/* Zenith design tokens + base kit components. Light ("paper") is the default; add class="stage" on <body>
   (or any container) for the dark stage mode used on TVs, the orchestra and most phone screens. */

@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(./vendor/fonts/plus-jakarta-sans-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(./vendor/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Newsreader'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(./vendor/fonts/newsreader-latin-wght-normal.woff2) format('woff2'); }
@font-face { font-family: 'Newsreader'; font-style: italic; font-display: swap; font-weight: 200 800;
  src: url(./vendor/fonts/newsreader-latin-wght-italic.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url(./vendor/fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2'); }

:root {
  /* brand */
  --ink: #19173D;
  --paper: #F7F6F2;
  --a1: #62BBF3;            /* sky */
  --a2: #4E308D;            /* violet */
  --a2-glow: #8F6BFF;       /* violet lifted for glow on dark backgrounds */
  --grad: linear-gradient(135deg, #62BBF3 0%, #4E308D 100%);
  --grad-glow: linear-gradient(135deg, #7CCBFF 0%, #8F6BFF 100%);

  /* status */
  --ok: #3EE6A8;
  --warn: #FFC15E;
  --think: #62BBF3;
  --hot: #FF7AB6;

  /* light surfaces */
  --bg: var(--paper);
  --surface: #FFFFFF;
  --line: #E1DFEA;
  --text: var(--ink);
  --dim: #5B5A72;

  /* stage (dark) surfaces */
  --stage-bg: #070618;
  --stage-bg-2: #0E0B2A;
  --stage-panel: rgba(255, 255, 255, 0.045);
  --stage-panel-2: rgba(255, 255, 255, 0.075);
  --stage-line: rgba(186, 196, 255, 0.13);
  --stage-ink: #F1F2FF;
  --stage-dim: rgba(222, 226, 255, 0.62);

  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --r-sm: 10px; --r: 16px; --r-lg: 24px; --r-xl: 32px;
  --shadow: 0 10px 30px rgba(25, 23, 61, 0.12);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
/* The hidden attribute always wins, even over a component's display:grid/flex (gates rely on this). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-ui); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; line-height: 1.45;
}
img, svg, canvas, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- stage mode ---------- */
.stage {
  --bg: var(--stage-bg); --surface: var(--stage-panel); --line: var(--stage-line); --text: var(--stage-ink); --dim: var(--stage-dim);
  color-scheme: dark; color: var(--stage-ink); background: var(--stage-bg);
}
body.stage {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(78, 48, 141, 0.55), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(98, 187, 243, 0.22), transparent 60%),
    var(--stage-bg);
  background-attachment: fixed;
}

/* ---------- type ---------- */
.pz-display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.05; margin: 0; }
.pz-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--a1); }
.pz-grad-text { background: var(--grad-glow); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pz-mono { font-family: var(--font-mono); }
.pz-dim { color: var(--dim); }

/* ---------- layout helpers ---------- */
.pz-wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }
.pz-center { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.pz-stack > * + * { margin-top: 14px; }
.pz-row { display: flex; gap: 10px; align-items: center; }

/* ---------- surfaces ---------- */
.pz-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px;
}
.stage .pz-card { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* ---------- controls ---------- */
.pz-btn {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 26px; border-radius: 999px; font-weight: 800; font-size: 17px; letter-spacing: 0.01em;
  color: #fff; background: var(--grad); text-decoration: none; position: relative; isolation: isolate;
  box-shadow: 0 10px 28px rgba(78, 48, 141, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.pz-btn:active { transform: scale(0.97); }
.pz-btn[disabled] { opacity: .5; pointer-events: none; }
.pz-btn.block { width: 100%; }
.pz-btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.stage .pz-btn.ghost { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.22); }
.pz-btn.light { background: #fff; color: var(--ink); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25); }

.pz-field { display: block; }
.pz-field > span { display: block; font-size: 13px; font-weight: 700; color: var(--dim); margin-bottom: 6px; letter-spacing: .02em; }
.pz-input {
  width: 100%; min-height: 54px; padding: 0 18px; border-radius: var(--r); border: 1.5px solid var(--line);
  background: var(--surface); font-size: 17px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.pz-input:focus { border-color: var(--a1); box-shadow: 0 0 0 4px rgba(98, 187, 243, 0.2); }
.stage .pz-input { background: rgba(255, 255, 255, 0.06); }

.pz-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase; background: var(--stage-panel-2); border: 1px solid var(--line);
}
.pz-forfun {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 800;
  color: #1b1640; background: linear-gradient(135deg, #FFE08A, #FFC15E); letter-spacing: .04em;
}

/* ---------- brand mark (wordmark; swap for the official logo when TASK-08 finds it) ---------- */
.pz-brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.005em; }
.pz-brand i { width: 14px; height: 14px; border-radius: 50%; background: var(--grad-glow); box-shadow: 0 0 14px rgba(124, 203, 255, 0.8); }

/* ---------- kit overlays (retry / queue / slow down) and the gate sheet ---------- */
.pz-overlay {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px;
  background: rgba(7, 6, 24, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: pz-fade .25s var(--ease);
}
.pz-overlay .pz-card { max-width: 400px; width: 100%; text-align: center; color: var(--stage-ink); background: #120f33; border-color: var(--stage-line); }
.pz-overlay h2 { font-family: var(--font-display); font-size: 28px; font-weight: 600; margin: 8px 0 8px; }
.pz-overlay p { color: var(--stage-dim); margin: 0 0 18px; }
.pz-queue-n { font-family: var(--font-display); font-size: 84px; line-height: 1; font-weight: 600; }
.pz-spinner { width: 46px; height: 46px; margin: 4px auto 10px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--a1); animation: pz-spin 0.9s linear infinite; }

.pz-sheet-back { position: fixed; inset: 0; z-index: 1000; background: rgba(7, 6, 24, 0.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: pz-fade .25s var(--ease); }
.pz-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; max-width: 560px; margin: 0 auto; color: var(--stage-ink);
  background: linear-gradient(180deg, #17124a 0%, #0c0a26 100%); border: 1px solid var(--stage-line); border-bottom: 0;
  border-radius: 28px 28px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5); animation: pz-up .38s var(--ease);
}
.pz-sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.22); margin: 0 auto 14px; }

@keyframes pz-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pz-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pz-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .pz-overlay, .pz-sheet, .pz-sheet-back { animation: none; }
}

/* ---------- follow gate ---------- */
.pz-gate-top { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.pz-gate-title { font-size: 28px; margin: 6px 0 10px; }
.pz-gate-reward { margin: 0; display: flex; gap: 8px; align-items: center; color: var(--stage-ink); font-weight: 700; }
.pz-lock { flex: none; width: 22px; height: 22px; border-radius: 7px; background: var(--grad-glow); position: relative; box-shadow: 0 0 14px rgba(143, 107, 255, .6); }
.pz-lock::before { content: ''; position: absolute; left: 6px; top: -6px; width: 10px; height: 10px; border: 2.5px solid #9fd8ff; border-bottom: 0; border-radius: 6px 6px 0 0; }
.pz-lock::after { content: ''; position: absolute; left: 9.5px; top: 8px; width: 3px; height: 6px; border-radius: 2px; background: #0b0a24; }
.pz-gate-qr { width: 108px; text-align: center; }
.pz-gate-qr .pz-qr { border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 3px rgba(255,255,255,.08), 0 10px 30px rgba(0,0,0,.4); }
.pz-gate-qr small { display: block; margin-top: 6px; font-size: 10.5px; color: var(--stage-dim); }
.pz-gate-handle { display: flex; align-items: center; gap: 10px; margin: 18px 0 16px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid var(--stage-line); flex-wrap: wrap; }
.pz-gate-handle b { font-size: 17px; }
.pz-gate-handle .pz-dim { flex-basis: 100%; font-size: 13px; margin-top: -4px; padding-left: 38px; }
.pz-ig-glyph { width: 20px; height: 20px; border-radius: 6px; border: 2.2px solid currentColor; position: relative; flex: none; }
.pz-ig-glyph::before { content: ''; position: absolute; inset: 3.5px; border-radius: 50%; border: 2.2px solid currentColor; }
.pz-ig-glyph.big { width: 28px; height: 28px; border-radius: 9px; color: #fff; border: 0; background: linear-gradient(45deg, #FFC15E, #FF5C96 45%, #8F6BFF); }
.pz-ig-glyph.big::before { inset: 7px; border-color: #fff; }
.pz-gate-fine { text-align: center; font-size: 12px; color: var(--stage-dim); margin: 14px 0 0; }
.pz-sheet-out { animation: pz-down .26s var(--ease) forwards; }
@keyframes pz-down { to { transform: translateY(100%); } }

/* ---------- TV toggle ---------- */
.pz-tvtoggle { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.pz-tvtoggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pz-switch { flex: none; width: 44px; height: 26px; border-radius: 99px; background: rgba(255,255,255,.18); position: relative; transition: background .2s; }
.pz-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.pz-tvtoggle input:checked + .pz-switch { background: var(--grad); }
.pz-tvtoggle input:checked + .pz-switch::after { transform: translateX(18px); }
.pz-tvtoggle input:focus-visible + .pz-switch { outline: 2px solid var(--a1); outline-offset: 2px; }
.pz-tvtoggle b { display: block; font-size: 14px; }
.pz-tvtoggle small { display: block; font-size: 12px; color: var(--dim); }
.pz-qr svg { width: 100%; height: auto; }

/* ---------- care card (CONTRACT 13.3) ---------- */
.pz-care { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, #1b2a4f 0%, #0b0a24 70%); color: #F1F2FF; animation: pz-fade .3s var(--ease); }
.pz-care-card { position: relative; width: 100%; max-width: 420px; text-align: center; }
/* always-on safety net right under long free-text inputs (phone only): small, calm, tap-to-call */
.pz-care-net { display: block; margin: 8px 2px 4px; text-align: left; font-family: var(--font-body, inherit); font-size: 14px; line-height: 1.4; color: rgba(241,242,255,.62); }
.pz-care-net a { color: inherit; text-decoration: none; }
.pz-care-net b { color: rgba(241,242,255,.88); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.pz-care-net .nw { white-space: nowrap; }
.tv .pz-care-net { display: none !important; }
/* degraded safety mode (no live AI crisis check): normal text size, a soft highlight card, still calm */
:root:not([data-pz-safety='live']) .pz-care-net { font-size: 16px; padding: 10px 12px; border-radius: 12px; color: rgba(241,242,255,.9);
  background: rgba(159,216,255,.08); border: 1px solid rgba(159,216,255,.28); }
.pz-care-glow { width: 84px; height: 84px; margin: 0 auto 22px; border-radius: 50%; background: radial-gradient(circle, rgba(159,216,255,.9), rgba(143,107,255,.2) 60%, transparent 72%); animation: pz-breathe 5s ease-in-out infinite; }
@keyframes pz-breathe { 50% { transform: scale(1.12); opacity: .8; } }
.pz-care h2 { font-family: var(--font-display); font-weight: 600; font-size: 34px; margin: 0 0 12px; }
.pz-care p { font-size: 19px; line-height: 1.45; margin: 0 0 14px; color: rgba(241,242,255,.88); }
.pz-care-line { font-weight: 800; font-size: 21px !important; color: #fff !important; margin-bottom: 22px !important; }
.pz-care .pz-btn { margin-top: 10px; }

/* ---------- big screen (CONTRACT 12.4) ---------- */
.pz-stage-title { font-size: 30px; margin: 6px 0 8px; }
.pz-stage-nicks { display: grid; gap: 10px; margin: 16px 0 12px; }
.pz-nick { font-family: var(--font-mono); letter-spacing: .02em; font-size: 20px; }
.pz-bigscreen { background: linear-gradient(135deg, #FF8FC0, #8F6BFF); }
.pz-tv-glyph { width: 22px; height: 15px; border: 2.5px solid #fff; border-radius: 4px; position: relative; }
.pz-tv-glyph::after { content: ''; position: absolute; left: 4px; right: 4px; bottom: -6px; height: 2.5px; background: #fff; border-radius: 2px; }
.pz-token { font-family: var(--font-mono); font-weight: 800; font-size: 64px; letter-spacing: .18em; text-align: center; margin: 10px 0; }
.pz-token-qr { width: 140px; margin: 0 auto 16px; border-radius: 12px; overflow: hidden; background: #fff; }
.pz-err { color: #ffb4a8; font-weight: 600; }
