:root {
  /* Base layout tokens */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  --radius-sm: 6px;
  --radius-md: 8px;

  /* Background image and tint */
  --mlb-bg-image: url("/Images/bg-deadshow.webp");
  --mlb-tint: rgba(243, 178, 62, 0.24);

  /* Header tokens */
  --mlb-header-bg: #FDF8F4;
  --mlb-header-opacity: 0.7;
  --mlb-header-height: 140px;
  --mlb-header-pad-y: 8px;
  --mlb-header-pad-x: 16px;
  --mlb-header-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

  /* Warm retro-modern palette */
  --mlb-bg: #fdf8f4;
  --mlb-panel-bg: #ffffff;
  --mlb-border-subtle: rgba(0, 0, 0, 0.08);
  --mlb-text-main: #111827;
  --mlb-text-muted: #6b7280;
  --mlb-primary: #e36f4c;
  --mlb-primary-soft: #f3b23e;

  /* Backwards-compatible aliases */
  --bg: var(--mlb-bg);
  --ink: var(--mlb-text-main);
  --muted: var(--mlb-text-muted);
  --line: var(--mlb-border-subtle);
  --color-panel: var(--mlb-panel-bg);
  --color-border: var(--mlb-border-subtle);
  --color-muted: var(--mlb-text-muted);
  --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.08);
}

/* === BASE STYLES === */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--mlb-bg);
  color: var(--mlb-text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  line-height: 1.5;
}

/* === BACKGROUND PHOTO + TINT === */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background-image: var(--mlb-bg-image);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0.6;
}

body::after {
  background: var(--mlb-tint);
}

/* === TYPOGRAPHY === */
h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.sub {
  color: var(--muted);
  font-size: 14px;
}

.note {
  color: var(--muted);
  font-size: 14px;
}

.tab-title {
  font-size: 18px;
  font-weight: 600;
}

/* === LAYOUT === */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .top-row {
    flex-direction: column;
  }
}

/* === FIXED HEADER === */
#fixedHeader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--mlb-header-bg);
  opacity: var(--mlb-header-opacity);
  box-shadow: var(--mlb-header-shadow);
  backdrop-filter: blur(2px);
  padding: 4px 0 !important;
}

#fixedHeader .header-inner {
  padding: 4px 16px !important;
  gap: 2px !important;
}

#fixedHeader .play-wrap {
  margin-top: -8px !important;
  margin-bottom: 4px !important;
}

main.app-main {
  padding-top: calc(var(--mlb-header-height));
}

/* === PANELS === */
.panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(1.05) blur(0.5px);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.panel-head {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.panel-body {
  padding: var(--space-3);
}

.panel.hero-panel,
.panel.auth-panel,
.panel.leaderboard-panel {
  min-height: 40px;
}

.panel.hero-panel {
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

section.panel.years-panel {
  margin: var(--space-6) 0 !important;
  padding: 12px !important;
  background: rgba(139, 157, 175, 0.60) !important;
}

.years-panel h4 {
  display: none;
}

.answer-panel {
  margin: var(--space-6) 0 !important;
  padding: 12px !important;
  background: rgba(139, 157, 175, 0.6) !important;
}

/* === BUTTONS & INPUTS === */
.input {
  width: 100%;
  height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
}

button,
input[type="text"] {
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #000;
}

button {
  background: var(--mlb-primary);
  color: #fff;
  border-color: var(--mlb-primary);
  cursor: pointer;
  transition: filter 0.2s;
}

button:hover {
  filter: brightness(0.9);
}

button:disabled {
  background: #bbb;
  border-color: #bbb;
  color: #fff;
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--mlb-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background: #155fc3;
  transform: scale(1.03);
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* === YEAR GRID === */
.years,
.years-guess,
.years-browse {
  display: grid;
  gap: 8px;
}

.years {
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

.years-guess,
.years-browse {
  grid-template-columns: repeat(6, 1fr);
}

/* Year buttons */
.years a,
.years button,
.years-guess button,
.years-browse button {
  display: block;
  text-align: center;
  padding: 10px 0;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #F3B23E;
  transition: background 0.18s ease, transform 0.08s ease;
  cursor: pointer;
}

.years a:hover,
.years button:hover,
.years-guess button:hover:not(.used),
.years-browse button:hover {
  background: #5B8FA3;
  transform: translateY(-1px);
}

.years-guess button.used {
  background: #D26757;
  color: #fff;
  border-color: #D26757;
  cursor: default;
}

.years-guess button.used:hover {
  background: #D26757;
  transform: none;
}

/* === PLAY CONTROLS === */
.play-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  margin-top: -6px;
}

#statusEl {
  margin-top: 2px;
  color: var(--color-muted);
}

#gameStatus {
  text-align: center;
  margin-top: 8px;
}

/* === AUTH PANEL === */
.auth-login {
  display: block;
}

.auth-logged {
  display: none;
}

.is-authed .auth-login {
  display: none;
}

.is-authed .auth-logged {
  display: block;
}

/* === LINKS === */
a.link {
  color: var(--accent);
  text-decoration: none;
}

a.link:hover {
  text-decoration: underline;
}

/* Answer panel track links */
#answer .gt-play,
#answer .gt-play:visited {
  color: #9ca3af !important;
  text-decoration: none;
}

#answer .gt-play:hover {
  color: #d1d5db !important;
  text-decoration: underline;
}

/* Bottom panel track links */
#bottom-show .bottom-play,
#bottom-show .bottom-play:visited {
  color: #9ca3af !important;
  text-decoration: none;
}

#bottom-show .bottom-play:hover {
  color: #d1d5db !important;
  text-decoration: underline;
}

/* === LISTS === */
.list {
  margin-top: 10px;
}

ol {
  padding-left: 5px;
}

ol li {
  margin: 6px 0;
}
