/* ============================================================
   BENCHED — design system
   Primetime-broadcast-meets-streetball-poster. Dark arena base,
   one hot brand gradient, heavy display type, card-game feel.
   ============================================================ */

:root {
  --bg: #070b14;
  --bg2: #0b1120;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-hi: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.10);
  --ink: #f2f5fb;
  --ink-dim: #9aa6bd;
  --ink-faint: #5d6a84;
  --brand-a: #ff5f1f;
  --brand-b: #ff2d78;
  --brand-c: #7b2dff;
  --grad: linear-gradient(100deg, var(--brand-a), var(--brand-b) 55%, var(--brand-c));
  --good: #2ee68a;
  --bad: #ff4d5e;
  --gold: #ffd24a;
  --radius: 18px;
  --dock-h: 92px;
  --font-display: -apple-system, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* body must GROW with content (min-height, not height) or it becomes a
   one-viewport containing block and the sticky topbar stops sticking */
html { height: 100%; }
body { min-height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: radial-gradient(1200px 700px at 80% -10%, rgba(123, 45, 255, 0.16), transparent 60%),
    radial-gradient(1000px 600px at -10% 20%, rgba(255, 95, 31, 0.10), transparent 55%);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  user-select: none;
}

#bggl {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: 0; pointer-events: none; opacity: 0.9;
}

.hidden { display: none !important; }
.hidden-canvas { position: fixed; left: -3000px; top: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(rgba(7, 11, 20, 0.92), rgba(7, 11, 20, 0.75) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.brand {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer; color: var(--ink);
}
.brand-bench { font-size: 20px; filter: drop-shadow(0 2px 6px rgba(255, 45, 120, .5)); }
.brand-word {
  font-family: var(--font-display);
  font-weight: 900; font-size: 22px; letter-spacing: 0.04em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.topbar-right { display: flex; gap: 8px; }

.chip {
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--ink);
  font-size: 13px; font-weight: 700; padding: 7px 12px;
  cursor: pointer; transition: background .15s, transform .1s;
}
.chip:active { transform: scale(0.94); }
.icon-chip { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 15px; }
.streak-chip b { color: var(--gold); }

/* ---------- screens ---------- */
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 0 16px 40px; }
.screen { display: none; animation: screen-in .28s ease both; }
.screen.active { display: block; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- home ---------- */
.hero { padding: 18px 2px 16px; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 900; font-size: clamp(38px, 11vw, 56px);
  line-height: 0.98; letter-spacing: -0.02em;
}
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.sit-text { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--brand-b); text-decoration-thickness: 4px; }
.hero-sub { margin-top: 10px; color: var(--ink-dim); font-size: 15px; max-width: 42ch; }
.hero-sub em { color: var(--ink); font-style: normal; font-weight: 700; }

.daily-card {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; padding: 18px;
  border: 1px solid transparent; border-radius: var(--radius);
  background:
    linear-gradient(var(--bg2), var(--bg2)) padding-box,
    var(--grad) border-box;
  color: var(--ink); cursor: pointer; text-align: left;
  box-shadow: 0 10px 40px rgba(255, 45, 120, 0.18);
  transition: transform .12s;
}
.daily-card:active { transform: scale(0.985); }
.daily-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; color: var(--brand-b); }
.daily-title { font-family: var(--font-display); font-weight: 900; font-size: 22px; margin-top: 4px; }
.daily-tag { color: var(--ink-dim); font-size: 13px; margin-top: 3px; }
.daily-right { text-align: center; }
.daily-cta {
  font-weight: 900; font-size: 13px; letter-spacing: 0.08em;
  padding: 8px 14px; border-radius: 999px; background: var(--grad); color: #fff;
  box-shadow: 0 4px 18px rgba(255, 95, 31, 0.4);
}
.daily-cta.played { background: var(--panel-hi); box-shadow: none; color: var(--ink-dim); }
.daily-sport { font-size: 26px; margin-top: 8px; }

.challenge-strip {
  margin-top: 12px; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-radius: var(--radius); border: 1px dashed var(--brand-b);
  background: rgba(255, 45, 120, 0.08); font-size: 14px;
}

.sport-chips { display: flex; gap: 8px; overflow-x: auto; padding: 18px 2px 4px; scrollbar-width: none; }
.sport-chips::-webkit-scrollbar { display: none; }
.sport-chip { flex: 0 0 auto; }
.sport-chip.on { background: var(--grad); border-color: transparent; color: #fff; }

.pack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pack-card {
  position: relative; text-align: left; padding: 14px; min-height: 110px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); cursor: pointer;
  transition: transform .12s, border-color .15s;
  overflow: hidden;
}
.pack-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--accent, var(--grad));
}
.pack-card:active { transform: scale(0.97); }
.pack-emoji { font-size: 22px; }
.pack-name { font-family: var(--font-display); font-weight: 800; font-size: 15px; line-height: 1.15; }
.pack-sub { color: var(--ink-dim); font-size: 12px; }
.pack-done { position: absolute; top: 10px; right: 10px; font-size: 14px; }
.pack-card.locked { opacity: 0.85; }
.pack-card.locked .pack-name { color: var(--gold); }

.promo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.promo-card {
  display: flex; gap: 10px; align-items: center; text-align: left;
  padding: 13px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
.promo-card b { display: block; font-size: 14px; }
.promo-card span { display: block; color: var(--ink-dim); font-size: 11px; margin-top: 2px; }
.promo-emoji { font-size: 22px; }
.pro-card { border-color: rgba(255, 210, 74, 0.35); }
.arena-card { border-color: rgba(46, 230, 138, 0.3); }

.ad-slot {
  margin-top: 16px; min-height: 64px; border-radius: 14px;
  border: 1px dashed var(--line); overflow: hidden;
}

.fineprint { margin-top: 14px; text-align: center; color: var(--ink-faint); font-size: 11.5px; }
.fineprint span {
  text-decoration: underline; cursor: pointer;
  /* inflate the tap target to ~44px without moving the layout */
  display: inline-block; padding: 16px 10px; margin: -16px -10px;
}

/* ---------- draft ---------- */
.draft-head { display: flex; align-items: center; gap: 12px; padding: 12px 0 4px; }
.draft-headtext { flex: 1; min-width: 0; }
.draft-title { font-family: var(--font-display); font-weight: 900; font-size: 19px; }
.draft-tag { color: var(--ink-dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-chip { font-size: 10px; letter-spacing: 0.12em; padding: 6px 10px; cursor: default; }
.mode-chip.daily { border-color: var(--brand-b); color: var(--brand-b); }
.mode-chip.challenge { border-color: var(--good); color: var(--good); }

.slotbar-wrap {
  /* topbar is 56px + the device notch; pin just below it */
  position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 30;
  padding: 8px 0 14px;
  background: linear-gradient(var(--bg) 88%, transparent);
}
.slotbar-label { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; color: var(--ink-dim); margin-bottom: 8px; }
.slotbar-label span { color: var(--brand-b); }
.slotbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.slot {
  height: 66px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1.5px dashed var(--line); background: rgba(10, 15, 28, 0.92);
  font-size: 22px; transition: all .18s; cursor: pointer; overflow: hidden;
}
.slot.filled {
  border-style: solid; border-color: var(--slot-color, var(--brand-b));
  background: color-mix(in srgb, var(--slot-color, #ff2d78) 20%, #0a0f1c);
  animation: slot-pop .25s ease;
}
@keyframes slot-pop { 0% { transform: scale(.7); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.slot-name {
  font-size: 8.5px; font-weight: 800; color: var(--ink-dim); white-space: nowrap;
  max-width: 92%; overflow: hidden; text-overflow: ellipsis; line-height: 1;
}

.player-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-bottom: calc(var(--dock-h) + 20px); }
.pcard {
  position: relative; text-align: left; padding: 12px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; transition: transform .12s, border-color .15s, opacity .2s, filter .2s;
  overflow: hidden;
}
.pcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--pc, var(--line)); }
.pcard:active { transform: scale(0.96); }
.pcard-top { display: flex; align-items: center; gap: 9px; }
.pcard-jersey {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: color-mix(in srgb, var(--pc, #888) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--pc, #888) 45%, transparent);
}
.pcard-name { font-family: var(--font-display); font-weight: 800; font-size: 14px; line-height: 1.1; overflow-wrap: anywhere; }
.pcard-meta { color: var(--ink-dim); font-size: 10.5px; margin-top: 2px; font-weight: 600; }
.pcard-accolade { margin-top: 8px; font-size: 11px; color: var(--ink-dim); line-height: 1.3; }
.pcard .tag {
  position: absolute; top: 7px; right: 7px; font-size: 8px; font-weight: 900; letter-spacing: 0.1em;
  padding: 2px 6px; border-radius: 6px; opacity: 0; transform: rotate(6deg) scale(.6); transition: all .18s;
  pointer-events: none;
}
.pcard .pcard-name { padding-right: 4px; }
.pcard.starting { border-color: var(--brand-b); box-shadow: 0 6px 24px rgba(255, 45, 120, 0.22); }
.pcard.starting .tag.start { opacity: 1; transform: rotate(0) scale(1); background: var(--grad); color: #fff; }
.pcard.benched { opacity: 0.55; filter: saturate(0.4); }
.pcard.benched .tag.sit { opacity: 1; transform: rotate(-4deg) scale(1); background: var(--panel-hi); color: var(--ink-dim); border: 1px solid var(--line); }

.lockdock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(7, 11, 20, 0.92) 40%);
  display: flex; justify-content: center;
}
.lockdock .btn { max-width: 528px; }

/* ---------- buttons ---------- */
.btn {
  width: 100%; padding: 16px 20px; border: none; border-radius: 16px;
  background: var(--grad); color: #fff; cursor: pointer;
  font-family: var(--font-display); font-weight: 900; font-size: 16px; letter-spacing: 0.06em;
  box-shadow: 0 8px 30px rgba(255, 45, 120, 0.35);
  transition: transform .12s, opacity .15s, box-shadow .15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { background: var(--panel-hi); color: var(--ink-faint); box-shadow: none; cursor: default; }
.btn.small { width: auto; padding: 10px 16px; font-size: 13px; border-radius: 12px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-dim); box-shadow: none; }
.lock-btn:not(:disabled) { animation: lock-pulse 1.6s ease-in-out infinite; }
@keyframes lock-pulse {
  0%, 100% { box-shadow: 0 8px 30px rgba(255, 45, 120, 0.35); }
  50% { box-shadow: 0 8px 44px rgba(255, 95, 31, 0.6); }
}

/* ---------- results ---------- */
.results-flow { padding: 14px 0 60px; display: flex; flex-direction: column; gap: 14px; }
.rpanel {
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(11, 17, 32, 0.75);
  padding: 16px; animation: rpanel-in .4s cubic-bezier(.2, .9, .3, 1.2) both;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
@keyframes rpanel-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.rpanel h3 { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.16em; color: var(--ink-dim); margin-bottom: 10px; }

.lineup-row { display: flex; flex-wrap: wrap; gap: 6px; }
.lineup-chipp {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  font-size: 12px; font-weight: 700;
}
.lineup-chipp .je { width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; background: color-mix(in srgb, var(--pc, #888) 30%, transparent); }
.lineup-chipp .ovr { color: var(--gold); font-weight: 900; font-size: 11px; }
.lineup-chipp.dim { opacity: 0.6; }
.bench-strike { text-decoration: line-through; text-decoration-color: var(--brand-b); }

.power-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.power-box { flex: 1; text-align: center; padding: 10px; border-radius: 12px; background: var(--panel); }
.power-box .num { font-family: var(--font-display); font-weight: 900; font-size: 26px; }
.power-box .lbl { font-size: 10px; letter-spacing: 0.12em; color: var(--ink-dim); }
.power-vs { font-family: var(--font-display); font-weight: 900; color: var(--ink-faint); }

/* sim */
.sim-board { text-align: center; }
.sim-series { display: flex; justify-content: center; gap: 8px; margin: 6px 0 12px; }
.sdot { width: 12px; height: 12px; border-radius: 999px; background: var(--panel-hi); border: 1px solid var(--line); transition: all .2s; }
.sdot.w { background: var(--good); border-color: var(--good); box-shadow: 0 0 10px rgba(46, 230, 138, .6); }
.sdot.l { background: var(--bad); border-color: var(--bad); box-shadow: 0 0 10px rgba(255, 77, 94, .6); }
.sim-score {
  font-family: var(--font-display); font-weight: 900; font-size: 40px; letter-spacing: 0.02em;
  display: flex; justify-content: center; align-items: baseline; gap: 14px;
}
.sim-score .tname { font-size: 11px; letter-spacing: 0.14em; color: var(--ink-dim); display: block; margin-top: 2px; }
.sim-ticker {
  margin-top: 12px; min-height: 44px; font-size: 13px; color: var(--ink-dim);
  border-top: 1px solid var(--line); padding-top: 10px;
}
.sim-ticker b { color: var(--ink); }
.sim-verdict { font-family: var(--font-display); font-weight: 900; font-size: 22px; margin-top: 10px; line-height: 1.15; }
.sim-verdict.good { color: var(--good); }
.sim-verdict.bad { color: var(--bad); }

/* hot take meter */
.temp-wrap { text-align: center; }
.temp-big { font-family: var(--font-display); font-weight: 900; font-size: 44px; }
.temp-label { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; margin-top: 2px; }
.temp-bar { height: 10px; border-radius: 999px; background: var(--panel-hi); margin-top: 12px; overflow: hidden; }
.temp-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #3da5ff, var(--gold), var(--brand-a), var(--brand-b)); transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.temp-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-dim); }
.temp-note b { color: var(--ink); }

.crowd-row { display: flex; flex-direction: column; gap: 6px; }
.crowd-line { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 8px; font-size: 12px; }
.crowd-line .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crowd-line .bar { height: 7px; border-radius: 999px; background: var(--panel-hi); overflow: hidden; }
.crowd-line .bar i { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.crowd-line .pc2 { text-align: right; color: var(--ink-dim); font-weight: 700; }
.crowd-line.you .nm::after { content: " ✔"; color: var(--good); }

/* share panel */
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.share-actions .btn { font-size: 13px; padding: 13px 10px; }
.share-actions .wide { grid-column: 1 / -1; }
.share-preview { width: 60%; max-width: 200px; margin: 4px auto 0; border-radius: 14px; border: 1px solid var(--line); display: block; }

.h2h-note { font-size: 13px; color: var(--ink-dim); text-align: center; margin-top: 6px; }

/* ---------- modals ---------- */
.modal-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 10, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal {
  position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 420px); padding: 22px; border-radius: 22px;
  background: var(--bg2); border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: modal-in .22s ease both;
}
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal h2 { font-family: var(--font-display); font-weight: 900; font-size: 22px; margin-bottom: 12px; }
.modal .btn { margin-top: 14px; }
.howto-list { padding-left: 20px; display: flex; flex-direction: column; gap: 9px; font-size: 14px; color: var(--ink-dim); }
.howto-list b { color: var(--ink); }
.pro-list { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--ink-dim); }
.pro-list li::before { content: "✓ "; color: var(--good); font-weight: 900; }
.pro-price { margin-top: 14px; font-family: var(--font-display); font-weight: 900; font-size: 20px; color: var(--gold); }
.modal p { font-size: 14px; color: var(--ink-dim); line-height: 1.5; }

.ad-label { font-size: 10px; letter-spacing: 0.2em; color: var(--ink-faint); font-weight: 800; }
.ad-fake { margin-top: 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.ad-fake-inner { height: 220px; display: grid; place-items: center; text-align: center; padding: 16px; font-size: 14px; color: var(--ink-dim); }

.name-input {
  width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 16px; font-weight: 700; outline: none;
}
.name-input:focus { border-color: var(--brand-b); }

/* house ad inside banner slot */
.house-ad {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer;
  background: linear-gradient(100deg, rgba(255, 95, 31, .12), rgba(123, 45, 255, .12));
}
.house-ad .he { font-size: 24px; }
.house-ad b { display: block; font-size: 13px; }
.house-ad span { font-size: 11px; color: var(--ink-dim); }
.house-ad .ad-tag { margin-left: auto; font-size: 9px; color: var(--ink-faint); letter-spacing: .15em; font-weight: 800; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; z-index: 80; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 999px; background: rgba(20, 27, 45, 0.95);
  border: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 700;
  animation: toast-in .25s ease both; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  max-width: 88vw; text-align: center;
}
.toast.out { animation: toast-out .3s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- confetti ---------- */
.confetti-canvas { position: fixed; inset: 0; z-index: 70; pointer-events: none; }

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .player-grid, .pack-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 58px; }
}
@media (max-width: 360px) {
  .player-grid { grid-template-columns: 1fr; }
  .pcard-name { font-size: 13px; }
  .crowd-line { grid-template-columns: 96px 1fr 36px; }
}

/* reduce motion — also pin iteration-count so infinite animations (lock-pulse)
   don't restart 1000x/sec and strobe */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
