:root {
  --bg: #06080c;
  --bg-2: #0b0f16;
  --card: #10151e;
  --card-2: #161d29;
  --line: #222b3a;
  --text: #f2f5fa;
  --muted: #8a95a8;
  --neon: #3dff8f;
  --neon-dim: #1f8f52;
  --gold: #ffcf33;
  --hot: #ff3d6b;
  --ice: #4fc3ff;
  --purple: #b26bff;
  --radius: 16px;
  --display: "Anton", "Impact", "Arial Narrow Bold", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(61, 255, 143, 0.12), transparent 70%),
    radial-gradient(800px 400px at 110% 30%, rgba(178, 107, 255, 0.08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 540px; margin: 0 auto; padding: 0 14px; }

/* ---------- ticker ---------- */
.ticker {
  background: var(--neon);
  color: #04130a;
  font-family: var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  padding: 6px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 0 30px rgba(61, 255, 143, 0.45);
}
.ticker__track { display: inline-block; animation: ticker 60s linear infinite; }
.ticker__track span { margin-right: 42px; }
@keyframes ticker { to { transform: translateX(-50%); } } /* content is doubled, so -50% loops seamlessly */

/* ---------- header ---------- */
.masthead { padding: 22px 0 10px; text-align: center; }
.logo {
  font-family: var(--display);
  font-size: clamp(44px, 14vw, 68px);
  line-height: 0.9;
  margin: 0;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff 0%, #b9ffd6 45%, var(--neon) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(61, 255, 143, 0.5));
  transform: skew(-6deg);
}
.logo small { display: block; font-size: 0.32em; letter-spacing: 0.3em; color: var(--gold); -webkit-text-fill-color: var(--gold); filter: none; }
.tagline { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; margin: 0 0 14px; }
.tab {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
}
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- bet card ---------- */
.bet {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 18px;
  overflow: hidden;
  position: relative;
}
.bet--fresh { border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon), 0 0 34px rgba(61, 255, 143, 0.28); }
.bet__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 0; flex-wrap: wrap; }
.badge {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px 2px;
  border-radius: 6px;
  background: var(--purple);
  color: #fff;
}
.badge--sgp { background: linear-gradient(90deg, var(--hot), var(--purple)); }
.badge--single { background: var(--ice); color: #021320; }
.badge--new { background: var(--gold); color: #1d1400; animation: pulse 1.4s ease-in-out infinite; }
.chip {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip--live { color: var(--hot); border-color: rgba(255, 61, 107, 0.5); }
.chip--live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--hot); animation: pulse 1s infinite; }
.chip--won { color: #04130a; background: var(--neon); border-color: var(--neon); }
.chip--lost { color: #fff; background: var(--hot); border-color: var(--hot); }
.chip--push, .chip--void { color: #1d1400; background: var(--gold); border-color: var(--gold); }
@keyframes pulse { 50% { opacity: 0.35; } }

.bet__title {
  font-family: var(--display);
  text-transform: uppercase;
  font-size: 26px;
  line-height: 1.05;
  margin: 10px 14px 0;
  letter-spacing: 0.01em;
}
.bet__take { margin: 8px 14px 0; color: #cfd6e2; font-style: italic; font-size: 14px; }
.bet__take::before { content: "“"; color: var(--neon); font-weight: 900; }
.bet__take::after { content: "” — Gavyn"; color: var(--muted); font-style: normal; font-size: 12px; }

.legs { list-style: none; margin: 12px 0 0; padding: 0; }
.leg {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 4px 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  position: relative;
}
.legs--multi .leg:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 32px;
  bottom: -12px;
  width: 2px;
  background: var(--line);
}
.leg__dot {
  width: 18px; height: 18px; margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 900;
  background: var(--card);
  position: relative; z-index: 1;
}
.leg--won .leg__dot { background: var(--neon); border-color: var(--neon); color: #04130a; }
.leg--lost .leg__dot { background: var(--hot); border-color: var(--hot); color: #fff; }
.leg--push .leg__dot { background: var(--gold); border-color: var(--gold); color: #1d1400; }
.leg--winning .leg__dot { border-color: var(--neon); box-shadow: 0 0 10px var(--neon); }
.leg--losing .leg__dot { border-color: var(--hot); }
.leg__pick { font-weight: 800; font-size: 16px; line-height: 1.2; }
.leg__odds { font-family: var(--display); font-size: 18px; text-align: right; letter-spacing: 0.02em; }
.leg__meta { grid-column: 2 / 4; color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.leg__market { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: #aab4c6; }
.leg__live { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: #c4ccda;
}
.pill--up { color: var(--neon); border-color: rgba(61, 255, 143, 0.35); }
.pill--down { color: var(--hot); border-color: rgba(255, 61, 107, 0.35); }
.pill--score { color: var(--text); }
.pill--winning { color: var(--neon); }
.pill--losing { color: var(--hot); }

.bet__total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-top: 1px dashed var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.bet__total-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.bet__total-odds {
  font-family: var(--display);
  font-size: 44px;
  line-height: 0.95;
  color: var(--neon);
  text-shadow: 0 0 22px rgba(61, 255, 143, 0.45);
}
.bet__now { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bet__payout { text-align: right; }
.bet__payout-num { font-family: var(--display); font-size: 26px; color: var(--gold); line-height: 1; }
.bet__quote-note { margin: 0; padding: 0 14px 12px; background: rgba(0, 0, 0, 0.18); color: var(--muted); font-size: 12px; }

.stakes { display: flex; gap: 6px; padding: 0 14px 12px; background: rgba(0, 0, 0, 0.18); overflow-x: auto; }
.stake {
  flex: 1 0 auto;
  min-width: 52px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.stake[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }

.bet__actions { display: grid; gap: 8px; padding: 12px 14px 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font-weight: 900;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn--tail { background: var(--neon); color: #04130a; box-shadow: 0 6px 24px rgba(61, 255, 143, 0.35); }
.btn--ghost { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); }
.btn--gold { background: var(--gold); color: #1d1400; }
.btn--danger { background: transparent; border: 1px solid var(--hot); color: var(--hot); }
.btn--small { padding: 8px 12px; font-size: 12px; border-radius: 10px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.bet__foot { padding: 0 14px 12px; color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; }

/* ---------- other books ---------- */
.books { border-top: 1px solid var(--line); padding: 6px 14px 14px; display: none; }
.books[data-open="true"] { display: block; }
.books__leg { margin-top: 12px; }
.books__leg-title { font-weight: 800; font-size: 13px; margin-bottom: 6px; }
.books__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-2);
  margin-bottom: 4px;
  text-decoration: none;
  font-size: 14px;
}
.books__row--best { outline: 1px solid var(--gold); }
.books__row--best .books__price { color: var(--gold); }
.books__price { font-family: var(--display); font-size: 17px; }
.books__go { color: var(--muted); font-size: 12px; }
.books__note { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ---------- misc ---------- */
.stamp {
  position: absolute;
  top: 46px;
  right: 12px;
  font-family: var(--display);
  font-size: 34px;
  padding: 2px 12px;
  border: 4px solid currentColor;
  border-radius: 8px;
  transform: rotate(-12deg);
  opacity: 0.9;
  pointer-events: none;
  letter-spacing: 0.04em;
  mix-blend-mode: screen;
}
.stamp--won { color: var(--neon); }
.stamp--lost { color: var(--hot); }
.stamp--push, .stamp--void { color: var(--gold); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty__big { font-size: 54px; }
.updated { text-align: center; font-size: 11px; color: var(--muted); margin: 0 0 12px; }

.fine {
  color: #5c677a;
  font-size: 11px;
  text-align: center;
  padding: 24px 10px 40px;
  line-height: 1.6;
}

/* ---------- admin ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 16px;
}
.panel h2 { font-family: var(--display); text-transform: uppercase; font-size: 22px; margin: 0 0 4px; letter-spacing: 0.02em; }
.panel .hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 16px; /* stops iOS zooming in */
  outline: none;
}
.input:focus { border-color: var(--neon); }
textarea.input { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.row > .btn { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

.drop {
  display: grid;
  place-items: center;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 22px 14px;
  cursor: pointer;
  color: var(--muted);
}
.drop:hover, .drop:focus-within { border-color: var(--neon); color: var(--text); }
.drop strong { color: var(--text); display: block; font-size: 16px; margin-top: 4px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop img { max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 10px; }

.leg-edit {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 10px;
}
.leg-edit__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 800; }
details.adv summary { cursor: pointer; color: var(--muted); font-size: 12px; margin: 2px 0 8px; }

.status-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.status-row .btn { flex: 1 1 0; min-width: 0; padding-left: 4px; padding-right: 4px; }
.status-row .btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120px);
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 999px;
  transition: transform 0.25s ease;
  z-index: 50;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast[data-show="true"] { transform: translateX(-50%) translateY(0); }
.spinner { width: 16px; height: 16px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .ticker__track, .badge--new, .chip--live::before { animation: none; }
}

/* ---------- the Gavyn Index ---------- */
.gi {
  --tier: var(--neon);
  margin: 14px 0 18px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--tier) 55%, var(--line));
  background:
    radial-gradient(500px 160px at 0% 0%, color-mix(in srgb, var(--tier) 18%, transparent), transparent 70%),
    var(--card);
  padding: 14px;
  box-shadow: 0 0 36px color-mix(in srgb, var(--tier) 18%, transparent);
}
.gi--blender { --tier: var(--hot); }
.gi--cautious { --tier: #ff9a3d; }
.gi--funmoney { --tier: var(--gold); }
.gi--printer { --tier: var(--neon); }
.gi--none { --tier: var(--ice); }
.gi__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.gi__title { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.gi__tier {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tier);
}
.gi__msg {
  font-family: var(--display);
  font-size: clamp(22px, 6.4vw, 28px);
  line-height: 1.1;
  margin: 10px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.gi__meter {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gi__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--tier);
  box-shadow: 0 0 12px var(--tier);
}
.gi__tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, 0.18); }
.gi__sub { color: var(--muted); font-size: 12px; margin: 6px 0 12px; }
.gi__boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gi__box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.gi__box-label { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.gi__rate { font-family: var(--display); font-size: 34px; line-height: 1.05; color: var(--tier); }
.gi__box:last-child .gi__rate { color: var(--text); }
.gi__detail { font-size: 13px; font-weight: 700; color: #c4ccda; }
.gi__up { color: var(--neon); }
.gi__down { color: var(--hot); }
.gi__foot { color: #5c677a; font-size: 11px; margin: 10px 0 0; }

.scan-status { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; }
.scan-status > .spinner { flex: 0 0 16px; width: 16px; height: 16px; box-sizing: border-box; }

/* Phone layouts: compact iPhones through the larger Plus / Max screens. */
body { min-height: 100svh; }
.wrap {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
body > .wrap { padding-top: env(safe-area-inset-top); }
.ticker { padding-top: calc(6px + env(safe-area-inset-top)); }
.logo { font-size: clamp(44px, 12.5vw, 64px); line-height: 1.02; }
.logo > span { display: block; }
.logo small { margin-top: 6px; line-height: 1.3; letter-spacing: 0.2em; }
.tab, .stake, .btn, .books__row, details.adv summary { min-height: 44px; }
.tab, .stake, .btn { touch-action: manipulation; }
details.adv summary { padding: 10px 0; }
.leg { grid-template-columns: 22px minmax(0, 1fr) auto; }
.leg__pick, .leg__meta, .bet__title, .bet__take, .books__leg-title,
.books__row > :first-child, .gi__msg, .gi__detail { overflow-wrap: anywhere; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid2 > *, .gi__box, .bet__total > * { min-width: 0; }
.bet__foot { flex-wrap: wrap; gap: 6px 12px; }
.status-row .btn { flex-basis: 72px; }
.stakes { flex-wrap: wrap; overflow: visible; }
.stake { flex: 1 1 52px; }
.fine, .gi__foot { color: #8a95a8; }
.btn:focus-visible, .tab:focus-visible, .stake:focus-visible,
.books__row:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; }

@media (max-width: 375px) {
  .wrap { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .masthead { padding-top: 18px; }
  .gi { padding: 12px; margin-top: 12px; }
  .gi__msg { font-size: 22px; }
  .gi__box { padding: 10px 8px; }
  .gi__rate { font-size: 30px; }
  .panel { padding: 12px; }
  .leg { gap: 4px 8px; padding: 12px; }
  .leg__pick { font-size: 15px; }
  .bet__total { gap: 8px; padding: 12px; flex-wrap: wrap; }
  .bet__total-odds { font-size: 38px; }
  .bet__payout { margin-left: auto; }
  .books__row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; padding: 8px; }
  .empty { padding: 32px 12px; }
}

@media (min-width: 414px) and (max-width: 600px) {
  .wrap { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .masthead { padding-top: 26px; padding-bottom: 14px; }
  .gi { padding: 18px; }
  .leg { padding: 14px 16px; }
  .bet__actions { padding: 14px 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .logo { filter: none; }
  .toast { transition: none; }
}

/* Expand automatically when the Duo is unfolded, without reloading the page. */
@media (min-width: 600px) {
  .feed-page .wrap { max-width: 960px; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  .feed-page .masthead { padding: 28px 0 16px; }
  .feed-page .logo { font-size: 64px; }
  .feed-page .logo > span { display: inline; }
  .feed-page .logo > span + span::before { content: " "; }
  .feed-page .gi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr); column-gap: 24px; }
  .feed-page .gi__top, .feed-page .gi__foot { grid-column: 1 / -1; }
  .feed-page .gi__msg { grid-column: 1; }
  .feed-page .gi__meter, .feed-page .gi__sub { grid-column: 1; }
  .feed-page .gi__boxes { grid-column: 2; grid-row: 2 / 5; align-self: center; }
  .feed-page .gi--none { display: block; }
  .feed-page #feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 18px; }
  .feed-page #feed > .bet { margin-bottom: 0; }
  .feed-page #feed > .empty { grid-column: 1 / -1; }
}
