:root {
  --bg: #0e1b15;
  --panel: #16271f;
  --panel-2: #1d3329;
  --line: #2b4638;
  --text: #e9f0ea;
  --muted: #9db3a5;
  --accent: #e8c45a;
  --accent-ink: #1c1606;
  --good: #63c78a;
  --bad: #e2725b;
  --warn: #e8a13a;
  --bar: #2b4638;
  --tabbar: 62px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f1e8;
    --panel: #ffffff;
    --panel-2: #ece9dc;
    --line: #d5d1c0;
    --text: #17231c;
    --muted: #5d6b62;
    --accent: #1f6b45;
    --accent-ink: #ffffff;
    --good: #1f7a4a;
    --bad: #b8432c;
    --warn: #a56a12;
    --bar: #dcd8c8;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.35rem; line-height: 1.2; text-wrap: balance; }
h2 { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 1rem; }
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }

/* Layout */
.screen { padding: 16px 16px calc(var(--tabbar) + 96px + env(safe-area-inset-bottom)); }
.screen.plain { padding-bottom: 32px; }
.head { padding: 4px 0 14px; }
.head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card.tight { padding: 4px 0; }
.stack > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .grow { flex: 1; min-width: 0; }
.cut { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 48px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.slim { min-height: 44px; width: auto; padding: 8px 14px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .tab:focus-visible, .chip:focus-visible, .item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 44px; }

/* Advance bar and tabs */
.advance {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding: 10px 16px; background: linear-gradient(transparent, var(--bg) 35%);
}
.advance .btn { max-width: 528px; margin: 0 auto; min-height: 56px; font-size: 1.05rem; box-shadow: 0 6px 18px rgb(0 0 0 / .3); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--panel); border-top: 1px solid var(--line);
}
.tab { background: none; border: 0; color: var(--muted); font-size: .7rem; min-width: 0; font-weight: 600; display: grid; place-items: center; gap: 0; cursor: pointer; padding: 6px 0; }
.tab svg { width: 22px; height: 22px; display: block; margin: 0 auto 2px; }
.tab[aria-current="page"] { color: var(--accent); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 14px;
  background: none; border: 0; border-top: 1px solid var(--line); text-align: left; cursor: pointer;
}
.list > li:first-child .item, .item.first { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8rem; }
.group { padding: 10px 14px 4px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stars { color: var(--accent); letter-spacing: 1px; white-space: nowrap; font-size: .9rem; }
.stars .off { color: var(--bar); }
.tag { font-size: .7rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.tag.bad { color: var(--bad); }
.tag.xi { color: var(--good); }

/* Bars */
.bar { height: 8px; border-radius: 4px; background: var(--bar); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--good); }
.bar.mid > i { background: var(--warn); }
.bar.low > i { background: var(--bad); }
.rate { flex: none; display: grid; gap: 5px; justify-items: end; }
.rate .bar { width: 100%; height: 5px; }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.meter .bar { grid-column: 1 / -1; }

/* Match card */
.score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.score .team { font-weight: 600; line-height: 1.2; }
.score .team.away { text-align: right; }
.score .goals { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.notes { margin: 10px 0 0; padding: 0 0 0 18px; }
.notes li + li { margin-top: 6px; }
.banner { border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; background: var(--panel-2); border: 1px solid var(--warn); }
.banner.bad { border-color: var(--bad); }

/* Table */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 9px 6px; text-align: right; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .74rem; }
td.club, th.club { text-align: left; white-space: normal; width: 100%; }
td.pos { color: var(--muted); padding-left: 12px; border-left: 3px solid transparent; }
tr.up td.pos { border-left-color: var(--good); }
tr.down td.pos { border-left-color: var(--bad); }
tbody tr { border-top: 1px solid var(--line); }
tbody tr.mine { background: var(--panel-2); font-weight: 700; }
tbody tr[data-action] { cursor: pointer; }
.chips { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.chip { flex: 1; min-height: 44px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: .86rem; white-space: nowrap; cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.key { display: flex; gap: 14px; font-size: .78rem; color: var(--muted); padding: 8px 14px; }
.key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* Traits */
.trait { border-top: 1px solid var(--line); padding: 10px 0; }
.trait:first-child { border-top: 0; padding-top: 0; }
.trait b { display: block; }
.trait .kind { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* Start */
.hero { min-height: 100dvh; display: grid; align-content: center; gap: 18px; padding: 24px 20px; }
.hero h1 { font-size: 2rem; }
.hero .lede { color: var(--muted); max-width: 34ch; }
.offer h3 { margin-bottom: 2px; }
.offer p.sit { margin: 10px 0 12px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; margin: 10px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* Modal */
.veil { position: fixed; inset: 0; background: rgb(0 0 0 / .6); display: grid; place-items: end center; padding: 16px; z-index: 10; }
.sheet { width: 100%; max-width: 528px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.sheet p { margin: 8px 0 16px; color: var(--muted); }
.sheet .row > * { flex: 1; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + 84px + env(safe-area-inset-bottom)); z-index: 9;
  max-width: 528px; margin: 0 auto; background: var(--text); color: var(--bg); padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.back { display: inline-flex; align-items: center; min-height: 44px; background: none; border: 0; color: var(--accent); font-weight: 600; padding: 0; cursor: pointer; }
input[type=file] { display: none; }

/* Market */
.tag.warn { color: var(--warn); }
.rate .rt { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.picks { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
select { width: 100%; min-width: 0; min-height: 44px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: .84rem; }
.fee { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 10px; margin: 4px 0 12px; }
.fee b { text-align: center; font-size: 1.6rem; }
.fee .btn { font-size: 1.3rem; }
.sheet { max-height: calc(100dvh - 32px); overflow-y: auto; }
.sheet .chips .chip { flex: 1; }
.sheet .banner { margin: 0 0 12px; }
.row .btn.grow { flex: 1; }
.sheet .stack .row > * { flex: initial; }
.sheet .stack .row > .grow { flex: 1; }
.sheet .chips .chip { padding: 6px 4px; min-width: 0; font-size: .82rem; }
.picks select { font-size: .8rem; padding: 6px 4px; }
