/* ============================================================
   BUILD-A-HOOPER — single-screen basketball builder
   Vanilla CSS, no build step. Theme-aware, fits 100dvh.
   ============================================================ */

:root {
  --bg:      #090c11;
  --bg-1:    #0e131b;
  --bg-2:    #131b25;
  --bg-3:    #1a2534;
  --raise:   #202d3f;
  --line:    rgba(255,255,255,.075);
  --line-2:  rgba(255,255,255,.15);
  --text:    #eef2f7;
  --muted:   #9aa7b8;
  --faint:   #8493a6;

  --accent:  #ff7a1a;
  --accent-d:#e8620a;
  --accent-2:#ffb457;
  --gold:    #ffd24a;
  --good:    #35d38a;
  --info:    #4cc4f5;
  --bad:     #f8776b;

  --t-elite: #ffd24a;
  --t-great: #ff8a3d;
  --t-good:  #35d38a;
  --t-ok:    #4cc4f5;
  --t-mid:   #97a9bf;
  --t-low:   #6b7a8d;

  --radius:  14px;
  --radius-s:9px;
  --shadow:  0 18px 50px -18px rgba(0,0,0,.7);
  --ring:    0 0 0 2px var(--bg-1), 0 0 0 4px var(--accent);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Arial Narrow", "Helvetica Neue Condensed", "Roboto Condensed", system-ui, sans-serif;
  --gap: clamp(8px, 1.1vw, 16px);
}

:root[data-theme="light"] {
  --bg:      #ece7db;
  --bg-1:    #f6f3ec;
  --bg-2:    #ffffff;
  --bg-3:    #fbf8f1;
  --raise:   #f2ede2;
  --line:    rgba(20,28,40,.10);
  --line-2:  rgba(20,28,40,.20);
  --text:    #17202b;
  --muted:   #566372;
  --faint:   #5a6774;
  --accent:  #dd5600;
  --accent-d:#b84800;
  --accent-2:#c96a00;
  --gold:    #9a6b00;
  --good:    #12915a;
  --info:    #1284bb;
  --bad:     #d63d33;
  --t-elite: #9a6b00;
  --t-great: #cc5200;
  --t-good:  #12915a;
  --t-ok:    #1580b0;
  --t-mid:   #5f6d7e;
  --t-low:   #7c8a99;
  --shadow:  0 18px 50px -20px rgba(40,30,10,.35);
  --ring:    0 0 0 2px var(--bg-1), 0 0 0 4px var(--accent);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* beat class-level display:grid on .stage/.season */
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* subtle court glow backdrop */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 82% -10%, rgba(255,122,26,.16), transparent 55%),
    radial-gradient(90% 70% at 8% 110%, rgba(76,196,245,.10), transparent 55%);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(120% 80% at 82% -10%, rgba(239,95,0,.12), transparent 55%),
    radial-gradient(90% 70% at 8% 110%, rgba(24,153,207,.08), transparent 55%);
}

.app {
  position: relative; z-index: 1;
  height: 100dvh;
  display: flex; flex-direction: column;
  padding: clamp(8px, 1.2vw, 16px);
  gap: var(--gap);
}

/* ===================== TOPBAR ===================== */
.topbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 2px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; justify-self: start; }
.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: .04em;
  line-height: 1;
}
.brand-name i { color: var(--accent); font-style: normal; }
.ball {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle at 35% 30%, #ffb15e, var(--accent) 55%, var(--accent-d));
  position: relative;
  box-shadow: 0 2px 10px rgba(255,122,26,.4);
}
.ball::before, .ball::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.6px solid rgba(0,0,0,.55);
}
.ball::before { border-width: 0; background:
  linear-gradient(rgba(0,0,0,.55),rgba(0,0,0,.55)) 50% 0/1.6px 100% no-repeat,
  linear-gradient(rgba(0,0,0,.55),rgba(0,0,0,.55)) 0 50%/100% 1.6px no-repeat; }

.topbar-center { justify-self: center; }
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar {
  width: clamp(90px, 16vw, 200px); height: 7px; border-radius: 99px;
  background: var(--bg-3); overflow: hidden; border: 1px solid var(--line);
}
.progress-bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 99px; transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.progress-text { font-size: 12px; color: var(--muted); white-space: nowrap; }
.progress-text b { color: var(--text); font-variant-numeric: tabular-nums; }

.topbar-actions { display: flex; align-items: center; gap: 8px; justify-self: end; }
.seg {
  display: inline-flex; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 99px; padding: 3px;
}
.seg-btn {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 13px; border-radius: 99px; cursor: pointer; transition: .15s;
}
.seg-btn.is-active { background: var(--accent); color: #1a0e02; }
:root[data-theme="light"] .seg-btn.is-active { color: #fff; }
.seg-btn:not(.is-active):hover { color: var(--text); }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
#dailyBtn { width: auto; padding: 0 12px; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: #1a0e02; border-color: transparent; }
:root[data-theme="light"] .icon-btn[aria-pressed="true"] { color: #fff; }

/* language selector */
.lang-sel {
  height: 34px; border-radius: 10px; padding: 0 26px 0 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: .15s;
  max-width: 132px; text-overflow: ellipsis;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237c8a9c' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.lang-sel:hover { color: var(--text); border-color: var(--line-2); }
.lang-sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-sel option { background: var(--bg-2); color: var(--text); }
:root[dir="rtl"] .lang-sel { padding: 0 10px 0 26px; background-position: left 10px center; }
:root[dir="rtl"] .gc-home, :root[dir="rtl"] .gc-away { flex-direction: row-reverse; }

/* ===================== STAGE (two columns) ===================== */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: var(--gap);
}
.panel {
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ---------- BUILD PANEL ---------- */
.build { padding: clamp(12px,1.4vw,18px); }
.build-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.overall-badge {
  flex: none; width: 62px; height: 62px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-3); border: 1px solid var(--line-2);
  position: relative; overflow: hidden;
  transition: box-shadow .3s, border-color .3s;
}
.overall-badge::after {
  content:""; position:absolute; inset:0; opacity:.16; pointer-events:none;
  background: radial-gradient(circle at 50% 0%, currentColor, transparent 70%);
}
.ovr-num {
  font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.ovr-lbl { font-size: 10px; letter-spacing: .18em; color: var(--muted); margin-top: 2px; }
.build-title h2 { font-family: var(--display); font-size: clamp(18px,2vw,23px); letter-spacing:.02em; font-weight: 800; }
.build-title p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.radar-wrap {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 4px 0;
}
.radar { width: 100%; height: 100%; max-height: 46vh; overflow: visible; }

.slots {
  list-style: none; flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px;
  margin: 8px 0 12px;
}
.slot {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 9px; background: var(--bg-2);
  border: 1px solid var(--line); min-width: 0;
  transition: background .2s, border-color .2s;
}
.slot.filled { background: var(--bg-3); }
.slot.pop { animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { 0%{transform:scale(.85);} 60%{transform:scale(1.05);} 100%{transform:scale(1);} }
.slot-key { font-size: 10.5px; font-weight: 800; color: var(--faint); letter-spacing: .03em; width: 30px; }
.slot.filled .slot-key { color: var(--muted); }
.slot-src { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.slot-val {
  font-family: var(--display); font-weight: 800; font-size: 16px; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--t-mid);
}
.slot:not(.filled) .slot-val { color: var(--faint); }

.btn-sim { width: 100%; margin-top: auto; }

/* ---------- FLOOR PANEL ---------- */
.floor { padding: clamp(12px,1.4vw,18px); }
.floor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.floor-title h2 { font-family: var(--display); font-size: clamp(18px,2vw,24px); letter-spacing:.02em; font-weight: 800; }
.floor-title p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.floor-tools { display: flex; gap: 8px; flex: none; }

.reel {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
.reel.has-team { display: flex; flex-direction: column; }

/* ---------- TEAM BANNER (the spin reveal) ---------- */
.team-banner {
  flex: 0 0 auto;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--team) 26%, transparent), transparent 60%),
    var(--bg-2);
  position: relative; overflow: hidden;
}
.team-banner::before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background:var(--team); }
.team-banner.spin { animation: bannerIn .5s cubic-bezier(.2,.9,.3,1) backwards; }
@keyframes bannerIn { from { opacity:0; transform: translateY(-10px) scale(.99); } }

/* ---------- SPIN REEL (slot-machine team draw) ---------- */
.reel.spinning { display: flex; flex-direction: column; align-items: stretch; justify-content: center; }
.spin-stage {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; text-align: center;
  position: relative; overflow: hidden;
}
.spin-stage::before, .spin-stage::after {
  content: ""; position: absolute; left: 0; right: 0; height: 34%; pointer-events: none; z-index: 2;
}
.spin-stage::before { top: 0; background: linear-gradient(var(--bg-1), transparent); }
.spin-stage::after  { bottom: 0; background: linear-gradient(transparent, var(--bg-1)); }
.spin-window {
  width: min(84%, 460px); border-radius: 18px; padding: 22px 20px;
  border: 1px solid var(--line-2);
  background: linear-gradient(90deg, color-mix(in srgb, var(--team) 30%, transparent), transparent 62%), var(--bg-2);
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 16px;
  position: relative; overflow: hidden; box-shadow: 0 20px 44px -26px rgba(0,0,0,.6);
}
.spin-window::before { content:""; position:absolute; inset:0 auto 0 0; width:5px; background:var(--team); }
.spin-window.flip { animation: spinFlip .16s ease-out; }
.spin-window.land { animation: spinLand .5s cubic-bezier(.16,1.02,.3,1); }
@keyframes spinFlip { from { transform: translateY(-92%); opacity: .1; } to { transform: translateY(0); opacity: 1; } }
@keyframes spinLand { 0% { transform: scale(.94); } 45% { transform: scale(1.05); } 100% { transform: scale(1); } }
.spin-badge {
  font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1;
  width: 74px; height: 74px; border-radius: 16px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); border: 1px solid var(--line-2); font-variant-numeric: tabular-nums;
}
.spin-info { min-width: 0; text-align: left; }
:root[dir="rtl"] .spin-info { text-align: right; }
.spin-name {
  font-family: var(--display); font-weight: 800; font-size: clamp(17px,2.1vw,24px);
  line-height: 1.08; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spin-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.spin-window.is-final .spin-name { color: var(--team); }
.spin-caption {
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); display: flex; align-items: center; gap: 8px; z-index: 3;
}
.spin-caption::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--accent); border-top-color: transparent; animation: spinDot .6s linear infinite;
}
@keyframes spinDot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin-window.flip, .spin-window.land { animation: none; }
  .spin-caption::before { animation: none; }
}
.tb-badge {
  font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1;
  width: 50px; height: 50px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); border: 1px solid var(--line-2); font-variant-numeric: tabular-nums;
}
.tb-info { min-width: 0; }
.tb-name { font-family: var(--display); font-weight: 800; font-size: clamp(16px,1.9vw,22px); letter-spacing:.01em; line-height:1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-meta { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-tag { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 700; white-space: nowrap; align-self: flex-start; }

/* ---------- ROSTER STRIP (pick a player) ---------- */
.roster-strip { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; max-height: 27%; overflow-y: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: 10px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 12.5px; transition: .12s; -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--line-2); background: var(--bg-3); }
.chip:focus-visible { outline: none; box-shadow: var(--ring); }
.chip.sel { border-color: var(--team); background: color-mix(in srgb, var(--team) 16%, var(--bg-2)); }
.chip-name { font-weight: 600; white-space: nowrap; }
.chip-pos { font-size: 10px; color: var(--faint); font-weight: 700; }
.chip-ovr { font-family: var(--display); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }

.card.detail { flex: 1 1 auto; }
.card-hint { margin-left: auto; color: var(--team); font-weight: 700; font-size: 10.5px; letter-spacing: .04em; }
.attr.locked .attr-val { color: var(--good) !important; }

/* start screen */
.start { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; text-align: center; }
.start-inner { max-width: 520px; padding: 20px; }
.start-ball {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 18px;
  background: radial-gradient(circle at 35% 30%, #ffb15e, var(--accent) 55%, var(--accent-d));
  box-shadow: 0 10px 40px -6px rgba(255,122,26,.55);
  position: relative; animation: bounce 2.4s ease-in-out infinite;
}
.start-ball::after {
  content:""; position:absolute; inset:0; border-radius:50%;
  background:
    linear-gradient(rgba(0,0,0,.5),rgba(0,0,0,.5)) 50% 0/2px 100% no-repeat,
    linear-gradient(rgba(0,0,0,.5),rgba(0,0,0,.5)) 0 50%/100% 2px no-repeat;
}
@keyframes bounce { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-12px);} }
.start-inner h1 { font-family: var(--display); font-size: clamp(30px,4.4vw,52px); font-weight: 800; letter-spacing: .01em; line-height: .98; }
.start-inner > p { color: var(--muted); font-size: clamp(13px,1.4vw,15.5px); margin: 12px auto 22px; max-width: 44ch; line-height: 1.5; }
.start-inner b { color: var(--text); }
.start-fine { font-size: 12px; color: var(--faint); margin-top: 18px; }

/* ---------- PLAYER CARD ---------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
  --team: var(--accent);
}
.card::before {
  content:""; position:absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--team), transparent 85%);
}
.card.dealing { animation: deal .42s cubic-bezier(.2,.9,.3,1) backwards; }
@keyframes deal { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.card-head {
  padding: 11px 12px 9px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px;
  border-bottom: 1px solid var(--line);
}
.card-head > div:first-child { min-width: 0; }
.card-name { font-family: var(--display); font-weight: 800; font-size: clamp(15px,1.5vw,18px); line-height: 1.05; letter-spacing:.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 3px; display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.card-team { color: var(--team); font-weight: 700; }
.card-pos { background: var(--bg-3); border:1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 10px; font-weight: 700; color: var(--muted); }
.card-ovr {
  font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1;
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); border: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}

.attrs {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 1fr;
  grid-auto-rows: minmax(0, 1fr); gap: 2px;
  padding: 6px; overflow: hidden;
}
.attr {
  display: grid; grid-template-columns: 34px minmax(0, 40%) 1fr auto; align-items: center; gap: 8px;
  padding: 0 8px; border-radius: 7px; border: 1px solid transparent;
  background: var(--bg-2); cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
  min-height: 0;
  -webkit-tap-highlight-color: transparent;
}
.attr:hover:not(.locked) { background: var(--bg-3); border-color: var(--line-2); }
.attr:active:not(.locked) { transform: scale(.985); }
.attr:focus-visible { outline: none; box-shadow: var(--ring); }
.attr.locked { cursor: default; opacity: .34; }
.attr.locked .attr-bar span { filter: grayscale(.6); }
.attr-key { font-size: 10.5px; font-weight: 800; color: var(--faint); letter-spacing: .02em; }
.attr-name { font-size: 11.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attr-bar { height: 7px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.attr-bar span { display:block; height:100%; border-radius:99px; }
.attr-val {
  font-family: var(--display); font-weight: 800; font-size: 15px; min-width: 22px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.attr.mys .attr-val { color: var(--faint); }
.attr.mys .attr-bar span { width: 100% !important; background: repeating-linear-gradient(45deg, var(--bg-3), var(--bg-3) 4px, var(--raise) 4px, var(--raise) 8px) !important; }

/* tier colors */
.t-elite { color: var(--t-elite); } .bg-elite { background: var(--t-elite); }
.t-great { color: var(--t-great); } .bg-great { background: var(--t-great); }
.t-good  { color: var(--t-good);  } .bg-good  { background: var(--t-good); }
.t-ok    { color: var(--t-ok);    } .bg-ok    { background: var(--t-ok); }
.t-mid   { color: var(--t-mid);   } .bg-mid   { background: var(--t-mid); }
.t-low   { color: var(--t-low);   } .bg-low   { background: var(--t-low); }

/* ===================== BUTTONS ===================== */
.btn {
  font: inherit; font-weight: 700; font-size: 14px;
  border: 1px solid transparent; border-radius: 11px;
  padding: 10px 16px; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #1a0e02; box-shadow: 0 8px 20px -8px rgba(255,122,26,.7);
}
:root[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:not(:disabled):hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-2); border-color: var(--line); color: var(--text); }
.btn-ghost:not(:disabled):hover { border-color: var(--line-2); background: var(--bg-3); }
.btn-ghost b { color: var(--accent); font-variant-numeric: tabular-nums; }
.btn-lg { padding: 14px 30px; font-size: 16px; border-radius: 13px; }
.btn-sim { font-size: 15px; padding: 13px; }
.btn-sim.ready { animation: readyPulse 1.8s ease-in-out infinite; }
@keyframes readyPulse { 0%,100%{box-shadow:0 8px 20px -8px rgba(255,122,26,.7);} 50%{box-shadow:0 8px 30px -6px rgba(255,122,26,.95);} }

/* ===================== OVERLAYS ===================== */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(5,8,12,.66); backdrop-filter: blur(7px);
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } }
.overlay[hidden] { display: none; }
.overlay-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--muted); cursor: pointer; font-size: 15px;
}
.overlay-close:hover { color: var(--text); }

.result-card, .help-card {
  position: relative;
  background: var(--bg-1); border: 1px solid var(--line-2);
  border-radius: 18px; box-shadow: var(--shadow);
  width: min(860px, 100%); max-height: min(92dvh, 640px); overflow: auto;
  animation: rise .35s cubic-bezier(.2,.9,.3,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; }
.result-left {
  padding: clamp(20px,3vw,34px); display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: radial-gradient(120% 90% at 0% 0%, rgba(255,122,26,.12), transparent 60%);
}
.res-banner {
  font-family: var(--display); font-weight: 800; letter-spacing: .12em; font-size: 14px;
  color: var(--accent); text-transform: uppercase;
}
.res-banner.champ { color: var(--gold); }
.res-record {
  font-family: var(--display); font-weight: 800; font-size: clamp(52px, 9vw, 84px); line-height: .9;
  margin: 8px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.res-record i { color: var(--faint); font-style: normal; margin: 0 6px; }
.res-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.res-seed { font-size: 13px; color: var(--muted); }
.res-grade {
  font-family: var(--display); font-weight: 800; font-size: 20px; padding: 3px 12px;
  border-radius: 9px; background: var(--bg-3); border: 1px solid var(--line-2);
}
.res-odds { margin-top: auto; display: grid; gap: 8px; margin-bottom: 18px; }
.odds-row { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--muted); }
.odds-row b { font-family: var(--display); font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.res-actions { display: flex; gap: 10px; }
.res-actions .btn { flex: 1; }

/* social share */
.share-row { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.share-hint { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.share-nets { display: flex; gap: 8px; flex-wrap: wrap; }
.share-ico {
  width: 40px; height: 40px; border-radius: 11px; flex: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; transition: .15s;
}
.share-ico svg { width: 19px; height: 19px; fill: currentColor; }
.share-ico:hover { color: #fff; border-color: transparent; transform: translateY(-2px); }
.share-ico[data-net="x"]:hover        { background: #000; color: #fff; }
.share-ico[data-net="facebook"]:hover { background: #1877F2; }
.share-ico[data-net="reddit"]:hover   { background: #FF4500; }
.share-ico[data-net="whatsapp"]:hover { background: #25D366; }
.share-ico[data-net="telegram"]:hover { background: #229ED9; }
.share-ico.share-copy:hover           { background: var(--accent); color: #1a0e02; }
:root[data-theme="light"] .share-ico[data-net="x"]:hover { background: #000; color: #fff; }

.result-right { padding: clamp(20px,3vw,30px); min-width: 0; }
.bracket-title, .roster-title { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.roster-title { margin-top: 20px; }
.bracket { list-style: none; display: grid; gap: 6px; }
.bracket li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px 11px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line);
  font-size: 13px;
}
.bracket li.win { border-color: rgba(53,211,138,.4); }
.bracket li.loss { border-color: rgba(248,119,107,.4); opacity: .82; }
.br-round { font-size: 10.5px; letter-spacing: .05em; color: var(--faint); text-transform: uppercase; }
.br-opp { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-score { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.br-score.win { color: var(--good); } .br-score.loss { color: var(--bad); }

.squad { list-style: none; display: grid; grid-template-columns: repeat(2,1fr); gap: 5px; }
.squad li { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; padding: 4px 8px; background: var(--bg-2); border-radius: 7px; border: 1px solid var(--line); min-width: 0; }
.squad .sq-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.squad .sq-skill { font-weight: 800; flex: none; }

.help-card { width: min(560px, 100%); padding: clamp(22px,3vw,34px); }
.help-card h2 { font-family: var(--display); font-size: 28px; font-weight: 800; margin-bottom: 16px; }
.help-steps { list-style: none; display: grid; gap: 12px; counter-reset: s; }
.help-steps li { position: relative; padding-left: 40px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.help-steps b { color: var(--text); }
.help-steps li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); color: #1a0e02; font-family: var(--display); font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
:root[data-theme="light"] .help-steps li::before { color: #fff; }
.help-note { font-size: 13px; color: var(--muted); margin-top: 18px; line-height: 1.6; padding-top: 16px; border-top: 1px solid var(--line); }
.help-note b { color: var(--accent); }
.help-fine { font-size: 11.5px; color: var(--faint); margin-top: 12px; }

/* ===================== SEASON VIEW ===================== */
.season {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(300px, 350px) 1fr; gap: var(--gap);
}
.season-side, .season-main {
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
  border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.season-side { padding: clamp(16px, 1.8vw, 22px); gap: 16px; }
.season-main { padding: clamp(16px, 1.8vw, 22px); gap: 16px; }

.team-id { display: flex; align-items: center; gap: 14px; }
.team-crest {
  width: 58px; height: 58px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .02em;
  color: #fff; background: var(--accent); border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 6px 18px -8px rgba(0,0,0,.6);
}
.team-id h2 { font-family: var(--display); font-size: clamp(19px,2.1vw,24px); font-weight: 800; letter-spacing: .01em; }
.team-id p { font-size: 13px; color: var(--muted); margin-top: 3px; }

.record-box { text-align: center; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.record { font-family: var(--display); font-weight: 800; font-size: clamp(44px,7vw,64px); line-height: 1; font-variant-numeric: tabular-nums; }
.record i { color: var(--faint); font-style: normal; margin: 0 8px; }
.record-sub { display: flex; justify-content: center; gap: 10px; align-items: center; margin: 8px 0 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.phase-tag { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; padding: 2px 9px; border: 1px solid var(--line-2); border-radius: 99px; }
.last5 { display: flex; gap: 5px; justify-content: center; }
.pill { width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 12px; }
.pill.w { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); }
.pill.l { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 38%, transparent); }

.statline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.stat-tile { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 4px; text-align: center; }
.stat-tile b { display: block; font-family: var(--display); font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: 10px; color: var(--muted); letter-spacing: .04em; }

.awards { display: grid; gap: 7px; margin-top: auto; }
.award-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.award-name { font-size: 12.5px; color: var(--muted); }
.award-name b { color: var(--text); font-weight: 700; }
.award-rank { font-family: var(--display); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.award-rank.lead { color: var(--gold); }
.award-rank small { font-size: 10px; color: var(--faint); font-family: var(--font); font-weight: 600; }

/* matchup */
.matchup { background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--radius); padding: clamp(14px,1.6vw,20px); flex: none; }
.matchup-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.matchup-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.matchup-count { font-size: 12px; color: var(--muted); }
.matchup-body { display: flex; align-items: center; justify-content: center; gap: clamp(12px,3vw,34px); margin-bottom: 16px; }
.mu-team { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.mu-crest { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; font-size: 16px; color: #fff; border: 1px solid rgba(255,255,255,.18); }
.mu-name { font-size: 12.5px; color: var(--muted); text-align: center; max-width: 15ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-ovr { font-family: var(--display); font-weight: 800; font-size: 15px; }
.mu-vs { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--faint); }
.mu-at { font-size: 11px; color: var(--faint); }
.matchup-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.matchup-controls .btn { flex: 1 1 auto; }
#watchBtn { flex: 2 1 auto; }

.season-cols { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.ticker-wrap, .standings-wrap { display: flex; flex-direction: column; min-height: 0; }
.mini-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.ticker, .standings { list-style: none; overflow-y: auto; min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ticker li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 7px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.ticker .tk-res { font-family: var(--display); font-weight: 800; }
.ticker .tk-res.w { color: var(--good); } .ticker .tk-res.l { color: var(--bad); }
.ticker .tk-opp { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker .tk-score { font-variant-numeric: tabular-nums; color: var(--text); font-size: 11.5px; }
.standings li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px; font-size: 12px; }
.standings li:nth-child(odd) { background: var(--bg-2); }
.standings li.me { background: color-mix(in srgb, var(--accent) 16%, var(--bg-2)); border: 1px solid var(--accent); }
.st-rank { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11px; }
.st-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-w { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }

/* ===================== GAMECAST ===================== */
.gc-overlay { align-items: stretch; padding: clamp(10px, 2vw, 26px); }
.gc-card {
  width: min(760px, 100%); margin: auto;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column; max-height: 94dvh;
  animation: rise .3s cubic-bezier(.2,.9,.3,1);
}
.gc-scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  padding: clamp(16px,2.4vw,26px) clamp(16px,2.4vw,28px);
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border-bottom: 1px solid var(--line);
}
.gc-team { display: flex; align-items: center; gap: 14px; }
.gc-home { justify-content: flex-start; }
.gc-away { justify-content: flex-end; }
.gc-abbr { font-family: var(--display); font-weight: 800; font-size: clamp(20px,3vw,30px); letter-spacing: .03em; padding: 4px 12px; border-radius: 10px; color: #fff; }
.gc-pts { font-family: var(--display); font-weight: 800; font-size: clamp(40px,7vw,64px); line-height: 1; font-variant-numeric: tabular-nums; }
.gc-center { text-align: center; min-width: 92px; }
.gc-clock { font-family: var(--display); font-weight: 800; font-size: clamp(16px,2.2vw,22px); font-variant-numeric: tabular-nums; }
.gc-status { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-top: 4px; }
.gc-livebox { display: flex; gap: 1px; padding: 12px clamp(16px,2.4vw,28px) 0; }
.gc-boxgrid { display: grid; gap: 4px; width: 100%; }
.gc-boxrow { display: grid; grid-template-columns: 48px repeat(var(--cols,4), 1fr) 52px; gap: 4px; align-items: center; }
.gc-boxrow.head span { font-size: 10px; color: var(--faint); text-align: center; letter-spacing: .05em; }
.gc-boxrow .bx-tm { font-family: var(--display); font-weight: 800; font-size: 13px; }
.gc-boxrow .bx-q { text-align: center; font-variant-numeric: tabular-nums; font-size: 13px; padding: 4px 0; background: var(--bg-2); border-radius: 6px; }
.gc-boxrow .bx-tot { text-align: center; font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.gc-yourline { margin: 12px clamp(16px,2.4vw,28px) 0; padding: 8px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; text-align: center; font-size: 13px; color: var(--muted); }
.gc-yourline b { color: var(--text); font-family: var(--display); }
.gc-feed { list-style: none; flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 12px clamp(16px,2.4vw,28px); display: flex; flex-direction: column; gap: 6px; }
.gc-feed li { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: baseline; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); animation: feedIn .25s ease backwards; }
@keyframes feedIn { from { opacity: 0; transform: translateY(4px); } }
.gc-feed .f-clock { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--faint); white-space: nowrap; }
.gc-feed .f-score { font-family: var(--display); font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.gc-feed .f-text { color: var(--text); }
.gc-feed li.me .f-text { color: var(--text); }
.gc-feed li.opp .f-text { color: var(--muted); }
.gc-feed li.end .f-text, .gc-feed li.tip .f-text { color: var(--accent); font-weight: 600; }
.gc-controls { display: flex; align-items: center; gap: 10px; padding: 12px clamp(16px,2.4vw,28px); border-top: 1px solid var(--line); }
.gc-speed { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.gc-speed .seg-btn { padding: 4px 11px; font-size: 12px; }
.gc-speed .seg-btn.is-active { background: var(--accent); color: #1a0e02; }
:root[data-theme="light"] .gc-speed .seg-btn.is-active { color: #fff; }
.gc-controls .btn { margin-left: auto; }
.gc-controls #gcContinue { margin-left: 0; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px);
  z-index: 50; background: var(--bg-3); border: 1px solid var(--line-2);
  color: var(--text); padding: 10px 18px; border-radius: 99px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
  .stage { grid-template-columns: 1fr; }
  .season { grid-template-columns: 1fr; }
  .season-side, .season-main { overflow: visible; }
  .season-cols { grid-template-columns: 1fr; }
  .ticker, .standings { max-height: 300px; }
  .awards { margin-top: 16px; }
  .topbar { grid-template-columns: 1fr; }
  .topbar-center { display: none; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-start; row-gap: 6px; }
  .lang-sel { max-width: 120px; }
  .reel { grid-template-columns: 1fr; }
  .reel .card { min-height: 168px; }
  .result-grid { grid-template-columns: 1fr; }
  .result-left { border-right: 0; border-bottom: 1px solid var(--line); }

  /* the draft floor (the action) comes first on mobile; the build panel
     (radar + slots + progress) reads below it */
  .panel.floor { order: -1; }
  .radar-wrap { flex: 0 0 auto; }
  .radar { max-height: 220px; }
  .slots { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .topbar-actions .seg-btn { padding: 5px 10px; }
  .radar { max-height: 190px; }
  .season-side { padding-bottom: 4px; }
}

/* very short desktop windows: keep the build panel's CTA reachable without page scroll */
@media (min-width: 861px) and (max-height: 560px) {
  .radar { max-height: 30vh; }
  .radar-wrap { padding: 0; }
  .slots { gap: 4px; margin: 6px 0 8px; }
  .slot { padding: 4px 8px; }
  .build-head { margin-bottom: 2px; }
  .build { overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .05ms !important; }
}
