/* ClassKit styles — tokens first, then layout, components, tools.
   v0.5 visual direction D · 明亮书房 (Bright Studio). Reference: design/visual-directions/d-bright-studio.html */

@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope-latin-var.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ===== v0.5 direction D · 明亮书房 (Bright Studio) tokens ===== */
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-2: #f4efe6;
  --surface-3: #eae4d9;
  --ink: #1a1d24;
  --ink-2: #3b3f49;
  --muted: #5f6370;
  --line: #eae3d6;
  --line-strong: #858893;
  --lip: #e3dbcc;
  --brand: #0b7a62;
  --brand-hover: #096a55;
  --brand-lip: #065444;
  --brand-ink: #ffffff;
  --brand-soft: #e5f4ee;
  --brand-line: #a8dac8;
  --focus: #0b7a62;
  --good: #16a34a; --good-ink: #15803d;
  --warn: #e69100; --warn-ink: #a35a00;
  --bad: #e5484d; --bad-ink: #c02b31;
  --danger-ink: #ffffff;
  --pro: #1a1d24; --pro-on: #ffd23f; --pro-ink: #1a1d24;
  --stage: #ffffff;
  --overlay: rgba(26, 29, 36, 0.42);
  --shadow-sm: 0 1px 2px rgba(40, 32, 20, 0.06);
  --shadow: 0 1px 2px rgba(40, 32, 20, 0.05), 0 8px 22px -10px rgba(40, 32, 20, 0.16);
  --shadow-lg: 0 2px 4px rgba(40, 32, 20, 0.05), 0 30px 60px -22px rgba(40, 32, 20, 0.3);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --logo-bg: #1a1d24;
  --tag-new: var(--brand);
  --tag-login: var(--muted);
  --good-soft: color-mix(in srgb, var(--good) 12%, var(--surface));
  --warn-soft: color-mix(in srgb, var(--warn) 14%, var(--surface));
  --bad-soft: color-mix(in srgb, var(--bad) 10%, var(--surface));
  /* 5 category colours = wayfinding: fill (carries an ink glyph) / soft tint / ink (text-safe) */
  --cat-noise: #ff7a5c; --cat-noise-soft: #ffede6; --cat-noise-ink: #b7381e;
  --cat-time: #ffbe2e; --cat-time-soft: #fff3d6; --cat-time-ink: #8f5b00;
  --cat-people: #44a8f5; --cat-people-soft: #e3f1fd; --cat-people-ink: #0e64a8;
  --cat-fun: #f468ae; --cat-fun-soft: #fde8f2; --cat-fun-ink: #b0256c;
  --cat-create: #9b7df8; --cat-create-soft: #efeafe; --cat-create-ink: #6142d4;
  /* joy = celebration colours (stage, previews, confetti only, never text) */
  --joy-coral: #ff7a5c; --joy-sun: #ffbe2e; --joy-sky: #44a8f5; --joy-berry: #f468ae;
  --joy-grape: #9b7df8; --joy-leaf: #34c38f; --joy-gold: #ffd23f;
  /* scoreboard timer style: same in both themes */
  --score-bg: #0e1016; --score-cell: #1a1d27; --score-digit: #ffd23f; --score-off: #2a2e3c;
  /* type scale (UI) */
  --topbar-h: 64px;
  --panel-w: 340px;
  --font: 'Manrope', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --text-xs: 12px; --text-meta: 13px; --text-sm: 14px; --text-md: 16px; --text-lg: 18px;
  --text-xl: 20px; --text-2xl: 24px; --text-3xl: 32px; --text-hero: clamp(34px, 5vw, 54px);
  /* type scale (stage, read by students) */
  --stage-text-s: clamp(16px, 2.2vmin, 24px);
  --stage-text-m: clamp(20px, 3.2vmin, 36px);
  --stage-text-l: clamp(28px, 5vmin, 56px);
  --stage-text-xl: clamp(40px, 9vmin, 110px);
  --stage-num: min(17vmin, 150px);
  --stage-num-full: min(19vmin, 190px);
  --font-mono: ui-monospace, Consolas, 'Cascadia Mono', monospace;
  /* spacing, radius, motion, layers */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;
  --radius-xs: 8px; --radius-sm: 12px; --radius-md: 14px; --radius: 16px; --radius-lg: 20px; --radius-xl: 28px; --radius-pill: 999px;
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-pop: cubic-bezier(0.2, 1.4, 0.4, 1);
  --z-stage-ui: 5; --z-sticky: 20; --z-topbar: 50; --z-menu: 60; --z-fs-exit: 70;
  --z-present: 80; --z-confetti: 90; --z-dialog: 120; --z-toast: 130;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1013; --surface: #17191e; --surface-2: #1f2228; --surface-3: #2a2d35;
    --ink: #eeeff2; --ink-2: #c9ccd3; --muted: #9da1ab; --line: #2a2d34; --line-strong: #696e7a; --lip: #08090b;
    --brand: #4fd6b0; --brand-hover: #74e0c2; --brand-lip: #2b9c7f; --brand-ink: #04261d;
    --brand-soft: #13332b; --brand-line: #1f5c4b; --focus: #4fd6b0;
    --good: #22c55e; --good-ink: #4ade80; --warn: #f5a524; --warn-ink: #fbbf24; --bad: #f2555a; --bad-ink: #ff8a8e;
    --danger-ink: #1a0b10;
    --pro: #ffd23f; --pro-on: #1a1d24; --pro-ink: #ffd23f;
    --stage: #0b0c0f;
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 28px -10px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.5), 0 30px 70px -20px rgba(0, 0, 0, 0.8);
    --hi: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --logo-bg: #2a2d35;
    --cat-noise: #ff8a6e; --cat-noise-soft: #3b2520; --cat-noise-ink: #ffa58e;
    --cat-time: #ffc94f; --cat-time-soft: #3a2f15; --cat-time-ink: #ffd47a;
    --cat-people: #5db6fa; --cat-people-soft: #162e44; --cat-people-ink: #8ccbfc;
    --cat-fun: #ff82bd; --cat-fun-soft: #3b1f2e; --cat-fun-ink: #ffa3cf;
    --cat-create: #a991fa; --cat-create-soft: #2a2344; --cat-create-ink: #c3b2fc;
    --joy-coral: #ff8a6e; --joy-sun: #ffc94f; --joy-sky: #5db6fa; --joy-berry: #ff82bd;
    --joy-grape: #a991fa; --joy-leaf: #3fd39a; --joy-gold: #ffd23f;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0f1013; --surface: #17191e; --surface-2: #1f2228; --surface-3: #2a2d35;
  --ink: #eeeff2; --ink-2: #c9ccd3; --muted: #9da1ab; --line: #2a2d34; --line-strong: #696e7a; --lip: #08090b;
  --brand: #4fd6b0; --brand-hover: #74e0c2; --brand-lip: #2b9c7f; --brand-ink: #04261d;
  --brand-soft: #13332b; --brand-line: #1f5c4b; --focus: #4fd6b0;
  --good: #22c55e; --good-ink: #4ade80; --warn: #f5a524; --warn-ink: #fbbf24; --bad: #f2555a; --bad-ink: #ff8a8e;
  --danger-ink: #1a0b10;
  --pro: #ffd23f; --pro-on: #1a1d24; --pro-ink: #ffd23f;
  --stage: #0b0c0f;
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 28px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.5), 0 30px 70px -20px rgba(0, 0, 0, 0.8);
  --hi: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --logo-bg: #2a2d35;
  --cat-noise: #ff8a6e; --cat-noise-soft: #3b2520; --cat-noise-ink: #ffa58e;
  --cat-time: #ffc94f; --cat-time-soft: #3a2f15; --cat-time-ink: #ffd47a;
  --cat-people: #5db6fa; --cat-people-soft: #162e44; --cat-people-ink: #8ccbfc;
  --cat-fun: #ff82bd; --cat-fun-soft: #3b1f2e; --cat-fun-ink: #ffa3cf;
  --cat-create: #a991fa; --cat-create-soft: #2a2344; --cat-create-ink: #c3b2fc;
  --joy-coral: #ff8a6e; --joy-sun: #ffc94f; --joy-sky: #5db6fa; --joy-berry: #ff82bd;
  --joy-grape: #a991fa; --joy-leaf: #3fd39a; --joy-gold: #ffd23f;
  color-scheme: dark;
}

/* category binding: put one of these classes on any element (home sections, cards, stage) */
.c-noise  { --c: var(--cat-noise);  --cs: var(--cat-noise-soft);  --ci: var(--cat-noise-ink); }
.c-time   { --c: var(--cat-time);   --cs: var(--cat-time-soft);   --ci: var(--cat-time-ink); }
.c-people { --c: var(--cat-people); --cs: var(--cat-people-soft); --ci: var(--cat-people-ink); }
.c-fun    { --c: var(--cat-fun);    --cs: var(--cat-fun-soft);    --ci: var(--cat-fun-ink); }
.c-create { --c: var(--cat-create); --cs: var(--cat-create-soft); --ci: var(--cat-create-ink); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; text-wrap: balance; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: var(--text-sm); margin-top: 6px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 19px; letter-spacing: -0.025em; }
.brand-mark { display: inline-flex; width: 32px; height: 32px; flex: none; }
.brand-mark svg { width: 32px; height: 32px; display: block; }
.brand-mark .logo-bg { fill: var(--logo-bg); }

.tool-menu { position: relative; margin-left: 6px; }
.tool-menu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 6px; min-height: 44px; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; user-select: none;
  border: 0; background: transparent; color: var(--ink);
}
.tool-menu summary:hover, .tool-menu[open] summary { background: var(--surface-2); }
.tool-menu summary::-webkit-details-marker { display: none; }
.tool-menu summary { white-space: nowrap; }
.tool-menu summary .chev { color: var(--muted); font-size: 12px; }
.tool-menu-list { min-width: 240px; }
/* tool tiles: category-colour fill + ink glyph + 2px inner bottom edge (D) */
.ti, .tile-sm, .card .tile { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--c, var(--surface-3)); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.35); flex: none; color: #1a1d24; }
.ti svg, .tile-sm svg, .card .tile svg { width: 28px; height: 28px; display: block; }
.tile-sm { width: 32px; height: 32px; border-radius: 9px; }
.tile-sm svg { width: 22px; height: 22px; }
.tile-home { background: var(--surface-2); box-shadow: none; color: var(--ink-2); }
.tile-home svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.ic-f { fill: currentColor; stroke: none; }

/* ---------- Buttons & inputs ---------- */
.btn {
  font: inherit; font-size: var(--text-md); font-weight: 600; cursor: pointer;
  min-height: 44px; padding: 9px 18px; border-radius: var(--radius-md); font-weight: 700;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: 0 2px 0 var(--lip), var(--shadow-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-align: center; text-decoration: none;
  transition: transform var(--dur-1) ease, background var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--lip), var(--shadow-sm); }
.btn .ic { width: 19px; height: 19px; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; box-shadow: 0 2px 0 var(--brand-lip), 0 8px 18px -10px color-mix(in srgb, var(--brand) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { box-shadow: 0 0 0 var(--brand-lip), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-ink { background: var(--ink); color: var(--surface); border-color: transparent; box-shadow: 0 2px 0 #000, 0 8px 18px -10px rgba(0, 0, 0, 0.55); }
.btn-ink:hover { background: var(--ink-2); }
.btn-soft { background: var(--brand-soft); color: var(--brand); border-color: transparent; box-shadow: 0 2px 0 var(--brand-line); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-ghost:active { box-shadow: none; transform: none; }
.btn-danger { background: var(--bad-ink); color: var(--danger-ink); border-color: transparent; box-shadow: 0 2px 0 color-mix(in srgb, var(--bad-ink) 60%, #000); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad-ink) 88%, #000); border-color: transparent; }
.btn-ghost-danger { color: var(--bad-ink); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: 12px 22px; font-size: var(--text-md); border-radius: 16px; }
.btn-xl { min-height: 64px; padding: 16px 32px; font-size: 19px; border-radius: 20px; min-width: 150px; gap: 10px; box-shadow: 0 3px 0 var(--lip), var(--shadow-sm); }
.btn-xl.btn-primary { box-shadow: 0 3px 0 var(--brand-lip), 0 14px 26px -12px color-mix(in srgb, var(--brand) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-xl.btn-ink { box-shadow: 0 3px 0 #000, 0 14px 26px -12px rgba(0, 0, 0, 0.55); }
.btn-xl:active { transform: translateY(3px); }
.btn-xl .ic { width: 22px; height: 22px; }
.btn-round { width: 64px; min-width: 0; padding: 0; border-radius: 50%; }
@media (any-pointer: coarse) { .btn-sm { min-height: 44px; } }
.icon-btn {
  font: inherit; font-size: 18px; width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center; border-radius: var(--radius-md);
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn .ic { width: 21px; height: 21px; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[aria-pressed='true'] { background: var(--brand-soft); color: var(--brand); }
.icon-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { font: inherit; font-size: 14px; font-weight: 700; border: 0; background: transparent; color: var(--muted); min-height: 44px; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on, .seg button[aria-selected='true'], .seg button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 0 var(--lip), 0 0 0 1px var(--line); }
:root[data-theme='dark'] .seg button.on, :root[data-theme='dark'] .seg button[aria-pressed='true'], :root[data-theme='dark'] .seg button[aria-selected='true'] { background: var(--surface-3); box-shadow: 0 1px 0 #000; }
.seg button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg.seg-block { display: flex; }
.seg.seg-block button { flex: 1; }

.input { font: inherit; font-size: var(--text-md); width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; }
.input:hover { border-color: var(--ink-2); }
.input:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; border-color: var(--brand); }
.input[aria-invalid='true'] { border-color: var(--bad-ink); }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 32px; }
.field { margin-bottom: var(--space-4); }
.field-error { color: var(--bad-ink); font-size: var(--text-sm); font-weight: 600; margin-top: 6px; min-height: 1.2em; }
.field-label { display: flex; justify-content: space-between; gap: var(--space-2); font-weight: 600; font-size: var(--text-sm); margin: var(--space-4) 0 6px; }
.field-label .val { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.row-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; margin: 2px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
input[type='range'] { width: 100%; min-height: 32px; accent-color: var(--brand); }
@media (any-pointer: coarse) { input[type='range'] { min-height: 44px; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font: inherit; font-size: var(--text-sm); font-weight: 650; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; box-shadow: 0 2px 0 var(--lip); }
.chip:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--lip); }
.chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (any-pointer: coarse) { .chip { min-height: 44px; } }
.chip.off { text-decoration: line-through; color: var(--muted); background: var(--surface-2); }

/* ---------- Home ---------- */
.home-wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.hero { position: relative; padding: 64px 0 44px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero::before { content: ''; position: absolute; right: -180px; top: -200px; width: 700px; height: 700px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--joy-sun) 22%, transparent), transparent 62%); pointer-events: none; }
.hero > * { position: relative; }
.hero h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.12; letter-spacing: -0.04em; font-weight: 800; margin: 0 0 18px; }
.hero h1 em { font-style: normal; color: var(--brand); background: linear-gradient(transparent 68%, color-mix(in srgb, var(--joy-sun) 75%, transparent) 68% 92%, transparent 92%); padding: 0 2px; }
.hero p.lead { font-size: 18px; line-height: 1.7; color: var(--muted); max-width: 34em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.badge { font-size: 13px; font-weight: 650; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); box-shadow: 0 2px 0 var(--lip); }
.hero-art { position: relative; padding: 24px 0 30px; }
.bezel { position: relative; background: #1b1d22; border-radius: 24px; padding: 12px; box-shadow: 0 2px 4px rgba(40, 32, 20, 0.08), 0 40px 70px -30px rgba(40, 32, 20, 0.5); }
.bezel::after { content: ''; position: absolute; left: 50%; bottom: 4px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #3b3f49; }
.hero-screen { aspect-ratio: 4 / 3; border-radius: 13px; overflow: hidden; background: linear-gradient(#d6ecff, #fff6e6); }
:root[data-theme='dark'] .hero-screen { background: linear-gradient(#1b2a3e, #1f2228); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .hero-screen { background: linear-gradient(#1b2a3e, #1f2228); } }
.hero-screen canvas { width: 100%; height: 100%; display: block; }
.float { position: absolute; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); }
.float b { display: block; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.float small { display: block; font-size: 12px; font-weight: 650; color: var(--muted); }
.f-timer { right: -14px; top: 0; display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; transform: rotate(-3deg); }
.f-timer b { font-size: 26px; }
.f-name { right: -18px; bottom: -4px; width: 176px; padding: 22px 16px 14px; text-align: center; transform: rotate(4deg); }
.f-name b { font-size: 34px; letter-spacing: 0.02em; }
.f-name .rib { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); height: 28px; padding: 0 16px; display: inline-flex; align-items: center; background: var(--joy-sun); color: #1a1d24; font-size: 13px; font-weight: 800; white-space: nowrap; clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.f-name .cf { position: absolute; border-radius: 2px; }

.section { padding: 26px 0; }
.section h2 { font-size: 15px; color: var(--muted); font-weight: 750; margin-bottom: 14px; }
.sec-h { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sec-h h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.sec-h .en { font-size: 14px; color: var(--ci); font-weight: 700; }
.sec-h .rule { flex: 1; height: 1px; background: var(--line); }
.sec-h .cnt { font-size: 13.5px; color: var(--muted); font-weight: 650; white-space: nowrap; }
.sec-h .ti { width: 36px; height: 36px; border-radius: 11px; }
.sec-h .ti svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--brand-line); }
.card-pv { position: relative; height: 92px; margin: 6px 6px 0; border-radius: 15px; overflow: hidden; background: var(--cs, var(--surface-2)); }
.card-pv::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 86% 24%, color-mix(in srgb, var(--c, var(--brand)) 45%, transparent) 0 22px, transparent 23px), radial-gradient(circle at 70% 78%, color-mix(in srgb, var(--c, var(--brand)) 30%, transparent) 0 12px, transparent 13px), radial-gradient(circle at 92% 70%, color-mix(in srgb, var(--c, var(--brand)) 22%, transparent) 0 8px, transparent 9px); }
.card .tile { position: absolute; left: 18px; top: 72px; width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 0 0 3px var(--surface), inset 0 -2px 0 rgba(0, 0, 0, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.card-b { display: block; padding: 34px 18px 18px; }
.card h3 { font-size: 17.5px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 6px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Home: search bar, categories, favourites, recently used, card tags */
.tools-home { padding-top: 8px; }
.tools-bar {
  position: sticky; top: var(--topbar-h); z-index: 20; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 0; background: var(--bg); border-bottom: 1px solid var(--line);
}
.tools-search { position: relative; display: flex; align-items: center; flex: 1 1 280px; max-width: 420px; }
.tools-search > span:first-child { position: absolute; left: 12px; pointer-events: none; font-size: 15px; }
.tools-search .input { padding-left: 38px; padding-right: 36px; background: var(--surface); border-radius: var(--radius-md); min-height: 48px; box-shadow: 0 2px 0 var(--lip); }
.tools-search > span:first-child { display: grid; place-items: center; color: var(--muted); }
.tools-search > span:first-child svg { width: 20px; height: 20px; }
.tools-search .kbd { position: absolute; right: 10px; color: var(--muted); }
.tools-search .input:focus + .kbd, .tools-search .input:not(:placeholder-shown) + .kbd { display: none; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 15px; font-weight: 650; min-height: 44px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; box-shadow: 0 2px 0 var(--lip); }
.cat-chip:hover { color: var(--ink); background: var(--surface-2); }
.cat-chip:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--lip); }
.cat-chip .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--c); box-shadow: inset 0 -1.5px 0 rgba(0, 0, 0, 0.15); }
.cat-chip .n { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.cat-chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); box-shadow: 0 2px 0 #000; }
.cat-chip.on .n { color: color-mix(in srgb, var(--surface) 65%, transparent); }
:root[data-theme='dark'] .cat-chip.on { box-shadow: 0 2px 0 #8e929c; }
.cat-chip:focus-visible, .fav-btn:focus-visible, .recent-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tools-empty { padding: 40px 10px; text-align: center; color: var(--muted); font-size: 17px; }
.tools-tip { text-align: center; margin: 4px 0 10px; }

.card-wrap { position: relative; }
.card-wrap .card { height: 100%; }
.card-wrap .card h3 { padding-right: 30px; }
.fav-btn { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer; opacity: 0.7; transition: opacity 0.15s, transform 0.1s; }
.card-wrap:hover .fav-btn, .fav-btn:focus-visible { opacity: 1; }
.fav-btn:hover { background: var(--surface-2); }
.fav-btn:active { transform: scale(0.9); }
.fav-btn.on { color: var(--cat-time-ink); opacity: 1; }
@media (hover: none) { .fav-btn { opacity: 1; } .tools-search .kbd { display: none; } }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; font-size: 12.5px; font-weight: 700; line-height: 1; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.tag-free { color: var(--muted); background: var(--surface-2); }
.tag-pop { color: var(--ci, var(--brand)); background: var(--cs, var(--brand-soft)); }
.tag-new { color: var(--brand); background: var(--brand-soft); }
.tag-pro { color: var(--pro-on); background: var(--pro); letter-spacing: 0.06em; font-size: 11.5px; font-weight: 800; }
.tag-login { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.tag-online { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.recent-row { display: flex; flex-wrap: wrap; gap: 8px; }
.recent-link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 6px; border-radius: 14px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; }
.recent-link:hover { background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 2px 0 var(--lip); }
@media (max-width: 820px) {
  .tools-bar { top: var(--topbar-h); }
  .tools-search { max-width: none; }
  .cat-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .cat-chips::-webkit-scrollbar { display: none; }
}

.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tip { padding: 20px 22px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 2px 0 var(--lip); }
.tip b { display: block; margin-bottom: 4px; }
.tip p { margin: 0; color: var(--muted); font-size: 14px; }
.kbd { display: inline-grid; place-items: center; font-family: var(--font); font-size: 12.5px; font-weight: 700; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 7px; color: var(--ink-2); border: 1px solid var(--line); border-bottom-width: 2px; border-bottom-color: var(--lip); background: var(--surface); }

.footer { padding: 34px 0 46px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 30px; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
}

/* ---------- Tool layout ---------- */
.tool {
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
}
.stage { position: relative; overflow: hidden; background: radial-gradient(ellipse 52% 100% at 50% 0%, var(--cs, transparent), transparent 74%) top / 100% 320px no-repeat, var(--stage); min-height: 0; }
:root[data-theme='dark'] .stage { background: radial-gradient(ellipse 52% 100% at 50% 0%, color-mix(in srgb, var(--cs, transparent) 80%, transparent), transparent 74%) top / 100% 320px no-repeat, var(--stage); }
.panel { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 4px 22px 30px; }
.panel h3 { font-size: 13px; letter-spacing: 0.02em; color: var(--muted); font-weight: 700; margin: 24px 0 8px; }
.panel .keys { margin-top: 26px; font-size: var(--text-sm); color: var(--muted); display: grid; gap: 6px; }
body.panel-hidden .tool { grid-template-columns: 1fr; }
body.panel-hidden .panel { display: none; }

body.is-fs .topbar, body.is-fs .panel { display: none; }
body.is-fs .tool { grid-template-columns: 1fr; height: 100vh; }
.fs-exit {
  position: fixed; right: 16px; top: 16px; z-index: var(--z-fs-exit);
  display: none; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: var(--radius-pill); border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink);
  font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  opacity: 0.9; transition: opacity var(--dur-3) ease;
}
body.is-fs .fs-exit { display: inline-flex; }
body.is-fs.fs-idle .fs-exit { opacity: 0.35; }
body.is-fs .fs-exit:hover, body.is-fs .fs-exit:focus-visible { opacity: 1; }
.fs-exit:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 820px) {
  .tool { grid-template-columns: 1fr; grid-template-rows: minmax(62vh, 1fr) auto; height: auto; }
  .stage { min-height: 62vh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .topbar { gap: 6px; padding: 0 10px; }
  .brand-name { display: none; }
}

.stage-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.stage canvas.fill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Mic permission overlay */
.mic-gate { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; background: color-mix(in srgb, var(--stage) 80%, transparent); backdrop-filter: blur(4px); padding: 16px; }
.mic-gate-card { max-width: 440px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px 28px; box-shadow: var(--shadow); }
.mic-gate-icon { font-size: 44px; }
.mic-gate-err { color: var(--bad-ink); font-weight: 600; min-height: 1.4em; margin: 14px 0 0; }

/* Vertical level meter used by noise tools */
.meter-v { position: absolute; right: 18px; top: 18px; bottom: 18px; width: 16px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: visible; z-index: 2; }
.meter-v .fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 99px; background: linear-gradient(to top, #22c55e, #eab308 60%, #ef4444); transition: height 0.06s linear; }
.meter-v .mark { position: absolute; left: -6px; right: -6px; height: 3px; border-radius: 3px; background: var(--ink); }
.meter-v .mark::after { content: attr(data-label); position: absolute; right: 26px; top: -9px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }

.loud-banner {
  position: absolute; left: 50%; top: 22px; transform: translate(-50%, -220%); z-index: 3;
  background: var(--bad); color: #fff; font-weight: 800; font-size: clamp(20px, 3vw, 34px);
  padding: 10px 26px; border-radius: 999px; box-shadow: 0 10px 30px rgba(225, 29, 72, 0.35);
  transition: transform 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.stage.is-loud .loud-banner { transform: translate(-50%, 0); }
.stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 0 rgba(225, 29, 72, 0); transition: box-shadow 0.3s; z-index: 2; }
.stage.is-loud::after { box-shadow: inset 0 0 120px 20px rgba(225, 29, 72, 0.35); }

.hud { position: absolute; left: 18px; bottom: 16px; z-index: 2; font-size: 13px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; display: flex; gap: 8px; }
.hud span:not(:empty) { background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 3px 10px; border-radius: 999px; backdrop-filter: blur(4px); }

/* ---------- Timer & quiet challenge ring ---------- */
.ring-wrap { position: relative; width: min(62vmin, 620px); aspect-ratio: 1; }
body.is-fs .ring-wrap, body.panel-hidden .ring-wrap { width: min(80vmin, 760px); }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring-track { fill: none; stroke: color-mix(in srgb, var(--ink) 9%, transparent); }
.ring-bar { fill: none; stroke-linecap: round; transition: stroke 0.4s ease; }
.ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.big-time { font-size: min(17vmin, 150px); font-weight: 700; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; line-height: 1; }
body.is-fs .big-time, body.panel-hidden .big-time { font-size: min(19vmin, 190px); }
.task-label { font: inherit; font-size: clamp(18px, 3vmin, 30px); font-weight: 700; text-align: center; border: 0; border-bottom: 2px dashed transparent; background: transparent; color: var(--ink); width: 70%; padding: 4px; margin-bottom: 8px; }
.task-label:hover, .task-label:focus { border-bottom-color: var(--line); outline: none; }
.task-label::placeholder { color: var(--muted); opacity: 0.7; }
.stage-controls { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.ring-sub { margin-top: 10px; font-size: clamp(14px, 2.2vmin, 20px); color: var(--muted); font-weight: 600; }

/* .time-up: the "Time's up!" screen (.timesup) is shown; see the end of this file */
@keyframes flash { 50% { background: color-mix(in srgb, var(--bad) 22%, var(--stage)); } }

.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.presets .btn { padding: 8px 4px; }
.time-inputs { display: flex; gap: 8px; align-items: center; }
.time-inputs .input { text-align: center; font-variant-numeric: tabular-nums; }
.time-inputs .btn { flex: none; white-space: nowrap; }

/* Quiet challenge */
.qc-status { font-size: clamp(18px, 3.4vmin, 32px); font-weight: 800; margin-top: 6px; }
.qc-status.good { color: var(--good-ink); }
.qc-status.bad { color: var(--bad-ink); }
.stars { display: flex; gap: 6px; justify-content: center; margin-top: 10px; font-size: clamp(22px, 4.5vmin, 42px); }
.stars span { filter: grayscale(1); opacity: 0.3; transition: all 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
.stars span.on { filter: none; opacity: 1; transform: scale(1.15); }
.meter-h { width: min(70vmin, 560px); height: 14px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); position: relative; margin: 18px auto 0; }
.meter-h .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(to right, #22c55e, #eab308 60%, #ef4444); width: 0; }
.meter-h .mark { position: absolute; top: -6px; bottom: -6px; width: 3px; border-radius: 3px; background: var(--ink); }

/* ---------- Name picker ---------- */
.wheel-wrap { position: relative; width: min(80vmin, 720px); aspect-ratio: 1; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.wheel-pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 38px solid var(--ink); filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25)); z-index: 2; }
.wheel-hub { position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--surface); border: 5px solid var(--ink); display: grid; place-items: center; font-weight: 800; font-size: clamp(14px, 2.6vmin, 24px); cursor: pointer; box-shadow: var(--shadow); color: var(--ink); font-family: inherit; }
.result-pop { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; background: color-mix(in srgb, var(--stage) 70%, transparent); backdrop-filter: blur(3px); }
.result-card { position: relative; text-align: center; background: var(--surface); border-radius: 34px; padding: 44px 48px 28px; box-shadow: 0 4px 0 var(--lip), 0 0 0 1px var(--line), 0 44px 80px -24px rgba(40, 32, 20, 0.38); animation: popin 0.4s cubic-bezier(0.2, 1.5, 0.4, 1); max-width: 90%; }
.result-card .name { font-size: clamp(44px, 12vmin, 150px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin: 4px 0 18px; word-break: break-word; }
@keyframes popin { from { transform: scale(0.6); opacity: 0; } }
.history { display: flex; flex-wrap: wrap; gap: 6px; }
.empty-msg { max-width: 420px; }

/* ---------- Group maker ---------- */
.groups-stage { position: absolute; inset: 0; overflow: auto; padding: 24px; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.group { border-radius: 18px; background: var(--surface); border: 1px solid var(--line); border-top: 8px solid var(--c); padding: 14px 18px 16px; box-shadow: var(--shadow); animation: popin 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.group h3 { font-size: 20px; margin: 0 0 8px; display: flex; justify-content: space-between; }
.group h3 small { color: var(--muted); font-size: 14px; font-weight: 600; }
.group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.group li { font-size: clamp(16px, 2.2vmin, 22px); font-weight: 600; }
body.is-fs .groups, body.panel-hidden .groups { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- Dice ---------- */
.dice-row { display: flex; gap: min(5vmin, 44px); flex-wrap: wrap; justify-content: center; }
.die { width: min(30vmin, 240px); aspect-ratio: 1; position: relative; cursor: pointer; }
.die.d6 { background: var(--surface); border-radius: 22%; border: 2px solid var(--line); box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.06), var(--shadow); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14%; gap: 4%; }
.die.d6 .pip { border-radius: 50%; background: var(--ink); transform: scale(0.82); }
.die.d6 .pip.red { background: #e11d48; }
.die svg { width: 100%; height: 100%; display: block; overflow: visible; }
.die.rolling { animation: shake 0.6s ease-in-out; }
@keyframes shake { 0% { transform: rotate(0); } 20% { transform: rotate(-18deg) scale(0.92); } 45% { transform: rotate(14deg) scale(1.05); } 70% { transform: rotate(-8deg); } 100% { transform: rotate(0); } }
.dice-total { margin-top: 26px; font-size: clamp(20px, 4vmin, 36px); font-weight: 700; color: var(--muted); }
.dice-total b { color: var(--ink); font-size: 1.4em; }

/* ---------- Voice levels ---------- */
.levels { position: absolute; inset: 0; display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; padding: 22px; }
.level-big { border-radius: 26px; background: var(--c); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; transition: background 0.3s ease; }
.level-big .num { font-size: min(26vmin, 220px); font-weight: 900; line-height: 0.95; }
.level-big .ttl { font-size: clamp(30px, 6vmin, 66px); font-weight: 850; }
.level-big .desc { font-size: clamp(16px, 2.7vmin, 26px); opacity: 0.92; margin-top: 8px; max-width: 18em; }
.level-big .ico { font-size: clamp(36px, 8vmin, 80px); }
.level-list { display: grid; grid-template-rows: repeat(5, 1fr); gap: 10px; min-height: 0; }
.level-item { font: inherit; text-align: left; display: flex; align-items: center; gap: 14px; border-radius: 18px; border: 2px solid transparent; background: var(--surface); color: var(--ink); padding: 8px 16px; cursor: pointer; box-shadow: var(--shadow); min-height: 0; }
.level-item .n { flex: none; width: 46px; height: 46px; border-radius: 13px; background: var(--c); color: #fff; font-weight: 900; font-size: 24px; display: grid; place-items: center; }
.level-item b { display: block; font-size: clamp(15px, 2.2vmin, 21px); }
.level-item small { color: var(--muted); font-size: 13px; }
.level-item.on { border-color: var(--c); }
@media (max-width: 820px) { .levels { grid-template-columns: 1fr; position: relative; } }

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: var(--z-toast);
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 20px; border-radius: var(--radius-md);
  background: var(--ink); color: var(--surface); font-size: var(--text-md); font-weight: 650;
  box-shadow: var(--shadow-lg); pointer-events: none;
  opacity: 0; transform: translate(-50%, 16px);
  transition: opacity var(--dur-2) ease, transform var(--dur-2) var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--bad-ink); color: var(--danger-ink); }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

@media print {
  .topbar, .panel, .fs-exit { display: none !important; }
  .tool { display: block; height: auto; }
  .stage, .groups-stage { position: static; overflow: visible; background: #fff; }
  .group { box-shadow: none; break-inside: avoid; }
}

/* ---------- Stage backgrounds (each one sets its own tokens, independent of light/dark) ---------- */
.stage { color: var(--ink); }
.seg.seg-wrap { flex-wrap: wrap; }
/* Five timer styles: an even 3 + 2 grid instead of 4 + 1 with a lone, stretched last button. */
#styleSeg { display: grid; grid-template-columns: repeat(3, 1fr); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 13px; border: 2px solid var(--line); cursor: pointer; padding: 0; position: relative; }
.swatch.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand); }
.swatch.on::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.sw-plain { background: linear-gradient(135deg, #fbfaf6 50%, #12161e 50%); }
.sw-chalk { background: #24493c; box-shadow: inset 0 0 0 4px #a8763f; }
.sw-night { background: radial-gradient(1.5px 1.5px at 30% 30%, #fff, transparent), radial-gradient(1.5px 1.5px at 70% 60%, #fff, transparent), linear-gradient(#0b1026, #2a2f6b); }
.sw-sunset { background: linear-gradient(160deg, #ffd6a5, #ffadad 55%, #cdb4db); }
.sw-grid { background: #fffdf7 linear-gradient(#cfdcf3 1px, transparent 1px) 0 0 / 8px 8px, #fffdf7; background-image: linear-gradient(#cfdcf3 1px, transparent 1px), linear-gradient(90deg, #cfdcf3 1px, transparent 1px); background-size: 8px 8px; }

.stage.bg-chalk {
  --stage: #23473a; --ink: #f6f3e7; --muted: #b8cdbf; --surface: #2c5547; --surface-2: #326050; --line: #46705f; --brand: #ffd166; --brand-ink: #1f2a22;
  --line-strong: #8fb8a6; --good-ink: #86efac; --warn-ink: #fde68a; --bad-ink: #ffb3c1; --danger-ink: #2a0a12;
  background: radial-gradient(ellipse at 30% 15%, #2f5a4a, #1d3b31 75%);
}
.stage.bg-chalk::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1; box-shadow: inset 0 0 0 12px #a8763f, inset 0 0 0 15px #6f4a25, inset 0 0 60px rgba(0,0,0,.35); }
.stage.bg-night {
  --stage: #0d1230; --ink: #f1f3ff; --muted: #a9b0d9; --surface: #1a2150; --surface-2: #232b62; --line: #343d7a; --brand: #8fa8ff; --brand-ink: #0b1026;
  --line-strong: #8a95d6; --good-ink: #4ade80; --warn-ink: #fbbf24; --bad-ink: #fb7185; --danger-ink: #1a0b10;
  background:
    radial-gradient(1.6px 1.6px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 28% 62%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 44% 12%, #ffe9a8 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 63% 38%, #fff 50%, transparent 51%),
    radial-gradient(1.8px 1.8px at 78% 14%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 88% 70%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 8% 84%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 52% 88%, #fff 50%, transparent 51%),
    radial-gradient(ellipse at 80% 110%, rgba(140, 90, 255, .35), transparent 60%),
    linear-gradient(#0a0f2a, #1d2360);
}
.stage.bg-sunset {
  --stage: #ffc8a8; --ink: #2b1d2f; --muted: #4d3344; --surface: rgba(255, 255, 255, .72); --surface-2: rgba(255,255,255,.5); --line: rgba(43, 29, 47, .14); --brand: #d6336c; --brand-ink: #fff;
  --line-strong: #7a5a6c; --good-ink: #14532d; --warn-ink: #7c2d12; --bad-ink: #9f1239; --danger-ink: #fff;
  background: linear-gradient(165deg, #ffe0b5 0%, #ffb4a2 45%, #e5989b 75%, #b5838d 100%);
}
.stage.bg-grid {
  --stage: #fffdf7; --ink: #1c2230; --muted: #5d6576; --surface: #ffffff; --surface-2: #f1efe7; --line: #dfe6f2; --brand: #2f5bea; --brand-ink: #fff;
  --line-strong: #857c69; --good-ink: #15803d; --warn-ink: #b45309; --bad-ink: #be123c; --danger-ink: #fff;
  background-color: #fffdf7;
  background-image: linear-gradient(#e3eaf6 1px, transparent 1px), linear-gradient(90deg, #e3eaf6 1px, transparent 1px);
  background-size: 32px 32px;
}
.stage.bg-chalk .btn, .stage.bg-night .btn, .stage.bg-sunset .btn { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.stage.bg-chalk .btn-primary, .stage.bg-night .btn-primary, .stage.bg-sunset .btn-primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }

/* ---------- Timer display styles ---------- */
.t-display { display: flex; flex-direction: column; align-items: center; }
.ring-sub.alert { color: var(--bad-ink); font-size: clamp(20px, 4vmin, 40px); font-weight: 850; }

.pie-wrap { width: min(60vmin, 540px); aspect-ratio: 1; }
body.is-fs .pie-wrap, body.panel-hidden .pie-wrap { width: min(66vmin, 640px); }
.pie-wrap svg { width: 100%; height: 100%; display: block; }
.pie-face { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.pie-tick { stroke: var(--ink); stroke-linecap: round; opacity: .55; }
.pie-sector { transition: fill .4s ease; }
.pie-knob { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.big-time.pie-time { font-size: min(10vmin, 96px); margin-top: 14px; }

.bar-wrap { width: min(86%, 980px); display: flex; flex-direction: column; align-items: center; }
.big-time.huge { font-size: min(28vmin, 300px); }
body.is-fs .big-time.huge, body.panel-hidden .big-time.huge { font-size: min(32vmin, 360px); }
.tbar { width: 100%; height: clamp(26px, 5vmin, 54px); border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; margin-top: 18px; }
.tbar-fill { height: 100%; border-radius: 999px; transition: background .4s ease; background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.18) 0 14px, transparent 14px 28px) !important; background-color: currentColor; }

.tank { --lvl: 1; --water: #10b981; position: relative; width: min(46vmin, 420px); aspect-ratio: 3 / 4; border-radius: 34px 34px 46px 46px; background: color-mix(in srgb, var(--ink) 7%, transparent); border: 5px solid color-mix(in srgb, var(--ink) 22%, transparent); overflow: hidden; }
body.is-fs .tank, body.panel-hidden .tank { width: min(52vmin, 500px); }
.wave { position: absolute; left: 50%; width: 240%; aspect-ratio: 1; border-radius: 43%; background: var(--water); opacity: .9; top: calc((1 - var(--lvl)) * 100% - 4%); transform: translateX(-50%) rotate(0); animation: spin 9s linear infinite; transition: top .25s linear, background .5s ease; }
.wave.w2 { opacity: .45; border-radius: 40%; animation-duration: 13s; top: calc((1 - var(--lvl)) * 100% - 6%); }
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }
.tank-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.tank .big-time { font-size: min(11vmin, 100px); text-shadow: 0 2px 12px color-mix(in srgb, var(--stage) 70%, transparent); }
@media (prefers-reduced-motion: reduce) { .wave { animation: none; } }

/* ---------- Quiet challenge display styles ---------- */
.qc-display { display: flex; align-items: center; justify-content: center; gap: min(6vmin, 56px); flex-wrap: wrap; }
.qc-side .big-time { font-size: min(15vmin, 140px); }
.ring-wrap.qc-ring { width: min(50vmin, 460px); }
body.is-fs .ring-wrap.qc-ring, body.panel-hidden .ring-wrap.qc-ring { width: min(56vmin, 540px); }
.qc-ring .big-time { font-size: min(11vmin, 100px); }
.qc-emoji { font-size: min(8vmin, 72px); line-height: 1.1; }

.rocket-scene {
  position: relative; width: min(32vmin, 300px); height: min(50vmin, 460px); border-radius: 28px; overflow: hidden;
  background:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 75% 22%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 60% 55%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 30% 70%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 85% 80%, #fff 50%, transparent 51%),
    linear-gradient(#0b1026, #2b2f7a 70%, #4b4fa8);
  box-shadow: var(--shadow);
}
.rocket-scene .moon { position: absolute; top: 4%; left: 50%; width: 34%; transform: translateX(-50%); transition: filter .6s; }
.rocket-scene.landed .moon { filter: drop-shadow(0 0 18px #fde68a); }
.moon-svg, .rocket-svg { display: block; width: 100%; height: auto; }
.rocket-scene .track { position: absolute; left: 50%; top: 20%; bottom: 14%; border-left: 3px dashed rgba(255, 255, 255, .25); }
.rocket-scene .planet { position: absolute; left: -30%; width: 160%; aspect-ratio: 1; bottom: calc(-160% * 0.86); border-radius: 50%; background: radial-gradient(circle at 50% 8%, #34d399, #059669 30%, #1e40af 60%); }
.rocket-scene .rocket { --p: 0; position: absolute; left: 50%; width: 20%; bottom: calc(6% + var(--p) * 58%); transform: translateX(-50%); transition: bottom .25s linear; z-index: 1; }
.rocket-scene .flame { fill: #fb923c; opacity: 0; transform-origin: 30px 92px; }
.rocket-scene .flame.inner { fill: #fde047; }
.rocket-scene.flying .flame { opacity: 1; animation: flicker .12s ease-in-out infinite alternate; }
@keyframes flicker { from { transform: scaleY(.8); } to { transform: scaleY(1.15); } }
.rocket-scene.shaking .rocket { animation: jitter .09s linear infinite; }
@keyframes jitter { 0% { transform: translateX(-52%) rotate(-3deg); } 50% { transform: translateX(-48%) rotate(3deg); } 100% { transform: translateX(-52%) rotate(-3deg); } }
.rocket-scene.landed .rocket { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-6px); } }

.flower-scene { width: min(36vmin, 330px); }
.flower-svg { width: 100%; height: auto; display: block; overflow: visible; }
.flower-svg .plant { transform-origin: 100px 208px; transition: transform .6s cubic-bezier(.3, 1.4, .5, 1), filter .6s; }
.flower-svg .plant.droop { transform: rotate(14deg); filter: saturate(.35) brightness(.95); }
.flower-svg .leaf, .flower-svg .head, .flower-svg .petals { transition: transform .3s ease; }
.flower-svg.done .petals { animation: glow 1.4s ease-in-out infinite alternate; }
@keyframes glow { to { filter: drop-shadow(0 0 6px #f9a8d4); } }

/* ---------- Name picker: slot machine ---------- */
.slot { position: relative; width: min(84%, 760px); padding: 34px 30px 28px; border-radius: 34px; background: linear-gradient(160deg, #ff5f6d, #c3195d 60%, #8e1450); box-shadow: 0 18px 50px rgba(142, 20, 80, .35), inset 0 -10px 0 rgba(0,0,0,.18); display: flex; flex-direction: column; align-items: center; gap: 22px; }
.slot-lights { position: absolute; left: 22px; right: 22px; top: 12px; display: flex; justify-content: space-between; }
.slot-lights i { width: 10px; height: 10px; border-radius: 50%; background: #ffe08a; box-shadow: 0 0 8px #ffd23f; animation: blink 1.2s steps(2) infinite; }
.slot-lights i:nth-child(even) { animation-delay: .6s; }
.slot.spinning .slot-lights i { animation-duration: .25s; }
@keyframes blink { 50% { opacity: .25; } }
.slot-window { width: 100%; height: min(42vmin, 330px); border-radius: 20px; background: #fff; overflow: hidden; position: relative; box-shadow: inset 0 0 0 6px #ffd23f, inset 0 14px 24px rgba(0,0,0,.25), inset 0 -14px 24px rgba(0,0,0,.25); }
.slot-window::before { content: ''; position: absolute; left: 6px; right: 6px; top: calc(100% / 3); height: calc(100% / 3); border-top: 3px solid rgba(195, 25, 93, .5); border-bottom: 3px solid rgba(195, 25, 93, .5); background: rgba(255, 210, 63, .14); pointer-events: none; z-index: 1; }
.slot-reel { will-change: transform; }
.slot-item { height: var(--h, 100px); display: grid; place-items: center; font-size: min(9vmin, 76px); font-weight: 850; color: #1c2230; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 20px; opacity: .45; }
.slot-item.win { opacity: 1; color: #c3195d; animation: popin .4s cubic-bezier(.2, 1.5, .4, 1); }
.slot.spinning .slot-item { opacity: .8; filter: blur(.6px); }
.slot-btn { background: #ffd23f !important; color: #5a1030 !important; box-shadow: 0 6px 0 #c99a00; }
.slot-btn:active { box-shadow: 0 2px 0 #c99a00; transform: translateY(4px); }

/* ---------- Name picker: flip cards ---------- */
.cards-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; }
.cards-hint { margin-bottom: 12px; font-weight: 600; }
.cards { --cols: 6; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: min(1.6vmin, 14px); width: min(100%, 1100px); margin: 0 auto; max-height: 72%; }
.flip { font: inherit; border: 0; padding: 0; background: none; cursor: pointer; perspective: 800px; aspect-ratio: 4 / 3; animation: deal .45s cubic-bezier(.2, 1.3, .4, 1) both; min-height: 0; }
@keyframes deal { from { transform: translateY(-30px) rotate(-8deg) scale(.6); opacity: 0; } }
.flip-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .55s cubic-bezier(.3, 1.3, .5, 1); transform-style: preserve-3d; }
.flip.open .flip-inner { transform: rotateY(180deg); }
.flip-back, .flip-front { position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; font-weight: 850; padding: 4px; overflow: hidden; }
.flip-back { color: rgba(255,255,255,.95); font-size: clamp(16px, 3.4vmin, 34px); background: var(--c); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.14) 0 8px, transparent 8px 16px); box-shadow: inset 0 0 0 4px rgba(255,255,255,.35), 0 4px 12px rgba(0,0,0,.12); }
.flip:hover .flip-back { filter: brightness(1.08); }
.flip-front { transform: rotateY(180deg); background: var(--surface); color: var(--ink); border: 3px solid var(--c); font-size: clamp(13px, 2.6vmin, 28px); line-height: 1.15; word-break: break-word; }
.flip.hot .flip-front { animation: hot 1.6s ease; }
@keyframes hot { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 45%, transparent); } }

/* ---------- Dice (overrides) ---------- */
.die { font: inherit; border: 0; padding: 0; background: none; width: var(--dsize, min(30vmin, 240px)); }
.die.d6 { background: var(--body); border: 2px solid color-mix(in srgb, var(--body) 80%, #000); padding: 14%; }
.die.d6 .pip { background: var(--pip); }
.die.d6 .pip.red { background: #e11d48; }
.die.dn .face { fill: var(--body); stroke: color-mix(in srgb, var(--body) 70%, #000); stroke-width: 2.5; stroke-linejoin: round; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.die.dn .edge { fill: none; stroke: color-mix(in srgb, var(--pip) 25%, transparent); stroke-width: 1.5; stroke-linejoin: round; }
.die.dn .num { fill: var(--pip); font-size: 30px; font-weight: 900; text-anchor: middle; dominant-baseline: middle; font-family: var(--font); }

/* ---------- Voice levels: stairs + editor ---------- */
.stairs { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: min(2vmin, 18px); padding: 28px 28px 22px; align-items: end; }
.stair { font: inherit; border: 0; background: none; padding: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; cursor: pointer; color: var(--ink); gap: 10px; }
.stair-label { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); }
.stair-label .ico { font-size: clamp(26px, 5vmin, 54px); }
.stair-label b { font-size: clamp(15px, 2.6vmin, 28px); }
.stair-label small { font-size: clamp(13px, 1.9vmin, 19px); color: var(--muted); min-height: 2.6em; max-width: 14em; }
.stair-bar { height: var(--h); border-radius: 18px 18px 8px 8px; background: color-mix(in srgb, var(--c) 28%, transparent); display: flex; align-items: flex-start; justify-content: center; transition: background .3s, box-shadow .3s; }
.stair-bar .num { font-size: clamp(30px, 7vmin, 84px); font-weight: 900; color: color-mix(in srgb, var(--c) 70%, var(--ink)); margin-top: 6px; }
.stair.on .stair-bar { background: var(--c); box-shadow: 0 12px 34px color-mix(in srgb, var(--c) 50%, transparent); }
.stair.on .stair-bar .num { color: #fff; }
.stair.on .stair-label { transform: scale(1.12); }
.stair:not(.on) { opacity: .62; }
.vl-edit { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.vl-edit .n { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--c); color: #fff; font-weight: 900; display: grid; place-items: center; margin-top: 4px; }
.vl-edit > div { flex: 1; display: grid; gap: 4px; }
.vl-edit .input { padding: 6px 9px; font-size: 14px; }

/* ---------- Group maker extras ---------- */
.groups-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.groups-empty { padding: 60px 20px; text-align: center; font-size: 18px; grid-column: 1 / -1; }
.g-title { display: inline-flex; gap: 8px; align-items: center; }
.g-icon { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--c) 20%, transparent); font-size: 19px; padding: 0 6px; }
.group li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.group li.leader span:first-child { color: var(--c); }
.leader-tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); white-space: nowrap; }

/* Style picker grid (tiles with an icon) */
.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.style-grid button { font: inherit; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 7px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; box-shadow: 0 2px 0 var(--lip); }
.style-grid button:hover { border-color: var(--brand-line); color: var(--ink); }
.style-grid button.on { border: 2px solid var(--brand); padding: 8px 3px 6px; color: var(--ink); box-shadow: 0 0 0 3px var(--brand-soft), 0 2px 0 var(--brand-lip); }
.style-grid .sg-ico { font-size: 22px; line-height: 1.2; }
.t-display[data-style='bar'] { width: 100%; }
.seg button { white-space: nowrap; }
.tank .big-time { text-shadow: none; }

/* ---------- Noise balls: reading prompts + draggable target line ---------- */
.cheer {
  position: absolute; left: 50%; top: 22px; z-index: 3; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -220%); color: #fff; font-weight: 850; font-size: clamp(22px, 3.6vw, 44px);
  padding: 10px 30px; border-radius: 999px; transition: transform .3s cubic-bezier(.2, 1.4, .4, 1);
}
.cheer.show { transform: translate(-50%, 0); }
.cheer.good { background: linear-gradient(135deg, #22c55e, #059669); box-shadow: 0 12px 34px rgba(16, 185, 129, .4); }
.cheer.good.show { animation: cheerpop .5s cubic-bezier(.2, 1.6, .4, 1); }
.cheer.low { background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 12px 34px rgba(249, 115, 22, .35); }
.cheer.low.show { animation: nudge 1.6s ease-in-out infinite; }
@keyframes cheerpop { 0% { transform: translate(-50%, 0) scale(.6); } 100% { transform: translate(-50%, 0) scale(1); } }
@keyframes nudge { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 0) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .cheer.show { animation: none !important; } }

.meter-v.reading { width: 18px; cursor: ns-resize; touch-action: none; }
.meter-v.reading::before { content: ''; position: absolute; inset: -6px -16px; } /* bigger touch target */
.meter-v.reading .fill { background: linear-gradient(to top, #94a3b8, #60a5fa 45%, #22c55e 80%); }
.meter-v.reading.on-target .fill { box-shadow: 0 0 18px rgba(34, 197, 94, .7); }
.meter-v .mark.draggable { height: 4px; left: -8px; right: -8px; }
.meter-v .mark.draggable::before { content: ''; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); transform: translate(-50%, -50%); transition: transform .15s; }
.meter-v.dragging .mark.draggable::before, .meter-v.reading:hover .mark.draggable::before { transform: translate(-50%, -50%) scale(1.25); }
.meter-v .mark.draggable::after { right: 30px; }
.meter-v .gate { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0 0 99px 99px; pointer-events: none; transition: height .3s ease;
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--ink) 28%, transparent) 0 3px, transparent 3px 7px); }

/* ---------- Quiet garden ---------- */
.qg-stage { background: #8fd0ff; }
.qg-card { position: absolute; left: 16px; top: 16px; z-index: 3; min-width: 210px; padding: 14px 18px 16px; border-radius: 20px; color: #1c2230;
  background: rgba(255, 255, 255, .84); backdrop-filter: blur(8px); box-shadow: 0 8px 28px rgba(15, 23, 42, .15); }
.qg-count { display: flex; align-items: baseline; gap: 8px; font-weight: 800; }
.qg-count b { font-size: clamp(30px, 5.5vmin, 56px); line-height: 1; font-variant-numeric: tabular-nums; }
.qg-count span:last-child { color: #475569; font-size: 15px; }
.qg-ico { font-size: clamp(24px, 4vmin, 40px); align-self: center; }
.qg-time { font-size: clamp(22px, 4.2vmin, 44px); font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.qg-bar { height: 10px; border-radius: 99px; background: rgba(15, 23, 42, .1); overflow: hidden; margin: 6px 0 12px; }
.qg-bar div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #22c55e, #84cc16); transition: width .3s linear; }
.qg-btns { display: flex; gap: 8px; }
.qg-btns .btn { background: #fff; color: #1c2230; border-color: rgba(15, 23, 42, .15); }
.qg-btns .btn-primary { background: #15803d; color: #fff; border-color: transparent; }
.qg-status { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 3; padding: 9px 24px; border-radius: 999px; white-space: nowrap;
  font-weight: 800; font-size: clamp(16px, 2.6vmin, 26px); color: #1c2230; background: rgba(255, 255, 255, .86); box-shadow: 0 8px 24px rgba(15, 23, 42, .15); transition: background .3s, color .3s; }
.qg-status.good { color: #15803d; }
.qg-status.bad { background: #e11d48; color: #fff; animation: nudge 1.2s ease-in-out infinite; }
.qg-status.done { background: linear-gradient(135deg, #22c55e, #059669); color: #fff; }
.qg-stage .meter-v { width: 18px; cursor: ns-resize; touch-action: none; background: rgba(255, 255, 255, .35); }
.qg-stage .meter-v::before { content: ''; position: absolute; inset: -6px -16px; }
.qg-stage .meter-v .mark { background: #1c2230; }
.qg-stage .meter-v .mark::after { color: #1c2230; right: 30px; background: rgba(255,255,255,.8); padding: 0 6px; border-radius: 6px; }
@media (max-width: 820px) {
  .qg-status { top: auto; bottom: 14px; font-size: 15px; }
  .qg-card { min-width: 0; padding: 10px 14px 12px; }
}
.qg-vol { font-size: 13px; font-weight: 600; color: #475569; margin: -6px 0 10px; font-variant-numeric: tabular-nums; }

/* ---------- Privacy page ---------- */
.prose { max-width: 760px; padding-top: 32px; padding-bottom: 60px; }
.prose h1 { font-size: 32px; }
.prose h2 { font-size: 19px; margin-top: 28px; }
.prose p, .prose li { color: var(--ink); font-size: 16px; }
.prose li { margin: 6px 0; }
.optout { margin: 18px 0; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.optout p { margin: 0 0 10px; }

/* ---------- Feedback dialog ---------- */
.fb-open { gap: 4px; }
@media (max-width: 820px) { .fb-open-label { display: none; } }
.fb-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: rgba(15, 18, 24, .45); backdrop-filter: blur(3px); }
.fb-card { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 22px 24px; box-shadow: var(--shadow); animation: popin .25s ease; }
.fb-card h2 { font-size: 20px; margin-bottom: 4px; }
.fb-card p { margin: 0 0 12px; }
.fb-kinds { margin-top: 6px; }
.fb-len { text-align: right; margin-top: 2px; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-error { color: var(--bad-ink); font-weight: 600; min-height: 1.3em; margin: 8px 0 0 !important; font-size: 14px; }
.fb-error.ok { color: var(--good-ink); }
.fb-btns { justify-content: flex-end; margin-top: 10px; }
.fb-done { text-align: center; padding: 10px 0; }
.fb-done-icon { font-size: 44px; }

/* ---------- Class points ---------- */
.cp-stage { position: absolute; inset: 0; display: flex; flex-direction: column; }
.cp-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 18px 10px; position: relative; z-index: 3; }
.cp-selbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 18px 8px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); font-weight: 700; position: relative; z-index: 3; }
.cp-body { flex: 1; min-height: 0; overflow: auto; padding: 6px 18px 22px; position: relative; z-index: 2; }
.cp-empty { padding: 50px 20px; text-align: center; font-size: 18px; }

.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
body.is-fs .cp-grid, body.panel-hidden .cp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cp-grid.groups { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.cp-card {
  font: inherit; color: var(--ink); position: relative; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 10px;
  border-radius: 18px; border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .15s ease;
}
.cp-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.cp-card:active { transform: scale(.97); }
.cp-card.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.cp-card.sel::after { content: '\2713'; position: absolute; top: 6px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 900; font-size: 13px; display: grid; place-items: center; }
.cp-card.absent { opacity: .45; }
.cp-pet { position: relative; font-size: clamp(34px, 5.4vmin, 56px); line-height: 1.15; }
.cp-pet i { position: absolute; right: -14px; top: -6px; font-style: normal; font-size: .42em; }
.cp-avatar { width: clamp(42px, 6vmin, 60px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-weight: 850; font-size: clamp(20px, 3vmin, 28px); color: #fff; background: var(--c); margin-bottom: 4px; }
.cp-name { font-weight: 700; font-size: clamp(14px, 2vmin, 19px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-pts { font-weight: 900; font-size: clamp(24px, 4vmin, 40px); line-height: 1.05; color: var(--good-ink); font-variant-numeric: tabular-nums; }
.cp-pts.neg { color: var(--bad-ink); }
.cp-lv { display: flex; align-items: center; gap: 6px; width: 100%; padding: 2px 6px 0; font-size: 11px; font-weight: 700; color: var(--muted); }
.cp-xp { flex: 1; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.cp-xp i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #f59e0b, #22c55e); }
.cp-float { position: absolute; left: 50%; top: 30%; transform: translate(-50%, 0); font-weight: 900; font-size: clamp(24px, 4vmin, 40px); pointer-events: none; animation: cpfloat 1.1s ease-out forwards; text-shadow: 0 2px 8px color-mix(in srgb, var(--stage) 80%, transparent); }
.cp-float.up { color: var(--good-ink); }
.cp-float.down { color: var(--bad-ink); }
@keyframes cpfloat { from { opacity: 1; transform: translate(-50%, 10px) scale(.7); } 30% { transform: translate(-50%, -10px) scale(1.2); } to { opacity: 0; transform: translate(-50%, -50px) scale(1); } }
@media (prefers-reduced-motion: reduce) { .cp-float { animation-duration: .01s; } }

.cp-gcard { border-top: 8px solid var(--c); padding: 14px 14px 12px; }
.cp-gicon { font-size: clamp(30px, 5vmin, 48px); line-height: 1.1; }
.cp-gcard .cp-name { font-size: clamp(18px, 2.6vmin, 24px); }
.cp-gcard .cp-pts { font-size: clamp(34px, 6vmin, 60px); }
.cp-members { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.35; }

.cp-class { min-height: 100%; display: flex; align-items: center; justify-content: center; gap: min(6vmin, 60px); flex-wrap: wrap; padding: 10px; }
.cp-jar { position: relative; width: min(34vmin, 300px); aspect-ratio: 3 / 4; border-radius: 26% 26% 18% 18% / 12% 12% 10% 10%; border: 6px solid color-mix(in srgb, var(--ink) 25%, transparent); border-top-width: 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); overflow: hidden; box-shadow: var(--shadow); }
.cp-jar-fill {
  position: absolute; left: 0; right: 0; bottom: 0; transition: height .6s cubic-bezier(.2, 1.2, .4, 1);
  background-color: #fef3c7;
  background-image: radial-gradient(circle, #f87171 0 30%, transparent 32%), radial-gradient(circle, #60a5fa 0 30%, transparent 32%), radial-gradient(circle, #34d399 0 30%, transparent 32%), radial-gradient(circle, #fbbf24 0 30%, transparent 32%);
  background-size: 52px 52px;
  background-position: 0 0, 26px 26px, 26px 0, 0 26px;
}
.cp-jar-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; color: var(--ink); }
.cp-jar-num b { font-size: min(13vmin, 110px); line-height: 1; padding: 4px 16px; border-radius: 20px; background: color-mix(in srgb, var(--surface) 82%, transparent); }
.cp-jar-num span:not(:empty) { margin-top: 6px; font-size: clamp(16px, 2.6vmin, 24px); padding: 0 10px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 82%, transparent); }
.cp-goal { max-width: 460px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.cp-goal-label { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; }
.cp-goal-name { display: flex; align-items: center; gap: 12px; font-size: clamp(26px, 5vmin, 48px); font-weight: 850; line-height: 1.1; }
.cp-goal-icon { font-size: 1.3em; }
.cp-goal-left { font-size: clamp(16px, 2.6vmin, 24px); font-weight: 700; color: var(--muted); }
.cp-goal-select { max-width: 320px; }
.cp-unlock { margin-top: 6px; animation: cppulse 1.4s ease-in-out infinite; }
@keyframes cppulse { 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .cp-unlock { animation: none; } }
.cp-goal .stage-controls { margin-top: 8px; }

.cp-overlay { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--stage) 60%, rgba(0, 0, 0, .35)); backdrop-filter: blur(3px); }
.cp-dialog { width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 22px; padding: 16px 20px 20px; box-shadow: var(--shadow); animation: popin .25s ease; }
.cp-dialog.wide { width: min(820px, 100%); }
.cp-dhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cp-dtitle { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: clamp(20px, 3vmin, 28px); font-weight: 850; }
.cp-dpet { font-size: 1.5em; }
.cp-dbal { font-size: 15px; font-weight: 700; color: var(--muted); }
.cp-behaviors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cp-behaviors.neg { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.cp-beh { font: inherit; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; border: 2px solid color-mix(in srgb, var(--good) 35%, var(--line)); background: color-mix(in srgb, var(--good) 8%, var(--surface)); text-align: left; }
.cp-beh:hover { border-color: var(--good); }
.cp-beh.neg { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); background: color-mix(in srgb, var(--bad) 6%, var(--surface)); }
.cp-beh.neg:hover { border-color: var(--bad); }
.cp-beh-icon { font-size: 24px; }
.cp-beh-label { flex: 1; font-weight: 650; font-size: 15px; line-height: 1.2; }
.cp-beh b { font-size: 18px; color: var(--good-ink); }
.cp-beh.neg b { color: var(--bad-ink); }
.cp-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.cp-quick .muted { margin-right: 4px; font-size: 14px; font-weight: 600; }
.cp-petpick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.cp-petpick .muted { width: 100%; font-size: 14px; font-weight: 600; }
.cp-petbtn { font: inherit; font-size: 22px; width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; background: var(--surface-2); cursor: pointer; }
.cp-petbtn.on { border-color: var(--brand); }

.cp-shop-tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.cp-shelf { display: grid; gap: 8px; margin-bottom: 12px; }
.cp-item { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.cp-item.out { opacity: .55; }
.cp-item-icon { font-size: 30px; }
.cp-item-name { font-weight: 700; font-size: 17px; }
.cp-item-cost { font-weight: 850; font-size: 18px; color: var(--warn-ink); white-space: nowrap; }
.cp-item-stock { font-size: 13px; white-space: nowrap; }
.cp-item.edit { grid-template-columns: 56px 1fr 80px 80px auto; gap: 8px; }
.cp-item-head { background: none; border: 0; padding: 0 14px; font-size: 12px; font-weight: 700; }
.cp-item-head span { text-align: center; }
.cp-item-head span:nth-child(2) { text-align: left; }
.cp-in-icon { text-align: center; padding: 6px 4px; font-size: 18px; }
.cp-in-num { text-align: center; padding: 6px 4px; }
.cp-in-num.neg { color: var(--bad-ink); }
.cp-buyers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.cp-buyer { font: inherit; color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); font-weight: 650; }
.cp-buyer:hover { border-color: var(--brand); }
.cp-buyer b { color: var(--good-ink); }
.cp-buyer.poor { opacity: .45; cursor: not-allowed; }

.cp-podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 10px; max-width: 560px; margin: 4px auto 14px; }
.cp-step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.cp-medal { font-size: 30px; }
.cp-step-icon { font-size: 34px; line-height: 1.1; }
.cp-step-name { font-weight: 800; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-step b { font-size: 24px; color: var(--good-ink); }
.cp-step-block { width: 100%; display: grid; place-items: center; font-size: 28px; font-weight: 900; color: #fff; border-radius: 12px 12px 0 0; }
.cp-step.p1 .cp-step-block { height: 110px; background: linear-gradient(#fbbf24, #f59e0b); }
.cp-step.p2 .cp-step-block { height: 80px; background: linear-gradient(#cbd5e1, #94a3b8); }
.cp-step.p3 .cp-step-block { height: 60px; background: linear-gradient(#fdba74, #c2410c); }
.cp-ranks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.cp-ranks li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--bg); font-weight: 650; }
.cp-ranks li b { margin-left: auto; color: var(--good-ink); }
.cp-rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-size: 13px; font-weight: 800; color: var(--muted); flex: none; }

.cp-brow { display: grid; grid-template-columns: 46px 1fr 58px 38px; gap: 6px; align-items: center; margin-top: 6px; }
#groupsEditor .cp-brow { grid-template-columns: 46px 1fr 38px; border-left: 4px solid var(--c); padding-left: 6px; }
.cp-brow .input { padding: 6px 8px; font-size: 14px; }
.cp-members-edit { margin-top: 10px; font-size: 14px; }
.cp-members-edit summary { cursor: pointer; font-weight: 650; }
.cp-mrow { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; align-items: center; margin-top: 6px; }
.cp-mrow .input { padding: 5px 8px; font-size: 14px; }
.cp-history { display: grid; gap: 4px; max-height: 280px; overflow-y: auto; }
.cp-hrow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: center; font-size: 13px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.cp-htext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-htime { font-size: 12px; font-variant-numeric: tabular-nums; }
.cp-hrow b.pos { color: var(--good-ink); }
.cp-hrow b.neg { color: var(--bad-ink); }
.cp-hrow .btn { padding: 2px 8px; font-size: 12px; }
.cp-sync { display: grid; gap: 8px; justify-items: start; }
.cp-sync .hint { margin: 0; }
.cp-sync-status { font-weight: 700; font-size: 14px; }
.cp-sync-status.ok { color: var(--good-ink); }
.cp-sync-status.error { color: var(--bad-ink); }

/* ---------- Class schedule ---------- */
.sc-stage { position: absolute; inset: 0; display: flex; flex-direction: column; }
.sc-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 18px 6px; position: relative; z-index: 3; }
.sc-body { flex: 1; min-height: 0; overflow: auto; position: relative; z-index: 2; }
.sc-board {
  min-height: 100%; display: grid; grid-template-columns: 1fr minmax(260px, 30%); grid-template-rows: auto 1fr;
  gap: 10px 24px; padding: 4px 22px 22px; position: relative;
}
.sc-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.sc-class { font-weight: 850; font-size: clamp(18px, 2.6vmin, 28px); }
.sc-date { color: var(--muted); font-weight: 650; font-size: clamp(14px, 2vmin, 20px); }
.sc-clock { font-weight: 850; font-size: clamp(30px, 6vmin, 64px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sc-main { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; min-width: 0; }
.sc-label { font-weight: 850; font-size: clamp(24px, 5vmin, 54px); letter-spacing: 0.02em; }
.sc-label.big { font-size: clamp(30px, 7vmin, 72px); }
.sc-count { font-weight: 900; font-size: min(22vmin, 220px); line-height: 0.95; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
body.is-fs .sc-count, body.panel-hidden .sc-count { font-size: min(26vmin, 280px); }
.sc-next, .sc-after { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; font-size: clamp(16px, 2.4vmin, 24px); font-weight: 700; }
.sc-sub { font-weight: 700; color: var(--muted); font-size: clamp(16px, 2.6vmin, 26px); margin-bottom: -6px; }
.sc-bring { font-weight: 700; font-size: clamp(16px, 2.8vmin, 28px); padding: 8px 22px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--line); }
.sc-progress { width: min(80%, 720px); height: clamp(14px, 2.4vmin, 24px); border-radius: 999px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.sc-progress i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #22c55e, #3b82f6); transition: width 0.5s linear; }
.sc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-weight: 750; background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--ink); border: 2px solid color-mix(in srgb, var(--c) 55%, transparent); white-space: nowrap; }
.sc-chip.big { font-size: clamp(30px, 6.5vmin, 70px); padding: 6px 30px; border-width: 3px; }
.sc-chip-icon:empty { display: none; }
.sc-board.soon .sc-count { color: var(--bad-ink); animation: scpulse 1s ease-in-out infinite; }
.sc-board.soon .sc-bring { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
@keyframes scpulse { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .sc-board.soon .sc-count { animation: none; } }

.sc-today { align-self: stretch; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 20px; background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); min-height: 0; overflow: auto; }
.sc-today h3 { margin: 0 0 4px; font-size: clamp(16px, 2.2vmin, 22px); }
.sc-item { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; border-left: 5px solid var(--c); background: var(--bg); font-size: clamp(14px, 1.9vmin, 19px); }
.sc-item-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.82em; font-weight: 650; white-space: nowrap; }
.sc-item-name { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-item.past { opacity: 0.45; }
.sc-item.now { background: color-mix(in srgb, var(--c) 22%, var(--surface)); outline: 2px solid var(--c); }
.sc-item.next { outline: 2px dashed var(--c); }
.sc-tag { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--c); color: #fff; white-space: nowrap; }
.sc-sample { position: absolute; left: 22px; bottom: 10px; font-size: 13px; font-weight: 700; color: var(--warn-ink); }

.sc-week { padding: 6px 18px 22px; }
.sc-week-title { font-size: clamp(18px, 2.6vmin, 26px); margin: 4px 0 12px; }
.sc-table { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.sc-table th { font-size: clamp(14px, 2vmin, 19px); font-weight: 800; padding: 6px; text-align: center; border-radius: 10px; }
.sc-table thead th.today { background: var(--brand); color: var(--brand-ink); }
.sc-table th.sc-ptime { width: clamp(90px, 13%, 150px); text-align: left; background: var(--surface-2); }
.sc-ptime b { display: block; }
.sc-ptime small { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.sc-table td { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; height: clamp(44px, 7vmin, 70px); text-align: center; padding: 4px; }
.sc-table td.today { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.sc-table td.now { outline: 3px solid var(--brand); }
.sc-table td .sc-chip { font-size: clamp(13px, 1.9vmin, 18px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sc-table td select.input { padding: 6px 4px; font-size: 14px; }

.sc-prow { display: grid; grid-template-columns: minmax(0, 1fr) 86px 86px 34px; gap: 5px; align-items: center; margin-top: 6px; }
.sc-prow .input { padding: 6px 6px; font-size: 14px; }
.sc-prow.bad .input[type='time'] { border-color: var(--bad); }
.sc-warn { color: var(--bad-ink); font-weight: 650; }
.sc-srow { display: grid; grid-template-columns: 46px 1fr 40px 38px; gap: 5px; align-items: center; margin-top: 10px; padding-left: 6px; border-left: 4px solid var(--c); }
.sc-srow .input { padding: 6px 8px; font-size: 14px; }
.sc-srow .sc-bring-in { grid-column: 1 / -1; font-size: 13px; }
.sc-color { width: 40px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }

/* ---------- Class board ---------- */
.cb-stage { position: absolute; inset: 0; overflow: auto; z-index: 2; }
.cb-board {
  min-height: 100%; display: grid; grid-template-columns: 1fr minmax(240px, 26%); grid-template-rows: auto 1fr auto;
  gap: 12px 22px; padding: 14px 22px 20px;
}
.cb-top { grid-column: 1 / -1; }
.cb-main { grid-column: 1; grid-row: 2; gap: 8px; }
.cb-today { grid-column: 2; grid-row: 2; }
.cb-cards { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.cb-board .sc-label { font-size: clamp(20px, 4vmin, 44px); }
.cb-board .sc-label.big { font-size: clamp(26px, 5.5vmin, 60px); }
.cb-board .sc-count { font-size: min(16vmin, 170px); }
body.is-fs .cb-board .sc-count, body.panel-hidden .cb-board .sc-count { font-size: min(19vmin, 210px); }
.cb-board .sc-chip.big { font-size: clamp(22px, 4.4vmin, 50px); padding: 4px 22px; }
.cb-board .sc-bring { font-size: clamp(15px, 2.3vmin, 24px); }
.cb-board.soon .sc-count { color: var(--bad-ink); animation: scpulse 1s ease-in-out infinite; }
.cb-board.soon .sc-bring { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
@media (prefers-reduced-motion: reduce) { .cb-board.soon .sc-count { animation: none; } }
.cb-today .sc-item { grid-template-columns: auto auto 1fr auto; padding: 5px 9px; }

.cb-card { padding: 12px 16px 14px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.cb-card h3 { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; font-size: clamp(15px, 2vmin, 21px); }
.cb-duty { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: clamp(14px, 1.9vmin, 19px); }
.cb-duty:last-child { border-bottom: 0; }
.cb-job { font-weight: 750; white-space: nowrap; }
.cb-names { display: flex; flex-wrap: wrap; gap: 4px; }
.cb-names span { padding: 1px 9px; border-radius: 999px; background: var(--surface-2); font-weight: 650; }
.cb-names span.absent { text-decoration: line-through; color: var(--muted); }
.cb-text { font-size: clamp(15px, 2.1vmin, 22px); font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.cb-meta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.cb-stars { display: grid; gap: 4px; font-size: clamp(15px, 2.1vmin, 22px); }
.cb-stars > div { display: flex; align-items: center; gap: 8px; }
.cb-stars b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-pts { margin-left: auto; color: var(--good-ink); font-weight: 800; }
.cb-jar { margin-top: 10px; }
.cb-jar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.cb-jar .sc-progress { width: 100%; height: 12px; }
.cb-event { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3px 0; font-size: clamp(15px, 2.1vmin, 22px); font-weight: 650; }
.cb-days { font-size: 1.6em; font-weight: 900; color: var(--brand); font-variant-numeric: tabular-nums; }
.cb-today-tag { color: var(--bad-ink); }

.cb-table-wrap { overflow-x: auto; margin: 8px 0 12px; }
.cb-duty-table { min-width: 640px; }
.cb-duty-table th:first-child { width: 190px; text-align: left; }
.cb-duty-table td { height: auto; padding: 3px; }
.cb-duty-table textarea.input { font-size: 13px; padding: 5px 6px; resize: vertical; min-height: 44px; }
.cb-duty-table .cb-del { width: 44px; background: none; border: 0; }
.cb-jobedit { display: grid; grid-template-columns: 44px 1fr; gap: 4px; }
.cb-jobedit .input { padding: 5px 6px; font-size: 14px; }
.cb-erow { display: grid; grid-template-columns: minmax(0, 1fr) 140px 34px; gap: 5px; align-items: center; margin-top: 6px; }
.cb-erow .input { padding: 6px 6px; font-size: 14px; }
.cb-duty-dialog .row-btns { align-items: center; }

@media (max-width: 820px) {
  .cb-board { grid-template-columns: 1fr; grid-template-rows: none; }
  .cb-main, .cb-today, .cb-cards { grid-column: 1; grid-row: auto; }
  .cb-stage { position: relative; min-height: 62vh; }
}

@media print {
  .sc-bar { display: none !important; }
  .sc-stage, .sc-body { position: static; overflow: visible; }
  .sc-table td, .sc-table th { border: 1px solid #ccc; }
  .sc-table thead th.today, .sc-table td.today { background: #fff; color: #000; }
  .sc-table td.now { outline: none; }
}

@media (max-width: 820px) {
  .sc-board { grid-template-columns: 1fr; }
  .sc-stage { position: relative; min-height: 62vh; }
  .sc-table { border-spacing: 3px; }
  .sc-table td .sc-chip { padding: 2px 6px; }
}

@media (max-width: 820px) {
  .cp-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .cp-item { grid-template-columns: auto 1fr auto; }
  .cp-item-stock { grid-column: 2; }
  .cp-item.edit { grid-template-columns: 48px 1fr 64px; }
  .cp-item-head { display: none; }
  .cp-stage { position: relative; min-height: 62vh; }
}

/* =====================================================================
   v0.5 UI redesign: shared shell + components
   ===================================================================== */
a.btn:hover { text-decoration: none; }
.hidden { display: none !important; }

/* Top bar additions */
.topbar { gap: var(--space-2); }
.topbar .brand { min-height: 44px; padding: 0 var(--space-2) 0 var(--space-1); border-radius: var(--radius-sm); }
.topbar .brand:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar-sep { width: 1px; height: 28px; background: var(--line); margin: 0 var(--space-1); flex: none; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-2); }
.topbar .icon-btn { width: 44px; height: 44px; }
.topbar .fb-open { min-height: 44px; }
.topbar-more { display: none; }
.fs-btn .fs-label { margin-left: 4px; }
.topbar .tool-menu summary, .topbar .topbar-more > summary { min-height: 44px; }

/* Menus */
.topbar details { position: relative; }
.topbar details > summary { list-style: none; }
.topbar details > summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; top: calc(100% + 6px);
  min-width: 260px; max-height: calc(100vh - var(--topbar-h) - 16px); max-height: calc(100dvh - var(--topbar-h) - 16px); overflow: auto;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: var(--space-2); z-index: var(--z-menu);
}
.menu-left { left: 0; }
.menu-right { right: 0; }
.menu-item {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  min-height: 44px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink); font: inherit; font-size: var(--text-md); font-weight: 600;
  text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.menu-item[aria-current='page'] { background: var(--brand-soft); font-weight: 700; }
.menu-item .tag, .menu-item .badge-pro { margin-left: auto; }
.menu-group-title { display: flex; align-items: center; gap: 8px; padding: var(--space-3) var(--space-3) var(--space-1); font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.menu-group-title .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.menu-sep { height: 1px; margin: var(--space-2) 0; background: var(--line); }
.menu-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); }
.menu-head small { display: block; color: var(--muted); font-size: var(--text-sm); }
.menu-recent { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0 var(--space-3) var(--space-2); }
.menu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-2); }
.tool-menu .menu { width: 560px; }
@media (max-width: 899px) {
  .menu-cols { grid-template-columns: 1fr; }
  .tool-menu .menu { width: min(360px, calc(100vw - 16px)); }
}
.tool-menu-list { display: block; padding: var(--space-2); gap: 0; }

/* Account area */
.acct { display: flex; align-items: center; }
.acct[data-state='unknown'], .acct[data-state='none'] { display: none; }
.acct details { position: relative; }
.acct-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 4px 12px 4px 4px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 2px 0 var(--lip);
  font: inherit; font-size: var(--text-sm); font-weight: 700; cursor: pointer; list-style: none;
}
.acct-btn::-webkit-details-marker { display: none; }
.acct-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.acct-btn.is-compact { padding: 4px; }
.avatar {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #ffd23f, #ff9a5c 70%, #ff7a5c); color: #1a1d24; font-weight: 800; font-size: 15px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}
.avatar.is-guest { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.avatar .pro-dot {
  position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--joy-gold); border: 2px solid var(--surface);
}
.acct-credits { color: var(--muted); font-variant-numeric: tabular-nums; }
.acct-credits b { color: var(--ink); }
.acct-pop { width: 320px; max-width: calc(100vw - 16px); padding: var(--space-4); }
.acct-pop p { margin: 0 0 var(--space-3); color: var(--muted); font-size: var(--text-sm); }
.acct-pop h4 { margin: 0 0 var(--space-2); font-size: var(--text-md); }
.acct-pop .row-btns { margin-top: 0; }
.email-row { display: flex; align-items: center; gap: var(--space-1); }
.email-row .email-text { overflow-wrap: anywhere; font-weight: 600; }
.email-toggle { width: 32px; height: 32px; font-size: 15px; border-radius: var(--radius-sm); border: 0; background: transparent; }

/* Boxes */
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.box + .box { margin-top: var(--space-4); }
.box-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.box-title { flex: 1; margin: 0; font-size: var(--text-lg); font-weight: 700; }
.box-sub { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.box-danger { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

/* Dense editing rows in the panel (4.4 exception: 36px, 44px on touch) */
.cp-brow .input, .sc-prow .input, .sc-srow .input, .cb-erow .input, .cp-item.edit .input,
.cp-mrow .input, .vl-edit .input, .cb-jobedit .input, .sc-table td select.input,
.cb-duty-table textarea.input { min-height: 36px; }
.cp-brow .icon-btn, .sc-prow .icon-btn, .sc-srow .icon-btn, .cb-erow .icon-btn, .cb-del .icon-btn, .cp-item.edit .icon-btn { width: 36px; height: 36px; }
@media (any-pointer: coarse) {
  .cp-brow .input, .sc-prow .input, .sc-srow .input, .cb-erow .input, .cp-item.edit .input,
  .cp-mrow .input, .vl-edit .input, .cb-jobedit .input, .sc-table td select.input { min-height: 44px; }
  .cp-brow .icon-btn, .sc-prow .icon-btn, .sc-srow .icon-btn, .cb-erow .icon-btn, .cb-del .icon-btn, .cp-item.edit .icon-btn { width: 44px; height: 44px; }
  .cp-brow { grid-template-columns: 46px 1fr 58px 44px; }
  #groupsEditor .cp-brow { grid-template-columns: 46px 1fr 44px; }
  .sc-prow { grid-template-columns: minmax(0, 1fr) 86px 86px 44px; }
  .sc-srow { grid-template-columns: 46px 1fr 40px 44px; }
  .cb-erow { grid-template-columns: minmax(0, 1fr) 140px 44px; }
}
@media (min-width: 1600px) { :root { --panel-w: 360px; } }

/* Dialog */
dialog.dialog {
  width: min(520px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.dialog.wide { width: min(880px, calc(100vw - 32px)); }
dialog.dialog::backdrop { background: var(--overlay); }
dialog.dialog[open] { animation: popin var(--dur-2) var(--ease-out); }
.dialog-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-5) var(--space-2); }
.dialog-title { flex: 1; margin: 0; font-size: var(--text-xl); font-weight: 700; }
.dialog-body { padding: 0 var(--space-5); overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-4) var(--space-5) var(--space-5); }
@media (max-width: 520px) { .dialog-foot .btn { flex: 1; } }

/* Notice, empty state, spinner */
.notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--brand-soft); color: var(--ink); font-size: var(--text-sm);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-left: 4px solid var(--brand);
}
.notice-icon { flex: none; font-size: 18px; line-height: 1.3; }
.notice-title { display: block; font-weight: 700; font-size: var(--text-md); }
.notice-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.notice.is-ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, var(--line)); border-left-color: var(--good); }
.notice.is-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); border-left-color: var(--warn); }
.notice.is-error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); border-left-color: var(--bad); }
.empty-state { text-align: center; padding: var(--space-10) var(--space-4); color: var(--muted); }
.empty-state-icon { font-size: 44px; line-height: 1; }
.empty-state-title { margin: var(--space-3) 0 var(--space-1); font-size: var(--text-lg); font-weight: 700; color: var(--ink); }
.empty-state p { max-width: 36em; margin: 0 auto var(--space-4); }
.spinner {
  display: inline-block; width: 18px; height: 18px; vertical-align: -3px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
  animation: ck-spin 0.8s linear infinite;
}
@keyframes ck-spin { to { transform: rotate(360deg); } }

/* Gate card (login / Pro / offline) */
.gate {
  max-width: 560px; margin: clamp(24px, 8vh, 80px) auto; padding: var(--space-8) var(--space-6);
  text-align: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
.gate-icon { font-size: 48px; line-height: 1; }
.gate-title { margin: var(--space-3) 0 var(--space-2); font-size: var(--text-2xl); font-weight: 800; }
.gate-lead { margin: 0 0 var(--space-4); color: var(--muted); font-size: var(--text-md); }
.gate-list { list-style: none; max-width: 420px; margin: 0 auto var(--space-5); padding: 0; display: grid; gap: var(--space-2); text-align: left; }
.gate-list li { display: flex; gap: var(--space-2); }
.gate-list li::before { content: '\2713'; color: var(--good-ink); font-weight: 800; }
.gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.gate-foot { margin-top: var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.gate.is-inline { margin: 0; padding: var(--space-5); box-shadow: none; }
/* the noise tools already use .gate inside the volume meter: keep them untouched */
.meter-v .gate { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; text-align: initial; }

/* Pro badge, upsell, credits chip */
.badge-pro {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border-radius: 7px; background: var(--pro); color: var(--pro-on);
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; line-height: 1;
}
.upsell {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm);
  border: 1px dashed var(--line-strong);
  background: color-mix(in srgb, var(--joy-gold) 14%, var(--surface));
}
.upsell a { color: var(--pro-ink); font-weight: 700; }
.credits {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border-radius: var(--radius-pill); background: var(--surface-2); font-variant-numeric: tabular-nums;
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
}
.credits b { font-variant-numeric: tabular-nums; }
.credits.is-low { background: var(--warn-soft); }

/* Choice buttons (workbench model picker) */
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.choice { text-align: left; min-height: 64px; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 2px 0 var(--lip); }
.choice small { display: block; color: var(--muted); font-size: var(--text-sm); }
.choice[aria-pressed='true'] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand), 0 2px 0 var(--brand-line); }
.choice:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 520px) { .choice-row { grid-template-columns: 1fr; } }

/* Assistant presentation layer (quiz game, flashcards) */
.present { position: fixed; inset: 0; z-index: var(--z-present); display: flex; flex-direction: column; padding: 3vh 4vw; background: var(--stage); color: var(--ink); }
.present-bar { display: flex; align-items: center; gap: var(--space-3); font-size: var(--stage-text-s); }
.present-q { margin: 4vh 0 3vh; font-size: var(--stage-text-l); font-weight: 800; line-height: 1.25; }
.present-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 2vh 2vw; }
.present-opt { display: flex; gap: 14px; align-items: center; padding: 2.2vh 2vw; border: 3px solid var(--line-strong); border-radius: 18px; background: var(--surface); font-size: var(--stage-text-m); }
.present-opt .l { font-weight: 800; color: var(--brand); }
.present-opt.right { border-color: var(--good); background: var(--good-soft); }
.present-opt.dim { opacity: 0.45; }
.present-exp { margin-top: 3vh; color: var(--muted); font-size: var(--stage-text-m); }
.present-nav { margin-top: auto; padding-top: 2vh; display: flex; justify-content: center; gap: var(--space-3); }
.present-card { flex: 1; margin: 3vh 0; padding: 4vh 4vw; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 3px solid var(--line-strong); border-radius: 28px; background: var(--surface); cursor: pointer; user-select: none; }
.present-card .front { font-size: var(--stage-text-xl); font-weight: 800; line-height: 1.15; }
.present-card .back { margin-top: 2vh; font-size: var(--stage-text-l); font-weight: 700; }
.present-card .ex { margin-top: 2vh; color: var(--muted); font-size: var(--stage-text-m); font-style: italic; }
.present-card .tap { margin-top: 3vh; color: var(--muted); font-size: var(--stage-text-s); }
@media (max-width: 820px) { .present-opts { grid-template-columns: 1fr; } }

/* Home: hide the demo animation on phones */
@media (max-width: 640px) { .hero-art { display: none; } .hero { padding-top: 24px; } }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Shell (P2) */
@media (max-width: 820px) {
  .topbar { padding: 0 var(--space-2); gap: var(--space-1); }
  .brand-name { display: none; }
  .tool-menu summary .tool-menu-name { display: none; }
  .topbar .fb-open, .topbar .lang-seg, .topbar .theme-btn, .topbar .topbar-sep, .topbar .mute-btn { display: none; }
  .topbar-more { display: block; }
  .fs-btn .fs-label, .acct-credits { display: none; }
}
.tool-menu { margin-left: var(--space-1); }
.menu-check { margin-left: auto; color: var(--brand); font-weight: 800; }
.menu-pad { padding: 0 var(--space-3) var(--space-2); }
.menu-pad .seg { display: flex; }
.menu-pad .seg button { flex: 1; }
.menu-col { min-width: 0; }
.dialog .keys { display: grid; gap: 6px; font-size: var(--text-sm); color: var(--muted); }
.hint.ai-note { margin: 0 0 var(--space-3); }
.acct .menu { min-width: 300px; }
.menu-head > div { min-width: 0; flex: 1; }
@media (max-width: 820px) {
  .topbar .menu { position: fixed; top: calc(var(--topbar-h) + 6px); max-width: calc(100vw - 16px); }
  .topbar .menu-right { right: 8px; left: auto; }
  .topbar .menu-left { left: 8px; right: auto; }
  .acct .menu { min-width: 0; width: min(320px, calc(100vw - 16px)); }
}

/* Semester garden page */
.sg-wrap { max-width: 920px; margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-16); }
.sg-head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; justify-content: space-between; margin-bottom: var(--space-4); }
.sg-head h1 { font-size: var(--text-2xl); margin: 0; }
.sg-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--text-sm); }
.sg-card h2 { font-size: var(--text-md); margin: 0 0 var(--space-3); }
.sg-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.sg-row label:not(.btn) { font-size: var(--text-sm); color: var(--muted); }
.sg-row .input { width: auto; min-width: 150px; }
.sg-note { color: var(--muted); font-size: var(--text-sm); margin: var(--space-2) 0 0; }
.sg-stats { display: flex; flex-wrap: wrap; gap: var(--space-5); margin: var(--space-1) 0 var(--space-3); font-size: var(--text-sm); color: var(--muted); }
.sg-stats b { color: var(--ink); font-size: var(--text-lg); margin-right: var(--space-1); }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.sg-cell { aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px dashed var(--line-strong); display: grid; place-items: center; font-size: 22px; background: var(--stage); position: relative; }
.sg-cell.future { opacity: 0.45; }
.sg-cell.today { border: 2px solid var(--brand); }
.sg-cell.missed { background: transparent; }
.sg-cell.planted { border-style: solid; border-color: var(--line); background: var(--surface-2); }
.sg-cell .d { position: absolute; bottom: 1px; right: 4px; font-size: 10px; color: var(--muted); }
.sg-msg { min-height: 1.4em; font-size: var(--text-sm); margin-top: var(--space-2); }
.sg-msg.err { color: var(--bad-ink); font-weight: 600; }
.sg-msg.ok { color: var(--good-ink); font-weight: 600; }

/* =====================================================================
   v0.5 direction D: icons, favourites, topbar details
   ===================================================================== */
.fav-btn .ic { width: 20px; height: 20px; }
.fav-btn.on .ic { fill: var(--joy-gold); stroke: #1a1d24; }
.chev.ic { width: 16px; height: 16px; color: var(--muted); }
.fs-exit .ic { width: 18px; height: 18px; }
.menu-check .ic { width: 18px; height: 18px; }
.menu-item .ic { width: 20px; height: 20px; color: var(--ink-2); }
.topbar .fb-open { color: var(--ink-2); gap: 8px; }
.topbar .fb-open .ic { width: 19px; height: 19px; }
.topbar .brand-name { white-space: nowrap; }
.topbar { box-shadow: 0 1px 0 var(--line); }
.mute-btn[aria-pressed='true'] { background: var(--warn-soft); color: var(--warn-ink); }
.topbar .lang-seg button { min-height: 38px; min-width: 44px; }
.topbar .lang-seg { height: 44px; align-items: center; }
.tool-menu summary .tile-sm.tile-home { background: var(--surface-2); }
.menu-recent { padding-bottom: var(--space-2); }

/* =====================================================================
   Timer: scoreboard style + "Time's up!" screen (direction D, mockup s2c)
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
.t-display[data-style='score'] { width: 100%; }
.board {
  --n: 4; --m: 1;
  position: relative; container-type: inline-size; width: min(94%, 1400px, 138vmin); margin: 0 auto;
  padding: clamp(14px, 2.4vmin, 24px) clamp(14px, 3.2vmin, 36px);
  border-radius: clamp(20px, 3vmin, 32px); background: var(--score-bg); color: #eeeff2; text-align: left;
  box-shadow: 0 4px 0 #000, 0 44px 80px -30px rgba(14, 16, 22, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  transition: box-shadow 0.3s ease;
}
.board::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(ellipse 55% 60% at 50% 0%, rgba(255, 255, 255, 0.09), transparent 70%); pointer-events: none; }
.board .bd-h { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.board .slant { display: inline-flex; align-items: center; gap: 10px; height: clamp(30px, 4.6cqi, 42px); padding: 0 clamp(14px, 2.6cqi, 26px); background: var(--score-digit); color: #1a1d24; font-size: clamp(13px, 2cqi, 19px); font-weight: 800; clip-path: polygon(11px 0, 100% 0, calc(100% - 11px) 100%, 0 100%); }
.board .slant .live { width: 9px; height: 9px; border-radius: 50%; background: #1a1d24; box-shadow: 0 0 0 3px rgba(26, 29, 36, 0.22); }
.board .bd-meta { display: flex; gap: clamp(10px, 2.4cqi, 24px); font-size: clamp(12px, 1.6cqi, 15px); color: #a9adb6; font-weight: 600; }
.board .bd-meta b { color: #fff; font-weight: 800; margin-left: 4px; font-size: 1.25em; font-variant-numeric: tabular-nums; }
.board .digits {
  --gap: clamp(5px, 1.4cqi, 14px);
  --cw: calc((100cqi - (var(--n) + var(--m) - 1) * var(--gap)) / (var(--n) + 0.22 * var(--m)));
  position: relative; display: flex; justify-content: center; align-items: center; gap: var(--gap); margin: clamp(10px, 2.2cqi, 22px) 0;
}
.board .cell {
  position: relative; width: var(--cw); height: calc(var(--cw) * 1.32); border-radius: calc(var(--cw) * 0.12);
  background: linear-gradient(var(--score-cell), #12141b); display: grid; place-items: center; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 2px 0 #000;
}
.board .cell::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: var(--score-bg); }
.board .cell b { font-size: calc(var(--cw) * 1.25); font-weight: 800; line-height: 1; color: var(--score-digit); text-shadow: 0 0 44px rgba(255, 210, 63, 0.35); margin-top: calc(var(--cw) * -0.05); font-variant-numeric: tabular-nums; }
.board .colon { width: calc(var(--cw) * 0.22); display: flex; flex-direction: column; align-items: center; gap: calc(var(--cw) * 0.24); }
.board .colon i { width: calc(var(--cw) * 0.13); height: calc(var(--cw) * 0.13); border-radius: 30%; background: var(--score-digit); box-shadow: 0 0 22px rgba(255, 210, 63, 0.45); }
.board .segbar { position: relative; display: grid; grid-template-columns: repeat(30, 1fr); gap: clamp(2px, 0.4cqi, 6px); }
.board .segbar i { height: clamp(10px, 1.8cqi, 18px); border-radius: 4px; background: var(--score-off); }
.board .segbar i.on { background: var(--score-digit); }
.board .seg-l { position: relative; display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: clamp(11px, 1.4cqi, 13px); font-weight: 800; letter-spacing: 0.12em; color: #a9adb6; text-transform: uppercase; }
.board[data-state='warn'] { box-shadow: 0 0 0 5px var(--joy-coral), 0 0 0 18px rgba(255, 122, 92, 0.2), 0 0 0 36px rgba(255, 122, 92, 0.08), 0 30px 60px -24px rgba(14, 16, 22, 0.6); animation: sb-pulse 1s ease-in-out infinite; }
.board[data-state='warn'] .slant { background: var(--joy-coral); }
.board[data-state='warn'] .cell b { color: var(--joy-coral); text-shadow: 0 0 34px rgba(255, 122, 92, 0.5); }
.board[data-state='warn'] .colon i { background: var(--joy-coral); box-shadow: 0 0 16px rgba(255, 122, 92, 0.5); }
.board[data-state='warn'] .segbar i.on { background: var(--joy-coral); }
.board[data-state='done'] .slant { background: var(--joy-coral); }
.board[data-state='done'] .cell b { color: var(--joy-coral); }
@keyframes sb-pulse { 50% { transform: scale(1.015); } }
@media (prefers-reduced-motion: reduce) { .board[data-state='warn'] { animation: none; } }

.timesup {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; overflow: hidden; cursor: pointer; text-align: center;
  color: #1a1d24;
  background: repeating-conic-gradient(from 0deg at 50% 48%, rgba(255, 255, 255, 0.26) 0deg 8deg, rgba(255, 255, 255, 0) 8deg 20deg), radial-gradient(circle at 50% 48%, #ffe9a8 0%, #ffc94f 42%, #ffbe2e 70%);
}
.timesup .tu-ring { position: absolute; left: 50%; top: 48%; border-radius: 50%; transform: translate(-50%, -50%); border: 3px solid rgba(255, 255, 255, 0.7); pointer-events: none; }
.timesup .tu-ring1 { width: min(52vmin, 520px); height: min(52vmin, 520px); }
.timesup .tu-ring2 { width: min(76vmin, 760px); height: min(76vmin, 760px); border-color: rgba(255, 255, 255, 0.35); }
.timesup .tu-cf { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.timesup .tu-in { position: relative; z-index: 2; padding: 20px; max-width: 100%; }
.timesup .tu-title { margin: 0; font-size: clamp(48px, 15vmin, 190px); font-weight: 800; letter-spacing: 0.02em; line-height: 1; color: #1a1d24; text-wrap: balance; }
.timesup .tu-cap { margin-top: 12px; min-height: 1em; font-size: clamp(14px, 2.6vmin, 28px); letter-spacing: 0.3em; font-weight: 800; }
.timesup .tu-muted { display: inline-block; margin-top: 18px; padding: 8px 18px; border-radius: 999px; background: #1a1d24; color: #fff; font-size: clamp(14px, 2vmin, 20px); font-weight: 700; }
.timesup .tu-acts { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.timesup .btn { min-height: 52px; border-radius: 16px; background: #fff; color: #1a1d24; border: 1px solid rgba(26, 29, 36, 0.12); box-shadow: 0 2px 0 rgba(26, 29, 36, 0.18); }
.timesup .btn:hover { background: #fff6dc; }
.timesup .btn.btn-ink { background: #1a1d24; color: #fff; border-color: transparent; box-shadow: 0 2px 0 #000; }
.timesup .btn:focus-visible { outline: 3px solid #1a1d24; outline-offset: 3px; }
.timesup.tu-go .tu-ring1 { animation: tu-pulse 1s ease-out 3; }
.timesup.tu-go .tu-ring2 { animation: tu-pulse 1s ease-out 0.25s 3; }
.timesup.tu-go .tu-title { animation: popin 0.5s var(--ease-pop) both; }
@keyframes tu-pulse { from { transform: translate(-50%, -50%) scale(0.7); opacity: 1; } to { transform: translate(-50%, -50%) scale(1.15); opacity: 0.1; } }

/* Name picker reveal (mockup s3): ribbon + sun rays behind the card */
.result-pop { background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 190, 46, 0.2) 0deg 7deg, rgba(255, 190, 46, 0) 7deg 17deg), color-mix(in srgb, var(--stage) 70%, transparent); }
.result-card .rib { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); height: 46px; padding: 0 30px; display: inline-flex; align-items: center; background: var(--joy-gold); color: #1a1d24; font-size: clamp(18px, 3vmin, 24px); font-weight: 800; white-space: nowrap; clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); }
.result-card { overflow: visible; }

/* inline icon placeholders on the server pages */
.ic-slot { display: inline-flex; vertical-align: -4px; }
.ic-slot .ic { width: 19px; height: 19px; }
.gate-tile { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto; }
.gate-tile svg { width: 46px; height: 46px; }
.empty-state-icon svg { width: 44px; height: 44px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: inline-block; }
