/* =====================================================================
   ORTEM HELLAS · RoboProgrammer
   Friendly Robotics Command Center
   Brand palette derived from the ORTEM mark: petrol + mint
   ===================================================================== */

:root {
    /* --- Brand core (from the logo) --- */
    --ink:        #00222e;   /* deepest petrol, backgrounds */
    --ink-2:      #002b3a;
    --petrol:     #003c48;   /* primary brand dark */
    --petrol-3:   #0a4c5a;
    --mint:       #60b4a8;   /* brand mint */
    --mint-bright:#7fe3d1;   /* glow mint */
    --mint-soft:  #cdeee8;

    /* --- Kid-delight toy accents (used sparingly) --- */
    --coral:  #ff7a66;
    --amber:  #ffc24b;
    --grape:  #9b8cff;

    /* --- Light surfaces --- */
    --paper:   #f1faf8;
    --paper-2: #e6f4f1;
    --white:   #ffffff;

    --text:        #0a2730;
    --text-muted:  #5b7a82;
    --text-on-dark:#dff3ef;
    --muted-on-dark:#8fb6b9;

    --line: rgba(0, 60, 72, 0.12);

    --display: "Fredoka", "Nunito", system-ui, sans-serif;
    --ui:      "Nunito", system-ui, -apple-system, Segoe UI, sans-serif;
    --mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

    --r-lg: 30px;
    --r-md: 20px;
    --r-sm: 14px;

    --shadow-soft: 0 24px 60px rgba(0, 34, 46, 0.16);
    --shadow-card: 0 18px 44px rgba(0, 40, 58, 0.14);
    --shadow-glow: 0 0 0 1px rgba(127, 227, 209, 0.18),
                   0 18px 50px rgba(0, 196, 168, 0.22);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--ui);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Light app background (blockly page) */
body {
    background:
        radial-gradient(900px 500px at 12% -5%, rgba(96, 180, 168, 0.20), transparent 60%),
        radial-gradient(800px 480px at 100% 0%, rgba(0, 60, 72, 0.10), transparent 55%),
        linear-gradient(160deg, #eef8f6 0%, #f6fbfa 45%, #eaf4f5 100%);
    overflow-x: hidden;
}

a { color: inherit; }

/* faint engineering grid behind everything */
body::before {
    content: "";
    position: fixed; inset: 0; z-index: -3;
    background-image:
        linear-gradient(rgba(0, 60, 72, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 60, 72, 0.045) 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 80%);
            mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 80%);
    pointer-events: none;
}

/* =====================================================================
   Buttons
   ===================================================================== */
.btn,
.styled-button,
.primary-button {
    font-family: var(--ui);
    border: none;
    cursor: pointer;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
    padding: 14px 24px;
    color: #062b30;
    background: linear-gradient(135deg, var(--mint-bright), var(--mint));
    box-shadow: 0 14px 30px rgba(0, 160, 140, 0.30),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: transform .16s cubic-bezier(.2,.9,.3,1.4),
                box-shadow .2s ease, filter .2s ease;
}
.btn:hover,
.styled-button:hover,
.primary-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0, 160, 140, 0.40),
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
    filter: saturate(1.08);
}
.btn:active,
.styled-button:active,
.primary-button:active { transform: translateY(0) scale(.97); }

.btn:disabled,
.styled-button:disabled,
.primary-button:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.social-links {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.social-links a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 180, 216, 0.10);
    border: 1px solid rgba(0, 180, 216, 0.22);
    color: #0077B6;
    text-decoration: none;
    font-size: 17px;
    transition: all 0.22s ease;
}

.social-links a:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #00B4D8, #0077B6);
    color: #FFFFFF;
    box-shadow: 0 10px 24px rgba(0, 119, 182, 0.24);
}

@media (max-width: 480px) {
    .social-links {
        gap: 8px;
    }

    .social-links a {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }
}

.cf-turnstile {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

.login-divider {
    margin: 22px 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(0, 60, 72, 0.55);
    font-size: 13px;
    font-weight: 800;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(0, 60, 72, 0.14);
}

.social-login-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.provider-button {
    height: 48px;
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    transition: all 0.22s ease;
    background: #ffffff;
    color: #102A43;
    box-shadow: inset 0 0 0 1px rgba(0, 60, 72, 0.12);
}

.provider-button i {
    font-size: 17px;
}

.provider-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 60, 72, 0.14);
}

.provider-button.google i {
    color: #DB4437;
}

.provider-button.microsoft i {
    color: #00A4EF;
}

@media (max-width: 520px) {
    .social-login-buttons {
        grid-template-columns: 1fr;
    }
}


.robot-form input[readonly] {
    cursor: default;
    opacity: 0.95;
    background: rgba(255, 255, 255, 0.72);
}

.robot-auto-note {
    margin: 8px 0 0;
    font-family: var(--ui);
    font-size: 12px;
    font-weight: 800;
    color: rgba(0, 60, 72, 0.62);
    line-height: 1.35;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-on-dark);
    border: 1px solid rgba(127, 227, 209, 0.28);
    box-shadow: none;
    font-weight: 700;
}
.btn-ghost:hover {
    background: rgba(127, 227, 209, 0.14);
    box-shadow: none;
    filter: none;
}

/* The big "send to robot" button */
.btn-launch {
    position: relative;
    overflow: hidden;

    min-height: 38px;
    padding: 9px 16px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    border: none;
    border-radius: 999px;

    background: linear-gradient(135deg, var(--coral), var(--amber));
    color: #3a1300;

    font-family: var(--ui);
    font-size: 12.5px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;

    cursor: pointer;

    box-shadow:
        0 10px 22px rgba(255, 122, 102, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);

    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        filter 0.16s ease;
}

.btn-launch:hover {
    transform: translateY(-2px);
    box-shadow:
        0 14px 28px rgba(255, 122, 102, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    filter: saturate(1.06);
}

.btn-launch:active {
    transform: translateY(0) scale(0.97);
}

.btn-launch:disabled {
    opacity: 0.68;
    cursor: not-allowed;
    transform: none;
}

.btn-launch .rocket {
    display: inline-block;
    font-size: 14px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.btn-launch:hover .rocket {
    transform: translateX(3px) translateY(-2px) rotate(8deg);
}
/* shimmer sweep */
.btn-launch::after {
    content: "";
    position: absolute; top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
    transform: skewX(-18deg);
    animation: sweep 3.6s ease-in-out infinite;
}
@keyframes sweep { 0%,55% { left: -120%; } 80%,100% { left: 140%; } }

/* =====================================================================
   THE ROBOT  — the signature element (built from the ORTEM orbital eye)
   ===================================================================== */
.robot {
    --size: 200px;
    position: relative;
    width: var(--size);
    height: calc(var(--size) * 1.1);
    margin-inline: auto;
    font-size: calc(var(--size) * 0.1); /* 1em = size/10, so parts scale */
    animation: bob 3.4s ease-in-out infinite;
    transform-origin: 50% 90%;
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(-1deg); } }

/* antenna */
.robot .antenna {
    position: absolute; left: 50%; top: -0.3em;
    width: 0.2em; height: 1.3em; border-radius: 0.2em;
    background: var(--mint);
    transform: translateX(-50%);
}
.robot .antenna::after {
    content: ""; position: absolute; left: 50%; top: -0.6em;
    width: 0.8em; height: 0.8em; border-radius: 50%;
    transform: translateX(-50%);
    background: var(--amber);
    box-shadow: 0 0 0 0 rgba(255, 194, 75, 0.7);
    animation: signal 1.8s ease-out infinite;
}
@keyframes signal {
    0%   { box-shadow: 0 0 0 0 rgba(255,194,75,.7); }
    70%  { box-shadow: 0 0 0 14px rgba(255,194,75,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,194,75,0); }
}

/* head */
.robot .head {
    position: absolute; left: 50%; top: 0.9em;
    width: 78%; aspect-ratio: 1.18 / 1;
    transform: translateX(-50%);
    border-radius: 1.7em;
    background: linear-gradient(180deg, #ffffff, #e4f6f2);
    border: 0.15em solid rgba(0, 60, 72, 0.10);
    box-shadow: inset 0 -0.5em 1.2em rgba(96, 180, 168, 0.22),
                var(--shadow-card);
}
/* ears / bolts */
.robot .head::before,
.robot .head::after {
    content: ""; position: absolute; top: 42%;
    width: 0.6em; height: 1.3em; border-radius: 0.4em;
    background: var(--mint);
}
.robot .head::before { left: -0.5em; }
.robot .head::after  { right: -0.5em; }

/* the ORTEM eye/face screen */
.robot .face {
    position: absolute; left: 50%; top: 50%;
    width: 72%; height: 56%;
    transform: translate(-50%, -52%);
    border-radius: 1.1em;
    background:
        radial-gradient(120% 140% at 50% 0%, #073642, #021c25);
    box-shadow: inset 0 0 0 0.1em rgba(127, 227, 209, 0.18),
                inset 0 0.4em 1em rgba(0,0,0,0.5);
    overflow: hidden;
}
/* scanning sweep line across the face */
.robot .face::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(127,227,209,.12) 50%, transparent 60%);
    transform: translateY(-100%);
    animation: scan 3s linear infinite;
}
@keyframes scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(120%); } }

.robot .eyes {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    gap: 16%;
}
.robot .eye {
    width: 22%; aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--mint-bright), var(--mint) 60%, #1c6e66);
    box-shadow: 0 0 16px rgba(127, 227, 209, 0.9);
    transition: transform .18s ease;
    animation: blink 4.2s infinite;
}
@keyframes blink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.08); }
}
.robot.is-happy .eye { animation: none; transform: scaleY(0.5) translateY(-10%); }
.robot.is-thinking .eye { background: radial-gradient(circle at 35% 30%, var(--amber), #e89a17); box-shadow: 0 0 16px rgba(255,194,75,.9); }

/* mouth / speaker grill */
.robot .mouth {
    position: absolute; left: 50%; bottom: 14%;
    transform: translateX(-50%);
    width: 38%; height: 8%;
    border-radius: 999px;
    background: rgba(127, 227, 209, 0.55);
    box-shadow: 0 0 12px rgba(127,227,209,.5);
}
.robot.is-happy .mouth { height: 16%; border-radius: 0 0 999px 999px; background: var(--mint-bright); }

/* little waving arm */
.robot .arm {
    position: absolute; right: 2%; top: 56%;
    width: 0.7em; height: 2.2em; border-radius: 999px;
    background: var(--mint);
    transform-origin: top center;
    animation: wave 3.4s ease-in-out infinite;
}
@keyframes wave {
    0%, 60%, 100% { transform: rotate(8deg); }
    70% { transform: rotate(-26deg); }
    80% { transform: rotate(10deg); }
    90% { transform: rotate(-20deg); }
}

/* body / chip */
.robot .body {
    position: absolute; left: 50%; bottom: 0;
    width: 58%; height: 26%;
    transform: translateX(-50%);
    border-radius: 0.8em 0.8em 1em 1em;
    background: linear-gradient(180deg, var(--petrol), var(--ink-2));
    box-shadow: var(--shadow-card);
}
.robot .body::after {
    content: ""; position: absolute; left: 50%; top: 30%;
    transform: translateX(-50%);
    width: 40%; height: 30%; border-radius: 0.3em;
    background: repeating-linear-gradient(90deg, var(--mint) 0 0.2em, transparent 0.2em 0.4em);
    opacity: .8;
}

/* speech bubble (kid delight) */
.robot .speech {
    position: absolute; right: -70%; top: -6%;
    background: var(--white);
    color: var(--petrol);
    font-family: var(--display);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 14px 14px 14px 4px;
    box-shadow: var(--shadow-card);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(6px) scale(.9);
    transition: .25s cubic-bezier(.2,.9,.3,1.4);
}
.robot:hover .speech { opacity: 1; transform: translateY(0) scale(1); }

/* shadow puddle */
.robot::after {
    content: ""; position: absolute; left: 50%; bottom: -14px;
    width: 56%; height: 14px; border-radius: 50%;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, rgba(0,40,55,.28), transparent);
    animation: puddle 3.4s ease-in-out infinite;
}
@keyframes puddle { 0%,100% { transform: translateX(-50%) scale(1); opacity:.85 } 50% { transform: translateX(-50%) scale(.82); opacity:.6 } }

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
body.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 26px;
    background:
        radial-gradient(1000px 600px at 80% -10%, rgba(96,180,168,.16), transparent 60%),
        radial-gradient(800px 600px at 0% 110%, rgba(127,227,209,.10), transparent 60%),
        linear-gradient(160deg, #021c25 0%, #00303c 55%, #053844 100%);
}

.login-shell {
    width: min(1060px, 96vw);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 16, 24, 0.55);
}

/* --- left: dark command hero --- */
.hero-panel {
    position: relative;
    padding: 46px 44px;
    color: var(--text-on-dark);
    background:
        radial-gradient(600px 320px at 18% 8%, rgba(96,180,168,.28), transparent 60%),
        linear-gradient(160deg, #00333f, #021c25 70%);
    overflow: hidden;
    display: flex; flex-direction: column;
}
/* floating ambient particles */
.hero-panel .orbit {
    position: absolute; border-radius: 50%;
    border: 1px dashed rgba(127, 227, 209, 0.22);
    pointer-events: none;
}
.hero-panel .orbit.o1 { width: 360px; height: 360px; right: -120px; top: -90px; animation: spin 36s linear infinite; }
.hero-panel .orbit.o2 { width: 220px; height: 220px; right: -40px; top: 20px; animation: spin 24s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-panel .spark {
    position: absolute; width: 6px; height: 6px; border-radius: 50%;
    background: var(--mint-bright); opacity: .5;
    animation: drift 7s ease-in-out infinite alternate;
}
.hero-panel .spark:nth-child(3){ left: 14%; top: 30%; }
.hero-panel .spark:nth-child(4){ left: 30%; bottom: 18%; animation-delay: 1.2s; background: var(--amber); }
.hero-panel .spark:nth-child(5){ left: 70%; top: 24%; animation-delay: 2.1s; background: var(--coral); }
@keyframes drift { to { transform: translate(10px, -16px); opacity: 1; } }

.hero-logo { width: 188px; height: auto; position: relative; z-index: 2; }

.hero-robot-wrap { position: relative; z-index: 2; margin: 26px 0 8px; }
.hero-robot-wrap .robot { --size: 178px; }

.hero-panel h1 {
    position: relative; z-index: 2;
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(34px, 4.4vw, 52px);
    line-height: 1.02;
    margin: 8px 0 0;
    letter-spacing: -0.01em;
    color: #ffffff;
}
.hero-panel h1 .accent { color: var(--mint-bright); }

.hero-panel .sub {
    position: relative; z-index: 2;
    margin: 14px 0 0;
    max-width: 420px;
    font-size: 17px;
    line-height: 1.55;
    color: var(--muted-on-dark);
}

.feature-pills {
    position: relative; z-index: 2;
    display: flex; flex-wrap: wrap; gap: 9px;
    margin-top: 26px;
}
.feature-pills span {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.02em;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--mint-bright);
    background: rgba(127, 227, 209, 0.08);
    border: 1px solid rgba(127, 227, 209, 0.22);
}

/* --- right: clean light card --- */
.login-card {
    background: var(--white);
    padding: 48px 44px;
    display: flex; flex-direction: column; justify-content: center;
}

.login-eyebrow {
    font-family: var(--mono);
    font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--mint);
    display: flex; align-items: center; gap: 8px;
}
.login-eyebrow .live {
    width: 8px; height: 8px; border-radius: 50%; background: var(--mint);
    box-shadow: 0 0 0 0 rgba(96,180,168,.7); animation: pulse 1.8s infinite;
}
.login-card h2 {
    font-family: var(--display); font-weight: 600;
    font-size: 34px; margin: 10px 0 6px; color: var(--petrol);
}
.login-card .lead { margin: 0 0 22px; color: var(--text-muted); font-size: 15px; }

.field { margin-bottom: 14px; }
.field label {
    display: block; margin: 0 0 7px;
    font-weight: 800; font-size: 13.5px; color: var(--petrol);
    letter-spacing: 0.01em;
}
.input-wrap {
    display: flex; align-items: center; gap: 10px;
    height: 54px; padding: 0 16px;
    border-radius: var(--r-sm);
    background: var(--paper);
    border: 2px solid transparent;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.input-wrap:focus-within {
    background: var(--white);
    border-color: var(--mint);
    box-shadow: 0 0 0 4px rgba(96, 180, 168, 0.16);
}
.input-wrap .ico { width: 20px; height: 20px; flex: 0 0 auto; color: var(--mint); }
.input-wrap input {
    width: 100%; border: none; outline: none; background: transparent;
    font-family: var(--ui); font-size: 16px; font-weight: 600; color: var(--text);
}
.input-wrap input::placeholder { color: #9bb5b9; font-weight: 500; }

.login-card form .styled-button,
.login-card form .btn { width: 100%; margin-top: 18px; }

.error-message {
    color: #e2455f; min-height: 22px; margin: 14px 0 0;
    text-align: center; font-weight: 800; font-size: 14px;
}

.footer-links {
    display: flex; justify-content: center; gap: 18px;
    flex-wrap: wrap; margin-top: 22px;
}
.footer-link {
    color: var(--mint); font-size: 13.5px; font-weight: 800;
    text-decoration: none; cursor: pointer; position: relative;
}
.footer-link:hover { text-decoration: underline; }

.tooltip {
    visibility: hidden; opacity: 0;
    position: absolute; width: 250px; left: 50%; bottom: 26px;
    transform: translateX(-50%) translateY(6px);
    padding: 12px 14px; border-radius: 14px;
    background: var(--petrol); color: #eafaf7;
    font-size: 12px; font-weight: 600; line-height: 1.45;
    box-shadow: var(--shadow-card);
    transition: .2s ease; z-index: 200;
}
.footer-link:hover .tooltip { visibility: visible; opacity: 1; transform: translateX(-50%) translateY(0); }

.powered-by { margin-top: 9px; text-align: center; }
.powered-by img { width: 274px; height: auto; opacity: .9; }

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(96,180,168,.55); }
    70%  { box-shadow: 0 0 0 9px rgba(96,180,168,0); }
    100% { box-shadow: 0 0 0 0 rgba(96,180,168,0); }
}

/* =====================================================================
   BLOCKLY APP PAGE
   ===================================================================== */
body.blockly-page { min-height: 100vh; overflow: hidden; }

.app-header {
    height: 92px;
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.62));
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.app-brand > div:last-child {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "logo title"
        "logo subtitle";
    column-gap: 14px;
    align-items: center;
    min-width: 0;
}

.header-logo {
    grid-area: logo;
    width: 135px;
    max-width: 135px;
    height: auto;
    display: block;
    object-fit: contain;
}

.app-brand h1 {
    grid-area: title;
    font-family: var(--display);
    font-weight: 600;
    font-size: 26px;
    line-height: 1;
    margin: -11px;
    color: var(--petrol);
    letter-spacing: -.01em;
    white-space: nowrap;
}

.app-brand p {
    grid-area: subtitle;
    margin: -11px 0 0;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: .04em;
    white-space: nowrap;
}
.app-brand .badge-robot {
    width: 50px;
    height: 54px;
    flex: 0 0 auto;
}
.app-brand .badge-robot .robot { --size: 50px; margin: 0; }
.app-brand .badge-robot .robot .speech,
.app-brand .badge-robot .robot .arm { display: none; }


.app-user-area { display: flex; align-items: center; gap: 10px; }
.user-chip {
    max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 10px 15px; border-radius: 999px;
    background: var(--paper); border: 1px solid var(--line);
    color: var(--petrol); font-weight: 800; font-size: 13px;
    display: flex; align-items: center; gap: 8px;
}
.user-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(96,180,168,.6); animation: pulse 1.8s infinite; }

/* layout */
.programmer-layout {
    height: calc(100vh - 84px);
    padding: 18px 26px 26px;
    display: grid; grid-template-columns: 340px 1fr; gap: 18px;
}

.control-card, .workspace-card {
    background: rgba(255,255,255,.78);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}
.control-card {
    border-radius: var(--r-md); padding: 22px;
    display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
}

.panel-title { display: flex; align-items: center; gap: 12px; }
.panel-title .badge-robot { width: 46px; height: 50px; flex: 0 0 auto; }
.panel-title .badge-robot .robot { --size: 46px; margin: 0; }
.panel-title .badge-robot .robot .speech, .panel-title .badge-robot .robot .arm { display: none; }
.panel-title h2 { font-family: var(--display); font-weight: 600; font-size: 19px; margin: 0; color: var(--petrol); }
.panel-title p  { margin: 2px 0 0; color: var(--text-muted); font-size: 12.5px; line-height: 1.35; }

.robot-form { display: flex; flex-direction: column; gap: 10px; }
.field-label {
    font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--mint);
}
#robotIdInput {
    width: 100%; height: 50px; padding: 0 16px;
    border: 2px solid transparent; border-radius: var(--r-sm);
    background: var(--paper); color: var(--text);
    font-family: var(--mono); font-size: 14px; outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
#robotIdInput:focus {
    background: #fff; border-color: var(--mint);
    box-shadow: 0 0 0 4px rgba(96,180,168,.16);
}
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; padding: 12px 14px; font-size: 14px; }
.btn-row .btn.secondary {
    background: var(--paper); color: var(--petrol);
    box-shadow: inset 0 0 0 1px var(--line);
}
.btn-row .btn.secondary:hover { background: #fff; filter: none; }

/* block legend (teaches kids what the blocks do) */
.legend { display: flex; flex-direction: column; gap: 8px; }
.legend-head {
    font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--text-muted);
}
.legend-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 12px;
    background: var(--paper); font-weight: 700; font-size: 13px; color: var(--petrol);
}
.legend-swatch { width: 14px; height: 14px; border-radius: 5px; flex: 0 0 auto; }

/* live status console */
.console {
    margin-top: auto;
    border-radius: var(--r-sm);
    background: linear-gradient(180deg, #022730, #02323d);
    color: var(--mint-bright);
    font-family: var(--mono); font-size: 12px; line-height: 1.7;
    padding: 14px 16px;
    border: 1px solid rgba(127,227,209,.16);
}
.console .row { display: flex; align-items: center; gap: 8px; color: #bfe9e2; }
.console .ok { color: var(--mint-bright); }
.console .pulse-dot {
    width: 9px; height: 9px; border-radius: 50%; background: var(--mint-bright);
    box-shadow: 0 0 0 0 rgba(127,227,209,.7); animation: pulse 1.6s infinite;
}
.console .caret::after { content: "▌"; animation: caret 1s steps(1) infinite; color: var(--mint-bright); }
@keyframes caret { 50% { opacity: 0; } }


.logout-button {
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    border: 1px solid rgba(255, 122, 102, 0.28);
    border-radius: 999px;

    background: rgba(255, 122, 102, 0.12);
    color: #b83a2b;

    font-family: var(--ui);
    font-size: 13px;
    font-weight: 900;

    cursor: pointer;
    box-shadow:
        0 8px 18px rgba(255, 122, 102, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);

    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease,
        color 0.16s ease,
        border-color 0.16s ease;
}

.logout-button span {
    font-size: 14px;
    line-height: 1;
    opacity: 0.9;
}

.logout-button:hover {
    background: linear-gradient(135deg, #ff7a66, #ff9a66);
    border-color: rgba(255, 122, 102, 0.55);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow:
        0 12px 26px rgba(255, 122, 102, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.logout-button:active {
    transform: translateY(0) scale(0.97);
}

.logout-button:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 4px rgba(255, 122, 102, 0.20),
        0 8px 18px rgba(255, 122, 102, 0.14);
}



/* workspace */
.workspace-card {
    min-width: 0; border-radius: var(--r-md); padding: 16px;
    display: flex; flex-direction: column; overflow: hidden;
}
.workspace-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 2px 4px 14px;
}
.workspace-toolbar .ws-title h2 {
    font-family: var(--display); font-weight: 600; font-size: 18px; margin: 0; color: var(--petrol);
}
.workspace-toolbar .ws-title p { margin: 2px 0 0; color: var(--text-muted); font-size: 12.5px; }

#blocklyDiv {
    flex: 1;
    width: 100%;
    min-height: 0;
    border-radius: var(--r-sm);
    overflow: hidden;
    background:
        radial-gradient(600px 300px at 90% -10%, rgba(96,180,168,.10), transparent 60%),
        #ffffff;

    border: 2px solid rgba(96, 180, 168, 0.65);
    box-shadow:
        0 0 0 4px rgba(127, 227, 209, 0.20),
        0 18px 42px rgba(0, 60, 72, 0.14),
        inset 0 0 0 1px rgba(255,255,255,.7);
}

/* =========================================================
   Strong turquoise border around Blockly workspace section
   ========================================================= */

.workspace-card {
    border: 3px solid rgba(96, 180, 168, 0.85) !important;
    box-shadow:
        0 0 0 5px rgba(127, 227, 209, 0.18),
        0 22px 55px rgba(0, 60, 72, 0.18) !important;
}

#blocklyDiv {
    box-shadow:
        0 0 0 4px rgba(127, 227, 209, 0.26),
        inset 0 0 0 2px rgba(255, 255, 255, 0.85) !important;
}

/* Make the actual Blockly SVG also feel framed */
#blocklyDiv .blocklySvg {
    border-radius: 12px !important;
}

/* Mobile/tablet keep the same nice border */
@media (max-width: 1024px) {
    .workspace-card {
        border: 3px solid rgba(96, 180, 168, 0.88) !important;
        box-shadow:
            0 0 0 4px rgba(127, 227, 209, 0.20),
            0 14px 34px rgba(0, 60, 72, 0.16) !important;
    }

    #blocklyDiv {
        border: 3px solid rgba(0, 180, 216, 0.75) !important;
    }
}

/* Blockly chrome polish to match brand */
.blocklyToolboxDiv,
.blocklyFlyoutBackground { fill: rgba(241,250,248,.96) !important; background: rgba(241,250,248,.96) !important; }
.blocklyMainBackground { stroke: rgba(0,60,72,.10) !important; }
.blocklyScrollbarHandle { fill: rgba(0,60,72,.22) !important; }
.blocklyZoom > image, .blocklyZoom > svg > image { opacity: .85; }
.blocklyTrash { opacity: .85; }

/* celebration confetti layer */
.confetti-piece {
    position: fixed; top: -12px; width: 10px; height: 14px; border-radius: 2px;
    z-index: 9999; pointer-events: none; will-change: transform, opacity;
}


.mobile-panel-toggle,
.mobile-panel-close {
    display: none;
}

/* Social icons inside blockly page */
.blockly-page .workspace-card > .powered-by {
    margin-top: 10px;
    flex: 0 0 auto;
}

.blockly-page .workspace-card > .powered-by .social-links {
    margin-top: 0;
    padding-top: 8px;
}

/* Mobile/tablet drawer */
.mobile-panel-overlay {
    display: none;
}

body.blockly-page.auth-checking .programmer-layout,
body.blockly-page.auth-checking .app-header {
    visibility: hidden;
}

@media (max-width: 1024px) {
    body.blockly-page {
        overflow: hidden;
    }

    .app-header {
        height: auto;
        min-height: 74px;
        padding: 10px 12px;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand panel"
            "user user";
        gap: 10px;
        align-items: center;
    }

    .app-brand {
        grid-area: brand;
        justify-content: flex-start;
        min-width: 0;
    }

    .app-brand .badge-robot {
        display: none;
    }

    .app-brand > div:last-child {
        column-gap: 8px;
    }

    .header-logo {
        width: 92px;
        max-width: 92px;
    }

    .app-brand h1 {
        font-size: 20px;
        margin: 0;
    }

    .app-brand p {
        font-size: 9.5px;
        margin: 2px 0 0;
    }

    .app-user-area {
        grid-area: user;
        display: flex;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
    }

    .user-chip {
        flex: 1;
        max-width: none;
        min-width: 0;
        font-size: 12px;
        padding: 8px 10px;
    }

    .logout-button {
        flex: 0 0 auto;
        height: 34px;
        padding: 0 11px;
        font-size: 12px;
    }

    .mobile-panel-toggle {
        grid-area: panel;
        height: 38px;
        padding: 0 14px;
        border: 1px solid rgba(96, 180, 168, 0.42);
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: linear-gradient(135deg, var(--mint-bright), var(--mint));
        color: #062b30;
        font-family: var(--ui);
        font-size: 13px;
        font-weight: 900;
        cursor: pointer;
        box-shadow: 0 10px 22px rgba(0, 160, 140, 0.18);
    }

    .programmer-layout {
        height: calc(100dvh - 124px);
        padding: 10px;
        display: block;
    }

    .workspace-card {
        height: 100%;
        padding: 10px;
        border-radius: 18px;
        border: 2px solid rgba(96, 180, 168, 0.55);
    }

    .workspace-toolbar {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 2px 2px 10px;
    }

    .workspace-toolbar .ws-title {
        min-width: 0;
    }

    .workspace-toolbar .ws-title h2 {
        font-size: 15px;
        white-space: nowrap;
    }

    .workspace-toolbar .ws-title p {
        display: none;
    }

    .workspace-toolbar .btn-launch {
        width: auto;
        min-width: 116px;
        height: 36px;
        padding: 8px 11px;
        font-size: 10.5px;
        white-space: nowrap;
    }

    #blocklyDiv {
        min-height: 0;
        height: auto;
        flex: 1 1 auto;
    }

    .control-card {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 10010;
        width: min(86vw, 360px);
        height: 100dvh;
        border-radius: 0 26px 26px 0;
        padding: 54px 18px 18px;
        transform: translateX(-110%);
        transition: transform 0.25s ease;
        box-shadow: 24px 0 60px rgba(0, 34, 46, 0.28);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    body.mobile-panel-open .control-card {
        transform: translateX(0);
    }

    .mobile-panel-close {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 34px;
        height: 34px;
        border: none;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 122, 102, 0.14);
        color: #b83a2b;
        cursor: pointer;
        font-size: 15px;
    }

    .mobile-panel-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: rgba(0, 34, 46, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    body.mobile-panel-open .mobile-panel-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 520px) {
    .programmer-layout {
        height: calc(100dvh - 132px);
        padding: 8px;
    }

    .workspace-card {
        padding: 8px;
    }

    .workspace-toolbar .ws-title h2 {
        font-size: 14px;
    }

    .workspace-toolbar .btn-launch {
        min-width: 104px;
        padding: 7px 9px;
        font-size: 9.8px;
    }

    .blockly-page .workspace-card > .powered-by {
        margin-top: 6px;
    }

    .blockly-page .social-links {
        gap: 7px;
    }

    .blockly-page .social-links a {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
}

/* =====================================================================
   Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1100px) {
    .programmer-layout { grid-template-columns: 300px 1fr; }
}
@media (max-width: 860px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .hero-panel {
        display: none;
    }

    .login-card {
        padding: 40px 26px;
    }
}

@media (max-width: 520px) {
    .login-card h2 {
        font-size: 28px;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
}
@media (max-height: 560px) and (orientation: landscape) {
    .hero-panel { display: none; }
    .login-shell { grid-template-columns: 1fr; max-width: 460px; }
    .app-header { height: 60px; padding: 8px 16px; }
    .app-brand p, .panel-title p { display: none; }
    .programmer-layout { height: calc(100vh - 60px); grid-template-columns: 260px 1fr; padding: 10px; }
}



.robot-toast {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 99999;

    max-width: 380px;
    padding: 14px 18px;

    display: flex;
    align-items: center;
    gap: 10px;

    border-radius: 18px;
    font-family: var(--ui);
    font-size: 14px;
    font-weight: 900;

    opacity: 0;
    transform: translateY(18px) scale(0.96);

    box-shadow: 0 18px 40px rgba(0, 34, 46, 0.24);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.robot-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.robot-toast-icon {
    font-size: 20px;
    line-height: 1;
}

.robot-toast.success {
    background: linear-gradient(135deg, var(--mint-bright), var(--mint));
    color: #062b30;
}

.robot-toast.error {
    background: linear-gradient(135deg, var(--coral), #e2455f);
    color: #ffffff;
}

.btn-launch.is-sending {
    filter: saturate(1.1);
    cursor: wait;
}

@media (max-width: 600px) {
    .robot-toast {
        left: 16px;
        right: 16px;
        bottom: 18px;
        max-width: none;
        justify-content: center;
        text-align: center;
    }
}