/* =============================================================================
   RVL DESIGN SYSTEM — Light, calm, and legible
   Default palette is daylight; dark palettes are opt-in via Tweaks.
   ============================================================================= */

:root {
  /* Palette: Daylight (default) — cream paper, deep crimson accent, gold sparingly */
  --bg:           #f7f4ec;       /* page */
  --bg-elev:      #ffffff;       /* nav, surfaces */
  --bg-card:      #ffffff;       /* cards */
  --bg-card-2:    #f1ece1;       /* subtle card / hover */
  --line:         #e6dfce;       /* hairline */
  --line-bright:  #d3c8ac;       /* stronger hairline */
  --ink:          #1c1611;       /* primary text */
  --ink-dim:      #4a3f33;       /* secondary text */
  --ink-mute:     #8c7f6c;       /* muted / labels */
  --crimson:      #b21e2e;
  --crimson-deep: #7b0d1a;
  --crimson-bright:#cf2a3d;
  --gold:         #b08526;
  --gold-light:   #d4a847;
  --bone:         #f7f4ec;
  --field:        #1f5d3f;
  --warn:         #c97a0a;
  --bad:          #c0392b;
  --good:         #1f8a4a;

  /* Hero surface — used by leaderboard / login / recap. Calm cream-on-cream. */
  --hero-bg:      linear-gradient(135deg, #ffffff 0%, #f3ecd9 100%);
  --hero-ink:     var(--ink);
  --hero-ink-dim: var(--ink-dim);
  --hero-border:  var(--line);

  --shadow-card:  0 1px 0 rgba(255,255,255,.7) inset, 0 1px 2px rgba(60,40,20,.05), 0 4px 14px rgba(60,40,20,.06);
  --shadow-glow:  0 0 0 1px rgba(178,30,46,.20), 0 8px 22px rgba(178,30,46,.18);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-display: "Anton", "Bebas Neue", Impact, sans-serif;
  --font-sans:    "Outfit", "Manrope", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;
}

/* Palette: Crimson Gold (original dark) */
.palette-crimsonGold {
  --bg:           #0f0a0b;
  --bg-elev:      #1a1213;
  --bg-card:      #221718;
  --bg-card-2:    #2a1c1d;
  --line:         #382628;
  --line-bright:  #4a2f31;
  --ink:          #f7f3ec;
  --ink-dim:      #d8cfc4;
  --ink-mute:     #8e857d;
  --crimson:      #b21e2e;
  --crimson-deep: #7b0d1a;
  --crimson-bright:#e63946;
  --gold:         #d4a847;
  --gold-light:   #f0c869;
  --hero-bg:      linear-gradient(135deg, #4a0d12 0%, #1a0608 50%, #0f0a0b 100%);
  --hero-ink:     #ffffff;
  --hero-ink-dim: rgba(255,255,255,.7);
  --hero-border:  var(--line-bright);
  --shadow-card:  0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px rgba(0,0,0,.45);
}

/* Palette: Midnight Navy */
.palette-midnight {
  --bg:           #08101c;
  --bg-elev:      #0e1828;
  --bg-card:      #132035;
  --bg-card-2:    #1a2a45;
  --line:         #1f3354;
  --line-bright:  #2c4775;
  --ink:          #eef2ff;
  --ink-dim:      #c7d2fe;
  --ink-mute:     #7a87a8;
  --crimson:      #ef4444;
  --crimson-deep: #991b1b;
  --crimson-bright:#f87171;
  --gold:         #fbbf24;
  --gold-light:   #fde68a;
  --hero-bg:      linear-gradient(135deg, #0e1828 0%, #08101c 100%);
  --hero-ink:     #ffffff;
  --hero-ink-dim: rgba(255,255,255,.7);
  --hero-border:  var(--line-bright);
  --shadow-card:  0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px rgba(0,0,0,.45);
}

/* Palette: Onyx Champagne */
.palette-onyx {
  --bg:           #0c0c0d;
  --bg-elev:      #15161a;
  --bg-card:      #1c1d22;
  --bg-card-2:    #25262c;
  --line:         #2e2f36;
  --line-bright:  #3f414a;
  --ink:          #f3f1ed;
  --ink-dim:      #d4d1ca;
  --ink-mute:     #8a8780;
  --crimson:      #a21d2c;
  --crimson-deep: #6b0d1a;
  --crimson-bright:#c92339;
  --gold:         #c8a96a;
  --gold-light:   #e0c989;
  --hero-bg:      linear-gradient(135deg, #2a2017 0%, #15161a 60%, #0c0c0d 100%);
  --hero-ink:     #ffffff;
  --hero-ink-dim: rgba(255,255,255,.7);
  --hero-border:  var(--line-bright);
  --shadow-card:  0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px rgba(0,0,0,.45);
}

/* -------------------------------------------------------------------------- */
*  { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: scroll;
}

.app-root {
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

.display { font-family: var(--font-display); letter-spacing: 0.01em; line-height: 0.92; }
.mono    { font-family: var(--font-mono); font-feature-settings: "tnum"; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-bright); border: 3px solid transparent; background-clip: content-box; }

/* Utility */
.divider { height: 1px; background: var(--line); }
.kicker {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.tag-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--bg-card-2); color: var(--ink-dim);
  border: 1px solid var(--line);
}
.tag-pill.gold    { background: rgba(212,168,71,.16); color: #7a5a16; border-color: rgba(212,168,71,.45); }
.tag-pill.crimson { background: rgba(178,30,46,.10); color: var(--crimson-deep); border-color: rgba(178,30,46,.30); }
.tag-pill.good    { background: rgba(31,138,74,.10); color: #146734; border-color: rgba(31,138,74,.30); }

/* On dark hero surfaces (crimsonGold / midnight / onyx) the tags need light treatment */
.palette-crimsonGold .tag-pill.gold,
.palette-midnight    .tag-pill.gold,
.palette-onyx        .tag-pill.gold    { background: rgba(212,168,71,.14); color: var(--gold-light); border-color: rgba(212,168,71,.4); }
.palette-crimsonGold .tag-pill.crimson,
.palette-midnight    .tag-pill.crimson,
.palette-onyx        .tag-pill.crimson { background: rgba(178,30,46,.18); color: #f4b3ba; border-color: rgba(178,30,46,.45); }
.palette-crimsonGold .tag-pill.good,
.palette-midnight    .tag-pill.good,
.palette-onyx        .tag-pill.good    { background: rgba(34,197,94,.14); color: #86efac; border-color: rgba(34,197,94,.4); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 8px; border: 1px solid var(--line-bright);
  background: var(--bg-card); color: var(--ink);
  font-weight: 600; font-size: 14px;
  white-space: nowrap;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--bg-card-2); border-color: var(--ink-mute); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}
.btn-primary {
  background: var(--crimson);
  border-color: var(--crimson-deep);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 2px 6px rgba(178,30,46,.25);
}
.btn-primary:hover { background: var(--crimson-deep); border-color: var(--crimson-deep); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  border-color: transparent; color: #2a1c00;
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 2px 8px rgba(212,168,71,.30);
}
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-card-2); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 40px; padding: 0; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-bare {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Animations */
@keyframes rvl-spin { to { transform: rotate(360deg); } }
@keyframes rvl-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rvl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rvl-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(178,30,46,.45); }
  50%      { box-shadow: 0 0 0 8px rgba(178,30,46,0); }
}
@keyframes rvl-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes rvl-arrow-up { 0% { transform: translateY(2px); } 50% { transform: translateY(-2px); } 100% { transform: translateY(2px); } }
.rise { animation: rvl-rise .45s cubic-bezier(.22,.61,.36,1) both; }
.fade { animation: rvl-fade .35s ease both; }

/* Halftone — kept for stadium feel; very subtle in light mode */
.halftone {
  background-image:
    linear-gradient(45deg, rgba(0,0,0,.025) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.025) 75%),
    linear-gradient(45deg, rgba(0,0,0,.025) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.025) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 7px 7px;
}
.palette-crimsonGold .halftone,
.palette-midnight    .halftone,
.palette-onyx        .halftone {
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.025) 75%),
    linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.025) 75%);
}

/* Segmented control */
.seg {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--ink-dim);
  padding: 7px 14px;
  font-size: 13px; font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}
.seg button.active { background: var(--crimson); color: white; }

/* Focus ring */
.focus-ring:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; }

/* Spinner keyframes (used by <Spinner/> and <PageLoader/>) */
@keyframes rvl-spin { to { transform: rotate(360deg); } }

/* Logout icon button */
.logout-btn:hover { background: rgba(178, 30, 46, 0.12); color: var(--crimson-deep) !important; }
.logout-btn:active { transform: scale(0.92); }
.logout-btn:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; }

/* Print */
@media print {
  .no-print { display: none !important; }
  body { background: white; color: black; }
}

@media (max-width: 880px) {
  .hero-strip { grid-template-columns: 1fr !important; padding: 22px !important; }
  .hero-strip > * { min-width: 0; }
}
