/* ============================================================
   Steelers Squares -- design system
   Direction: stadium scoreboard / game-day ticket. Black & gold
   is real subject material here (the team's own colors), not
   decoration. No gradients anywhere in this file, by design brief.
   ============================================================ */

/* ---- Tokens ------------------------------------------------ */
:root {
  --paper: #FFFFFF;
  --ink: #1C1C1C;
  --obsidian: #121212;
  --silver: #E0E0E0;
  --gold: #FFB612;    /* signature accent -- Steelers gold */
  --ember: #C1531B;   /* secondary accent -- pending/warning */

  /* Light theme (PRD 6.2 exact values) */
  --bg: var(--paper);
  --fg: var(--ink);
  --line: var(--ink);         /* "classic high-contrast lines" */
  --panel-bg: var(--paper);
  --muted: #6b6b6b;

  --font-display: 'Anton', system-ui, sans-serif;
  --font-body: 'Work Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;

  --radius: 4px;
  --nav-height: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--obsidian);
    --fg: var(--silver);
    --line: var(--gold);      /* "vibrant color borders" */
    --panel-bg: #1a1a1a;
    --muted: #9a9a9a;
  }
}

:root[data-theme="dark"] {
  --bg: var(--obsidian);
  --fg: var(--silver);
  --line: var(--gold);
  --panel-bg: #1a1a1a;
  --muted: #9a9a9a;
}

:root[data-theme="light"] {
  --bg: var(--paper);
  --fg: var(--ink);
  --line: var(--ink);
  --panel-bg: var(--paper);
  --muted: #6b6b6b;
}

/* ---- Reset --------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: calc(var(--nav-height) + 1rem);
  transition: background-color 0.2s ease, color 0.2s ease;
}
@media (min-width: 1025px) {
  body { padding-bottom: 1rem; padding-top: calc(var(--nav-height) + 1rem); }
}
a { color: var(--fg); }
button, input, select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
}
button {
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
button:hover { border-color: var(--gold); }
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Flash messages ------------------------------------------ */
.flash { max-width: 960px; margin: 0.75rem auto 0; padding: 0 1.25rem; }
.flash-error {
  color: var(--paper);
  background: var(--ember);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-weight: 600;
}
.flash-success {
  color: var(--obsidian);
  background: var(--gold);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-weight: 600;
}

/* ---- Status chips --------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.chip-live {
  background: var(--ember);
  color: var(--paper);
  border-color: var(--ember);
}
.chip-live::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--paper);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* ---- Axis legend (which axis is Steelers vs. the opponent) ---- */
.axis-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0 0 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.axis-legend-item { display: inline-flex; align-items: baseline; gap: 0.35rem; font-weight: 700; }
.axis-legend-steelers { color: var(--gold); }
.axis-legend-opponent { color: var(--fg); }
.axis-legend-note {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
  font-size: 0.72rem;
}

/* ---- The scoreboard grid --------------------------------------- */
.scoreboard-wrap {
  overflow: auto;
  max-width: 100%;
  width: fit-content;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  background: var(--panel-bg);
}
table.grid {
  border-collapse: separate;
  border-spacing: 2px;
  padding: 2px;
}
table.grid th, table.grid td {
  width: 2.6rem;
  height: 2.6rem;
  text-align: center;
  vertical-align: middle;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 2px;
}
/* axis header tiles -- "illuminated scoreboard" digits */
table.grid th {
  background: var(--obsidian);
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  text-shadow: 0 0 6px var(--gold);
  position: sticky;
  z-index: 10;
}
table.grid th.corner { background: transparent; box-shadow: none; text-shadow: none; }
@media (max-width: 768px) {
  table.grid th.col-header { top: 0; }
  table.grid th.row-header { left: 0; }
}

td.cell-open {
  background: var(--bg);
  border: 1px dashed var(--muted);
  color: var(--muted);
}
td.cell-open label { display: block; width: 100%; height: 100%; cursor: pointer; }
td.cell-open input[type="checkbox"] { display: none; }
td.cell-open:has(input:checked) {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: var(--obsidian);
}

td.cell-taken {
  background: var(--panel-bg);
  border: 2px dashed var(--gold);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
}
td.cell-taken:hover { border-style: solid; }

.no-axis-note {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.75rem;
}

/* ---- Popover (ticket stub) -------------------------------------- */
#square-popover {
  position: fixed;
  display: none;
  min-width: 12rem;
  max-width: 16rem;
  background: var(--panel-bg);
  border: 2px solid var(--gold);
  border-top: 4px dashed var(--gold);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  z-index: 100;
  animation: popover-in 0.12s ease-out;
}
#square-popover.visible { display: block; }
@keyframes popover-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
#square-popover .popover-close {
  position: absolute;
  top: 0.3rem; right: 0.4rem;
  background: none; border: none;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.2rem 0.5rem;
}
#square-popover .popover-name { font-weight: 700; margin-bottom: 0.15rem; }
#square-popover .popover-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---- Claim form -------------------------------------------------- */
form.claim-form {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
form.claim-form label { display: block; margin: 0.6rem 0 0.2rem; font-size: 0.9rem; }
form.claim-form input, form.claim-form select { width: 100%; max-width: 24rem; }
form.claim-form button[type="submit"] {
  margin-top: 1rem;
  background: var(--gold);
  color: var(--obsidian);
  border-color: var(--gold);
}

/* ---- Nav: bottom tab bar (mobile) / top bar (desktop) ------------- */
nav.app-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-height);
  background: var(--obsidian);
  border-top: 2px solid var(--gold);
  display: flex;
  z-index: 200;
}
nav.app-nav a, nav.app-nav button.nav-more {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--silver);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0.4rem;
}
nav.app-nav a.active { color: var(--gold); }
nav.app-nav a:hover, nav.app-nav button.nav-more:hover { color: var(--gold); border: none; }

@media (min-width: 1025px) {
  nav.app-nav {
    top: 0; bottom: auto;
    border-top: none;
    border-bottom: 2px solid var(--gold);
    justify-content: flex-start;
    padding: 0 1.25rem;
  }
  nav.app-nav a, nav.app-nav button.nav-more {
    flex: none;
    flex-direction: row;
    gap: 0.4rem;
    padding: 0 1.25rem;
    font-size: 0.85rem;
  }
}

#overflow-sheet {
  position: fixed;
  display: none;
  right: 1rem;
  bottom: calc(var(--nav-height) + 0.5rem);
  background: var(--panel-bg);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.5rem;
  min-width: 10rem;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
#overflow-sheet.visible { display: flex; flex-direction: column; }
#overflow-sheet a {
  padding: 0.6rem 0.5rem;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 600;
  border-bottom: 1px solid var(--muted);
}
#overflow-sheet a:last-child { border-bottom: none; }
@media (min-width: 1025px) {
  #overflow-sheet { top: calc(var(--nav-height) + 0.5rem); bottom: auto; }
}

/* ---- Admin surface: its own simple top bar, no player nav/popover ---- */
nav.admin-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--obsidian);
  border-bottom: 2px solid var(--gold);
  margin-bottom: 1.25rem;
}
nav.admin-nav a {
  color: var(--silver);
  text-decoration: none;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
nav.admin-nav a:hover { color: var(--gold); }
nav.admin-nav .admin-nav-trailing {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
/* Theme toggle lives inline in the admin nav, not in the fixed corner
   position the public pages use. */
nav.admin-nav #theme-toggle {
  position: static;
  padding: 0.4rem 0.7rem;
  font-size: 0.7rem;
}

#theme-toggle {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 210;
  padding: 0.4rem 0.7rem;
  font-size: 0.7rem;
}
@media (min-width: 1025px) {
  #theme-toggle { position: static; margin-left: auto; align-self: center; }
  nav.app-nav { align-items: center; }
}

/* ---- Simple content tables (prior results, payout schedule) -------- */
table.data-table { border-collapse: collapse; width: 100%; margin-bottom: 1.5rem; }
table.data-table th, table.data-table td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  text-align: left;
  font-size: 0.9rem;
}
table.data-table th {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--panel-bg);
}

/* ---- What-If tool ---------------------------------------------- */
.scenario-list { list-style: none; margin: 0; padding: 0; }
.scenario-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  background: var(--panel-bg);
}
.scenario-card.mine { border: 2px solid var(--gold); }
.scenario-label { font-weight: 700; }
.scenario-digits { font-family: var(--font-mono); color: var(--muted); font-size: 0.85rem; }
.scenario-owner { font-family: var(--font-mono); font-size: 0.85rem; }
.summary-banner {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 1.1rem;
  padding: 1rem;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

/* ---- Admin "Weekly Update" clipboard panel ---- */
.summary-panel textarea {
  width: 100%;
  max-width: 32rem;
  height: 6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ---- Print (PRD 6.3): maximize the grid onto a physical 8.5x11 sheet,
   hide anything that isn't the board itself. ---- */
@page {
  size: letter portrait;
  margin: 0.5in;
}
@media print {
  #theme-toggle,
  nav.app-nav,
  nav.admin-nav,
  #overflow-sheet,
  #square-popover,
  .flash,
  .eyebrow,
  form.claim-form h2,
  form.claim-form label,
  form.claim-form button,
  form.claim-form input,
  form.claim-form select {
    display: none !important;
  }
  body { padding: 0; background: #fff; color: #000; }
  main { max-width: 100%; padding: 0; }
  h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }

  /* Fill the printable width rather than sitting at the grid's normal
     screen size -- table-layout:fixed spreads all 11 columns evenly. */
  .scoreboard-wrap { border-color: #000; width: 100%; max-width: 100%; }
  table.grid {
    width: 100%;
    table-layout: fixed;
    border-spacing: 2px;
  }
  table.grid th, table.grid td {
    width: auto;
    height: 0.7in;
    font-size: 1rem;
  }
  table.grid th {
    background: #fff;
    color: #000;
    text-shadow: none;
    border: 1px solid #000;
    font-size: 1.15rem;
  }
  td.cell-taken { border: 1px solid #000; font-size: 0.85rem; }
  td.cell-open { border: 1px dashed #999; }
}
