:root {
  --brown: #2F241D;
  --brown-2: #3d2f26;
  --brown-3: #4d3c30;
  --gold: #FFC425;
  --gold-soft: #ffd968;
  --sand: #f5ead8;
  --ink: #241b15;
  --white: #fffdf8;
  --green: #3fa34d;
  --red: #c0392b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--brown);
  color: var(--sand);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 10px;
  background: linear-gradient(180deg, #1f1712, var(--brown));
}
.masthead .logo { width: 56px; height: 56px; }
.masthead h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  letter-spacing: 1.5px;
  color: var(--gold);
  line-height: 1;
}
.tagline { font-size: .8rem; color: var(--sand); opacity: .8; }

.tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding: 8px 12px;
  background: var(--brown-2);
  position: sticky;
  top: 0;
  z-index: 10;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 1px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sand);
  cursor: pointer;
}
.tabs button.active { background: var(--gold); color: var(--ink); }

main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 16px; }
.tab { display: none; }
.tab.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.loading { text-align: center; padding: 48px 0; opacity: .7; }

.card {
  background: var(--brown-2);
  border: 1px solid var(--brown-3);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 10px;
}

/* ------- scoreboard ------- */
.score-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.team-block img { width: 64px; height: 64px; }
.team-block .tname { font-weight: 800; font-size: .95rem; margin-top: 4px; }
.team-block .trec { font-size: .75rem; opacity: .7; }
.big-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.6rem;
  color: var(--white);
  line-height: 1;
}
.big-score .sep { color: var(--gold); margin: 0 10px; }
.game-status {
  text-align: center;
  font-weight: 600;
  color: var(--gold);
  margin: 8px 0 2px;
}
.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); margin-right: 6px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.count-row {
  display: flex; justify-content: center; gap: 18px;
  font-size: .9rem; margin-top: 8px;
}
.count-row b { color: var(--gold); }

.diamond {
  width: 90px; height: 90px; margin: 10px auto;
}
.diamond .base { fill: var(--brown-3); stroke: var(--sand); stroke-width: 2; }
.diamond .base.on { fill: var(--gold); }

.matchup {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px;
  font-size: .85rem; text-align: center;
}
.matchup .who { color: var(--gold-soft); font-weight: 600; }

.lastplay {
  margin-top: 12px; padding: 10px 12px;
  background: var(--brown); border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0; font-size: .9rem;
}

table.linescore, table.standings-tbl {
  width: 100%; border-collapse: collapse; font-size: .85rem;
}
table.linescore th, table.linescore td,
table.standings-tbl th, table.standings-tbl td {
  padding: 6px 8px; text-align: center;
  border-bottom: 1px solid var(--brown-3);
}
table.linescore td:first-child, table.linescore th:first-child,
table.standings-tbl td:first-child, table.standings-tbl th:first-child { text-align: left; }
table.standings-tbl tr.padres { background: rgba(255, 196, 37, .12); }
table.standings-tbl tr.padres td:first-child { color: var(--gold); font-weight: 800; }
.tbl-wrap { overflow-x: auto; }

.countdown {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem; color: var(--white); text-align: center; letter-spacing: 2px;
}

/* ------- schedule ------- */
.month-h {
  font-family: 'Bebas Neue', sans-serif; color: var(--gold);
  font-size: 1.3rem; letter-spacing: 1px; margin: 18px 0 8px;
}
.sched-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--brown-3);
  font-size: .88rem;
}
.sched-row .d { opacity: .75; font-size: .8rem; }
.sched-row .res-w { color: var(--green); font-weight: 800; }
.sched-row .res-l { color: #e07b6d; font-weight: 800; }
.sched-row .time { color: var(--gold-soft); }

/* ------- players ------- */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.player-card {
  background: var(--brown-2);
  border: 1px solid var(--brown-3);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  transition: transform .12s ease, border-color .12s ease;
}
.player-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.player-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #d9cfc0; }
.player-card .pname { font-weight: 600; font-size: .85rem; padding: 8px 6px 2px; }
.player-card .pmeta { font-size: .75rem; color: var(--gold-soft); padding-bottom: 10px; }

.pos-h {
  font-family: 'Bebas Neue', sans-serif; color: var(--gold);
  font-size: 1.25rem; letter-spacing: 1px; margin: 18px 0 10px;
}

/* ------- modal ------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--brown-2); border: 1px solid var(--brown-3);
  border-radius: 16px; max-width: 560px; width: 100%;
  max-height: 85vh; overflow-y: auto; padding: 20px; position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: 0; color: var(--sand);
  font-size: 1.6rem; cursor: pointer;
}
.pp-head { display: flex; gap: 14px; align-items: center; }
.pp-head img { width: 90px; height: 90px; border-radius: 12px; object-fit: cover; background: #d9cfc0; }
.pp-head h3 { color: var(--gold); font-family: 'Bebas Neue', sans-serif; font-size: 1.6rem; letter-spacing: 1px; }
.pp-bio { font-size: .82rem; opacity: .85; margin-top: 4px; }
.pp-stats h4 { color: var(--gold-soft); margin: 14px 0 6px; font-size: .9rem; }
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px;
}
.stat-box {
  background: var(--brown); border-radius: 8px; padding: 8px 4px; text-align: center;
}
.stat-box .v { font-family: 'Bebas Neue', sans-serif; font-size: 1.3rem; color: var(--white); }
.stat-box .k { font-size: .65rem; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }

/* ------- news ------- */
.news-item {
  display: block; padding: 12px 14px; margin-bottom: 10px;
  background: var(--brown-2); border: 1px solid var(--brown-3);
  border-radius: 12px; text-decoration: none; color: var(--sand);
  transition: border-color .12s ease;
}
.news-item:hover { border-color: var(--gold); }
.news-item .nt { font-weight: 600; font-size: .95rem; }
.news-item .nm { font-size: .75rem; color: var(--gold-soft); margin-top: 4px; }

/* ------- leaders ------- */
.leader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.leader-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: .88rem; border-bottom: 1px dashed var(--brown-3); }
.leader-row:last-child { border-bottom: 0; }
.leader-row .lv { color: var(--gold); font-weight: 800; }

footer {
  text-align: center; padding: 26px 16px 34px;
  background: #1f1712; font-size: .82rem;
}
.mazel { color: var(--gold); font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; letter-spacing: 2px; }
.fineprint { opacity: .5; font-size: .7rem; margin-top: 10px; max-width: 520px; margin-left: auto; margin-right: auto; }

@media (max-width: 480px) {
  .masthead h1 { font-size: 1.5rem; }
  .big-score { font-size: 2.6rem; }
  .team-block img { width: 48px; height: 48px; }
}
