/* =========================================================================
   WA → TG — midnight-glass aurora theme
   Layers: reset → tokens → base → layout → components → effects → motion
   ========================================================================= */
@layer reset, tokens, base, layout, components, effects, motion;

/* ---------- reset ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; }
  h1, h2, h3, p, dl, dd, ol, ul, fieldset, pre { margin: 0; padding: 0; }
  fieldset { border: 0; min-width: 0; }
  ul, ol { list-style: none; }
  button, input, textarea { font: inherit; color: inherit; }
  button { background: none; border: 0; cursor: pointer; }
  svg { display: block; }
}

/* ---------- design tokens ---------- */
@layer tokens {
  @property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

  :root {
    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Nirmala UI", "Noto Sans Devanagari", "Kohinoor Devanagari", "Mangal", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Nirmala UI", "Noto Sans Devanagari", monospace, "Apple Color Emoji", "Segoe UI Emoji";
    --green: #25D366; --cyan: #22d3ee; --violet: #8b5cf6; --pink: #f472b6; --amber: #fbbf24;
    --r-sm: 10px; --r: 16px; --r-lg: 24px;
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --ease-io: cubic-bezier(.65, 0, .35, 1);
    --step-0: clamp(.92rem, .88rem + .2vw, 1rem);
    --step-1: clamp(1.05rem, 1rem + .3vw, 1.2rem);
    --step-4: clamp(1.9rem, 1.3rem + 2.6vw, 3.4rem);
    --gutter: clamp(12px, 3vw, 32px);
  }

  [data-theme="dark"] {
    --bg: #060714; --bg-2: #0c0e26;
    --surface: rgba(16, 18, 44, .56); --surface-solid: rgba(16, 18, 44, .94);
    --surface-2: rgba(255, 255, 255, .05); --surface-3: rgba(255, 255, 255, .09);
    --line: rgba(255, 255, 255, .10); --line-2: rgba(255, 255, 255, .18);
    --text: #f1f2ff; --text-2: #c4c8ec; --muted: #969bc8;
    --accent-text: #4ade80; --focus: #7dd3fc; --caret: #4ade80;
    --sel: rgba(34, 211, 238, .30);
    --c-bold: #fcd34d; --c-italic: #67e8f9; --c-strike: #f9a8d4; --c-code: #c4b5fd;
    --c-list: #4ade80; --c-quote: #93c5fd; --c-link: #5eead4; --c-keep: #a5b4fc;
    --shadow: 0 30px 80px -30px rgba(0, 0, 0, .75), 0 10px 30px -18px rgba(0, 0, 0, .6);
    --a1: rgba(37, 211, 102, .50); --a2: rgba(139, 92, 246, .55); --a3: rgba(34, 211, 238, .40); --a4: rgba(244, 114, 182, .38);
    --aurora-blend: screen; --grain: .07;
  }
  [data-theme="light"] {
    --bg: #f5f3ff; --bg-2: #eaf6ff;
    --surface: rgba(255, 255, 255, .62); --surface-solid: rgba(255, 255, 255, .96);
    --surface-2: rgba(30, 27, 75, .04); --surface-3: rgba(30, 27, 75, .08);
    --line: rgba(30, 27, 75, .10); --line-2: rgba(30, 27, 75, .20);
    --text: #17163a; --text-2: #3b3d6b; --muted: #5a5e8e;
    --accent-text: #0f7a3d; --focus: #2563eb; --caret: #0f7a3d;
    --sel: rgba(37, 99, 235, .20);
    --c-bold: #a15c07; --c-italic: #0e7490; --c-strike: #be185d; --c-code: #6d28d9;
    --c-list: #15803d; --c-quote: #1d4ed8; --c-link: #0f766e; --c-keep: #4f46e5;
    --shadow: 0 30px 70px -35px rgba(60, 50, 140, .35), 0 8px 24px -16px rgba(60, 50, 140, .25);
    --a1: rgba(37, 211, 102, .26); --a2: rgba(167, 139, 250, .34); --a3: rgba(34, 211, 238, .26); --a4: rgba(244, 114, 182, .26);
    --aurora-blend: multiply; --grain: .05;
  }
}

/* ---------- base ---------- */
@layer base {
  html { color-scheme: dark; background: var(--bg); }
  html[data-theme="light"] { color-scheme: light; }
  body {
    min-height: 100dvh; font: 400 var(--step-0)/1.55 var(--font-sans); color: var(--text);
    background: radial-gradient(1200px 800px at 10% -10%, var(--bg-2), transparent 60%), var(--bg);
    -webkit-font-smoothing: antialiased; overflow-x: hidden;
    transition: background-color .4s, color .4s;
  }
  ::selection { background: var(--sel); }
  :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
  kbd {
    font: 600 .78em var(--font-mono); padding: .12em .45em; border-radius: 6px;
    background: var(--surface-3); border: 1px solid var(--line-2); border-bottom-width: 2px;
  }
  code { font-family: var(--font-mono); font-size: .92em; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 8px 14px; border-radius: 10px; background: var(--green); color: #052e16; font-weight: 700; }
  .skip:focus { top: 12px; }
  * { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
}

/* ---------- layout ---------- */
@layer layout {
  .topbar, main, .footer { width: min(1440px, 100% - 2 * var(--gutter)); margin-inline: auto; position: relative; z-index: 2; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding-block: 18px 10px; }
  .topbar__actions { display: flex; gap: 6px; }
  main { display: grid; gap: clamp(14px, 2vw, 22px); }
  .workspace { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 2vw, 22px); }
  .workspace .pane { height: clamp(440px, 64vh, 780px); }
  .footer { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; align-items: center; padding: 26px 0 36px; color: var(--muted); font-size: .88rem; }
  @media (max-width: 900px) {
    .workspace { grid-template-columns: 1fr; }
    .workspace .pane { height: auto; min-height: 340px; }
    .workspace .editor, .workspace .output { min-height: 300px; height: 48vh; }
  }
}

/* ---------- components ---------- */
@layer components {
  /* brand */
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem; }
  .logo { width: 40px; height: 40px; filter: drop-shadow(0 6px 18px rgba(37, 211, 102, .35)); animation: float 5s ease-in-out infinite; }
  .logo__dots circle { animation: dots 7s infinite; transform-box: fill-box; transform-origin: center; }
  .logo__dots circle:nth-child(2) { animation-delay: .12s; }
  .logo__dots circle:nth-child(3) { animation-delay: .24s; }
  .logo__plane { opacity: 0; transform-box: fill-box; transform-origin: center; animation: plane 7s infinite; }
  .logo__glint { transform-box: fill-box; transform-origin: center; animation: glint 3.5s ease-in-out infinite; }
  .brand__arrow { display: inline-block; margin: 0 2px; background: linear-gradient(90deg, var(--green), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }

  /* glass card */
  .glass {
    position: relative; isolation: isolate; border-radius: var(--r-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015)), var(--surface);
    -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .08);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--surface-solid); } }
  .glass::before { /* 1px gradient border */
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
    background: linear-gradient(140deg, rgba(255, 255, 255, .30), rgba(255, 255, 255, .04) 40%, rgba(37, 211, 102, .28) 72%, rgba(139, 92, 246, .35));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  }
  .glass::after { /* cursor spotlight */
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
    background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -30%), rgba(255, 255, 255, .09), transparent 45%);
    opacity: 0; transition: opacity .4s;
  }
  [data-theme="light"] .glass::after { background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -30%), rgba(139, 92, 246, .10), transparent 45%); }
  .glass.is-lit::after { opacity: 1; }

  /* hero */
  .hero { padding: clamp(20px, 3.4vw, 40px); text-align: center; transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s var(--ease-out); }
  .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); padding: 6px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
  .eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(37, 211, 102, .6); animation: ping 2.2s infinite; }
  h1 { margin-top: 14px; font-size: var(--step-4); line-height: 1.06; letter-spacing: -.035em; font-weight: 800; text-wrap: balance; }
  .grad { background: linear-gradient(90deg, var(--green), var(--cyan), var(--violet), var(--pink), var(--green)); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shift 9s linear infinite; }
  .typer { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 2.6em; margin-top: 14px; font-size: var(--step-1); }
  .typer code { padding: .25em .7em; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 3ch; min-height: 1.9em; display: inline-flex; align-items: center; white-space: pre; }
  .typer__to { color: var(--accent-text); }
  .typer__to .ch { display: inline-block; animation: pop .35s var(--ease-spring) both; }
  .typer__arrow { color: var(--muted); transition: transform .3s var(--ease-spring), color .3s; }
  .typer.is-morph .typer__arrow { transform: translateX(4px) scale(1.25); color: var(--accent-text); }
  .typer__caret { width: 2px; height: 1.3em; background: var(--caret); border-radius: 2px; animation: blink 1s steps(1) infinite; margin-left: -8px; }
  .hero__sub { max-width: 60ch; margin: 10px auto 0; color: var(--text-2); }
  .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
  .chip {
    position: relative; overflow: hidden; padding: 9px 16px; border-radius: 99px; font-weight: 600; font-size: .9rem; background: var(--surface-2); border: 1px solid var(--line);
    transform: perspective(500px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0));
    transition: transform .4s var(--ease-spring), background .25s, border-color .25s, box-shadow .25s;
  }
  .chip:hover { --lift: -3px; background: var(--surface-3); border-color: var(--line-2); box-shadow: 0 10px 24px -12px rgba(37, 211, 102, .5); }

  /* buttons */
  .btn {
    --tx: 0px; --ty: 0px; --lift: 0px;
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 14px; border-radius: 12px; font-weight: 650; font-size: .9rem;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
    transform: translate3d(var(--tx), calc(var(--ty) + var(--lift)), 0);
    transition: transform .35s var(--ease-spring), background .2s, border-color .2s, box-shadow .25s, opacity .2s;
  }
  .btn:hover:not(:disabled) { --lift: -2px; background: var(--surface-3); border-color: var(--line-2); box-shadow: 0 10px 24px -14px rgba(34, 211, 238, .6); }
  .btn:active:not(:disabled) { --lift: 1px; transition-duration: .08s; }
  .btn:disabled { opacity: .4; cursor: not-allowed; }
  .btn--icon { width: 38px; padding: 0; }
  .btn--ghost { background: transparent; border-color: transparent; }
  .btn--wide { width: 100%; margin-top: 8px; border-color: var(--line); }
  .btn--primary { color: #04210f; border: 0; padding: 0 18px; background: linear-gradient(135deg, #34e27a, #1fc7a4 55%, #22d3ee); box-shadow: 0 8px 24px -10px rgba(37, 211, 102, .7), inset 0 1px 0 rgba(255, 255, 255, .45); overflow: hidden; }
  .btn--primary:hover:not(:disabled) { background: linear-gradient(135deg, #4ff08d, #2bd8b3 55%, #49e0f5); box-shadow: 0 14px 30px -10px rgba(37, 211, 102, .8); }
  .btn--primary::after { /* shimmer sweep */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%);
    transform: translateX(-120%); animation: sweep 4s var(--ease-io) infinite 1.5s;
  }
  .btn__icons { position: relative; width: 18px; height: 18px; }
  .btn__icons .ico { position: absolute; inset: 0; transition: transform .35s var(--ease-spring), opacity .2s; }
  .ico--check { opacity: 0; transform: scale(.4); stroke-width: 2.6; }
  .ico--check path { stroke-dasharray: 24; stroke-dashoffset: 24; }
  .btn.is-done .ico--clip { opacity: 0; transform: scale(.4) rotate(-20deg); }
  .btn.is-done .ico--check { opacity: 1; transform: none; }
  .btn.is-done .ico--check path { animation: draw .45s .08s var(--ease-out) forwards; }
  .ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .25; transform: scale(0); animation: ripple .6s var(--ease-out) forwards; }

  /* icons + hover micro-animations */
  .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease-spring); }
  .btn:hover .ico--clip { transform: rotate(-12deg); }
  .btn:hover .ico--down .arrow { animation: bounce .7s var(--ease-spring) infinite alternate; }
  .btn:hover .ico--trash .lid { transform: translateY(-2px) rotate(-8deg); transform-origin: 20% 100%; }
  .ico--trash .lid { transition: transform .3s var(--ease-spring); }
  .btn:hover .ico--gear { transform: rotate(90deg); }
  .btn:hover .ico--undo { transform: rotate(-25deg); }
  .btn:hover .ico--paste, .btn:hover .ico--file { transform: translateY(-2px); }
  .ico--theme .sun, .ico--theme .rays { transition: transform .5s var(--ease-spring), opacity .3s; transform-origin: center; }
  .ico--theme .moon { opacity: 0; transform: rotate(-60deg) scale(.5); transform-origin: center; transition: transform .5s var(--ease-spring), opacity .3s; }
  [data-theme="light"] .ico--theme .sun, [data-theme="light"] .ico--theme .rays { opacity: 0; transform: rotate(90deg) scale(.4); }
  [data-theme="light"] .ico--theme .moon { opacity: 1; transform: none; }

  /* tooltips */
  [data-tip] { position: relative; }
  @media (hover: hover) {
    [data-tip]::before {
      content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 10px); z-index: 30;
      padding: 6px 10px; border-radius: 8px; white-space: nowrap; font: 600 .75rem var(--font-sans); color: var(--text);
      background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow);
      opacity: 0; transform: translate(-50%, 4px) scale(.96); pointer-events: none; transition: opacity .18s, transform .25s var(--ease-spring);
    }
    .topbar [data-tip]::before { bottom: auto; top: calc(100% + 10px); }
    [data-tip]:hover::before, [data-tip]:focus-visible::before { opacity: 1; transform: translate(-50%, 0) scale(1); transition-delay: .35s; }
  }

  /* panes */
  .pane { display: flex; flex-direction: column; min-width: 0; }
  .pane__ring { /* rotating conic border on focus */
    position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none; opacity: 0; transition: opacity .4s;
    background: conic-gradient(from var(--angle), var(--green), var(--cyan), var(--violet), var(--pink), var(--green));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
    animation: spin 6s linear infinite;
  }
  .pane:focus-within .pane__ring { opacity: 1; }
  .pane__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--line); }
  .pane__title { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 700; }
  .badge { font: 800 .7rem var(--font-sans); padding: 4px 7px; border-radius: 8px; color: #04210f; background: linear-gradient(135deg, var(--green), var(--cyan)); }
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .pane__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; min-height: 44px; }
  .num { color: var(--text); font-variant-numeric: tabular-nums; display: inline-block; }
  .num.bump { animation: bump .45s var(--ease-spring); }

  /* editor (transparent textarea over highlighted mirror) */
  .editor, .output { position: relative; flex: 1; min-height: 0; }
  .editor__mirror, .editor__input, .out-raw, .out-preview {
    margin: 0; padding: 18px 20px 28px; border: 0; font: 400 15px/1.7 var(--font-sans);
    white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; letter-spacing: 0; font-variant-ligatures: none;
  }
  .editor__mirror { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; color: var(--text); pointer-events: none; }
  .editor__input { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; background: transparent; color: transparent; caret-color: var(--caret); outline: none; overflow: auto; }
  .editor__input::placeholder { color: var(--muted); opacity: 1; }
  .editor__input::selection { background: var(--sel); color: transparent; }
  .editor.is-plain .editor__input { color: var(--text); }
  .editor.is-plain .editor__mirror { display: none; }
  @media (max-width: 600px) { .editor__mirror, .editor__input, .out-raw, .out-preview { font-size: 16px; padding: 14px 14px 22px; } }

  .mk--bold { color: var(--c-bold); font-weight: inherit; }
  .mk--italic { color: var(--c-italic); }
  .mk--strike { color: var(--c-strike); }
  .mk--list { color: var(--c-list); }
  .mk--quote { color: var(--c-quote); }
  .mk--keep { color: var(--c-keep); }
  .mk--code, .tk--code { color: var(--c-code); }
  .mk--link, .tk--link { color: var(--c-link); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
  .editor__mirror .mk--bold, .editor__mirror .mk--italic, .editor__mirror .mk--strike { background: color-mix(in srgb, currentColor 16%, transparent); border-radius: 3px; }

  /* output */
  .panel { position: absolute; inset: 0; overflow: auto; outline-offset: -3px; }
  .panel.is-entering { animation: panelIn .4s var(--ease-out); }
  .out-raw { min-height: 100%; }
  .out-raw .mk { border-radius: 4px; }
  .out-raw .mk.is-new { animation: flash 1.1s var(--ease-out) var(--d, 0ms) both; }
  .out-preview strong { font-weight: 750; }
  .out-preview del { text-decoration-color: var(--c-strike); text-decoration-thickness: 2px; }
  .out-preview code, .pv-pre { font-family: var(--font-mono); font-size: .9em; padding: .1em .4em; border-radius: 6px; background: var(--surface-3); color: var(--c-code); }
  .pv-pre { display: block; padding: 12px 14px; margin: 4px 0; border: 1px solid var(--line); }
  .pv-quote { display: inline-block; width: 100%; padding-left: 12px; border-left: 3px solid var(--c-quote); color: var(--text-2); }
  .pv-bullet { color: var(--c-list); font-weight: 700; }
  .out-preview a { color: var(--c-link); }

  /* tabs */
  .tabs { position: relative; display: flex; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
  .tab { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: 10px; font-weight: 650; font-size: .88rem; color: var(--muted); transition: color .25s; }
  .tab[aria-selected="true"] { color: var(--text); }
  .tabs__pill { position: absolute; top: 4px; bottom: 4px; left: 0; width: var(--pw, 0); transform: translateX(var(--px, 0)); border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .4); transition: transform .45s var(--ease-spring), width .45s var(--ease-spring); }

  /* segmented control */
  .seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
  .seg label { position: relative; }
  .seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
  .seg span { display: block; padding: 6px 14px; border-radius: 9px; font-weight: 650; font-size: .86rem; color: var(--muted); transition: background .3s var(--ease-out), color .2s, box-shadow .3s; }
  .seg--sm span { padding: 5px 10px; font-size: .8rem; }
  .seg input:checked + span { color: #04210f; background: linear-gradient(135deg, #34e27a, #22d3ee); box-shadow: 0 4px 12px -4px rgba(37, 211, 102, .6); }
  .seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

  /* conversion breakdown */
  .kinds { display: flex; flex-wrap: wrap; gap: 6px; }
  .kind { padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); animation: pop .4s var(--ease-spring); }
  .kind--bold .num { color: var(--c-bold); } .kind--italic .num { color: var(--c-italic); }
  .kind--strike .num { color: var(--c-strike); } .kind--keep .num { color: var(--c-keep); }

  /* empty states */
  .empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; pointer-events: none; text-align: center; padding: 20px; transition: opacity .35s; }
  .empty.is-hidden { opacity: 0; }
  .editor .empty { padding-top: 70px; }
  .empty__art { width: 150px; }
  .empty__art rect { fill: var(--surface-3); stroke: var(--line-2); }
  .empty__art .b1 { animation: float 4.5s ease-in-out infinite; }
  .empty__art .b2 { animation: float 5.2s ease-in-out infinite reverse; }
  .empty__art path { stroke: var(--green); stroke-width: 4; stroke-linecap: round; fill: none; }
  .empty__art .l1 { animation: float 4.5s ease-in-out infinite; }
  .empty__art .l2 { stroke: var(--violet); animation: float 5.2s ease-in-out infinite reverse; }
  .empty__art .sp { fill: var(--amber); stroke: none; transform-box: fill-box; transform-origin: center; animation: glint 2.8s infinite; }
  .empty__hint { color: var(--muted); font-weight: 600; background: linear-gradient(90deg, var(--muted) 40%, var(--text) 50%, var(--muted) 60%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shift 3.5s linear infinite; }
  .empty__plane { width: 44px; height: 44px; color: var(--cyan); animation: float 4s ease-in-out infinite; }

  /* drop overlay */
  .drop { position: absolute; inset: 10px; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 10px; border-radius: 18px; font-weight: 700; font-size: 1.15rem; background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
  .drop.is-on { opacity: 1; visibility: visible; animation: glow 1.4s ease-in-out infinite; }
  .drop__border { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .drop__border rect { width: calc(100% - 4px); height: calc(100% - 4px); fill: none; stroke: var(--green); stroke-width: 2.5; stroke-dasharray: 10 8; animation: march .8s linear infinite; }
  .drop__arrow { width: 40px; height: 40px; color: var(--green); animation: bounce .6s var(--ease-spring) infinite alternate; }

  /* footer */
  .link { color: var(--accent-text); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
  .footer__egg { opacity: .8; }

  /* dialogs */
  dialog { padding: 0; border: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
  dialog::backdrop { background: rgba(5, 6, 20, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .3s; }
  .drawer { margin: 0 0 0 auto; width: min(420px, 100vw); height: 100dvh; }
  .drawer[open] { animation: drawerIn .45s var(--ease-out); }
  .drawer.is-closing { animation: drawerOut .3s var(--ease-io) forwards; }
  .drawer__inner, .modal__inner { height: 100%; background: var(--surface-solid); border-left: 1px solid var(--line-2); box-shadow: var(--shadow); overflow: auto; }
  @supports (backdrop-filter: blur(1px)) {
    .drawer__inner, .modal__inner { background: var(--surface); -webkit-backdrop-filter: blur(28px) saturate(160%); backdrop-filter: blur(28px) saturate(160%); }
  }
  .dlg__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 14px 22px; border-bottom: 1px solid var(--line); }
  .dlg__head h2 { font-size: 1.15rem; }
  .drawer__body { padding: 18px 22px 30px; display: grid; gap: 22px; }
  .set legend { font-size: .76rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
  .hint { margin-top: 10px; font-size: .84rem; color: var(--text-2); }
  .switch-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; cursor: pointer; }
  .switch { position: relative; flex: none; }
  .switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
  .switch__track { display: block; width: 46px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background .3s; }
  .switch__thumb { position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 99px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .45s var(--ease-spring), width .25s var(--ease-out); }
  .switch input:active + .switch__track .switch__thumb { width: 24px; }
  .switch input:checked + .switch__track { background: linear-gradient(135deg, var(--green), var(--cyan)); border-color: transparent; }
  .switch input:checked + .switch__track .switch__thumb { transform: translateX(20px); }
  .switch input:checked:active + .switch__track .switch__thumb { transform: translateX(14px); }
  .switch input:focus-visible + .switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }

  .modal { margin: auto; width: min(520px, 100vw - 24px); max-height: min(86vh, 900px); }
  .modal--wide { width: min(860px, 100vw - 24px); }
  .modal[open] { animation: modalIn .45s var(--ease-spring); }
  .modal.is-closing { animation: modalOut .22s var(--ease-io) forwards; }
  .modal__inner { border: 1px solid var(--line-2); border-radius: var(--r-lg); max-height: inherit; }
  .keys { display: grid; grid-template-columns: auto 1fr; gap: 12px 22px; padding: 20px 24px 26px; align-items: center; }
  .keys dt { display: flex; gap: 4px; }
  .keys dd { color: var(--text-2); }
  .tests__summary { display: flex; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); font-weight: 700; }
  .tests__summary svg { width: 56px; height: 56px; transform: rotate(-90deg); }
  .tests__summary circle { fill: none; stroke-width: 6; }
  .tests__list { padding: 10px 16px 22px; display: grid; gap: 6px; }
  .test { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); animation: pop .35s var(--ease-out) both; animation-delay: var(--d); font-size: .9rem; }
  .test__mark { font-weight: 800; color: var(--accent-text); }
  .test.is-fail { background: color-mix(in srgb, var(--c-strike) 14%, transparent); }
  .test.is-fail .test__mark { color: var(--c-strike); }
  .test__group { font-size: .74rem; color: var(--muted); }
  .test pre { grid-column: 2 / -1; font: .8rem/1.5 var(--font-mono); white-space: pre-wrap; color: var(--text-2); }

  /* toasts */
  .toasts { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
  .toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 36px));
    padding: 10px 10px 10px 14px; border-radius: 14px; font-weight: 600; font-size: .9rem;
    background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow);
    animation: toastIn .5s var(--ease-spring);
  }
  .toast.is-out { animation: toastOut .3s var(--ease-io) forwards; }
  .toast__icon { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; color: #04210f; background: linear-gradient(135deg, var(--green), var(--cyan)); }
  .toast--error .toast__icon { background: linear-gradient(135deg, var(--pink), var(--amber)); }
  .toast--info .toast__icon { background: linear-gradient(135deg, var(--violet), var(--cyan)); color: #fff; }
  .toast__action { padding: 5px 10px; border-radius: 8px; color: var(--accent-text); font-weight: 750; background: var(--surface-3); }
  @media (max-width: 600px) { .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; } .toast { max-width: none; } }

  @media (max-width: 600px) {
    .pane__head { padding: 10px 12px; }
    .seg--sm span { padding: 5px 8px; }
    .btn--primary .btn__label { display: none; }
    .btn--primary { padding: 0 12px; }
    .footer__egg { display: none; }
    .eyebrow { flex-wrap: wrap; justify-content: center; font-size: .68rem; letter-spacing: .04em; }
    .typer { font-size: .95rem; gap: 8px; }
  }
}

/* ---------- effects ---------- */
@layer effects {
  .aurora { position: fixed; inset: -10vmax; z-index: 0; pointer-events: none; overflow: hidden; filter: blur(70px) saturate(140%); }
  .aurora i { position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%; mix-blend-mode: var(--aurora-blend); opacity: .9; }
  .aurora i:nth-child(1) { background: radial-gradient(circle, var(--a1), transparent 65%); left: -5%; top: -10%; animation: drift1 28s ease-in-out infinite alternate; }
  .aurora i:nth-child(2) { background: radial-gradient(circle, var(--a2), transparent 65%); right: -10%; top: 5%; animation: drift2 34s ease-in-out infinite alternate; }
  .aurora i:nth-child(3) { background: radial-gradient(circle, var(--a3), transparent 65%); left: 25%; bottom: -25%; animation: drift3 40s ease-in-out infinite alternate; }
  .aurora i:nth-child(4) { background: radial-gradient(circle, var(--a4), transparent 65%); right: 15%; bottom: -15%; animation: drift1 46s ease-in-out infinite alternate-reverse; }
  body.no-fx .aurora i { animation-play-state: paused; }
  .layer-stars { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
  .layer-fx { position: fixed; inset: 0; z-index: 70; width: 100%; height: 100%; pointer-events: none; }
  .grain { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: var(--grain); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

  .reveal { animation: reveal .9s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 90ms + 60ms); }

  /* circular theme reveal (View Transitions) */
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
  html.theme-fade, html.theme-fade * { transition: background-color .45s, color .45s, border-color .45s; }

  @keyframes reveal { from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(6px); } }
  @keyframes float { 50% { transform: translateY(-5px); } }
  @keyframes dots { 0%, 40% { opacity: 1; transform: translateY(0); } 10% { transform: translateY(-3px); } 20% { transform: translateY(0); } 45%, 92% { opacity: 0; transform: scale(.2); } 100% { opacity: 1; } }
  @keyframes plane { 0%, 42% { opacity: 0; transform: translate(-6px, 4px) scale(.6) rotate(-15deg); } 50%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translate(8px, -6px) scale(.7); } }
  @keyframes glint { 0%, 70%, 100% { opacity: 0; transform: scale(.2) rotate(0deg); } 80% { opacity: 1; transform: scale(1) rotate(45deg); } 90% { opacity: 0; transform: scale(.3) rotate(90deg); } }
  @keyframes shift { to { background-position: 300% 0; } }
  @keyframes ping { 70%, 100% { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); } }
  @keyframes blink { 50% { opacity: 0; } }
  @keyframes pop { from { opacity: 0; transform: scale(.4) translateY(4px); } }
  @keyframes sweep { 0% { transform: translateX(-120%); } 40%, 100% { transform: translateX(120%); } }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
  @keyframes bounce { to { transform: translateY(3px); } }
  @keyframes spin { to { --angle: 360deg; } }
  @keyframes bump { 40% { transform: scale(1.25); } }
  @keyframes flash { 0% { background: transparent; box-shadow: 0 0 0 0 transparent; } 25% { background: color-mix(in srgb, currentColor 28%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); } 100% { background: transparent; box-shadow: 0 0 0 0 transparent; } }
  @keyframes panelIn { from { opacity: 0; transform: translateX(12px); } }
  @keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(37, 211, 102, .15), 0 0 40px rgba(37, 211, 102, .35); } }
  @keyframes march { to { stroke-dashoffset: -36; } }
  @keyframes fade { from { opacity: 0; } }
  @keyframes drawerIn { from { transform: translateX(100%); } }
  @keyframes drawerOut { to { transform: translateX(100%); } }
  @keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.95); } }
  @keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }
  @keyframes toastIn { from { opacity: 0; transform: translateY(24px) scale(.9); } }
  @keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.95); } }
  @keyframes drift1 { to { transform: translate(18vw, 12vh) scale(1.15); } }
  @keyframes drift2 { to { transform: translate(-16vw, 18vh) scale(.9); } }
  @keyframes drift3 { to { transform: translate(10vw, -20vh) scale(1.2); } }
}

/* ---------- reduced motion: keep simple fades only ---------- */
@layer motion {
  @media (prefers-reduced-motion: reduce) {
    .aurora i, .logo, .logo__dots circle, .logo__glint, .grad, .eyebrow .dot, .btn--primary::after, .pane__ring,
    .empty__art *, .empty__hint, .empty__plane, .drop__arrow, .drop__border rect, .drop.is-on, .typer__caret { animation: none; }
    .logo__plane { animation: none; opacity: 0; }
    .reveal, .panel.is-entering, .modal[open], .drawer[open], .toast, .kind, .test, .typer__to .ch, .out-raw .mk.is-new { animation: fade .3s ease both; }
    .num.bump { animation: none; }
    .hero, .chip, .btn { transform: none; }
    .btn, .chip, .tabs__pill, .switch__thumb { transition-duration: .01s; }
  }
}

