/* ===================== NBA LEGENDS — UI ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #e8622a;
  --orange-bright: #ff8a3d;
  --gold: #ffd23f;
  --green: #39d98a;
  --red: #ff5a5a;
  --ink: #0d0f14;
  --panel: #171a22;
  --panel2: #1f232e;
  --line: #2c3140;
  --text: #e8ebf2;
  --muted: #9aa3b5;
}

html, body {
  height: 100%;
  background: radial-gradient(1200px 700px at 50% -10%, #23283a 0%, var(--ink) 60%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, system-ui, Arial, sans-serif;
  overflow-x: hidden;
}

#app {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.screen { display: none; width: 100%; max-width: 1040px; }
.screen.active { display: block; animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Titles ---------- */
.title {
  text-align: center;
  margin-bottom: 8px;
  font-weight: 900;
  letter-spacing: 2px;
  font-size: clamp(38px, 7vw, 74px);
  line-height: 0.95;
  background: linear-gradient(180deg, #fff 0%, var(--gold) 55%, var(--orange) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 30px rgba(232,98,42,0.25);
}
.subtitle { text-align: center; color: var(--muted); margin-bottom: 30px; font-size: 15px; letter-spacing: 3px; text-transform: uppercase; }

/* ---------- Menu ---------- */
.menu-wrap { display: flex; flex-direction: column; gap: 14px; max-width: 420px; margin: 0 auto; }
.btn {
  font: inherit; font-weight: 800; font-size: 18px; letter-spacing: 1px;
  border: none; border-radius: 14px; padding: 18px 22px; cursor: pointer;
  color: #fff; background: var(--panel2); border: 1px solid var(--line);
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-align: center; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,0.35); background: #262b38; }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(180deg, var(--orange-bright), var(--orange));
  border-color: transparent; font-size: 22px; padding: 22px;
  box-shadow: 0 10px 30px rgba(232,98,42,0.35);
}
.btn.primary:hover { background: linear-gradient(180deg, #ff9a52, #ef6b30); }
.btn.small { font-size: 14px; padding: 12px 16px; border-radius: 10px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.footer-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; }
.hi { color: var(--gold); font-weight: 800; }

/* two contest buttons side by side in the menu */
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.menu-row .btn { font-size: 15px; padding: 16px 12px; }

/* ---------- Difficulty selector ---------- */
.diff-select { max-width: 420px; margin: 20px auto 0; text-align: center; }
.diff-lab { display: block; font-size: 12px; letter-spacing: 3px; color: var(--muted); margin-bottom: 8px; }
.diff-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.diff-btn {
  font: inherit; font-weight: 800; font-size: 14px; letter-spacing: 0.5px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 8px; cursor: pointer;
  color: var(--muted); background: var(--panel2);
  transition: transform 0.08s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.diff-btn:hover { transform: translateY(-1px); color: var(--text); }
.diff-btn.active {
  color: #fff; border-color: var(--orange); background: rgba(232,98,42,0.18);
  box-shadow: 0 0 0 1px var(--orange) inset;
}

/* ---------- Mode selector ---------- */
.mode-select { max-width: 460px; margin: 24px auto 0; text-align: center; }
.mode-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mode-btn {
  font: inherit; font-weight: 800; font-size: 14px; letter-spacing: 0.5px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 8px; cursor: pointer;
  color: var(--muted); background: var(--panel2);
  transition: transform 0.08s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.mode-btn:hover { transform: translateY(-1px); color: var(--text); }
.mode-btn.active {
  color: #fff; border-color: var(--orange); background: rgba(232,98,42,0.18);
  box-shadow: 0 0 0 1px var(--orange) inset;
}
.mode-note { color: var(--muted); font-size: 12px; margin-top: 10px; min-height: 15px; }

/* ---------- Team Builder ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel), #12151c);
  border: 1px solid var(--line); border-radius: 18px; padding: 20px;
}
.tb-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tb-head h2 { font-size: 24px; }
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Team toggle: build your five or the rival five */
.team-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.team-tab {
  font: inherit; font-weight: 800; font-size: 15px; letter-spacing: 0.5px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; cursor: pointer;
  color: var(--muted); background: var(--panel2);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.08s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.team-tab:hover { transform: translateY(-1px); color: var(--text); }
.team-tab .tt-count { font-weight: 900; color: var(--muted); }
.team-tab[data-team="you"].active {
  color: #fff; border-color: #2f7bff; background: rgba(47,123,255,0.16);
  box-shadow: 0 0 0 1px #2f7bff inset;
}
.team-tab[data-team="you"].active .tt-count { color: #7fb0ff; }
.team-tab[data-team="cpu"].active {
  color: #fff; border-color: #ff4d4d; background: rgba(255,77,77,0.16);
  box-shadow: 0 0 0 1px #ff4d4d inset;
}
.team-tab[data-team="cpu"].active .tt-count { color: #ff9a9a; }

.lineup {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px;
}
.slot {
  background: var(--panel2); border: 2px dashed var(--line); border-radius: 12px;
  min-height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 8px; cursor: pointer; position: relative;
}
.slot.filled { border-style: solid; }
.slot .slot-num { position: absolute; top: 4px; left: 8px; font-size: 11px; color: var(--muted); }
.slot .slot-name { font-weight: 800; font-size: 13px; line-height: 1.15; }
.slot .slot-pos { font-size: 11px; color: var(--muted); }
.slot .slot-ovr { font-size: 20px; font-weight: 900; }
.slot .empty { color: var(--muted); font-size: 12px; }

.team-meta { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.chem-badge { font-weight: 900; font-size: 26px; }

/* roster grid */
.search-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-row input, .search-row select {
  font: inherit; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.search-row input { flex: 1; min-width: 180px; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px;
  max-height: 46vh; overflow-y: auto; padding: 4px; margin: -4px;
}
.card {
  background: linear-gradient(180deg, var(--panel2), #14171f);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer;
  position: relative; transition: transform 0.08s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--orange); }
.card.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(57,217,138,0.35) inset; }
.card .disc {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #fff; font-size: 14px; position: absolute; top: 12px; right: 12px;
  border: 2px solid rgba(255,255,255,0.85);
}
.card .cname { font-weight: 800; font-size: 15px; padding-right: 42px; line-height: 1.15; }
.card .cmeta { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.card .covr { font-size: 22px; font-weight: 900; }
.card .covr span { font-size: 11px; color: var(--muted); font-weight: 600; }

.bars { margin-top: 8px; display: grid; gap: 4px; }
.bar { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.bar .lab { width: 26px; }
.bar .track { flex: 1; height: 6px; background: #0c0e13; border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 4px; }

/* ---------- Game screen ---------- */
#screen-game { max-width: 1000px; }
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 12px; background: linear-gradient(180deg, #10131a, #0a0c11);
  border: 1px solid var(--line); border-radius: 14px 14px 0 0; padding: 10px 18px;
  border-bottom: none;
}
.sb-block { text-align: center; }
.sb-block .lab { font-size: 11px; color: var(--muted); letter-spacing: 2px; }
.sb-score { font-size: 40px; font-weight: 900; color: var(--green); line-height: 1; }
.sb-score.cpu { color: var(--red); }
.sb-time { font-size: 34px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sb-left { text-align: left; }
.sb-right { text-align: right; }
.sb-name { font-weight: 800; font-size: 13px; color: var(--muted); }
.sb-shot { font-weight: 900; color: var(--gold); }
#hud-poss { font-weight: 800; }

.canvas-wrap {
  position: relative; border: 1px solid var(--line); border-radius: 0 0 14px 14px; overflow: hidden;
  background: #000; line-height: 0;
}
canvas { width: 100%; height: auto; display: block; }

.game-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }
.hint b { color: var(--text); }
.hint kbd {
  background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-family: inherit; font-size: 12px; color: var(--text);
}

/* ---------- Controls / help ---------- */
.help-list { display: grid; gap: 14px; max-width: 560px; margin: 0 auto; }
.help-row { display: flex; gap: 14px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.help-row .keys { min-width: 130px; display: flex; gap: 6px; flex-wrap: wrap; }
.help-row .keys kbd {
  background: #0c0e13; border: 1px solid var(--line); border-bottom-width: 3px;
  border-radius: 6px; padding: 6px 10px; font-family: inherit; font-weight: 800;
}
.help-row .desc { color: var(--muted); font-size: 14px; }
.help-row .desc b { color: var(--text); }

/* ---------- Game Over ---------- */
.go-card { max-width: 460px; margin: 0 auto; text-align: center; }
.go-score { font-size: 76px; font-weight: 900; color: var(--green); line-height: 1; margin: 6px 0; }
.go-score .go-dash { color: var(--muted); margin: 0 10px; }
.go-score .cpu { color: var(--red); }
.go-label { color: var(--muted); letter-spacing: 3px; text-transform: uppercase; font-size: 13px; }
.go-new { color: var(--green); font-weight: 900; font-size: 20px; margin: 8px 0; }
.go-stats { display: flex; justify-content: center; gap: 30px; margin: 18px 0 24px; }
.go-stats .n { font-size: 26px; font-weight: 900; }
.go-stats .l { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

/* MVP / champion card (game over + contest over) */
.mvp-card {
  background: linear-gradient(180deg, rgba(255,210,63,0.14), rgba(255,210,63,0.04));
  border: 1px solid rgba(255,210,63,0.42); border-radius: 14px;
  padding: 12px 16px; margin: 12px auto 4px; max-width: 380px;
}
.mvp-crown { font-size: 12px; letter-spacing: 2px; color: var(--gold); font-weight: 800; }
.mvp-name { font-size: 24px; font-weight: 900; margin: 3px 0; line-height: 1.1; }
.mvp-line { font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---------- Leaderboard ---------- */
.lb-list { max-height: 60vh; overflow-y: auto; padding: 4px; margin: -4px; display: grid; gap: 8px; }
.lb-msg { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 15px; }
.lb-row {
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
}
.lb-row.top { border-color: rgba(255,210,63,0.42); background: linear-gradient(180deg, rgba(255,210,63,0.12), rgba(255,210,63,0.03)); }
.lb-row .lb-rank { font-size: 18px; font-weight: 900; color: var(--muted); text-align: center; }
.lb-row.top .lb-rank { font-size: 22px; }
.lb-row .lb-name { font-weight: 800; font-size: 17px; letter-spacing: 1px; }
.lb-row .lb-diff { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.lb-row .lb-score { font-size: 22px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }

/* ---------- Post-score box (game over) ---------- */
.go-submit {
  background: linear-gradient(180deg, rgba(232,98,42,0.14), rgba(232,98,42,0.04));
  border: 1px solid rgba(232,98,42,0.42); border-radius: 14px;
  padding: 14px 16px; margin: 4px auto 18px; max-width: 380px;
}
.go-submit-lab { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.go-submit-row { display: flex; gap: 8px; justify-content: center; }
.go-submit-row input {
  font: inherit; font-weight: 900; font-size: 20px; letter-spacing: 4px; text-align: center; text-transform: uppercase;
  width: 110px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.go-submit-row input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; }
.go-submit-status { font-size: 13px; font-weight: 700; min-height: 16px; margin-top: 10px; }

/* ---------- Feedback form ---------- */
.fb-form { max-width: 460px; margin: 18px auto 6px; display: grid; gap: 18px; }
.fb-field { display: grid; gap: 8px; position: relative; }
.fb-lab { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.fb-opt { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; opacity: 0.7; }
.fb-field input,
.fb-field textarea {
  font: inherit; width: 100%; box-sizing: border-box;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
}
.fb-field textarea { resize: vertical; min-height: 108px; line-height: 1.4; }
.fb-field input:focus,
.fb-field textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; }
.fb-count { font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.fb-prio { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fb-prio-btn {
  font: inherit; font-weight: 800; font-size: 13px; cursor: pointer;
  background: var(--panel2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px;
  transition: border-color .12s, color .12s, background .12s;
}
.fb-prio-btn:hover { color: var(--text); }
.fb-prio-btn.active { color: var(--text); border-color: var(--orange); background: linear-gradient(180deg, rgba(232,98,42,0.16), rgba(232,98,42,0.04)); }
.fb-status { font-size: 13px; font-weight: 700; min-height: 18px; text-align: center; }

/* ---------- Feedback board (submitted requests + status) ---------- */
.fb-board { max-width: 460px; margin: 26px auto 6px; }
.fb-board-title { font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--muted); margin: 0 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.fb-list { max-height: 38vh; overflow-y: auto; display: grid; gap: 8px; padding: 2px; }
.fb-msg { text-align: center; color: var(--muted); padding: 20px 10px; font-size: 14px; }
.fb-item { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.fb-item.done { opacity: 0.62; }
.fb-item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.fb-badge { font-size: 10px; font-weight: 900; letter-spacing: 0.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); text-transform: uppercase; }
.fb-badge.prio-low { color: #39d98a; border-color: rgba(57,217,138,0.4); }
.fb-badge.prio-medium { color: #ffd23f; border-color: rgba(255,210,63,0.4); }
.fb-badge.prio-high { color: #e8a33f; border-color: rgba(232,163,63,0.4); }
.fb-badge.prio-critical { color: #ff5a5a; border-color: rgba(255,90,90,0.45); }
.fb-badge.status-new { color: var(--text); }
.fb-badge.status-progress { color: #4aa3ff; border-color: rgba(74,163,255,0.45); }
.fb-badge.status-done { color: #39d98a; border-color: rgba(57,217,138,0.5); background: rgba(57,217,138,0.1); }
.fb-who { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.fb-item-desc { font-size: 14px; line-height: 1.42; color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* contest top bar mirrors the scoreboard shell */
.contest-bar { grid-template-columns: 1fr auto 1fr; }
.contest-bar .sb-left { text-align: left; }
.contest-bar .sb-right { text-align: right; }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.topbar .brand { font-weight: 900; letter-spacing: 1px; color: var(--muted); }
.mute-btn { cursor: pointer; }

.scroll-nice::-webkit-scrollbar { width: 10px; }
.scroll-nice::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
