/* sooks — clean LeetCode-ish layout with monospace accents (agentic/decisions/0011).
   Themes are token sets on <html data-theme>; "" follows the OS. Fonts are self-hosted. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/static/inter-400.woff2?v=8909904a") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("/static/inter-500.woff2?v=f3779f1e") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/static/inter-600.woff2?v=f9a06e79") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("/static/inter-700.woff2?v=6f56409f") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("/static/jetbrains-mono-400.woff2?v=14425ba9") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url("/static/jetbrains-mono-600.woff2?v=400c6bfd") format("woff2"); }
/* The editor's other fonts (its settings menu; theme.js applies the choice). A browser downloads one
   only when it's used. */
@font-face { font-family: "Fira Code"; font-weight: 400; font-display: swap; src: url("/static/fira-code-400.woff2?v=6dc9da17") format("woff2"); }
@font-face { font-family: "Cascadia Code"; font-weight: 400; font-display: swap; src: url("/static/cascadia-code-400.woff2?v=923fd5a6") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 400; font-display: swap; src: url("/static/geist-mono-400.woff2?v=3f98383b") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/static/ibm-plex-mono-400.woff2?v=08949f72") format("woff2"); }
@font-face { font-family: "Source Code Pro"; font-weight: 400; font-display: swap; src: url("/static/source-code-pro-400.woff2?v=75aa8cac") format("woff2"); }
@font-face { font-family: "Victor Mono"; font-weight: 400; font-display: swap; src: url("/static/victor-mono-400.woff2?v=1c96d470") format("woff2"); }
@font-face { font-family: "Comic Mono"; font-weight: 400; font-display: swap; src: url("/static/comic-mono-400.woff2?v=b5f97a2b") format("woff2"); }

/* ---------- tokens ---------- */
/* The light tokens also apply to any element with data-theme="light" (as every theme's do), so the
   theme picker's previews can show each one in any page. */
:root, [data-theme="light"] {
  --select: rgba(240, 140, 0, 0.24); /* text selected with the mouse (::selection) */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 8px;
  --radius-sm: 5px;
  --header-h: 50px;

  /* light ("paper") */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --surface-3: #e9eaee;
  --border: #e3e4e8;
  --border-strong: #cfd1d6;
  --fg: #1f2125;
  --fg-2: #3c3f45;
  --muted: #7b7f87;
  --accent: #f08c00;
  --accent-fg: #ffffff;
  --accent-soft: rgba(240, 140, 0, 0.12);
  --ok: #1f9d55;
  --ok-fg: #ffffff;
  --easy: #00a38c;
  --medium: #e5a300;
  --hard: #e8304f;
  --link: #2f6fe0;
  --shadow: 0 1px 2px rgba(16, 18, 24, 0.06), 0 2px 8px rgba(16, 18, 24, 0.04);
  --habit: #7c4dff;
  --habit-active: #6328ff;
  --heat-0: #ebedf0; --heat-1: #ffe2b0; --heat-2: #ffc266; --heat-3: #f99d1c; --heat-4: #d97800;
  color-scheme: light;
}

/* dark (default when the OS prefers dark) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
  --select: rgba(255, 161, 22, 0.28); /* text selected with the mouse (::selection) */
    --bg: #1a1a1a; --surface: #262626; --surface-2: #2e2e2e; --surface-3: #383838;
    --border: #353535; --border-strong: #4a4a4a; --fg: #eff1f6; --fg-2: #d3d6dc; --muted: #9a9ea6;
    --accent: #ffa116; --accent-fg: #1a1a1a; --accent-soft: rgba(255, 161, 22, 0.14);
    --ok: #2cbb5d; --ok-fg: #ffffff; --easy: #00b8a3; --medium: #ffc01e; --hard: #ff375f; --link: #6aa6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --habit: #b49cff; --habit-active: #d2c4ff;
    --heat-0: #2d2d2d; --heat-1: #5a3f12; --heat-2: #8f5f10; --heat-3: #d0820f; --heat-4: #ffa116;
    color-scheme: dark;
  }
}
[data-theme="dark"] {
  --select: rgba(255, 161, 22, 0.28); /* text selected with the mouse (::selection) */
  --bg: #1a1a1a; --surface: #262626; --surface-2: #2e2e2e; --surface-3: #383838;
  --border: #353535; --border-strong: #4a4a4a; --fg: #eff1f6; --fg-2: #d3d6dc; --muted: #9a9ea6;
  --accent: #ffa116; --accent-fg: #1a1a1a; --accent-soft: rgba(255, 161, 22, 0.14);
  --ok: #2cbb5d; --ok-fg: #ffffff; --easy: #00b8a3; --medium: #ffc01e; --hard: #ff375f; --link: #6aa6ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --habit: #b49cff; --habit-active: #d2c4ff;
  --heat-0: #2d2d2d; --heat-1: #5a3f12; --heat-2: #8f5f10; --heat-3: #d0820f; --heat-4: #ffa116;
  color-scheme: dark;
}
[data-theme="solarized"] {
  --select: rgba(38, 139, 210, 0.38); /* text selected with the mouse (::selection) */
  --bg: #002b36; --surface: #073642; --surface-2: #0b3f4c; --surface-3: #124a58;
  --border: #154c59; --border-strong: #2a6070; --fg: #eee8d5; --fg-2: #c9c4b0; --muted: #839496;
  --accent: #cb4b16; --accent-fg: #fdf6e3; --accent-soft: rgba(203, 75, 22, 0.18);
  --ok: #859900; --ok-fg: #002b36; --easy: #2aa198; --medium: #b58900; --hard: #dc322f; --link: #268bd2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --habit: #a59bf0;
  --habit-active: #c3bcff;
  --heat-0: #0b3f4c; --heat-1: #4d4a1a; --heat-2: #7a6a0e; --heat-3: #a87e05; --heat-4: #cb4b16;
  color-scheme: dark;
}
[data-theme="gruvbox"] {
  --select: rgba(254, 128, 25, 0.30); /* text selected with the mouse (::selection) */
  --bg: #1d2021; --surface: #282828; --surface-2: #32302f; --surface-3: #3c3836;
  --border: #3c3836; --border-strong: #504945; --fg: #ebdbb2; --fg-2: #d5c4a1; --muted: #a89984;
  --accent: #fe8019; --accent-fg: #1d2021; --accent-soft: rgba(254, 128, 25, 0.16);
  --ok: #b8bb26; --ok-fg: #1d2021; --easy: #8ec07c; --medium: #fabd2f; --hard: #fb4934; --link: #83a598;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --habit: #d3869b;
  --habit-active: #e9a7b8;
  --heat-0: #32302f; --heat-1: #5f4a1c; --heat-2: #8a5d17; --heat-3: #c26b14; --heat-4: #fe8019;
  color-scheme: dark;
}

/* Catppuccin (catppuccin.com/palette): latte is light, the others dark. The --syn-* tokens colour
   code (the editor and highlighted solutions) as Catppuccin's own editor themes do. */
[data-theme="catppuccin-latte"] {
  --select: rgba(124, 127, 147, 0.40); /* text selected with the mouse (::selection) */
  --bg: #e6e9ef; --surface: #eff1f5; --surface-2: #e6e9ef; --surface-3: #dce0e8;
  --border: #ccd0da; --border-strong: #bcc0cc; --fg: #4c4f69; --fg-2: #5c5f77; --muted: #6c6f85;
  --accent: #8839ef; --accent-fg: #eff1f5; --accent-soft: rgba(136, 57, 239, 0.14);
  --ok: #40a02b; --ok-fg: #eff1f5; --easy: #179299; --medium: #df8e1d; --hard: #d20f39; --link: #1e66f5;
  --shadow: 0 1px 2px rgba(76, 79, 105, 0.08), 0 2px 8px rgba(76, 79, 105, 0.05);
  --habit: #ea76cb;
  --habit-active: #c94fb0;
  --heat-0: #dce0e8; --heat-1: #c3aeea; --heat-2: #b28cec; --heat-3: #9d63ed; --heat-4: #8839ef;
  --syn-keyword: #8839ef; --syn-type: #df8e1d; --syn-string: #40a02b; --syn-number: #fe640b;
  --syn-func: #1e66f5; --syn-comment: #8c8fa1; --syn-op: #04a5e5;
  --caret: #dc8a78;
  color-scheme: light;
}
[data-theme="catppuccin-frappe"] {
  --select: rgba(148, 156, 187, 0.45); /* text selected with the mouse (::selection) */
  --bg: #232634; --surface: #303446; --surface-2: #292c3c; --surface-3: #414559;
  --border: #414559; --border-strong: #51576d; --fg: #c6d0f5; --fg-2: #b5bfe2; --muted: #838ba7;
  --accent: #ca9ee6; --accent-fg: #303446; --accent-soft: rgba(202, 158, 230, 0.18);
  --ok: #a6d189; --ok-fg: #303446; --easy: #81c8be; --medium: #e5c890; --hard: #e78284; --link: #8caaee;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --habit: #f4b8e4;
  --habit-active: #eebebe;
  --heat-0: #414559; --heat-1: #6a6083; --heat-2: #8672a0; --heat-3: #a888c3; --heat-4: #ca9ee6;
  --syn-keyword: #ca9ee6; --syn-type: #e5c890; --syn-string: #a6d189; --syn-number: #ef9f76;
  --syn-func: #8caaee; --syn-comment: #949cbb; --syn-op: #99d1db;
  --caret: #f2d5cf;
  color-scheme: dark;
}
[data-theme="catppuccin-macchiato"] {
  --select: rgba(147, 154, 183, 0.45); /* text selected with the mouse (::selection) */
  --bg: #181926; --surface: #24273a; --surface-2: #1e2030; --surface-3: #363a4f;
  --border: #363a4f; --border-strong: #494d64; --fg: #cad3f5; --fg-2: #b8c0e0; --muted: #8087a2;
  --accent: #c6a0f6; --accent-fg: #24273a; --accent-soft: rgba(198, 160, 246, 0.18);
  --ok: #a6da95; --ok-fg: #24273a; --easy: #8bd5ca; --medium: #eed49f; --hard: #ed8796; --link: #8aadf4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --habit: #f5bde6;
  --habit-active: #f0c6c6;
  --heat-0: #363a4f; --heat-1: #615981; --heat-2: #7e6da2; --heat-3: #a286cc; --heat-4: #c6a0f6;
  --syn-keyword: #c6a0f6; --syn-type: #eed49f; --syn-string: #a6da95; --syn-number: #f5a97f;
  --syn-func: #8aadf4; --syn-comment: #939ab7; --syn-op: #91d7e3;
  --caret: #f4dbd6;
  color-scheme: dark;
}
[data-theme="catppuccin-mocha"] {
  --select: rgba(147, 153, 178, 0.45); /* text selected with the mouse (::selection) */
  --bg: #11111b; --surface: #1e1e2e; --surface-2: #181825; --surface-3: #313244;
  --border: #313244; --border-strong: #45475a; --fg: #cdd6f4; --fg-2: #bac2de; --muted: #7f849c;
  --accent: #cba6f7; --accent-fg: #1e1e2e; --accent-soft: rgba(203, 166, 247, 0.18);
  --ok: #a6e3a1; --ok-fg: #1e1e2e; --easy: #94e2d5; --medium: #f9e2af; --hard: #f38ba8; --link: #89b4fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --habit: #f5c2e7;
  --habit-active: #f2cdcd;
  --heat-0: #313244; --heat-1: #5f557a; --heat-2: #7e6c9e; --heat-3: #a489ca; --heat-4: #cba6f7;
  --syn-keyword: #cba6f7; --syn-type: #f9e2af; --syn-string: #a6e3a1; --syn-number: #fab387;
  --syn-func: #89b4fa; --syn-comment: #9399b2; --syn-op: #89dceb;
  --caret: #f5e0dc;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.6 var(--font); background: var(--bg); color: var(--fg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--fg); }
h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 1.6em 0 0.6em; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.4em 0 0.5em; }
h4 { font-size: 0.75rem; font-weight: 600; margin: 0.6em 0 0.25em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--mono); }
code, pre, kbd, .mono { font-family: var(--mono); }
code { font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--border); padding: 0.05em 0.35em; border-radius: 4px; }
pre { font-size: 0.85em; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75em 0.9em; overflow-x: auto; margin: 0.4em 0 0.9em; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
kbd { font-size: 0.75em; background: var(--surface-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.35em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
::selection { background: var(--select); }

/* ---------- forms & buttons ---------- */
input, select, textarea, button { font: inherit; color: var(--fg); }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="date"], input[type="url"], input:not([type]), select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.42em 0.7em; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { accent-color: var(--accent); }
.btn, button {
  display: inline-flex; align-items: center; gap: 0.4em; cursor: pointer; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.4em 0.95em; font-weight: 500; line-height: 1.4; color: var(--fg); text-decoration: none;
  transition: background 0.12s, border-color 0.12s, filter 0.12s;
}
.btn:hover, button:hover { background: var(--surface-3); text-decoration: none; }
.btn-primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn-primary:hover, button.primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ok, button.ok { background: var(--ok); border-color: var(--ok); color: var(--ok-fg); font-weight: 600; }
.btn-ok:hover, button.ok:hover { background: var(--ok); filter: brightness(1.08); }
.btn-ghost, button.link { background: none; border-color: transparent; color: var(--link); padding: 0.2em 0.35em; font-weight: 500; }
.btn-ghost:hover, button.link:hover { background: var(--surface-2); }
button.link.danger { color: var(--hard); background: none; border-color: transparent; font-weight: 500; }
button.link.danger:hover { background: var(--surface-2); filter: none; }
button:disabled { opacity: 0.55; cursor: progress; }
.btn kbd { margin-left: 0.2em; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  display: flex; align-items: center; gap: 1.6em;
  /* The logo lines up with the page's content column (main); the controls sit at the right edge.
     Wide pages (solving a problem) use the whole width: the logo goes to the left edge. */
  padding: 0 1.2em 0 max(1.2em, calc((100% - 1120px) / 2 + 1.4em));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-family: var(--mono); font-weight: 600; font-size: 1.05rem; color: var(--fg); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand .bracket { color: var(--accent); }
/* The beta mark (config [brand]): yellow, darker ink on light themes so it reads on white. */
:root, [data-theme="light"], [data-theme="catppuccin-latte"] { --beta-bg: #ffe066; --beta-ink: #4a3600; --beta-text: #7a5a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --beta-bg: #ffd23f; --beta-ink: #1a1a1a; --beta-text: #ffd23f; } }
[data-theme="dark"], [data-theme="solarized"], [data-theme="gruvbox"], [data-theme="catppuccin-frappe"],
[data-theme="catppuccin-macchiato"], [data-theme="catppuccin-mocha"] { --beta-bg: #ffd23f; --beta-ink: #1a1a1a; --beta-text: #ffd23f; }
.brand .beta-word { background: var(--beta-bg); color: var(--beta-ink); padding: 0 3px; border-radius: 3px; }
/* A set width, so the nav beside it never moves as the jokes come and go (long ones end in "…").
   Phones have no nav up here: there it takes what's free. */
.brand-jokes { display: flex; flex-direction: column; gap: 1px; flex: none; width: 15.5rem; line-height: 1.1; }
@media (max-width: 760px) { .brand-jokes { flex: 0 1 15.5rem; width: auto; min-width: 0; } }
.brand-joke {
  display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 500 0.66rem var(--mono); letter-spacing: 0; color: var(--beta-text);
}
.brand-joke-text.in { animation: joke-in 0.35s ease; }
@keyframes joke-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .brand-joke-text.in { animation: none; } }
.site-nav { display: flex; gap: 0.2em; flex: 1; }
.site-nav a { color: var(--muted); padding: 0.35em 0.75em; border-radius: var(--radius-sm); font-weight: 500; font-size: 0.93rem; }
.site-nav a:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--fg); }
/* The Habit tab: its own color and two small twinkling stars, to invite a click. */
.site-nav a.nav-habit, .site-nav a.nav-habit[aria-current="page"] { color: var(--habit); }
.site-nav a.nav-habit[aria-current="page"] { color: var(--habit-active); font-weight: 700; }
.site-nav a.nav-habit:hover { background: color-mix(in srgb, var(--habit) 12%, transparent); }
.nav-habit .stars { display: inline-flex; flex-direction: column; margin-left: 0.15em; font-size: 0.78em; line-height: 0.8; vertical-align: 0.3em; }
.nav-habit .stars i { font-style: normal; animation: twinkle 2.8s ease-in-out infinite; }
.nav-habit .stars i + i { margin-left: 0.6em; font-size: 0.7em; animation-delay: 1.4s; }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.75); } }
@media (prefers-reduced-motion: reduce) { .nav-habit .stars i { animation: none; } }
.calm .nav-habit .stars i { animation: none; } /* still while solving a problem */
.header-right { display: flex; align-items: center; gap: 0.7em; }
/* Theme picker: a button with a thumbnail of the page, and a menu of preview cards. */
.theme-picker { position: relative; display: flex; }
.theme-btn { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.3em 0.6em; font: 500 0.82rem var(--font); color: var(--fg-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.theme-btn:hover, .theme-btn[aria-expanded="true"] { border-color: var(--border-strong); color: var(--fg); }
.theme-btn .chev { color: var(--muted); font-size: 0.7em; }
.theme-thumb { display: inline-flex; flex-direction: column; width: 22px; height: 16px; border-radius: 3px; overflow: hidden; background: var(--bg); border: 1px solid var(--border-strong); }
.theme-thumb .bar { height: 5px; flex: none; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 2px; }
.theme-thumb .bar b { width: 6px; height: 2px; border-radius: 1px; background: var(--accent); }
.theme-thumb .ln { display: flex; gap: 2px; padding: 3px 3px 0; }
.theme-thumb .ln i { height: 2px; width: 6px; border-radius: 1px; }
.theme-name { display: none; }
:root:not([data-theme]) .theme-name[data-for=""], [data-theme="light"] .theme-name[data-for="light"],
[data-theme="dark"] .theme-name[data-for="dark"], [data-theme="solarized"] .theme-name[data-for="solarized"],
[data-theme="gruvbox"] .theme-name[data-for="gruvbox"], [data-theme="catppuccin-latte"] .theme-name[data-for="catppuccin-latte"],
[data-theme="catppuccin-frappe"] .theme-name[data-for="catppuccin-frappe"],
[data-theme="catppuccin-macchiato"] .theme-name[data-for="catppuccin-macchiato"],
[data-theme="catppuccin-mocha"] .theme-name[data-for="catppuccin-mocha"] { display: inline; }
.theme-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: min(30em, calc(100vw - 1.6em)); padding: 0.6em 0.8em 0.8em; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28); }
.theme-menu[hidden] { display: none; }
.theme-group { padding: 0.5em 0 0.3em; color: var(--muted); font: 0.72rem var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6em; margin-bottom: 0.4em; }
.theme-grid.four { grid-template-columns: repeat(4, 1fr); }
.theme-card { display: block; padding: 3px; text-align: left; background: none; border: 2px solid transparent; border-radius: var(--radius-sm); cursor: pointer; font: inherit; color: inherit; }
.theme-card:hover, .theme-card:focus-visible { border-color: var(--border-strong); outline: none; }
.theme-card[aria-checked="true"] { border-color: var(--accent); }
.theme-prevs { display: block; position: relative; }
.theme-half { position: absolute; inset: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.theme-prev { display: block; height: 58px; border-radius: 4px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.theme-prev .bar { height: 11px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 3px; padding: 0 4px; }
.theme-prev .bar b { width: 12px; height: 3px; border-radius: 2px; background: var(--accent); }
.theme-prev .bar u { width: 9px; height: 3px; border-radius: 2px; background: var(--muted); opacity: 0.6; }
.theme-prev .code { display: grid; gap: 3px; margin: 5px; padding: 4px 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; }
.theme-prev .code > span { display: flex; gap: 3px; }
.theme-prev i { display: block; height: 3px; border-radius: 2px; }
.theme-thumb .kw, .theme-prev .kw { background: var(--syn-keyword, var(--link)); }
.theme-thumb .str, .theme-prev .str { background: var(--syn-string, var(--easy)); }
.theme-prev .id { background: var(--fg-2); }
.theme-prev .fn { background: var(--syn-func, var(--accent)); }
.theme-prev .num { background: var(--syn-number, var(--hard)); }
.theme-prev .cm { background: var(--muted); }
.theme-card-name { display: flex; justify-content: space-between; padding: 0.3em 0.1em 0; font-size: 0.78rem; color: var(--fg-2); }
.theme-card[aria-checked="true"] .theme-card-name { color: var(--fg); font-weight: 600; }
.theme-card[aria-checked="true"] .theme-card-name::after { content: "✓"; color: var(--accent); }
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5em; padding: 0.2em 0.4em; border-radius: var(--radius-sm); }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--surface-2); }
.avatar { border-radius: 50%; display: inline-block; vertical-align: middle; flex: none; background: var(--surface-2); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 12em; padding: 0.35em;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 0.45em 0.7em; border: 0; border-radius: var(--radius-sm); background: none; color: var(--fg); font-weight: 400; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .menu-legal { padding: 0.5em 0.7em 0.2em; margin-top: 0.3em; border-top: 1px solid var(--border); color: var(--muted); }
.menu .menu-legal a { display: inline; width: auto; padding: 0; color: var(--muted); }
.menu .menu-legal a:hover { background: none; text-decoration: underline; }
.site-footer a { color: inherit; }
/* The privacy and terms pages. */
.legal { max-width: 46em; }
.legal h2 { font-size: 1.1rem; margin: 1.4em 0 0.4em; }
.legal ul { padding-left: 1.2em; line-height: 1.55; }
.legal li + li { margin-top: 0.45em; }
.legal p { line-height: 1.6; }
.menu a, .menu button { display: flex; align-items: center; gap: 0.6em; white-space: nowrap; }
.menu .menu-phone { display: none; } /* (phones show it: below) */
.menu-icon { flex: none; color: var(--muted); }
.menu a:hover .menu-icon, .menu button:hover .menu-icon { color: var(--fg); }
.menu .menu-head { padding: 0.45em 0.7em; color: var(--muted); font: 0.8rem var(--mono); border-bottom: 1px solid var(--border); margin-bottom: 0.3em; }
.menu form { margin: 0; }

/* ---------- layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 1.8em 1.4em 3em; }
main.wide { max-width: none; padding: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1em; margin-bottom: 1.2em; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.sub-head-side { display: flex; align-items: center; gap: 0.6em 0.9em; flex-wrap: wrap; }
.sub-head-side .sc-share { margin-left: 0; }
.eyebrow { font: 0.78rem var(--mono); color: var(--muted); letter-spacing: 0.04em; margin-bottom: 0.3em; }
.eyebrow .prompt { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.1em 1.3em; }
.card-head { padding: 0.8em 1.3em; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.card-head h2 { margin: 0; font-size: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2em; }
.stack { display: flex; flex-direction: column; gap: 1.2em; }
.callout { border: 1px solid var(--border); background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 0.75em 1em; margin-bottom: 1em; }
.callout.error { border-left-color: var(--hard); }
.callout.ok { border-left-color: var(--easy); }
.callout.warn { border-left-color: var(--medium); }
.notice { margin-bottom: 1em; }

/* ---------- pills, tags, badges ---------- */
.pill { display: inline-block; font: 600 0.75rem var(--font); padding: 0.15em 0.7em; border-radius: 999px; text-transform: capitalize; }
.pill.easy { color: var(--easy); background: color-mix(in srgb, var(--easy) 14%, transparent); }
.pill.medium { color: var(--medium); background: color-mix(in srgb, var(--medium) 16%, transparent); }
.pill.hard { color: var(--hard); background: color-mix(in srgb, var(--hard) 14%, transparent); }
.easy { color: var(--easy); } .medium { color: var(--medium); } .hard { color: var(--hard); }
.tag { display: inline-block; font: 0.75rem var(--mono); color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 0.45em; margin: 0 0.25em 0.25em 0; }
.badge { font: 0.7rem var(--mono); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 0.4em; color: var(--muted); margin-left: 0.4em; vertical-align: 1px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.card:has(> .table), .card-body:has(> .table) { overflow-x: auto; } /* a table too wide for its card scrolls in it */
main:has(.table.accounts) { max-width: 1340px; } /* Admin → Accounts: every column without scrolling */
.table th { text-align: left; font: 600 0.72rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 0.7em 1em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th a { color: inherit; }
.table th a.sorted { color: var(--fg); }
.table td { padding: 0.65em 1em; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.status { width: 2.5em; text-align: center; }
.table td.id { color: var(--muted); font-family: var(--mono); width: 3.5em; }
.table td.title a { color: var(--fg); font-weight: 500; }
.table td.title a:hover { color: var(--accent); text-decoration: none; }
.check { color: var(--easy); font-weight: 700; }
.dot { color: var(--medium); }
.empty-row td { text-align: center; color: var(--muted); padding: 2em; }

/* ---------- problem list toolbar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.6em; padding: 0.9em 1em; border-bottom: 1px solid var(--border); align-items: center; }
.filters input[type="search"] { flex: 1; min-width: 14em; }
.progress-summary { display: flex; gap: 1.2em; align-items: center; font: 0.85rem var(--mono); color: var(--muted); }
.progress-summary strong { color: var(--fg); font-weight: 600; }

/* ---------- stats ---------- */
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
.bar.easy > span { background: var(--easy); } .bar.medium > span { background: var(--medium); } .bar.hard > span { background: var(--hard); }
.diff-stats { display: flex; flex-direction: column; gap: 0.9em; }
.diff-stat .label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.3em; }
.ring { display: flex; align-items: center; gap: 1.3em; }
.ring svg { flex: none; }
.ring .big { font: 600 2rem var(--mono); line-height: 1; }
.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8em; }
.stat-tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7em 0.9em; }
.stat-tile .v { font: 600 1.4rem var(--mono); }
.stat-tile .k { font-size: 0.78rem; color: var(--muted); }
.heatmap { overflow-x: auto; }
.heatmap svg rect { rx: 2; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--muted); justify-content: flex-end; margin-top: 0.4em; }
.heat-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.profile-head { display: flex; align-items: center; gap: 1em; margin-bottom: 0.8em; }

.profile-tabs { display: flex; gap: 0.2em; border-bottom: 1px solid var(--border); margin-bottom: 1.2em; }
.profile-tabs .tab { font-size: 0.95rem; text-decoration: none; margin-bottom: -1px; }

/* ---------- habit ---------- */
.stat-tile .v.surplus, td.surplus { color: var(--easy); }
.stat-tile .v.debt, td.debt { color: var(--hard); }
.habit-cal { display: inline-grid; grid-template-columns: max-content repeat(7, 2.6em); gap: 4px; align-items: center; max-width: 100%; }
.hd-head { font-size: 0.75rem; color: var(--muted); text-align: center; }
.hd-week { font-size: 0.72rem; color: var(--muted); padding-right: 0.6em; white-space: nowrap; }
.hd { height: 2.2em; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font: 0.75rem var(--mono); color: var(--fg-2); background: var(--surface-2); }
.hd.empty { background: none; }
.hd.off { background: var(--heat-0); color: var(--muted); }
.hd.met { background: color-mix(in srgb, var(--easy) 35%, transparent); }
.hd.extra { background: var(--easy); color: var(--accent-fg); font-weight: 600; }
.hd.missed { background: color-mix(in srgb, var(--hard) 30%, transparent); }
.hd.today { box-shadow: inset 0 0 0 2px var(--accent); }
.habit-legend { display: flex; flex-wrap: wrap; gap: 1em; margin-top: 0.9em; }
.habit-legend span { display: inline-flex; align-items: center; gap: 0.4em; }
.habit-legend i.hd { display: inline-block; width: 0.9em; height: 0.9em; }
.habit-form fieldset { border: 0; padding: 0; margin: 0 0 1em; }
.habit-form legend { font-weight: 600; margin-bottom: 0.5em; }
.day-picks { display: flex; flex-wrap: wrap; gap: 0.4em; }
.day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick span { display: inline-block; min-width: 3em; text-align: center; padding: 0.35em 0.6em; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-size: 0.85rem; }
.day-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.day-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.quota-picks { display: flex; flex-wrap: wrap; gap: 1em; }
.quota-picks label { display: flex; align-items: center; gap: 0.5em; font-size: 0.9rem; }
.quota-picks input { width: 4.5em; }
.habit-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1em; margin-top: 1.2em; padding-top: 1em; border-top: 1px solid var(--border); }
.habit-reset { display: flex; align-items: center; gap: 0.6em; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 1em; padding: 0.55em 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.rank { font: 600 0.9rem var(--mono); color: var(--muted); width: 2.5em; }
.rank.top { color: var(--accent); }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: calc(100vh - var(--header-h) - 5em); display: grid; place-items: center; }
.auth-card { width: min(26em, 100%); }
.auth-card .card-body { padding: 1.8em 2em; }
.auth-card h1 { font-size: 1.35rem; }
.auth-logo { font: 600 1.6rem var(--mono); text-align: center; margin-bottom: 0.2em; }
.auth-logo .bracket { color: var(--accent); }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 1.4em; font-size: 0.92rem; }
.auth-stack { width: min(26em, 100%); }
.auth-stack .auth-card { width: 100%; }
.btn-github { display: flex; align-items: center; justify-content: center; gap: 0.55em; width: 100%;
  background: #24292f; border-color: #24292f; color: #fff; font-weight: 600; padding-block: 0.6em; }
.btn-github:hover { background: #32383f; color: #fff; text-decoration: none; }
.auth-card form .btn-github { width: auto; display: inline-flex; }
.auth-note { text-align: center; margin: 0.6em 0 0; }
.join-card { text-align: center; }
.join-card h1 { font-size: 1.3rem; margin: 0.5em 0; }
.join-avatar { display: flex; justify-content: center; }
.auth-card .vs-invite input { flex: 1; width: auto; min-width: 0; }
.invite-joined { list-style: none; padding: 0; margin: 0.5em 0 0; }
.invite-joined li { display: flex; justify-content: space-between; align-items: center; padding: 0.35em 0; border-top: 1px solid var(--border); }
.auth-or { display: flex; align-items: center; gap: 0.8em; margin: 1.3em 0 1em; color: var(--muted); font-size: 0.82rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
form.stack { gap: 0.9em; }
form.stack label { display: flex; flex-direction: column; gap: 0.3em; font-size: 0.85rem; font-weight: 500; color: var(--fg-2); }
form.stack input { font-size: 0.95rem; padding: 0.55em 0.8em; }
form.stack button { justify-content: center; padding: 0.6em; margin-top: 0.3em; }
.narrow { max-width: 28em; }
.secret { display: block; font: 600 1.35rem var(--mono); letter-spacing: 0.04em; text-align: center; padding: 0.8em; user-select: all; border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: var(--radius-sm); color: var(--fg); }
.actions { display: flex; flex-wrap: wrap; gap: 0.3em; align-items: center; }
.actions form { margin: 0; }

/* ---------- problem page (solve) ---------- */
.solve {
  --left: 45%; --top: 64%;
  display: grid; grid-template-columns: var(--left) 6px 1fr;
  height: calc(100vh - var(--header-h)); min-height: 30em; background: var(--bg); padding: 8px; gap: 0;
}
.pane { min-width: 0; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.statement-pane { overflow: auto; padding: 1.2em 1.5em 2em; }
.statement-pane .problem-head h1 { font-size: 1.4rem; margin: 0.2em 0 0.4em; }
.problem-head .meta { display: flex; flex-wrap: wrap; gap: 0.6em; align-items: center; margin-bottom: 1em; }
.statement { font-size: 0.95rem; color: var(--fg-2); }
.statement img { max-width: 100%; border-radius: var(--radius-sm); }
.statement h1 { display: none; }
.statement h2 { font-size: 1rem; margin-top: 1.3em; }
.samples { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7em; }
.samples pre { margin: 0; }
/* Hints: small, at the bottom of the description, each behind its own toggle. */
.hints { margin-top: 1.8em; }
.hints-head { display: flex; align-items: center; gap: 0.4em; font-size: 0.85rem; font-weight: 600; margin: 0 0 0.45em; }
.hints-head .muted { font-weight: 400; }
.hint-icon { flex: none; color: var(--accent); }
.hint-card { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.35em; font-size: 0.85rem; }
.hint-card summary { cursor: pointer; padding: 0.3em 0.65em; color: var(--muted); list-style-position: inside; }
.hint-card summary:hover, .hint-card[open] summary { color: var(--fg); }
.hint-card[open] summary { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.hint-body { padding: 0.15em 0.75em; font-size: 0.85rem; }
.hint-body p { margin: 0.45em 0; }
.work-pane { display: grid; grid-template-rows: auto var(--top) 6px 1fr; background: transparent; border: 0; border-radius: 0; overflow: visible; }
.work-pane > .editor-card, .work-pane > .console { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-height: 0; }
.toolbar { display: flex; flex-wrap: wrap; min-width: 0; align-items: center; gap: 0.6em; padding: 0.4em 0.5em; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.toolbar select { padding: 0.25em 0.5em; font-size: 0.88rem; }
.toolbar label { display: flex; gap: 0.35em; align-items: center; font: 0.82rem var(--mono); color: var(--muted); }
.toolbar .spacer { flex: 1; }
.toolbar button { padding: 0.32em 0.9em; font-size: 0.88rem; }
/* One line always, so Run and Submit never wrap under the rest: the suggestions chip and pace note
   shrink first, then the language select; a narrow toolbar drops the scratchpad tab's word (🧪 stays). */
.toolbar { flex-wrap: nowrap; container-type: inline-size; }
.toolbar > :not(.lsp-chip):not(.pace-note):not(.spacer):not(select) { flex-shrink: 0; white-space: nowrap; }
.toolbar > select { flex: 0 1 auto; min-width: 5.5em; }
@container (max-width: 560px) { .toolbar .mode-label { display: none; } }
/* Narrower still (a dragged-in pane, small phones): no suggestions chip, Reset as ↺ (its title says what
   it does), tighter spacing; Run's label (it grows to "▶ Run · 12s") gives way before Submit moves. */
@container (max-width: 480px) {
  .toolbar .lsp-chip { display: none; }
  .toolbar #reset { font-size: 0; padding-inline: 0.5em; }
  .toolbar #reset::before { content: "↺"; font-size: 1rem; }
  .toolbar > select { min-width: 4.5em; }
  .toolbar button#run { flex-shrink: 1; min-width: 2.6em; overflow: hidden; text-overflow: ellipsis; }
  .toolbar button#run, .toolbar button#submit { padding-inline: 0.6em; }
}
.editor-card { display: flex; flex-direction: column; }
.editor { flex: 1; min-height: 0; overflow: hidden; }
/* The size and font come from the editor's settings menu (theme.js sets the variables). */
.editor .cm-editor { height: 100%; font-size: var(--editor-size, 14px); }
.editor .cm-editor .cm-scroller { font-family: var(--editor-font, var(--mono)); }
.editor[hidden] { display: none; }
/* The scratchpad (decision 0024): amber (--medium) everywhere it shows, so it never looks like the solution. */
.editor-modes { flex: none; display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.editor-modes .mode { border: 0; border-radius: 0; padding: 0.28em 0.75em; font-size: 0.84rem; background: none; color: var(--muted); }
.editor-modes .mode + .mode { border-left: 1px solid var(--border-strong); }
.editor-modes .mode:hover { color: var(--fg); background: var(--surface-2); }
.editor-modes .mode.active { background: var(--surface-3, var(--surface-2)); color: var(--fg); font-weight: 600; }
.editor-modes .mode[data-mode="scratch"].active { background: color-mix(in srgb, var(--medium) 22%, transparent); color: var(--fg); }
.editor-card.scratch-mode { border: 2px dashed var(--medium); position: relative; }
.editor-card.scratch-mode::after {
  content: "scratchpad · not your solution"; position: absolute; right: 0.8em; bottom: 0.5em; pointer-events: none;
  font: 600 0.75rem var(--mono); letter-spacing: 0.04em; color: var(--medium); opacity: 0.55;
}
/* The suggestions indicator: a small pill; its text stops at 15em with "…" (all of it on hover). */
.lsp-chip { display: inline-flex; align-items: center; gap: 0.4em; min-width: 0; box-sizing: border-box; padding: 0.15em 0.6em;
  font: 0.7rem/1.5 var(--mono); color: var(--muted); white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.lsp-chip[hidden] { display: none; }
.lsp-chip-text { min-width: 0; max-width: 15em; overflow: hidden; text-overflow: ellipsis; }
/* The chip takes only the room left on the toolbar's line (up to its full text) and ends in "…"
   rather than pushing Run onto a new line; hovering shows all of it. (A zero basis keeps it from
   forcing a wrap; the big grow factor lets it fill before the spacer does.) */
.toolbar .lsp-chip { flex: 1000 1 0; max-width: max-content; }
.toolbar .pace-note { flex: 1000 1 0; max-width: max-content; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* The editor's settings menu (editorsettings.templ): a gear right of the language select. */
.editor-settings { position: relative; flex: none; display: inline-flex; }
.toolbar button.editor-settings-btn { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.toolbar button.editor-settings-btn:hover { color: var(--fg); background: var(--surface-2); }
.editor-settings.open .editor-settings-btn { color: var(--fg); background: var(--accent-soft); border-color: var(--accent); }
.editor-settings-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: 260px; max-width: calc(100vw - 32px);
  box-sizing: border-box; display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 18, 24, 0.16); font: 0.84rem var(--font); color: var(--fg-2); }
.editor-settings-menu[hidden] { display: none; }
.editor-settings-menu .es-title { font-weight: 600; color: var(--fg); }
.editor-settings-menu .es-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 0.84rem var(--font); color: var(--fg-2); }
.editor-settings-menu .es-stepper { display: flex; align-items: center; gap: 4px; }
.toolbar .editor-settings-menu .es-stepper button { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1rem; line-height: 1; }
.toolbar .editor-settings-menu label { font: inherit; color: inherit; } /* (not the toolbar's mono labels) */
.editor-settings-menu .es-stepper button:disabled { opacity: 0.4; cursor: default; }
.editor-settings-menu output { min-width: 3.4em; text-align: center; font: 600 0.84rem var(--mono); color: var(--fg); }
.toolbar .editor-settings-menu select { width: 11em; }
.editor-settings-menu input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.editor-settings-menu .es-note { margin: 0; font-size: 0.76rem; line-height: 1.45; color: var(--muted); }
.lsp-chip::before { content: "●"; flex: none; font-size: 0.8em; color: var(--medium); }
.lsp-chip[data-state="connected"]::before { color: var(--ok); }
.lsp-chip[data-state="unavailable"]::before, .lsp-chip[data-state="idle"]::before { color: var(--muted); }
.toolbar button#run.scratch { background: var(--medium); border-color: var(--medium); color: #1a1a1a; font-weight: 600; }
.toolbar button#run.scratch:hover { filter: brightness(1.06); }
.toolbar button#submit:disabled { opacity: 0.4; cursor: not-allowed; }
.scratch-result .output.scratch-out { margin-top: 0; }
.scratch-result .output.scratch-out:empty::before { content: "(no output)"; color: var(--muted); }
.scratch-result .output.scratch-err { color: var(--muted); border-left: 3px solid var(--border-strong); }
.scratch-status { margin: 0.4em 0 0; font: 0.82rem var(--mono); }
.splitter { border-radius: 3px; }
.splitter.vertical { cursor: col-resize; margin: 0 1px; }
.splitter.horizontal { cursor: row-resize; margin: 1px 0; }
.splitter:hover, .splitter:focus { background: var(--accent); outline: none; }
.console { display: flex; flex-direction: column; }
.console-tabs { display: flex; gap: 0.2em; padding: 0 0.6em; border-bottom: 1px solid var(--border); background: var(--surface-2); }
/* The drawer button (right of the console's tabs): one click opens the results to half the
   code column, or folds them down to their first line; the splitter still drags. */
.work-pane .console-tabs:has(.console-drawer) { cursor: pointer; } /* (the bar toggles the drawer) */
.console-drawer { margin-left: auto; align-self: center; display: inline-flex; padding: 0.25em 0.35em; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); }
.console-drawer:hover { color: var(--fg); background: var(--surface-3); filter: none; }
.console-drawer svg { transition: transform 0.2s; }
.console-drawer[aria-expanded="false"] svg { transform: rotate(180deg); }
.work-pane.drawer-moving { transition: grid-template-rows 0.22s ease; }
@media (prefers-reduced-motion: reduce) { .work-pane.drawer-moving { transition: none; } }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 0.55em 0.8em; font-size: 0.85rem; }
.tab:hover { background: none; color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab-body { flex: 1; overflow: auto; padding: 0.8em 1em; }
.tab-body textarea { width: 100%; height: 100%; min-height: 6em; font: 13px var(--mono); background: var(--bg); resize: none; }

/* ---------- results ---------- */
.verdict { font-weight: 700; }
.verdict.good { color: var(--easy); } .verdict.warn { color: var(--medium); } .verdict.bad { color: var(--hard); }
.verdict-line { display: flex; flex-wrap: wrap; gap: 0.5em; align-items: baseline; margin: 0.1em 0 0.6em; }
.verdict-line .verdict { font-size: 1.2rem; }
.verdict-line .permalink { margin-left: auto; font-size: 0.85em; }
ul.tests { list-style: none; padding: 0; margin: 0.5em 0; display: flex; flex-wrap: wrap; gap: 0.4em; }
ul.tests li { display: flex; gap: 0.45em; align-items: center; font: 0.8rem var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.2em 0.6em; }
pre.output { max-height: 14em; overflow: auto; margin: 0.2em 0 0.6em; }
.failed { display: grid; grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); gap: 0 0.8em; }
.failed .failed-title, .failed .failed-msg, .failed .failed-wide { grid-column: 1 / -1; }
.failed .failed-title { margin: 0.6em 0 0; font-size: 0.85rem; }
ul.tests li.fail-chip, ul.tests li.pass-chip { padding: 0; border: 0; background: none; }
.test-chip { display: flex; gap: 0.45em; align-items: center; font: 0.8rem var(--mono); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.2em 0.6em; cursor: pointer; color: var(--fg); }
.test-chip:hover { border-color: var(--border-strong); background: var(--surface-3); }
.test-chip.active { border-color: var(--hard); box-shadow: 0 0 0 1px var(--hard) inset; }
.result-box { padding: 1em 1.2em; }
pre.code { font-size: 0.85em; }

/* ---------- misc ---------- */
.site-footer { text-align: center; color: var(--muted); font: 0.78rem var(--mono); padding: 2em 0 3em; }
@media (max-width: 900px) {
  .site-header { gap: 0.8em; padding: 0 0.8em; }
  .theme-picker { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .solve { grid-template-columns: 1fr; height: auto; }
  .splitter.vertical { display: none; }
  .work-pane { grid-template-rows: auto 60vh 8px 40vh; margin-top: 8px; }
  .console-drawer { display: none; } /* (fixed rows here: nothing to open or fold) */
  .work-pane .console-tabs:has(.console-drawer) { cursor: auto; }
  .mock-console .console-drawer { display: inline-flex; } /* (a mock room keeps its splitter: the drawer stays) */
  /* ...and its side-by-side panes: the problem page's stacking above isn't for it (hiding this
     splitter dropped the code into the splitter's 6px column). */
  .mock-panes > .splitter.vertical { display: block; }
  .mock-work { margin-top: 0; }
  .mock-work .console-tabs:has(.console-drawer) { cursor: pointer; }
  .table td.tags, .table th.tags { display: none; }
}

/* Themed scrollbars (Firefox + Chromium). */
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
/* No programming ligatures: "->" should look like what you typed. */
code, pre, kbd, .mono, .editor .cm-editor .cm-scroller { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.list-plain .pill, td .pill + .pill { margin-left: 0.5em; }
/* Recent submissions: a submission to a problem already solved (doesn't count toward streaks). */
.repeat-chip { font: 600 0.68rem var(--mono); padding: 0.05em 0.5em; border-radius: 999px; color: var(--muted);
  border: 1px dashed var(--border-strong); cursor: help; white-space: nowrap; }
.recent-subs li > span:first-child { display: flex; flex-wrap: wrap; gap: 0.5em; align-items: baseline; min-width: 0; }
.recent-subs li > span:first-child .pill { margin-left: 0; }
.recent-subs li > span:last-child { white-space: nowrap; }
.table tr.me td { background: var(--accent-soft) !important; }
/* Grid/flex children default to min-width:auto, so a wide <pre> would stretch the page. */
.grid-2 > *, .stack > *, .card-body { min-width: 0; }

/* ---------- hide tags (spoilers) ---------- */
.tag-toggle { font-size: 0.8rem; }
.when-tags-hidden { display: none; }
html.hide-tags .when-tags-shown { display: none; }
html.hide-tags .when-tags-hidden { display: inline; }
html.hide-tags .problem-head .tag, html.hide-tags th.tags, html.hide-tags td.tags { display: none; }

/* ---------- habit widget (problems page) ---------- */
.habit-card { margin-bottom: 1.2em; }
.habit-card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8em 2em; padding: 0.9em 1.2em; }
.habit-card-title { display: flex; flex-direction: column; gap: 0.15em; min-width: 9em; }
.habit-card-title a { color: var(--habit); }
.habit-stats { display: flex; flex-wrap: wrap; gap: 0.6em 2em; }
.habit-stat { display: flex; align-items: baseline; gap: 0.45em; }
.habit-stat .v { font: 600 1.25rem var(--mono); }
.habit-stat .k { font-size: 0.8rem; color: var(--muted); }
.habit-stat .v.surplus, .good-text { color: var(--easy); }
.habit-stat .v.debt { color: var(--hard); }

/* ---------- admin: habit adjustments ---------- */
.surplus-text { color: var(--easy); }
.debt-text { color: var(--hard); }
.admin-habit { white-space: nowrap; }
.adjust-form { display: inline-flex; align-items: center; gap: 0.3em; margin-left: 0.6em; }
.adjust-form input { padding: 0.2em 0.45em; font-size: 0.85em; }
.adjust-form input[name="amount"] { width: 4.2em; }
.adjust-form input[name="note"] { width: 10em; }

/* ---------- habit: streaks, pauses, admin rulings ---------- */
.hd.covered { background: color-mix(in srgb, var(--easy) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--easy) 45%, transparent); }
.hd.excused { background: repeating-linear-gradient(135deg, var(--surface-2) 0 4px, var(--surface-3) 4px 8px); color: var(--muted); }
.hd.credited { background: color-mix(in srgb, var(--habit) 30%, transparent); }
.habit-pause { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6em; margin-bottom: 0.9em; padding: 0.55em 0.8em; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--medium) 12%, transparent); color: var(--fg-2); }
.streak-tile .v { color: var(--habit); }
.streak-cell { cursor: help; }
.paused-mark { margin-left: 0.35em; opacity: 0.85; }
/* A pause symbol drawn in CSS (the ⏸ glyph is missing from many fonts). */
.pause-icon { display: inline-block; width: 0.7em; height: 0.75em; vertical-align: -0.05em;
  background: linear-gradient(to right, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%); }
.streak-tile .v .unit { font-size: 0.8rem; margin-left: 0.3em; color: var(--muted); }
th .sorted { color: var(--fg); }
th a { color: inherit; text-decoration: underline dotted; }
.pill.ruling { text-transform: none; margin: 0 0.4em; }
.pill.ruling.excuse { color: var(--muted); background: var(--surface-3); }
.pill.ruling.credit { color: var(--habit); background: color-mix(in srgb, var(--habit) 14%, transparent); }
.inline-form { display: inline; margin-left: 0.5em; }
.admin-tools .tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; }
.admin-tools .tool-row strong { min-width: 5em; }
.admin-tools input[type="date"], .admin-tools input[type="text"] { padding: 0.3em 0.5em; }
.admin-tools input[name="amount"] { width: 4.5em; }
.admin-tools input[name="note"] { width: 14em; }
.pause-log li > span:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4em; }
.pause-log .mono { font-size: 0.85em; }
.hint { text-decoration: underline dotted; text-underline-offset: 0.2em; cursor: help; }

/* Problem reports */
.report-row { margin-top: 2.5em; padding-top: 0.8em; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 0.5em 1em; }
.editor-note { font-size: 0.75rem; color: var(--muted); }
.editor-note code { font-size: 0.95em; }
.report-link { display: inline-flex; align-items: center; gap: 0.35em; background: none; border: 0; padding: 0;
  font-size: 0.75rem; color: var(--muted); text-decoration: none; cursor: pointer; }
.report-link:hover { background: none; color: var(--hard); }
.warn-icon { flex: none; }
.report-dialog { width: min(32em, calc(100vw - 2em)); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--fg); padding: 1.3em 1.4em; }
.report-dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.report-dialog h2 { margin: 0; font-size: 1.1rem; }
.report-dialog p { margin: 0; }
.report-dialog textarea { resize: vertical; }
.report-dialog label.small { flex-direction: row; align-items: center; gap: 0.5em; font-weight: 400; }
.report-buttons { display: flex; justify-content: flex-end; gap: 0.5em; }
.report-dialog form.stack .report-buttons button { margin-top: 0; padding: 0.5em 1em; }
.report-thanks { display: flex; flex-direction: column; gap: 0.9em; align-items: flex-start; }
.reports-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em; margin-bottom: 1em; }
.reports-filter .small { margin-left: auto; }
.reports-sep { width: 1px; align-self: stretch; margin: 0 0.3em; background: var(--border); }
.pill-link { padding: 0.25em 0.8em; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; text-decoration: none; color: var(--fg-2); }
.pill-link.active { border-color: var(--accent); color: var(--fg); background: var(--accent-soft); }
.count-badge { display: inline-block; min-width: 1.5em; margin-left: 0.3em; padding: 0 0.4em; border-radius: 999px;
  background: var(--hard); color: #fff; font-size: 0.72rem; font-weight: 600; text-align: center; }
.report { margin-bottom: 1em; }
.report .card-head h2 { display: flex; gap: 0.5em; align-items: baseline; }
.report-status.open { color: var(--medium); }
.report-status.resolved { color: var(--easy); }
.report-meta { margin-bottom: 0.6em; }
.report-message { white-space: pre-wrap; margin: 0 0 0.8em; }
.report-code pre { max-height: 24em; overflow: auto; }
.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6em 1.2em; }
.report-actions .inline-form { display: inline-flex; align-items: center; gap: 0.4em; margin: 0; }
.report-actions input { padding: 0.3em 0.6em; font-size: 0.85rem; }
.report-actions input[type="url"] { width: 18em; max-width: 60vw; }

/* Profile: habit streak tile and habit days on the activity heatmap */
.stat-tile.habit-tile .v { color: var(--habit); }
.stat-tile.habit-tile.none .v { color: var(--muted); }
.stat-tile[title] { cursor: help; }
.heatmap circle.habit-day.met { stroke: var(--habit-active); stroke-width: 0.6; }
.legend-habit { margin-left: 1.2em; display: inline-flex; align-items: center; gap: 0.35em; }
.heat-legend i.dot { border-radius: 50%; background: var(--heat-0); }
.heat-legend i.dot.met { background: var(--habit); }

/* Problem page: Description | Solution tabs, and highlighted solutions.
   Token colours come from the theme palette (chroma's class names). */
.stmt-tabs { display: flex; gap: 0.2em; border-bottom: 1px solid var(--border); margin: 0.6em 0 1em; }
/* The tabs stay at the top of the pane as it scrolls (a long Coach session, a solution), edge to
   edge like the Coach's input at the bottom (ai.css); top: -1.2em is the pane's padding. */
.statement-pane > .stmt-tabs { position: sticky; top: -1.2em; z-index: 3; background: var(--surface); margin: 0.6em -1.5em 1em; padding: 0 1.5em; }
.stmt-tabs .tab { margin-bottom: -1px; }
.sol-gate { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 1em 1.2em; margin-bottom: 1em; }
.sol-gate p { margin: 0 0 0.8em; color: var(--fg-2); }
.sol-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin: 1.2em 0 0.6em; }
.sol-toolbar h3 { margin: 0; }
.sol-toolbar select { width: auto; padding: 0.3em 0.6em; font-size: 0.85rem; }
.sol-file + .sol-file { margin-top: 1em; }
.sol-name { margin-bottom: 0.3em; }
.sol-file pre.chroma { margin: 0; padding: 0.8em 1em; overflow: auto; font: 13px/1.5 var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sol-file > pre.chroma .ln, .ai-side-by-side > div > pre.chroma .ln { display: inline-block; min-width: 2em; margin-right: 1em; text-align: right; color: var(--muted); opacity: 0.75; user-select: none; -webkit-user-select: none; }
.chroma .k, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr, .chroma .kc, .chroma .ow { color: var(--syn-keyword, var(--link)); }
.chroma .kt, .chroma .nc, .chroma .nn { color: var(--syn-type, var(--medium)); }
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sb, .chroma .sc, .chroma .sa, .chroma .se, .chroma .si, .chroma .sd, .chroma .sh, .chroma .sr, .chroma .ss, .chroma .dl { color: var(--syn-string, var(--easy)); }
.chroma .m, .chroma .mi, .chroma .mf, .chroma .mh, .chroma .mo, .chroma .mb, .chroma .il { color: var(--syn-number, var(--hard)); }
.chroma .c, .chroma .c1, .chroma .cm, .chroma .cs, .chroma .ch, .chroma .cpf { color: var(--syn-comment, var(--muted)); font-style: italic; }
.chroma .cp { color: var(--syn-comment, var(--muted)); }
.chroma .nf, .chroma .fm, .chroma .nb, .chroma .bp { color: var(--syn-func, var(--accent)); }

/* The drawing pad (decision 0052): the Draw tab fills the rest of the statement pane, edge to edge
   (static/drawpad.js adds .drawing); the mock room's Draw view fills its doc pane. Excalidraw
   brings its own stylesheet (static/draw/draw.css) when it first opens. */
.stmt-tabs .draw-tab, .editor-modes .mode[data-doc="draw"] { display: inline-flex; align-items: center; gap: 0.35em; }
.draw-icon { flex: none; }
.statement-pane.drawing { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.statement-pane.drawing > * { flex-shrink: 0; }
.statement-pane.drawing > .draw-pane { flex: 1 1 0; min-height: 0; margin: -1em -1.5em 0; }
.draw-host { position: relative; height: 100%; }
.draw-canvas { position: absolute; inset: 0; }
.draw-note { display: none; position: absolute; top: 1em; left: 1.5em; right: 1.5em; margin: 0; }
.draw-host.draw-loading .draw-wait, .draw-host.draw-failed .draw-err { display: block; }
.draw-canvas .sidebar-trigger__label-element:has(.default-sidebar-trigger), .draw-canvas .default-sidebar-trigger { display: none !important; } /* no shape library (its "Browse libraries" leaves the site) */
/* People on a shared pad (the mock room's Draw button): "2 👤". */
.draw-here { display: inline-flex; align-items: center; gap: 0.15em; margin-left: 0.15em; padding: 0 0.45em 0 0.4em; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font: 600 0.72rem/1.5 var(--mono); }
.draw-here svg { width: 0.8em; height: 0.8em; fill: currentColor; }

/* Solution lockout (Preferences) */
.lock-icon { flex: none; vertical-align: -1px; }
.stmt-tabs .tab.locked { color: var(--muted); opacity: 0.65; cursor: help; display: inline-flex; align-items: center; gap: 0.35em; }
.sol-locked { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 1em 1.2em; margin-bottom: 1em; }
.sol-locked h3 { margin: 0 0 0.5em; display: flex; align-items: center; gap: 0.4em; color: var(--fg-2); }
.sol-locked p { margin: 0 0 0.6em; color: var(--fg-2); }
.sol-locked p:last-child { margin-bottom: 0; }
.prefs-wrap { max-width: 44em; margin: 0 auto; }
.prefs-wrap .card-head h2 { display: flex; align-items: center; gap: 0.45em; }
.prefs-wrap ul { padding-left: 1.2em; }
.prefs-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6em; margin: 1em 0 0.5em; }
.prefs-form label { font-weight: 500; }
.prefs-form input[type="number"] { width: 7em; }
/* Settings most people never need: closed until clicked. */
.prefs-advanced { flex-basis: 100%; }
.prefs-advanced > summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; width: max-content; }
.prefs-advanced[open] > summary { margin-bottom: 0.5em; }
/* Where each language's suggestions run: each device shows its own table (as pyright.js's
   handheld() decides; the other's selects stay in the form, hidden, so saving keeps them). */
.lsp-where { border-collapse: collapse; margin: 0.4em 0 0.6em; }
.lsp-where caption { text-align: left; font-weight: 600; font-size: 0.9rem; padding-bottom: 0.3em; }
.lsp-where th { text-align: left; font-weight: 500; padding: 0.2em 1em 0.2em 0; min-width: 4em; }
.lsp-where td { padding: 0.2em 0; }
.lsp-where-notes { margin: 0.4em 0 0; padding-left: 1.2em; }
.lsp-where-notes li { margin-bottom: 0.3em; }
.lsp-where-phone { display: none; }
@media (pointer: coarse) and (hover: none) {
  .lsp-where-phone { display: table; }
  .lsp-where-computer { display: none; }
}

.prefs-state { font-size: 0.85rem; color: var(--muted); }
.prefs-state.on { color: var(--accent); font-weight: 600; }
.prefs-foot { margin-top: 1em; }
.hold-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em 0.9em; margin: 0.9em 0 0.7em; }
.hold-unlock { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.hold-unlock .hold-label { position: relative; }
.hold-unlock .hold-fill { position: absolute; inset: 0; width: 0; background: var(--accent-soft); transition: width 0.15s ease-out; }
.hold-unlock.holding .hold-fill { width: 100%; border-right: 2px solid var(--accent); transition: width 3s linear; }
.hold-unlock:disabled .hold-fill { width: 100%; }
.sol-early { display: flex; align-items: center; gap: 0.4em; margin: 0 0 0.8em; }
.prefs-wrap .card-body > p:first-child, .prefs-wrap .card-body > h3:first-child { margin-top: 0; }
.prefs-wrap h3 { font-size: 1rem; margin-bottom: 0.4em; }
.vim-maps { width: 100%; box-sizing: border-box; font: 13px var(--mono); resize: vertical; }
.sol-tip { display: flex; align-items: baseline; gap: 0.45em; margin: 0 0 1em; padding: 0.5em 0.8em; border-left: 2px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm); }
.stat-tile .k.covered-note { color: var(--habit); margin-top: 0.15em; }

/* Rest days: a sleeping dog */
.sleepy-dog { display: block; flex: none; }
.stat-tile .rest-v { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.5em; }
.stat-tile .rest-v .sleepy-dog { width: 112px; height: 61px; margin: -26px 0 -24px; }
.rest-stat { align-items: center; }
.rest-stat .sleepy-dog { width: 66px; height: 36px; margin: -6px 0; }

/* Avatars */
td.title .avatar { margin-right: 0.5em; }
.user-cell { display: inline-flex; align-items: center; gap: 0.5em; }
/* A clickable avatar (opens its replay): the pointer, and it grows a little on hover. */
/* Clickable avatars: a pointer, and 6% larger on hover (also while a hover replay's canvas stands in). */
img.avatar, canvas.avatar[data-avatar-id] { cursor: pointer; transition: transform 0.15s ease; }
img.avatar:hover, canvas.avatar[data-avatar-id]:hover { transform: scale(1.06); }
a img.avatar, .user-menu img.avatar, button.draw-card img.avatar, .avatar-confirm img.avatar, button.draw-card canvas.avatar { cursor: inherit; }
button.draw-card canvas.avatar:hover { transform: none; }
a img.avatar:hover, .user-menu img.avatar:hover, button.draw-card img.avatar:hover, .avatar-confirm img.avatar:hover,
.avatar-swap img.avatar:hover, [data-drag-slot] img.avatar:hover, .arrange-dialog img.avatar:hover { transform: none; }
.bench-strip img.avatar:hover, .bench-strip canvas.avatar:hover { transform: scale(1.06); } /* in a link, but benched avatars still grow */
/* The replay dialog (decision 0018, 2026-10-15): someone else's avatar has their card on top (name,
   numbers, View profile / Avatars / friend buttons); the replay with its progress (bedtime shaded) on
   the left, everything about the avatar on the right. A bottom sheet on phones. static/app.js builds it. */
.avatar-dialog { position: relative; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--fg);
  padding: 0; width: min(58em, calc(100vw - 2em)); max-height: calc(100vh - 2em); box-sizing: border-box; overflow: auto;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25); }
.avatar-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.av-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--muted); }
.av-x:hover { background: var(--surface-2); color: var(--fg); }
.av-person { display: flex; align-items: center; gap: 0.9em; padding: 1em 3.6em 1em 1.3em; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.av-person[hidden] { display: none; }
.av-face { line-height: 0; flex: none; }
.av-face img { border-radius: 50%; }
.av-who { display: flex; flex-direction: column; gap: 0.2em; min-width: 0; flex: 1 1 12em; }
.av-namerow { display: flex; align-items: center; gap: 0.5em; }
.avatar-dialog:focus { outline: none; }
.av-uname { font-size: 1.15rem; font-weight: 650; color: var(--fg); text-decoration: none; }
.av-uname:hover { text-decoration: underline; }
.av-acts { margin-left: auto; display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; }
.av-acts form { margin: 0; }
.av-acts .btn, .av-acts button { height: 36px; display: inline-flex; align-items: center; }
.av-body { display: grid; grid-template-columns: 21em minmax(0, 1fr); }
.av-pic { padding: 1.4em; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 0.7em; }
.avatar-dialog .av-pic canvas { width: min(290px, 70vw); height: min(290px, 70vw); display: block; cursor: pointer; }
.avatar-caption-line { color: var(--fg-2); margin: 0; height: 1.4em; line-height: 1.4em; width: 100%; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.av-bench { width: 100%; display: flex; flex-direction: column; gap: 0.5em; padding-top: 0.8em; border-top: 1px solid var(--border); }
.av-bench[hidden] { display: none; }
.av-bench > span:last-child { display: flex; gap: 8px; flex-wrap: wrap; }
.av-thumb { padding: 0; border: 0; background: none; border-radius: 50%; line-height: 0; }
.av-thumb img { border-radius: 50%; box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 3px var(--border-strong); transition: transform 0.15s ease; }
.av-thumb:hover img { transform: scale(1.08); }
.av-side { padding: 1.3em 1.5em 1.2em; display: flex; flex-direction: column; gap: 0.3em; min-width: 0; }
.avatar-dialog:not(.has-person) .av-side { padding-right: 3.6em; }
.av-kicker { margin: 0; }
.av-kicker[hidden] { display: none; }
/* Keeping from the details (phones: a tapped shuffle card opens these first): the bar at the foot. */
.av-keep { display: flex; align-items: center; gap: 0.8em; padding: 0.8em 1em calc(0.8em + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
  background: var(--surface); position: sticky; bottom: 0; z-index: 2; }
.av-keep[hidden] { display: none; }
.av-keep .primary { flex: 1; height: 48px; font-size: 1rem; font-weight: 600; border-radius: 10px; }
.av-keep .link { flex: none; }
.avatar-stats { display: flex; flex-direction: column; gap: 1em; }
.av-name { margin: 0; font-size: 1.4rem; font-weight: 650; overflow-wrap: anywhere; }
.av-tierline { display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap; margin-top: -0.5em; }
.av-tierline .tier, .av-tierline .mutation-chip, .av-tierline .season-chip { margin: 0; }
.av-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.av-tile { display: flex; flex-direction: column; gap: 0.1em; padding: 0.55em 0.7em; border-radius: 10px; background: var(--surface-2); }
.av-tile b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.av-tile b small { font-size: 0.7em; color: var(--muted); font-weight: 500; }
.av-tile span { font-size: 0.75rem; color: var(--muted); }
.av-sec { display: flex; flex-direction: column; gap: 0.45em; }
.av-sec .share-bar { max-width: none; height: 10px; margin: 0; gap: 2px; }
.av-key { display: flex; gap: 0.9em; flex-wrap: wrap; font: 0.75rem var(--mono); color: var(--fg-2); }
.av-key span { display: inline-flex; align-items: center; gap: 0.35em; }
.av-key i { width: 10px; height: 10px; border-radius: 3px; }
.av-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.av-chips span { padding: 0.2em 0.7em; border-radius: 999px; border: 1px solid var(--border); font-size: 0.8rem; color: var(--fg-2); }
.av-story { margin: 0.2em 0 0; color: var(--fg-2); }
.avatar-stats .avatar-facts { font-size: 0.82rem; }
.av-foot { margin: 0.2em 0 0; padding-top: 0.8em; border-top: 1px solid var(--border); color: var(--muted);
  display: flex; align-items: center; gap: 0.5em 0.8em; flex-wrap: wrap; }
/* A long value (seed, id) as a chip: cut off with an ellipsis, click to copy it all. */
.copy-chip { display: inline-flex; align-items: center; gap: 0.45em; max-width: 13em; height: 26px; padding: 0 0.6em; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--fg-2); font: inherit; cursor: copy; }
.copy-chip:hover { border-color: var(--border-strong); color: var(--fg); }
.copy-label { color: var(--muted); flex: none; }
.copy-v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.copy-chip.copied { border-color: var(--ok); }
.copy-chip.copied .copy-v { color: var(--ok); }
.copy-chip.copied .copy-v::before { content: "copied "; }
/* The profile view: someone's card (their name or avatar clicked anywhere but the Avatar pages). */
.person-view { width: min(31em, calc(100vw - 2em)); }
.pv-head { display: flex; align-items: center; gap: 1.1em; padding: 1.4em 3.6em 1em 1.4em;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.pv-face { flex: none; padding: 0; border: 0; background: none; border-radius: 50%; line-height: 0; cursor: pointer; }
.pv-face img { border-radius: 50%; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border-strong), var(--shadow); transition: transform 0.15s ease; }
.pv-face:hover img { transform: scale(1.04); }
.pv-who { display: flex; flex-direction: column; gap: 0.3em; min-width: 0; }
.pv-name { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
a.pv-name:hover { text-decoration: underline; }
.pv-rel { font: 600 0.72rem var(--font); padding: 0.15em 0.6em; border-radius: 999px; background: var(--surface-3); color: var(--fg-2); white-space: nowrap; }
.pv-rel.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pv-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; padding: 0 1.4em 1.1em; }
.pv-acts form { margin: 0; display: flex; }
.pv-acts .btn, .pv-acts button { width: 100%; height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.pv-acts .fr-state { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; }
.pv-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 1.4em 1.1em; }
.pv-tiles .av-tile { align-items: center; text-align: center; }
.pv-bench { display: flex; flex-direction: column; gap: 0.6em; padding: 1em 1.4em 1.3em; border-top: 1px solid var(--border); }
.pv-bench-head { display: flex; justify-content: space-between; align-items: baseline; }
.pv-thumbs { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pv-thumbs .av-thumb img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--border-strong); }
.pv-more { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); border: 1px dashed var(--border-strong);
  font: 600 0.8rem var(--mono); color: var(--fg-2); text-decoration: none; }
.pv-bench p { margin: 0; }
@media (max-width: 720px) {
  .avatar-dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .av-person { padding: 0.9em 3.4em 0.9em 1em; gap: 0.7em; }
  .av-acts { margin-left: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .av-acts .btn, .av-acts button { width: 100%; justify-content: center; height: 44px; }
  .av-acts .fr-state { display: none; }
  .av-body { grid-template-columns: minmax(0, 1fr); }
  .av-pic { border-right: 0; border-bottom: 1px solid var(--border); padding: 1em; }
  .avatar-dialog .av-pic canvas { width: min(230px, 62vw); height: min(230px, 62vw); }
  .av-side { padding: 1em; }
  .avatar-dialog:not(.has-person) .av-side { padding-right: 1em; }
  .av-tiles { gap: 6px; }
  .av-tile { padding: 0.45em 0.5em; align-items: center; text-align: center; }
  .av-tile b { font-size: 1rem; }
  .person-view { width: 100vw; }
  .pv-head { padding: 1.2em 3.4em 0.9em 1em; }
  .pv-face img { width: 80px; height: 80px; }
  .pv-acts, .pv-tiles { padding-left: 1em; padding-right: 1em; }
  .pv-acts .btn, .pv-acts button { height: 44px; }
  .pv-tiles { gap: 6px; }
  .pv-bench { padding: 0.9em 1em 1.2em; }
}

/* Something due today: the dog fetches a ball */
.fetch-dog { display: block; flex: none; overflow: visible; }
.stat-tile .fetch-v { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.5em; }
.stat-tile .fetch-v .fetch-dog { width: 198px; height: 80px; bottom: 14px; }
.fetch-dog .fd-leg, .fetch-dog .fd-tail, .fetch-dog .fd-ear, .fetch-dog .fd-ball { transform-box: fill-box; }
.fetch-dog .fd-leg { transform-origin: 50% 8%; animation: fd-leg 0.42s ease-in-out infinite alternate; }
.fetch-dog .fd-leg-b { animation-delay: -0.42s; }
.fetch-dog .fd-dog { animation: fd-bob 0.21s ease-in-out infinite alternate; }
.fetch-dog .fd-tail { transform-origin: 85% 90%; animation: fd-wag 0.3s ease-in-out infinite alternate; }
.fetch-dog .fd-ear { transform-origin: 30% 5%; animation: fd-flop 0.42s ease-in-out infinite alternate; }
.fetch-dog .fd-ball { transform-origin: 50% 100%; animation: fd-bounce 0.84s infinite; }
.fetch-dog .fd-ball-shadow { transform-box: fill-box; transform-origin: center; animation: fd-ball-shadow 0.84s infinite; }
.fetch-dog .fd-speed { animation: fd-speed 0.42s linear infinite; }
@keyframes fd-leg { from { transform: rotate(-26deg); } to { transform: rotate(26deg); } }
@keyframes fd-bob { from { transform: translateY(0); } to { transform: translateY(-1.4px); } }
@keyframes fd-wag { from { transform: rotate(-12deg); } to { transform: rotate(14deg); } }
@keyframes fd-flop { from { transform: rotate(-10deg); } to { transform: rotate(16deg); } }
@keyframes fd-bounce {
  0% { transform: translateY(0) scale(1, 1); animation-timing-function: cubic-bezier(0.4, 0, 1, 1); }
  46% { transform: translateY(21px) scale(1.06, 0.94); }
  52% { transform: translateY(21.5px) scale(1.22, 0.78); animation-timing-function: cubic-bezier(0, 0, 0.6, 1); }
  60% { transform: translateY(18px) scale(0.94, 1.08); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes fd-ball-shadow { 0%, 100% { transform: scale(0.55); opacity: 0.08; } 50% { transform: scale(1.1); opacity: 0.22; } }
@keyframes fd-speed { from { transform: translateX(3px); opacity: 0.7; } to { transform: translateX(-4px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .fetch-dog *, .fetch-dog { animation: none !important; }
}

/* Habit page: something's due today */
.due-tag { font-size: 0.9rem; font-weight: 600; color: var(--habit); margin-left: 0.3em; }
.stat-tile.due-today { border-color: var(--habit); box-shadow: 0 0 0 1px var(--habit) inset;
  background: color-mix(in srgb, var(--habit) 9%, var(--surface-2)); }
.stat-tile.due-today .k { color: var(--fg-2); }
.avatar-confirm { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--fg);
  padding: 1.4em 1.6em; width: min(26em, calc(100vw - 2em)); }
.avatar-confirm::backdrop { background: rgb(0 0 0 / 0.55); }
.avatar-confirm h2 { margin: 0 0 0.8em; font-size: 1.1rem; }
.avatar-swap { display: flex; align-items: center; justify-content: center; gap: 1.2em; }
.avatar-swap figure { margin: 0; text-align: center; }
.avatar-swap img.avatar { cursor: default; }
.avatar-arrow { font-size: 1.4rem; color: var(--muted); }
.avatar-confirm-buttons { display: flex; justify-content: flex-end; gap: 0.5em; margin-top: 0.8em; }

/* ls problems/ flavor text */
.ls-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.ls-no-tags { display: none; }
.hide-tags .ls-no-tags { display: inline; }

/* Avatar page */
.profile-head { flex-wrap: wrap; }
.bench-strip { display: inline-flex; gap: 4px; margin-left: auto; padding: 4px 8px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); }
.bench-strip:hover { border-color: var(--border-strong); }
.bench-more { align-self: center; padding: 0 4px; color: var(--muted); } /* (the rest of a long bench: "+392") */
.list-more > summary { cursor: pointer; padding: 0.4em 0; }
.avatar-main-card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.avatar-detail { display: flex; gap: 1.6em; align-items: flex-start; flex-wrap: wrap; }
.avatar-detail-pic img.avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.avatar-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.35em 1em; margin: 0; flex: 1; min-width: 16em; font-size: 0.88rem; }
.avatar-facts dt { color: var(--muted); font: 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0.15em; }
.avatar-facts dd { margin: 0; }
.share-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; max-width: 22em; margin-top: 0.3em; }
.bench-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17em, 1fr)); gap: 1em; }
.bench-earn { margin: 0; padding: 0.7em 1.3em 0; }
.bench-actions { display: flex; gap: 0.5em; align-items: center; }
.bench-actions form { margin: 0; }
/* The compact bench: avatars only, with their slot numbers. */
.bench-compact { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 0.9em 0.6em; }
.bench-tile { display: flex; flex-direction: column; align-items: center; gap: 0.25em; }
.bench-tile .empty-slot { width: 64px; height: 64px; }
.bench-tile .slot-num { font-size: 0.7rem; color: var(--muted); }
.locked-tile .slot-num { color: var(--habit); }
.bench-pager { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4em 1.2em; padding: 0.2em 1em 1em; }
/* The habit note sits in the bottom right, out of the flow, so prev/next stay centered; narrow: its own line below. */
.bench-pager-note { position: absolute; right: 1em; bottom: 1em; color: var(--muted); }
@media (max-width: 900px) { .bench-pager-note { position: static; flex-basis: 100%; text-align: center; } }
/* The next bench slot, locked until a habit streak earns it. */
.bench-card.locked-slot { border: 1px dashed color-mix(in srgb, var(--habit) 60%, var(--border));
  background: color-mix(in srgb, var(--habit) 8%, var(--surface-2)); color: var(--fg-2); }
.locked-slot strong { color: var(--habit); }
.locked-slot p { margin: 0.5em 0 0; }
.locked-slot a { color: var(--habit); }
.empty-slot.locked { display: inline-flex; align-items: center; justify-content: center; color: var(--habit);
  border-color: color-mix(in srgb, var(--habit) 55%, transparent); }
.empty-slot.locked svg { width: 22px; height: 22px; }
.unlock-progress { display: flex; align-items: center; gap: 0.6em; margin-top: 0.6em; }
.unlock-bar { flex: 1; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--habit) 18%, transparent); overflow: hidden; }
.unlock-bar i { display: block; height: 100%; background: var(--habit); border-radius: 3px; }
.bench-new { color: var(--habit); font-weight: 600; margin-right: 0.5em; }
.bench-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.9em; background: var(--surface-2); }
.bench-card .avatar-facts { font-size: 0.8rem; min-width: 0; }
.bench-top { display: flex; align-items: center; gap: 0.9em; margin-bottom: 0.7em; }
.empty-slot { display: inline-block; width: 64px; height: 64px; border-radius: 50%; border: 2px dashed var(--border-strong); flex: none; }
.empty-slot.small-slot { width: 40px; height: 40px; }
.tier { margin: 0 0.35em; font: 600 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; padding: 0.05em 0.45em; border-radius: 999px;
  border: 1px solid currentColor; }
.tier.common, .tier-text.common { color: var(--muted); }
.tier.uncommon, .tier-text.uncommon { color: var(--easy); }
.tier.rare, .tier-text.rare { color: var(--link); }
.tier.kyoshi, .tier-text.kyoshi { color: #c65bdc; }
.tier.legendary, .tier-text.legendary { color: #e3b341; }
/* Seasonal drops: a chip (icon, season, year) and a badge in the picture's corner. */
.season-chip { margin: 0 0.35em; font: 600 0.7rem var(--mono); letter-spacing: 0.03em; padding: 0.08em 0.55em; border-radius: 999px;
  white-space: nowrap; color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); cursor: help; }
.draw-card .season-chip, .draw-card .mutation-chip { font-size: 0.62rem; margin: 0; }
/* World mutations: a chip, and the two worlds highlighted in the facts. */
.mutation-chip { margin: 0 0.35em; font: 600 0.7rem var(--mono); letter-spacing: 0.03em; padding: 0.08em 0.55em; border-radius: 999px;
  white-space: nowrap; color: var(--text); cursor: help;
  background: linear-gradient(90deg, color-mix(in srgb, #2fbf71 20%, transparent), color-mix(in srgb, #b45fe0 22%, transparent));
  border: 1px solid color-mix(in srgb, #b45fe0 55%, transparent); }
.mutation-kind { display: inline-flex; align-items: baseline; gap: 0.35em; padding: 0.05em 0.5em; margin-right: 0.4em; border-radius: 6px;
  background: color-mix(in srgb, #b45fe0 14%, transparent); }
.mutation-arrow { color: #b45fe0; font-weight: 700; }
.avatar-badged { position: relative; display: inline-block; line-height: 0; flex: none; }
.season-badge { position: absolute; right: -0.15em; bottom: -0.15em; font-size: 0.95rem; line-height: 1; padding: 0.18em;
  border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, var(--border));
  cursor: help; }
.avatar-badged.big .season-badge { font-size: 1.3rem; right: 0.1em; bottom: 0.1em; }
.mutation-badge { position: absolute; left: -0.15em; bottom: -0.15em; font-size: 0.95rem; line-height: 1; padding: 0.18em;
  border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px color-mix(in srgb, #b45fe0 65%, var(--border)); cursor: help; }
.avatar-badged.big .mutation-badge { font-size: 1.3rem; left: 0.1em; bottom: 0.1em; }
/* The Shuffle (decision 0018, 2026-10-15): pay, the button and the odds on the left, the cards on
   the right; on phones the odds first, the cards in a sideways row, pay + Shuffle above the tab bar. */
.shuffle-card { padding: 0; overflow: visible; }
.shuffle-layout { display: grid; grid-template-columns: 17.5em minmax(0, 1fr); grid-template-rows: auto auto 1fr;
  grid-template-areas: "intro cards" "pay cards" "odds cards"; }
.shuffle-intro, .shuffle-pay, .shuffle-odds { padding: 1.2em 1.3em 0; border-right: 1px solid var(--border); }
.shuffle-odds { padding-bottom: 1.3em; }
.shuffle-intro { grid-area: intro; }
.shuffle-intro h2 { margin: 0 0 0.3em; font-size: 1.3rem; font-weight: 650; }
.shuffle-intro p { margin: 0; line-height: 1.5; }
.shuffle-pay { grid-area: pay; display: flex; flex-direction: column; gap: 0.6em; }
.pay-opts { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45em; min-width: 0; }
.pay-opts legend { padding: 0; margin-bottom: 0.45em; }
.pay-opt { display: flex; align-items: center; gap: 0.7em; padding: 0.6em 0.75em; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface); }
.pay-opt input { margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.pay-opt.surplus input { accent-color: var(--habit); }
.pay-opt:has(input:checked).free { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.pay-opt:has(input:checked).surplus { border-color: var(--habit); background: color-mix(in srgb, var(--habit) 8%, var(--surface)); }
.pay-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pay-opt.off { opacity: 0.55; cursor: not-allowed; }
.pay-text { display: flex; flex-direction: column; gap: 0.1em; min-width: 0; }
.pay-name { font-weight: 600; font-size: 0.92rem; }
.pay-sub { font-size: 0.8rem; color: var(--muted); }
.shuffle-go { height: 46px; font-size: 1rem; font-weight: 600; border-radius: 10px; }
.shuffle-pay:has(input[value="surplus"]:checked) .shuffle-go:not(:disabled) { background: var(--habit); border-color: var(--habit); color: #fff; }
.pay-note { color: var(--fg-2); line-height: 1.4; }
.shuffle-odds { grid-area: odds; display: flex; flex-direction: column; gap: 0.55em; }
.odds-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; gap: 2px; }
.odds-list { display: flex; flex-direction: column; }
.odds-row { display: flex; justify-content: space-between; align-items: center; height: 30px; }
.odds-row + .odds-row { border-top: 1px solid var(--border); }
.odds-row .tier-text { display: inline-flex; align-items: center; gap: 0.5em; font: 600 0.72rem var(--mono); letter-spacing: 0.05em; text-transform: uppercase; }
.odds-row .tier-text i { width: 8px; height: 8px; border-radius: 50%; }
.odds-pct { font-weight: 600; font-variant-numeric: tabular-nums; }
.odds-note { margin: 0.2em 0 0; padding: 0.6em 0.75em; border-radius: 8px; background: var(--surface-2); color: var(--fg-2); line-height: 1.45; }
.tier-bg.common { background: var(--muted); }
.tier-bg.uncommon { background: var(--easy); }
.tier-bg.rare { background: var(--link); }
.tier-bg.legendary { background: #e3b341; }
.tier-bg.kyoshi { background: #c65bdc; }
.shuffle-cards { grid-area: cards; padding: 1.2em 1.3em 1.3em; min-width: 0; }
.draw-head { display: flex; align-items: baseline; gap: 0.7em; margin-bottom: 0.8em; }
.draw-head .link { margin-left: auto; }
.draw-empty { display: grid; place-items: center; min-height: 12em; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.draw { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: 1fr; gap: 12px; } /* every card the same height */
.draw-page { display: contents; } /* pages only mean something on phones */
.draw-pager { display: none; }
.draw-card { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.45em; padding: 1em 0.6em 0.9em; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; color: var(--fg); font: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease; }
.draw-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.draw-card.rare { border-color: color-mix(in srgb, var(--link) 55%, var(--border)); }
.draw-card.kyoshi { border-color: #c65bdc; background: color-mix(in srgb, #c65bdc 8%, var(--surface)); }
.draw-card.legendary { border-color: #e3b341; background: color-mix(in srgb, #e3b341 9%, var(--surface)); }
.draw-card .avatar-badged, .draw-card img.avatar, .draw-card canvas.avatar { flex: none; } /* the picture never shrinks to make room */
.draw-name { font-size: 0.88rem; font-weight: 600; text-align: center; }
.draw-meta { display: inline-flex; align-items: center; gap: 0.4em; }
.draw-meta .tier { margin: 0; }
.draw-odds { font: 0.7rem var(--mono); color: var(--muted); }
.wide-only { display: inline; }
@media (max-width: 720px) {
  .shuffle-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "intro" "odds" "cards" "pay"; }
  .shuffle-intro, .shuffle-pay, .shuffle-odds { border-right: 0; padding: 1em 1em 0; }
  .shuffle-odds { margin: 0.9em 1em 0; padding: 0.8em 0.9em; border: 1px solid var(--border); border-radius: 12px; }
  .odds-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .odds-row { flex-direction: column; align-items: flex-start; height: auto; gap: 2px; }
  .odds-row + .odds-row { border-top: 0; }
  .odds-row .tier-text { font-size: 0.6rem; letter-spacing: 0; overflow: hidden; max-width: 100%; }
  .odds-row .tier-text i { display: none; }
  .odds-pct { font-size: 0.85rem; }
  .shuffle-cards { padding: 1em 0 0.6em; }
  .draw-head { padding: 0 1em; }
  .draw-how { display: none; }
  /* Pages of four cards (2×2), swiped sideways; dots and a hint below (static/app.js keeps them current). */
  .draw { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0; padding: 2px 0 6px; scrollbar-width: none; scroll-padding: 0 1em; }
  .draw::-webkit-scrollbar { display: none; }
  .draw-page { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 10px; flex: none; width: 100%; box-sizing: border-box; padding: 0 1em; scroll-snap-align: start; scroll-snap-stop: always; }
  /* Every card the same, fixed size: the picture, one line of name, the rarity; a season or a
     mutation is a badge on the picture's corner, not a line of text. */
  .draw-card { padding: 0.9em 0.5em 0.8em; gap: 0.35em; height: 100%; box-sizing: border-box; }
  .draw-card img.avatar, .draw-card canvas.avatar { width: 120px !important; height: 120px !important; }
  .draw-name { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .draw-card .season-chip, .draw-card .mutation-chip { display: none; }
  .draw-pager { display: flex; flex-direction: column; align-items: center; gap: 0.45em; padding: 0.4em 1em 0; }
  .draw-dots { display: inline-flex; gap: 6px; }
  .draw-dot { width: 28px; height: 6px; padding: 0; border: 0; border-radius: 999px; background: var(--border-strong); transition: background 0.2s ease, width 0.2s ease; }
  .draw-dot.on { background: var(--fg); width: 40px; }
  .draw-swipe { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.4; } /* one line, always: the card's height never moves */
  /* A light deal on phones (static/app.js): cards fade in, no slide, glow, sheen, twinkle or staggered exit. */
  .draw.revealing .draw-card { transform: none; }
  .draw.revealing .draw-card.dealt { transition: opacity 0.2s ease; }
  .draw-card:hover { transform: none; }
  .draw-card.revealed { animation: none !important; }
  .draw-card.revealed::after { display: none; }
  .twinkle { display: none; }
  .draw.leaving .draw-card { animation-duration: 0.18s; animation-delay: 0s; }
  .draw.entering .draw-card { animation: none; }
  .wide-only { display: none; }
  .shuffle-pay { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5; flex-direction: row; flex-wrap: wrap; align-items: stretch;
    gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 -6px 18px rgb(0 0 0 / 0.06); }
  .pay-opts { flex-direction: row; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
  .pay-opts legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pay-opt { position: relative; width: 82px; min-height: 46px; padding: 4px; justify-content: center; text-align: center; border: 0; border-radius: 9px; background: transparent; }
  .pay-opt input { position: absolute; opacity: 0; pointer-events: none; }
  .pay-opt:has(input:checked).free, .pay-opt:has(input:checked).surplus { background: var(--surface); box-shadow: var(--shadow); }
  .pay-name { font-size: 0.82rem; }
  .pay-sub { font: 0.66rem var(--mono); }
  .shuffle-go { flex: 1; height: auto; min-height: 52px; }
  .pay-note { flex: 1 1 100%; }
  .shuffle-pay > .muted { align-self: center; }
}
.pick-name { font-weight: 600; margin-bottom: 0.2em; }
.pick-slots { display: flex; flex-direction: column; gap: 0.35em; margin: 0.8em 0 0.4em; }
.pick-slot { display: flex; align-items: center; gap: 0.6em; padding: 0.3em 0.5em; border-radius: var(--radius-sm); cursor: pointer; }
.pick-slot:hover { background: var(--surface-2); }

/* Shuffle reveal: cards are dealt one at a time (static/app.js), replay their
   world, and show their tier as they settle, with a little flourish for the
   rarer ones. */
.draw.revealing .draw-card { opacity: 0; transform: translateY(14px) scale(0.94); }
.draw.revealing .draw-card.dealt { opacity: 1; transform: none; transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.draw.revealing .draw-card .tier, .draw.revealing .draw-card .draw-name, .draw.revealing .draw-card .season-chip, .draw.revealing .draw-card .mutation-chip,
.draw.revealing .draw-card .season-badge, .draw.revealing .draw-card .mutation-badge { opacity: 0; }
.draw.revealing .draw-card.revealed .tier, .draw.revealing .draw-card.revealed .draw-name, .draw.revealing .draw-card.revealed .season-chip, .draw.revealing .draw-card.revealed .mutation-chip,
.draw.revealing .draw-card.revealed .season-badge, .draw.revealing .draw-card.revealed .mutation-badge { opacity: 1; transition: opacity 0.4s ease; }
.draw-card { position: relative; overflow: hidden; }
.draw-card canvas.avatar { display: block; border-radius: 50%; }
.draw-card.revealed.uncommon { animation: glow-uncommon 1.2s ease-out; }
.draw-card.revealed.rare { animation: glow-rare 1.4s ease-out; }
.draw-card.revealed.kyoshi { animation: glow-kyoshi 1.1s ease-in-out 2; }
.draw-card.revealed.legendary { animation: glow-legendary 1.8s ease-out; }
.draw-card.revealed.legendary::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgb(255 236 170 / 0.45) 50%, transparent 65%);
  transform: translateX(-120%); animation: sheen-sweep 1.4s ease-out 0.15s; }
@keyframes glow-uncommon { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--easy) 70%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@keyframes glow-rare { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--link) 80%, transparent); } 60% { box-shadow: 0 0 18px 6px color-mix(in srgb, var(--link) 35%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes glow-legendary { 0% { box-shadow: 0 0 0 0 rgb(227 179 65 / 0.9); } 50% { box-shadow: 0 0 26px 8px rgb(227 179 65 / 0.45); } 100% { box-shadow: 0 0 12px rgb(227 179 65 / 0.35); } }
@keyframes glow-kyoshi { 0%, 100% { box-shadow: 0 0 6px rgb(198 91 220 / 0.25); } 50% { box-shadow: 0 0 22px 6px rgb(198 91 220 / 0.5); } }
@keyframes sheen-sweep { to { transform: translateX(120%); } }
/* A kyoshi's twinkle: diamonds over the top of the card as it lands (static/app.js adds them). */
.twinkle { position: absolute; left: 0; right: 0; top: 4px; height: 34px; pointer-events: none; }
.twinkle i { position: absolute; font-style: normal; line-height: 1; color: #c65bdc; opacity: 0;
  text-shadow: 0 0 6px rgb(198 91 220 / 0.8), 0 0 2px #fff; animation: twinkle 1.2s ease-in-out 3 both; }
.twinkle i:nth-child(1) { left: 16%; top: 14px; font-size: 9px; animation-delay: 0s; }
.twinkle i:nth-child(2) { left: 32%; top: 2px; font-size: 13px; animation-delay: 0.35s; }
.twinkle i:nth-child(3) { left: 50%; top: 9px; font-size: 7px; animation-delay: 0.15s; }
.twinkle i:nth-child(4) { left: 66%; top: 0; font-size: 11px; animation-delay: 0.6s; }
.twinkle i:nth-child(5) { left: 82%; top: 12px; font-size: 8px; animation-delay: 0.45s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.2) translateY(4px); } 45% { opacity: 1; transform: scale(1.15) translateY(0); }
  60% { opacity: 0.9; transform: scale(0.9); } }
/* The old row leaving before a new shuffle comes in, and refused shuffles' cards coming back. */
.draw.leaving .draw-card { animation: card-leave 0.32s ease-in calc(var(--i, 0) * 45ms) both; pointer-events: none; }
@keyframes card-leave { to { opacity: 0; transform: translateY(18px) scale(0.92); } }
.draw.entering .draw-card { animation: card-enter 0.3s ease-out both; }
@keyframes card-enter { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .draw.revealing .draw-card, .draw.revealing .draw-card .tier, .draw.revealing .draw-card .draw-name,
  .draw.revealing .draw-card .season-chip, .draw.revealing .draw-card .mutation-chip, .draw.revealing .draw-card .season-badge, .draw.revealing .draw-card .mutation-badge { opacity: 1; transform: none; }
  .draw-card.revealed { animation: none !important; }
  .draw-card.revealed::after { display: none; }
  html .draw.revealing .draw-card .draw-odds { opacity: 1; }
  .twinkle { display: none; }
  .draw.leaving .draw-card, .draw.entering .draw-card { animation: none; }
}
.keep-canvas { cursor: pointer; flex: none; }
.draw.revealing .draw-card:not(.revealed) { border-color: var(--border); box-shadow: none; background: var(--surface); } /* no spoilers before it lands */
.draw.revealing .draw-card .draw-odds { opacity: 0; }
.draw.revealing .draw-card.revealed .draw-odds { opacity: 1; transition: opacity 0.4s ease; }
.danger-text { color: var(--hard); }
.pick-slot span > span { margin-left: 0.3em; }

/* Dragging avatars */
[data-drag-slot], [data-drag-new] { touch-action: none; cursor: grab; }
[data-drag-slot] img.avatar { cursor: grab; }
/* Its own compositor layer: moving it then repaints nothing (not its shadow, not the hex avatars
   under it), which made dragging onto the bench lag (agentic/spikes/bench-drag). */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: 0.9;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.35); will-change: transform; }
/* img.avatar eases its transform for hovers; on the ghost that made it trail the cursor. */
img.avatar.drag-ghost { transition: none; }
.drag-source { opacity: 0.35; }
[data-drop-slot].drop-over, .pick-slot.drop-over { outline: 2px dashed var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* While a modal dialog is open the page is pinned where it was (static/app.js sets top/left). */
body.modal-pinned { position: fixed; width: 100%; overflow: hidden; }
/* The slot board (Rearrange, and keeping a shuffled card): the new card and
   the main avatar on the left, every bench slot in a scrolling grid on the
   right; a bottom sheet on phones. static/app.js runs it. */
.arrange-dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--fg); padding: 0;
  width: min(62em, calc(100vw - 2em)); height: min(48em, calc(100vh - 2em)); max-height: calc(100vh - 2em); overflow: hidden;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25); box-sizing: border-box; }
.arrange-dialog[open] { display: flex; flex-direction: column; }
.arrange-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
/* While the board is open, the page's own avatars under its backdrop aren't drawn: an avatar that
   animates (kyoshi, color cycles) repainted the whole viewport every frame, and dragging onto the
   bench lagged behind it (agentic/spikes/bench-drag: half the rendering work, 30 -> 60 fps). */
body:has(dialog.arrange-dialog[open]) img.avatar:not(.arrange-dialog img):not(.site-header img) { visibility: hidden; }
.arrange-dialog form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.arr-head { display: flex; align-items: center; gap: 0.8em; padding: 0.9em 1.2em; border-bottom: 1px solid var(--border); }
.arr-head h2 { margin: 0; font-size: 1.15rem; font-weight: 650; overflow-wrap: anywhere; }
.arr-how { flex: 1; }
.arrange-dialog:not(.keeping) .arr-new, .arrange-dialog:not(.keeping) .arr-title-keep, .arrange-dialog.keeping .arr-title-arrange { display: none; }
.arr-x { margin-left: auto; width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: var(--radius-sm); flex: none; }
.arr-x:hover { background: var(--surface-2); color: var(--fg); }
.arr-body { display: grid; grid-template-columns: 15.5em minmax(0, 1fr); min-height: 0; flex: 1; }
.arr-bench, .arr-side { min-width: 0; }
.arr-side { padding: 1.1em; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 1em; overflow-y: auto; }
.arr-label { font: 600 0.68rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.arr-new, .arr-main, .arr-tidy { display: flex; flex-direction: column; gap: 0.5em; }
.arr-tidy { padding-top: 0.9em; border-top: 1px solid var(--border); }
.arr-tidy button { text-align: left; }
.arr-new-info { display: flex; flex-direction: column; gap: 0.3em; align-items: center; text-align: center; }
.arr-new-info .link { padding: 0; }
.arr-bench { padding: 0.9em 1.1em; display: flex; flex-direction: column; gap: 0.6em; min-height: 0; }
.arr-filters { display: flex; align-items: center; gap: 0.35em; flex-wrap: wrap; }
.arr-filters .arr-label { margin-right: 0.3em; }
.arr-chip { height: 30px; padding: 0 0.75em; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font: 600 0.78rem var(--font);
  display: inline-flex; align-items: center; gap: 0.4em; }
.arr-chip:not(.tier-text) { color: var(--fg); }
.arr-chip .n { font: 400 0.7rem var(--mono); color: var(--muted); }
.arr-chip[aria-pressed="true"] { background: var(--fg); color: var(--surface); border-color: var(--fg); }
.arr-chip[aria-pressed="true"] .n { color: inherit; opacity: 0.7; }
.arr-chip.empty-tier { display: none; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; align-content: start; overflow-y: auto;
  padding: 6px; border-radius: var(--radius); background: var(--surface-2); min-height: 12em; flex: 1; }
.slot-grid img.avatar { width: 56px; height: 56px; }
.slot-main img.avatar { width: 104px; height: 104px; }
.arrange-tray img.avatar { width: 132px; height: 132px; }
.arrange-tray.doomed img.avatar { width: 72px; height: 72px; }
/* A slot: its number, the avatar (a piece) or the empty ring, and a hint while something's being moved. */
.arrange-tray, .arr-slot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 100px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: center; }
.arr-slot.slot-main { min-height: 176px; border-color: color-mix(in srgb, var(--link) 45%, var(--border)); }
.arrange-tray { min-height: 176px; border: 2px solid transparent; background: none; }
.arrange-tray.doomed { border: 2px dashed var(--hard); background: color-mix(in srgb, var(--hard) 8%, var(--surface)); }
.arrange-tray:not(.empty) .empty-slot, .arr-slot:not(.empty) .empty-slot { display: none; }
.arrange-tray.empty:not(.doomed) .tray-slot { width: 132px; height: 132px; }
.tray-note { color: var(--muted); }
.arrange-tray.doomed .tray-note { color: var(--hard); font-weight: 600; }
.slot-num { position: absolute; top: 4px; left: 7px; font: 0.62rem var(--mono); color: var(--muted); }
.slot-hint { min-height: 1.1em; font: 600 0.6rem var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.arr-slot.locked { border-style: dashed; background: none; color: var(--muted); cursor: default; }
.arr-slot.locked .empty-slot { display: grid; place-items: center; border: 0; background: var(--surface-3); }
.arr-slot.locked .slot-hint { color: var(--habit); }
.piece { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 3px; background: none; border: 2px solid transparent;
  border-radius: 12px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--fg); font: inherit; max-width: 100%; }
.piece:hover { background: none; border-color: var(--border-strong); }
.piece.selected { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
@media (hover: none) { .piece:not(.selected):hover { border-color: transparent; } }
.piece img { -webkit-user-drag: none; cursor: inherit; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--border-strong); }
.piece.uncommon img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--easy); }
.piece.rare img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--link); }
.piece.legendary img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #e3b341; }
.piece.kyoshi img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #c65bdc; }
.piece-name { font-size: 0.78rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-grid .piece-name { display: none; }
.slot-main .piece-name, .piece-new .piece-name { font-size: 0.9rem; white-space: normal; overflow-wrap: anywhere; }
.arr-slot.is-new { border: 2px solid #e3b341; background: color-mix(in srgb, #e3b341 9%, var(--surface)); }
/* While an avatar is picked up: where it can go. */
.arrange-dialog.moving .arr-slot.target-empty { border: 2px dashed var(--accent); background: var(--accent-soft); }
.arrange-dialog.moving .arr-slot.target-replace { border-style: dashed; border-color: color-mix(in srgb, var(--hard) 45%, var(--border)); }
.arrange-dialog [data-slot].target-replace.drop-over { border: 2px dashed var(--hard); background: color-mix(in srgb, var(--hard) 7%, var(--surface)); outline-color: var(--hard); }
.arrange-dialog.moving .arr-slot.target-replace .slot-hint { color: var(--hard); }
.arrange-dialog [data-slot].drop-over { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Rarity filters: the others fade (they can still be dropped on). */
.arrange-dialog[data-filter] .slot-grid .arr-slot:not(.match) { opacity: 0.3; }
.arr-foot { display: flex; align-items: center; gap: 0.8em; padding: 0.8em 1.2em; border-top: 1px solid var(--border); flex-wrap: wrap; }
.arr-status { flex: 1; min-width: 14em; display: flex; flex-direction: column; gap: 0.3em; }
.arr-status p { margin: 0; }
.arr-summary { color: var(--fg-2); }
.delete-warn, .sure-warn { display: flex; align-items: center; gap: 0.5em; color: var(--hard); font-weight: 600; }
.delete-warn[hidden], .sure-warn[hidden] { display: none; }
.delete-warn input { accent-color: var(--hard); width: 16px; height: 16px; }
.sure-warn input { width: 9em; }
.arr-foot button[type="submit"]:disabled { opacity: 1; background: var(--surface-2); border-color: var(--border); color: var(--muted); cursor: not-allowed; }
.arrange-dialog.deleting .arr-foot button[type="submit"]:not(:disabled) { background: var(--hard); border-color: var(--hard); color: #fff; }
@media (max-width: 720px) {
  .arrange-dialog { width: 100vw; max-width: 100vw; height: auto; max-height: 94vh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .arr-how { display: none; }
  .arr-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .arr-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 0; border-bottom: 1px solid var(--border); padding: 0.8em; gap: 0.6em; overflow: visible; }
  .arrange-dialog:not(.keeping) .arr-main { grid-column: 1 / -1; }
  .arr-tidy { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; border-top: 0; padding-top: 0; }
  .arr-tidy .arr-label { display: none; }
  .arr-new-info { display: none; }
  .arrange-tray, .arr-slot.slot-main { min-height: 128px; }
  .arrange-tray img.avatar { width: 84px; height: 84px; }
  .arrange-tray.doomed img.avatar { width: 56px; height: 56px; }
  .slot-main img.avatar { width: 84px; height: 84px; }
  .arrange-tray.empty:not(.doomed) .tray-slot { width: 88px; height: 88px; }
  .arr-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .arr-chip { flex: none; height: 36px; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); max-height: none; overflow: visible; }
  .arr-slot { min-height: 84px; }
  .slot-grid img.avatar { width: 46px; height: 46px; }
  .arr-foot { position: sticky; bottom: 0; background: var(--surface); }
  .arr-status { flex: 1 1 100%; }
  .arr-foot button { min-height: 44px; }
  .arr-foot button[type="submit"] { flex: 1; }
}

/* Habit page: today's quota by difficulty */
.today-slots { display: flex; flex-wrap: wrap; gap: 0.35em; margin-top: 0.5em; }
.today-slot { font: 0.75rem var(--mono); padding: 0.1em 0.55em; border-radius: 999px; border: 1px solid currentColor; opacity: 0.85; }
.today-slot.easy { color: var(--easy); }
.today-slot.medium { color: var(--medium); }
.today-slot.hard { color: var(--hard); }
.today-slot.any { color: var(--fg-2); }
.today-slot.done { opacity: 1; background: color-mix(in srgb, currentColor 16%, transparent); font-weight: 600; }
.draw-name { max-width: 100%; overflow-wrap: anywhere; line-height: 1.25; }
.site-header.wide { padding-left: 1.2em; }
.still-pref { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em 1em; padding: 0.6em 1.2em 0; }
.still-pref label { display: inline-flex; gap: 0.4em; align-items: center; font-weight: 500; }
.draw-card, .draw-name { white-space: normal; }
.draw-name { word-break: break-word; }
@media (max-width: 720px) { /* phones: one line, so every card is the same height (a long name is cut with …) */
  .draw-card .draw-name { white-space: nowrap; word-break: normal; overflow-wrap: normal; overflow: hidden; text-overflow: ellipsis; }
}

/* Admin → Avatar lab */
.lab-help { margin: 0 0 0.8em; }
.lab-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(11em, 1fr)); gap: 0.6em 1em; }
.lab-fields label { display: flex; flex-direction: column; gap: 0.2em; font-size: 0.8rem; color: var(--muted); }
.lab-fields input, .lab-fields select { width: 100%; box-sizing: border-box; }
.lab-buttons { display: flex; flex-wrap: wrap; gap: 0.8em; align-items: center; margin-top: 1em; }
.lab-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.8em; }
@media (max-width: 900px) { .lab-grid { grid-template-columns: repeat(3, 1fr); } }
.lab-card { display: flex; flex-direction: column; align-items: center; gap: 0.25em; text-align: center; min-width: 0; }
.lab-card { cursor: pointer; }
.lab-card .avatar { width: 100% !important; height: auto !important; max-width: 140px; aspect-ratio: 1; }
.lab-name { font-size: 0.82rem; overflow-wrap: anywhere; }
.lab-knobs { font-size: 0.68rem; line-height: 1.3; overflow-wrap: anywhere; }
.lab-form { padding: 1em 1.2em; }
.lab-hint { font-size: 0.7rem; opacity: 0.75; margin-left: 0.3em; }

/* The nav's Avatar tab: a shuffle to spend (a free one, or the surplus). */
.nav-diamond { color: #b45fe0; font-size: 0.62em; margin-left: 0.3em; vertical-align: 0.35em; }
.leader-cell { gap: 0.75em; }
.gifted { color: #b45fe0; }
.give-form h2 { margin: 0 0 0.4em; font-size: 1.05rem; }
.give-fields { display: grid; grid-template-columns: 12em 1fr auto; gap: 0.8em; align-items: end; }
.give-fields label { display: flex; flex-direction: column; gap: 0.2em; font-size: 0.8rem; color: var(--muted); }
.give-fields textarea { font: 0.8rem var(--mono); width: 100%; box-sizing: border-box; }
@media (max-width: 700px) { .give-fields { grid-template-columns: 1fr; } }

/* A small "?" bubble: this label has a hover explanation (its title). */
.has-help { cursor: help; }
.help-q { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-left: 0.35em;
  border: 1px solid currentColor; border-radius: 50%; font-size: 0.8em; line-height: 1; font-weight: 700;
  vertical-align: 0.45em; opacity: 0.7; text-transform: none; letter-spacing: 0; }
.has-help:hover .help-q { opacity: 1; }
.replay-hint { opacity: 0.75; }

/* The problem list's pager. */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6em; padding: 0.8em 1em; border-top: 1px solid var(--border); }
.pager-links { display: flex; flex-wrap: wrap; gap: 0.3em; align-items: center; }
.pager-links a, .pager-current, .pager-gap { min-width: 2em; text-align: center; padding: 0.25em 0.55em; border-radius: 6px; font-variant-numeric: tabular-nums; }
.pager-links a { border: 1px solid var(--border); text-decoration: none; }
.pager-links a:hover { background: var(--surface-3); }
.pager-current { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.pager-gap { color: var(--muted); }
.sol-locked h3 .lock-sub { font-weight: 400; font-size: 0.85em; color: var(--muted); }
/* A pill banked surplus will cover tonight: safe, but not done (only your own solve grows the streak). */
.today-slot.covered { border-style: dashed; opacity: 1; background: color-mix(in srgb, currentColor 6%, transparent); }
.shield-icon { vertical-align: -0.1em; margin-left: 0.15em; }
.streak-nudge { margin: 0.45em 0 0; line-height: 1.35; }
.covered-sub { font-size: 0.78em; font-weight: 400; color: var(--muted); opacity: 0.85; margin-left: 0.3em; white-space: nowrap; }
/* Debt: "owed" pills (a minus count and a red edge, still in the difficulty's color). */
.owed-slots { align-items: center; }
.owed-label { font: 0.7rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 0.1em; }
.today-slot.owed { opacity: 1; box-shadow: inset 3px 0 0 var(--hard); padding-left: 0.7em; }
.owes-sub { color: color-mix(in srgb, var(--hard) 70%, var(--muted)); }
.debt-nudge { margin-top: 0.25em; }
.uncovers-note { display: block; color: var(--medium); }
.quizzical-dog { display: block; flex: none; overflow: visible; }
.rest-stat .quizzical-dog { width: 38px; height: 39px; margin: -10px 0 -6px; }
.happy-dog { display: block; flex: none; overflow: visible; }
.rest-stat .happy-dog { width: 46px; height: 34px; margin: -6px 0; }
.happy-dog .hd-tail { transform-box: fill-box; transform-origin: 0% 100%; animation: hd-wag 0.35s ease-in-out infinite alternate; }
.happy-dog .hd-heart { animation: hd-float 2.4s ease-in-out infinite; }
@keyframes hd-wag { from { transform: rotate(-14deg); } to { transform: rotate(16deg); } }
@keyframes hd-float { 0%, 100% { transform: translateY(0); opacity: 0.85; } 50% { transform: translateY(-2.5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .happy-dog .hd-tail, .happy-dog .hd-heart { animation: none; } }
.calm .happy-dog .hd-tail, .calm .happy-dog .hd-heart { animation: none; }
.happy-dog .hd-ball { animation: hd-bounce 1.6s ease-in-out infinite; }
@keyframes hd-bounce { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-2.5px); } }
@media (prefers-reduced-motion: reduce) { .happy-dog .hd-ball { animation: none; } }
.calm .happy-dog .hd-ball { animation: none; }
/* The big habit-page dogs sit in the tile's bottom-right corner, out of the layout, so they never
   stretch the tile (it's sized by its text, with room for a dog). */
.stat-tile:has(.quizzical-dog, .happy-dog, .fetch-dog) { position: relative; min-height: 124px; }
.stat-tile .quizzical-dog, .stat-tile .happy-dog, .stat-tile .fetch-dog { position: absolute; right: 12px; bottom: 6px; }
.stat-tile .quizzical-dog { width: 116px; height: 119px; }
.stat-tile .happy-dog { width: 149px; height: 112px; }
.quizzical-dog .qd-mark { animation: qd-bob 2.2s ease-in-out infinite; transform-box: fill-box; }
@keyframes qd-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -1.5px; } }
@media (prefers-reduced-motion: reduce) { .quizzical-dog .qd-mark { animation: none; } }
.calm .quizzical-dog .qd-mark { animation: none; }
/* Today met by your own solves, nothing owed: a green tile with a check. */
.stat-tile.done-clean { position: relative; border-color: color-mix(in srgb, var(--ok) 60%, var(--border));
  background: color-mix(in srgb, var(--ok) 10%, var(--surface-2)); }
.done-check { position: absolute; top: 9px; right: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid;
  place-items: center; background: var(--ok); color: var(--ok-fg, #fff); font: 700 13px/1 var(--font); }
.schedule-summary { margin: 0.2em 0 0.9em; padding: 0.55em 0.8em; border-left: 3px solid var(--habit); background: color-mix(in srgb, var(--habit) 8%, transparent); border-radius: 0 6px 6px 0; }
.habit-form button[data-schedule-submit]:disabled { opacity: 1; cursor: not-allowed; background: var(--surface-3); border-color: var(--border); color: var(--muted); font-weight: 500; }
.verdict.neutral { color: var(--muted); }
.run-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8em; }
@media (max-width: 700px) { .run-compare { grid-template-columns: 1fr; } }

/* Admin → Activity */
.activity-filters { flex-wrap: wrap; align-items: center; }
.activity-filters .spacer-left { margin-left: auto; }
.activity-table .nowrap { white-space: nowrap; }
.activity-kind { padding: 0.05em 0.45em; border-radius: 4px; background: var(--surface-3); color: var(--fg-2); text-decoration: none; }

/* Custom input: pills for every example and your own inputs. */
.custom-input { display: flex; flex-direction: column; gap: 0.45em; }
.input-pills { display: flex; flex-wrap: wrap; gap: 0.35em; }
.input-pill { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.2em 0.7em; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--fg-2); font: 0.78rem var(--mono); cursor: pointer; }
.input-pill:hover { border-color: var(--border-strong); }
.input-pill.active { border-color: var(--accent); color: var(--fg); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.input-pill.input-add { font-weight: 700; padding: 0.2em 0.6em; }
.input-pill-x { opacity: 0.6; font-size: 0.95em; line-height: 1; }
.input-pill-x:hover { opacity: 1; color: var(--hard); }
.input-hint { margin: 0; }
.custom-input textarea[readonly] { opacity: 0.8; }
.input-head { display: flex; align-items: baseline; gap: 0.8em; }
.input-head .use-input { font-weight: 500; text-transform: none; letter-spacing: 0; }
.input-head a.use-input { padding: 0.2em 0.35em; text-decoration: none; }
.input-head a.use-input:hover { text-decoration: underline; }
.inputs-head { margin: 0.8em 0 0.3em; }
.input-results { flex-direction: column; align-items: stretch; }
.input-result summary { display: flex; gap: 0.6em; align-items: baseline; cursor: pointer; }
.input-result[open] summary { margin-bottom: 0.4em; }
.pass-chip .test-chip { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.pass-chip .test-chip.active { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }

/* ---------- phones (decision 0021) ----------
   At 720px and below: the nav is a tab bar at the bottom (CLI and Admin move to the account
   menu), pages get narrow gutters, and the solve page shows one pane at a time. Everything above
   stays as on desktop. Screenshots: PHONE=1 agentic/spikes/screens/run.sh. */
.nav-icon, .menu-phone, .phone-tabs { display: none; }
@media (max-width: 720px) {
  :root { --tabbar-h: 56px; --header-h: 48px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  body.calm { padding-bottom: 0; } /* the solve page: no tab bar, every pixel for the work */
  .site-header { gap: 0.6em; padding: 0 max(0.8em, env(safe-area-inset-right)) 0 max(0.9em, env(safe-area-inset-left)); }
  .site-header .header-right { margin-left: auto; }
  .site-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 0; justify-content: space-around;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
  }
  .calm .site-nav { display: none; }
  .site-nav a {
    position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 0.3em 0 0.2em; border-radius: 0; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.01em;
  }
  .site-nav a:hover { background: none; }
  .site-nav a.nav-more { display: none; }
  .site-nav a[aria-current="page"] { color: var(--accent); }
  .site-nav a[aria-current="page"]::before { /* a bar over the current tab */
    content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; border-radius: 0 0 2px 2px; background: currentColor;
  }
  .site-nav a.nav-habit:hover { background: none; }
  .nav-icon { display: block; }
  .site-nav .nav-label { line-height: 1; }
  .site-nav .stars { position: absolute; top: 4px; left: calc(50% + 8px); font-size: 0.6rem; }
  .site-nav .nav-diamond { position: absolute; top: 5px; left: calc(50% + 10px); margin: 0; font-size: 0.6rem; }
  .menu .menu-phone { display: flex; }
  .menu { min-width: 13em; }
  main { padding: 1.1em max(0.9em, env(safe-area-inset-left)) 1.6em; }
  .site-footer { padding: 1em 0 1.4em; }
  h1 { font-size: 1.45rem; }

  /* The solve page: Problem | Code | Result. */
  .phone-tabs {
    display: flex; position: sticky; top: var(--header-h); z-index: 15; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .phone-tabs button {
    flex: 1; justify-content: center; text-align: center; padding: 0.65em 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none;
    color: var(--muted); font-weight: 600; font-size: 0.9rem;
  }
  .phone-tabs button.active { color: var(--fg); border-bottom-color: var(--accent); }
  .solve { display: block; height: auto; min-height: 0; padding: 6px; }
  .splitter { display: none !important; }
  .solve[data-phone="problem"] .work-pane, .solve[data-phone="code"] .statement-pane, .solve[data-phone="result"] .statement-pane { display: none; }
  /* The Coach is a tab up top on phones: not among the problem's own tabs, which hide in its view. */
  .stmt-tabs .coach-tab:not(.locked), .solve[data-phone-coach] .stmt-tabs { display: none; }
  .statement-pane { padding: 1em 1.05em 1.6em; overflow: visible; }
  .statement-pane > .stmt-tabs { position: static; margin: 0.6em 0 1em; padding: 0; } /* the page scrolls here, not the pane */
  .work-pane { display: flex; flex-direction: column; margin-top: 0; height: calc(100dvh - var(--header-h) - 44px - 12px); }
  .work-pane > .editor-card, .work-pane > .console { flex: 1; min-height: 0; }
  .solve[data-phone="code"] .work-pane > .console, .solve[data-phone="result"] .work-pane > .editor-card { display: none; }
  .toolbar { gap: 0.5em; }
  .toolbar button { padding: 0.45em 1em; }

  /* Tables: tighter cells; the problem list drops its acceptance column. */
  .table th, .table td { padding: 0.6em 0.55em; }
  .table td.status { width: 1.6em; }
  .table td.id { width: 2.2em; }
  .table .acceptance { display: none; }
  .table .pill { font-size: 0.7rem; padding: 0.1em 0.5em; }
  .toolbar .vim-toggle { display: none; } /* phone keyboards have no Esc */
  .editor-settings-menu .es-row.vim-toggle { display: none; }
  .toolbar .editor-modes { display: none; } /* no scratchpad on phones yet (decision 0024) */
  .stmt-tabs .draw-tab { display: none; } /* nor the drawing pad (decision 0052) */
  .toolbar select { max-width: 9.5em; }

  /* Cards: narrower padding; a header's note wraps under its title when they don't fit side by side. */
  .card-body { padding: 0.95em 1em; }
  .card-head { padding: 0.7em 1em; flex-wrap: wrap; gap: 0.25em 0.8em; }
  .card-head > h2 { flex: 1 0 auto; }
  .list-plain li { flex-wrap: wrap; gap: 0.2em 0.8em; }
  .grid-2 { gap: 1em; }

  /* Habit: the tile with the dog spans both columns (the dog needs room); the calendar fits. */
  .stat-tiles { gap: 0.6em; }
  .stat-tile:has(.quizzical-dog, .happy-dog, .fetch-dog) { grid-column: 1 / -1; min-height: 110px; }
  .stat-tile .fetch-v .fetch-dog { width: 160px; height: 65px; }
  .habit-cal { display: grid; grid-template-columns: max-content repeat(7, minmax(0, 1fr)); gap: 3px; }
  .hd { height: 2em; font-size: 0.7rem; }
  .hd-week { padding-right: 0.3em; font-size: 0.66rem; }
  .stat-tile:has(.quizzical-dog, .happy-dog, .fetch-dog) ~ .stat-tile:last-child { grid-column: 1 / -1; }
  .stat-tile:has(.quizzical-dog, .happy-dog, .fetch-dog) .today-slots { max-width: calc(100% - 150px); }
  .card-head > h2 { flex: 1 1 auto; min-width: 0; }
  .card-head h2 .due-tag, .card-head h2 .owes-sub, .card-head h2 .covered-sub { white-space: normal; }

  /* Leaderboard: rank, user, solved, streak and balance (the rest is on profiles). */
  .table.leaderboard th:nth-child(n+4):nth-child(-n+7), .table.leaderboard td:nth-child(n+4):nth-child(-n+7),
  .table.leaderboard th:nth-child(10), .table.leaderboard td:nth-child(10) { display: none; }
  .table.leaderboard img.avatar { width: 34px; height: 34px; }

  /* Tabs scroll sideways rather than wrap; tables too wide for the screen scroll in their card. */
  .profile-tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .profile-tabs::-webkit-scrollbar { display: none; }
  .profile-tabs .tab { flex: none; white-space: nowrap; }

  /* Avatars: the main picture centered, shuffle cards two to a row, dialogs' bench slots 2x2. */
  .avatar-detail { flex-direction: column; }
  .avatar-detail-pic { align-self: center; }

  /* The header has room again (the nav is at the bottom): the theme picker comes back, compact. */
  .theme-picker { display: flex; }
  .theme-btn { gap: 0.35em; padding: 0.3em 0.45em; }
  .theme-picker .theme-btn .theme-name[data-for] { display: none; }
  .theme-menu { position: fixed; left: 0.8em; right: 0.8em; top: calc(var(--header-h) + 6px); width: auto; }
}

/* ---------- mock interviews (decision 0025) ---------- */
.phone-only { display: none; }
@media (max-width: 720px) { .phone-only { display: block; } }
.mock-cards { margin-bottom: 1.2em; }
.mock-card.disabled { opacity: 0.6; }
.pill.soon { font-size: 0.72rem; background: var(--surface-3); color: var(--muted); }
.mock-form { display: grid; gap: 0.5em; }
.mock-form label { font-weight: 500; }
.mock-form fieldset { border: 0; padding: 0; margin: 0.3em 0; display: grid; gap: 0.45em; }
.mock-form legend { font-weight: 500; margin-bottom: 0.3em; }
.mock-form .radio { display: flex; align-items: center; gap: 0.5em; font-weight: 400; }
.mock-form .pp { margin-left: 1.6em; }
.mock-form input[name="problem"] { width: 100%; box-sizing: border-box; }
/* The problem picker (problempicker.js): suggestions under the box, each with its difficulty, acceptance and tags. */
.pp { position: relative; }
.pp-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: min(26em, 60vh); overflow-y: auto;
  margin: 0; padding: 0.3em; list-style: none; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 10px 28px rgb(0 0 0 / 0.18);
}
.pp-list[hidden] { display: none; }
.pp-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 3.2em; align-items: center; column-gap: 0.7em; row-gap: 0.25em;
  padding: 0.45em 0.6em; border-radius: var(--radius-sm); cursor: pointer;
}
.pp-row:hover, .pp-row.active { background: var(--surface-2); }
.pp-row.active { box-shadow: inset 2px 0 0 var(--accent); }
.pp-main { display: flex; align-items: baseline; gap: 0.55em; min-width: 0; }
.pp-id { color: var(--muted); font-size: 0.8rem; min-width: 2.2em; text-align: right; }
.pp-title { font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-hidden { flex: none; font-size: 0.7rem; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 999px; padding: 0 0.5em; }
.pp-acc { font-size: 0.8rem; color: var(--fg-2); text-align: right; }
.pp-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.3em; padding-left: 2.75em; }
.pp-tag { font: 0.72rem var(--mono); color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 0.05em 0.4em; }
.pp-row:hover .pp-tag, .pp-row.active .pp-tag { background: var(--surface-3, var(--surface)); }
.pp-empty, .pp-more { padding: 0.6em; list-style: none; }
.mock-room { display: flex; flex-direction: column; gap: 8px; height: calc(100vh - var(--header-h)); min-height: 30em; padding: 8px; box-sizing: border-box; background: var(--bg); }
.mock-strip { display: flex; align-items: center; gap: 1em; padding: 0.5em 0.9em; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.mock-strip .spacer { flex: 1; }
.mock-title h1 { font-size: 1.15rem; margin: 0.1em 0 0; }
.mock-people { display: flex; flex-wrap: wrap; gap: 0.35em; list-style: none; margin: 0; padding: 0; }
.mock-people li { display: flex; align-items: center; gap: 0.35em; padding: 0.15em 0.6em 0.15em 0.2em; border-radius: 999px; background: var(--surface-2); font-size: 0.85rem; }
.mock-people .avatar { border-radius: 50%; }
.mock-host { font: 600 0.65rem var(--mono); text-transform: uppercase; color: var(--accent); }
.mock-invite { display: flex; gap: 0.4em; }
.mock-invite input { width: 19em; font: 0.8rem var(--mono); }
.mock-panes { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, var(--mock-left, 50%)) 6px minmax(0, 1fr); column-gap: 1px; }
.mock-work > .splitter.horizontal { flex: none; height: 6px; }
.mock-work { display: flex; flex-direction: column; background: none; border: 0; }
.mock-work .editor-card { flex: 1; min-height: 0; }
.mock-doc { display: flex; flex-direction: column; padding: 0; }
.mock-doc-head { display: flex; align-items: center; gap: 0.6em; padding: 0.5em 0.8em; border-bottom: 1px solid var(--border); }
.mock-doc-head .spacer { flex: 1; }
.mock-doc .statement { flex: 1; overflow: auto; padding: 1em 1.5em 2em; }
.mock-doc .mock-md { flex: 1; min-height: 0; }
.mock-doc .mock-draw { flex: 1; min-height: 0; }
.mock-doc [hidden] { display: none; }
.mock-people li { border: 1px solid var(--who, transparent); transition: opacity 0.2s; }
.mock-people li.away { opacity: 0.4; border-color: transparent; }
.mock-people li { position: relative; }
.mock-people li.mock-invited { background: none; border: 1.5px dashed var(--border-strong); color: var(--muted); }
.mock-people li.mock-invited .avatar { opacity: 0.55; }
.mock-badge { position: absolute; left: 18px; bottom: -3px; min-width: 15px; height: 13px; padding: 0 2px; box-sizing: border-box; border-radius: 7px;
  background: var(--surface-3); border: 1.5px solid var(--surface); color: var(--fg-2); font-size: 10px; font-weight: 700; line-height: 10px;
  display: inline-flex; align-items: center; justify-content: center; }
.mock-badge.joined { background: var(--ok); color: var(--ok-fg); animation: fr-drop-in 0.25s ease-out; }
.mock-people li[role="button"] { cursor: pointer; }
.mock-people li[role="button"]:hover { background: var(--surface-3); }
.mock-people li[role="button"]:focus-visible { outline: 2px solid var(--who, var(--accent)); outline-offset: 1px; }
.mock-hint { position: fixed; z-index: 40; padding: 0.3em 0.6em; font-size: 0.8rem; background: var(--surface-3); color: var(--fg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
.mock-hint[hidden] { display: none; }
/* Clicking someone's chip flashes their caret (y-codemirror.next draws it in their colour). */
.cm-ySelectionCaret.mock-flash { animation: mock-flash 0.45s ease-out 3; }
@keyframes mock-flash { 0% { box-shadow: 0 0 0 0 var(--flash, var(--accent)); } 100% { box-shadow: 0 0 0 9px transparent; } }
.mock-status { font: 0.75rem var(--mono); color: var(--muted); }
.mock-work .editor-card { min-height: 8em; }
/* It wraps (Run and Submit to a second row) rather than clip them when the pane is narrow. */
.mock-work .toolbar { gap: 0.45em; flex-wrap: wrap; row-gap: 0.4em; }
.mock-work .toolbar #mock-lang { width: auto; min-width: 6.5em; flex-shrink: 1; }
.mock-work .toolbar .lsp-chip { flex-shrink: 1; }
.mock-work .toolbar > :not(.lsp-chip):not(.spacer):not(#mock-lang) { flex-shrink: 0; white-space: nowrap; }
.mock-console { flex: none; height: var(--mock-console, 38%); min-height: 4.5em; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mock-console .console-tabs { display: flex; align-items: center; }
.mock-console .console-tabs .spacer { flex: 1; }
.mock-console .console-drawer { margin-left: 0; }
.mock-work.drawer-moving > .mock-console { transition: height 0.22s ease; }
@media (prefers-reduced-motion: reduce) { .mock-work.drawer-moving > .mock-console { transition: none; } }
.mock-console .tab-body { flex: 1; min-height: 0; overflow: auto; }
.mock-console .mock-input { display: flex; flex-direction: column; gap: 0.5em; }
.mock-console .mock-input[hidden] { display: none; }
.mock-console .input-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em; }
.mock-stdin { flex: 1; min-height: 4em; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.mock-cases-bar { display: flex; align-items: center; gap: 0.6em; }
.mock-cases-bar .input-pills { flex: 1; }
.mock-console .input-pill.edited::after { content: " •"; color: var(--medium); }
.mock-runner { font-size: 0.8rem; color: var(--medium); padding-right: 0.6em; }
.mock-runner::before { content: "● "; animation: mock-pulse 1.2s ease-in-out infinite; }
@keyframes mock-pulse { 50% { opacity: 0.25; } }
.mock-run-head { margin: 0 0 0.5em; font-size: 0.88rem; }
/* Text someone just added to the problem (mockroom.js): the theme's accent, faintly, and full-strength
   text, fading back to normal. (The 100% keyframe is the element's own style.) */
.mock-fresh { border-radius: 2px; animation: mock-fresh 2.6s ease-in forwards; }
@keyframes mock-fresh {
  0%, 20% { background-color: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--fg); }
  100% { background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) { .mock-fresh { animation-timing-function: steps(1, end); } }
.mock-status[data-state="connected"] { color: var(--ok); }
.mock-status[data-state="connected"]::before { content: "● "; }
.mock-status[data-state="reconnecting"] { color: var(--medium); }
.mock-soon { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.mock-soon { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2em; }
.mock-room .statement h1 { display: block; font-size: 1.4rem; margin: 0.2em 0 0.5em; } /* the pane is the whole document, title and all */
.mock-soon p { margin: 0.3em 0; max-width: 28em; }
/* Slice 4: the timer, the host's menu, the chip menu, and the archive. */
/* The timer: a progress ring that's the play/pause button, the time (it opens the popover). */
.mock-timer { position: relative; display: flex; align-items: center; gap: 0.5em; }
.mock-timer-go { position: relative; width: 32px; height: 32px; padding: 0; border: 0; background: none; display: grid; place-items: center; color: var(--fg); border-radius: 50%; cursor: pointer; }
.mock-timer-go:disabled { cursor: default; opacity: 0.6; }
.mock-timer-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mock-ring { position: absolute; inset: 0; width: 32px; height: 32px; }
.mock-ring-track { fill: none; stroke: var(--surface-3); stroke-width: 3; }
.mock-ring-arc { fill: none; stroke: var(--fg); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 0 82; transition: stroke-dasharray 0.25s linear; }
.mock-ring-icon { position: relative; width: 10px; height: 10px; fill: currentColor; }
.mock-icon-play { width: 11px; height: 11px; }
.mock-timer .mock-icon-pause, .mock-timer.running .mock-icon-play { display: none; }
.mock-timer.running .mock-icon-pause { display: block; }
.mock-timer.down .mock-ring-arc { stroke: var(--accent); }
.mock-timer.paused .mock-timer-go { color: var(--accent); }
.mock-timer.paused .mock-ring-arc { stroke: var(--muted); opacity: 0.6; }
.mock-timer.over .mock-timer-go { color: var(--hard); }
.mock-timer.over .mock-ring-track { stroke: var(--hard); fill: color-mix(in srgb, var(--hard) 12%, transparent); }
.mock-timer.over .mock-ring-arc { stroke: none; }
.mock-timer.over .mock-ring { animation: mock-pulse 1s ease-in-out 3; } /* reaching zero flashes; it never ends anything */
.mock-timer-read { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 0.1em 0.35em; border: 0; border-radius: var(--radius-sm); background: none; color: var(--fg); line-height: 1.15; cursor: pointer; text-align: left; }
.mock-timer-read:hover, .mock-timer-read[aria-expanded="true"] { background: var(--surface-2); }
.mock-timer-clock { font: 600 0.95rem var(--mono); font-variant-numeric: tabular-nums; min-width: 3.4em; }
.mock-timer-sub { font: 500 0.68rem var(--mono); color: var(--muted); white-space: nowrap; }
.mock-timer.paused .mock-timer-clock { color: var(--muted); }
.mock-timer.over .mock-timer-clock, .mock-timer.over .mock-timer-sub { color: var(--hard); }
.mock-timer .mock-timer-pop { position: absolute; top: calc(100% + 8px); left: 0; width: 19.5em; gap: 0.85em; padding: 0.85em; }
.mock-timer-pop[hidden], .mock-timer-from[hidden] { display: none; }
.mock-timer-pop-head { display: flex; align-items: baseline; justify-content: space-between; }
.mock-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); }
.mock-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; height: 28px; border: 0; border-radius: 5px; background: none; color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.mock-seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14); }
.mock-seg svg, .mock-timer-foot svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mock-timer-from { display: flex; flex-direction: column; gap: 0.5em; }
.mock-timer-presets { display: flex; flex-wrap: wrap; gap: 0.4em; }
.mock-timer-presets button { height: 28px; padding: 0 0.7em; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--fg); font: 500 0.8rem var(--mono); }
.mock-timer-presets button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.mock-timer-custom { display: inline-flex; align-items: center; gap: 0.25em; height: 28px; padding: 0 0.3em 0 0.7em; border: 1px solid var(--border); border-radius: 999px; font-size: 0.78rem; color: var(--muted); }
.mock-timer-custom input { width: 3em; padding: 0; border: 0; background: none; color: var(--fg); font: 500 0.8rem var(--mono); text-align: right; -moz-appearance: textfield; }
.mock-timer-custom input::-webkit-inner-spin-button { -webkit-appearance: none; }
.mock-timer-foot { display: flex; align-items: center; gap: 0.5em; padding-top: 0.75em; border-top: 1px solid var(--border); }
.mock-timer-foot .spacer { flex: 1; }
.mock-timer-foot .link { display: inline-flex; align-items: center; gap: 0.35em; color: var(--muted); font-size: 0.85rem; }
.mock-locked { color: var(--medium); background: color-mix(in srgb, var(--medium) 14%, transparent); text-transform: none; white-space: nowrap; }
.mock-locked[hidden], .mock-host-menu[hidden], .mock-menu[hidden] { display: none; }
.mock-host-menu { position: relative; }
.mock-menu { display: flex; flex-direction: column; gap: 0.15em; min-width: 16em; padding: 0.4em; z-index: 40;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
.mock-host-menu .mock-menu { position: absolute; right: 0; top: calc(100% + 6px); width: 21em; }
.mock-person-menu { position: fixed; }
.mock-menu-item { display: flex; align-items: center; gap: 0.5em; padding: 0.4em 0.55em; margin: 0; border-radius: var(--radius-sm); font-size: 0.88rem; text-align: left; }
.mock-menu button.mock-menu-item { background: none; border: 0; width: 100%; cursor: pointer; color: var(--fg); }
.mock-menu label.mock-menu-item { cursor: pointer; }
.mock-menu .mock-menu-item:hover { background: var(--surface-2); }
.mock-menu .mock-menu-item.danger { color: var(--hard); }
.mock-menu p.mock-menu-item:hover { background: none; }
.mock-swap { flex-wrap: wrap; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0; padding: 0.6em 0.55em; }
.mock-swap label { width: 100%; font-weight: 500; }
.mock-swap .pp { flex: 1; min-width: 0; }
.mock-swap input { width: 100%; box-sizing: border-box; }
.mock-menu .mock-swap:hover { background: none; }
.mock-archive { height: auto; }
.mock-archive .mock-panes { flex: none; height: 62vh; min-height: 24em; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 8px; } /* (no splitter here) */
.mock-archive .editor-card { flex: 1; }
.mock-ended-note { margin: 0; }
.mock-timeline .mock-run-row { cursor: pointer; }
.mock-timeline .mock-run-row:hover, .mock-timeline .mock-run-row[aria-expanded="true"] { background: var(--surface-2); }
.mock-timeline .mock-run-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mock-run-detail > td { padding: 0.8em 1em 1.2em; background: var(--bg); }
.mock-run-files { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1em; margin-top: 1em; }
.mock-run-files h4 { margin: 0 0 0.4em; }
.mock-run-files pre.code { max-height: 28em; overflow: auto; margin: 0; }
@media (max-width: 720px) { .mock-panes, .mock-invite, .mock-people, .mock-timer, .mock-host-menu { display: none; } .mock-room { height: auto; min-height: 0; } }

/* Daily questions (decision 0027): a card fixed in the left margin when the window leaves room
   for it beside the 1120px column; swipe tiles atop the Problems page otherwise. */
.daily-tag { display: inline-block; font: 600 0.72rem var(--font); color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 0.05em 0.6em; margin-left: 0.5em; white-space: nowrap; vertical-align: 0.08em; }
.meta .daily-tag { margin-left: 0; }
.daily-tag.hidden-tag { color: var(--muted); background: var(--surface-2); }
.daily-tag.claimed { text-decoration: line-through; color: var(--muted); background: var(--surface-2); }
.sun { color: var(--accent); flex: none; }
.daily-got { color: var(--ok); font-weight: 600; }
.daily-reward { color: var(--habit); font-weight: 700; }
/* A daily's hint that solving it that day mints a trophy (dailies.templ mintHex): a tiny hex in the tiers' colors. */
.mint-hex { display: inline-block; margin-left: 0.35em; padding: 0.1em; vertical-align: -0.12em; cursor: help; }
.mint-hex > span { display: block; width: 0.85em; height: 0.98em; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(150deg, var(--link) 15%, #c65bdc 55%, #e3b341 90%); }
.daily-tag.claimed .mint-hex { display: none; }
.daily-note { color: var(--muted); font-size: 0.75rem; }
.daily-ends { color: var(--muted); font-size: 0.76rem; }
.daily-row-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5em; font-size: 0.74rem; font-weight: 600; }
.daily-title { font-weight: 600; }
.daily-num { margin-left: 0.5em; padding: 0.05em 0.4em; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font: 600 0.7rem var(--mono); }
.daily-tile-tags { display: inline-flex; align-items: center; }
.daily-row.done .daily-title, .daily-tile.done .daily-title { color: var(--muted); }
.daily-row.done, .daily-tile.done {
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in srgb, var(--muted) 16%, transparent) 7px 9px);
}
.daily-row.done > *, .daily-tile.done > * { opacity: 0.6; }
.daily-row.done .daily-title, .daily-tile.done .daily-title { text-decoration: line-through; text-decoration-color: var(--muted); }
.daily-tile.done { border-color: var(--border); }

.daily-rail { display: none; }
@media (min-width: 1600px) {
  /* A zero-flow rail down the problem list's left side: the card starts level with the list and
     sticks under the header while it scrolls. */
  .listing-card { position: relative; }
  .daily-rail { display: block; position: absolute; top: 0; bottom: 0; right: calc(100% + 20px); width: 200px; }
  .daily-strip { display: none; }
}
.daily-float {
  position: sticky; top: calc(var(--header-h) + 1.2em); z-index: 10;
  max-height: calc(100vh - var(--header-h) - 2.4em); overflow-x: hidden; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow), 0 6px 20px rgba(16, 18, 24, 0.1);
}
.daily-float-head {
  display: flex; align-items: center; gap: 0.45em; width: 100%; box-sizing: border-box; padding: 0.75em 0.8em 0.55em;
  border: 0; border-radius: 10px 10px 0 0; background: none; color: var(--fg); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
  transition: padding-bottom 0.25s ease;
}
.daily-float-head:hover { background: var(--surface-2); }
.daily-float-head .daily-ends { margin-left: auto; }
.daily-chevron { color: var(--muted); flex: none; transition: transform 0.25s ease; }
.daily-left { display: none; font-size: 0.74rem; font-weight: 600; color: var(--habit); white-space: nowrap; }
.daily-float-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.25s ease; }
.daily-float-inner { min-height: 0; overflow: hidden; }
.daily-float.collapsed .daily-float-body { grid-template-rows: 0fr; }
.daily-float.collapsed .daily-float-head { padding-bottom: 0.75em; border-radius: 10px; }
.daily-float.collapsed .daily-chevron { transform: rotate(180deg); }
.daily-float.collapsed .daily-left { display: inline; margin-left: auto; }
.daily-float.collapsed .daily-ends { display: none; }
.daily-float:not(.ready) .daily-float-body, .daily-float:not(.ready) .daily-float-head, .daily-float:not(.ready) .daily-chevron { transition: none; }
@media (prefers-reduced-motion: reduce) { .daily-float-body, .daily-float-head, .daily-chevron { transition: none; } }
.daily-row { display: flex; flex-direction: column; gap: 0.25em; padding: 0.6em 0.8em; border-top: 1px solid var(--border); color: var(--fg); font-size: 0.82rem; text-decoration: none; }
a.daily-row:hover { background: var(--surface-2); text-decoration: none; }
.daily-row.empty { color: var(--muted); }
.daily-float-foot { display: flex; flex-direction: column; gap: 0.4em; padding: 0.6em 0.8em 0.7em; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--muted); }
.daily-bar { display: block; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.daily-bar span { display: block; height: 100%; background: var(--habit); }

.daily-strip { margin-bottom: 1.2em; }
.daily-strip-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35em 0.6em; margin-bottom: 0.6em; }
.daily-strip-head .daily-spacer { flex: 1; }
.daily-all-done { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.7em 1em; margin: 0; }
.daily-all-done .daily-avatar { margin-left: auto; font-weight: 600; }
.daily-tiles { display: flex; gap: 0.7em; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 6px; margin: -4px -4px 0; scrollbar-width: thin; }
.daily-tile {
  flex: none; width: 236px; box-sizing: border-box; scroll-snap-align: start; display: flex; flex-direction: column; gap: 0.55em;
  padding: 0.85em 0.9em; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--fg); text-decoration: none;
}
a.daily-tile:hover { text-decoration: none; border-color: var(--border-strong); }
.daily-tile.todo { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.daily-tile.empty { border-style: dashed; border-color: var(--border-strong); justify-content: center; }
.daily-tile .daily-title { font-size: 0.98rem; }
.daily-tile .pill { font-size: 0.72rem; }

.daily-earned { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; padding: 0.5em 0.7em; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--habit) 10%, transparent); font-size: 0.86rem; }
.daily-earned strong { color: var(--habit); }
.admin-dailies { padding: 1em 1.2em; }
.admin-dailies .inline-form { display: flex; gap: 0.4em; }
@media (min-width: 721px) { .daily-tile { flex: 1 1 236px; } }
/* Short tiles, so the strip leaves room for the list: one-line titles, and no note (a solved
   tile's hatching says it). */
.daily-strip { margin-bottom: 1em; }
.daily-strip-head { margin-bottom: 0.45em; }
.daily-tile { gap: 0.3em; padding: 0.55em 0.8em; }
.daily-tile .daily-title { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily-tile .daily-note { display: none; }
@media (max-width: 720px) {
  .daily-tiles { gap: 0.5em; }
  .daily-tile { width: 200px; padding: 0.5em 0.7em; }
  .daily-tile .daily-title { font-size: 0.88rem; }
}

/* Submissions tab (statement pane): the list, one submission's detail, and
   how an accepted one compares with others in its language (perf.templ). */
.subs-pane { padding-top: 4px; }
.subs-table th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: left; }
.subs-table td, .subs-table th { white-space: nowrap; }
.subs-row { cursor: pointer; }
.subs-row:hover, .subs-row:focus-visible { background: var(--surface-2); outline: none; }
.sub-detail { display: flex; flex-direction: column; gap: 14px; }
.sub-detail-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sub-detail-meta { margin-top: -8px; }
.sub-code h3 { margin: 0 0 6px; font-size: 14px; }
.sub-code pre.code { max-height: 420px; overflow: auto; }
.perf { display: flex; flex-direction: column; gap: 10px; }
.perf-first, .perf-note { margin: 0; }
.perf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.perf-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.perf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.perf-value { font-size: 18px; }
.perf-beats strong { color: var(--accent); font-size: 16px; }
.perf-hist { display: flex; align-items: flex-end; gap: 2px; height: 56px; border-bottom: 1px solid var(--border); }
.perf-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.perf-bar span { display: block; width: 100%; background: var(--border-strong); border-radius: 2px 2px 0 0; }
.perf-bar.mine span { background: var(--accent); }
.perf-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: -4px; }

/* ---------- versus (decision 0029) ---------- */
.vs-sub { margin: 0.35em 0 0; }
.vs-diffs { display: flex; gap: 0.5em; margin: 0.1em 0 0 1.6em; flex-wrap: wrap; }
.vs-diff { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.3em 0.75em; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-weight: 600 !important; cursor: pointer; }
.vs-diff:has(input:checked) { border-color: currentColor; background: color-mix(in srgb, currentColor 10%, transparent); }
.vs-pick .small { margin: 0 0 0.3em 1.6em; }
/* The half of the picker not in use is dimmed (clicking it switches: versus.js). */
.vs-pick:has(input[name="pick"][value="chosen"]:checked) .vs-diffs,
.vs-pick:has(input[name="pick"][value="chosen"]:checked) .vs-diffs + .small,
.vs-pick:has(input[name="pick"][value="random"]:checked) input[name="problem"] { opacity: 0.45; }
.vs-advanced summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.vs-advanced-body { display: flex; flex-wrap: wrap; gap: 0.8em 1.6em; align-items: flex-end; padding-top: 0.7em; }
.vs-advanced-body label { display: flex; flex-direction: column; gap: 0.3em; font-size: 0.85rem; }
.vs-advanced-body label.check { flex-direction: row; align-items: center; gap: 0.45em; }
.vs-won { color: var(--ok); }
.vs-lost { color: var(--hard); }
.vs-live-tag { color: var(--medium); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; display: inline-flex; align-items: center; gap: 0.45em; }
.vs-beacon { width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--medium); box-shadow: 0 0 0 0 color-mix(in srgb, var(--medium) 60%, transparent); animation: vs-beacon 1.4s ease-out infinite; }
@keyframes vs-beacon {
  0% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--medium) 60%, transparent); }
  50% { opacity: 0.35; }
  100% { opacity: 1; box-shadow: 0 0 0 0.45em transparent; }
}
@media (prefers-reduced-motion: reduce) { .vs-beacon { animation: none; } }
.vs-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
button.danger, .btn.vs-danger { background: var(--hard); border-color: var(--hard); color: #fff; font-weight: 600; }
button.danger:hover, .btn.vs-danger:hover { background: var(--hard); filter: brightness(1.08); }

/* The lobby. */
.vs-lobby-head h1 .pill { font-size: 0.8rem; vertical-align: middle; margin-left: 0.4em; }
.vs-invite { display: flex; }
.vs-invite input { font: 0.82rem var(--mono); width: 22em; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.vs-invite button { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.vs-lobby { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.2em; align-items: start; }
.vs-lobby-main { display: flex; flex-direction: column; gap: 1em; }
.vs-seats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8em; }
.vs-seat {
  position: relative; box-sizing: border-box; min-height: 13.5em; padding: 1.3em 0.8em 1em; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; gap: 0.45em;
}
.vs-seat.me { border: 2px solid var(--accent); }
.vs-seat .avatar, .vs-chip .avatar, .vs-placings .avatar, .vs-who .avatar { border-radius: 50%; }
.vs-seat.empty { background: none; border: 1.5px dashed var(--border-strong); color: var(--muted); justify-content: center; font-size: 0.85rem; }
.vs-plus { font-size: 1.6rem; line-height: 1; }
.vs-kick { position: absolute; top: 0.25em; right: 0.25em; margin: 0; }
.vs-kick button { font-size: 1.15rem; color: var(--muted); }
.vs-ready { font-size: 0.8rem; font-weight: 700; padding: 0.2em 0.8em; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.vs-ready.on { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.vs-me { display: flex; align-items: center; gap: 1.1em; padding: 0.9em 1.1em; }
.vs-me form { margin: 0; }
.vs-lang { display: flex; flex-direction: column; gap: 0.25em; font-size: 0.8rem; color: var(--muted); }
.vs-me-text { flex: 1; display: flex; flex-direction: column; gap: 0.15em; }
.vs-ready-btn { padding: 0.6em 1.4em; font-weight: 700; font-size: 1rem; }
.vs-ready-btn.on { border: 2px solid var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.vs-host form { margin: 0; }
.vs-host-body { display: flex; flex-direction: column; gap: 1em; }
.vs-host-body p { margin: 0.2em 0 0; }
.vs-change summary { cursor: pointer; color: var(--link); font-size: 0.85rem; margin-top: 0.3em; }
.vs-change form { margin-top: 0.6em; }
.vs-save-status { min-height: 1.2em; }
.vs-save-status.error { color: var(--hard); }
.vs-change .vs-diffs, .vs-change .vs-pick .small { margin-left: 0; }
.vs-start { width: 100%; justify-content: center; background: none; border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* The countdown. */
.vs-countdown { min-height: calc(100vh - var(--header-h) - 5em); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.8em; }
.vs-cd-label { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.vs-cd-players { display: flex; align-items: center; gap: 2em; --cd: 230px; }
.vs-cd-players.n3 { --cd: 200px; gap: 1.7em; }
.vs-cd-players.n4 { --cd: 172px; gap: 1.3em; }
.vs-cd-player { display: flex; flex-direction: column; align-items: center; gap: 0.45em; font-size: 1.2rem; }
.vs-cd-player .mono { font-size: 0.85rem; }
.vs-cd-avatar { position: relative; width: var(--cd); height: var(--cd); }
.vs-cd-avatar img, .vs-cd-avatar canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }
.vs-cd-avatar canvas { position: absolute; inset: 0; opacity: 0; }
.vs-cd-avatar canvas.on { opacity: 1; }
.vs-cd-vs { font: 800 1.3rem var(--mono); color: var(--muted); margin-bottom: 3.5em; }
.vs-cd-ring { position: relative; width: 112px; height: 112px; display: grid; place-items: center; }
.vs-cd-ring svg { position: absolute; inset: 0; }
.vs-cd-ring circle, .vs-clock circle { fill: none; }
.vs-cd-ring circle { stroke-width: 6; }
.vs-cd-ring .track, .vs-clock .track { stroke: var(--border-strong); }
.vs-cd-ring .arc, .vs-clock .arc { stroke: var(--accent); stroke-linecap: round; }
.vs-cd-ring span { font: 800 3.2rem var(--mono); }

/* The battle: its strip above the problem page, which shrinks to fit. */
main.wide:has(.solve.in-battle) { display: flex; flex-direction: column; height: calc(100vh - var(--header-h)); }
.solve.in-battle { height: auto; flex: 1; min-height: 0; }
.vs-strip { display: flex; align-items: center; gap: 1em; padding: 0.45em 1em; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.vs-clock { display: flex; align-items: center; gap: 0.5em; }
.vs-clock circle { stroke-width: 3.5; }
.vs-clock .arc { stroke-dasharray: 0 88; }
.vs-clock-read { display: flex; align-items: baseline; line-height: 1; }
.vs-clock-read [data-vs-clock] { font-weight: 700; font-size: 1.2rem; }
.vs-clock-cap { font-size: 0.82rem; color: var(--muted); margin-left: 0.15em; }
.vs-clock.over .arc { stroke: var(--muted); }
.vs-strip-problem { display: flex; flex-direction: column; min-width: 0; padding-left: 1em; border-left: 1px solid var(--border); line-height: 1.3; }
.vs-strip-problem strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28em; }
.vs-strip .spacer { flex: 1; }
.vs-chips { display: flex; gap: 0.5em; flex-wrap: wrap; }
.vs-chip { display: flex; align-items: center; gap: 0.5em; padding: 0.22em 0.85em 0.22em 0.3em; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; }
.vs-chip.me { border: 2px solid var(--accent); }
.vs-chip.solved .vs-chip-status { color: var(--ok); font-weight: 600; }
.vs-chip.first { border-color: color-mix(in srgb, var(--medium) 50%, transparent); background: color-mix(in srgb, var(--medium) 10%, transparent); }
.vs-chip.first .vs-chip-status { color: var(--medium); font-weight: 700; }
.vs-chip.out { opacity: 0.6; }
.vs-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
/* typing/idle: a badge on the avatar, so the chip never changes size for it */
.vs-chip-pic { position: relative; display: inline-flex; flex: none; }
.vs-chip-badge { position: absolute; right: -6px; bottom: -4px; display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 19px; height: 13px; padding: 0 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font: 700 9px/1 var(--mono); }
.vs-chip-badge i { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); animation: vs-typing 1.1s ease-in-out infinite; }
.vs-chip-badge i:nth-child(2) { animation-delay: 0.15s; }
.vs-chip-badge i:nth-child(3) { animation-delay: 0.3s; }
@keyframes vs-typing { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-1.5px); } }
.vs-chip.resizing { overflow: hidden; white-space: nowrap; transition: width 0.25s ease; }
@media (prefers-reduced-motion: reduce) { .vs-chip-badge i { animation: none; opacity: 0.8; } .vs-chip.resizing { transition: none; } }
.vs-chip-name { font-weight: 600; }
.vs-chip-name .muted { font-weight: 400; font-size: 0.75rem; margin-left: 0.25em; }
.vs-chip-status { font-size: 0.75rem; color: var(--muted); }
.vs-chip-status.bad { color: var(--hard); }
.vs-hint-mark { display: inline-flex; align-items: center; gap: 0.1em; color: var(--accent); font-size: 0.75rem; margin-left: 0.3em; }
.vs-hint-mark .hint-icon { width: 12px; height: 12px; }
.vs-giveup { color: var(--muted); }
.vs-banner { padding: 0.4em 1em; font-size: 0.88rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.vs-banner.gold { background: color-mix(in srgb, var(--medium) 10%, var(--surface)); }

/* Dialogs: the results, and the confirmations. */
dialog.vs-results, dialog.vs-confirm {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--fg);
  padding: 1.4em 1.6em; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35); width: min(34em, calc(100% - 2em)); box-sizing: border-box;
}
dialog.vs-results::backdrop, dialog.vs-confirm::backdrop { background: rgba(0, 0, 0, 0.45); }
.vs-results h2, .vs-confirm h2 { margin: 0 0 0.3em; font-size: 1.25rem; }
.vs-results-head { display: flex; align-items: baseline; gap: 0.8em; flex-wrap: wrap; }
.vs-placings { list-style: none; padding: 0; margin: 1em 0; display: flex; flex-direction: column; gap: 0.4em; }
.vs-placings li { display: flex; align-items: center; gap: 0.7em; padding: 0.5em 0.8em; border-radius: 8px; background: var(--surface-2); }
.vs-placings li.first { background: color-mix(in srgb, var(--medium) 12%, var(--surface)); }
.vs-placings li.me strong { color: var(--accent); }
.vs-place { font-weight: 800; min-width: 2.6em; }
.vs-placings li.first .vs-place, td.vs-place.first { color: var(--medium); }
.vs-results-actions, .vs-confirm-actions { display: flex; justify-content: flex-end; gap: 0.6em; margin-top: 1em; }
.vs-confirm ul { padding-left: 1.2em; line-height: 1.55; }

/* The recap. */
.vs-recap-table { margin-bottom: 1.2em; overflow-x: auto; }
.vs-who { display: inline-flex; align-items: center; gap: 0.5em; }
.vs-recap-table tr.me td { background: var(--accent-soft); }
.vs-tl-head { min-width: 14em; }
.vs-timeline { position: relative; display: block; height: 14px; min-width: 12em; margin-right: 8px; border-radius: 7px; background: var(--surface-2); }
.vs-dot { position: absolute; top: 1px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--hard); border: 2px solid var(--surface); box-sizing: border-box; }
.vs-dot.ok { background: var(--ok); }
.vs-code-tabs { display: flex; gap: 0.2em; padding: 0 0.8em; border-bottom: 1px solid var(--border); }
.vs-code-tabs button { background: none; border: 0; border-radius: 0; padding: 0.7em 0.9em; color: var(--muted); }
.vs-code-tabs button.active { color: var(--fg); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.vs-code-panel { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 20em; }
.vs-code-panel[hidden] { display: none; }
.vs-code-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.vs-code-list button { display: flex; gap: 0.6em; align-items: center; justify-content: flex-start; background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0.6em 0.9em; text-align: left; font-size: 0.88rem; }
.vs-code-list button.active { background: var(--accent-soft); }
.vs-code-list button .mono { margin-left: auto; }
.vs-v { font-weight: 700; color: var(--hard); min-width: 2.8em; }
.vs-v.ok { color: var(--ok); }
.vs-v.final { color: var(--accent); }
.vs-code-view { padding: 0.9em 1.1em; min-width: 0; }
.vs-code-view pre.code { margin: 0.4em 0 0; overflow: auto; max-height: 36em; }
.vs-edge { max-width: 34em; margin: 3em auto; }
.vs-edge h1 { margin: 0.2em 0 0.4em; }

/* Versus spectating (decision 0029, slice 2). */
.vs-specs { display: flex; align-items: center; gap: 0.7em; padding: 0.75em 1.1em; flex-wrap: wrap; }
.vs-specs form { margin: 0; }
.vs-specs .spacer, .vs-watch-head .spacer, .vs-watch-bar .spacer { flex: 1; }
.vs-spec { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.85rem; padding: 0.15em 0.7em 0.15em 0.2em; border-radius: 999px; background: var(--surface-2); }
.vs-spec .avatar { border-radius: 50%; }
.vs-eye-icon { flex: none; color: var(--muted); vertical-align: -3px; }
.vs-eye { display: inline-flex; align-items: center; gap: 0.3em; font-size: 0.85rem; color: var(--muted); }
/* After the battle: who's still working, and Watch (decision 0029). */
.vs-watched { color: var(--fg); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.15em 0.7em; }
.vs-working-row { display: inline-flex; align-items: center; gap: 0.6em; flex-wrap: wrap; }
.vs-step .vs-working-row { flex-direction: column; gap: 0.35em; }
.vs-working { display: inline-flex; align-items: center; gap: 0.45em; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.vs-working.typing { color: color-mix(in srgb, var(--ok) 80%, var(--fg)); }
.vs-working-dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--muted); flex: none; }
.vs-working.typing .vs-working-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.btn.vs-watch-btn { padding: 0.25em 0.7em; font-size: 0.82rem; gap: 0.35em; border-color: var(--ok); color: var(--fg); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.btn.vs-watch-btn .vs-eye-icon { color: var(--ok); }
.vs-placings li .spacer { flex: 1; }
.vs-placings li:has(.vs-working-row) { flex-wrap: wrap; row-gap: 0.4em; }
.vs-placings .vs-working-row { flex-wrap: nowrap; margin-left: auto; }
.vs-chip-link { color: inherit; text-decoration: none; border-radius: 999px; }
.vs-chip-link:hover { text-decoration: none; }
.vs-chip-link:hover .vs-chip { background: var(--surface-2); }
.vs-chip-link.watching .vs-chip { border: 2px solid var(--accent); background: var(--accent-soft); }
.vs-watch-bar { display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap; padding: 0.45em 1em; font-size: 0.85rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.vs-attempt { font-weight: 700; color: var(--hard); padding: 0.1em 0.55em; border-radius: var(--radius-sm); background: var(--surface-2); }
.vs-attempt.ok { color: var(--ok); }
.vs-attempt .mono { font-weight: 400; color: var(--muted); }
main.wide:has(.vs-watch) { display: flex; flex-direction: column; height: calc(100vh - var(--header-h)); }
.vs-watch { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.75fr); gap: 8px; padding: 8px; background: var(--bg); }
.vs-watch-code { display: flex; flex-direction: column; }
.vs-watch-head { display: flex; align-items: center; gap: 0.6em; padding: 0.55em 0.9em; border-bottom: 1px solid var(--border); }
.vs-last-edit { font-size: 0.95rem; font-weight: 600; color: var(--fg); padding: 0.1em 0.6em; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.vs-last-edit.fresh { color: color-mix(in srgb, var(--ok) 80%, var(--fg)); border-color: color-mix(in srgb, var(--ok) 60%, var(--border)); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.vs-watch-editor { flex: 1; min-height: 0; }
.vs-watch-problem { overflow: auto; padding: 1.1em 1.4em 2em; }
.vs-watch-problem h2 { margin: 0.2em 0 0.6em; font-size: 1.25rem; }

/* Versus rematch (decision 0029, slice 3). */
.vs-rematch { display: flex; align-items: center; gap: 0.7em; flex-wrap: wrap; margin: 0.4em 0 0.2em; padding: 0.6em 0.8em; border-radius: var(--radius-sm); background: var(--surface-2); }
.vs-rematch form { margin: 0; }
.vs-votes { flex: 1; display: inline-flex; align-items: center; gap: 0.4em; flex-wrap: wrap; font-size: 0.88rem; }
.vs-votes .vs-spec { background: var(--accent-soft); }
.vs-vote.on { border: 2px solid var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.vs-recap-table + .vs-live, .page-head + .vs-live { margin-bottom: 1.2em; }

/* Versus records (decision 0029, slice 4). */
.vs-reward { font-size: 0.8rem; font-weight: 700; color: var(--habit, var(--accent)); margin-left: 0.3em; }
.vs-won-line { margin: 0.2em 0 0; font-weight: 600; }
.vs-places { margin: 0.8em 0 0.4em; }
.lb-tabs { display: flex; gap: 0.2em; margin: -0.4em 0 1em; border-bottom: 1px solid var(--border); }
.lb-tabs a { padding: 0.55em 0.9em; color: var(--muted); text-decoration: none; }
.lb-tabs a:hover { color: var(--fg); text-decoration: none; }
.lb-tabs a[aria-current] { color: var(--fg); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.vs-period { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.vs-period a { padding: 0.35em 0.85em; font-size: 0.85rem; color: var(--fg); text-decoration: none; }
.vs-period a + a { border-left: 1px solid var(--border-strong); }
.vs-period a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* The Versus logo (decision 0029): versusLogo in versus.templ. */
.vs-logo { flex: none; display: inline-block; vertical-align: middle; }
.vs-logo-a { fill: var(--accent); stroke: var(--accent); }
.vs-logo-b { fill: var(--easy); stroke: var(--easy); }
.vs-logo-x { fill: var(--fg); stroke: var(--fg); }
.vs-logo-cut { fill: var(--vs-logo-cut, var(--surface)); }
.page-head, .vs-countdown { --vs-logo-cut: var(--bg); }
.vs-title { display: inline-flex; align-items: center; gap: 0.35em; }
.vs-eyebrow { display: flex; align-items: center; gap: 0.45em; }
.vs-word { font-weight: 800; letter-spacing: 0.16em; font-size: 0.8rem; }
.vs-brand { display: inline-flex; align-items: center; gap: 0.45em; padding: 0 1em; border-left: 1px solid var(--border); }
.vs-brand + .vs-strip-problem { padding-left: 1em; }
.vs-cd-brand { display: flex; align-items: center; gap: 0.6em; }
.vs-cd-brand .vs-word { font-size: 1.15rem; }
.lb-tabs a.vs-tab { display: inline-flex; align-items: center; gap: 0.4em; }

/* The results' podium (3+ players). */
.vs-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 0.8em; margin: 1.1em 0 0.6em; }
.vs-step { display: flex; flex-direction: column; align-items: center; gap: 0.3em; text-align: center; min-width: 0; }
.vs-step .avatar { border-radius: 50%; }
.vs-step.me strong { color: var(--accent); }
.vs-step .small { line-height: 1.3; }
.vs-block { width: 100%; margin-top: 0.3em; border-radius: 8px 8px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1em; color: #2a2208; }
.vs-block .vs-place { font-size: 1.5rem; }
.vs-step.p1 .vs-block { height: 6.6em; background: #f2c14e; }
.vs-step.p2 .vs-block { height: 5.2em; background: #c9ced6; color: #1f2125; }
.vs-step.p3 .vs-block { height: 4.2em; background: #d9a27a; color: #3b1f0a; }
.vs-podium + .vs-placings:empty { display: none; }
.vs-num { color: var(--muted); font-weight: 500; }
.vs-reward.none { color: var(--muted); text-decoration: underline dashed; text-underline-offset: 3px; cursor: help; }
.versus-chip { display: inline-flex; align-items: center; gap: 0.3em; font: 600 0.68rem var(--mono); padding: 0.05em 0.55em 0.05em 0.35em; border-radius: 999px; color: var(--fg-2, var(--fg)); background: var(--surface-2); border: 1px solid var(--border); text-decoration: none; vertical-align: middle; }
a.versus-chip:hover { text-decoration: none; border-color: var(--accent); }

/* ---------- friends (decision 0037) ---------- */
.header-right { position: relative; }
.user-menu > summary { position: relative; }
.news-dot { display: none; position: absolute; top: 0; right: 0.15em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface); }
.has-news .news-dot { display: block; }
.menu-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 10px;
  background: var(--accent); color: var(--accent-fg); font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.menu-count[hidden] { display: none; }

/* The invites that drop from the avatar. */
.fr-drops { position: absolute; right: 0; top: calc(100% + 10px); width: min(344px, calc(100vw - 32px)); z-index: 60;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.fr-drops.open::before { content: ""; position: absolute; top: -7px; right: 18px; width: 12px; height: 12px; transform: rotate(45deg);
  background: var(--surface); border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong); }
.fr-drop { pointer-events: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); padding: 14px; display: flex; flex-direction: column; gap: 12px;
  animation: fr-drop-in 0.22s ease-out; transition: opacity 0.15s, transform 0.15s; }
.fr-drop.leaving { opacity: 0; transform: translateY(-4px); pointer-events: none; }
@keyframes fr-drop-in { from { opacity: 0; transform: translateY(-6px); } }
.fr-drop-top { display: flex; gap: 12px; align-items: flex-start; }
.fr-drop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fr-drop-kind { display: flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.fr-drop.mock .fr-drop-kind { color: var(--habit); }
.fr-drop-text { font-weight: 600; line-height: 1.35; }
.fr-drop-text a { color: var(--fg); }
.fr-drop-detail { color: var(--muted); font-size: 0.82rem; }
.fr-drop-x { flex: none; width: 28px; height: 28px; margin: -6px -6px 0 0; padding: 0; border: 0; background: none; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; }
.fr-drop-x:hover { color: var(--fg); }
.fr-drop-acts { display: flex; gap: 8px; align-items: center; }
.fr-drop-acts .spacer { flex: 1; }
.fr-drop-mute { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 0.82rem; }
@media (max-width: 720px) { .fr-drops { position: fixed; top: calc(var(--header-h) + 8px); right: 16px; } .fr-drops.open::before { display: none; } }
@media (prefers-reduced-motion: reduce) { .fr-drop { animation: none; transition: none; } }

/* The Friends page. */
.fr-page { max-width: 880px; margin: 0 auto; }
.fr-lede { margin: 0.2em 0 0; }
.fr-search { position: relative; width: 360px; max-width: 100%; }
.fr-search-box { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--muted); }
.fr-search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fr-search-box input { flex: 1; min-width: 0; border: 0; background: none; padding: 0; outline: none; box-shadow: none; color: var(--fg); }
.fr-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22); padding: 6px; display: flex; flex-direction: column; }
.fr-results[hidden] { display: none; }
.fr-result { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.fr-result:hover { background: var(--surface-2); }
.fr-result-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-section { margin-bottom: 1.8em; }
.fr-section h2 { display: flex; align-items: center; gap: 10px; font-size: 1rem; margin: 0 0 0.6em; }
.fr-sub { font-weight: 400; font-size: 0.9rem; }
.fr-count { min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 10px; background: var(--accent); color: var(--accent-fg);
  font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.fr-live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.fr-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.fr-none { margin: 0; }
.fr-mute { margin: 0.5em 0 0; display: flex; align-items: center; gap: 0.3em; flex-wrap: wrap; }
.fr-mute button.link { padding: 0; font-size: inherit; }
.fr-list .fr-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.fr-list .fr-row:last-child { border-bottom: 0; }
.fr-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fr-name { color: var(--fg); font-weight: 600; }
a.fr-name:hover { color: var(--link); }
.fr-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
.fr-form { margin: 0; display: inline; }
.fr-inline { display: inline; }
button.fr-quiet { color: var(--muted); }
.fr-av { position: relative; display: inline-flex; flex: none; }
.fr-av.online::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--surface); }
.fr-dim { opacity: 0.6; }
.fr-phone { display: none; }
.fr-kind.versus { color: var(--accent); font-weight: 600; }
.fr-kind.mock { color: var(--habit); font-weight: 600; }
.fr-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-h2h { width: 120px; flex: none; display: flex; flex-direction: column; gap: 1px; }
.fr-score { font: 0.85rem var(--mono); }
.fr-score .w { color: var(--ok); font-weight: 400; }
.fr-score .l { color: var(--hard); font-weight: 400; }
.fr-tiny { font-size: 0.7rem; }
.fr-more { position: relative; }
.fr-more > summary { list-style: none; cursor: pointer; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; }
.fr-more > summary::-webkit-details-marker { display: none; }
.fr-more > summary:hover, .fr-more[open] > summary { background: var(--surface-3); color: var(--fg); }
.fr-more .menu { z-index: 10; }
.menu button.fr-danger, button.fr-danger { color: var(--hard); }
.fr-state { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 0.85rem; padding-right: 4px; white-space: nowrap; }
.fr-state.ok { color: var(--ok); }
.fr-state.accent { color: var(--accent); }
.fr-accent { color: var(--accent); }
.fr-ref p { margin: 0 0 0.8em; }
.fr-ref p:last-child { margin-bottom: 0; }
.fr-ref .vs-invite input { flex: 1; width: auto; min-width: 0; }
@media (max-width: 720px) {
  .fr-search { width: 100%; }
  .fr-h2h { display: none; }
  .fr-list .fr-row { flex-wrap: wrap; }
  .fr-list .fr-invite .fr-who { flex-basis: calc(100% - 60px); }
  .fr-list .fr-invite .fr-acts { width: 100%; justify-content: flex-start; padding-left: 50px; }
  .fr-desktop { display: none !important; }
  .fr-phone { display: inline; }
}

/* The lobby's and room's "Invite friends" picker. */
.fr-head-acts { display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; }
.fr-picker { position: relative; }
.fr-picker > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fr-picker > summary::-webkit-details-marker { display: none; }
.fr-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  text-align: left; font-size: 0.9rem; }
.fr-pick-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.fr-pick-title { font-weight: 600; }
.fr-pick-list { padding: 6px; max-height: 340px; overflow-y: auto; }
.fr-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.fr-pick-row:hover { background: var(--surface-2); }
.fr-pick-row .fr-name { font-weight: 500; }
.fr-pick-row button { padding: 0.25em 0.8em; font-size: 0.85rem; }
.fr-pick-none { padding: 12px 14px; margin: 0; }
.profile-friend { margin-left: auto; display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; }
.profile-block { margin-top: 2.5em; text-align: center; }
.profile-block button.link { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.profile-block button.link:hover { color: var(--hard); background: none; }
.fr-pick-foot { margin: 0; padding: 10px 14px; border-top: 1px solid var(--border); }
.callout.ai-unlock { margin: 0.6em 0 0.9em; font-size: 0.88rem; }

/* "Continue": back to the problem you were working on (static/return.js). */
.ret { z-index: 40; color: var(--fg); font-size: 0.85rem; }
.ret .ret-meta { font: 0.68rem var(--mono); color: var(--muted); }
.ret .ret-num { color: var(--muted); font-family: var(--mono); font-weight: 500; }
.ret-close { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 1.7rem; height: 1.7rem; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); }
.ret-close:hover { color: var(--fg); background: var(--surface-2); filter: none; }
/* Narrow windows: a pill at the bottom, the whole pill the link. */
.ret-pill {
  position: fixed; left: 50%; bottom: 1.1rem; transform: translateX(-50%); display: flex; align-items: center; gap: 0.15rem;
  max-width: calc(100vw - 2rem); padding: 0.25rem 0.3rem 0.25rem 0.25rem; border-radius: 999px;
  background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.ret-pill-link { display: flex; align-items: center; gap: 0.5rem; min-width: 0; padding: 0.4rem 0.6rem 0.4rem 0.75rem; border-radius: 999px; color: inherit; text-decoration: none; white-space: nowrap; }
.ret-pill-link:hover { background: var(--surface-2); text-decoration: none; }
.ret-pill-link svg { color: var(--accent); flex: none; }
.ret-pill .ret-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Phones: a card above the tab bar. */
.ret-phone {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabbar-h, 0px) + env(safe-area-inset-bottom) + 10px);
  display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.5rem 0.6rem 0.75rem;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}
.ret-phone-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--fg); text-decoration: none; }
.ret-phone-text .ret-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ret-go { display: inline-flex; align-items: center; height: 2.5rem; padding: 0 0.9rem; border-radius: 8px; background: var(--accent); color: var(--accent-fg); font-weight: 600; text-decoration: none; }
.ret-go:hover { text-decoration: none; filter: brightness(1.05); }
.ret-phone .ret-close { width: 2.5rem; height: 2.5rem; }
/* Wide windows: a card in the left margin (above the daily card on Problems). */
.ret-rail {
  position: fixed; top: calc(var(--header-h) + 1.2em); left: max(16px, calc((100vw - 1120px) / 2 - 220px)); width: 200px;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow), 0 6px 20px rgba(16, 18, 24, 0.1); overflow: hidden;
}
.ret-rail.in-rail { position: sticky; left: auto; width: auto; margin-bottom: 12px; }
.ret-head { display: flex; align-items: center; gap: 0.4em; padding: 0.55em 0.4em 0.45em 0.8em; color: var(--accent); }
.ret-head strong { flex: 1; color: var(--fg); font-size: 0.9rem; }
.ret-body { display: flex; flex-direction: column; gap: 0.25em; padding: 0.6em 0.8em 0.75em; border-top: 1px solid var(--border); color: var(--fg); text-decoration: none; font-size: 0.82rem; }
a.ret-body:hover { background: var(--surface-2); text-decoration: none; }
.ret-diff { font-size: 0.72rem; font-weight: 600; }
.ret-diff.easy { color: var(--easy); } .ret-diff.medium { color: var(--medium); } .ret-diff.hard { color: var(--hard); }
.ret-body .ret-title { font-weight: 600; }
.ret-verdict { display: inline-flex; align-items: center; gap: 0.35em; font-size: 0.76rem; }
.ret-verdict::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ret-verdict.bad { color: var(--hard); } .ret-verdict.ok { color: var(--ok); }
@media print { .ret { display: none; } }
.ret-diff { text-transform: capitalize; }

/* Restarts and updates (app.js SooksServer): a note at the top while the server is away, and a
   reload offer when it's back on a new build. */
.server-note { position: fixed; top: 0.75rem; left: 50%; transform: translateX(-50%); z-index: 1000;
  max-width: calc(100% - 32px); box-sizing: border-box; display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap;
  padding: 0.45em 0.9em; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  color: var(--fg); font-size: 0.875rem; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }
.server-note.update { border-radius: 12px; }
.server-note button { font-size: 0.8rem; padding: 0.2em 0.7em; }

/* ---------- admin stats (decision 0047) ---------- */
.ok-text { color: var(--ok); } .bad-text { color: var(--hard); } .warn-text { color: var(--medium); }
.st-health { border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: var(--radius-sm); background: var(--surface); padding: 0.7em 1em; margin-bottom: 1em; }
.st-health.warn { border-left-color: var(--medium); } .st-health.bad { border-left-color: var(--hard); }
.st-health-head { display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap; }
.st-health-head .st-updated { margin-left: auto; }
.st-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); display: inline-block; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.st-dot.warn { background: var(--medium); box-shadow: 0 0 0 3px color-mix(in srgb, var(--medium) 25%, transparent); }
.st-dot.bad { background: var(--hard); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hard) 25%, transparent); }
.st-dot.small { width: 7px; height: 7px; box-shadow: none; }
.st-warnings { margin: 0.5em 0 0; padding-left: 1.4em; font-size: 0.9rem; }
.st-warnings li { margin: 0.15em 0; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6em; margin-bottom: 1em; }
.st-now { margin-bottom: 1.2em; }
.st-tile .v { font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-tile .v.warn { color: var(--medium); } .st-tile .v.bad { color: var(--hard); }
.st-section { margin-bottom: 1.2em; }
.st-section > h2 { font-size: 1rem; margin: 0 0 0.6em; }
.st-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1em; }
.st-sections .card-body { padding: 0.9em 1em; }
.st-sections h4 { margin-top: 1em; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.8em; }
.st-machine { padding: 0.8em 1em; }
.st-machine.down { border-color: color-mix(in srgb, var(--hard) 50%, var(--border)); }
.st-machine-head { display: flex; align-items: center; gap: 0.6em; margin-bottom: 0.6em; flex-wrap: wrap; }
.st-machine-head strong { text-transform: capitalize; }
.st-meters { display: flex; flex-direction: column; gap: 0.5em; margin-bottom: 0.5em; }
.st-meter .label { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.2em; gap: 0.5em; }
.bar > span { background: var(--easy); }
.bar.warn > span { background: var(--medium); } .bar.bad > span { background: var(--hard); }
.st-procs { list-style: none; margin: 0.5em 0 0; padding: 0; font-size: 0.9rem; }
.st-procs li { display: flex; align-items: center; gap: 0.45em; flex-wrap: wrap; padding: 0.2em 0; }
.st-proc-kind { font: 600 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); min-width: 3.2em; }
.st-table th, .st-table td { padding: 0.45em 0.7em; font-size: 0.88rem; }
.st-table tbody tr.muted td { color: var(--muted); }
.st-chart { margin: 0.8em 0 0.4em; }
.st-chart-head { display: flex; justify-content: space-between; gap: 0.6em; flex-wrap: wrap; margin-bottom: 0.2em; }
.st-chart svg { display: block; width: 100%; height: 84px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.st-chart .line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.st-chart .area { fill: var(--accent); opacity: 0.12; }
.st-chart rect { fill: var(--accent); }
.st-chart .c2, .st-chart rect.c2 { stroke: var(--link); fill: var(--link); }
.st-chart .c3, .st-chart rect.c3 { stroke: var(--hard); fill: var(--hard); }
.st-chart .c4, .st-chart rect.c4 { stroke: var(--muted); fill: var(--muted); }
.st-chart .line.c2, .st-chart .line.c3, .st-chart .line.c4 { fill: none; }
.st-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--accent); vertical-align: -1px; margin: 0 0.15em 0 0.4em; }
.st-key.c2 { background: var(--link); } .st-key.c3 { background: var(--hard); }
.st-ticks { display: flex; justify-content: space-between; font: 0.68rem var(--mono); color: var(--muted); margin-top: 0.15em; }
.st-shares { display: flex; gap: 2px; margin: 0.3em 0 0.6em; min-height: 1.6em; }
.st-share { flex: 1 1 0; min-width: 2.5em; padding: 0.2em 0.4em; font: 600 0.72rem var(--mono); border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; background: var(--surface-3); }
.st-share.ok { background: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.st-share.warn { background: color-mix(in srgb, var(--medium) 25%, transparent); }
.st-share.bad { background: color-mix(in srgb, var(--hard) 25%, transparent); color: var(--hard); }
.st-periods { display: flex; gap: 0.2em; flex-wrap: wrap; }
.st-periods .tab { text-decoration: none; font-size: 0.85rem; padding: 0.4em 0.6em; }
.st-users .card-head { flex-wrap: wrap; }
.stats-users th[data-sort] { cursor: pointer; user-select: none; }
.stats-users th[data-sort]:hover { color: var(--fg); }
.stats-users th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent); }
.stats-users th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }
.stats-users tfoot td { font-weight: 600; border-top: 2px solid var(--border-strong); }
.stats-users tr[hidden] { display: none; }
@media (max-width: 900px) {
  .st-sections { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .st-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0.45em; }
  .st-tile { padding: 0.5em 0.6em; }
  .st-tile .v { font-size: 1.05rem; }
  .st-cards { grid-template-columns: 1fr; }
  .stats-users .lo { display: none; }
  .st-req th:nth-child(n+6), .st-req td:nth-child(n+6) { display: none; } /* p99, max, 4xx… scroll the table for them */
  .st-routes th:nth-child(n+5), .st-routes td:nth-child(n+5) { display: none; }
  .st-health-head .st-updated { margin-left: 0; width: 100%; }
}

/* ---------- problem suggestions (suggestions.go) ---------- */
.menu-suggest { position: relative; }
.menu-new-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.menu-new-dot[hidden] { display: none; }
/* Shuffles a suggestion pays, as the daily-solved line shows them: "+3 ◆" in the habit purple. */
.shuffle-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; margin: 0; padding: 0.5em 0.7em; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--habit) 10%, transparent); font-size: 0.86rem; color: var(--fg-2); }
.shuffle-note[hidden] { display: none; }
.shuffle-amt { color: var(--habit); font-weight: 700; }
.suggest-bar-text .shuffle-note { align-self: flex-start; margin-top: 0.2em; }
.suggest-diffs { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5em; }
.suggest-diffs legend { padding: 0; margin-bottom: 0.4em; font-weight: 500; }
form.stack .suggest-diffs label.vs-diff { flex-direction: row; align-items: center; gap: 0.4em; font-size: 0.85rem; color: var(--muted); }
form.stack .suggest-diffs label.vs-diff.easy { color: var(--easy); }
form.stack .suggest-diffs label.vs-diff.medium { color: var(--medium); }
form.stack .suggest-diffs label.vs-diff.hard { color: var(--hard); }
.suggest-blocked p { line-height: 1.55; }
/* The bar on Problems. */
.suggest-bar {
  margin: 0 0 1em; padding: 0.95em 1.1em; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-sizing: border-box;
  transition: height 0.35s ease, opacity 0.35s ease, margin 0.35s ease, padding 0.35s ease, transform 0.35s ease, border-color 0.35s ease;
}
.suggest-bar-body { display: flex; gap: 0.9em; align-items: flex-start; }
.suggest-bar-icon {
  flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.suggest-bar-icon .menu-icon { width: 20px; height: 20px; }
.suggest-bar-text { display: flex; flex-direction: column; gap: 0.3em; min-width: 0; line-height: 1.5; }
.suggest-bar-text > span { color: var(--fg-2); font-size: 0.92rem; }
.suggest-bar-actions { display: flex; gap: 0.8em; align-items: center; margin-top: 0.4em; flex-wrap: wrap; }
.suggest-bar-bye { margin: 0; color: var(--fg-2); font-weight: 500; animation: suggest-bye-in 0.35s ease; }
@keyframes suggest-bye-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.suggest-bar.closing { opacity: 0; margin: 0; padding-top: 0; padding-bottom: 0; border-color: transparent; transform: translateY(-6px); }
@media (prefers-reduced-motion: reduce) { .suggest-bar, .suggest-bar-bye { transition: none; animation: none; } }
/* Admin → Reports → Suggestions. */
.suggest-settings { margin-bottom: 1em; }
.suggest-settings .card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6em 1.2em; }
.suggest-settings label { display: inline-flex; align-items: center; gap: 0.5em; }
.suggest-settings .suggest-on { font-weight: 600; }
.suggest-settings input[type="number"] { width: 5em; }
.suggest-settings p { flex-basis: 100%; margin: 0; }
.pill.suggest-tag { color: var(--accent); background: var(--accent-soft); text-transform: none; margin-left: 0.5em; vertical-align: 0.15em; }
.pill.suggest-unsure { color: var(--muted); background: var(--surface-2); }
.suggest-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em; margin: 0.5em 0; }
.suggest-limits { display: flex; width: 100%; align-items: center; margin-top: 0.8em; padding-top: 0.7em; border-top: 1px dashed var(--border); flex-wrap: wrap; gap: 0.5em 1em; }
.suggest-limits label { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.88rem; }
/* Admin → Debug's problem suggestions. */
.debug-suggest { display: flex; flex-direction: column; gap: 0.9em; }
.debug-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3em 1.2em; margin: 0; font-size: 0.9rem; }
.debug-facts dt { color: var(--muted); }
.debug-facts dd { margin: 0; }
.debug-suggest-states { display: flex; flex-wrap: wrap; gap: 0.5em; }
.debug-suggest-help { margin: 0; padding-left: 1.2em; }

/* Solve rewards, daily trophies and share links (decision 0050). */
/* The Results drawer's congratulations: what a first solve and a daily paid, and Share. */
.solve-congrats { display: flex; align-items: center; gap: 0.75em; padding: 0.6em 0.8em; margin: 0.2em 0 0.6em; border-radius: var(--radius);
  background: color-mix(in srgb, var(--habit) 10%, transparent); font-size: 0.88rem; flex-wrap: nowrap; }
.solve-congrats .sc-icon { flex: none; width: 2.1em; height: 2.1em; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--habit); }
.sc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15em; }
.sc-head { display: flex; flex-wrap: wrap; gap: 0.1em 0.6em; font-weight: 600; color: var(--fg); }
.sc-head strong { color: var(--habit); }
.sc-sub { color: var(--fg-2); }
.sc-sub a { color: var(--habit-active); font-weight: 600; }
.sc-share { flex: none; display: inline-flex; align-items: center; gap: 0.4em; height: 36px; font-weight: 600; }
@media (max-width: 720px) { .solve-congrats { flex-wrap: wrap; } .sc-share { margin-left: auto; } }

/* The Avatar page's trophy shelf. */
.trophy-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 0.6em; }
.trophy { display: flex; flex-direction: column; align-items: center; gap: 0.35em; padding: 0.7em 0.4em 0.6em; border: 1px solid transparent;
  border-radius: var(--radius); background: none; color: inherit; cursor: pointer; }
.trophy:hover { background: var(--surface-2); border-color: var(--border); }
.trophy img.avatar { border-radius: 50%; }
.av-trophy { margin: 0 0 0.2em; }
.av-trophy-odds { margin: 0 0 0.5em; }

/* A daily's trophy popup (static/share.js): the minted avatar grows, then its tier shows. */
.trophy-dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--fg); padding: 1.3em 1.6em 1.2em;
  width: min(30em, calc(100vw - 2em)); box-sizing: border-box; text-align: center; box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
  --tier-glow: var(--link); }
.trophy-dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.trophy-dialog.tier-legendary { --tier-glow: #e3b341; }
.trophy-dialog.tier-kyoshi { --tier-glow: #c65bdc; }
.td-badge { display: inline-flex; margin: 0; padding: 0.25em 0.8em; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.td-badge::first-letter { text-transform: uppercase; }
.td-title { margin: 0.6em 0 0.3em; font-size: 1.15rem; line-height: 1.25; }
.td-stage { height: 296px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4em; }
.td-pic { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; line-height: 0; transition: box-shadow 0.6s ease; }
.td-pic:hover { background: none; }
.td-pic canvas { width: 260px; height: 260px; display: block; border-radius: 50%; }
.trophy-dialog.revealed .td-pic { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tier-glow) 55%, transparent), 0 0 48px 8px color-mix(in srgb, var(--tier-glow) 45%, transparent); }
.td-pic[hidden], .td-phase[hidden], .td-preview[hidden] { display: none; }
.trophy-dialog:focus { outline: none; }
.trophy-dialog.previewing .td-stage { height: auto; min-height: 296px; padding: 0.4em 0; }
.td-phase { margin: 0; height: 1.4em; color: var(--muted); }
.td-preview { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.4em; }
.td-preview p { margin: 0; }
.td-embed { width: min(432px, 100%); box-sizing: border-box; text-align: left; padding: 0.6em 0.8em 0.8em; border-left: 4px solid #dec164;
  border-radius: 6px; background: var(--surface-2); display: flex; flex-direction: column; gap: 0.3em; }
.td-embed-title { color: var(--link); font-size: 0.92rem; }
.td-embed img { width: 100%; height: auto; aspect-ratio: 1200 / 630; border-radius: 4px; background: var(--surface-3); }
.td-tier { margin: 0.4em 0 0.3em; height: 1.4em; font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.td-tier.revealed { font-size: 0.88rem; font-weight: 800; letter-spacing: 0.16em; }
.td-line { margin: 0.2em 0; color: var(--fg-2); font-size: 0.92rem; }
.td-minted { text-decoration: underline dotted; text-underline-offset: 0.2em; cursor: help; }
.td-earn { display: inline-flex; gap: 0.5em; margin: 0.4em 0; padding: 0.3em 0.8em; border-radius: 999px; font-size: 0.9rem;
  background: color-mix(in srgb, var(--habit) 10%, transparent); color: var(--fg-2); }
.td-earn strong { color: var(--habit); }
.td-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5em; margin: 0.6em 0 0.6em; }
.td-acts button { height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; font-weight: 600; }
.td-spend { color: var(--habit-active); font-weight: 600; font-size: 0.9rem; }
@media (max-width: 720px) {
  .trophy-dialog { padding: 1.1em 1em 1em; }
  .td-stage { height: 250px; }
  .trophy-dialog.previewing .td-stage { min-height: 250px; }
  .td-pic canvas { width: 214px; height: 214px; }
}

/* A brief note at the bottom of the screen (static/share.js; a popover, over open dialogs). */
.toast { position: fixed; inset: auto auto 1.4em 50%; margin: 0; border: 0; transform: translate(-50%, 0.8em); opacity: 0; pointer-events: none;
  background: var(--fg); color: var(--bg); padding: 0.65em 1em; border-radius: var(--radius); font-size: 0.9rem; max-width: calc(100vw - 2em);
  box-shadow: var(--shadow); transition: opacity 0.2s ease, transform 0.2s ease; z-index: 1000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* A share link's page (/w/<id>). */
.share-page { max-width: 56em; margin: 2em auto; padding: 0 1em; }
.share-card { display: flex; flex-wrap: wrap; align-items: center; gap: 2em; padding: 2em; }
.share-avatar { flex: none; border-radius: 50%; max-width: 60vw; height: auto; }
.share-text { flex: 1 1 18em; min-width: 0; display: flex; flex-direction: column; gap: 0.5em; }
.share-kicker { margin: 0; font: 700 0.8rem var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--link); }
.share-kicker.tier-legendary { color: #e3b341; }
.share-kicker.tier-kyoshi { color: #c65bdc; }
.share-lead { margin: 0; color: var(--fg-2); font-size: 1.1rem; }
.share-title { margin: 0; font-size: 1.8rem; line-height: 1.15; }
.share-num { color: var(--accent); }
.share-chips { display: flex; flex-wrap: wrap; gap: 0.4em; margin: 0.3em 0; }
.share-chip { padding: 0.2em 0.75em; border-radius: 999px; background: var(--surface-2); font-size: 0.9rem; color: var(--fg-2); }
.share-chip.diff-easy { color: var(--easy); font-weight: 600; }
.share-chip.diff-medium { color: var(--medium); font-weight: 600; }
.share-chip.diff-hard { color: var(--hard); font-weight: 600; }
.share-actions { display: flex; flex-wrap: wrap; gap: 0.6em; margin-top: 0.6em; }

/* "Invite" by Run and Submit: a group session's popover (decision 0051, static/group.js). */
.group-picker > summary.btn { padding: 0.35em 0.8em; }
.group-pop { width: 380px; white-space: normal; font-weight: 400; }
.group-about { margin: 0; padding: 10px 14px 0; }
.group-search { padding: 10px 14px 0; }
.group-search input { width: 100%; }
.group-friends .fr-pick-head { display: none; }
.group-friends .fr-pick-foot { display: none; }
.group-friends .fr-pick-list { max-height: 240px; }
.group-link { display: flex; gap: 0.4em; padding: 10px 14px; border-top: 1px solid var(--border); }
.group-link input { flex: 1; min-width: 0; font: 0.8rem var(--mono); }
.group-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6em; padding: 0 14px 12px; }
.group-foot a[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.group-pill { margin-left: 0.5em; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); text-transform: none; letter-spacing: 0; }
.share-kicker.group-live { color: #ffa116; }
@media (max-width: 720px) { .group-picker { display: none; } }
.mock-takeback { margin-left: 0.8em; font-size: 0.8rem; }
/* The note on Problems that solving pays shuffles (problems.templ solveNote; goes like the suggest bar). */
.solve-note-icon { background: color-mix(in srgb, var(--habit) 14%, transparent); color: var(--habit); font-size: 1.15rem; }
.group-join { display: inline-flex; align-items: center; gap: 0.35em; white-space: nowrap; padding: 0.35em 0.6em; }
.group-join[hidden], .group-picker[hidden] { display: none; }
.group-join-n { display: inline-flex; align-items: center; gap: 0.15em; font-weight: 700; opacity: 0.9; }
@container (max-width: 620px) { .toolbar .group-join .mode-label { display: none; } }
@media (max-width: 720px) { .group-join { display: none; } }
/* The language select, moved into the editor settings menu while the toolbar is narrow (editorsettings.js). */
.editor-settings-menu .es-lang[hidden] { display: none; }
.editor-settings-menu .es-lang-slot select { width: auto; min-width: 0; max-width: 11em; }

/* A daily solved before it was one: its tile or row with a Claim trophy button over its corner
   (dailies.templ dailyClaimButton; a button can't go inside the link). */
.daily-claim-wrap { display: grid; }
.daily-claim-wrap > * { grid-area: 1 / 1; }
.daily-tiles > .daily-claim-wrap { flex: none; width: 236px; scroll-snap-align: start; }
@media (min-width: 721px) { .daily-tiles > .daily-claim-wrap { flex: 1 1 236px; } }
.daily-claim-wrap > .daily-tile { width: auto; padding-bottom: 3.1em; }
.daily-claim-wrap > .daily-row { padding-bottom: 2.9em; }
.daily-claim { justify-self: end; align-self: end; margin: 0 0.6em 0.6em 0; z-index: 1; display: inline-flex; align-items: center; gap: 0.1em;
  padding: 0.3em 0.8em; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-fg); font: 600 0.8rem var(--font);
  box-shadow: 0 0 0 3px var(--accent-soft); cursor: pointer; }
.daily-claim:hover { filter: brightness(1.06); }
.daily-claim .mint-hex { margin: 0 0.3em 0 0; cursor: inherit; }
.daily-claim:disabled { opacity: 0.7; cursor: progress; }
.daily-claimed { justify-self: end; align-self: end; margin: 0 0.8em 0.75em 0; font: 600 0.78rem var(--font); color: var(--habit); }
.td-before { margin: 0.1em 0 0.4em; font-weight: 600; color: var(--fg); }
