/* Prediction game (/f1/predict/, scripts/predict.js). The round card is a
   night surface like the homepage's data scenes; the rules and the leaderboard
   sit on paper. Tokens come from signal.css with fallbacks. */

.predict-page {
  --pd-night: var(--sg-night, #121211);
  --pd-cream: var(--sg-cream, #f3f2ee);
  --pd-muted-dark: var(--sg-muted-dark, rgba(243, 242, 238, 0.66));
  --pd-line-dark: var(--sg-line-dark, rgba(255, 255, 255, 0.12));
  /* edges on the night card, which stays dark in both themes */
  --pd-edge-dark: rgba(255, 255, 255, 0.2);
  --pd-edge-dark-strong: rgba(255, 255, 255, 0.45);
  --pd-ink: var(--sg-ink, var(--dk-fg-141414, #141414));
  --pd-muted: var(--sg-muted, var(--dk-fg-5c5c5a, #5c5c5a));
  --pd-line: var(--sg-line, var(--dk-ln-e2e2df, #e2e2df));
  --pd-mist: var(--sg-mist, var(--dk-bg-f3f3f1, #f3f3f1));
  --pd-paper: var(--sg-paper, var(--dk-bg-fcfcfc, #fcfcfc));
  --pd-orange: var(--sg-orange, #ff6b00);
  --pd-orange-ink: var(--sg-orange-ink, var(--dk-fg-a33d00, #a33d00));
  --pd-r: 16px;
  --pd-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.predict-page .predict-shell { padding-top: clamp(28px, 4vw, 56px); }

.pd-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
}

.pd-card {
  border-radius: var(--pd-r);
  background: var(--pd-paper);
  box-shadow: inset 0 0 0 1px var(--pd-line);
}

/* ---- The round ---- */

.pd-round {
  display: grid;
  gap: 20px;
  padding: clamp(20px, 2.6vw, 36px);
  background:
    radial-gradient(80% 90% at 100% 0%, rgba(255, 107, 0, 0.18), transparent 60%),
    var(--pd-night);
  box-shadow: none;
  color: var(--pd-cream);
}

.pd-round-head { display: grid; gap: 6px; }
.pd-eyebrow { margin: 0; color: var(--pd-orange); font-size: 0.8125rem; font-weight: 650; }
.pd-round h2 { margin: 0; color: var(--pd-cream); font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.75rem); font-weight: 720; letter-spacing: -0.045em; line-height: 1.05; }
.pd-clock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 4px 0 0; color: var(--pd-muted-dark); font-size: 0.9375rem; }
.pd-clock strong { color: var(--pd-cream); font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.pd-clock:empty { display: none; }

.pd-form { display: grid; gap: 18px; }
.pd-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.pd-slot {
  --pd-team: #8a8a86;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 14px 14px 14px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px var(--pd-edge-dark), inset 4px 0 0 var(--pd-team);
  transition: box-shadow 260ms var(--pd-ease), background-color 260ms var(--pd-ease);
}

.pd-slot:focus-within { background: rgba(255, 255, 255, 0.13); box-shadow: inset 0 0 0 1px var(--pd-edge-dark-strong), inset 4px 0 0 var(--pd-team); }
.pd-slot-label { display: flex; align-items: baseline; gap: 10px; color: rgba(243, 242, 238, 0.82); font-size: 0.8125rem; font-weight: 600; }
.pd-slot-short { color: var(--pd-cream); font-size: 1.25rem; font-weight: 740; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }

.pd-select {
  width: 100%;
  min-height: 46px;
  padding: 0 38px 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23141414' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 14px center,
    var(--pd-cream);
  color: #141414;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  appearance: none;
  cursor: pointer;
}

.pd-select option, .pd-select optgroup { background: var(--dk-bg-fcfcfc, #fcfcfc); color: var(--dk-fg-141414, #141414); }
.pd-select:hover { box-shadow: 0 0 0 2px var(--pd-edge-dark-strong); }
.pd-select:has(option[value=""]:checked) { background-color: var(--pd-cream); color: #5c5c5a; }
.pd-select:focus-visible { outline: 2px solid var(--pd-orange); outline-offset: 2px; }
.pd-select option { color: var(--dk-fg-141414, #141414); }
.pd-swatch { display: none; }

/* a locked or scored pick */
.pd-slot.is-locked { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.pd-slot-pick { display: grid; gap: 2px; min-width: 0; }
.pd-slot-pick strong { overflow: hidden; color: var(--pd-cream); font-size: 1.0625rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.pd-slot-pick small { color: var(--pd-muted-dark); font-size: 0.8125rem; }

.pd-outcome { justify-self: end; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.pd-outcome.is-exact { background: var(--pd-orange); color: #141414; }
.pd-outcome.is-podium { background: rgba(255, 107, 0, 0.18); color: #ffb27a; }
.pd-outcome.is-miss { background: rgba(255, 255, 255, 0.08); color: var(--pd-muted-dark); }
.pd-outcome.is-pending { background: transparent; box-shadow: inset 0 0 0 1px var(--pd-line-dark); color: var(--pd-muted-dark); }

.pd-total { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 4px 0 0; color: var(--pd-muted-dark); }
.pd-total strong { color: var(--pd-cream); font-size: 2.5rem; font-weight: 740; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.pd-total em { color: var(--pd-orange); font-style: normal; font-weight: 650; }

.pd-hint { margin: 0; color: var(--pd-muted-dark); font-size: 0.8125rem; }

.pd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.pd-status { margin: 0; color: var(--pd-muted-dark); font-size: 0.9375rem; }
.pd-round .pd-status { color: rgba(243, 242, 238, 0.82); }
.predict-board .pd-status { margin-top: 12px; color: var(--pd-muted); }
.predict-board .pd-status.is-error { color: var(--dk-fg-b3261e, #b3261e); }
.pd-status:empty { display: none; }
.pd-status.is-error { color: #ff9b7a; }

.pd-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--pd-orange);
  border-radius: 999px;
  background: var(--pd-orange);
  color: #141414;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 220ms var(--pd-ease), color 220ms var(--pd-ease), border-color 220ms var(--pd-ease), opacity 220ms;
}
.pd-button:hover:not(:disabled) { background: #ff8a33; }
.pd-button:disabled { opacity: 0.5; cursor: not-allowed; }
/* on the night card a disabled button reads as a quiet chip, not a dimmed orange */
.pd-round .pd-button:disabled { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.1); color: rgba(243, 242, 238, 0.78); opacity: 1; }
.pd-button:focus-visible { outline: 2px solid var(--pd-orange); outline-offset: 3px; }
.pd-button.is-secondary { border-color: var(--pd-ink); background: transparent; color: var(--pd-ink); }
.pd-button.is-secondary:hover:not(:disabled) { background: var(--pd-ink); color: var(--pd-paper); }
.pd-button.is-small { min-height: 40px; padding: 0 16px; font-size: 0.875rem; }

/* ---- Rules ---- */

.pd-rules { display: grid; gap: 14px; padding: clamp(20px, 2.4vw, 32px); }
.pd-rules h2 { margin: 0; font-size: 1.375rem; font-weight: 720; letter-spacing: -0.035em; }
.pd-rules p { margin: 0; color: var(--pd-muted); font-size: 0.9375rem; line-height: 1.6; }
.pd-points { display: grid; margin: 0; }
.pd-points div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--pd-line); }
.pd-points div:first-child { border-top: 0; }
.pd-points dt { color: var(--pd-ink); font-weight: 550; }
.pd-points dd { margin: 0; color: var(--pd-orange-ink); font-size: 1.125rem; font-weight: 740; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Tables ---- */

.pd-titles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.pd-title { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 18px 20px 20px; border: 0; border-radius: var(--pd-r); background: var(--pd-paper); box-shadow: inset 0 0 0 1px var(--pd-line); color: var(--pd-ink); font: inherit; text-align: left; cursor: pointer; transition: background-color 0.3s var(--pd-ease), color 0.3s var(--pd-ease), box-shadow 0.3s var(--pd-ease); }
.pd-title:hover { box-shadow: inset 0 0 0 1px var(--pd-ink); }
.pd-title[aria-selected="true"] { background: var(--pd-night); box-shadow: none; color: var(--pd-cream); }
.pd-title:focus-visible { outline: 2px solid var(--pd-orange); outline-offset: 3px; }
.pd-title-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pd-title-name { font-size: 1rem; font-weight: 720; letter-spacing: -0.02em; }
.pd-title-range, .pd-title-points { color: var(--pd-muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.pd-title[aria-selected="true"] .pd-title-range, .pd-title[aria-selected="true"] .pd-title-points { color: var(--pd-muted-dark); }
.pd-title-tag { margin-top: 8px; color: var(--pd-muted); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.pd-title.is-won .pd-title-tag, .pd-title.is-live .pd-title-tag { color: var(--pd-orange-ink); }
.pd-title[aria-selected="true"] .pd-title-tag { color: var(--pd-muted-dark); }
.pd-title[aria-selected="true"].is-won .pd-title-tag, .pd-title[aria-selected="true"].is-live .pd-title-tag { color: var(--pd-orange); }
.pd-title-who { overflow: hidden; font-size: clamp(1.25rem, 2.2vw, 1.625rem); font-weight: 760; letter-spacing: -0.035em; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.pd-title-points { min-height: 1.3em; }

.pd-table-wrap { overflow-x: auto; border-radius: var(--pd-r); box-shadow: inset 0 0 0 1px var(--pd-line); background: var(--pd-paper); }
.pd-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pd-table th, .pd-table td { padding: 14px 16px; border-bottom: 1px solid var(--pd-line); text-align: left; }
.pd-table thead th { background: var(--pd-mist); color: var(--pd-muted); font-size: 0.75rem; font-weight: 650; }
.pd-table tbody tr:last-child > * { border-bottom: 0; }
.pd-table tbody th { font-weight: 650; }
.pd-table .pd-num { text-align: right; }
.pd-table tbody td:first-child { font-size: 1.125rem; font-weight: 720; letter-spacing: -0.03em; }
.pd-table tbody tr:first-child td:first-child, .pd-table tbody tr:first-child td:nth-child(3) { color: var(--pd-orange-ink); }
.pd-table tbody tr.is-me > * { background: rgba(255, 107, 0, 0.07); }
.pd-table tbody tr.is-me th { box-shadow: inset 3px 0 0 var(--pd-orange); }
.pd-table tbody tr.is-gap > * { border-top: 2px dashed var(--pd-line); }
.pd-empty { margin: 0; padding: 20px; border-radius: var(--pd-r); background: var(--pd-mist); color: var(--pd-muted); }

/* ---- Your season ---- */

.pd-history { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pd-history-row { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--pd-r); box-shadow: inset 0 0 0 1px var(--pd-line); }
.pd-history-title { display: grid; gap: 2px; }
.pd-history-title span { color: var(--pd-muted); font-size: 0.8125rem; font-weight: 600; }
.pd-history-title a { font-weight: 700; }
.pd-history-picks { margin: 0; color: var(--pd-muted); font-size: 0.9375rem; }
.pd-history-points { font-size: 1.125rem; font-weight: 740; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pd-history-correction { grid-column: 1 / -1; color: var(--pd-muted); }

@media (max-width: 960px) {
  .pd-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  .pd-slots { grid-template-columns: minmax(0, 1fr); }
  .pd-titles { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pd-title { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; padding: 14px 16px; }
  .pd-title-head { grid-column: 1; justify-content: flex-start; white-space: nowrap; }
  .pd-title-tag { grid-column: 2; grid-row: 1; margin: 0; align-self: center; }
  .pd-title-who, .pd-title-points { grid-column: 1 / -1; }
  .pd-title-who { font-size: 1.25rem; }
  .pd-title-points { min-height: 0; }
  .pd-history-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pd-history-picks { grid-column: 1 / -1; grid-row: 2; }
  .pd-table th, .pd-table td { padding: 12px 10px; }
  .pd-table th:nth-child(4), .pd-table td:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pd-slot, .pd-button, .pd-title { transition: none; }
}

/* Reporting a player name from a table */
.pd-table tbody th { position: relative; }
.pd-player { overflow-wrap: anywhere; }
.pd-report-button { margin-left: 8px; min-height: 28px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--pd-muted); font: inherit; font-size: 0.75rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; opacity: 0; }
.pd-table tbody tr:hover .pd-report-button, .pd-report-button:focus-visible { opacity: 1; }
.pd-report-button:focus-visible { outline: 2px solid var(--pd-orange); outline-offset: 2px; }
@media (hover: none) { .pd-report-button { opacity: 1; } }
.pd-report { width: min(440px, calc(100% - 32px)); padding: 0; border: 1px solid var(--pd-line); border-radius: var(--pd-r); background: var(--pd-paper); color: var(--pd-ink); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2); }
.pd-report::backdrop { background: rgba(0, 0, 0, 0.45); }
.pd-report form { display: grid; gap: 14px; padding: 22px; }
.pd-report h2 { margin: 0; font-size: 1.2rem; letter-spacing: -0.02em; }
.pd-report-name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.pd-report fieldset { display: grid; gap: 4px; margin: 0; padding: 0; border: 0; }
.pd-report legend { margin-bottom: 6px; color: var(--pd-muted); font-size: 0.875rem; }
.pd-report label { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 0.9375rem; cursor: pointer; }
.pd-report input { width: 18px; height: 18px; accent-color: var(--pd-orange); }
.pd-report-note { margin: 0; color: var(--pd-muted); font-size: 0.8125rem; line-height: 1.5; }
.pd-report-actions { display: flex; justify-content: flex-end; gap: 10px; }
