/* ============================================================
   Parky's Bet Hub — Workshop theme
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@900&family=Inter:wght@400;600;700&display=swap");

/* ---------- Theme tokens ---------- */
:root,
[data-theme="dark"] {
  --bg: #050505;
  --bg-2: #08080a;
  --surface: #0a0a0c;
  --surface-2: #101013;
  --surface-3: #17171c;
  --hover: #15151a;
  --border: rgba(255,255,255,.075);
  --border-2: rgba(255,255,255,.16);
  --text: #f7f7f8;
  --text-2: #a1a1aa;
  --text-3: #62626d;
  --brand: #a855f7;
  --brand-2: #3b82f6;
  --brand-ink: #ffffff;
  --brand-soft: rgba(168,85,247,.12);
  --brand-ring: rgba(168,85,247,.30);
  --good: #22c55e;
  --good-bg: rgba(34,197,94,.12);
  --bad: #ff6b78;
  --bad-bg: rgba(255,107,120,.13);
  --amber: #ffb454;
  --amber-bg: rgba(255,180,84,.14);
  --violet: #9a8bff;
  --shadow: 0 28px 80px rgba(0,0,0,.65);
  --shadow-sm: 0 12px 34px rgba(0,0,0,.38);
  --r-xs: 9px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --grad-brand: linear-gradient(135deg, #a855f7, #3b82f6);
  --grad-hero: linear-gradient(150deg, rgba(168,85,247,.17), rgba(59,130,246,.06) 60%, transparent);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1000px 560px at 82% -8%, rgba(59,130,246,.11), transparent 60%),
    radial-gradient(900px 520px at -6% 8%, rgba(168,85,247,.09), transparent 55%);
  pointer-events: none; z-index: 0;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, select { width: 100%; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
::selection { background: var(--brand-ring); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 20px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- Icons ---------- */
i[data-icon] { display: inline-flex; width: 1.1em; height: 1.1em; }
i[data-icon] svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Kicker / headings ---------- */
.kicker { font-size: .64rem; letter-spacing: .2em; font-weight: 900; color: var(--brand); margin-bottom: 8px; text-transform: uppercase; }
h1, h2, h3 { font-family: "Montserrat", sans-serif; font-weight: 900; text-transform: uppercase; }
h1 { font-size: clamp(1.65rem, 3.2vw, 2.25rem); letter-spacing: .055em; line-height: 1.12; }
h2 { font-size: 1.05rem; letter-spacing: .055em; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--r-sm); padding: 11px 17px; font-weight: 800; font-size: .84rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .16s cubic-bezier(.2,.8,.3,1), box-shadow .18s, background .18s, border-color .18s, opacity .18s;
  border: 1px solid transparent; white-space: nowrap; letter-spacing: .035em;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn.brand-btn { background: var(--grad-brand); color: var(--brand-ink); box-shadow: 0 10px 30px -8px rgba(99,102,241,.62); }
.btn.brand-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -8px rgba(99,102,241,.65); }
.btn.ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--hover); border-color: var(--border-2); transform: translateY(-1px); }
.btn.betfair { background: linear-gradient(135deg,#ffb200,#ff8a00); color: #241500; box-shadow: 0 10px 26px -8px rgba(255,160,0,.5); }
.btn.betfair:hover { transform: translateY(-1px); }
.btn.danger-btn { background: var(--bad-bg); color: var(--bad); border-color: rgba(255,107,120,.3); }
.btn.danger-btn:hover { background: rgba(255,107,120,.2); }
.btn.full { width: 100%; }
.btn.compact { padding: 9px 14px; font-size: .88rem; }
.btn.tiny { padding: 6px 12px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .plus { font-size: 1.15em; line-height: 0; margin-top: -1px; }
.link-btn { color: var(--brand); font-weight: 700; font-size: .88rem; padding: 4px 2px; transition: opacity .15s; }
.link-btn:hover { opacity: .75; }
.danger-text { color: var(--bad); }

/* ---------- Fields ---------- */
.field { display: grid; gap: 7px; text-align: left; }
.field > span { font-size: .84rem; font-weight: 650; color: var(--text-2); }
.field small { font-weight: 500; color: var(--text-3); }
input, select {
  background: #0d0d10; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 12px 13px; color: var(--text); outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder { color: var(--text-3); }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2395a7bd' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.money, .pct { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; transition: border-color .16s, box-shadow .16s; }
.money:focus-within, .pct:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.money b, .pct b { color: var(--text-3); font-weight: 700; padding: 0 0 0 13px; }
.pct b { padding: 0 13px 0 0; }
.money input, .pct input { border: 0; background: transparent; box-shadow: none !important; }
.field.compact { max-width: 240px; }

/* ---------- Segmented control ---------- */
.seg {
  display: inline-flex; background: #0d0d10; border: 1px solid var(--border);
  border-radius: 13px; padding: 4px; gap: 3px;
}
.seg button {
  padding: 9px 16px; border-radius: 9px; font-weight: 650; font-size: .88rem; color: var(--text-2);
  transition: color .18s; position: relative; z-index: 1;
}
.seg button.active { color: #fff; background: var(--grad-brand); box-shadow: 0 8px 24px -10px var(--brand-ring); }
.seg.mini button { padding: 8px 13px; font-size: .84rem; }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border); border-radius: 99px; transition: background .2s, border-color .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 2px; width: 21px; height: 21px; border-radius: 50%; background: var(--text-2); transition: transform .22s cubic-bezier(.2,.8,.3,1), background .2s; }
.switch input:checked + i { background: var(--grad-brand); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(19px); background: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 4px; }
.switch-row span:first-child { display: grid; }
.switch-row b { font-weight: 650; }
.switch-row small { color: var(--text-3); font-size: .8rem; }

/* ============================================================
   LOCK SCREEN
   ============================================================ */
.lock {
  position: fixed; inset: 0; z-index: 100;
  display: block; padding: 24px;
  background: #050505;
  overflow-x: hidden;
  overflow-y: auto;
}
.lock-aurora span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5;
  animation: float 14s ease-in-out infinite;
}
.lock-aurora span:nth-child(1) { width: 420px; height: 420px; background: #a855f7; top: -180px; right: -80px; opacity: .24; }
.lock-aurora span:nth-child(2) { width: 400px; height: 400px; background: #3b82f6; bottom: -190px; left: -100px; opacity: .22; animation-delay: -5s; }
.lock-aurora span:nth-child(3) { width: 300px; height: 300px; background: #22c55e; top: 38%; left: 55%; opacity: .09; animation-delay: -9s; }
@keyframes float { 0%,100%{ transform: translate(0,0) scale(1); } 33%{ transform: translate(30px,-24px) scale(1.06); } 66%{ transform: translate(-20px,18px) scale(.96); } }

.lock-inner { position: relative; z-index: 1; width: min(500px, 100%); min-height: 100%; margin: 0 auto; padding: 34px 0; display: flex; flex-direction: column; justify-content: flex-start; text-align: center; }
.lock-brand { display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 30px; }
.lock-stage { animation: rise .5s cubic-bezier(.2,.8,.3,1) both; }
.lock-kicker { font-size: .64rem; letter-spacing: .24em; font-weight: 900; color: var(--brand); margin-bottom: 13px; }
.lock-title { font-size: clamp(1.75rem, 7vw, 2.35rem); letter-spacing: .035em; line-height: 1.2; }
.title-gradient { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lock-sub { color: var(--text-2); line-height: 1.65; margin: 12px auto 0; max-width: 430px; }
.lock-foot { color: var(--text-3); font-size: .82rem; margin-top: 26px; }
.lock-back { position: absolute; margin-top: -6px; color: var(--text-2); font-weight: 650; font-size: .9rem; left: 0; }
.lock-back:hover { color: var(--text); }

.profile-choices { display: grid; gap: 12px; margin-top: 28px; max-height: 330px; overflow-y: auto; padding: 2px; }
.profile-choice {
  display: flex; align-items: center; gap: 15px; padding: 15px 17px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  text-align: left; transition: transform .16s, border-color .18s, box-shadow .18s;
  animation: rise .5s cubic-bezier(.2,.8,.3,1) both;
}
.profile-choice:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 14px 34px -12px var(--brand-ring); }
.profile-choice .who { display: grid; flex: 1; }
.profile-choice .who b { font-size: 1.05rem; font-weight: 750; }
.profile-choice .who small { color: var(--text-3); font-size: .8rem; }
.profile-choice .lock-state { font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.lock-state.set { background: var(--good-bg); color: var(--good); }
.lock-state.new { background: var(--brand-soft); color: var(--brand); }
.profile-choice .go { color: var(--text-3); font-size: 1.3rem; transition: transform .18s, color .18s; }
.profile-choice:hover .go { color: var(--brand); transform: translateX(3px); }
.profiles-empty { display: grid; gap: 6px; padding: 24px; border: 1px dashed var(--border-2); border-radius: var(--r-lg); background: rgba(10,10,12,.7); }
.profiles-empty b { font-family: "Montserrat", sans-serif; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; }
.profiles-empty span { color: var(--text-3); font-size: .82rem; }
@media (min-height: 900px) {
  .lock-inner { justify-content: center; }
}

.unlock-head { display: flex; align-items: center; gap: 15px; justify-content: center; margin: 24px 0 20px; }
.unlock-head .lock-title { font-size: 1.5rem; text-align: left; }
.unlock-head .lock-sub { text-align: left; margin-top: 3px; }
.lock-method { margin: 0 auto 20px; }

/* PIN */
.pin-wrap { display: grid; justify-items: center; gap: 18px; }
.pin-dots { display: flex; gap: 14px; height: 20px; align-items: center; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-2); transition: transform .18s, background .18s, border-color .18s; }
.pin-dots i.on { background: var(--grad-brand); border-color: transparent; transform: scale(1.18); box-shadow: 0 0 14px var(--brand-ring); }
.pin-wrap.shake { animation: shake .4s; }
.pin-error, .pin-error { min-height: 18px; color: var(--bad); font-size: .84rem; font-weight: 600; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 74px); gap: 14px; justify-content: center; }
.pin-key {
  height: 74px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border);
  font-size: 1.5rem; font-weight: 600; color: var(--text);
  transition: transform .12s, background .18s, border-color .18s;
}
.pin-key:hover { background: var(--hover); border-color: var(--border-2); }
.pin-key:active { transform: scale(.92); background: var(--brand-soft); border-color: var(--brand); }
.pin-key.ghost { background: transparent; border-color: transparent; font-size: 1rem; font-weight: 700; color: var(--text-2); }
.pin-key.ghost:active { background: var(--surface-2); }
.pin-submit { width: 242px; margin-top: 2px; }

/* Pattern */
.pattern-wrap { display: grid; justify-items: center; gap: 12px; }
.pattern-grid { width: 260px; height: 260px; touch-action: none; }
.pattern-grid .pl-line { stroke: var(--brand); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .85; filter: drop-shadow(0 0 6px var(--brand-ring)); }
.pattern-grid .pl-node-hit { fill: transparent; }
.pattern-grid .pl-node { fill: var(--surface-3); stroke: var(--border-2); stroke-width: 2; transition: fill .15s, r .15s; }
.pattern-grid .pl-node.on { fill: var(--brand); stroke: var(--brand); }
.pattern-grid .pl-node.core { fill: var(--brand); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { position: relative; z-index: 1; min-height: 100vh; padding-bottom: 90px; }
@media (min-width: 860px) { .app { padding-bottom: 0; } }

.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(20px) saturate(1.4); border-bottom: 1px solid var(--border); }
@supports not (background: color-mix(in srgb, red, blue)) { .topbar { background: var(--bg-2); } }
.topbar-inner { max-width: 1280px; margin: auto; height: 70px; padding: 0 22px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; padding: 8px 2px; }
.nexus-word { font-family: "Inter", system-ui, sans-serif; font-weight: 700; font-size: 1.08rem; letter-spacing: -.025em; text-transform: none; }
.topnav { display: none; gap: 2px; margin-right: auto; margin-left: 12px; }
@media (min-width: 860px) { .topnav { display: flex; } }
.navlink { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; color: var(--text-2); font-weight: 700; font-size: .84rem; transition: color .18s, background .18s; }
.navlink i { font-size: 1.05rem; opacity: .85; }
.navlink:hover { color: var(--text); background: var(--surface-2); }
.navlink.active { color: #fff; background: linear-gradient(135deg, rgba(168,85,247,.2), rgba(59,130,246,.14)); border: 1px solid rgba(168,85,247,.22); }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
@media (max-width: 859px) { .topbar-actions { margin-left: auto; } }

.profile-menu { position: relative; }
.profile-greeting { display: inline-flex; align-items: center; gap: 7px; padding: 9px 2px 9px 10px; color: var(--text-2); font-size: .9rem; transition: color .18s; }
.profile-greeting b { color: var(--text); font-weight: 700; }
.profile-greeting:hover, .profile-greeting[aria-expanded="true"] { color: var(--brand); }
.chev { color: var(--text-3); font-size: .9rem; }
.avatar { width: 36px; height: 36px; border-radius: 11px; display: inline-grid; place-items: center; font-weight: 800; font-size: .9rem; color: #04222b; background: var(--grad-brand); flex: 0 0 auto; }
.avatar.lg { width: 54px; height: 54px; border-radius: 16px; font-size: 1.3rem; }
.avatar.p2 { background: linear-gradient(135deg,#9a8bff,#5b7cff); color: #120a2e; }
.avatar.p3 { background: linear-gradient(135deg,#ffb454,#ff7a59); color: #2a1400; }

.popover { position: absolute; top: calc(100% + 10px); right: 0; width: 232px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; z-index: 60; animation: pop .18s cubic-bezier(.2,.8,.3,1) both; }
.popover-label { font-size: .68rem; letter-spacing: .12em; color: var(--text-3); font-weight: 700; padding: 8px 10px 2px; }
.popover-name { padding: 0 10px 8px; font-weight: 750; }
.popover-div { height: 1px; background: var(--border); margin: 4px 0; }
.popover-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: .9rem; transition: background .15s; }
.popover-item:hover { background: var(--surface-2); }
.popover-item i { color: var(--text-2); }

/* ---------- Page shell ---------- */
.shell { max-width: 1280px; margin: auto; padding: 38px 22px 52px; }
.page { display: none; }
.page.active { display: block; animation: pageIn .45s cubic-bezier(.2,.8,.3,1) both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: rgba(10,10,12,.94); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; top: 0; left: 20%; right: 20%; height: 2px; border-radius: 0 0 99px 99px; background: linear-gradient(90deg, transparent, var(--brand), var(--brand-2), transparent); opacity: .45; }
.card > * { position: relative; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-head.compact { margin-bottom: 12px; }

/* ---------- Stat cards ---------- */
.stat-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .stat-row { grid-template-columns: 1fr 1fr; } .stat.hero { grid-column: 1 / -1; } }
@media (max-width: 520px) { .stat-row { grid-template-columns: 1fr; } }
.stat { background: rgba(10,10,12,.94); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; animation: rise .5s cubic-bezier(.2,.8,.3,1) both; transition: transform .22s, border-color .22s, box-shadow .22s; }
.stat:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: 0 20px 42px -24px var(--brand-ring); }
.stat:nth-child(2){ animation-delay: .05s; } .stat:nth-child(3){ animation-delay: .1s; } .stat:nth-child(4){ animation-delay: .15s; }
.stat > span { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.stat-num { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-num.sm { font-size: 1.45rem; }
.stat-sub { display: block; font-size: .8rem; color: var(--text-3); margin-top: 4px; }
.stat.hero { background: linear-gradient(160deg, #111017, #0a0a0c); }
.stat.hero::before { content: ""; position: absolute; inset: 0; background: var(--grad-hero); pointer-events: none; }
.stat.hero > * { position: relative; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-top span:first-child { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.stat-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px; font-size: 1rem; }
.stat-ico.good { background: var(--good-bg); color: var(--good); }
.stat-ico.blue { background: var(--brand-soft); color: var(--brand); }
.stat-ico.amber { background: var(--amber-bg); color: var(--amber); }
.pnl-badge { font-size: .74rem; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.pnl-badge.pos { background: var(--good-bg); color: var(--good); }
.pnl-badge.neg { background: var(--bad-bg); color: var(--bad); }
.pos { color: var(--good); } .neg { color: var(--bad); }
.spark { position: absolute; right: 0; bottom: 0; left: 0; height: 40px; opacity: .5; }

/* ---------- Home grid ---------- */
.home-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
.side { display: grid; gap: 16px; align-content: start; }

.activity { display: grid; gap: 8px; }
.activity-item { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 12px; border-radius: var(--r); transition: background .16s; }
.activity-item:hover { background: var(--surface-2); }
.book-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 800; font-size: .78rem; color: var(--text-2); letter-spacing: .02em; }
.activity-main { display: grid; gap: 2px; min-width: 0; }
.activity-main strong { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-main span { font-size: .8rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-right { text-align: right; display: grid; gap: 2px; }
.activity-right strong { font-weight: 750; font-variant-numeric: tabular-nums; }
.activity-right small { font-size: .74rem; color: var(--text-3); }
.tag-open { color: var(--amber); }

.group-list { display: grid; gap: 6px; }
.group-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r); transition: background .15s; }
.group-row:hover { background: var(--surface-2); }
.group-row .who { flex: 1; display: grid; }
.group-row .who b { font-weight: 650; font-size: .95rem; }
.group-row .who small { color: var(--text-3); font-size: .78rem; }
.group-row .amt { font-weight: 750; font-variant-numeric: tabular-nums; }
.tool-card h2 { margin-bottom: 6px; }
.tool-card .btn { margin-top: 14px; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 40px 20px; display: grid; justify-items: center; gap: 6px; }
.empty.small { padding: 24px; }
.empty-ico { width: 58px; height: 58px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 1.5rem; color: var(--text-3); margin-bottom: 6px; }
.empty h3 { font-weight: 750; }
.empty p { color: var(--text-2); font-size: .9rem; max-width: 340px; }
.empty .btn { margin-top: 10px; }
.recent-card .empty { padding: 30px 10px; }

/* ---------- Gemini Bet Tracker ---------- */
#betsPage { width: 100%; max-width: none; }
#betsPage .page-head { align-items: center; margin-bottom: 24px; }
#betsPage .page-head h1 { margin: 0; font-family: "Inter", sans-serif; font-size: 28px; font-weight: 700; letter-spacing: 0; text-transform: none; }
#betsPage .page-head .kicker { margin-bottom: 4px; color: #a1a1b3; }
.tracker-save-btn { background: #6366f1; color: #fff; padding: 12px 20px; border-radius: 8px; font-weight: 600; transition: background .2s, transform .15s; }
.tracker-save-btn:hover { background: #4f46e5; transform: translateY(-1px); }

.stats-strip { display: flex; background: #15151b; border: 1px solid #2a2a35; border-radius: 12px; margin-bottom: 24px; overflow: hidden; }
.stat-block { flex: 1; min-width: 0; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-right: 1px solid #2a2a35; }
.stat-block:last-child { border-right: 0; }
.stat-left { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 13px; color: #a1a1b3; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.stat-bets { font-size: 13px; color: #8a8a98; font-weight: 500; white-space: nowrap; }
.stat-profit { color: #fff; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-profit.pos { color: #10b981; }
.stat-profit.neg { color: #ef4444; }

.filter-bar { background: #1a1a21; border: 1px solid #2a2a35; border-radius: 12px; padding: 12px; display: flex; gap: 12px; margin-bottom: 24px; }
.filter-bar input, .filter-bar select { background-color: #0f0f13; border: 1px solid #2a2a35; color: #fff; padding: 10px 16px; border-radius: 8px; outline: none; }
.filter-bar input { flex: 1; min-width: 0; }
.filter-bar select { width: auto; min-width: 150px; }
.filter-bar input::placeholder { color: #555566; }
.filter-bar input:focus, .filter-bar select:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }

.bets-list { display: flex; flex-direction: column; gap: 12px; }
.bet-row { background: #15151b; border: 1px solid #2a2a35; border-radius: 12px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; transition: background .2s, border-color .2s, box-shadow .2s, opacity .2s; }
.bet-row:hover { background: #1a1a21; border-color: #6366f1; box-shadow: 0 4px 15px rgba(0,0,0,.4); }
.bet-row.settled { opacity: .6; }
.bet-row.settled:hover { opacity: 1; }
.bet-primary { display: flex; align-items: center; gap: 16px; flex: 2; min-width: 0; }
.bookmaker-mark { --bookie-color: #20202a; position: relative; width: 116px; height: 58px; flex: 0 0 116px; overflow: hidden; display: grid; place-items: center; background: var(--bookie-color); border: 1px solid rgba(255,255,255,.1); border-radius: 9px; box-shadow: 0 5px 14px rgba(0,0,0,.22); }
.bookmaker-mark img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; display: block; }
.bookmaker-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: .04em; }
.bet-info-main { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.bet-match { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; min-width: 0; }
.bet-match > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-sport { flex: 0 0 auto; font-size: 11px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); padding: 4px 8px; border-radius: 6px; font-weight: 600; color: #a1a1b3; text-transform: uppercase; }
.bet-details-sub { font-size: 13px; color: #8a8a98; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bet-details-sub strong { color: #fff; font-weight: 600; }
.bet-financials { display: flex; gap: 32px; flex: 2; justify-content: center; }
.fin-col { display: flex; flex-direction: column; gap: 4px; min-width: 86px; }
.fin-col span { font-size: 12px; color: #8a8a98; font-weight: 500; }
.fin-col strong { font-size: 15px; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-col strong.pos { color: #10b981; }
.fin-col strong.neg { color: #ef4444; }
.bet-actions { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.btn-edit { background: transparent; color: #a1a1b3; border: 1px solid #353541; padding: 9px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: color .2s, background .2s, border-color .2s; }
.btn-edit:hover { color: #fff; background: #24242d; border-color: #4a4a59; }
.btn-settle { background: #2a2a35; color: #fff; border: 1px solid #3a3a45; padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .2s, border-color .2s; }
.btn-settle:hover { background: #6366f1; border-color: #6366f1; }
.status-badge { font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 8px; background: rgba(255,255,255,.05); color: #a1a1b3; border: 1px solid rgba(255,255,255,.1); white-space: nowrap; }
.status-badge.won { color: #10b981; background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.2); }
.status-badge.lost { color: #ef4444; background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.2); }
.bet-pagination { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 20px; }
.bet-pagination button { min-width: 92px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-2); font-weight: 700; }
.bet-pagination button:hover:not(:disabled) { border-color: var(--brand); color: var(--text); }
.bet-pagination button:disabled { opacity: .35; cursor: not-allowed; }
.bet-pagination span { min-width: 110px; text-align: center; color: var(--text-2); font-size: .84rem; font-weight: 650; }
@media (max-width: 900px) {
  .bet-row { flex-wrap: wrap; }
  .bet-primary { flex-basis: 100%; }
  .bet-financials { justify-content: flex-start; }
}
@media (max-width: 768px) {
  .stats-strip { flex-direction: column; }
  .stat-block { border-right: 0; border-bottom: 1px solid #2a2a35; }
  .stat-block:last-child { border-bottom: 0; }
  .bet-row { flex-direction: column; align-items: flex-start; gap: 16px; }
  .bet-primary { width: 100%; }
  .bet-financials { width: 100%; gap: 20px; overflow-x: auto; }
  .bet-actions { width: 100%; }
  .btn-settle { flex: 1; }
  .bet-actions { justify-content: flex-start; }
  .filter-bar { flex-direction: column; }
  .filter-bar select { width: 100%; }
}
@media (max-width: 520px) {
  #betsPage .page-head, .tracker-save-btn { width: 100%; }
  .tracker-save-btn { text-align: center; }
  .stat-block { padding: 18px; }
  .stat-profit { font-size: 21px; }
  .bookmaker-mark { width: 104px; height: 52px; flex-basis: 104px; }
  .bet-financials { display: grid; grid-template-columns: 1fr 1fr; }
  .fin-col:last-child { grid-column: 1 / -1; }
}

/* ---------- Bankroll ---------- */
.bankroll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 20px; }
.acct { background: rgba(10,10,12,.94); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); transition: transform .2s, border-color .2s, box-shadow .2s; animation: rise .45s cubic-bezier(.2,.8,.3,1) both; position: relative; overflow: hidden; }
.acct::before { content: ""; position: absolute; left: 0; top: 20%; bottom: 20%; width: 2px; background: var(--brand); opacity: .7; }
.acct:hover { transform: translateY(-3px); border-color: rgba(168,85,247,.34); box-shadow: 0 18px 40px -24px var(--brand-ring); }
.acct-top { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.acct-badge { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: .82rem; }
.acct-badge.bookmaker { background: var(--brand-soft); color: var(--brand); }
.acct-badge.exchange { background: var(--amber-bg); color: var(--amber); }
.acct-name { display: grid; flex: 1; min-width: 0; }
.acct-name b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-name small { font-size: .74rem; color: var(--text-3); text-transform: capitalize; }
.acct-bal { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.acct-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: .78rem; color: var(--text-3); }
.acct-actions { display: flex; gap: 8px; margin-top: 14px; }
.acct-actions .btn { flex: 1; padding: 8px; font-size: .82rem; }

.ledger-card { margin-top: 4px; }
.ledger { display: grid; gap: 4px; }
.ledger-row { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 11px 8px; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border-bottom: 0; }
.led-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: .95rem; }
.led-ico.in { background: var(--good-bg); color: var(--good); }
.led-ico.out { background: var(--bad-bg); color: var(--bad); }
.led-ico.move { background: var(--brand-soft); color: var(--brand); }
.led-main { display: grid; gap: 1px; min-width: 0; }
.led-main b { font-weight: 650; font-size: .92rem; }
.led-main small { color: var(--text-3); font-size: .78rem; }
.led-amt { font-weight: 750; font-variant-numeric: tabular-nums; }

/* ---------- Calculator ---------- */
.calc-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(100%, 760px); margin: 0 auto 26px; padding: 6px; gap: 5px; overflow: visible; background: #15151b; border-color: #2a2a35; border-radius: 16px; box-shadow: 0 14px 34px rgba(0,0,0,.2); }
.calc-seg button { min-height: 48px; padding: 11px 16px; display: grid; place-items: center; white-space: normal; line-height: 1.2; border-radius: 11px; color: #8f98a8; }
.calc-seg button:hover { color: #fff; background: rgba(255,255,255,.04); }
.calc-seg button.active { color: #fff; background: linear-gradient(135deg, #6366f1, #7c3aed); box-shadow: 0 8px 22px rgba(99,102,241,.24); }
@media (max-width: 560px) {
  .calc-seg { padding: 5px; gap: 3px; }
  .calc-seg button { min-height: 52px; padding: 9px 6px; font-size: .75rem; }
}
.calc-card { display: none; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.calc-card.active { display: grid; animation: pageIn .35s cubic-bezier(.2,.8,.3,1) both; }
@media (max-width: 820px) { .calc-card.active { grid-template-columns: 1fr; } }
.calc-inputs { background: rgba(10,10,12,.94); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.calc-note { margin-bottom: 16px; }
.calc-note h2 { margin: 4px 0; }

.calc-result { background: #101015; border: 1px solid #292933; border-radius: 18px; padding: 26px; box-shadow: 0 24px 60px rgba(0,0,0,.28); position: relative; overflow: hidden; align-self: start; }
.calc-result::before { content: ""; position: absolute; inset: 0; background: var(--grad-hero); pointer-events: none; }
.calc-result > * { position: relative; }
.result-kicker { font-size: .68rem; letter-spacing: .16em; font-weight: 800; color: var(--brand); margin-bottom: 12px; }
.big-result { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #0b0b0f; border: 1px solid #2a2a35; border-radius: 12px; padding: 19px 20px; text-align: left; transition: transform .14s, border-color .18s, box-shadow .18s; }
.big-result span { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.big-result strong { font-family: "Montserrat", sans-serif; font-size: 2.1rem; font-weight: 900; letter-spacing: .01em; font-variant-numeric: tabular-nums; margin-left: auto; }
.big-result .copy-ico { color: var(--text-3); font-size: 1.1rem; }
.big-result.copy:hover { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.big-result.copy:active { transform: scale(.99); }
.big-result.copied { border-color: var(--good); }
.big-result.copied .copy-ico { color: var(--good); }
.result-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.rp { display: grid; gap: 5px; padding: 14px 16px; background: #15151b; border: 1px solid #2a2a35; border-radius: 11px; text-align: left; }
.rp span { font-size: .74rem; color: var(--text-3); font-weight: 600; }
.rp strong { font-weight: 750; font-variant-numeric: tabular-nums; }
.rp.copy { cursor: pointer; transition: border-color .16s; }
.rp.copy:hover { border-color: var(--brand); }
.rp.copied { border-color: var(--good); }
.rating { color: var(--brand); }
.profit-line { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--good-bg); border-radius: var(--r-sm); margin-bottom: 14px; }
.profit-line span { font-weight: 650; color: var(--text-2); }
.profit-line strong { font-size: 1.25rem; font-weight: 800; color: var(--good); font-variant-numeric: tabular-nums; }
.profit-line.neg { background: var(--bad-bg); } .profit-line.neg strong { color: var(--bad); }
.profit-line.waiting { background: var(--surface-2); }
.profit-line.waiting strong { color: var(--text-3); }

/* Quick lay */
.quicklay { margin-top: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.quicklay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.quicklay-head strong { font-weight: 750; }
.pill { font-size: .72rem; font-weight: 700; padding: 5px 11px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.pill.connected { background: var(--good-bg); color: var(--good); }
.dfield { display: grid; gap: 7px; margin-bottom: 10px; }
.dfield span { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.market-summary { padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-sm); margin: 10px 0; display: grid; gap: 3px; }
.market-summary strong { font-weight: 700; }
.market-summary span { font-size: .82rem; color: var(--text-2); }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } }
.set-card { display: grid; gap: 12px; align-content: start; }
.set-card.wide { grid-column: 1 / -1; }
.set-card h2 { margin-bottom: 2px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bf-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.notice { display: grid; gap: 3px; padding: 13px 15px; background: var(--amber-bg); border: 1px solid rgba(255,180,84,.25); border-radius: var(--r-sm); }
.notice b { font-size: .84rem; color: var(--amber); }
.notice span { font-size: .82rem; color: var(--text-2); }
.bf-panel { display: grid; gap: 14px; }
.bf-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .84rem; }
.set-card.danger { border-color: rgba(255,107,120,.25); }

/* ============================================================
   Home + Settings — Bet Tracker visual system
   ============================================================ */
#homePage,
#settingsPage { width: 100%; max-width: none; }

#homePage .page-head,
#settingsPage .page-head {
  align-items: center;
  margin-bottom: 24px;
}
#homePage .page-head h1,
#settingsPage .page-head h1 {
  margin: 0;
  font-family: "Inter", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
#homePage .page-head .kicker,
#settingsPage .page-head .kicker,
#homePage .card .kicker,
#settingsPage .card .kicker {
  margin-bottom: 4px;
  color: #a1a1b3;
}

#homePage .scope-seg {
  background: #15151b;
  border-color: #2a2a35;
  border-radius: 10px;
  padding: 4px;
}
#homePage .scope-seg button {
  min-width: 112px;
  padding: 9px 15px;
  border-radius: 7px;
  color: #8a8a98;
  font-size: 13px;
  font-weight: 600;
}
#homePage .scope-seg button.active {
  background: #6366f1;
  box-shadow: none;
}

#homePage .stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 24px;
  overflow: hidden;
  background: #15151b;
  border: 1px solid #2a2a35;
  border-radius: 12px;
}
#homePage .stat {
  min-height: 112px;
  padding: 20px 24px;
  background: transparent;
  border: 0;
  border-right: 1px solid #2a2a35;
  border-radius: 0;
  box-shadow: none;
  animation: none;
  transition: background .2s;
}
#homePage .stat:last-child { border-right: 0; }
#homePage .stat:hover {
  transform: none;
  background: #1a1a21;
  border-color: #2a2a35;
  box-shadow: none;
}
#homePage .stat.hero { background: transparent; }
#homePage .stat.hero::before,
#homePage .stat-ico,
#homePage .spark { display: none; }
#homePage .stat-top { min-height: 19px; }
#homePage .stat > span,
#homePage .stat-top span:first-child {
  color: #a1a1b3;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
#homePage .stat-num,
#homePage .stat-num.sm {
  margin-top: 9px;
  font-size: 24px;
  font-weight: 700;
}
#homePage .stat-sub {
  margin-top: 5px;
  color: #8a8a98;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

#homePage .home-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr);
  gap: 24px;
}
#homePage .side { gap: 16px; }
#homePage .card,
#settingsPage .card {
  padding: 20px 24px;
  overflow: hidden;
  background: #15151b;
  border: 1px solid #2a2a35;
  border-radius: 12px;
  box-shadow: none;
}
#homePage .card::before,
#settingsPage .card::before { display: none; }
#homePage .card-head h2,
#settingsPage .set-card h2 {
  font-family: "Inter", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
#homePage .card-head { align-items: center; margin-bottom: 14px; }
#homePage .link-btn { color: #818cf8; font-size: 13px; font-weight: 600; }

#homePage .activity { gap: 8px; }
#homePage .activity-item {
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 10px 12px;
  background: #0f0f13;
  border: 1px solid #252530;
  border-radius: 10px;
  transition: background .2s, border-color .2s;
}
#homePage .activity-item:hover {
  background: #1a1a21;
  border-color: #4f46e5;
}
.recent-bookmaker-mark {
  --bookie-color: #20202a;
  position: relative;
  width: 76px;
  height: 40px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--bookie-color);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 7px;
}
.recent-bookmaker-mark img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.recent-bookmaker-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
}
#homePage .activity-main strong { font-size: 14px; font-weight: 700; }
#homePage .activity-main span,
#homePage .activity-right small { color: #8a8a98; }
#homePage .group-list { gap: 8px; }
#homePage .group-row {
  padding: 10px 12px;
  background: #0f0f13;
  border: 1px solid #252530;
  border-radius: 10px;
}
#homePage .group-row:hover {
  background: #1a1a21;
  border-color: #353541;
}
#homePage .tool-card {
  background: linear-gradient(145deg, #171721, #15151b);
  border-color: #343442;
}
#homePage .tool-card .btn,
#settingsPage .btn {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

#settingsPage .settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr);
  gap: 16px;
}
#settingsPage .set-card {
  gap: 14px;
  align-content: start;
}
#settingsPage .set-card.wide { grid-column: 1 / -1; }
#settingsPage .settings-appearance {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
#settingsPage .settings-appearance > .kicker,
#settingsPage .settings-appearance > h2,
#settingsPage .settings-appearance > p { grid-column: 1; }
#settingsPage .settings-appearance > .switch-row {
  grid-column: 2;
  grid-row: 1 / span 3;
  min-width: 250px;
  padding: 12px 14px;
  background: #0f0f13;
  border: 1px solid #2a2a35;
  border-radius: 8px;
}
#settingsPage .settings-main {
  grid-column: 1;
  grid-row: 2;
}
#settingsPage .settings-side-stack {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  gap: 16px;
  align-content: start;
}
#settingsPage .settings-side-stack .set-card { min-height: 0; }
#settingsPage .field > span { color: #a1a1b3; }
#settingsPage input,
#settingsPage select {
  background-color: #0f0f13;
  border-color: #2a2a35;
  border-radius: 8px;
}
#settingsPage input:focus,
#settingsPage select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
#settingsPage .btn.brand-btn {
  justify-self: start;
  background: #6366f1;
  box-shadow: none;
}
#settingsPage .btn.brand-btn:hover { background: #4f46e5; box-shadow: none; }
#settingsPage .btn.ghost {
  justify-self: start;
  background: #24242d;
  border-color: #353541;
}
#settingsPage .btn.ghost:hover {
  background: #2d2d38;
  border-color: #4a4a59;
}
#settingsPage .settings-side-stack .btn-row { margin-top: auto; }

@media (max-width: 900px) {
  #homePage .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #homePage .stat:nth-child(2) { border-right: 0; }
  #homePage .stat:nth-child(-n+2) { border-bottom: 1px solid #2a2a35; }
  #homePage .home-grid { grid-template-columns: 1fr; }
  #settingsPage .settings-grid { grid-template-columns: 1fr; }
  #settingsPage .settings-main,
  #settingsPage .settings-side-stack {
    grid-column: 1;
    grid-row: auto;
  }
}
@media (max-width: 600px) {
  #homePage .page-head,
  #settingsPage .page-head { align-items: stretch; }
  #homePage .scope-seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  #homePage .scope-seg button { min-width: 0; }
  #homePage .stat-row { grid-template-columns: 1fr; }
  #homePage .stat {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid #2a2a35;
  }
  #homePage .stat:nth-child(3) { border-bottom: 1px solid #2a2a35; }
  #homePage .stat:last-child { border-bottom: 0; }
  #homePage .activity-item { grid-template-columns: 68px minmax(0, 1fr); }
  #homePage .activity-right { grid-column: 2; text-align: left; grid-auto-flow: column; justify-content: start; gap: 8px; }
  .recent-bookmaker-mark { width: 68px; height: 38px; }
  #settingsPage .settings-appearance { grid-template-columns: 1fr; }
  #settingsPage .settings-appearance > .switch-row {
    grid-column: 1;
    grid-row: auto;
    min-width: 0;
  }
}

/* ============================================================
   MODALS
   ============================================================ */
.modal { border: 0; padding: 0; background: transparent; max-width: 620px; width: calc(100% - 32px); }
.modal.small { max-width: 460px; }
.modal.tiny { max-width: 400px; }
.modal::backdrop { background: rgba(4,8,14,.78); }
.modal-card { background: #0a0a0c; border: 1px solid var(--border-2); border-radius: var(--r-xl); padding: 24px; box-shadow: var(--shadow); animation: modalIn .32s cubic-bezier(.2,.8,.3,1) both; max-height: 88vh; overflow-y: auto; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.x { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1.4rem; color: var(--text-2); transition: background .15s, color .15s; }
.x:hover { background: var(--surface-2); color: var(--text); }
.q-block { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.q-block:first-of-type { padding-top: 0; }
.q-block .field:only-child { grid-column: 1 / -1; }
@media (max-width: 520px) { .q-block { grid-template-columns: 1fr; } .field-grid { grid-template-columns: 1fr; } .result-pairs { grid-template-columns: 1fr; } }
.lay-hint { display: flex; align-items: center; gap: 18px; margin: 16px 0 6px; padding: 15px 18px; background: var(--brand-soft); border: 1px solid var(--brand-ring); border-radius: var(--r); }
.lay-hint > div { display: grid; gap: 2px; }
.lay-hint span { font-size: .74rem; color: var(--text-2); font-weight: 600; }
.lay-hint strong { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mini-copy { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-2); color: var(--brand); font-weight: 700; font-size: .82rem; transition: transform .14s; }
.mini-copy:active { transform: scale(.95); }
.mini-copy.copied { color: var(--good); border-color: var(--good); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Save A Bet — supplied two-column design, wired into the tracker */
.modal.bet-modal { max-width: 800px; }
.bet-modal-card { background: #1a1a21; border: 1px solid #2a2a35; border-radius: 16px; padding: 32px; box-shadow: 0 20px 40px rgba(0,0,0,.4); max-height: 90vh; overflow-y: auto; color: #fff; }
.bet-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.bet-modal-header h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.bet-close-btn { background: none; border: 0; color: #8a8a98; font-size: 24px; line-height: 1; transition: color .2s; }
.bet-close-btn:hover { color: #fff; }
.bet-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.bet-input-group { display: flex; flex-direction: column; gap: 8px; }
.bet-input-group > span:first-child { font-size: 13px; font-weight: 500; color: #a1a1b3; }
.bet-input-group input, .bet-input-group select { background-color: #0f0f13; border: 1px solid #2a2a35; color: #fff; padding: 12px 16px; min-height: 44px; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; color-scheme: dark; }
.bet-input-group select { appearance: auto; background-image: none; cursor: pointer; transition: none; }
.bet-input-group input:focus, .bet-input-group select:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.bet-input-group input::placeholder { color: #555566; }
.bookmaker-picker { position: relative; }
.bookmaker-trigger { width: 100%; min-height: 44px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; background: #0f0f13; border: 1px solid #2a2a35; border-radius: 8px; color: #fff; text-align: left; transition: border-color .15s, box-shadow .15s; }
.bookmaker-trigger:hover, .bookmaker-trigger[aria-expanded="true"] { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.bookmaker-trigger > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-logo, .option-logo { --bookie-color: #20202a; position: relative; flex: 0 0 auto; overflow: hidden; display: grid; place-items: center; background: var(--bookie-color); border: 1px solid rgba(255,255,255,.1); color: #fff; font-size: .66rem; font-weight: 800; }
.picker-logo { width: 34px; height: 25px; border-radius: 6px; }
.picker-logo span, .option-logo span { position: absolute; inset: 0; display: grid; place-items: center; }
.picker-logo img, .option-logo img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; display: block; }
.bookmaker-menu { position: absolute; z-index: 80; top: calc(100% + 8px); left: 0; right: 0; padding: 10px; background: #15151b; border: 1px solid #343440; border-radius: 12px; box-shadow: 0 20px 46px rgba(0,0,0,.52); }
.bookmaker-search { min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 9px; background: #0d0d11; border: 1px solid #2a2a35; border-radius: 8px; color: #737386; }
.bookmaker-search:focus-within { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.bookmaker-search input { min-height: 40px; padding: 9px 0; border: 0; background: transparent; box-shadow: none !important; }
.bookmaker-options { max-height: 250px; margin-top: 8px; display: grid; gap: 3px; overflow-y: auto; }
.bookmaker-option { width: 100%; padding: 8px 9px; display: flex; align-items: center; gap: 11px; border-radius: 8px; color: #d9d9e2; text-align: left; font-size: .86rem; font-weight: 650; }
.bookmaker-option:hover, .bookmaker-option:focus-visible { background: #23232d; color: #fff; outline: none; }
.option-logo { width: 46px; height: 31px; border-radius: 6px; }
.bookmaker-no-results { padding: 20px 12px; color: #8a8a98; text-align: center; font-size: .84rem; }
.date-time-row { display: flex; gap: 12px; }
.date-time-row input { flex: 1; min-width: 0; }
.bet-results-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.bet-result-card { background: #15151b; border: 1px solid #2a2a35; border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.bet-result-card > span { font-size: 13px; color: #a1a1b3; font-weight: 500; }
.bet-val-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bet-val-row strong { font-size: 20px; font-weight: 700; color: #fff; }
.bet-copy-btn { background: #1a1a21; border: 1px solid #2a2a35; color: #fff; padding: 6px 12px; border-radius: 6px; font-size: 12px; display: flex; align-items: center; gap: 6px; transition: background .2s, border-color .2s; }
.bet-copy-btn:hover { background: #2a2a35; }
.bet-copy-btn.copied { color: var(--good); border-color: var(--good); }
.bet-modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bet-footer-actions { display: flex; justify-content: flex-end; gap: 12px; }
.btn-cancel, .btn-save { padding: 12px 24px; border-radius: 8px; font-size: 14px; font-weight: 600; transition: all .2s; }
.btn-cancel { background: transparent; border: 1px solid #2a2a35; color: #fff; }
.btn-cancel:hover { background: #2a2a35; }
.btn-save { background: #6366f1; color: #fff; }
.btn-save:hover { background: #4f46e5; }
.btn-delete-bet { padding: 10px 2px; color: #ff6b78; font-size: 13px; font-weight: 700; }
.btn-delete-bet:hover { color: #ff8d97; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 680px) {
  .bet-modal-card { padding: 22px; }
  .bet-form-grid, .bet-results-container { grid-template-columns: 1fr; gap: 14px; }
  .date-time-row { flex-direction: column; }
  .bet-modal-footer { align-items: stretch; flex-direction: column-reverse; }
  .bet-footer-actions { width: 100%; }
  .bet-footer-actions .btn-cancel, .bet-footer-actions .btn-save { flex: 1; }
  .btn-delete-bet { width: 100%; }
}

.result-modal-card { position: relative; text-align: center; display: grid; justify-items: center; gap: 12px; padding: 30px; overflow: hidden; }
.result-close { position: absolute; top: 14px; right: 14px; }
.result-celebrate { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--good-bg); border: 1px solid rgba(34,197,94,.28); color: var(--good); font-size: 1.7rem; font-weight: 900; box-shadow: 0 0 28px rgba(34,197,94,.12); }
.result-modal-card h2 { max-width: 340px; }
.result-message { color: var(--text-2); line-height: 1.6; max-width: 390px; }
.result-net { width: 100%; display: grid; gap: 5px; padding: 15px 18px; margin: 4px 0 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.result-net span { color: var(--text-3); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.result-net strong { font-family: "Montserrat", sans-serif; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.settle-sub { color: var(--text-2); margin-bottom: 16px; }
.win-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wc { display: grid; justify-items: center; gap: 4px; padding: 22px 14px; border: 1.5px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); transition: transform .15s, border-color .18s, background .18s; }
.wc i { font-size: 1.6rem; margin-bottom: 4px; }
.wc b { font-weight: 750; } .wc small { color: var(--text-3); font-size: .78rem; }
.wc:hover { transform: translateY(-2px); }
.wc.win:hover, .wc.win.sel { border-color: var(--good); background: var(--good-bg); } .wc.win i { color: var(--good); }
.wc.lose:hover, .wc.lose.sel { border-color: var(--bad); background: var(--bad-bg); } .wc.lose i { color: var(--bad); }
.settle-preview { margin-top: 16px; padding: 15px 18px; border-radius: var(--r); background: var(--surface-2); display: grid; gap: 8px; animation: rise .3s ease both; }
.settle-preview .sp-row { display: flex; justify-content: space-between; font-size: .9rem; }
.settle-preview .sp-row span { color: var(--text-2); }
.settle-preview .sp-row strong { font-variant-numeric: tabular-nums; }
.settle-preview .sp-total { border-top: 1px solid var(--border); padding-top: 8px; font-weight: 800; }

/* ---------- Toast ---------- */
.toast-region { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 10px; width: max-content; max-width: calc(100% - 32px); }
@media (max-width: 859px) { .toast-region { bottom: 100px; } }
.toast { background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; padding: 13px 18px; box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 10px; animation: toastIn .35s cubic-bezier(.2,.8,.3,1) both; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: 0 0 auto; }
.toast.good::before { background: var(--good); }
.toast.error::before { background: var(--bad); }
.toast.leaving { animation: toastOut .3s ease forwards; }

/* ---------- Mobile nav ---------- */
.mobilenav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; display: flex; align-items: center; justify-content: space-around; height: 68px; padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(18px); border-top: 1px solid var(--border); }
@supports not (background: color-mix(in srgb, red, blue)) { .mobilenav { background: var(--bg-2); } }
@media (min-width: 860px) { .mobilenav { display: none; } }
.mobilenav button { display: grid; justify-items: center; gap: 3px; color: var(--text-3); font-size: .68rem; font-weight: 650; padding: 6px 10px; transition: color .18s; }
.mobilenav button i { font-size: 1.25rem; }
.mobilenav button.active { color: var(--brand); }
.mob-add { background: var(--grad-brand) !important; color: var(--brand-ink) !important; width: 52px; height: 52px; border-radius: 17px; display: grid !important; place-items: center; box-shadow: 0 10px 24px -6px var(--brand-ring); margin-top: -18px; }
.mob-add .plus { font-size: 1.7rem; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
@keyframes shake { 0%,100%{ transform: translateX(0); } 20%{ transform: translateX(-9px); } 40%{ transform: translateX(8px); } 60%{ transform: translateX(-6px); } 80%{ transform: translateX(4px); } }
@keyframes countPulse { 0%{ transform: scale(1);} 50%{ transform: scale(1.03);} 100%{ transform: scale(1);} }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
}
