:root {
  --bg: #080b11;
  --bg-2: #0e131c;
  --surface: #151c28;
  --surface-2: #1c2534;
  --line: #253044;
  --text: #eaf0f8;
  --muted: #8a98ad;
  --dim: #5d6b80;
  --home: #35d07f;
  --draw: #f0b429;
  --away: #4d8bf0;
  --accent: #35d07f;
  --danger: #f2555a;
  --radius: 14px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
/* WKWebView inflates text on its own unless told not to, which pushes the
   header and tab labels out of their boxes in the native shells. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

.app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.boot { flex: 1; display: grid; place-items: center; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.topbar {
  flex: 0 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px 12px;
  background: rgba(8,11,17,.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.topbar .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.topbar .spacer { flex: 1; }
.iconbtn {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer;
}
.iconbtn:active { background: var(--surface-2); }

main { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px 24px; max-width: 780px; width: 100%; margin: 0 auto; }
@media (min-width: 900px) { main { max-width: 1080px; } }

.tabbar {
  flex: 0 0 auto;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(10,14,21,.94);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar button {
  background: none; border: 0; color: var(--dim); cursor: pointer;
  touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  min-width: 0; padding: 0 2px;
}
.tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar button.active { color: var(--accent); }
.tabbar svg { width: 21px; height: 21px; }

/* ---------- generic ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.card.tight { padding: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.tiny { font-size: 11px; }
.bold { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 4px 10px; }
h2.section:first-child { margin-top: 4px; }

.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #06210f; }

.btn {
  display: block; width: 100%; padding: 13px 16px; border-radius: 12px; cursor: pointer;
  background: var(--accent); border: 0; color: #06210f; font-weight: 700; font-size: 15px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 12px 13px; border-radius: 11px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
}
.field input:focus, .field select:focus { outline: 2px solid rgba(53,208,127,.5); outline-offset: 0; border-color: transparent; }
.field .err { color: var(--danger); font-size: 12px; margin-top: 5px; }
.banner { padding: 11px 13px; border-radius: 11px; font-size: 13.5px; margin-bottom: 12px; }
.banner.error { background: rgba(242,85,90,.12); border: 1px solid rgba(242,85,90,.4); color: #ffb3b6; }
.banner.info { background: rgba(53,208,127,.1); border: 1px solid rgba(53,208,127,.35); color: #a8f0cd; }

/* ---------- match card ---------- */
.match { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; margin-bottom: 10px; cursor: pointer; }
.match:active { background: var(--surface-2); }
.match .meta { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--dim); margin-bottom: 9px; }
.match .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 11px; }
.match .team { font-weight: 650; font-size: 15px; }
.match .team.away { text-align: right; }
.match .vs { font-size: 11px; color: var(--dim); font-weight: 700; }
.match .xg { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.probbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--bg-2); }
.probbar > span { display: block; }
.probbar .h { background: var(--home); }
.probbar .d { background: var(--draw); }
.probbar .a { background: var(--away); }
.problabels { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.problabels .h { color: var(--home); }
.problabels .d { color: var(--draw); }
.problabels .a { color: var(--away); }
.problabels b { font-weight: 700; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.good { background: rgba(53,208,127,.14); color: var(--home); border-color: rgba(53,208,127,.35); }
.pill.bad { background: rgba(242,85,90,.14); color: var(--danger); border-color: rgba(242,85,90,.35); }
.pill.warn { background: rgba(240,180,41,.14); color: var(--draw); border-color: rgba(240,180,41,.35); }

.formdots { display: inline-flex; gap: 3px; }
.formdots i {
  width: 17px; height: 17px; border-radius: 5px; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 800; font-style: normal; color: #071016;
}
.formdots i.W { background: var(--home); }
.formdots i.D { background: var(--draw); }
.formdots i.L { background: var(--danger); color: #fff; }

/* ---------- detail ---------- */
.hero { background: linear-gradient(160deg, #16202f, #10161f); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px; margin-bottom: 14px; }
.hero .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.hero .team { font-size: 17px; font-weight: 700; }
.hero .team.away { text-align: right; }
.hero .score { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 650; font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px; text-align: center; }
.stat .n { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

.wf { display: flex; flex-direction: column; gap: 7px; }
.wf .r { display: grid; grid-template-columns: 110px 1fr 54px; align-items: center; gap: 8px; font-size: 12.5px; }
.wf .track { position: relative; height: 16px; background: var(--bg-2); border-radius: 5px; }
.wf .track i { position: absolute; top: 3px; height: 10px; border-radius: 3px; display: block; }
.wf .track .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); }
.wf .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 7px 5px; border-bottom: 1px solid var(--line); font-weight: 700; }
table.tbl td { padding: 9px 5px; border-bottom: 1px solid rgba(37,48,68,.5); font-variant-numeric: tabular-nums; }
table.tbl td.name { font-variant-numeric: normal; font-weight: 600; }
table.tbl tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.calib { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 8px; }
.calib .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.calib .b .pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; }
.calib .b .pair i { flex: 1; border-radius: 3px 3px 0 0; display: block; }
.calib .b .pair i.p { background: var(--dim); }
.calib .b .pair i.o { background: var(--accent); }
.calib .b span { font-size: 9px; color: var(--dim); text-align: center; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 10px; }

/* ---------- auth ---------- */
.auth {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column;
  justify-content: center; justify-content: safe center;
  padding: calc(28px + var(--safe-t)) 20px calc(28px + var(--safe-b));
  max-width: 430px; width: 100%; margin: 0 auto;
}
.auth .brand { text-align: center; margin-bottom: 26px; }
.auth .brand .logo { width: 66px; height: 66px; margin: 0 auto 14px; }
.auth .brand h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.03em; }
.auth .brand p { margin: 0; color: var(--muted); font-size: 14px; }
.auth .switch { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.auth .switch button { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; }
.legal { font-size: 11px; color: var(--dim); text-align: center; margin-top: 20px; line-height: 1.5; }

.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--radius); height: 96px; margin-bottom: 10px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- user selections ---------- */
.picker { display: flex; gap: 6px; margin-top: 11px; }
.picker button {
  flex: 1 1 0; min-width: 0; padding: 8px 6px; border-radius: 10px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picker button:active { transform: scale(.98); }
.picker button.on { background: var(--accent); border-color: var(--accent); color: #06210f; }
.picker button.on.d { background: var(--draw); border-color: var(--draw); }
.picker button.on.a { background: var(--away); border-color: var(--away); color: #04122b; }
.picker button.busy { opacity: .5; }
.picker .clear { flex: 0 0 38px; color: var(--dim); }

.pickhead { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.pickhead .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 700; }

.market-block { margin-bottom: 14px; }
.market-block .name { font-size: 12.5px; color: var(--muted); font-weight: 650; margin-bottom: 7px; }

.selcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; margin-bottom: 10px; }
.selcard.hit { border-color: rgba(53,208,127,.45); }
.selcard.miss { border-color: rgba(242,85,90,.4); }
.selcard .top { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--dim); margin-bottom: 7px; }
.selcard .fix { font-weight: 650; font-size: 14.5px; margin-bottom: 3px; }
.selcard .call { font-size: 13px; color: var(--accent); font-weight: 650; }

.accum { background: linear-gradient(160deg, #16202f, #10161f); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.accum .leg { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.accum .leg:last-of-type { border-bottom: 0; }
.accum .leg input { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 auto; }
.accum .leg .txt { flex: 1; min-width: 0; }
.accum .leg .txt b { display: block; font-weight: 650; }
.accum .leg .p { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }

.vs-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.vs-row .who { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.vs-row .n { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.vs-row .mid { font-size: 11px; color: var(--dim); font-weight: 700; }

.tabbar { grid-template-columns: repeat(6, 1fr); }
.tabbar button { font-size: 9.5px; }

/* ---------- safe picks ---------- */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper button {
  flex: 1 1 0; min-width: 40px; padding: 10px 4px; border-radius: 10px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.stepper button.on { background: var(--accent); border-color: var(--accent); color: #06210f; }
.stepper button:disabled { opacity: .3; cursor: not-allowed; }

.floors { display: flex; gap: 6px; }
.floors button {
  flex: 1 1 0; min-width: 0; padding: 9px 4px; border-radius: 10px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.floors button .pc { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.floors button .n { font-size: 9.5px; color: var(--dim); }
.floors button.on { background: var(--accent); border-color: var(--accent); color: #06210f; }
.floors button.on .n { color: rgba(6,33,15,.7); }
.floors button:disabled { opacity: .35; cursor: not-allowed; }

.slipsum {
  background: linear-gradient(155deg, #16281f, #101a17);
  border: 1px solid rgba(53,208,127,.3); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; text-align: center;
}
.slipsum .odds { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.slipsum .oddslbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin-top: 5px; }
.slipsum .bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.slipsum .bar .n { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.slipsum .bar .l { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); margin-top: 3px; }

.leg {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px; margin-bottom: 8px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
}
.leg .who { font-size: 14px; font-weight: 650; }
.leg .sel { font-size: 12.5px; color: var(--accent); font-weight: 600; margin-top: 2px; }
.leg .meta { font-size: 10.5px; color: var(--dim); margin-top: 3px; }
.leg .rt { text-align: right; }
.leg .pct { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.leg .od { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; margin-top: 2px; }

.notebox {
  background: var(--bg-2); border-left: 2px solid var(--warn); border-radius: 8px;
  padding: 11px 13px; margin-top: 14px; font-size: 12.5px; color: var(--muted); line-height: 1.5;
}
