/* Four Downs: dark, quiet, product-style UI. Zinc neutrals, one indigo-violet accent, Geist type. */
:root {
  --bg: #25262b;
  --bg-2: #2b2c32;
  --card: rgba(255, 255, 255, .035);
  --card-2: rgba(255, 255, 255, .06);
  --surface: #1e1f23;          /* solid panel (inputs, dropdowns) */
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .15);
  --text: #ededef;
  --muted: #9b9ba6;
  --faint: #6b6b76;
  --accent: #7375de;           /* the one indigo used everywhere */
  --accent-soft: rgba(115, 117, 222, .16);
  --accent-ink: #ffffff;
  --turf: #34d399;
  --miss: #fb7185;
  --skip: #71717a;
  --radius: 16px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 40px -12px rgba(0, 0, 0, .6);
  --display: 'Geist', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.5 var(--display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}
button, input { font: inherit; color: inherit; }
img { max-width: 100%; }
.muted { color: var(--muted); }
::selection { background: rgba(115, 117, 222, .35); }

/* ---------- top bar & steps ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 14px; max-width: 720px; width: 100%; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 16px/1 var(--mono);
}
.brand-name { font: 600 17px/1 var(--display); letter-spacing: -.02em; }
.top-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; }
#puzzle-no { font-family: var(--mono); font-size: 12.5px; color: var(--faint); }
.score-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font: 500 13px/1.2 var(--mono); font-variant-numeric: tabular-nums;
}

.steps {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  max-width: 720px; width: 100%; margin: 0 auto; padding: 0 16px 14px;
}
.step {
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 9px; font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; gap: 4px;
  min-width: 0; transition: border-color .2s ease, background .2s ease;
}
.step b { color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.active { border-color: rgba(115, 117, 222, .55); background: var(--accent-soft); color: var(--text); }
.step.active b { color: var(--text); }
.step.done { background: var(--card); }
.step.done b { color: var(--text); }
.step .pts { font-family: var(--mono); color: var(--accent); }

.wrap { max-width: 720px; width: 100%; margin: 0 auto; padding: 0 16px 24px; flex: 1; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* ---------- cards ---------- */
.card {
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 14px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.round-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.kicker { font: 500 11.5px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.round-title { font: 600 26px/1.15 var(--display); margin: 4px 0 0; letter-spacing: -.03em; }
.worth { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.worth b { font: 600 18px/1 var(--display); color: var(--text); }
.lede { color: var(--muted); margin: 0 0 16px; }
.prompt-note { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid var(--line-2); background: var(--card-2);
  border-radius: 10px; padding: 11px 16px; font-weight: 500; font-size: 15px; cursor: pointer; letter-spacing: -.01em;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .2s ease, filter .15s ease;
}
a.btn { color: var(--text); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn:hover { border-color: rgba(255, 255, 255, .24); background: rgba(255, 255, 255, .09); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(115, 117, 222, .45); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: none; }
.btn.primary:hover { background: var(--accent); border-color: transparent; opacity: .9; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* ---------- intro ---------- */
.start-wrap { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; text-align: center; padding-top: 12px; }
.start-title {
  font: 600 clamp(46px, 12.5vw, 80px)/1 var(--display); letter-spacing: -.055em; margin: 0;
  color: var(--text);
}
.downs-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; max-width: 540px; }
.downs-row img {
  width: 100%; aspect-ratio: 1; object-fit: cover; object-position: top; border-radius: 16px;
  background: #313238;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .55);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.downs-row img:nth-child(odd) { transform: rotate(-3deg); }
.downs-row img:nth-child(even) { transform: rotate(3deg); }
.downs-row img:hover { transform: rotate(0) translateY(-3px); }
.start-btn { max-width: 380px; padding: 15px 20px; font-size: 16.5px; font-weight: 500; border-radius: 12px; }
.site-foot { margin: 28px 0 10px; text-align: center; font-size: 14px; color: var(--muted); }
.hero h1 { font: 600 38px/1.05 var(--display); margin: 6px 0 8px; letter-spacing: -.04em; }
.hero p { color: var(--muted); margin: 0 0 18px; }
.rounds { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.rounds li { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.rounds .num { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); font: 600 18px/1 var(--mono); color: var(--accent); }
.rounds strong { display: block; font-weight: 500; }
.rounds small { color: var(--muted); }
.rounds .max { font: 500 15px/1 var(--mono); color: var(--muted); }

/* ---------- round 1: stat card ---------- */
.statcard { background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pos-badge { font: 600 12.5px/1 var(--mono); background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(115, 117, 222, .3);
  padding: 5px 9px; border-radius: 7px; letter-spacing: .06em; }
.season { font-size: 12.5px; color: var(--faint); font-family: var(--mono); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid rgba(255, 255, 255, .05); border-radius: 10px; padding: 11px 8px; text-align: center; min-width: 0; }
.stat .v { font: 600 24px/1.05 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { font: 500 10.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-top: 5px; }

.hints { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.hint { border: 1px dashed var(--line-2); border-radius: 10px; padding: 8px 4px; text-align: center; min-height: 74px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; transition: background .2s ease, border-color .2s ease; }
.hint .hl { font: 500 9.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.hint .hv { font: 600 16px/1.15 var(--display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.hint.locked .hv { color: var(--faint); font-size: 18px; }
.hint.open { border-style: solid; border-color: rgba(115, 117, 222, .45); background: var(--accent-soft); }
.hint img { width: 100%; max-width: 70px; margin: 0 auto; border-radius: 8px; background: var(--bg-2); }
.photo-big { display: block; width: 100%; max-width: 260px; margin: 0 auto 12px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }

/* ---------- guess input + autocomplete ---------- */
.guess-row { display: flex; gap: 8px; position: relative; }
.ac { position: relative; flex: 1; }
.ac input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); outline: none; font-size: 16px; transition: border-color .15s ease, box-shadow .15s ease;
}
.ac input::placeholder { color: var(--faint); }
.ac input:focus { border-color: rgba(115, 117, 222, .7); box-shadow: 0 0 0 3px rgba(115, 117, 222, .2); }
.ac-list { position: absolute; z-index: 1000; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px;
  list-style: none; background: #303137; border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, .7); max-height: 290px; overflow-y: auto; }
.ac-list li { padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.ac-list li.hl, .ac-list li:hover { background: var(--accent-soft); }
.ac-list mark { background: none; color: var(--accent); font-weight: 600; }
.sub-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; flex-wrap: wrap; }
.feedback { min-height: 22px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.feedback.bad { color: var(--miss); }
.feedback.good { color: var(--turf); }

.guess-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.guess-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1px solid rgba(255, 255, 255, .04); font-size: 14.5px; }
.guess-list .tag { font: 500 11px/1 var(--mono); padding: 4px 7px; border-radius: 6px; }
.tag.miss { background: rgba(251, 113, 133, .14); color: #fda4af; }
.tag.skip { background: rgba(161, 161, 170, .14); color: #d4d4d8; }
.tag.hit { background: rgba(52, 211, 153, .14); color: #6ee7b7; }

/* ---------- reveal ---------- */
.reveal { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; margin-bottom: 14px;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.reveal img { width: 96px; height: 70px; object-fit: cover; object-position: top; border-radius: 10px; background: var(--bg-2); }
.reveal .name { font: 600 22px/1.15 var(--display); letter-spacing: -.03em; }
.answer-name { font: 600 22px/1.15 var(--display); letter-spacing: -.03em; }
.points-earned {
  font: 600 42px/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.points-earned small { font-size: 17px; color: var(--faint); letter-spacing: 0; }
.result-line { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin: 6px 0 14px; }

/* ---------- round 2: roster ---------- */
.team-band { background: var(--accent); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center; color: #fff; position: relative; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.team-band > * { position: relative; z-index: 1; }
.team-band .tn { font: 600 28px/1 var(--display); letter-spacing: -.035em; }
.team-band small { opacity: .85; font-size: 12.5px; font-family: var(--mono); }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.slot { background: rgba(0, 0, 0, .2); border: 1px dashed var(--line-2); border-radius: 12px; padding: 10px 8px; text-align: center;
  min-height: 108px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; min-width: 0; }
.slot .sl { font: 500 11.5px/1 var(--mono); letter-spacing: .08em; color: var(--accent); }
.slot .sn { font-weight: 500; font-size: 14px; line-height: 1.2; overflow-wrap: anywhere; letter-spacing: -.01em; }
.slot .sq { font: 500 24px/1 var(--mono); color: var(--faint); }
.slot img { width: 56px; height: 41px; object-fit: cover; object-position: top; border-radius: 6px; background: var(--bg-2); }
.slot.filled { border-style: solid; border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .06); }
.slot.given { border-style: solid; border-color: var(--line); background: var(--card-2); }
.slot.missed { border-style: solid; border-color: rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .05); }
.pips { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.pip { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.pip.used { background: rgba(255, 255, 255, .12); box-shadow: none; }

/* ---------- round 3: map ---------- */
#map { height: min(62vh, 520px); border-radius: 14px; border: 1px solid var(--line-2); margin-bottom: 12px; background: #1d2128; }
.leaflet-container { font: inherit; }
.leaflet-bar { border: 1px solid var(--line-2) !important; border-radius: 10px !important; overflow: hidden; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .5) !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: #303137 !important; color: var(--text) !important; border-bottom-color: var(--line) !important; }
.leaflet-bar a:hover { background: #393a41 !important; }
.leaflet-bar a.leaflet-disabled { color: var(--faint) !important; }
.map-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.dist { font: 600 32px/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.pin-guess { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; background: var(--accent); border: 3px solid #fff;
  transform: rotate(-45deg); box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.pin-stadium { width: 26px; height: 26px; border-radius: 50%; background: var(--turf); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(52, 211, 153, .3), 0 2px 6px rgba(0, 0, 0, .45); }

/* ---------- round 4: krillion ---------- */
.prompt { font: 600 22px/1.3 var(--display); margin: 4px 0 16px; letter-spacing: -.025em; }
.timer-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.timer { position: relative; width: 72px; height: 72px; flex: none; }
.timer svg { transform: rotate(-90deg); }
.timer .t { position: absolute; inset: 0; display: grid; place-items: center; font: 500 24px/1 var(--mono); font-variant-numeric: tabular-nums; }
.timer.low .t { color: var(--miss); }
.tier-legend { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 4px 0 18px; }
.tier-legend div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 4px; text-align: center; }
.tier-legend b { display: block; font: 600 19px/1 var(--display); letter-spacing: -.03em; color: var(--text); }
.tier-legend span { display: block; font-size: 11px; line-height: 1.25; color: var(--muted); margin-top: 4px; }
.answer-groups { display: grid; gap: 12px; margin-top: 12px; }
.answer-groups h4 { margin: 0 0 4px; font: 500 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.answer-groups p { margin: 0; font-size: 14px; color: #d4d4d8; }
.answer-groups b { color: var(--accent); font-weight: 600; }
/* "+N more" / "Show less" */
.more-btn {
  appearance: none; border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  font: 500 12px/1 var(--mono); padding: 4px 8px; margin-left: 2px; border-radius: 999px; cursor: pointer; vertical-align: 1px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.more-btn:hover { color: var(--text); border-color: rgba(115, 117, 222, .6); background: var(--accent-soft); }
.ag-all + .more-btn { margin: 8px 0 0; }
.ag-count { font: 500 11px/1 var(--mono); color: var(--faint); margin-left: 6px; letter-spacing: 0; }
.ag-all {
  list-style: none; margin: 0; padding: 4px 0; max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  font-size: 14px; color: #d4d4d8; background: rgba(0, 0, 0, .18); border: 1px solid var(--line); border-radius: 10px;
}
.ag-all li { padding: 7px 12px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.ag-all li:last-child { border-bottom: none; }
.ag-all li.yours { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.ag-filter {
  width: 100%; margin: 2px 0 8px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); outline: none; font-size: 14px;
}
.ag-filter:focus { border-color: rgba(115, 117, 222, .7); box-shadow: 0 0 0 3px rgba(115, 117, 222, .2); }
.shake { animation: shake .3s; }

/* ---------- motion: small, quick, and only on submit / reveal ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.94); } 55% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes accepted { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .45); } 100% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } }
.fx-rise { animation: rise .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 55ms); }
.fx-pop { animation: pop .34s cubic-bezier(.2, .8, .2, 1) both; }
.fx-fade { animation: fade .25s ease both; }
.fx-bars .bar i { transform-origin: left; animation: grow .7s cubic-bezier(.2, .8, .2, 1) .15s both; }
.ac.accepted input { border-color: rgba(52, 211, 153, .8); animation: accepted .45s ease-out; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- results ---------- */
.final { text-align: center; padding: 8px 0 16px; }
.final .big { font: 600 80px/1 var(--display); letter-spacing: -.06em; font-variant-numeric: tabular-nums; color: var(--accent); }
.final .of { font: 500 22px/1 var(--mono); color: var(--faint); }
.final .verdict { font-size: 15px; margin-top: 8px; color: var(--muted); }
.breakdown { display: grid; gap: 8px; margin: 10px 0 16px; }
.brow { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; }
.brow .bl { font-weight: 500; }
.brow .bl small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.brow .bp { font: 600 22px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.share-preview { white-space: pre-wrap; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font: 13px/1.6 var(--mono); color: #d4d4d8; margin: 0 0 12px; }
.countdown { text-align: center; color: var(--muted); margin-top: 16px; font-size: 13.5px; }
.countdown b { font: 500 18px/1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #f4f4f5; color: #09090b;
  padding: 10px 16px; border-radius: 10px; font-weight: 500; font-size: 14px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .6); z-index: 2000; }

@media (max-width: 520px) {
  .hero h1 { font-size: 32px; }
  .card { padding: 16px; }
  .stat .v { font-size: 20px; }
  .hints { gap: 4px; }
  .hint { min-height: 66px; padding: 6px 2px; }
  .hint .hv { font-size: 14px; }
  .hint .hl { font-size: 8.5px; }
  .step { flex-direction: column; align-items: flex-start; }
  .slot { min-height: 96px; }
  .slot .sn { font-size: 13px; }
  .final .big { font-size: 66px; }
  .prompt { font-size: 19.5px; }
  .round-title { font-size: 23px; }
  .tier-legend span { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
