/* =========================================================================
   Gemini AI Pro — redeem console
   One screen: key + account + submit on the first view, live tasks beside it.

   PERFORMANCE CONTRACT (measured — see README "Performance"):
   - the backdrop is OPAQUE and painted once. The only motion behind the page
     is two light pools moved by `transform` (a compositor job, no repaint).
     The old animated WebGL backdrop cost 60fps -> 10fps on a software renderer.
   - no backdrop-filter, no filter:blur on large layers, no mix-blend-mode.
   - every animation is transform / opacity / clip-path on a small element, or
     a one-time entrance.
   ========================================================================= */

:root {
  --bg: #06070b;
  --panel: #0c0e14;
  --panel-2: #11141c;
  --field: #08090e;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --line-3: rgba(255, 255, 255, .22);

  --fg: #eceef4;
  --fg-2: #9ba2b3;
  --fg-3: #7d869a;

  --blue: #6b8cff;
  --sky: #7dd3fc;
  --violet: #9b7bf0;
  --rose: #d77aa8;
  --good: #3ddc97;
  --warn: #f2b84b;
  --bad: #ff6b81;

  --grad: linear-gradient(120deg, #4f8ff7 0%, #8a6be8 55%, #c472a6 100%);
  --grad-text: linear-gradient(100deg, #b4c8ff 0%, #c9b4ff 55%, #f2bcd6 100%);
  --ring: 0 0 0 4px rgba(107, 140, 255, .16);

  --r-lg: 22px;
  --r: 14px;
  --r-sm: 11px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --cine: cubic-bezier(.16, 1, .3, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f5f9;
  --panel: #ffffff;
  --panel-2: #f7f8fb;
  --field: #ffffff;
  --line: rgba(15, 23, 42, .08);
  --line-2: rgba(15, 23, 42, .13);
  --line-3: rgba(15, 23, 42, .24);
  --fg: #0d1222;
  --fg-2: #4a5468;
  --fg-3: #636d83;
  --blue: #3f63f2;
  --sky: #0ea5e9;
  --violet: #7650e0;
  --good: #0b7f53;
  --warn: #94600f;
  --bad: #c42a40;
  --grad-text: linear-gradient(100deg, #3461f0 0%, #7a4ee0 60%, #b9468a 100%);
  --ring: 0 0 0 4px rgba(63, 99, 242, .14);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  font: 15px/1.55 var(--font); color: var(--fg); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button, a, summary, label, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input, textarea { -webkit-appearance: none; appearance: none; }
html { scrollbar-color: var(--line-3) transparent; }
a { color: inherit; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
::selection { background: rgba(107, 140, 255, .35); }

/* --------------------------- cinematic backdrop ------------------------- */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 120%, rgba(0,0,0,.55), transparent 60%),   /* floor vignette */
    radial-gradient(900px 440px at 18% -10%, rgba(79, 120, 247, .14), transparent 70%),
    radial-gradient(760px 400px at 92% -6%, rgba(138, 107, 232, .11), transparent 70%),
    var(--bg);
  animation: bg-in 1.4s var(--cine) both;
}
@keyframes bg-in { from { opacity: 0; } }
.bg::after {   /* fine engineering grid, fading out below the fold */
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.032) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 72%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 72%);
}
/* two big soft light pools; they drift by transform only (compositor, no repaint) */
.pool { position: absolute; border-radius: 50%; will-change: transform; }
.pool--a {
  width: 70vmax; height: 70vmax; left: -22vmax; top: -38vmax;
  background: radial-gradient(closest-side, rgba(79,120,247,.16), rgba(79,120,247,.05) 55%, transparent);
  animation: drift-a 38s ease-in-out infinite alternate;
}
.pool--b {
  width: 60vmax; height: 60vmax; right: -24vmax; top: -30vmax;
  background: radial-gradient(closest-side, rgba(150,110,240,.13), rgba(150,110,240,.04) 55%, transparent);
  animation: drift-b 46s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(14vmax, 8vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-12vmax, 10vmax, 0) scale(.94); } }
/* static film grain (painted once) */
.grain {
  position: absolute; inset: 0; opacity: .035;
  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='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="light"] .bg {
  background:
    radial-gradient(900px 440px at 18% -10%, rgba(63, 99, 242, .09), transparent 70%),
    radial-gradient(760px 400px at 92% -6%, rgba(118, 80, 224, .07), transparent 70%),
    var(--bg);
}
:root[data-theme="light"] .bg::after {
  background-image:
    linear-gradient(rgba(15,23,42,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.05) 1px, transparent 1px);
}
:root[data-theme="light"] .pool { opacity: .55; }
:root[data-theme="light"] .grain { opacity: .05; filter: invert(1); }

/* -------------------------------- header -------------------------------- */
.top { position: relative; z-index: 20; animation: top-in .9s var(--cine) .05s both; }
@keyframes top-in { from { opacity: 0; transform: translateY(-10px); } }
.top__in {
  width: min(1240px, 100% - 40px - env(safe-area-inset-left) - env(safe-area-inset-right)); margin-inline: auto; height: 60px;
  margin-top: env(safe-area-inset-top);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.015em; font-size: 16px; }
.brand__mark {
  position: relative; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line-2);
}
.brand__mark::after {   /* halo that breathes (opacity + transform only) */
  content: ""; position: absolute; inset: -6px; border-radius: 14px; z-index: -1;
  background: radial-gradient(closest-side, rgba(145,104,217,.35), transparent);
  animation: breathe 4.5s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.9); } 50% { opacity: .9; transform: scale(1.05); } }
.brand__mark svg { width: 18px; height: 18px; animation: spin-slow 18s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.brand__name { white-space: nowrap; }
.brand__name b { font-weight: 700; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top__right { display: flex; align-items: center; gap: 8px; }

.status {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  font: 500 12.5px var(--font); color: var(--fg-2); white-space: nowrap;
}
.status i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.status i::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: ping 2.2s var(--ease) infinite;
}
.status.is-warn i { background: var(--warn); }
.status.is-down i { background: var(--bad); }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(3); opacity: 0; } }

.chip-btn {
  position: relative; height: 36px; min-width: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 11px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel);
  color: var(--fg-2); cursor: pointer; font-size: 12.5px; font-weight: 600; overflow: hidden;
  transition: color .2s, border-color .2s, transform .2s var(--spring);
}
.chip-btn:active { transform: scale(.93); }
@media (hover: hover) { .chip-btn:hover { color: var(--fg); border-color: var(--line-3); transform: translateY(-1px); } }
.guide-btn svg { width: 16px; height: 16px; }

/* ---- globe: original vector, light blue with a soft glow; meridians sweep ---- */
.lang { position: relative; }
.globe { position: relative; width: 22px; height: 22px; display: grid; place-items: center; }
.globe::before {   /* glow halo: opacity/transform only */
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(125, 211, 252, .55), transparent);
  animation: globe-glow 3s ease-in-out infinite;
}
@keyframes globe-glow { 0%, 100% { opacity: .45; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
.globe svg { position: relative; width: 22px; height: 22px; overflow: visible; filter: drop-shadow(0 0 3px rgba(125, 211, 252, .65)); }
.g-lines { stroke: #0b4f8a; }
.g-rim { stroke: #38bdf8; }
.g-mer { transform-box: fill-box; transform-origin: center; animation: meridian 3.6s linear infinite; }
.g-mer.m2 { animation-delay: -1.2s; } .g-mer.m3 { animation-delay: -2.4s; }
@keyframes meridian {   /* |cos| sweep: reads as the globe turning */
  0%   { transform: scaleX(1); }    12.5% { transform: scaleX(.71); } 25% { transform: scaleX(.02); }
  37.5%{ transform: scaleX(-.71); } 50%   { transform: scaleX(-1); }  62.5% { transform: scaleX(-.71); }
  75%  { transform: scaleX(-.02); } 87.5% { transform: scaleX(.71); } 100% { transform: scaleX(1); }
}
@media (hover: hover) { .lang-btn:hover .g-mer { animation-duration: 1.6s; } }
.lang-btn.has-media .globe svg { display: none; }
.lang-btn .globe video, .lang-btn .globe img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.lang-btn .chev { opacity: .6; transition: transform .3s var(--spring); }
.lang.open .chev { transform: rotate(180deg); }
.lang-code { letter-spacing: .04em; }
.lang-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 190px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 15px;
  box-shadow: 0 28px 56px -22px rgba(0,0,0,.7);
  opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: top right; pointer-events: none; visibility: hidden;
  transition: opacity .2s var(--ease), transform .3s var(--spring), visibility 0s .3s; z-index: 40;
}
[dir="rtl"] .lang-menu { transform-origin: top left; }
.lang.open .lang-menu { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.lang-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none;
  border-radius: 10px; cursor: pointer; font-size: 14px; text-align: start; color: var(--fg);
  opacity: 0; transform: translateY(-4px); transition: background .15s, opacity .25s var(--ease), transform .3s var(--ease);
}
.lang.open .lang-menu button { opacity: 1; transform: none; }
.lang.open .lang-menu button:nth-child(2) { transition-delay: .02s; } .lang.open .lang-menu button:nth-child(3) { transition-delay: .04s; }
.lang.open .lang-menu button:nth-child(4) { transition-delay: .06s; } .lang.open .lang-menu button:nth-child(5) { transition-delay: .08s; }
.lang.open .lang-menu button:nth-child(6) { transition-delay: .1s; }
@media (hover: hover) { .lang-menu button:hover { background: var(--panel-2); } }
.lang-menu button.on { color: var(--blue); font-weight: 600; }
.lang-menu button.on::after { content: "✓"; margin-inline-start: auto; }
.lang-menu .fi { width: 22px; height: 16px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }

/* ---- theme coin (ported from the API docs switch) ---- */
.tt { position: relative; width: 36px; height: 36px; flex: none; padding: 0; border: 0; background: transparent; cursor: pointer; perspective: 260px; -webkit-tap-highlight-color: transparent; }
.tt-coin {
  position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform .58s cubic-bezier(.42, 0, .4, 1.18);   /* spends time mid-turn, lands with ~6% overshoot */
}
.tt-f, .tt-b {
  position: absolute; inset: 0; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--fg-2);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.tt-f svg, .tt-b svg { width: 17px; height: 17px; }
.tt-b { transform: rotateY(180deg); }
.tt.flip .tt-coin { transform: rotateY(180deg); }
.tt:active .tt-coin { transition-duration: .2s; }
@media (hover: hover) and (pointer: fine) {
  .tt:hover .tt-f, .tt:hover .tt-b { color: var(--fg); border-color: var(--line-3); }
  .tt:hover .tt-f svg { animation: wobble .6s var(--spring); }
}
@keyframes wobble { 30% { transform: rotate(-18deg) scale(1.1); } 60% { transform: rotate(10deg); } }
/* the outgoing theme, collapsing into the switch like an iris; the ring is its wavefront */
#tvl { position: fixed; inset: 0; z-index: 15; pointer-events: none; will-change: clip-path; }
#tvl.go { -webkit-transition: -webkit-clip-path .62s cubic-bezier(.42, .02, .58, 1), clip-path .62s cubic-bezier(.42, .02, .58, 1); }
#tvl.go { transition: clip-path .62s cubic-bezier(.42, .02, .58, 1); }
#tvr {
  position: fixed; z-index: 16; pointer-events: none; width: 32px; height: 32px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, transparent 52%, rgba(125, 211, 252, .75) 68%, rgba(155, 123, 240, .35) 74%, transparent 80%);
}
#tvr.go { animation: tt-ring .62s var(--ease) forwards; }
@keyframes tt-ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(48); } }
/* the palette lands in one frame under the veil instead of ~100 cross-fades */
html.tswap *:not([data-anim]), html.tswap *:not([data-anim])::before, html.tswap *:not([data-anim])::after { transition: none !important; }

/* -------------------------------- layout -------------------------------- */
.shell {
  position: relative; z-index: 1; flex: 1;
  width: min(1240px, 100% - 40px); margin: 6px auto 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 22px; align-items: start;
}
.main, .side { min-width: 0; }
.side { display: grid; gap: 16px; }

/* entrance sequence (one-time) */
.seq { animation: seq-in 1s var(--cine) both; }
.s1 { animation-delay: .15s; } .s2 { animation-delay: .25s; } .s3 { animation-delay: .38s; }
.s4 { animation-delay: .46s; } .s5 { animation-delay: .6s; } .s6 { animation-delay: .72s; }
@keyframes seq-in { from { opacity: 0; transform: translateY(18px); } }
h1.seq { animation-name: title-in; animation-duration: 1.2s; }
@keyframes title-in {   /* rises from behind a mask */
  from { opacity: 0; transform: translateY(40%); clip-path: inset(0 0 100% 0); }
  60% { opacity: 1; }
  to { clip-path: inset(0 0 -20% 0); }
}

.intro { margin: 0 0 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px 0 9px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel);
  font-size: 12.5px; font-weight: 500; color: var(--fg-2);
}
.pill svg { width: 13px; height: 13px; }
.intro h1 {
  margin: 12px 0 4px; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.06;
  font-weight: 800; letter-spacing: -.04em;
}
.grad {
  background: var(--grad-text); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: grad-pan 9s ease-in-out infinite alternate;
}
@keyframes grad-pan { to { background-position: 100% 0; } }
.intro p { margin: 0; color: var(--fg-2); font-size: 15.5px; }

.announce {
  display: none; align-items: center; gap: 10px; margin: 0 0 14px; padding: 11px 14px;
  border-radius: var(--r); border: 1px solid rgba(242,184,75,.28); background: rgba(242,184,75,.07);
  color: var(--warn); font-size: 13.5px; animation: seq-in .5s var(--ease);
}
.announce.show { display: flex; }
.announce.is-bad { border-color: rgba(255,107,129,.3); background: rgba(255,107,129,.07); color: var(--bad); }
.announce svg { width: 17px; height: 17px; flex: none; }

/* ------------------------------- console -------------------------------- */
/* .frame paints the 1px rim; a glow moves inside it (by transform) toward the cursor */
.frame {
  position: relative; border-radius: var(--r-lg); padding: 1px; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, var(--line-2), var(--line) 40%);
  box-shadow: 0 40px 80px -50px rgba(0,0,0,.95), 0 0 0 1px rgba(0,0,0,.2);
}
.frame::before {   /* signature hairline across the top edge */
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 1px; z-index: 2;
  background: linear-gradient(90deg, transparent, rgba(107,140,255,.9), rgba(155,123,240,.9), rgba(215,122,168,.6), transparent);
}
.frame::after {   /* one cinematic light sweep on load, then on demand while busy */
  content: ""; position: absolute; top: 0; left: 0; width: 34%; height: 2px; z-index: 3;
  background: linear-gradient(90deg, transparent, #fff, transparent); opacity: 0;
  animation: sweep 1.8s var(--cine) 1s 1 both;
}
.frame.busy::after { animation: sweep 1.6s var(--ease) infinite; }
@keyframes sweep { 0% { transform: translateX(-100%); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .9; } 100% { transform: translateX(300%); opacity: 0; } }
.frame__glow {
  position: absolute; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; z-index: 0;
  border-radius: 50%; pointer-events: none; opacity: 0; will-change: transform, opacity;
  background: radial-gradient(closest-side, rgba(125,170,255,.55), rgba(155,123,240,.18) 45%, transparent);
  transition: opacity .5s var(--ease);
}
.frame.lit .frame__glow { opacity: 1; }
:root[data-theme="light"] .frame { box-shadow: 0 2px 4px rgba(15,23,42,.04), 0 30px 60px -38px rgba(15,23,42,.3); }
:root[data-theme="light"] .frame__glow { background: radial-gradient(closest-side, rgba(63,99,242,.4), rgba(118,80,224,.12) 45%, transparent); }

.console { position: relative; z-index: 1; display: flow-root; border-radius: calc(var(--r-lg) - 1px); background: var(--panel); }   /* flow-root: the tabs' margin must not collapse through and expose the frame */
.card {
  position: relative; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.035) inset, 0 30px 60px -44px rgba(0,0,0,.9);
}
:root[data-theme="light"] .card { box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 24px 48px -34px rgba(15,23,42,.25); }

/* segmented tabs with a sliding ink pill */
.tabs {
  position: relative; display: grid; grid-template-columns: repeat(2, 1fr);
  margin: 8px; padding: 4px; border-radius: 14px; background: var(--field); border: 1px solid var(--line);
}
.tabs__ink {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line-2);
  box-shadow: 0 8px 18px -10px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.04);
  transition: transform .5s var(--spring), width .5s var(--spring);
}
:root[data-theme="light"] .tabs__ink { background: #fff; box-shadow: 0 2px 8px -2px rgba(15,23,42,.15); }
.tab {
  position: relative; z-index: 1; height: 34px; border: 0; background: none; cursor: pointer;
  color: var(--fg-3); font-size: 13.5px; font-weight: 600; border-radius: 10px; white-space: nowrap;
  padding: 0 8px; transition: color .25s;
}
.tab.on { color: var(--fg); }
@media (hover: hover) { .tab:not(.on):hover { color: var(--fg-2); } }

.panel { display: none; padding: 4px 26px 22px; }
.panel.on { display: block; animation: panel-in .5s var(--cine); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }

/* live 3-step strip */
.flow { list-style: none; display: flex; align-items: center; gap: 0; margin: 6px 0 14px; padding: 0; counter-reset: f; }
.flow__s { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--fg-3); transition: color .4s; }
.flow__s:not(:last-child)::after {
  content: ""; flex: 1; height: 1px; margin: 0 10px; background: var(--line-2);
  background-image: linear-gradient(90deg, var(--blue), var(--violet)); background-size: 0% 100%; background-repeat: no-repeat;
  transition: background-size .8s var(--cine);
}
.flow__s.is-done:not(:last-child)::after { background-size: 100% 100%; }
.flow__n {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font: 600 11px var(--mono); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--fg-3);
  transition: background .4s, color .4s, border-color .4s, transform .5s var(--spring);
}
.flow__t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow__s.is-now { color: var(--fg); }
.flow__s.is-now .flow__n { border-color: var(--blue); color: var(--fg); transform: scale(1.1); box-shadow: 0 0 0 4px rgba(107,140,255,.14); }
.flow__s.is-done { color: var(--fg-2); }
.flow__s.is-done .flow__n { background: var(--good); border-color: transparent; color: #04140d; font-size: 0; }
.flow__s.is-done .flow__n::before { content: "✓"; font-size: 11px; font-family: var(--font); }

/* --------------------------------- form --------------------------------- */
.field { margin-bottom: 13px; }
.field > label {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px;
  font-size: 13px; font-weight: 600; color: var(--fg); letter-spacing: -.005em; transition: color .2s;
}
.field:focus-within > label { color: var(--blue); }
.field > label em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--fg-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.tip { margin: 5px 0 0; font-size: 12px; line-height: 1.5; color: var(--fg-3); }
.tip.is-warn { color: var(--warn); }

.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--field); font-size: 15px;
  transition: border-color .2s, box-shadow .25s var(--ease), background-color .2s;
}
.input::placeholder { color: var(--fg-3); opacity: 1; }
@media (hover: hover) { .input:hover { border-color: var(--line-3); } }
.input:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
.input.mono { font-size: 14px; letter-spacing: .02em; }
.input--sm { height: 38px; max-width: 240px; font-size: 14px; }
textarea.input { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.7; font-size: 13px; }
.input.is-bad { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(255,107,129,.12); animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

.input-wrap { position: relative; flex: 1; min-width: 0; }
.input-wrap .input { padding-inline-end: 44px; }
.reveal-btn {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: none; color: var(--fg-3); cursor: pointer; transition: color .2s, transform .2s var(--spring);
}
.reveal-btn:active { transform: translateY(-50%) scale(.88); }
.reveal-btn svg { width: 18px; height: 18px; }
.reveal-btn.on { color: var(--blue); }
@media (hover: hover) { .reveal-btn:hover { color: var(--fg); } }

.keyrow { display: flex; gap: 8px; }
.ok-mark {
  position: absolute; inset-inline-end: 12px; top: 50%; width: 22px; height: 22px; margin-top: -11px;
  display: grid; place-items: center; border-radius: 50%; background: var(--good); color: #04140d;
  transform: scale(0) rotate(-90deg); transition: transform .5s var(--spring);
}
.ok-mark svg { width: 13px; height: 13px; }
.keyrow.verified .ok-mark { transform: none; }
.keyrow.verified .input { border-color: rgba(61,220,151,.5); }

.balance {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(61,220,151,.06); border: 1px solid rgba(61,220,151,.18);
  animation: panel-in .5s var(--cine);
}
.balance.is-warn { background: rgba(242,184,75,.07); border-color: rgba(242,184,75,.25); }
.balance.is-bad { background: rgba(255,107,129,.07); border-color: rgba(255,107,129,.25); }
.balance__nums { display: flex; gap: 14px; font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.balance__nums b { color: var(--fg); font-family: var(--mono); font-weight: 600; }
.balance__nums .good b { color: var(--good); }
.balance.is-warn .balance__nums .good b { color: var(--warn); }
.meter { height: 5px; border-radius: 9px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--good); transform-origin: left; transform: scaleX(0); transition: transform 1s var(--cine); }
.balance.is-warn .meter i { background: var(--warn); }
[dir="rtl"] .meter i { transform-origin: right; }
.balance__lbl { font: 600 11.5px var(--mono); white-space: nowrap; color: var(--good); }
.balance__lbl.is-warn { color: var(--warn); } .balance__lbl.is-bad { color: var(--bad); }

.bulk { margin: 0 0 12px; }
.bulk summary {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 500; color: var(--fg-2); padding: 4px 0; transition: color .2s;
}
.bulk summary::-webkit-details-marker { display: none; }
.bulk summary svg { width: 15px; height: 15px; transition: transform .4s var(--spring); }
.bulk[open] summary svg { transform: rotate(135deg); }
@media (hover: hover) { .bulk summary:hover { color: var(--fg); } }
.bulk .field { margin: 10px 0 0; animation: panel-in .4s var(--cine); }

.submit-row { display: flex; align-items: center; gap: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.submit-info { flex: 1; min-width: 0; }
.estimate { margin: 0 0 6px; font: 600 12.5px var(--mono); color: var(--fg-2); }
.estimate.is-over { color: var(--warn); }
.fine { display: flex; gap: 8px; margin: 0; font-size: 12px; line-height: 1.55; color: var(--fg-3); }
.fine svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--good); }
.note { margin: 0 0 16px; font-size: 13.5px; color: var(--fg-2); }

/* -------------------------------- buttons ------------------------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid transparent; overflow: hidden;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; isolation: isolate;
  transition: transform .25s var(--spring), background-color .2s, border-color .2s, color .2s, opacity .2s, box-shadow .3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.96); transition-duration: .1s; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn:focus-visible, .tab:focus-visible, .chip-btn:focus-visible, .tt:focus-visible, .reveal-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* click ripple (fx.js adds the span; transform + opacity only) */
.ripple {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; pointer-events: none; z-index: -1;
  background: currentColor; opacity: .28; transform: scale(0); animation: ripple .6s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(var(--rs, 30)); opacity: 0; } }

.btn--primary { color: #fff; background: var(--grad); box-shadow: 0 14px 30px -14px rgba(107,120,255,.95), inset 0 1px 0 rgba(255,255,255,.22); }
.btn--primary::after {   /* sheen: a transformed highlight, no repaint */
  content: ""; position: absolute; inset: 0; transform: translateX(-120%); z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.3) 50%, transparent 70%);
  transition: transform .9s var(--cine);
}
.btn--primary::before {   /* idle shimmer every few seconds so the CTA reads as alive */
  content: ""; position: absolute; inset: 0; z-index: -1; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 40%, rgba(255,255,255,.18) 50%, transparent 60%);
  animation: idle-shine 6s var(--ease) 2.5s infinite;
}
@keyframes idle-shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@media (hover: hover) {
  .btn--primary:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -16px rgba(107,120,255,1), inset 0 1px 0 rgba(255,255,255,.25); }
  .btn--primary:hover::after { transform: translateX(120%); }
}
.btn--primary .arrow { width: 17px; height: 17px; transition: transform .35s var(--spring); }
@media (hover: hover) { .btn--primary:hover .arrow { transform: translateX(4px); } }
[dir="rtl"] .btn--primary .arrow { transform: scaleX(-1); }
.btn--primary.is-blocked { filter: grayscale(.6); opacity: .7; }
.btn--lg { height: 50px; padding: 0 24px; font-size: 15px; border-radius: 14px; }
.btn--block { width: 100%; }

.btn--quiet { background: var(--panel-2); border-color: var(--line-2); color: var(--fg); min-width: 92px; }
@media (hover: hover) { .btn--quiet:hover { border-color: var(--line-3); transform: translateY(-1px); } }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--fg-2); }
@media (hover: hover) { .btn--ghost:hover { color: var(--fg); border-color: var(--line-3); background: var(--panel-2); } }
.btn--danger { color: #fff; background: #e0344f; box-shadow: 0 12px 26px -14px rgba(224,52,79,.9); }
.btn--danger-ghost { color: var(--bad); border-color: rgba(255,107,129,.3); }
@media (hover: hover) { .btn--danger-ghost:hover { color: var(--bad); border-color: var(--bad); background: rgba(255,107,129,.08); } }
.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.is-copied { color: var(--good); border-color: rgba(61,220,151,.45); }

.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: rgba(255,255,255,.22); font-size: 12px; animation: pop .4s var(--spring); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

.spin {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; opacity: .9;
  animation: rot .7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ------------------------------ side cards ------------------------------ */
.card { padding: 18px; }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__head h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.card__head p { margin: 3px 0 0; font-size: 12.5px; color: var(--fg-3); }
.count { font: 600 11px var(--mono); padding: 2px 7px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--fg-2); }

.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); flex: none; transition: background .3s; }
.live.running .live-dot { background: var(--good); }
.live.running .live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--good); animation: ping 1.8s var(--ease) infinite; }
.live__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.empty { text-align: center; padding: 18px 8px 8px; }
.empty p { margin: 12px auto 0; max-width: 270px; font-size: 13px; color: var(--fg-3); }
.empty__art { display: grid; gap: 6px; width: 170px; margin: 0 auto; }
.empty__art span { height: 10px; border-radius: 6px; background: var(--line); position: relative; overflow: hidden; }
.empty__art span::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); animation: shimmer 2.4s ease-in-out infinite; }
.empty__art span:nth-child(1) { width: 70%; } .empty__art span:nth-child(2) { width: 100%; } .empty__art span:nth-child(3) { width: 45%; }
.empty__art span:nth-child(2)::after { animation-delay: .2s; } .empty__art span:nth-child(3)::after { animation-delay: .4s; }
@keyframes shimmer { to { transform: translateX(100%); } }

.checklist { list-style: none; margin: 0; padding: 0; counter-reset: c; display: grid; }
.checklist li {
  counter-increment: c; position: relative; padding: 9px 0 9px 34px; font-size: 13.5px; line-height: 1.5;
  color: var(--fg-2); border-top: 1px solid var(--line);
}
[dir="rtl"] .checklist li { padding: 9px 34px 9px 0; }
.checklist li:first-child { border-top: 0; }
.checklist li::before {
  content: counter(c); position: absolute; inset-inline-start: 0; top: 9px;
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font: 600 11.5px var(--mono); color: var(--fg-2); background: var(--panel-2); border: 1px solid var(--line-2);
}
.checklist a, .gd a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; transition: text-decoration-color .2s; }
@media (hover: hover) { .checklist a:hover, .gd a:hover { text-decoration-color: var(--blue); } }

/* -------------------------------- tasks --------------------------------- */
.tasklist { display: grid; gap: 10px; }
.panel .tasklist:not(:empty) { margin-top: 6px; }
.task {
  position: relative; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel-2); overflow: hidden;
  animation: task-in .6s var(--cine);
}
.task::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 2px; background: var(--line-2); }
.task.tone-run::before { background: linear-gradient(var(--blue), var(--violet)); }
.task.tone-ok::before { background: var(--good); }
.task.tone-err::before { background: var(--bad); }
.task.tone-warn::before, .task.tone-cancel::before { background: var(--warn); }
@keyframes task-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.task__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 11px 12px; }
.task__who { display: grid; gap: 2px; min-width: 0; }
.task__email { display: flex; align-items: center; gap: 7px; min-width: 0; font: 600 13px var(--font); }
.task__email svg { flex: none; color: var(--fg-3); }
.task__email span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task__sub { font-size: 10.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task__body { padding: 0 12px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.task__body > * { min-width: 0; }
.task__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; flex: none; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.q { color: var(--fg-2); background: var(--line); }
.badge.run { color: var(--blue); background: rgba(107,140,255,.12); }
.badge.run::before { animation: blink 1.1s infinite; }
.badge.ok { color: var(--good); background: rgba(61,220,151,.12); }
.badge.err { color: var(--bad); background: rgba(255,107,129,.12); }
.badge.cancel, .badge.warn { color: var(--warn); background: rgba(242,184,75,.12); }
@keyframes blink { 50% { opacity: .25; } }

.note-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; line-height: 1.5; background: var(--line); color: var(--fg-2); }
.note-row svg { flex: none; margin-top: 1px; }
.note-row .spin { width: 13px; height: 13px; border-width: 1.5px; color: var(--blue); margin-top: 2px; }
.note-row.is-q { background: rgba(242,184,75,.07); color: var(--fg); }
.note-row.is-q svg { color: var(--warn); }
.note-row.is-run { background: rgba(107,140,255,.08); color: var(--fg); }
.note-row.is-err { background: rgba(255,107,129,.08); color: var(--fg); }
.note-row.is-err svg { color: var(--bad); }
.note-row.is-warn { background: rgba(242,184,75,.08); color: var(--fg); }
.note-row.is-warn svg { color: var(--warn); }
.note-tag { margin-inline-start: auto; font-size: 10px; opacity: .55; }

.prog { display: grid; gap: 6px; }
.prog__row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--fg); }
.prog__step { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog__step b { color: var(--fg-3); font-weight: 500; margin-inline-end: 4px; }
.prog__bar { position: relative; height: 5px; border-radius: 9px; background: var(--line); overflow: hidden; }
.prog__bar i { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--violet)); transform-origin: left; transition: transform .8s var(--cine); }
[dir="rtl"] .prog__bar i { transform-origin: right; }
.prog__bar::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); animation: shimmer 1.6s ease-in-out infinite; }
.prog__msg { font-size: 11.5px; color: var(--fg-3); }

.steps summary { cursor: pointer; list-style: none; font-size: 11.5px; font-weight: 600; color: var(--fg-3); display: inline-flex; align-items: center; gap: 6px; }
.steps summary::-webkit-details-marker { display: none; }
.steps summary::before { content: "▸"; transition: transform .3s var(--spring); display: inline-block; }
.steps[open] summary::before { transform: rotate(90deg); }
.steps ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; animation: panel-in .35s var(--cine); }
.steps li { position: relative; display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--fg-3); padding: 3px 0; }
.steps li .dot { width: 16px; height: 16px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel); }
.steps li .dot svg { width: 9px; height: 9px; }
.steps li.done { color: var(--fg-2); }
.steps li.done .dot { background: var(--good); border-color: transparent; color: #04140d; }
.steps li.active { color: var(--fg); font-weight: 600; }
.steps li.active .dot { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(107,140,255,.18); }
.steps li.failed { color: var(--bad); } .steps li.failed .dot { border-color: var(--bad); background: rgba(255,107,129,.15); }
.steps li.cancelled { text-decoration: line-through; }

.result-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: rgba(61,220,151,.07); border: 1px solid rgba(61,220,151,.22); animation: panel-in .45s var(--cine); color: var(--fg); font-size: 13px; }
.result-link svg { flex: none; color: var(--good); }
.result-link a { flex: 1; min-width: 0; color: var(--good); font: 500 12px var(--mono); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .result-link a:hover { text-decoration: underline; } }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; color: var(--fg-3); }
.task-meta b { font-weight: 600; } .task-meta .is-warn { color: var(--warn); } .task-meta .is-good { color: var(--good); }

/* ------------------------------- history -------------------------------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
.size-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-3); }
.size-pick select { height: 32px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--field); font: 500 12.5px var(--mono); cursor: pointer; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; font-size: 12.5px; color: var(--fg-2); }
.skeleton { border-radius: 12px; background: var(--line); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); animation: shimmer 1.4s ease-in-out infinite; }
.panel .empty { padding: 26px 8px; font-size: 13px; color: var(--fg-3); }

/* -------------------------------- modal --------------------------------- */
.modal {
  width: min(520px, calc(100% - 28px)); max-height: min(86vh, 760px); padding: 0; border: 1px solid var(--line-2);
  border-radius: 20px; background: var(--panel); color: var(--fg); overflow: hidden;
  box-shadow: 0 50px 100px -30px rgba(0,0,0,.85);
}
.modal--wide { width: min(680px, calc(100% - 28px)); }
.modal[open] { display: flex; flex-direction: column; animation: modal-in .45s var(--spring); }
.modal::backdrop { background: rgba(3, 4, 8, .72); animation: fade-in .3s var(--ease); }
.modal.is-fallback[open] { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 210; }
.modal-shade { position: fixed; inset: 0; z-index: 200; background: rgba(3, 4, 8, .72); animation: fade-in .3s var(--ease); }
.exp-box { width: 100%; min-height: 150px; max-height: 40vh; margin: 12px 0 0; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--field); font: 12.5px/1.6 var(--mono); resize: vertical; white-space: pre; overflow: auto; }
:root[data-theme="light"] .modal::backdrop { background: rgba(15, 23, 42, .4); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes fade-in { from { opacity: 0; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.modal__x { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--fg-3); cursor: pointer; transition: color .2s, background .2s, transform .3s var(--spring); }
.modal__x svg { width: 17px; height: 17px; }
@media (hover: hover) { .modal__x:hover { color: var(--fg); background: var(--panel-2); transform: rotate(90deg); } }
.modal__body { padding: 18px 20px; overflow-y: auto; }
.modal__text { margin: 0; font-size: 14px; line-height: 1.65; color: var(--fg-2); white-space: pre-line; word-break: break-word; }
.modal__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal__actions { display: flex; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); -webkit-appearance: auto; appearance: auto; }

.gd { display: grid; gap: 20px; }
.gd h4 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.gd-steps { list-style: none; margin: 0; padding: 0; counter-reset: g; display: grid; gap: 10px; }
.gd-steps li { counter-increment: g; position: relative; display: grid; gap: 2px; padding-inline-start: 38px; font-size: 13.5px; color: var(--fg-2); }
.gd-steps li::before {
  content: counter(g); position: absolute; inset-inline-start: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font: 700 12px var(--mono); color: #fff; background: var(--grad);
}
.gd-steps b { color: var(--fg); font-size: 14px; }
.gd-list { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; font-size: 13.5px; color: var(--fg-2); }
.gd-warn { margin: 10px 0 0; font-size: 12.5px; color: var(--warn); }

/* -------------------------------- footer -------------------------------- */
.foot {
  position: relative; z-index: 1; width: min(1240px, 100% - 40px); margin: 28px auto 0; padding: 18px 0 24px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-3);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.foot p { margin: 0; max-width: 640px; }

/* -------------------------------- toasts -------------------------------- */
.toasts { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); inset-inline-end: 20px; z-index: 100; display: grid; gap: 8px; width: min(370px, calc(100% - 32px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r);
  background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 24px 48px -20px rgba(0,0,0,.75);
  animation: toast-in .5s var(--spring);
}
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: var(--good); } .toast.err svg { color: var(--bad); } .toast.info svg { color: var(--blue); }
.toast p { margin: 0; font-size: 13.5px; } .toast .ti { font-weight: 600; }
.toast small { color: var(--fg-2); font-size: 12.5px; }

#confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

/* theme switch fallback path (View Transitions) — the coin path is the default */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ------------------------------ responsive ------------------------------ */
@media (max-height: 760px) and (min-width: 641px) {
  .intro .pill { display: none; }
  .intro h1 { margin-top: 4px; }
}
@media (max-width: 1060px) {
  .shell { grid-template-columns: 1fr; max-width: 760px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .top__in, .shell, .foot { width: calc(100% - 28px); }
  .top__in { height: 60px; }
  .top__right { gap: 6px; }
  .status { padding: 0 11px; }
  .status span, .guide-btn span { display: none; }
  .guide-btn { padding: 0; width: 36px; }
  .intro { margin-bottom: 12px; }
  .intro .pill { display: none; }
  .intro h1 { font-size: 28px; margin-top: 4px; }
  .intro p { font-size: 14px; line-height: 1.45; }
  .field { margin-bottom: 11px; }
  .field > label { margin-bottom: 5px; }
  .flow { margin: 4px 0 10px; }
  .tip { font-size: 11.5px; }
  .bulk { margin-bottom: 8px; }
  .submit-row { padding-top: 12px; }
  .tabs { margin: 8px; }
  .tab { font-size: 12.5px; padding: 0 4px; }
  .panel { padding: 6px 16px 18px; }
  .flow__s { font-size: 11.5px; gap: 6px; }
  .flow__s:not(:last-child)::after { margin: 0 6px; }
  .grid2 { grid-template-columns: 1fr; }
  .submit-row { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .submit-row .btn { width: 100%; }
  .balance { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
  .balance__nums { flex: 1 1 auto; }
  .balance__lbl { white-space: normal; text-align: end; }
  .balance .meter { order: 3; flex: 1 0 100%; }
  .toasts { inset-inline: 16px; bottom: 16px; width: auto; }
  .modal__foot { flex-direction: column-reverse; align-items: stretch; }
  .modal__actions { justify-content: flex-end; }
}
@media (max-width: 560px) {
  .flow__t { display: none; }
  .flow__s.is-now .flow__t { display: block; }
  .flow__s:not(.is-now) { flex: 0 1 auto; }
  .flow__s:not(.is-now):not(:last-child)::after { width: 18px; flex: none; }
}
@media (max-width: 430px) {
  .status { display: none; }
  .brand { font-size: 15px; gap: 8px; }
}
@media (max-width: 360px) {
  .top__right { gap: 5px; }
  .lang-btn .lang-code, .lang-btn .chev { display: none; }
  .lang-btn { padding: 0; width: 36px; }
  .brand { font-size: 14px; gap: 7px; }
  .brand__mark { width: 30px; height: 30px; }
  .tab { font-size: 12px; }
}

@media (pointer: coarse) {
  .input, .input.mono, .input--sm, textarea.input, .size-pick select { font-size: 16px; }
  .pool { animation: none; }
  .reveal-btn { width: 40px; height: 40px; }
  .btn--sm { height: 36px; }
}
@media (max-width: 640px) {
  .keyrow .btn--quiet { min-width: 0; padding: 0 16px; }
}
@media (min-width: 1700px) {
  .top__in, .shell, .foot { width: min(1360px, 100% - 80px); }
  .shell { grid-template-columns: minmax(0, 1fr) 420px; }
}
@media (forced-colors: active) {
  .btn, .input, .card, .frame, .tab.on, .chip-btn, .tt-f, .tt-b { border: 1px solid CanvasText; }
  .pool, .grain, .frame__glow { display: none; }
}

/* low-power / reduced motion: everything still works, nothing drifts */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  #tvl, #tvr { display: none !important; }
}
html.lowfx .pool, html.lowfx .grain { animation: none !important; }

/* =========================================================================
   LAYER 3 — colour, light and motion (still compositor-only; measured)
   ========================================================================= */
:root {
  --bg: #05060a;
  --panel: #0b0d14;
  --panel-2: #10131c;
  --field: #07080d;
  --blue: #7aa2ff;
  --violet: #a58bff;
  --rose: #ff8fc7;
  --mint: #5ef2c0;
  --amber: #ffd27a;
  --grad: linear-gradient(120deg, #5b8cff 0%, #8b6dff 45%, #d071c0 80%, #ff8fa8 100%);
  --grad-text: linear-gradient(95deg, #b9cbff 0%, #cdb9ff 28%, #ffb8dc 52%, #b8f3e2 76%, #b9cbff 100%);
}
:root[data-theme="light"] { --mint: #0b8f6a; --amber: #a86b00; }

/* utilities that replace inline styles (the CSP forbids them) */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skeleton--md { height: 84px; } .skeleton--lg { height: 96px; }
.offscreen-copy { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; }

/* local flags (no CDN) */
.fi { display: inline-block; width: 22px; height: 16px; background: center / cover no-repeat; border-radius: 3px; }
.fi-vn { background-image: url(flags/vn.svg); } .fi-gb { background-image: url(flags/gb.svg); }
.fi-cn { background-image: url(flags/cn.svg); } .fi-sa { background-image: url(flags/sa.svg); }
.fi-ru { background-image: url(flags/ru.svg); } .fi-id { background-image: url(flags/id.svg); }

/* Arabic: same layout as every language; the text itself still reads right-to-left per line */
.rtl-text :where([data-i18n], [data-i18n-html], p, li, h1, h2, h3, h4, small, .ti, .tip, .note-row span, .badge,
  .estimate, .balance__lbl, .balance__nums span, .modal__text, .prog__step, .prog__msg, .task__sub, .check span,
  #announceText) { unicode-bidi: plaintext; }
/* ...and every block sits on the LEFT, exactly like English (the page never mirrors) */
.rtl-text :where([data-i18n], [data-i18n-html], p, li, h1, h2, h3, h4, small, .ti, .tip, .note-row span, .estimate,
  .modal__text, .prog__msg, .check span, #announceText):not(.empty *) { text-align: left; }

/* ---- aurora halo: soft beams around the console, turning slowly (transform only) ---- */
.stage { position: relative; }
.stage > .frame { z-index: 1; }
.halo {
  position: absolute; inset: -46px -34px; z-index: 0; pointer-events: none; overflow: hidden; border-radius: 48px; opacity: .62;
  display: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
}
.halo::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 140%; aspect-ratio: 1; margin-left: -70%;
  transform: translateY(-50%) rotate(0deg); will-change: transform;
  background: conic-gradient(from 0deg,
    transparent 0 8%, rgba(122,162,255,.55) 16%, transparent 27%,
    transparent 40%, rgba(255,143,199,.42) 52%, transparent 63%,
    transparent 70%, rgba(94,242,192,.34) 80%, transparent 90%);
}
html.fx-halo .halo { display: block; animation: halo-in 1.4s var(--ease) both; }
html.fx-halo .halo::before { animation: halo-spin 28s linear infinite; }
@keyframes halo-in { from { opacity: 0; } }
@keyframes halo-spin { to { transform: translateY(-50%) rotate(360deg); } }
:root[data-theme="light"] .halo { opacity: .38; }
@media (pointer: coarse) { .halo::before { animation: none; } }
html.lowfx .halo::before { animation: none; }

/* ---- headline: a gradient stroke draws itself under the product name ---- */
.intro h1 .grad { position: relative; display: inline-block; padding-bottom: .04em; }
.intro h1 .grad::after {
  content: ""; position: absolute; left: 1%; right: 1%; bottom: -.04em; height: .075em; border-radius: 1em;
  background: var(--grad); transform: scaleX(0); transform-origin: left; opacity: .85;
  animation: swash 1.2s var(--cine) 1.15s forwards;
}
@keyframes swash { to { transform: scaleX(1); } }

/* ---- primary button: magnetic offset (fx.js sets --mx/--my) ---- */
.btn--primary { transform: translate(var(--mx, 0px), var(--my, 0px)); }
@media (hover: hover) { .btn--primary:hover { transform: translate(var(--mx, 0px), calc(var(--my, 0px) - 2px)); } }
.btn--primary:active { transform: translate(var(--mx, 0px), var(--my, 0px)) scale(.96); }

/* ---- toasts: countdown line ---- */
.toast { position: relative; overflow: hidden; }
.toast__life {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px; transform-origin: left; opacity: .7;
  background: var(--blue); animation: life linear forwards;
}
.toast.ok .toast__life { background: var(--good); } .toast.err .toast__life { background: var(--bad); }
@keyframes life { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---- live panel: a light runs across the top while jobs are running ---- */
.live { overflow: hidden; }
.live::before {
  content: ""; position: absolute; top: 0; left: 0; width: 35%; height: 2px; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--mint), transparent);
}
.live.running::before { opacity: .9; animation: sweep 2.2s var(--ease) infinite; }

/* ---- success: seal draws itself, card pulses once ---- */
.result-link .seal { width: 18px; height: 18px; flex: none; color: var(--good); }
.seal circle { stroke-dasharray: 63; stroke-dashoffset: 63; animation: draw .7s var(--ease) forwards; }
.seal path { stroke-dasharray: 16; stroke-dashoffset: 16; animation: draw .45s .55s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.task.just-done { animation: done-glow 2.4s var(--ease) 1; }
@keyframes done-glow {
  0% { box-shadow: 0 0 0 0 rgba(94,242,192,0); }
  18% { box-shadow: 0 0 0 2px rgba(94,242,192,.6), 0 0 46px 2px rgba(94,242,192,.22); }
  100% { box-shadow: 0 0 0 0 rgba(94,242,192,0); }
}

/* ---- richer accents ---- */
.badge.ok { color: var(--mint); background: rgba(94,242,192,.12); }
:root[data-theme="light"] .badge.ok { color: var(--good); background: rgba(11,127,83,.1); }
.task.tone-ok::before { background: linear-gradient(var(--mint), var(--good)); }
.flow__s.is-done .flow__n { background: linear-gradient(135deg, var(--mint), #3ddc97); }
.prog__bar i { background: linear-gradient(90deg, var(--blue), var(--violet) 60%, var(--rose)); }
.brand__mark::after { background: radial-gradient(closest-side, rgba(165,139,255,.45), transparent); }
.status i { box-shadow: 0 0 10px currentColor; color: var(--good); }

@media (prefers-reduced-motion: reduce) {
  .intro h1 .grad::after { transform: scaleX(1); }
  .seal circle, .seal path { stroke-dashoffset: 0; }
}

/* the halo must never widen the page (phones scrolled sideways by 20px) */
html, body { overflow-x: clip; }
@media (max-width: 640px) { .halo { inset: -28px -6px; } }
