/* ────────────────────────────────────────────────────────────
   SHL52-0  —  Mobile-first dark theme
   Inspired by 84-0.com design language
   ──────────────────────────────────────────────────────────── */

/* ── TOKENS ── */
/* ── TOKENS ── */
:root {
  --bg:           #0a1520;
  --bg-2:         #0e1c2c;
  --surface:      #122034;
  --surface-2:    #162840;
  --line:         rgba(255, 255, 255, 0.09);
  --line-hover:   rgba(255, 255, 255, 0.20);

  --accent:       #F5C542;   /* Swedish gold */
  --accent-dim:   rgba(245, 197, 66, 0.12);
  --accent-glow:  rgba(245, 197, 66, 0.25);

  --blue:         #2fb8ff;   /* Defense color */
  --green:        #43e08a;   /* Live dot */

  --text:         #eef4fb;
  --text-dim:     #7a9ab5;
  --text-faint:   #3d5a72;

  --shadow:       0 8px 32px rgba(0, 0, 0, 0.5);
  --radius:       16px;
  --radius-sm:    10px;
  --transition:   0.15s ease;

  --rink-red:       rgba(239, 68, 68, 0.22);
  --rink-red-glow:  rgba(239, 68, 68, 0.15);
  --rink-blue:      rgba(56, 189, 248, 0.25);
  --rink-blue-glow: rgba(56, 189, 248, 0.18);
  --rink-ice-glow:  radial-gradient(ellipse 85% 65% at 50% 50%, rgba(30, 75, 120, 0.22) 0%, rgba(10, 21, 32, 0) 80%);
  --rink-opacity:   1;
  --topbar-bg:    rgba(10, 21, 32, 0.88);
}

[data-theme="light"] {
  --bg:           #f2f5f9;
  --bg-2:         #e4ebf4;
  --surface:      #ffffff;
  --surface-2:    #f5f8fc;
  --line:         rgba(0, 0, 0, 0.09);
  --line-hover:   rgba(0, 0, 0, 0.20);

  --accent:       #c68a00;   /* Rich gold for high contrast on white */
  --accent-dim:   rgba(198, 138, 0, 0.12);
  --accent-glow:  rgba(198, 138, 0, 0.25);

  --blue:         #0284c7;   /* Sharp blue */
  --green:        #16a34a;

  --text:         #091726;
  --text-dim:     #49657e;
  --text-faint:   #758b9d;

  --shadow:       0 8px 24px rgba(10, 23, 38, 0.08);

  --rink-red:       rgba(220, 38, 38, 0.22);
  --rink-red-glow:  rgba(220, 38, 38, 0.08);
  --rink-blue:      rgba(2, 132, 199, 0.22);
  --rink-blue-glow: rgba(2, 132, 199, 0.08);
  --rink-ice-glow:  radial-gradient(ellipse 85% 65% at 50% 50%, rgba(255, 255, 255, 0.8) 0%, rgba(224, 233, 244, 0.4) 80%);
  --rink-opacity:   1;
}

/* Universal hidden attribute enforcement */
[hidden] {
  display: none !important;
}

[data-theme="light"] .record {
  color: #0c1e33;
}

[data-theme="light"] .primary-btn {
  background: linear-gradient(135deg, #122b49 0%, #061423 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(12, 30, 51, 0.25);
}

[data-theme="light"] .rate-bar {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .pc-pos-badge {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .fl-pos[data-pos="C"]  { color: #0284c7; }
[data-theme="light"] .fl-pos[data-pos="VF"] { color: #d95d00; }
[data-theme="light"] .fl-pos[data-pos="HF"] { color: #15803d; }
[data-theme="light"] .fl-pos[data-pos="B"]  { color: #7e22ce; }
[data-theme="light"] .fl-pos[data-pos="MV"] { color: #b45309; }

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; background: none; border: none; }
ul { list-style: none; }

/* ── BASE ── */
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ── RINK BACKGROUND DECORATION ── */
.rink-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: var(--rink-opacity);
  background: var(--rink-ice-glow);
}
.rink-line {
  position: absolute;
  top: 0; bottom: 0;
}
.rink-left, .rink-right {
  width: 5px;
  background: var(--rink-blue);
  box-shadow: 0 0 10px var(--rink-blue-glow);
}
.rink-left  { left: 18%; }
.rink-right { left: 82%; }

.rink-center {
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  background: var(--rink-red);
  box-shadow: 0 0 10px var(--rink-red-glow);
}

.rink-circle {
  position: absolute;
  left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  width: 220px; height: 220px;
  border: 4px solid var(--rink-red);
  border-radius: 50%;
  box-shadow: inset 0 0 12px var(--rink-red-glow), 0 0 12px var(--rink-red-glow);
}

/* Center face-off dot */
.rink-circle::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px;
  background: var(--rink-blue);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--rink-blue-glow);
}

/* ── TOPBAR ── */
.topbar {
  position: sticky;
  top: 0; z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.5px;
  text-decoration: none;
  color: var(--text);
}
.brand-icon { font-size: 20px; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  transition: border-color var(--transition), color var(--transition);
}
.ghost-btn:hover { border-color: var(--line-hover); color: var(--text); }
.ghost-btn:active { opacity: 0.7; }
#soundBtn {
  padding: 6px 10px;
  font-size: 15px;
  line-height: 1;
}

/* ── SCREENS ── */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: calc(100dvh - 54px);
  padding: 16px 16px 40px;
  max-width: 520px;
  margin: 0 auto;
}
.screen.active { display: block; }

/* ═══════════════════════════════════════
   TITLE SCREEN
═══════════════════════════════════════ */
.title-card { text-align: center; padding: 28px 0 48px; }

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
}
.logo-puck { font-size: 46px; line-height: 1; }
.logo-text {
  font-family: 'Oswald', sans-serif;
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
}
.logo-accent { color: var(--accent); }

h1 {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
}
.accent { color: var(--accent); }

.tagline {
  color: var(--text-dim);
  font-size: 14.5px;
  max-width: 380px;
  margin: 0 auto 26px;
  line-height: 1.65;
}

/* Personbästa & Topplista rad */
.title-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 auto 22px;
}
.draft-best-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.3s ease;
}
.draft-best-badge[hidden] {
  display: none !important;
}
.db-trophy { font-size: 16px; line-height: 1; }
.db-label { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }
.db-val {
  color: var(--accent);
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 15px;
}
.title-lb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 16px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.title-lb-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.title-lb-btn:active {
  transform: scale(0.97);
}

/* Mode buttons */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 10px 18px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  text-align: center;
}
.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.mode-card:active { transform: scale(0.97); }
.mode-hard:hover { border-color: #e05555; }
.mode-icon { font-size: 32px; line-height: 1; }
.mode-title {
  font-family: 'Oswald', sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.mode-sub { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

/* Rules */
.rules {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rules li {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  padding-left: 20px;
  position: relative;
}
.rules li::before {
  content: '›';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}
.rules li strong { color: var(--text); }

.disclaimer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* ═══════════════════════════════════════
   DRAFT SCREEN
═══════════════════════════════════════ */

/* Lineup bar */
.lineup-bar {
  display: flex;
  gap: 5px;
  padding: 12px 0 16px;
  justify-content: center;
}
.lb-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  max-width: 74px;
  min-width: 44px;
}
.lb-pos {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-faint);
  text-transform: uppercase;
}
.lb-pill {
  width: 100%;
  height: 38px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.2;
  padding: 0 4px;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition);
}
.lb-pill.filled {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}
.lb-pill.current {
  border-color: var(--accent);
  background: var(--accent-dim);
  animation: lb-pulse 1.4s ease-in-out infinite;
}
@keyframes lb-pulse {
  0%, 100% { border-color: var(--accent); box-shadow: 0 0 0 0 var(--accent-glow); }
  50%       { border-color: rgba(245,197,66,0.5); box-shadow: 0 0 0 4px transparent; }
}

/* Draft main area */
.draft-main { padding-bottom: 90px; }

.round-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.round-label {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.6px;
}
.slot-label {
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
}

/* Reel (slot machine) */
.reel-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.reel {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  height: 60px;
  min-width: 110px;
  flex: 1;
  max-width: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.reel span {
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
  text-align: center;
  display: block;
  padding: 0 8px;
  line-height: 1.2;
}
.reel-x {
  font-size: 20px;
  color: var(--text-faint);
  flex-shrink: 0;
  user-select: none;
}
.reel.spinning span {
  animation: reel-drop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes reel-drop {
  0%   { transform: translateY(-40px); opacity: 0; }
  55%  { transform: translateY(4px);   opacity: 1; }
  75%  { transform: translateY(-2px); }
  100% { transform: translateY(0);     opacity: 1; }
}

/* Re-spin buttons */
.respins {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}
.respin-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  font-family: inherit;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.respin-btn:not(:disabled):hover { color: var(--text); border-color: var(--line-hover); }
.respin-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.respin-badge {
  font-weight: 700;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 99px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

/* Pick prompt */
.pick-prompt {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
  min-height: 20px;
}

/* Player cards container (84-0 style grid) */
.candidates {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

@media (min-width: 480px) {
  .candidates {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

#screen-draft {
  max-width: 580px;
}

.player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--text);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.player-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
.player-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  pointer-events: none;
  animation: card-snap 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes card-snap {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.96) translateY(2px); }
  100% { transform: scale(1); }
}

.pc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-name {
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.pc-stats-line {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--blue);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-stats-hidden {
  color: var(--text-faint);
  letter-spacing: 2px;
  font-size: 13px;
}

.pc-pos-badge {
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  flex-shrink: 0;
  margin-left: 10px;
}
.pc-pos-badge[data-pos="C"]  { color: #2fb8ff; border-color: rgba(47,184,255,0.3); }
.pc-pos-badge[data-pos="VF"] { color: #ff8c42; border-color: rgba(255,140,66,0.3); }
.pc-pos-badge[data-pos="HF"] { color: #43e08a; border-color: rgba(67,224,138,0.3); }
.pc-pos-badge[data-pos="B"]  { color: #c084fc; border-color: rgba(192,132,252,0.3); }
.pc-pos-badge[data-pos="MV"] { color: #F5C542; border-color: rgba(245,197,66,0.3); }

/* Simulate button - fixed at bottom */
.sim-btn {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 488px;
  z-index: 50;
  font-size: 17px;
}

/* Primary button */
.primary-btn {
  padding: 16px 24px;
  background: linear-gradient(135deg, #f0c04e 0%, #cf962f 100%);
  color: #1a0e00;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 13px;
  cursor: pointer;
  width: 100%;
  transition: filter var(--transition), transform var(--transition);
}
.primary-btn:hover  { filter: brightness(1.06); transform: translateY(-1px); }
.primary-btn:active { transform: scale(0.98); }

/* ═══════════════════════════════════════
   RESULTS SCREEN
═══════════════════════════════════════ */
.results-card { padding: 20px 0 60px; text-align: center; }

.mode-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 14px;
  margin-bottom: 12px;
  transition: all var(--transition);
}
.mode-chip-hard {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #ff6b6b;
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  letter-spacing: 1.4px;
  padding: 6px 16px;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.22);
}
.mode-chip-free {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 11.5px;
}
[data-theme="light"] .mode-chip-hard {
  background: #fef2f2;
  border-color: #f87171;
  color: #dc2626;
}
.results-kicker {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.record {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(46px, 14vw, 76px);
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 6px;
}
.record-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* Team stats grid (84-0 style) */
.team-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 8px;
  margin-bottom: 20px;
}

@media (max-width: 460px) {
  .team-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 6px;
  }
}

.ts-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ts-val {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.ts-lbl {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* Rating bars */
.ratings {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rate-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rate-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  width: 64px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.rate-bar {
  flex: 1;
  height: 9px;
  background: rgba(255,255,255,0.07);
  border-radius: 5px;
  overflow: hidden;
}
.rate-fill {
  height: 100%;
  border-radius: 5px;
  width: 0;
  transition: width 1.3s cubic-bezier(0.25, 1, 0.5, 1);
}
.rate-fill.atk { background: linear-gradient(90deg, #d4a012, #F5C542); }
.rate-fill.def { background: linear-gradient(90deg, #1a7ab5, #2fb8ff); }
.rate-num {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 700;
  width: 32px;
  text-align: right;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Tier badge */
.tier-badge {
  display: inline-block;
  font-family: 'Oswald', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 7px 18px;
  border-radius: 99px;
  margin-bottom: 9px;
}
.tier-blurb {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 360px;
  margin: 0 auto 22px;
}

/* Final lineup */
.lineup-heading {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-align: left;
}
.final-lineup {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.fl-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fl-pos {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  width: 28px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.fl-name {
  font-family: 'Oswald', sans-serif;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fl-team {
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}
.fl-rating {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* Position colours in results */
.fl-pos[data-pos="C"]  { color: #2fb8ff; }
.fl-pos[data-pos="VF"] { color: #ff8c42; }
.fl-pos[data-pos="HF"] { color: #43e08a; }
.fl-pos[data-pos="B"]  { color: #c084fc; }
.fl-pos[data-pos="MV"] { color: #F5C542; }

/* Results actions */
.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.share-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.share-sub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 12px;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 13px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}
.share-sub-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-hover);
  transform: translateY(-1px);
}
.share-sub-btn:active {
  transform: translateY(0);
}
.share-x-btn {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.15);
}
.share-x-btn:hover {
  background: #000000;
  border-color: var(--accent);
  color: #ffffff;
}
.share-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
[data-theme="light"] .share-x-btn {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
[data-theme="light"] .share-x-btn:hover {
  background: #000000;
  color: #ffffff;
}
.results-actions .ghost-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  text-align: center;
  border-radius: 13px;
}
.share-note {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  min-height: 18px;
}
.feedback-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 14px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  max-width: 100%;
}
.feedback-hint .x-icon {
  flex-shrink: 0;
  color: var(--text-dim);
}
.feedback-hint a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--transition);
}
.feedback-hint a:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ── TOPBAR MODE PILLS ── */
.mode-pills {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px;
  gap: 2px;
}
[data-theme="light"] .mode-pills {
  background: rgba(0, 0, 0, 0.06);
}
.pill-btn {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  transition: all var(--transition);
  white-space: nowrap;
}
.pill-btn:hover {
  color: var(--text);
}
.pill-btn.active {
  background: var(--accent);
  color: #091726;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ── TRIVIA TEASER CARD (TITLE SCREEN) ── */
.trivia-teaser-card {
  margin: 16px 0 20px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.08) 0%, rgba(47, 184, 255, 0.06) 100%);
  border: 1px solid rgba(245, 197, 66, 0.25);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.trivia-teaser-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.ttc-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}
.ttc-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent);
  text-transform: uppercase;
}
.ttc-title {
  font-family: 'Oswald', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.ttc-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.3;
}
.ttc-btn {
  padding: 6px 12px;
  background: var(--accent);
  color: #091726;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   SUDDEN DEATH TRIVIA STYLES
═══════════════════════════════════════ */

.trivia-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── HUD ── */
.trivia-hud {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.hud-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.hud-box.highlight {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.hud-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.hud-val {
  font-family: 'Oswald', sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.streak-val {
  color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
}
.best-val {
  color: var(--blue);
}

.trivia-pucks {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
}
.trivia-puck {
  transition: all 0.25s ease;
  line-height: 1;
}
.trivia-puck.active {
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
}
.trivia-puck.lost {
  opacity: 0.25;
  filter: grayscale(1) contrast(0.5);
  transform: scale(0.85);
}

/* ── PLAY CARD ── */
.trivia-play-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}
.trivia-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.trivia-cat-pill {
  padding: 4px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.trivia-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.35);
  color: var(--accent);
  padding: 3px 9px;
  border-radius: 99px;
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
}
.trivia-timer-badge .timer-icon {
  font-size: 13px;
}
.trivia-timer-badge.warn {
  background: rgba(255, 179, 0, 0.15);
  border-color: rgba(255, 179, 0, 0.5);
  color: #ffb300;
}
.trivia-timer-badge.danger {
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.7);
  color: #ff3b30;
  animation: pulseTimerBadge 0.6s infinite alternate;
}
@keyframes pulseTimerBadge {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 59, 48, 0); }
  100% { transform: scale(1.08); box-shadow: 0 0 10px rgba(255, 59, 48, 0.5); }
}

.trivia-timer-track {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: -6px;
  margin-bottom: 2px;
}
.trivia-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00e5ff, #00ff88);
  border-radius: 99px;
  transition: background 0.3s ease;
}
.trivia-timer-fill.warn {
  background: linear-gradient(90deg, #ffb300, #ff9100);
}
.trivia-timer-fill.danger {
  background: linear-gradient(90deg, #ff5252, #ff1744);
}
.trivia-q-text {
  font-family: 'Oswald', sans-serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  text-align: left;
}

/* ── OPTIONS GRID ── */
.trivia-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.trivia-opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  transition: all var(--transition);
}
.trivia-opt-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.trivia-opt-btn:active:not(:disabled) {
  transform: translateY(0);
}
.opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
}
[data-theme="light"] .opt-letter {
  background: rgba(0, 0, 0, 0.06);
}
.opt-text {
  flex-grow: 1;
  line-height: 1.3;
}

/* Correct / Wrong states */
.trivia-opt-btn.correct {
  background: rgba(67, 224, 138, 0.18) !important;
  border-color: var(--green) !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(67, 224, 138, 0.35);
}
.trivia-opt-btn.correct .opt-letter {
  background: var(--green) !important;
  color: #091726 !important;
}
.trivia-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  animation: shake 0.35s ease;
}
.trivia-opt-btn.wrong .opt-letter {
  background: #ef4444 !important;
  color: #ffffff !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ── KURIOSA FACT BOX ── */
.trivia-fact-box {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(47, 184, 255, 0.08);
  border: 1px solid rgba(47, 184, 255, 0.22);
  border-radius: var(--radius-sm);
  animation: fadeIn 0.25s ease;
}
.fact-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1.2;
}
.fact-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fact-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--blue);
  text-transform: uppercase;
}
.fact-text {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.4;
}

.trivia-advance-btn {
  width: 100%;
  margin-top: 4px;
  animation: pulse 1.5s infinite;
}

/* Explicit hide rules for trivia state transitions */
.trivia-hud[hidden],
.trivia-play-card[hidden],
.trivia-fact-box[hidden],
.trivia-advance-btn[hidden],
.trivia-gameover-card[hidden],
.new-record-badge[hidden] {
  display: none !important;
}

/* ── GAME OVER CARD (DEDIKERAD SLUTSKÄRM) ── */
.trivia-gameover-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 20px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.35s ease;
  width: 100%;
}
.go-icon {
  font-size: 40px;
}
.go-heading {
  font-family: 'Oswald', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ef4444;
}
.go-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: -8px;
}
.go-score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 24px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 100%;
}
.go-score-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.go-streak-big {
  font-family: 'Oswald', sans-serif;
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 20px var(--accent-glow);
}
.new-record-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  margin-top: 4px;
}
.go-tier-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════
   LEADERBOARD (TOPPLISTA) & MODAL
═══════════════════════════════════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-icon { font-size: 22px; line-height: 1; }
.modal-title {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  color: var(--text);
}
.close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.close-btn:hover {
  color: var(--text);
}

/* Mode tabs */
.lb-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.08);
}
.lb-tab {
  flex: 1;
  padding: 8px 6px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: all var(--transition);
}
.lb-tab.active {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Scope toggle: Denna vecka vs Hall of Fame */
.lb-scope-toggle {
  display: flex;
  gap: 6px;
  padding: 6px 14px 10px;
  background: rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid var(--line);
}
.lb-scope-btn {
  flex: 1;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: all var(--transition);
}
.lb-scope-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}
.lb-scope-btn.active {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.4);
  color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
}
#lbWeekBadge {
  color: #4ade80;
  font-weight: 700;
}

/* Table */
.lb-table-wrap {
  overflow-y: auto;
  max-height: 52vh;
  padding: 0 16px;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.lb-table th {
  padding: 10px 8px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.lb-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
[data-theme="light"] .lb-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.th-rank, .td-rank { width: 38px; text-align: center; }
.th-name, .td-name { font-weight: 600; color: var(--text); }
.th-record, .td-record { text-align: center; color: var(--text-dim); font-size: 12px; }
.th-diff, .td-diff { text-align: center; width: 46px; font-weight: 700; font-size: 12px; color: #4ade80; }
.th-pts, .td-pts { text-align: right; width: 62px; font-weight: 700; font-family: 'Oswald', sans-serif; font-size: 14.5px; color: var(--accent); }

.lb-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
}
.rank-gold { background: #f5c542; color: #1a0e00; }
.rank-silver { background: #b0bec5; color: #0a1520; }
.rank-bronze { background: #cd7f32; color: #fff; }
.rank-num { color: var(--text-dim); }

.lb-user-row {
  background: rgba(245, 197, 66, 0.12) !important;
}
.lb-user-row .td-name {
  color: var(--accent) !important;
}
.lb-user-badge {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.lb-note {
  padding: 12px 20px;
  margin: 0;
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.04);
}

/* Qualify Banner on Results */
.lb-qualify-card {
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.15) 0%, rgba(245, 197, 66, 0.04) 100%);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0 20px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.lb-qualify-card[hidden] { display: none !important; }
.lb-qualify-badge {
  display: inline-block;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.lb-qualify-text {
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 12px;
}
.lb-input-row {
  display: flex;
  gap: 8px;
  max-width: 340px;
  margin: 0 auto;
}
.lb-input {
  flex: 1;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.lb-input:focus {
  border-color: var(--accent);
}
.lb-submit-btn {
  padding: 9px 14px !important;
  font-size: 13px !important;
  white-space: nowrap;
}

/* ── RESPONSIVE ── */
@media (max-width: 360px) {
  .mode-grid { grid-template-columns: 1fr; }
  .logo-text  { font-size: 44px; }
  .reel span  { font-size: 14px; }
  .pc-name    { font-size: 16px; }
  .pc-rating  { font-size: 22px; }
  .share-row  { grid-template-columns: 1fr; }
  .mode-pills { display: none; }
}

@media (min-width: 480px) {
  .reel span { font-size: 19px; }
  .pc-name   { font-size: 19px; }
}
