/* ---------------------------------------------------------------
   Salami Board — ballpark scoreboard aesthetic
   Palette: scoreboard green, chalk, lamp amber, live red
---------------------------------------------------------------- */
:root {
  --green-900: #101f17;   /* page background */
  --green-800: #16281d;   /* deep panel */
  --green-700: #1d3527;   /* card */
  --green-600: #274434;   /* raised / hover */
  --hairline:  #2f5040;
  --chalk:     #f1ebdd;   /* primary text */
  --chalk-dim: #b9c6b6;   /* secondary text */
  --sage:      #7e9484;   /* labels */
  --amber:     #ffb52e;   /* lamp numerals */
  --amber-dim: #8a6a2a;
  --red:       #e4572e;   /* live / over territory */
  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-mono: "Spline Sans Mono", "Courier New", monospace;
  --font-body: "Archivo", system-ui, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -200px, #1b3325 0%, transparent 70%),
    var(--green-900);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--hairline);
  background: var(--green-800);
}

.wordmark { display: flex; align-items: center; gap: 12px; }

.wordmark-sigma {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--green-900);
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
}

.wordmark-text { display: flex; flex-direction: column; line-height: 1.1; }

.wordmark-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wordmark-sub {
  color: var(--sage);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-controls { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; }

.control { display: flex; flex-direction: column; gap: 5px; }

.control-label {
  color: var(--sage);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

input[type="date"], input[type="number"], input[type="text"],
input[type="time"], select {
  background: var(--green-700);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 8px 10px;
  min-width: 0;
}

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

#line-input { width: 110px; }

.side-toggle { display: flex; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; }

.side-btn {
  background: var(--green-700);
  border: none;
  color: var(--chalk-dim);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  cursor: pointer;
}

.side-btn + .side-btn { border-left: 1px solid var(--hairline); }

.side-btn.active { background: var(--amber); color: var(--green-900); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 48px;
}

.main-col { min-width: 0; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--green-700), var(--green-800));
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px clamp(20px, 4vw, 36px) 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 24px;
  align-items: end;
}

.hero-label {
  display: block;
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.hero-number {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(64px, 12vw, 104px);
  line-height: 0.95;
  color: var(--amber);
  text-shadow: 0 0 24px rgba(255, 181, 46, 0.28);
  font-variant-numeric: tabular-nums;
}

.hero-verdict {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--chalk-dim);
}

.hero-verdict.hit { color: var(--amber); font-weight: 600; }
.hero-verdict.busted { color: var(--red); font-weight: 600; }

.hero-line { text-align: right; }

.hero-line-number {
  display: block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(30px, 5vw, 44px);
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
}

.hero-side-chip[hidden] { display: none; }

.hero-side-chip {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border: 1px solid var(--amber-dim);
  border-radius: 999px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Signature: lamp strip — one bulb per run up to the line */
.lamp-strip {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.lamp {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green-600);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
  transition: background 200ms ease, box-shadow 200ms ease;
}

.lamp.lit {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 181, 46, 0.5);
}

.lamp.over {
  background: var(--red);
  box-shadow: 0 0 8px rgba(228, 87, 46, 0.5);
}

.lamp.line-mark {
  width: 3px; height: 16px;
  border-radius: 2px;
  background: var(--chalk);
  align-self: center;
  box-shadow: none;
}

.hero-meta {
  grid-column: 1 / -1;
  color: var(--sage);
  font-size: 13px;
  margin-top: 10px;
}

.hero-meta .dot { margin: 0 8px; }

/* ---------- Ad slots ---------- */
.ad-slot {
  display: grid;
  place-items: center;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  color: var(--sage);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(255,255,255,0.015) 12px, rgba(255,255,255,0.015) 24px);
}

.ad-leaderboard { height: 90px; max-width: 728px; margin: 24px auto; width: 100%; }
.ad-rect { height: 250px; width: 100%; max-width: 300px; margin: 0 auto; }

/* ---------- Ledger ---------- */
.ledger {
  background: var(--green-800);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px clamp(14px, 3vw, 24px) 14px;
}

.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.ledger-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ledger-note {
  color: var(--sage);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: none;
  margin-left: 8px;
}

.ledger-cols, .game-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 150px 58px 60px;
  gap: 12px;
  align-items: center;
}

.ledger-cols {
  color: var(--sage);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline);
}

.ledger-cols .col-running, .running-cell { text-align: right; }

.games-list { list-style: none; margin: 0; padding: 0; }

.game-row {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(47, 80, 64, 0.5);
}

.game-row:last-child { border-bottom: none; }

.game-row.final { opacity: 0.92; }

.time-cell {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--chalk-dim);
  font-variant-numeric: tabular-nums;
}

.matchup-cell { min-width: 0; }

.matchup-teams {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matchup-teams .at { color: var(--sage); font-weight: 400; padding: 0 4px; }

.status-tag {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
}

.status-tag.live { color: var(--red); }
.status-tag.live::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  margin-right: 5px;
  animation: pulse 1.6s ease-in-out infinite;
}

.status-tag.final { color: var(--chalk-dim); }

@keyframes pulse { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .status-tag.live::before { animation: none; }
  .lamp { transition: none; }
}

.score-cell { display: flex; align-items: center; gap: 6px; }

.score-input {
  width: 52px;
  text-align: center;
  padding: 6px 4px;
  font-variant-numeric: tabular-nums;
}

.score-dash { color: var(--sage); }

.runs-cell {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--chalk);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.running-cell {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--sage);
  cursor: pointer;
  font-size: 14px;
  padding: 5px 7px;
}

.icon-btn:hover { border-color: var(--hairline); color: var(--chalk); }

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--chalk-dim);
}

.empty-state p { margin: 4px 0; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--green-600);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--chalk);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
}

.btn:hover { background: var(--green-700); }

.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--green-900); }
.btn-primary:hover { background: #ffc45a; }

.btn-danger { color: #f0a48d; }
.btn-danger:hover { border-color: var(--red); color: var(--red); background: var(--green-700); }

.btn-block { width: 100%; }

/* ---------- Rail ---------- */
.rail { display: flex; flex-direction: column; gap: 20px; }

.rail-card {
  background: var(--green-800);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.rail-card h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.summary-list { margin: 0; }

.summary-list div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(47, 80, 64, 0.5);
}

.summary-list div:last-child { border-bottom: none; }

.summary-list dt { color: var(--chalk-dim); font-size: 13px; }

.summary-list dd {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.rail-actions { display: flex; flex-direction: column; gap: 8px; }

.rail-note { color: var(--sage); font-size: 12px; margin: 12px 0 0; }

/* ---------- Dialog ---------- */
.game-dialog {
  background: var(--green-700);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  color: var(--chalk);
  padding: 24px;
  width: min(480px, calc(100vw - 32px));
}

.game-dialog::backdrop { background: rgba(6, 12, 9, 0.7); }

.game-dialog h3 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sage);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--hairline);
  padding: 24px clamp(16px, 4vw, 40px) 40px;
  text-align: center;
  color: var(--chalk-dim);
  font-size: 13px;
}

.footer p { max-width: 640px; margin: 6px auto; }

.footer-fine { color: var(--sage); font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; }
  .rail-card { flex: 1 1 280px; }
}

@media (max-width: 680px) {
  .ledger-cols { display: none; }

  .game-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "matchup runs"
      "score   score"
      "time    actions";
    gap: 8px 12px;
  }

  .time-cell { grid-area: time; }
  .matchup-cell { grid-area: matchup; }
  .score-cell { grid-area: score; }
  .runs-cell {
    grid-area: runs;
    text-align: right;
    font-size: 18px;
    font-weight: 700;
    color: var(--amber);
  }
  .row-actions { grid-area: actions; }

  .hero { grid-template-columns: 1fr; }
  .hero-line { text-align: left; }
}

/* ---------- Live sync ---------- */
.ledger-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--chalk-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}

.auto-refresh-toggle input { accent-color: var(--amber); }

.sync-status {
  margin: 0 0 10px;
  min-height: 18px;
  padding: 0 10px;
  color: var(--sage);
  font-size: 12px;
}

.sync-status.ok { color: var(--chalk-dim); }
.sync-status.warn { color: var(--red); }

.score-live {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
}

.sum-total-row dd {
  color: var(--amber);
  font-size: 20px;
  font-weight: 700;
}


/* ---------- Runs split ---------- */
.split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

.split-card {
  background: var(--green-800);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.split-label {
  color: var(--sage);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.split-number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
}


@media (max-width: 480px) {
  .split-row { grid-template-columns: 1fr; gap: 12px; }
}

/* ---------- Site nav + content pages ---------- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  justify-content: center;
  padding: 10px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--hairline);
  background: var(--green-900);
}

.site-nav a {
  color: var(--chalk-dim);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 2px;
}

.site-nav a:hover { color: var(--chalk); }
.site-nav a[aria-current="page"] { color: var(--amber); }

.topbar-simple { justify-content: center; }
.topbar-simple .wordmark { text-decoration: none; color: inherit; }

.page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 40px) 56px;
}

.prose h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(34px, 6vw, 46px);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.prose .lede {
  color: var(--amber);
  font-size: 17px;
  margin: 0 0 28px;
}

.prose h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 34px 0 10px;
}

.prose p {
  color: var(--chalk-dim);
  font-size: 15.5px;
  line-height: 1.75;
  margin: 0 0 16px;
}

.prose a { color: var(--amber); text-decoration-color: var(--amber-dim); }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  justify-content: center;
  margin-bottom: 12px;
}

.footer-nav a {
  color: var(--chalk-dim);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-nav a:hover { color: var(--amber); }

/* Ad units inside placeholder frames */
.ad-slot { position: relative; overflow: hidden; }

.ad-placeholder-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 0;
}

.ad-slot ins.adsbygoogle {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.ad-inarticle {
  min-height: 120px;
  margin: 36px 0 8px;
}

/* ---------- Contact form ---------- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 460px;
  margin-top: 8px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.contact-form textarea {
  background: var(--green-700);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px;
  resize: vertical;
}

.contact-form button { align-self: flex-start; }

.hp-field { position: absolute; left: -9999px; }
