/* w-and-0 — dark sports-stat aesthetic */

:root {
  --bg-top: #0b1220;
  --bg-bot: #070b14;
  --panel: #0f172a;
  --card: #1e293b;
  --card-alt: #172033;
  --line: #334155;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --accent: #f59e0b;
  --good: #22c55e;
  --perfect: #a855f7;
  --team: #1d4ed8;
  --era: #7c3aed;
  --dilute: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: linear-gradient(var(--bg-top), var(--bg-bot));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.45;
}

.site-header {
  text-align: center;
  padding: 24px 16px 8px;
}

.site-title {
  margin: 0;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.site-tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}

.site-footer {
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  padding: 24px 16px 40px;
  max-width: 760px;
  margin: 0 auto;
}
.site-footer a { color: var(--muted); text-decoration: underline; }
.site-footer a:hover { color: var(--accent); }

/* ---- generic ---- */

.screen {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.error { color: var(--dilute); }

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  padding: 8px 14px;
  transition: opacity .12s, background .12s;
}
button:hover:not(:disabled) { background: #243149; }
button:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1206;
  font-weight: 800;
  padding: 12px 22px;
  font-size: 16px;
}
.btn-primary:hover:not(:disabled) { background: #fbb22e; }

/* ---- start screen ---- */

.start {
  /* shrink the panel to the width of the explanatory text (60ch + 22px padding each side) */
  max-width: calc(60ch + 44px);
  margin: 0 auto;
  text-align: center;
}
.start h2 { margin: 0 0 8px; font-size: 26px; }
.start .intro { color: var(--muted); max-width: 60ch; margin: 0 auto; }

.mode-row {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
  justify-content: center;
}
.mode-btn {
  flex: 0 0 auto;
  min-width: 180px;
  text-align: center;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--card-alt);
  border-color: var(--accent);
}
.mode-btn .mode-name { font-weight: 800; font-size: 18px; display: block; color: var(--accent); }
.mode-btn .mode-desc { color: var(--muted); font-size: 13px; }
.mode-btn .mode-best {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--good);
}
.mode-btn:hover:not(:disabled) { background: var(--accent); }
.mode-btn:hover:not(:disabled) .mode-name { color: #1a1206; }
.mode-btn:hover:not(:disabled) .mode-desc { color: #3a2a08; }
.mode-btn:hover:not(:disabled) .mode-best { color: #1a1206; }

.rules { color: var(--muted); font-size: 14px; padding-left: 20px; }
.rules li { margin: 4px 0; }

.start-actions { margin: 18px 0 4px; }

/* ---- draft screen ---- */

.draft-grid {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 760px) {
  .draft-grid { grid-template-columns: 1fr; }
  /* Coach pane moves to the top and collapses to the condensed position strip.
     Selectors are scoped to .coach to out-specify the base .coach-condensed rule
     that appears later in the file. */
  .coach { order: -1; position: static; }
  .coach .coach-condensed { display: flex; }
  .coach .coach-head,
  .coach .slots-list,
  .coach .breakdown { display: none; }
}

.candidate-area {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.spin-header { margin-bottom: 16px; }
.pick-indicator { font-weight: 800; font-size: 18px; margin: 0 0 10px; }

.spin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.chips { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.chip-team { background: var(--team); position: relative; cursor: help; }
.chip-era { background: var(--era); }

/* full team name on hover */
.chip-team[data-fullname]:hover::after {
  content: attr(data-fullname);
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  margin-top: 6px;
  white-space: nowrap;
  background: #0b1220;
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}

.reroll-row { display: flex; gap: 8px; }
.reroll-btn.used { text-decoration: line-through; }

.cand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.cand-grid-single { grid-template-columns: 1fr; }

.cand-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cand-card.filled { opacity: .42; }
.filled-note { color: var(--muted); font-size: 12px; font-style: italic; }
.cand-name { font-weight: 800; font-size: 15px; }
.cand-meta { color: var(--muted); font-size: 12px; }
.cand-stats { font-size: 13px; }
.cand-stats .strong { font-weight: 800; }
.cand-stats .def { color: var(--muted); }
.cand-marginal { font-size: 13px; margin-top: 2px; }
.cand-marginal .ann { font-weight: 700; margin-left: 4px; }
.ann.dilute { color: var(--dilute); }
.ann.free { color: var(--good); }

.slot-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.slot-btn {
  background: var(--card-alt);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 800;
  padding: 6px 12px;
}
.slot-btn:hover:not(:disabled) { background: var(--accent); color: #1a1206; }

.empty-note { color: var(--muted); font-style: italic; }

/* ---- coach side panel ---- */

.coach {
  position: sticky;
  top: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.coach-head { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }

/* condensed position strip — hidden on wide screens, shown when coach is at top */
.coach-condensed { display: none; gap: 6px; flex-wrap: wrap; }
.coach-condensed .pos-chip {
  flex: 1 1 0;
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  border: 1px dashed var(--line);
  background: var(--card-alt);
  color: var(--muted);
}
.coach-condensed .pos-chip.filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent);
  color: #1a1206;
}
.ovr-row { display: flex; align-items: baseline; gap: 8px; }
.ovr-big { font-size: 40px; font-weight: 900; line-height: 1; }
.ovr-label { color: var(--muted); font-size: 13px; font-weight: 700; }

.record-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.record { font-size: 22px; font-weight: 900; }
.grade-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  color: #0b1220;
}

.pace-track {
  height: 8px;
  background: var(--card);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 6px;
}
.pace-fill { height: 100%; border-radius: 999px; }
.pace-note { font-size: 12px; color: var(--muted); }
.pace-note.on { color: var(--perfect); font-weight: 700; }

.slots-list { margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.slot-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--card-alt);
  border: 1px solid var(--line);
}
.slot-item.empty { border-style: dashed; color: var(--muted); }
.slot-tag { font-weight: 800; color: var(--accent); width: 26px; flex: none; }
.slot-player { font-weight: 700; }
.slot-sub { color: var(--muted); font-size: 12px; }

.breakdown {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.breakdown .b-val { color: var(--fg); font-weight: 700; }

/* ---- done screen ---- */

.done { text-align: center; }
.done .final-sub { color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-size: 13px; margin: 0; }
.final-record { font-size: 72px; font-weight: 900; line-height: 1.05; margin: 8px 0; }
.final-ovr { font-size: 16px; color: var(--muted); }
.final-ovr .b-val { color: var(--fg); font-weight: 800; }
.final-grade { font-size: 24px; font-weight: 900; margin: 8px 0 18px; }

.final-five {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 18px 0;
  text-align: left;
}
.final-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.final-card .fc-slot { color: var(--accent); font-weight: 800; font-size: 12px; }
.final-card .fc-name { font-weight: 800; font-size: 15px; margin: 2px 0; }
.final-card .fc-sub { color: var(--muted); font-size: 12px; }
.final-card .fc-line { font-size: 13px; margin-top: 4px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 16, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  padding: 0;
  line-height: 1;
  border-radius: 8px;
  color: var(--muted);
}
.modal-close:hover:not(:disabled) { color: var(--fg); }
.share-head {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.share-text {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}
.share-actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.btn-bsky {
  display: inline-block;
  background: #1185fe;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid #1185fe;
}
.btn-bsky:hover { background: #3a9bff; }

.done-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
