:root {
  color-scheme: dark;
  --ground: #111216;
  --surface: #191a20;
  --surface-2: #22232a;
  --line: #34353e;
  --ink: #f2f1ed;
  --muted: #aaabb3;
  --dim: #767983;
  --accent: #ff6651;
  --accent-2: #f5c87d;
  --cool: #8eced0;
  --mono: 'Cascadia Code', Consolas, monospace;
  --sans: 'Microsoft YaHei', 'PingFang SC', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 14px; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.topbar { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1280px) / 2)); border-bottom: 1px solid var(--line); background: #14151a; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 12px var(--mono); letter-spacing: .06em; }
.brand b { margin-left: 5px; color: var(--muted); font: 500 12px var(--sans); letter-spacing: 0; }
.brand-mark { width: 27px; height: 27px; display: grid; place-items: center; background: var(--accent); color: #1c1110; font: 700 15px Georgia, serif; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.guide-trigger, .quiet-button, .wallet { height: 34px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.guide-trigger { display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; color: var(--accent-2); }
.guide-trigger:hover, .quiet-button:hover { border-color: var(--line); background: var(--surface); }
.guide-icon { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font: 10px var(--mono); }
.quiet-button { padding: 0 10px; color: var(--ink); font-size: 12px; }
.wallet { height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-color: var(--line); }
.wallet-label { color: var(--muted); font-size: 10px; }
.wallet strong { color: var(--accent-2); font: 500 12px var(--mono); }

main { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.masthead { min-height: 164px; position: relative; display: grid; grid-template-columns: minmax(0,1fr) minmax(310px,.72fr); align-items: center; gap: 42px; overflow: hidden; border-bottom: 1px solid var(--line); }
.masthead:after { content: ''; position: absolute; z-index: -1; top: 0; right: 0; bottom: 0; width: 48%; opacity: .22; background: repeating-linear-gradient(135deg, transparent 0 20px, #8a4140 20px 21px); mask-image: linear-gradient(90deg, transparent, #000 85%); }
.masthead-copy { position: relative; z-index: 1; padding: 21px 0; }
.eyebrow, .section-kicker, .panel-index { margin: 0; color: var(--accent-2); font: 10px var(--mono); letter-spacing: .07em; }
.eyebrow { display: flex; align-items: center; gap: 8px; }
.live-dot, .sync-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,102,81,.14); }
h1 { margin: 12px 0 5px; font-size: 34px; font-weight: 600; line-height: 1.18; letter-spacing: 0; }
h1 em { color: var(--accent); font-family: Georgia, 'Noto Serif CJK SC', serif; font-weight: 400; font-style: normal; }
.intro { max-width: 650px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.primary-button, .secondary-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--accent); padding: 0 14px; background: var(--accent); color: #211311; font-weight: 700; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); background: #ff7965; }
.masthead .primary-button { position: absolute; top: 39px; right: 0; }
.primary-button span { font-size: 17px; line-height: 0; }
.how-panel { width: 100%; padding: 12px 15px 8px; border-left: 2px solid var(--accent); background: rgba(27,28,34,.93); }
.panel-index { padding-bottom: 9px; border-bottom: 1px solid var(--line); color: var(--muted); }
.panel-rule { display: grid; grid-template-columns: 29px 1fr; align-items: start; gap: 2px; padding: 7px 0; border-bottom: 1px solid #292a31; }
.panel-rule span { padding-top: 1px; color: var(--accent); font: 10px var(--mono); }
.panel-rule p { margin: 0; color: var(--ink); font-size: 11px; line-height: 1.5; }
.text-button { margin-top: 6px; padding: 3px 0; border: 0; background: none; color: var(--accent-2); cursor: pointer; font-size: 11px; }
.text-button span { margin-left: 5px; }
.decor-word { position: absolute; z-index: -1; right: 36%; bottom: -22px; color: #292126; font: 600 91px/.9 Georgia, serif; letter-spacing: 0; user-select: none; }

.content-grid { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 38px; padding: 27px 0 48px; }
.section-head { min-height: 53px; display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.section-kicker { margin-bottom: 5px; color: var(--dim); font-size: 9px; }
.section-head h2, .side-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: 0; }
.section-head h2 span { margin-left: 6px; color: var(--dim); font: 11px var(--mono); vertical-align: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); background: var(--surface); }
.filter { min-height: 26px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.filter.active { background: #343039; color: var(--accent-2); }
.sync-status { min-height: 29px; display: flex; align-items: center; gap: 8px; margin: 8px 0; color: var(--muted); font-size: 10px; }
.sync-status time { margin-left: auto; color: var(--dim); font: 9px var(--mono); }
.sync-dot { width: 6px; height: 6px; box-shadow: 0 0 0 3px rgba(255,102,81,.12); }
.sync-status.stale .sync-dot { background: var(--accent-2); box-shadow: 0 0 0 3px rgba(245,200,125,.12); }
.match-list { display: grid; gap: 10px; }
.match-card { padding: 15px 17px 12px; border: 1px solid var(--line); background: var(--surface); transition: border-color .16s ease; }
.match-card:hover { border-color: #6b4543; }
.match-card.is-closed { opacity: .82; }
.match-meta { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.match-league { max-width: 72%; color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.5; }
.match-state { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); text-align: right; font-size: 10px; }
.match-state i { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }
.match-state.closed { color: var(--muted); }
.match-state.in-play { color: var(--accent); }
.match-date { margin-top: 5px; color: var(--dim); font: 9px var(--mono); }
.match-date span { padding: 0 5px; color: #555760; }
.live-score { color: var(--cool); }
.teams-row { display: grid; grid-template-columns: minmax(0,1fr) 52px minmax(0,1fr); align-items: stretch; gap: 8px; margin: 14px 0 11px; }
.team-block { min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px 10px; padding: 11px; border: 1px solid #393943; background: #202127; }
.team-block.winner { border-color: var(--accent-2); background: #29242a; }
.team-heading { min-width: 0; display: flex; align-items: center; gap: 8px; }
.team-logo { width: 26px; height: 26px; flex: 0 0 26px; object-fit: contain; }
.team-code, .pick-letter { width: 21px; height: 21px; flex: 0 0 21px; display: grid; place-items: center; border: 1px solid #666771; color: var(--muted); font: 9px var(--mono); }
.team-heading strong { overflow-wrap: anywhere; font-size: 12px; font-weight: 600; line-height: 1.35; }
.team-odds { grid-column: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.team-odds b { color: var(--accent-2); font: 500 20px var(--mono); }
.team-odds span { color: var(--dim); font-size: 9px; }
.winner .team-code { border-color: var(--accent-2); color: var(--accent-2); }
.winner .team-heading strong { color: var(--accent-2); }
.buy-button { grid-column: 2; grid-row: 1 / span 2; min-height: 32px; padding: 0 10px; border: 1px solid #b04a40; background: transparent; color: var(--accent); cursor: pointer; white-space: nowrap; font-size: 10px; }
.buy-button:hover:not(:disabled) { background: var(--accent); color: #201210; }
.buy-button:disabled { opacity: .4; cursor: not-allowed; }
.buy-button span { margin-left: 4px; }
.pick-disabled { grid-column: 2; grid-row: 1 / span 2; color: var(--dim); font-size: 10px; }
.holding-row { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; padding-top: 8px; border-top: 1px solid #393943; color: var(--muted); font: 9px var(--mono); }
.holding-row small { color: var(--dim); font-size: 9px; }
.sell-button, .portfolio-sell { min-height: 25px; margin-left: auto; padding: 0 8px; border: 1px solid #66554a; background: transparent; color: var(--accent-2); cursor: pointer; font-size: 9px; }
.sell-button:disabled, .portfolio-sell:disabled { opacity: .4; cursor: not-allowed; }
.vs-divider { position: relative; display: grid; place-items: center; color: var(--dim); font: 9px var(--mono); }
.vs-divider i { position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--line); }
.vs-divider span { z-index: 1; padding: 6px; background: var(--surface); }
.market-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--dim); font-size: 9px; }
.market-footer a { color: var(--muted); }
.market-footer a:hover { color: var(--accent-2); }

.sidebar { padding-top: 4px; }
.leaderboard, .portfolio-section { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.portfolio-section { padding-top: 18px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.side-head h2 { font-size: 15px; }
.trophy { color: var(--accent-2); font-size: 16px; }
.rank-list { display: grid; }
.rank-row { min-height: 37px; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 7px; border-bottom: 1px solid #292a31; }
.rank-row.self { color: var(--accent-2); }
.rank-num { color: var(--dim); font: 9px var(--mono); }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.rank-row strong { font: 500 10px var(--mono); }
.rank-row small { color: var(--dim); font: 9px var(--sans); }
.rank-empty { padding: 10px 0; color: var(--dim); font-size: 10px; }
.portfolio-list { display: grid; gap: 8px; }
.portfolio-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 7px; align-items: center; padding: 8px 0; border-bottom: 1px solid #292a31; }
.portfolio-match { overflow: hidden; grid-column: 1 / -1; color: var(--dim); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.portfolio-team { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.portfolio-team small { display: block; margin-top: 3px; color: var(--muted); font: 9px var(--mono); }
.no-cash-note { display: grid; grid-template-columns: 26px 1fr; gap: 9px; margin-top: 16px; padding: 11px; border: 1px solid #494149; background: #1b1a20; }
.shield { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid #876146; color: var(--accent-2); }
.no-cash-note strong { color: var(--accent-2); font-size: 10px; }
.no-cash-note p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.empty-state { min-height: 235px; display: flex; align-items: center; flex-direction: column; justify-content: center; border: 1px dashed #414149; text-align: center; }
.empty-symbol { color: var(--accent); font: 37px Georgia, serif; }
.empty-state h3 { margin: 10px 0 6px; font-size: 15px; font-weight: 600; }
.empty-state p { max-width: 350px; margin: 0 0 14px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.secondary-button { min-height: 32px; border-color: var(--line); background: var(--surface-2); color: var(--ink); font-size: 10px; }
.secondary-button:hover { border-color: var(--accent); background: var(--surface-2); }
footer { min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 max(24px, calc((100vw - 1280px) / 2)); border-top: 1px solid var(--line); color: var(--dim); font-size: 9px; }
footer span:first-child { color: var(--muted); font: 9px var(--mono); }
footer button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 9px; }

.modal { position: relative; width: min(500px, calc(100% - 26px)); max-height: min(90vh, 750px); padding: 26px; overflow: auto; border: 1px solid #51474d; background: #19191f; color: var(--ink); box-shadow: 0 22px 72px rgba(0,0,0,.6); }
.modal::backdrop { background: rgba(5,5,8,.78); backdrop-filter: blur(3px); }
.modal h2 { margin: 6px 0 8px; font-size: 23px; font-weight: 600; }
.modal .section-kicker { color: var(--accent); }
.modal-lead { margin: 0 0 15px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.close-button { position: absolute; top: 13px; right: 13px; width: 32px; height: 32px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.close-button:hover { color: var(--ink); border-color: var(--muted); }
.guide-steps { margin: 18px 0 15px; border-top: 1px solid var(--line); }
.guide-steps > div { display: grid; grid-template-columns: 35px 1fr; gap: 9px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.guide-steps > div > b { color: var(--accent); font: 10px var(--mono); }
.guide-steps strong { font-size: 12px; }
.guide-steps p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.rules-strip { padding: 9px 11px; background: var(--surface-2); color: var(--muted); font-size: 9px; line-height: 1.8; }
.rules-strip span { padding: 0 4px; color: var(--accent-2); }
.modal-done { width: 100%; margin-top: 15px; }
.form-modal { width: min(450px, calc(100% - 26px)); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 18px 0; padding: 3px; background: var(--surface-2); }
.segmented button { min-height: 34px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.segmented button.selected { background: #37323a; color: var(--accent-2); }
.stack-form { display: grid; gap: 12px; }
.stack-form label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.stack-form input { width: 100%; min-height: 39px; border: 1px solid var(--line); outline: none; padding: 0 10px; background: #111216; color: var(--ink); font-size: 12px; }
.stack-form input:focus { border-color: var(--accent); }
.stack-form input::placeholder { color: #6a6b73; }
.form-note { margin: -2px 0 0; color: var(--dim); font-size: 9px; line-height: 1.6; }
.form-error { margin: 0; color: var(--accent); font-size: 10px; line-height: 1.6; }
.full-button { width: 100%; margin-top: 1px; }
.trade-modal h2 { max-width: 90%; overflow-wrap: anywhere; font-size: 18px; }
.action-tabs { margin: 14px 0; }
.pick-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.pick-options button { min-width: 0; display: grid; justify-items: start; gap: 8px; padding: 11px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.pick-options button.chosen { border-color: var(--accent); background: #2a2227; }
.pick-options strong { overflow-wrap: anywhere; font-size: 11px; }
.pick-options small { color: var(--accent-2); font: 9px var(--mono); }
.pick-options .pick-letter { color: var(--accent); border-color: #9a5148; }
.presets { display: flex; gap: 6px; }
.presets button { min-height: 27px; flex: 1; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer; font: 9px var(--mono); }
.presets button:hover { color: var(--accent-2); border-color: #8b654c; }
.estimate { margin: 0; color: var(--accent-2); font: 10px var(--mono); }
.toast { position: fixed; z-index: 5; bottom: 22px; left: 50%; max-width: calc(100% - 26px); padding: 10px 14px; transform: translate(-50%, 14px); opacity: 0; border: 1px solid #644c49; background: #252127; color: var(--ink); pointer-events: none; transition: opacity .16s ease, transform .16s ease; font-size: 11px; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .content-grid { grid-template-columns: minmax(0,1fr) 220px; gap: 22px; }
  .team-block { grid-template-columns: 1fr; }
  .team-odds { grid-column: 1; }
  .buy-button, .pick-disabled { grid-column: 1; grid-row: auto; justify-self: start; }
}
@media (max-width: 660px) {
  .topbar { height: 55px; padding: 0 13px; }
  .top-actions { gap: 3px; }
  .guide-trigger { gap: 5px; padding: 0 6px; font-size: 10px; }
  .quiet-button { padding: 0 6px; font-size: 10px; }
  .wallet { height: 32px; gap: 5px; padding: 0 7px; }
  .wallet-label { display: none; }
  main { padding: 0 13px; }
  .masthead { min-height: 0; grid-template-columns: 1fr; gap: 0; padding-bottom: 13px; }
  .masthead-copy { padding: 22px 0 14px; }
  .eyebrow { font-size: 8px; }
  h1 { max-width: 82%; margin: 9px 0 5px; font-size: 29px; }
  .intro { max-width: 390px; font-size: 10px; }
  .masthead .primary-button { top: 29px; right: 0; min-height: 31px; padding: 0 8px; font-size: 9px; }
  .masthead .primary-button span { font-size: 13px; }
  .how-panel { padding: 10px 11px 7px; }
  .panel-rule { display: inline-grid; width: 33.333%; grid-template-columns: 1fr; vertical-align: top; border-bottom: 0; }
  .panel-rule span { margin-bottom: 4px; }
  .panel-rule p { font-size: 9px; line-height: 1.45; }
  .panel-index { padding-bottom: 7px; }
  .text-button { margin-top: 1px; font-size: 9px; }
  .decor-word { right: 0; bottom: 19px; font-size: 66px; }
  .content-grid { grid-template-columns: 1fr; gap: 25px; padding: 20px 0 30px; }
  .section-head { align-items: end; flex-wrap: wrap; gap: 9px; }
  .section-head h2 { font-size: 17px; }
  .filters { margin-left: auto; }
  .filter { min-height: 24px; padding: 0 6px; font-size: 9px; }
  .match-card { padding: 12px 10px 10px; }
  .match-league { max-width: 65%; font-size: 10px; }
  .match-state { gap: 4px; font-size: 9px; }
  .teams-row { grid-template-columns: minmax(0,1fr) 32px minmax(0,1fr); gap: 4px; margin: 12px 0 9px; }
  .team-block { min-height: 110px; align-content: start; padding: 8px 7px; gap: 8px; }
  .team-heading { align-items: start; gap: 5px; }
  .team-logo { width: 22px; height: 22px; flex-basis: 22px; }
  .team-code { width: 18px; height: 18px; flex-basis: 18px; }
  .team-heading strong { font-size: 10px; }
  .team-odds { display: grid; gap: 1px; }
  .team-odds b { font-size: 17px; }
  .team-odds span { font-size: 8px; }
  .buy-button { width: 100%; min-height: 29px; padding: 0 4px; font-size: 9px; }
  .holding-row { gap: 4px; font-size: 8px; }
  .holding-row small { font-size: 8px; }
  .sell-button { min-height: 23px; padding: 0 6px; font-size: 8px; }
  .vs-divider span { padding: 5px; }
  .market-footer { font-size: 8px; }
  .sidebar { display: grid; grid-template-columns: 1fr; }
  .leaderboard { padding-bottom: 12px; }
  footer { padding: 0 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
