:root {
  --pk-bg: #0b1220;
  --pk-bg-2: #101a2b;
  --pk-card: #151f33;
  --pk-card-2: #1a2740;
  --pk-line: #24314a;
  --pk-text: #e6edf7;
  --pk-muted: #93a3bd;
  --pk-accent: #38bdf8;
  --pk-accent-2: #22d3ee;
  --pk-win: #4ade80;
  --pk-loss: #f87171;
  --pk-live: #fbbf24;
  --pk-radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(56, 189, 248, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(34, 211, 238, 0.10), transparent 55%),
    var(--pk-bg);
  color: var(--pk-text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a { color: var(--pk-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--pk-bg-2); border: 1px solid var(--pk-line); padding: 1px 5px; border-radius: 6px; }

.pk-main { max-width: 1120px; margin: 0 auto; padding: 30px 20px 70px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 10px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 12px; }

.pk-muted { color: var(--pk-muted); }
.pk-error { color: var(--pk-loss); }
.pk-more { margin: 12px 0 0; }

.pk-hero { padding: 26px 0 10px; max-width: 760px; }
.pk-kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; color: var(--pk-accent); margin: 0 0 8px; }
.pk-lede { font-size: 1.12rem; color: var(--pk-muted); margin: 0 0 20px; }
.pk-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.pk-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--pk-accent), var(--pk-accent-2));
  color: #042234; font-weight: 700; border: 0; border-radius: 10px;
  padding: 10px 18px; cursor: pointer; font-size: 0.95rem;
}
.pk-btn:hover { filter: brightness(1.08); text-decoration: none; }
.pk-btn--ghost { background: transparent; color: var(--pk-text); border: 1px solid var(--pk-line); }
.pk-btn--small { padding: 6px 12px; font-size: 0.85rem; }

.pk-page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin: 34px 0 16px; }
.pk-page-head p { margin: 0; color: var(--pk-muted); }
.pk-page-actions { display: flex; gap: 8px; }

.pk-card {
  background: linear-gradient(180deg, var(--pk-card), var(--pk-card-2));
  border: 1px solid var(--pk-line);
  border-radius: var(--pk-radius);
  padding: 18px;
  margin: 0 0 16px;
}
.pk-card--link { display: block; color: inherit; transition: border-color .15s, transform .15s; }
.pk-card--link:hover { border-color: var(--pk-accent); transform: translateY(-1px); text-decoration: none; }

.pk-grid { display: grid; gap: 14px; margin: 0 0 22px; }
.pk-grid--cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
/* 300px, not less: below that the two squares of a matchup share a column that
   is narrower than a phone, and the abbr starts colliding with the score. At 300
   a phone (one column) gets ~150px squares, a tablet two columns, desktop three. */
.pk-grid--games { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pk-grid--teams { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.pk-flash { border-radius: 10px; padding: 11px 14px; margin: 0 0 14px; border: 1px solid var(--pk-line); background: var(--pk-card); }
.pk-flash--success { border-color: rgba(74, 222, 128, .5); }
.pk-flash--error { border-color: rgba(248, 113, 113, .55); }
.pk-flash--info { border-color: rgba(56, 189, 248, .5); }

.pk-tag { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 999px; background: rgba(56, 189, 248, .16); color: var(--pk-accent); border: 1px solid rgba(56, 189, 248, .35); }

.pk-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pk-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pk-inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 12px; }
.pk-link { background: none; border: 0; color: var(--pk-accent); cursor: pointer; padding: 0; font: inherit; }
.pk-link--danger { color: var(--pk-loss); }
.pk-danger-zone { border-color: rgba(248, 113, 113, .35); }

/* Forms */
.pk-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pk-form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--pk-muted); }
.pk-form input[type="text"], .pk-form input[type="url"], .pk-form input[type="number"],
.pk-form input[type="color"], .pk-form select, .pk-form textarea,
.pk-inline-form input[type="text"] {
  width: 100%; background: var(--pk-bg-2); color: var(--pk-text);
  border: 1px solid var(--pk-line); border-radius: 9px; padding: 9px 11px; font: inherit;
}
.pk-form input[type="color"] { height: 42px; padding: 4px; }
.pk-form textarea { resize: vertical; }
.pk-form__wide { grid-column: 1 / -1; }
.pk-form__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
/* js/app.js marks the pick form when it is saving each click on its own, so the
   submit button is only the no-JS path. It comes back if a save fails. */
.pk-picks.is-instant .pk-form__actions .pk-btn { display: none; }
.pk-form input[disabled], .pk-form select[disabled] {
  background: rgba(15, 23, 42, .35); color: var(--pk-muted); cursor: not-allowed;
}
.pk-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; border: 1px solid var(--pk-line); border-radius: 10px; padding: 12px; }
.pk-check-grid legend { color: var(--pk-muted); font-size: .85rem; padding: 0 6px; }
.pk-check { display: flex; align-items: center; gap: 8px; flex-direction: row; color: var(--pk-text); font-size: .9rem; }
.pk-check input { accent-color: var(--pk-accent); }

/* Game cards - one row per team, so a matchup fits a phone width.
   The card is three lines: kickoff and status, the two team rows, and a foot
   that only exists when it has live drive detail or a failed-save message. */
.pk-game { background: linear-gradient(180deg, var(--pk-card), var(--pk-card-2)); border: 1px solid var(--pk-line); border-radius: 12px; padding: 9px 10px 10px; }
.pk-game--live { border-color: rgba(251, 191, 36, .55); }
.pk-game__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; font-size: .74rem; color: var(--pk-muted); margin-bottom: 8px; }
.pk-game__when { flex: 0 0 auto; display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.pk-game__week { text-transform: uppercase; letter-spacing: .1em; font-weight: 700; font-size: .66rem; }
.pk-game__meta { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pk-game__status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-pts { flex: 0 0 auto; padding: 2px 7px; border-radius: 999px; background: rgba(251, 191, 36, .16); border: 1px solid rgba(251, 191, 36, .45); color: #fbbf24; font-weight: 800; font-size: .64rem; letter-spacing: .06em; }
.pk-game__tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pk-tile { display: block; cursor: pointer; }
.pk-tile.is-locked { cursor: default; }
.pk-tile__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pk-tile__box {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; text-align: left;
  border-radius: 10px; border: 1px solid var(--pk-line); background: rgba(15, 23, 42, .55);
  transition: border-color .12s ease, background .12s ease;
}
.pk-tile:hover .pk-tile__box { border-color: rgba(56, 189, 248, .5); }
.pk-tile__input:focus-visible + .pk-tile__box { outline: 2px solid var(--pk-accent); outline-offset: 2px; }
.pk-tile__logo-wrap { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; }
.pk-tile__logo { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .45)); }
/* Text badge (the fallback when a team has no logo file): three letters, not a
   photo, so it does not need the image's drop shadow. */
.pk-tile__logo.pk-badge--text { width: 32px; height: 32px; border-radius: 8px; font-size: .56rem; filter: none; }
.pk-tile__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.pk-tile__abbr { font-weight: 800; letter-spacing: .06em; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-tile__record { font-size: .68rem; color: var(--pk-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pk-tile__score { flex: 0 0 auto; margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; }
.pk-tile__flag { margin-left: auto; flex: 0 0 auto; padding: 0 5px; border-radius: 999px; white-space: nowrap; font-size: .68rem; line-height: 1.5; background: rgba(56, 189, 248, .2); color: var(--pk-accent); border: 1px solid rgba(56, 189, 248, .45); }
.pk-tile.is-locked .pk-tile__box { background: rgba(15, 23, 42, .35); }
/* The selected square is styled from :checked, so the highlight moves the instant
   a tile is clicked. is-picked only exists on locked tiles, which have no input. */
.pk-tile__input:checked + .pk-tile__box,
.pk-tile.is-picked .pk-tile__box { border-color: var(--pk-accent); background: rgba(56, 189, 248, .14); }
.pk-tile.is-winner .pk-tile__box { border-color: rgba(74, 222, 128, .7); background: rgba(74, 222, 128, .12); }
.pk-tile.is-winner .pk-tile__flag { background: rgba(74, 222, 128, .2); color: #4ade80; border-color: rgba(74, 222, 128, .45); }
/* The score already takes the free space; when both are present the check sits
   right after it rather than splitting the gap into two. */
.pk-tile__score + .pk-tile__flag { margin-left: 4px; }
/* Instant save: the border and background already follow :checked, so a click
   feels immediate. The dimming and the "Your pick" flag wait for the server. */
.pk-game.is-saving .pk-tile__box { opacity: .65; }
/* The foot is always in the DOM (js/app.js writes save errors into it) and only
   takes space when something is in it. */
.pk-game__foot { margin-top: 6px; font-size: .72rem; color: var(--pk-muted); }
.pk-game__foot:empty { display: none; }
.pk-game__save-error { display: block; color: var(--pk-loss); font-weight: 600; }
.pk-game__live { color: var(--pk-live); }

.pk-badge { width: 24px; height: 24px; object-fit: contain; }
.pk-badge--text { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; font-size: .6rem; color: #fff; }

/* Teams */
.pk-team { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; padding: 16px 10px; border-radius: var(--pk-radius); background: var(--pk-card); border: 1px solid var(--pk-line); border-top: 3px solid var(--team-color, var(--pk-line)); color: inherit; }
.pk-team:hover { border-color: var(--pk-accent); text-decoration: none; }
.pk-team__logo { width: 56px; height: 56px; object-fit: contain; }
.pk-team__abbr { font-weight: 800; letter-spacing: .06em; }
.pk-team__name { font-size: .82rem; color: var(--pk-muted); }
.pk-team__record { font-size: .78rem; color: var(--pk-accent); }
.pk-team-head { display: flex; align-items: center; gap: 18px; background: var(--pk-card); border: 1px solid var(--pk-line); border-left: 6px solid var(--team-color, var(--pk-accent)); border-radius: var(--pk-radius); padding: 20px; }
.pk-team-head__logo { width: 84px; height: 84px; object-fit: contain; }
.pk-team-head p { margin: 0; color: var(--pk-muted); }
.pk-team-head__record { color: var(--pk-accent) !important; font-weight: 700; }
.pk-section-title { margin: 26px 0 12px; color: var(--pk-muted); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; }

/* Tables */
.pk-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.pk-table th, .pk-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--pk-line); }
.pk-table th { color: var(--pk-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.pk-table tr:last-child td { border-bottom: 0; }

/* Week tabs. Two runs - regular season, then the playoff rounds - because the
   playoff weeks are stored offset by 18 and would read as week numbers. */
.pk-weeks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 4px 0 14px; }
.pk-weeks__label { flex: 0 0 auto; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--pk-muted); }
.pk-weeks__run { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-week { flex: 0 0 auto; min-width: 38px; text-align: center; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--pk-line); color: var(--pk-muted); }
.pk-week--round { min-width: 46px; font-weight: 700; letter-spacing: .04em; }
.pk-week.is-active { background: rgba(56, 189, 248, .16); border-color: var(--pk-accent); color: var(--pk-text); font-weight: 700; }
.pk-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.pk-tab { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--pk-line); color: var(--pk-muted); }
.pk-tab.is-active { background: rgba(56, 189, 248, .16); border-color: var(--pk-accent); color: var(--pk-text); }

/* Polls */
.pk-poll { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; }
.pk-poll-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr) auto; align-items: center; gap: 12px; padding: 7px 0; font-size: .9rem; }
.pk-bar { display: block; height: 8px; border-radius: 999px; background: var(--pk-bg-2); overflow: hidden; }
.pk-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--pk-accent), var(--pk-accent-2)); }

/* Dashboard */
.pk-stat { display: flex; flex-direction: column; gap: 4px; }
.pk-stat__value { font-size: 2rem; font-weight: 800; }
.pk-stat__label { color: var(--pk-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.pk-auth { max-width: 560px; }

.pk-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; color: var(--pk-muted); font-size: .82rem; padding: 0 20px 40px; }

/* Weekly board - players down, games across, results colour-coded */
.pk-board-wrap { overflow-x: auto; }
.pk-board th, .pk-board td { white-space: nowrap; }
.pk-board__player { position: sticky; left: 0; z-index: 1; background: var(--pk-card); color: var(--pk-text); font-size: .82rem; text-transform: none; letter-spacing: 0; font-weight: 700; text-align: left; }
.pk-board__game { text-align: center; font-size: .68rem; }
.pk-board__game.is-bonus { color: #fbbf24; }
.pk-board__at { color: var(--pk-muted); margin: 0 3px; font-weight: 400; }
.pk-board__worth { display: block; font-size: .6rem; color: #fbbf24; letter-spacing: .06em; }
.pk-board__cell { text-align: center; font-size: .74rem; font-weight: 700; padding: 9px 7px; }
.pk-board__cell.is-hidden, .pk-board__cell.is-empty { color: rgba(148, 163, 184, .45); font-weight: 400; }
.pk-board__cell.is-win { background: rgba(74, 222, 128, .16); color: #4ade80; }
.pk-board__cell.is-lead { background: rgba(251, 191, 36, .16); color: #fbbf24; }
.pk-board__cell.is-loss { background: rgba(248, 113, 113, .13); color: #f87171; }
.pk-board__cell.is-push { color: var(--pk-muted); }
.pk-board__num { text-align: right; font-variant-numeric: tabular-nums; font-size: .82rem; }
.pk-board__num.is-live { color: var(--pk-muted); }
.pk-board__num.is-live.is-up { color: #fbbf24; font-weight: 700; }
.pk-proj.is-up { color: #fbbf24; font-weight: 700; }

@media (max-width: 560px) {
  .pk-main { padding: 20px 14px 60px; }
  /* Two team rows plus the top line is the whole card, so on a phone the gaps
     tighten rather than the type - 14 games on one screen-width column. */
  .pk-grid { gap: 10px; }
  .pk-tile__box { gap: 7px; padding: 7px; }
  .pk-tile__logo, .pk-tile__logo-wrap { width: 28px; height: 28px; }
  .pk-tile__logo.pk-badge--text { width: 28px; height: 28px; }
  .pk-tile__abbr { font-size: .86rem; }
  .pk-tile__flag { padding: 0 4px; font-size: .62rem; }
  .pk-poll-row { grid-template-columns: 1fr auto; }
  .pk-bar { grid-column: 1 / -1; }
  .pk-team-head { flex-direction: column; text-align: center; }
}

