:root,
[data-theme="dark"] {
  --background: #141210;
  --stone-plate: rgba(24, 21, 18, 0.84);
  --stone-elevated: rgba(34, 29, 24, 0.72);
  --row-active: rgba(212, 175, 106, 0.11);
  --row-hover: rgba(236, 224, 206, 0.045);
  --surface: rgba(236, 224, 206, 0.048);
  --spec-tile-bg: rgba(236, 224, 206, 0.042);
  --card-border: rgba(212, 184, 134, 0.15);
  --border: rgba(212, 184, 134, 0.28);
  --secondary: rgba(236, 224, 206, 0.095);
  --foreground: #F4EFE6;
  --muted-foreground: #B6AA99;
  --subtle-foreground: #84796B;
  --strike-foreground: #786D5F;
  --accent-emerald: #26B683;
  --accent-amber: #D4AF6A;
  --accent-gold: #C8A46B;
  --accent-gold-bright: #E6C88A;
  --accent-vermilion: #C96046;
  --gold-rank: #D4AF6A;
  --silver-rank: #D2CCC2;
  --bronze-rank: #C58654;
  --plinth-top: rgba(236, 224, 206, 0.06);
  --plinth-bottom: rgba(236, 224, 206, 0.01);
  --scrollbar-thumb: rgba(176, 164, 148, 0.24);
  --scrollbar-thumb-hover: rgba(212, 175, 106, 0.42);
  --phantom-opacity: 0.14;
  --icon-mono: #FFFFFF;
  --grok-brand: #FFFFFF;
  --grok-accent: #E2E2E2;
  --shadow-popover: 0 28px 72px rgba(0, 0, 0, 0.82);
  color-scheme: dark;
}

[data-theme="light"] {
  --background: #EFE9DC;
  --stone-plate: rgba(246, 241, 231, 0.82);
  --stone-elevated: rgba(238, 230, 214, 0.78);
  --row-active: rgba(168, 132, 68, 0.14);
  --row-hover: rgba(96, 78, 52, 0.055);
  --surface: rgba(96, 78, 52, 0.06);
  --spec-tile-bg: rgba(96, 78, 52, 0.05);
  --card-border: rgba(96, 78, 52, 0.17);
  --border: rgba(96, 78, 52, 0.3);
  --secondary: #E3DAC7;
  --foreground: #1B1814;
  --muted-foreground: #594F42;
  --subtle-foreground: #7D7162;
  --strike-foreground: #786D5F;
  --accent-emerald: #0E8A5D;
  --accent-amber: #A67B2E;
  --accent-gold: #9A7228;
  --accent-gold-bright: #B88A38;
  --accent-vermilion: #B54930;
  --gold-rank: #966D26;
  --silver-rank: #524B42;
  --bronze-rank: #8F4922;
  --plinth-top: rgba(96, 78, 52, 0.08);
  --plinth-bottom: rgba(96, 78, 52, 0.015);
  --scrollbar-thumb: rgba(123, 112, 98, 0.28);
  --scrollbar-thumb-hover: rgba(154, 114, 40, 0.48);
  --phantom-opacity: 0.11;
  --icon-mono: #111111;
  --grok-brand: #000000;
  --grok-accent: #2A2A2A;
  --shadow-popover: 0 22px 56px rgba(25, 22, 19, 0.2);
  color-scheme: light;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

html {
  font-size: clamp(13.5px, calc(8.6px + 0.37vw), 21.5px);
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

.font-codex {
  font-family: "Cormorant Garamond", Georgia, "Noto Serif SC", "Songti SC", serif;
}

.font-opus {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.font-neon {
  font-family: "Trebuchet MS", "Segoe UI", ui-sans-serif, sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.font-astra {
  font-family: "Palatino Linotype", "Bodoni MT", "Book Antiqua", Didot, Georgia, serif;
  font-variant: small-caps;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.font-sonnet {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.font-sonar {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.font-flash {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 500;
}

.num-clean {
  font-variant-numeric: tabular-nums lining-nums;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 700;
  color: var(--foreground);
}

.gemini4-grad {
  background: linear-gradient(92deg, #FA4441 0%, #F8BF10 28%, #18B961 56%, #3287FE 86%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

.tag-subtle {
  font-size: 0.72em;
  font-weight: 500;
  color: var(--muted-foreground);
  letter-spacing: 0.01em;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@keyframes phantomIn {
  from { opacity: 0; transform: translate(-10px, -50%) scale(0.95); }
  to { opacity: var(--phantom-opacity); transform: translate(0, -50%) scale(1); }
}

.phantom-enter {
  animation: phantomIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
