:root {
    --bg: #02060b;
    --ink: #e9fff4;
    --muted: #6fae8e;
    --green: #25f59a;
    --green-dim: #0f7d52;
    --blue: #36a3ff;
    --gold: #ffd24a;
    --danger: #ff5d73;
    --line: rgba(37,245,154,0.16);
    --glass: rgba(6,18,14,0.62);
    --mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", ui-monospace, Consolas, Menlo, monospace;
    --display: "Bubblegum Sans", system-ui, sans-serif;   /* whimsical face */
  }

  /* whimsical Bubblegum Sans on the expressive surfaces; mono stays on the
     terminal chrome (path bar, input) so it still reads as a real console */
  .splash-logo, .splash-tag, .splash-intro, .splash-speech,
  .logo, .tagline, .field-label, .eyebrow, .number, .number-label,
  .interpretation, .decode, .bg-bubble, .bg-name-tag,
  footer, .start-activate, .splash-eyebrow {
    font-family: var(--display);
  }
  /* Bubblegum Sans runs small & thin — nudge sizes/spacing to compensate */
  .bg-bubble { font-size: 17.5px; letter-spacing: .2px; line-height: 1.38; }  /* fills leftover room; scrolls if needed */
  .number { letter-spacing: 1px; }
  .decode { letter-spacing: 2px; }
  /* the big number stays hidden while he builds up to it, then drops in */
  .result .number, .result .number-label { transition: opacity .4s ease, transform .4s ease; }
  .result.num-hidden .number, .result.num-hidden .number-label { opacity: 0; transform: translateY(12px); }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--mono);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;            /* page never scrolls */
    overscroll-behavior: none;
  }

  /* ---- Matrix rain ---- */
  #matrix {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
  }
  /* vignette + readability veil over the rain */
  .veil {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
      radial-gradient(120% 90% at 50% 0%, rgba(54,163,255,0.10), transparent 55%),
      radial-gradient(100% 80% at 50% 100%, rgba(37,245,154,0.10), transparent 60%),
      radial-gradient(80% 65% at 50% 45%, rgba(2,6,11,0.12), rgba(2,6,11,0.58) 100%);
  }
  /* subtle CRT scanlines */
  .scan {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.20;
    background: repeating-linear-gradient(
      to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.18) 3px);
    mix-blend-mode: multiply;
  }

  /* ---- Layout: snap to viewport, flex column ---- */
  .stage {
    position: relative;
    z-index: 3;
    height: 100dvh;
    height: 100vh;             /* fallback */
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
      calc(clamp(10px, 2.4vh, 22px) + env(safe-area-inset-top))
      calc(clamp(10px, 3vw, 24px) + env(safe-area-inset-right))
      calc(clamp(10px, 2.4vh, 22px) + env(safe-area-inset-bottom))
      calc(clamp(10px, 3vw, 24px) + env(safe-area-inset-left));
  }

  .console {
    width: min(660px, 100%);
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--glass);
    backdrop-filter: blur(7px) saturate(1.1);
    -webkit-backdrop-filter: blur(7px) saturate(1.1);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow:
      0 0 0 1px rgba(0,0,0,0.4),
      0 24px 70px rgba(0,0,0,0.6),
      0 0 60px rgba(37,245,154,0.10),
      inset 0 1px 0 rgba(255,255,255,0.04);
    overflow: hidden;
  }

  /* titlebar */
  .bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(37,245,154,0.06), transparent);
    flex: 0 0 auto;
  }
  .dot { width: 11px; height: 11px; border-radius: 50%; opacity: .9; }
  .dot.r { background: #ff5f57; } .dot.y { background: #febc2e; } .dot.g { background: #28c840; }
  .bar .path {
    margin-left: 8px; color: var(--green); font-family: var(--display);
    font-size: 15px; letter-spacing: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* the bar plays a quick "boot" then folds away to free the screen */
  .bar.boot-done {
    max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0;
    border-bottom-color: transparent; overflow: hidden;
    transition: max-height .55s ease, padding .55s ease, opacity .45s ease;
  }
  .bar .live {
    margin-left: auto; color: var(--green); font-size: 11px; letter-spacing: 1.5px;
    display: flex; align-items: center; gap: 6px;
  }
  .bar .live::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 10px var(--green);
    animation: pulse 1.4s ease-in-out infinite;
  }
  @keyframes pulse { 0%,100% { opacity:1; transform: scale(1);} 50%{opacity:.35; transform: scale(.7);} }

  /* body of console: header + input + output (flex fill) */
  .body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(10px, 1.6vh, 15px);
    gap: clamp(8px, 1.1vh, 12px);
  }

  header { text-align: center; flex: 0 0 auto; }
  .logo {
    font-weight: 800;
    font-size: clamp(30px, 7vw, 50px);
    letter-spacing: clamp(8px, 3vw, 16px);
    margin: 0;
    padding-left: 0.4em;
    color: var(--green);
    text-shadow:
      0 0 6px rgba(37,245,154,0.9),
      0 0 22px rgba(37,245,154,0.55),
      0 0 50px rgba(37,245,154,0.30);
    animation: flicker 5s infinite steps(1);
  }
  @keyframes flicker {
    0%, 92%, 100% { opacity: 1; }
    93% { opacity: .55; } 94% { opacity: 1; } 96% { opacity: .7; } 97% { opacity: 1; }
  }
  .tagline { color: var(--muted); font-size: clamp(11px, 2.6vw, 13px); margin-top: 6px; }
  .tagline .cur { color: var(--green); animation: blink 1.05s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }

  .field-label {
    display: block; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
    color: var(--green); margin-bottom: 7px;
    text-shadow: 0 0 10px rgba(37,245,154,0.4);
  }
  .field-label::before { content: "› "; color: var(--green); font-weight: 800; }
  textarea {
    width: 100%;
    height: 46px;                                  /* one line; JS grows it as you type */
    min-height: 46px;
    max-height: clamp(120px, 30vh, 240px);         /* then it caps and scrolls */
    resize: none;
    overflow-y: auto;
    background: rgba(3,12,9,0.85);
    border: 1.5px solid rgba(37,245,154,0.55);
    border-radius: 11px;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 14.5px;
    line-height: 1.45;
    padding: 11px 13px;
    outline: none;
    box-shadow: 0 0 0 1px rgba(37,245,154,0.12), inset 0 0 18px rgba(37,245,154,0.10);
    transition: border-color .15s, box-shadow .15s;
    animation: inputBreathe 2.8s ease-in-out infinite;
  }
  /* idle glow so it's obvious where to type */
  @keyframes inputBreathe {
    0%,100% { box-shadow: 0 0 0 1px rgba(37,245,154,0.14), 0 0 14px rgba(37,245,154,0.10); }
    50%     { box-shadow: 0 0 0 1px rgba(37,245,154,0.30), 0 0 26px rgba(37,245,154,0.26); }
  }
  textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(54,163,255,0.28), 0 0 30px rgba(54,163,255,0.28);
    animation: none;
  }
  textarea::placeholder { color: #6aa98d; }

  /* search-bar row: [🔍 field .............] [DECODE] */
  .search { display: flex; align-items: stretch; gap: 8px; flex: 0 0 auto; }
  .search-field { position: relative; flex: 1 1 auto; display: flex; min-width: 0; }
  .search-field textarea { padding-left: 38px; }
  .search-ico {
    position: absolute; left: 12px; top: 23px; transform: translateY(-50%);
    font-size: 15px; opacity: .65; pointer-events: none; z-index: 1;
  }
  .search .decode { flex: 0 0 auto; align-self: flex-end; height: 46px; padding: 0 16px; }

  .controls { display: flex; gap: 9px; flex: 0 0 auto; flex-wrap: wrap; }
  button.decode {
    flex: 1 1 auto;
    appearance: none; border: none; cursor: pointer;
    font-family: var(--mono); font-weight: 800; font-size: 15px; letter-spacing: 3px;
    color: #02140c; padding: 13px 16px; border-radius: 11px;
    background: linear-gradient(90deg, var(--green), #6bffc0);
    box-shadow: 0 8px 22px rgba(37,245,154,0.35), 0 0 0 1px rgba(37,245,154,0.5) inset;
    transition: transform .08s, filter .15s;
  }
  button.decode:hover { filter: brightness(1.07); }
  button.decode:active { transform: translateY(1px); }
  button.decode:disabled { opacity: .6; cursor: not-allowed; }
  button.ghost {
    appearance: none; cursor: pointer; font-family: var(--mono); font-size: 13px;
    color: var(--muted); background: rgba(255,255,255,0.02);
    border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px;
    transition: color .15s, border-color .15s, box-shadow .15s; white-space: nowrap;
  }
  button.ghost:hover { color: var(--ink); border-color: var(--blue); box-shadow: 0 0 16px rgba(54,163,255,0.15); }
  button.ghost.icon { flex: 0 0 auto; padding: 12px; min-width: 44px; text-align: center; }

  /* output region fills remaining height; ONLY this can scroll, never the page */
  .output {
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(1,5,4,0.72);
    overflow: hidden;
    display: flex;
    flex-direction: column;     /* BG123 on top, the big number under him */
    position: relative;
  }

  .terminal {
    width: 100%;
    padding: 12px 14px;
    font-size: 12.5px; line-height: 1.7; color: var(--green);
    overflow-y: auto;
    display: none;
  }
  .terminal.show { display: block; }
  .terminal .line { white-space: pre-wrap; word-break: break-word; }
  .terminal .dim { color: var(--green-dim); }
  .terminal .warn { color: var(--gold); }
  .cursor-line::after { content: "▋"; color: var(--green); animation: blink 1s steps(1) infinite; }

  /* idle hint */
  .hint {
    margin: auto; text-align: center; color: #2f6650; font-size: 12.5px;
    padding: 18px; line-height: 1.7;
  }
  .hint .big { color: var(--green-dim); font-size: 14px; display:block; margin-bottom: 4px; }

  /* result */
  .result {
    width: 100%;
    flex: 0 0 auto;            /* pinned under him — the number always stays visible */
    padding: clamp(8px, 1.4vh, 14px);
    overflow-x: hidden;        /* long "exact" decimal clips off the edge */
    display: none;
    text-align: center;
    animation: kickout .5s cubic-bezier(.2,.9,.3,1.25);
  }
  .result.show { display: block; }
  /* —— stripped-down output: just BG123 up top + the big number he's saying —— */
  .hint { display: none !important; }          /* no more "// awaiting input" hogging the box */
  .terminal { display: none !important; }       /* he narrates the decode instead of a trace box */
  .result .eyebrow,
  .result .interpretation,
  .result .meta,
  .result .proof,
  .result .result-actions { display: none !important; }
  @keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  /* the result "kicks out" once the scan finishes */
  @keyframes kickout {
    0%   { transform: translateY(28px) scale(.95); opacity: 0; }
    55%  { transform: translateY(-7px) scale(1.015); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
  }

  /* ---- uploaded image preview (lives only in the browser) ---- */
  .preview {
    width: 100%; height: 100%;
    display: none; align-items: center; justify-content: center;
    padding: 12px; position: relative;
  }
  .preview.show { display: flex; }
  .preview img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    border-radius: 8px; border: 1px solid var(--line);
    box-shadow: 0 0 26px rgba(0,0,0,0.55);
  }
  /* toxic green↔red flicker while the beams sweep the image */
  .preview.scanning img { animation: scanTint 0.7s steps(1) infinite; }
  @keyframes scanTint {
    0%, 49%   { filter: sepia(1) saturate(4) hue-rotate(58deg) brightness(0.95) contrast(1.1); }  /* green */
    50%, 100% { filter: sepia(1) saturate(5) hue-rotate(-28deg) brightness(1.0) contrast(1.15); } /* red */
  }

  /* big "CAPTURED" stamp that flashes before the verdict */
  .capture-flash {
    position: absolute; inset: 0; z-index: 6;
    display: none; align-items: center; justify-content: center;
    font-weight: 800; font-size: clamp(22px, 7vw, 44px); letter-spacing: 3px;
    color: var(--green);
    text-shadow: 0 0 14px rgba(37,245,154,0.95), 0 0 44px rgba(37,245,154,0.5);
    background: rgba(2,12,8,0.42);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    pointer-events: none;
  }
  .capture-flash.show { display: flex; animation: capturePop .34s cubic-bezier(.2,.9,.3,1.45); }
  @keyframes capturePop {
    0%   { transform: scale(.55); opacity: 0; }
    60%  { transform: scale(1.09); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
  }

  /* ---- red scanner beams that sweep the image (up/down + left/right) ---- */
  .scanner {
    position: absolute; inset: 0; z-index: 5;
    pointer-events: none; overflow: hidden; border-radius: 12px;
    display: none; background: rgba(40,0,6,0.10);
  }
  .scanner.on { display: block; }
  .scanner .beam-h {
    position: absolute; left: -2%; right: -2%; height: 3px; top: 0;
    background: linear-gradient(90deg,
      transparent 0%, rgba(255,93,115,0.15) 12%,
      #ff4d63 46%, #ff7e90 50%, #ff4d63 54%,
      rgba(255,93,115,0.15) 88%, transparent 100%);
    box-shadow: 0 0 16px 3px rgba(255,45,69,0.85), 0 0 42px 10px rgba(255,45,69,0.40);
    animation: scanSweepY 1.15s ease-in-out infinite alternate;
  }
  .scanner .beam-v {
    position: absolute; top: -2%; bottom: -2%; width: 3px; left: 0;
    background: linear-gradient(180deg,
      transparent 0%, rgba(255,93,115,0.15) 12%,
      #ff4d63 46%, #ff7e90 50%, #ff4d63 54%,
      rgba(255,93,115,0.15) 88%, transparent 100%);
    box-shadow: 0 0 16px 3px rgba(255,45,69,0.7), 0 0 42px 10px rgba(255,45,69,0.30);
    animation: scanSweepX 0.95s ease-in-out infinite alternate;
  }
  .scanner .scanner-label {
    position: absolute; top: 8px; right: 12px;
    font-size: 10px; letter-spacing: 3px; color: var(--danger);
    text-shadow: 0 0 10px rgba(255,45,69,0.8);
    animation: scanBlink 0.9s steps(1) infinite;
  }
  @keyframes scanSweepY { from { top: 5%; }  to { top: 95%; } }
  @keyframes scanSweepX { from { left: 5%; } to { left: 95%; } }
  @keyframes scanBlink { 50% { opacity: 0.25; } }

  /* ---- the "calculator" that pops out while he thinks ---- */
  .calc {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%) scale(.82);
    width: min(360px, 86%); z-index: 8;
    background: rgba(2,12,8,0.97); border: 1px solid rgba(37,245,154,0.5);
    border-radius: 14px; padding: 15px 17px; text-align: center;
    box-shadow: 0 18px 50px rgba(0,0,0,0.6), 0 0 30px rgba(37,245,154,0.18);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s ease, transform .26s cubic-bezier(.2,.9,.3,1.5);
  }
  .calc.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
  .calc-title { font-family: var(--mono); font-size: 10.5px; letter-spacing: 2px; color: var(--green); text-transform: uppercase; }
  .calc-readout {
    font-family: var(--mono); font-weight: 800; font-size: 40px; color: var(--blue);
    margin: 8px 0 6px; letter-spacing: 4px; text-shadow: 0 0 16px rgba(54,163,255,0.5);
  }
  .calc-rows { font-family: var(--mono); font-size: 11px; color: var(--muted); line-height: 1.55; min-height: 4.4em; text-align: left; }
  .calc-rows .ok { color: var(--green); float: right; }
  .calc-bar { margin-top: 8px; height: 6px; border-radius: 6px; background: rgba(37,245,154,0.12); overflow: hidden; }
  .calc-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #6bffc0); transition: width .25s linear; }

  .eyebrow { font-size: 10.5px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
  .number {
    font-weight: 800;
    font-size: clamp(54px, 15vh, 104px);
    line-height: 0.95;
    margin: 6px 0 2px;
    color: var(--gold);
    text-shadow: 0 0 14px rgba(255,210,74,0.7), 0 0 40px rgba(255,210,74,0.35);
    animation: glowpulse 2.4s ease-in-out infinite;
    transition: transform .13s cubic-bezier(.2,.9,.3,1.4);
  }
  @keyframes glowpulse {
    50% { text-shadow: 0 0 22px rgba(255,210,74,0.95), 0 0 60px rgba(255,210,74,0.5); }
  }
  /* countdown tick pop (3·2·1 → 589) */
  .number.bump { transform: scale(1.16); }
  /* while counting down, dim the gold a touch so 589 lands brighter */
  .number.counting { color: var(--blue); text-shadow: 0 0 14px rgba(54,163,255,0.6); }
  /* easter-egg "exact" decimal: never wraps, runs straight off the edge */
  .number.long {
    white-space: nowrap;
    text-align: left;
    font-size: clamp(38px, 11vh, 76px);
    letter-spacing: -1px;
    animation: none;            /* hold steady so the tail just disappears */
  }
  .number-label { font-size: 12.5px; color: var(--blue); letter-spacing: 1.5px; }
  /* the big number "detonates" when it lands */
  .number.boom { animation: numBoom .55s cubic-bezier(.2,.9,.3,1.5); }
  @keyframes numBoom {
    0%   { transform: scale(.4);  opacity: 0; filter: blur(6px); }
    55%  { transform: scale(1.18); opacity: 1; filter: blur(0); }
    100% { transform: scale(1); }
  }
  /* the number wears a different display font depending on the question */
  .number.f-bangers  { font-family: "Bangers", system-ui; letter-spacing: 3px; }
  .number.f-luckiest { font-family: "Luckiest Guy", system-ui; letter-spacing: 1px; }
  .number.f-monoton  { font-family: "Monoton", system-ui; font-weight: 400; }
  .number.f-orbitron { font-family: "Orbitron", sans-serif; }
  .number.f-bungee   { font-family: "Bungee", system-ui; font-size: clamp(46px, 12vh, 88px); }
  .number.f-shrikhand{ font-family: "Shrikhand", system-ui; font-weight: 400; }
  .number.f-rubikb   { font-family: "Rubik Bubbles", system-ui; font-weight: 400; }
  .number.f-titan    { font-family: "Titan One", system-ui; }
  .number.f-bubble   { font-family: "Bubblegum Sans", system-ui; }
  .interpretation { margin: 12px auto 0; max-width: 46ch; font-size: 14.5px; line-height: 1.55; color: var(--ink); }
  .interpretation b { color: var(--gold); }

  .meta { margin-top: 12px; display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
  .badge {
    font-size: 10px; letter-spacing: .8px; padding: 5px 9px; border-radius: 999px;
    border: 1px solid var(--line); color: var(--muted);
  }
  .badge.green { color: var(--green); border-color: rgba(37,245,154,0.4); }
  .badge.blue  { color: var(--blue);  border-color: rgba(54,163,255,0.4); }
  .badge.gold  { color: var(--gold);  border-color: rgba(255,210,74,0.4); }

  .proof {
    margin: 12px 0 0; font-size: clamp(8.5px, 2.5vw, 11px); color: var(--green-dim);
    background: rgba(1,6,4,0.9); border: 1px solid var(--line); border-radius: 10px;
    padding: 11px 12px; line-height: 1.5; text-align: left;
    white-space: pre; overflow-x: auto; overflow-y: hidden;
    font-family: var(--mono); text-shadow: 0 0 6px rgba(37,245,154,0.25);
  }
  .proof::-webkit-scrollbar { height: 7px; }
  .proof::-webkit-scrollbar-thumb { background: rgba(37,245,154,0.25); border-radius: 8px; }

  .result-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

  footer {
    flex: 0 0 auto; text-align: center; color: #2c5947; font-size: 10.5px;
    padding: 8px 12px; border-top: 1px solid var(--line); line-height: 1.5;
  }

  .toast {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(16px);
    z-index: 9; background: var(--green); color: #02140c; font-weight: 700; font-size: 12.5px;
    padding: 9px 15px; border-radius: 10px; opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  /* scrollbars inside console */
  .terminal::-webkit-scrollbar, .result::-webkit-scrollbar { width: 8px; }
  .terminal::-webkit-scrollbar-thumb, .result::-webkit-scrollbar-thumb {
    background: rgba(37,245,154,0.25); border-radius: 8px;
  }

  /* very short screens: trim spacing so it still fits */
  @media (max-height: 560px) {
    .tagline { display: none; }
    textarea { height: 48px; }
  }

  @media (prefers-reduced-motion: reduce) {
    .logo, .number, .bar .live::before, textarea,
    .scanner .beam-h, .scanner .beam-v, .scanner .scanner-label,
    .preview.scanning img, .capture-flash.show { animation: none; }
  }

  /* ============================================================
     SPLASH / START SCREEN
     ============================================================ */
  .splash {
    position: fixed; inset: 0; z-index: 40;
    display: flex;                       /* margin:auto on inner centers it, and scrolls when it can't fit */
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    text-align: center;
    padding: clamp(12px, 2.5vh, 32px) clamp(16px, 4vw, 40px);
    background:
      radial-gradient(120% 90% at 50% 0%, rgba(54,163,255,0.10), transparent 55%),
      radial-gradient(90% 80% at 50% 100%, rgba(37,245,154,0.12), transparent 60%),
      rgba(2,6,11,0.72);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    transition: opacity .6s ease, visibility .6s ease;
  }
  .splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
  .splash-inner { margin: auto; display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.1vh, 13px); max-width: 100%; }
  .splash-logo img { max-width: min(360px, 72vw); height: auto; display: block; }
  .splash-eyebrow { font-size: 10.5px; letter-spacing: 4px; color: var(--muted); text-transform: uppercase; }
  .splash-logo {
    margin: 0; font-weight: 800; color: var(--green);
    font-size: clamp(44px, 12vw, 92px); letter-spacing: clamp(10px, 4vw, 22px);
    padding-left: 0.4em;
    text-shadow: 0 0 8px rgba(37,245,154,0.9), 0 0 30px rgba(37,245,154,0.55), 0 0 70px rgba(37,245,154,0.3);
    animation: flicker 5s infinite steps(1);
  }
  .splash-tag { color: var(--muted); font-size: clamp(11px, 2.8vw, 14px); }
  .splash-intro {
    max-width: 42ch; margin: clamp(4px,1vh,10px) auto clamp(8px,1.6vh,16px);
    color: var(--ink); font-size: clamp(12px, 3.1vw, 15px); line-height: 1.55;
  }
  .splash-intro em { color: var(--gold); font-style: normal; }
  .splash-intro-dim { display: block; margin-top: 6px; color: var(--muted); font-size: .92em; }
  .splash-foot { color: #2f6650; font-size: 12px; letter-spacing: .5px; margin-top: clamp(4px, 1vh, 12px); animation: blink 1.6s steps(1) infinite; }

  /* the animated circle = ACTIVATE button (video keeps its own art/glow) */
  .start-orb {
    position: relative; appearance: none; border: none; background: none; cursor: pointer;
    width: clamp(150px, 40vw, 216px); height: clamp(150px, 40vw, 216px);
    padding: 0; display: grid; place-items: center;
    transition: transform .15s ease, filter .2s ease;
  }
  .start-orb:hover { transform: scale(1.04); }
  .start-orb:active { transform: scale(.98); }
  .start-orb:focus-visible { outline: none; }
  .start-orb:focus-visible .orb-ring { border-color: var(--blue); }
  /* soft halo glow behind the orb, pulsing */
  .orb-ring {
    position: absolute; inset: -8%; border-radius: 50%;
    background: radial-gradient(circle, rgba(37,245,154,0.28), rgba(37,245,154,0.06) 55%, transparent 70%);
    filter: blur(8px);
    animation: orbPulse 2.6s ease-in-out infinite;
  }
  @keyframes orbPulse {
    0%,100% { transform: scale(1);   opacity: .85; }
    50%     { transform: scale(1.06); opacity: 1; }
  }
  .orb-media {
    position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
    display: grid; place-items: center;
  }
  .orb-media img, .orb-media video, .orb-media svg, .orb-media canvas {
    width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%;
  }
  /* fallback CSS animation if the asset can't load at all */
  .orb-media.orb-fallback { background: rgba(2,12,8,0.6); }
  .orb-media.orb-fallback::before {
    content: ""; position: absolute; inset: 16%;
    border-radius: 50%; border: 3px solid rgba(37,245,154,0.25);
    border-top-color: var(--green);
    animation: orbSpin 1.1s linear infinite;
  }
  @keyframes orbSpin { to { transform: rotate(360deg); } }
  /* coded line BG123 "speaks" on the splash, above the orb */
  .splash-speech {
    min-height: 1.4em; max-width: min(440px, 90vw);
    margin: clamp(2px, 1vh, 10px) auto 0;
    background: rgba(4,12,10,0.92); border: 1px solid rgba(37,245,154,0.3);
    border-radius: 14px; border-bottom-left-radius: 4px;
    padding: 9px 14px; color: var(--ink); font-size: clamp(12px, 3.2vw, 14px);
    line-height: 1.5; letter-spacing: .3px; text-align: left;
    box-shadow: 0 14px 40px rgba(0,0,0,0.55), 0 0 24px rgba(37,245,154,0.1);
    opacity: 0; transform: translateY(6px); visibility: hidden;
    transition: opacity .35s ease, transform .35s ease;
  }
  .splash-speech.show { opacity: 1; transform: translateY(0); visibility: visible; }
  .splash-speech .cur { color: var(--green); animation: blink 1s steps(1) infinite; }
  .start-activate {
    margin-top: clamp(8px, 2vh, 18px);
    font-weight: 800; letter-spacing: clamp(3px, 1.4vw, 6px);
    font-size: clamp(16px, 4.2vw, 24px); color: var(--green); cursor: pointer;
    text-shadow: 0 0 12px rgba(37,245,154,0.7), 0 0 30px rgba(37,245,154,0.4);
    animation: blink 1.5s steps(1) infinite;
  }
  @media (prefers-reduced-motion: reduce) {
    .splash-logo, .splash-foot, .start-activate, .orb-ring, .orb-media.orb-fallback::before { animation: none; }
  }

  /* ============================================================
     BEARABLEGUY123 — embedded host (his head narrates the output)
     ============================================================ */
  /* he lives in the top-left of the output window; his bubble grows with what he says */
  .bg-host {
    display: none; margin: 0 0 10px; min-height: 0;
    border: 1px solid var(--line); border-radius: 14px;
    background: rgba(3,11,8,0.55); padding: 9px 10px;
  }
  .bg-host.show { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; }
  .bg-host-row { display: flex; align-items: flex-start; gap: 11px; min-height: 0; }
  .bg-bubble {
    flex: 1 1 auto; align-self: flex-start; min-height: 0;
    max-height: clamp(110px, 40vh, 380px); overflow-y: auto;   /* grow with the dialog, then scroll */
    background: rgba(4,12,10,0.96); border: 1px solid rgba(37,245,154,0.3);
    border-radius: 14px; border-bottom-left-radius: 4px;
    padding: 10px 13px; color: var(--ink); font-size: 13px; line-height: 1.5;
    white-space: pre-wrap; word-break: break-word;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 0 22px rgba(37,245,154,0.08);
    display: none;
  }
  .bg-bubble.show { display: block; animation: kickout .3s cubic-bezier(.2,.9,.3,1.2); }
  .bg-head-win { position: relative; width: 58px; height: 58px; flex: 0 0 auto; cursor: pointer; align-self: flex-start; }
  .bg-avatar {
    position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
    border: 2px solid rgba(37,245,154,0.55); background: rgba(2,12,8,0.85);
    box-shadow: 0 8px 26px rgba(0,0,0,0.55); transition: box-shadow .2s, transform .15s;
  }
  .bg-head-win:hover .bg-avatar { transform: scale(1.05); }
  .bg-avatar.talking { box-shadow: 0 8px 26px rgba(0,0,0,0.55), 0 0 22px 3px rgba(37,245,154,0.75); border-color: var(--green); }
  .bg-avatar video, .bg-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
  /* always-present fallback face (sits behind the video; shows if it fails) */
  .bg-avatar-fallback { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2,12,8,0.85); }
  .bg-avatar-fallback::before {
    content: ""; width: 34px; height: 20px; border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, var(--green) 0 24%, #06351f 26% 48%, transparent 54%);
    box-shadow: 0 0 12px rgba(37,245,154,0.7);
  }
  .bg-avatar.talking .bg-avatar-fallback::before { animation: orbSpin 0.9s linear infinite; }
  .bg-status-dot {
    position: absolute; right: 3px; bottom: 6px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--green-dim); border: 2px solid #04120c; z-index: 2;
  }
  .bg-status-dot.live { background: var(--green); box-shadow: 0 0 10px var(--green); }
  .bg-name-tag {
    position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
    background: rgba(4,12,10,0.96); border: 1px solid var(--line); color: var(--green);
    font-size: 9px; font-weight: 700; letter-spacing: 1.5px; padding: 2px 7px; border-radius: 999px; z-index: 3;
  }
  .bg-ask { display: none; align-self: stretch; flex-direction: column; gap: 7px; }
  .bg-ask.show { display: flex; margin-top: 9px; }
  .bg-ask-row { display: flex; gap: 7px; }
  .bg-input {
    flex: 1 1 auto; background: rgba(2,8,6,0.9); border: 1px solid var(--line); border-radius: 10px;
    color: var(--ink); font-family: var(--mono); font-size: 13px; padding: 9px 11px; outline: none;
  }
  .bg-input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(54,163,255,0.18); }
  .bg-send {
    flex: 0 0 auto; appearance: none; border: none; cursor: pointer; border-radius: 10px;
    background: linear-gradient(90deg, var(--green), #6bffc0); color: #02140c; font-weight: 800; padding: 0 13px;
  }
  .bg-send:active { transform: translateY(1px); }
  @media (prefers-reduced-motion: reduce) {
    .bg-avatar.talking .bg-avatar-fallback::before { animation: none; }
  }

  /* ---- CODED+ : cipher-lens selector ---- */
  .lenses { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 2px 0; }
  .lens-label { font: 700 10px/1 var(--mono); letter-spacing: 1.6px; color: var(--muted); opacity: .8; margin-right: 2px; }
  .lens {
    font: 600 11px/1 var(--mono); letter-spacing: .3px; color: var(--muted);
    background: rgba(37,245,154,0.05); border: 1px solid var(--line);
    border-radius: 999px; padding: 5px 9px; cursor: pointer; transition: .15s;
  }
  .lens:hover { color: var(--ink); border-color: rgba(37,245,154,0.42); }
  .lens.active { color: #02120c; background: var(--green); border-color: var(--green); font-weight: 700; }

  /* ---- CODED+ : audio toggle "on" state ---- */
  #audioBtn[aria-pressed="true"] {
    color: var(--green); border-color: rgba(37,245,154,0.5);
    box-shadow: 0 0 12px rgba(37,245,154,0.25);
  }

  /* ---- CODED+ : the rare anomaly glitch ---- */
  .number.glitching {
    color: var(--danger) !important;
    text-shadow: 2px 0 var(--blue), -2px 0 var(--danger);
    animation: cxglitch .12s steps(2) infinite;
  }
  .console.glitching { animation: cxshake .09s steps(2) infinite; }
  @keyframes cxglitch {
    0%{transform:translate(0,0)} 25%{transform:translate(-2px,1px)}
    50%{transform:translate(2px,-1px) skewX(-3deg)} 75%{transform:translate(-1px,-1px)}
    100%{transform:translate(1px,1px)}
  }
  @keyframes cxshake { 0%{transform:translate(0,0)} 50%{transform:translate(1px,-1px)} 100%{transform:translate(-1px,1px)} }
  @media (prefers-reduced-motion: reduce) {
    .number.glitching, .console.glitching { animation: none; }
  }
