:root {
  color-scheme: dark;
  --bg: #030711;
  --surface: #080e1a;
  --surface-2: #0d1424;
  --surface-3: #121a2b;
  --line: #202b46;
  --line-soft: #151e32;
  --text: #f3f6fa;
  --muted: #8793a3;
  --blue: #7c5cff;
  --blue-bright: #a78bfa;
  --gold: #ffd166;
  --green: #38d788;
  --red: #ff6666;
  --sidebar: 184px;
  --radius: 8px;
  font-family: Inter, Geist, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); background: #070b16; }
.brand { height: 61px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #426f9d; border-radius: 7px; color: var(--blue-bright); background: #111e2c; box-shadow: inset 0 0 16px rgba(77,163,255,.12); }
.brand-mark svg { width: 20px; height: 20px; }
.brand strong { display: block; font-size: 13px; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 7px; font-weight: 700; letter-spacing: .14em; }

.profile-summary { display: grid; grid-template-columns: 42px 1fr; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.profile-summary strong { font-size: 12px; }
.profile-summary small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.verified { display: inline-flex; margin-left: 4px; vertical-align: middle; color: var(--blue); }
.verified svg { width: 13px; height: 13px; fill: rgba(77,163,255,.15); }
.tier-line { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; margin-left: 52px; margin-top: -4px; color: var(--gold); font-size: 9px; }
.tier-line svg { width: 11px; height: 11px; }
.avatar { position: relative; width: 34px; height: 34px; display: grid; place-items: center; overflow: visible; border: 1px solid #4a5d71; border-radius: 50%; background: #243242; color: #dce9f7; font-size: 10px; font-weight: 800; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.avatar-large { width: 42px; height: 42px; }
.avatar-xl { width: 88px; height: 88px; font-size: 22px; }
.online-dot { position: absolute; right: -1px; bottom: 1px; width: 9px; height: 9px; border: 2px solid #0b1017; border-radius: 50%; background: var(--green); }

.nav-groups { padding: 10px 8px; overflow-y: auto; }
.nav-groups p { margin: 7px 9px 4px; color: #667386; font-size: 8px; font-weight: 800; }
.nav-link { min-height: 39px; display: flex; align-items: center; gap: 10px; padding: 4px 9px; border: 1px solid transparent; border-radius: 6px; color: #a5afbc; }
.nav-link + .nav-link { margin-top: 2px; }
.nav-link svg { width: 16px; height: 16px; }
.nav-link span { font-size: 11px; font-weight: 600; }
.nav-link small { display: block; margin-top: 3px; color: #667386; font-size: 8px; font-weight: 500; }
.nav-link:hover { color: var(--text); background: #121a24; }
.nav-link.active { border-color: #315b86; color: #eaf4ff; background: #15263a; }
.nav-link.active svg { color: var(--blue-bright); }
.nav-link.active small { color: #8ea9c5; }
.invite-card { position: relative; min-height: 76px; margin: auto 10px 10px; overflow: hidden; padding: 11px; border: 1px solid #342d61; border-radius: var(--radius); background: #17152d; }
.invite-card img { position: absolute; right: 0; bottom: 0; width: 72px; height: 72px; object-fit: contain; }
.invite-card div { position: relative; z-index: 1; width: 96px; }
.invite-card strong { display: block; font-size: 9px; }
.invite-card small { display: block; margin-top: 3px; color: #8c89aa; font-size: 7px; line-height: 1.3; }
.invite-card button { height: 20px; margin-top: 8px; padding: 0 8px; border: 1px solid #6258ac; border-radius: 4px; background: #393072; color: #f1edff; font-size: 6px; font-weight: 800; cursor: pointer; }
.sidebar-foot { display: flex; align-items: center; gap: 11px; padding: 10px 14px 14px; border-top: 1px solid var(--line-soft); color: #718095; font-size: 8px; }
.sidebar-foot svg { width: 12px; height: 12px; }
.sidebar-foot span { flex: 1; }
.network-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--green); }

.workspace { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 15; height: 61px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line-soft); background: rgba(3,7,17,.97); backdrop-filter: blur(12px); }
.top-tabs { height: 100%; display: flex; align-items: center; gap: 3px; }
.top-tabs a { height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 13px; border: 1px solid transparent; border-radius: 5px; color: #929dac; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.top-tabs a:hover { color: white; background: #111923; }
.top-tabs a.active { border-color: #315b86; color: #eaf4ff; background: #15263a; }
.top-tabs a svg { width: 12px; height: 12px; color: var(--blue-bright); }
.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-button { position: relative; width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #0e151e; cursor: pointer; }
.icon-button:hover { border-color: #3f5570; background: #141e29; }
.icon-button svg { width: 16px; height: 16px; }
.notification-dot { position: absolute; top: 6px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
.balance-button { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #0e151e; cursor: pointer; }
.balance-button > svg:first-child { color: var(--gold); }
.balance-button > svg:last-child { width: 13px; color: #68788c; }
.balance-button small, .balance-button strong { display: block; text-align: left; }
.balance-button small { color: var(--muted); font-size: 7px; }
.balance-button strong { margin-top: 2px; font-size: 10px; }
.lichess-link { height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; color: #aeb9c7; font-size: 10px; }
.lichess-link:hover { color: white; border-color: #3f5570; }
.runtime-button { background: #0e151e; cursor: pointer; }
.runtime-button .network-dot { width: 6px; height: 6px; margin: 0; }
.mobile-menu { display: none; }

main { width: 100%; max-width: 1500px; margin: 0 auto; padding: 0 14px 14px; }
.view { display: none; }
.view.active { display: block; animation: reveal .2s ease; }
@keyframes reveal { from { opacity: .5; transform: translateY(4px); } }

.hero { position: relative; min-height: 227px; overflow: hidden; border: 0; border-radius: var(--radius); background: #060a14; box-shadow: inset 0 0 0 1px rgba(126, 98, 255, .06); }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 10%; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(7,10,14,.97) 0%, rgba(7,10,14,.88) 35%, rgba(7,10,14,.15) 70%, rgba(7,10,14,.28) 100%); }
.hero-content { position: relative; z-index: 2; width: min(410px, 68%); padding: 20px 30px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--blue-bright); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.eyebrow svg { width: 12px; height: 12px; }
.hero h1 { margin: 3px 0 10px; font-size: 30px; line-height: 1.06; letter-spacing: 0; }
.hero h1 span { color: #9d7cff; }
.hero p { max-width: 445px; margin: 0; color: #a6b0bd; font-size: 10px; line-height: 1.5; }
.hero-actions { display: flex; gap: 9px; margin-top: 14px; }
.primary-button, .secondary-button, .claim-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border-radius: 6px; font-size: 10px; font-weight: 700; cursor: pointer; }
.primary-button { border: 1px solid #9d85ff; background: #6f4ce8; color: white; box-shadow: 0 8px 20px rgba(104,74,226,.25); }
.primary-button:hover { background: #8062ed; }
.secondary-button { border: 1px solid var(--line); background: rgba(14,21,30,.88); color: #bac4d0; }
.secondary-button:hover { border-color: #3f5570; color: white; }
.primary-button svg, .secondary-button svg, .claim-button svg { width: 14px; height: 14px; }
.hero-meta { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(510px, 58%); padding: 0 30px 16px; }
.hero-meta span + span { padding-left: 16px; border-left: 1px solid #2d3744; }
.hero-meta small, .hero-meta strong { display: block; }
.hero-meta small { color: var(--muted); font-size: 8px; }
.hero-meta strong { margin-top: 3px; font-size: 13px; }
.gold { color: var(--gold) !important; }
.green { color: var(--green) !important; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 10px 0; }
.metric { min-height: 68px; display: flex; align-items: center; gap: 8px; padding: 10px; border: 0; border-radius: var(--radius); background: #080e1b; box-shadow: inset 0 1px rgba(255,255,255,.018); }
.metric-icon { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 7px; background: var(--surface-2); }
.metric-icon svg { width: 17px; }
.metric-icon.blue { color: var(--blue-bright); background: #15142f; }
.metric-icon.gold { color: var(--gold); background: #292314; }
.metric-icon.green { color: var(--green); background: #10271f; }
.metric-icon.neutral { color: #aeb8c5; }
.metric small, .metric strong, .metric em { display: block; font-style: normal; }
.metric small { color: var(--muted); font-size: 8px; }
.metric strong { margin-top: 3px; font-size: 13px; }
.metric em { margin-top: 3px; color: #5f7084; font-size: 7px; }

.dashboard-grid { display: contents; }
#dashboardView.active { display: grid; grid-template-columns: minmax(0, 1fr) clamp(230px, 23vw, 300px); align-items: start; column-gap: 10px; row-gap: 2px; }
#dashboardView .hero, #dashboardView .metric-grid, #dashboardView .matches-panel { grid-column: 1; }
#dashboardView .hero { grid-row: 1; }
#dashboardView .metric-grid { grid-row: 2; margin: 0; }
#dashboardView .matches-panel { grid-row: 3; }
#dashboardView .right-column { grid-column: 2; grid-row: 1 / span 3; }
#dashboardView .feature-strip { grid-column: 1 / -1; grid-row: 4; }
.content-panel { border: 0; border-radius: var(--radius); background: #080e1a; box-shadow: inset 0 1px rgba(255,255,255,.018); }
.section-heading { min-height: 53px; display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid rgba(117,132,162,.12); }
.section-heading h2 { margin: 0; font-size: 12px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 8px; }
.section-heading a { display: inline-flex; align-items: center; gap: 5px; color: #8ea0b5; font-size: 8px; }
.section-heading a:hover { color: var(--blue-bright); }
.section-heading a svg { width: 12px; }
.section-heading.compact { min-height: 40px; padding-top: 7px; padding-bottom: 7px; }
.right-column { display: grid; gap: 10px; align-content: start; }

.match-row { min-height: 56px; display: grid; grid-template-columns: minmax(150px, 1.45fr) .8fr .8fr .65fr 78px; align-items: center; gap: 10px; padding: 7px 13px; border-bottom: 1px solid rgba(117,132,162,.11); }
.match-row:last-child { border-bottom: 0; }
.match-row:hover { background: #121a24; }
.match-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mode-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: #172331; color: var(--blue); }
.mode-icon.blitz { color: var(--gold); background: #2a2415; }
.mode-icon.classical { color: #8ac4ff; background: #15263a; }
.match-main strong, .match-main small { display: block; }
.match-main strong { font-size: 10px; }
.match-main strong em { margin-left: 4px; padding: 2px 4px; border-radius: 3px; background: #24234a; color: #a99cff; font-size: 6px; font-style: normal; text-transform: uppercase; }
.match-main small { margin-top: 4px; color: var(--muted); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-cell small, .match-cell strong { display: block; }
.match-cell small { color: #68788b; font-size: 7px; }
.match-cell strong { margin-top: 4px; font-size: 9px; }
.players-joined { color: #a7b4c2; font-size: 8px; }
.join-button { height: 30px; border: 1px solid #34618e; border-radius: 5px; background: #12243a; color: #a9d3ff; font-size: 8px; font-weight: 800; cursor: pointer; }
.join-button:hover { background: #1b3b5d; color: white; }

.live-pill, .status-pill { padding: 4px 6px; border-radius: 4px; font-size: 7px; font-weight: 800; }
.live-pill { color: var(--green); background: #123326; }
.status-pill.payable { color: var(--green); border: 1px solid #275742; background: #10271f; }
.league-badge { display: flex; align-items: center; gap: 14px; padding: 14px 16px 8px; }
.league-badge > img { width: 48px; height: 48px; object-fit: contain; }
.league-badge small, .league-badge strong, .league-badge span { display: block; }
.league-badge small { color: var(--muted); font-size: 7px; }
.league-badge strong { margin: 2px 0; font-size: 15px; }
.league-badge span { color: #76869a; font-size: 8px; }
.progress { height: 4px; margin: 5px 16px 0; overflow: hidden; border-radius: 3px; background: #25303e; }
.progress span { display: block; height: 100%; background: var(--gold); }
.progress-label { display: flex; justify-content: space-between; margin: 7px 16px 13px; color: #6f7e91; font-size: 7px; }
.mini-player { min-height: 32px; display: grid; grid-template-columns: 18px 24px 1fr auto; align-items: center; gap: 6px; padding: 3px 10px; border-bottom: 1px solid rgba(117,132,162,.1); }
.mini-player:last-child { border-bottom: 0; }
.mini-player .rank { color: #65768a; font-size: 8px; text-align: center; }
.mini-avatar { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: #273444; font-size: 7px; font-weight: 800; }
.mini-player strong { font-size: 8px; }
.mini-player small { display: block; margin-top: 2px; color: #6e7e91; font-size: 7px; }
.mini-player > b { color: #bec8d4; font-size: 8px; }
.sprite-avatar { display: inline-block; overflow: hidden; border-radius: 50%; background-image: url('/assets/leaderboard-avatars.png'); background-repeat: no-repeat; background-size: 500% 100%; background-color: #273444; }
.avatar-pos-0 { background-position: 0% center; }
.avatar-pos-1 { background-position: 25% center; }
.avatar-pos-2 { background-position: 50% center; }
.avatar-pos-3 { background-position: 75% center; }
.avatar-pos-4 { background-position: 100% center; }
.skeleton { height: 39px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(90deg, transparent, rgba(255,255,255,.025), transparent); }
.settlement-flow { display: flex; align-items: flex-start; padding: 15px 15px 11px; }
.settlement-flow span { width: 38px; display: grid; justify-items: center; gap: 4px; }
.settlement-flow span > svg { width: 24px; height: 24px; padding: 6px; border: 1px solid var(--line); border-radius: 50%; }
.settlement-flow span.done > svg { color: var(--green); border-color: #286046; background: #112b21; }
.settlement-flow span.current > svg { color: var(--gold); border-color: #63552e; background: #2b2515; }
.settlement-flow small { color: #77869a; font-size: 7px; }
.settlement-flow b { flex: 1; height: 1px; margin-top: 12px; background: #2b3a49; }
.claim-button { width: calc(100% - 28px); margin: 0 14px 14px; border: 1px solid #2b6a4e; background: #143425; color: #77e6ad; }
.claim-button:hover { background: #1b4933; color: white; }
.activity-list > div { min-height: 38px; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 7px; padding: 5px 10px; border-bottom: 1px solid rgba(117,132,162,.1); }
.activity-list > div:last-child { border-bottom: 0; }
.activity-list .sprite-avatar { width: 25px; height: 25px; }
.activity-list p { margin: 0; }
.activity-list b { display: block; font-size: 7px; }
.activity-list small { display: block; margin-top: 2px; color: var(--muted); font-size: 6px; }
.activity-list strong { color: var(--green); font-size: 7px; }
.feature-strip { min-height: 48px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; border-top: 1px solid rgba(117,132,162,.12); border-bottom: 0; background: #070d18; }
.feature-strip > span { min-width: 0; display: grid; grid-template-columns: 26px 1fr; padding: 0 12px; border-right: 1px solid rgba(117,132,162,.1); }
.feature-strip > span:last-child { border-right: 0; }
.feature-strip svg { grid-row: 1 / span 2; align-self: center; color: #9aa6b5; }
.feature-strip b, .feature-strip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feature-strip b { font-size: 7px; }
.feature-strip small { margin-top: 2px; color: var(--muted); font-size: 6px; }

.page-heading { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 4px 18px; }
.page-heading h1 { margin: 6px 0 4px; font-size: 25px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.season-countdown { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.season-countdown svg { color: var(--gold); }
.season-countdown small, .season-countdown strong { display: block; }
.season-countdown small { color: var(--muted); font-size: 7px; }
.season-countdown strong { margin-top: 2px; font-size: 10px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #0d131b; }
.segmented button { min-width: 72px; height: 29px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.segmented button.active { background: var(--surface-3); color: white; }
.filter-bar label { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: #0d131b; color: var(--muted); }
.filter-bar label svg { width: 14px; }
.filter-bar select { border: 0; outline: 0; background: transparent; color: #b6c0cc; font-size: 9px; }
.filter-bar option { background: var(--surface); }
.match-table-head, .full-match-row { display: grid; grid-template-columns: 1.3fr .75fr .75fr .65fr .55fr 74px; align-items: center; gap: 10px; }
.match-table-head { min-height: 34px; padding: 0 14px; border-bottom: 1px solid var(--line); color: #68778a; font-size: 8px; font-weight: 700; }
.full-match-row { min-height: 62px; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); }
.full-match-row:last-child { border-bottom: 0; }
.full-match-row:hover { background: #121a24; }
.full-match-row > span { font-size: 9px; }
.trust-badge { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-size: 8px; }
.trust-badge svg { width: 12px; height: 12px; }

.leaderboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 10px; }
.leaderboard-head, .leaderboard-row { display: grid; grid-template-columns: 55px 1.3fr .8fr .7fr .7fr .7fr .7fr; align-items: center; gap: 8px; padding: 0 13px; }
.leaderboard-head { min-height: 36px; border-bottom: 1px solid var(--line); color: #6e7d90; font-size: 7px; font-weight: 700; }
.leaderboard-row { min-height: 52px; border-bottom: 1px solid var(--line-soft); font-size: 9px; }
.leaderboard-row:last-child { border-bottom: 0; }
.leaderboard-row.me { background: #122031; }
.leaderboard-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.leaderboard-player strong { overflow: hidden; text-overflow: ellipsis; }
.rank-number { color: #77879a; font-weight: 800; }
.rank-number.podium { color: var(--gold); }
.tier-badge { display: inline-block; width: fit-content; padding: 3px 6px; border: 1px solid #574b2d; border-radius: 4px; background: #262115; color: var(--gold); font-size: 7px; font-weight: 800; }
.rank-explainer { padding: 18px; }
.rank-explainer h2 { margin: 14px 0 8px; font-size: 14px; }
.rank-explainer > p { color: var(--muted); font-size: 9px; line-height: 1.6; }
.rank-explainer dl { margin-top: 18px; }
.rank-explainer dl div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 8px; }
.rank-explainer dt { color: #c6d0db; }
.rank-explainer dd { margin: 0; color: var(--muted); }

.wallet-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 10px; }
.wallet-balance { min-height: 250px; padding: 22px; border: 1px solid #2d5278; border-radius: var(--radius); background: #102034; }
.wallet-balance > small { color: #8da4bd; font-size: 9px; }
.wallet-balance > strong { display: block; margin: 8px 0 24px; font-size: 32px; }
.wallet-balance > strong span { color: #8da4bd; font-size: 12px; }
.wallet-balance > div { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 24px; padding: 14px 0; border-top: 1px solid #2e4661; border-bottom: 1px solid #2e4661; }
.wallet-balance > div span + span { padding-left: 15px; border-left: 1px solid #2e4661; }
.wallet-balance small, .wallet-balance b { display: block; }
.wallet-balance div small { color: #7890aa; font-size: 7px; }
.wallet-balance b { margin-top: 5px; font-size: 10px; }
.transaction { min-height: 58px; display: grid; grid-template-columns: 34px minmax(130px, 1fr) .8fr .65fr; align-items: center; gap: 10px; padding: 9px 13px; border-bottom: 1px solid var(--line-soft); }
.transaction:last-child { border-bottom: 0; }
.transaction strong, .transaction small { display: block; }
.transaction strong { font-size: 9px; }
.transaction small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.transaction > b { font-size: 9px; text-align: right; }
.profile-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 10px; }
.profile-card { display: flex; flex-direction: column; align-items: center; padding: 24px; text-align: center; }
.profile-card h2 { margin: 12px 0 3px; font-size: 15px; }
.profile-card > p { margin: 0; color: var(--muted); font-size: 8px; }
.profile-card dl { width: 100%; margin: 20px 0 0; }
.profile-card dl div { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 9px; }
.profile-card dd { margin: 0; font-weight: 800; }
.rating-chart { height: 220px; display: flex; align-items: end; gap: 8px; padding: 28px 22px 20px; }
.rating-chart span { flex: 1; min-width: 5px; border-radius: 3px 3px 0 0; background: #347bbd; transition: height .25s ease; }
.rating-chart span:hover { background: var(--blue-bright); }

.game-heading { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.game-heading > div { display: flex; align-items: center; gap: 10px; }
.game-heading small { color: var(--muted); font-size: 11px; }
.game-heading strong { padding: 5px 8px; border-radius: 4px; background: #17213a; color: var(--blue-bright); font-size: 11px; }
.back-button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 0; border: 0; background: transparent; color: #aeb8c7; font-size: 13px; cursor: pointer; }
.back-button:hover { color: white; }
.game-layout { display: grid; grid-template-columns: minmax(500px, 1fr) 380px; gap: 18px; align-items: start; }
.game-board-column { width: min(100%, 820px); margin: 0 auto; }
.board-player { min-height: 58px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; padding: 7px 2px; }
.board-player > .sprite-avatar, .board-player > .avatar { width: 40px; height: 40px; }
.board-player strong { display: block; font-size: 14px; }
.board-player small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.board-player time { min-width: 92px; padding: 8px 12px; border-radius: 5px; background: #151e2d; color: white; font-size: 24px; font-weight: 700; text-align: center; }
.chess-runtime-stage { position: relative; width: min(100%, 72vh); aspect-ratio: 1; margin: 0 auto; overflow: hidden; background: #111827; box-shadow: 0 18px 50px rgba(0,0,0,.34); }
.chessboard { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.board-square { display: grid; place-items: center; color: #edf3fb; font-family: Georgia, serif; font-size: clamp(24px, 4.2vw, 58px); line-height: 1; text-shadow: 0 2px 3px rgba(0,0,0,.35); }
.board-square.light { background: #b8c5d1; }
.board-square.dark { background: #536b82; }
.board-square.black-piece { color: #111923; text-shadow: 0 1px rgba(255,255,255,.12); }
.runtime-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; background: rgba(4,8,15,.74); text-align: center; backdrop-filter: blur(2px); }
.runtime-overlay svg { width: 38px; height: 38px; color: var(--blue-bright); }
.runtime-overlay strong { font-size: 18px; }
.runtime-overlay span { max-width: 340px; color: #a9b4c2; font-size: 13px; line-height: 1.5; }
.chess-runtime-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #050914; }
.chess-runtime-stage iframe:not([hidden]) { display: block; }
.arena-cg { position: absolute; inset: 0; width: 100%; height: 100%; }
.arena-cg[hidden] { display: none !important; }
.arena-cg cg-board {
  background-color: #aebdca;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.arena-cg cg-board square.last-move { background-color: rgba(58, 166, 255, .42); }
.arena-cg coords { color: rgba(235, 244, 252, .72); font-weight: 700; }
.board-controls { display: grid; grid-template-columns: 40px 40px minmax(120px, 1fr) 40px 40px; align-items: center; gap: 6px; width: min(100%, 72vh); margin: 8px auto 0; }
.board-controls[hidden] { display: none; }
.board-controls .icon-button { width: 40px; height: 36px; background: #111a29; }
.board-controls > span { overflow: hidden; color: #bdc8d5; font-size: 13px; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.empty-state {
  padding: 24px;
  color: #9ba7b7;
  font-size: 14px;
  line-height: 1.5;
}
.game-side-panel { display: grid; gap: 12px; }
.game-info-block { background: #080e1a; }
.game-panel-title { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(117,132,162,.12); }
.game-panel-title small { color: var(--muted); font-size: 10px; }
.game-panel-title h2 { margin: 3px 0 0; font-size: 17px; }
.runtime-health { display: inline-flex; align-items: center; gap: 6px; color: #aeb8c7; font-size: 10px; }
.runtime-health b { width: 7px; height: 7px; border-radius: 50%; background: #68778c; }
.runtime-health.online { color: var(--green); }
.runtime-health.online b { background: var(--green); }
.runtime-health.offline { color: var(--red); }
.runtime-health.offline b { background: var(--red); }
.game-facts { display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding: 6px 16px 14px; }
.game-facts div { padding: 11px 0; border-bottom: 1px solid rgba(117,132,162,.1); }
.game-facts div:nth-child(odd) { padding-right: 12px; }
.game-facts dt { color: var(--muted); font-size: 10px; }
.game-facts dd { margin: 4px 0 0; overflow: hidden; color: #e8eef6; font-size: 13px; font-weight: 700; text-overflow: ellipsis; }
.game-facts dd.pipeline-online { color: var(--green); }
.game-facts dd.pipeline-offline { color: var(--red); }
.match-timeline { margin: 0; padding: 4px 16px 14px; list-style: none; }
.match-timeline li { position: relative; min-height: 48px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 8px; }
.match-timeline li:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 34px; bottom: -8px; width: 1px; background: #263249; }
.match-timeline svg { width: 27px; height: 27px; padding: 6px; border-radius: 50%; background: #17243a; color: var(--blue-bright); }
.match-timeline b { display: block; font-size: 12px; }
.match-timeline small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.runtime-note { display: flex; gap: 11px; padding: 14px 16px; background: #10231f; color: var(--green); }
.runtime-note strong { display: block; font-size: 12px; }
.runtime-note span { display: block; margin-top: 4px; color: #80a997; font-size: 10px; line-height: 1.45; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(3,5,8,.78); backdrop-filter: blur(6px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(420px, 100%); padding: 24px; border: 1px solid #32465d; border-radius: var(--radius); background: #111923; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal h2 { margin: 15px 0 7px; font-size: 17px; }
.modal > p { color: var(--muted); font-size: 10px; line-height: 1.6; }
.modal ol { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: steps; }
.modal li { position: relative; padding: 9px 0 9px 36px; border-top: 1px solid var(--line-soft); counter-increment: steps; }
.modal li::before { content: counter(steps); position: absolute; left: 0; top: 9px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #19324b; color: var(--blue-bright); font-size: 8px; font-weight: 800; }
.modal li b, .modal li span { display: block; font-size: 9px; }
.modal li span { margin-top: 3px; color: var(--muted); }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; max-width: 320px; padding: 11px 14px; border: 1px solid #315b49; border-radius: 6px; background: #12291f; color: #b9f4d7; font-size: 9px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Readable application typography. Never compress operational text to fit a screenshot. */
.brand strong { font-size: 14px; }
.brand small { font-size: 9px; }
.profile-summary strong { font-size: 13px; }
.profile-summary small { font-size: 11px; }
.tier-line { font-size: 10px; }
.nav-groups p { font-size: 9px; }
.nav-link span { font-size: 12px; }
.nav-link small { font-size: 9.5px; }
.invite-card strong { font-size: 10px; }
.invite-card small { font-size: 9px; }
.invite-card button { font-size: 8px; }
.top-tabs a { font-size: 10px; }
.balance-button small { font-size: 9px; }
.balance-button strong, .lichess-link { font-size: 11px; }
.hero h1 { font-size: 34px; }
.hero p { font-size: 12px; }
.primary-button, .secondary-button, .claim-button { font-size: 11px; }
.hero-meta small { font-size: 9.5px; }
.hero-meta strong { font-size: 14px; }
.metric small { font-size: 10px; }
.metric strong { font-size: 15px; }
.metric em { font-size: 9px; }
.section-heading h2 { font-size: 14px; }
.section-heading p, .section-heading a { font-size: 9.5px; }
.match-main strong { font-size: 12px; }
.match-main strong em { font-size: 9px; }
.match-main small { font-size: 9.5px; }
.match-cell small { font-size: 9px; }
.match-cell strong { font-size: 11px; }
.players-joined, .join-button { font-size: 10px; }
.live-pill, .status-pill { font-size: 9px; }
.league-badge small { font-size: 9px; }
.league-badge strong { font-size: 16px; }
.league-badge span, .progress-label { font-size: 9.5px; }
.mini-player .rank, .mini-player strong, .mini-player > b { font-size: 9.5px; }
.mini-player small { font-size: 9px; }
.activity-list b, .activity-list strong { font-size: 9px; }
.activity-list small { font-size: 9px; }
.feature-strip b { font-size: 9px; }
.feature-strip small { font-size: 9px; }
.page-heading p { font-size: 12px; }
.segmented button, .filter-bar select, .full-match-row > span { font-size: 11px; }
.match-table-head, .trust-badge, .leaderboard-head, .tier-badge { font-size: 10px; }
.leaderboard-row { font-size: 11px; }
.rank-explainer > p, .rank-explainer dl div { font-size: 11px; }
.transaction strong, .transaction > b, .profile-card dl div { font-size: 11px; }
.transaction small, .profile-card > p { font-size: 9.5px; }
.modal > p { font-size: 12px; }
.modal li b, .modal li span, .toast { font-size: 11px; }

/* Large-screen application scale. The primary target is 1440-1920px desktop. */
@media (min-width: 1400px) {
  :root { --sidebar: 240px; }

  .brand, .topbar { height: 72px; }
  .brand { padding: 0 20px; gap: 13px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-mark svg { width: 24px; height: 24px; }
  .brand strong { font-size: 17px; }
  .brand small { font-size: 10px; }

  .profile-summary { grid-template-columns: 52px 1fr; gap: 12px; padding: 16px 18px; }
  .avatar-large { width: 52px; height: 52px; }
  .profile-summary strong { font-size: 15px; }
  .profile-summary small { font-size: 13px; }
  .tier-line { margin-left: 64px; font-size: 12px; }

  .nav-groups { padding: 12px 10px; }
  .nav-groups p { margin: 10px 11px 6px; font-size: 11px; }
  .nav-link { min-height: 48px; gap: 12px; padding: 6px 12px; }
  .nav-link svg { width: 19px; height: 19px; }
  .nav-link span { font-size: 14px; }
  .nav-link small { font-size: 11px; }

  .invite-card { min-height: 94px; margin: auto 12px 12px; padding: 14px; }
  .invite-card div { width: 130px; }
  .invite-card img { width: 90px; height: 90px; }
  .invite-card strong { font-size: 13px; }
  .invite-card small { font-size: 11px; }
  .invite-card button { height: 26px; font-size: 10px; }
  .sidebar-foot { padding: 13px 18px 16px; gap: 14px; }
  .sidebar-foot svg { width: 15px; height: 15px; }

  .topbar { padding: 0 22px; }
  .top-tabs a { height: 42px; padding: 0 18px; font-size: 13px; }
  .top-tabs a svg { width: 15px; height: 15px; }
  .icon-button { width: 42px; height: 42px; }
  .icon-button svg { width: 19px; height: 19px; }
  .lichess-link { height: 42px; padding: 0 14px; font-size: 13px; }
  .balance-button { height: 46px; padding: 0 13px; }
  .balance-button small { font-size: 10px; }
  .balance-button strong { font-size: 14px; }
  .top-actions > .avatar { width: 42px; height: 42px; }

  main { max-width: none; padding: 0 20px 20px; }
  #dashboardView.active { grid-template-columns: minmax(0, 1fr) 340px; column-gap: 14px; row-gap: 10px; }
  .hero { min-height: 310px; }
  .hero-content { width: min(620px, 62%); padding: 34px 40px; }
  .hero h1 { margin-bottom: 14px; font-size: 44px; }
  .hero p { max-width: 560px; font-size: 16px; line-height: 1.55; }
  .hero-actions { margin-top: 20px; gap: 12px; }
  .primary-button, .secondary-button, .claim-button { min-height: 44px; padding: 0 18px; font-size: 14px; }

  .metric-grid { gap: 12px; }
  .metric { min-height: 90px; gap: 13px; padding: 14px; }
  .metric-icon { width: 48px; height: 48px; }
  .metric-icon svg { width: 22px; height: 22px; }
  .metric strong { font-size: 19px; }
  .metric small { font-size: 13px; }
  .metric em { font-size: 11px; }

  .section-heading { min-height: 66px; padding: 13px 18px; }
  .section-heading.compact { min-height: 54px; padding: 10px 16px; }
  .section-heading h2 { font-size: 18px; }
  .section-heading p, .section-heading a { font-size: 12px; }
  .match-row { min-height: 72px; gap: 14px; padding: 9px 16px; }
  .mode-icon { width: 44px; height: 44px; }
  .match-main strong { font-size: 15px; }
  .match-main strong em { font-size: 10px; }
  .match-main small { font-size: 12px; }
  .match-cell small { font-size: 11px; }
  .match-cell strong { font-size: 14px; }
  .players-joined, .join-button { font-size: 12px; }
  .join-button { height: 38px; }

  .league-badge { gap: 16px; padding: 15px 18px 10px; }
  .league-badge > img { width: 68px; height: 68px; }
  .league-badge small { font-size: 11px; }
  .league-badge strong { font-size: 20px; }
  .league-badge span, .progress-label { font-size: 11px; }
  .mini-player { min-height: 44px; grid-template-columns: 22px 34px 1fr auto; gap: 9px; padding: 5px 13px; }
  .mini-avatar { width: 32px; height: 32px; }
  .mini-player .rank, .mini-player strong, .mini-player > b { font-size: 12px; }
  .mini-player small { font-size: 10px; }
  .activity-list > div { min-height: 50px; grid-template-columns: 34px 1fr auto; gap: 9px; padding: 7px 13px; }
  .activity-list .sprite-avatar { width: 32px; height: 32px; }
  .activity-list b, .activity-list strong { font-size: 11px; }
  .activity-list small { font-size: 10px; }

  .feature-strip { min-height: 64px; }
  .feature-strip > span { grid-template-columns: 34px 1fr; padding: 0 16px; }
  .feature-strip svg { width: 22px; height: 22px; }
  .feature-strip b { font-size: 12px; }
  .feature-strip small { font-size: 10px; }
}

@media (max-width: 960px) {
  :root { --sidebar: 72px; }
  .brand { justify-content: center; padding: 0; }
  .brand > span:last-child, .profile-summary > div, .profile-summary .tier-line, .nav-link span, .nav-groups p, .invite-card, .sidebar-foot { display: none; }
  .profile-summary { display: flex; justify-content: center; padding: 14px 0; }
  .nav-link { justify-content: center; height: 42px; padding: 0; }
  .nav-link svg { width: 18px; height: 18px; }
  #dashboardView.active { display: block; }
  .dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: start; gap: 10px; }
  #dashboardView .right-column { grid-column: auto; grid-row: auto; }
  #dashboardView .metric-grid { margin: 10px 0; }
}

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .leaderboard-layout, .wallet-grid { grid-template-columns: 1fr; }
  .dashboard-grid { display: grid; }
  #dashboardView .matches-panel, #dashboardView .right-column { grid-column: 1; grid-row: auto; }
  #dashboardView .feature-strip { grid-column: 1; grid-row: auto; }
  .right-column { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .match-row { grid-template-columns: minmax(150px, 1.4fr) .8fr .8fr 70px; }
  .match-row .players-joined { display: none; }
  .leaderboard-table { overflow-x: auto; }
  .leaderboard-head, .leaderboard-row { min-width: 720px; }
  .profile-grid { grid-template-columns: 240px 1fr; }
  .game-layout { grid-template-columns: 1fr; }
  .game-side-panel { grid-template-columns: 1fr 1fr; }
  .runtime-note { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 230px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 18px 0 50px rgba(0,0,0,.45); }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand { justify-content: flex-start; padding: 0 16px; }
  .sidebar .brand > span:last-child, .sidebar .profile-summary > div, .sidebar .nav-link span, .sidebar .nav-groups p, .sidebar .invite-card, .sidebar .sidebar-foot { display: flex; }
  .sidebar .profile-summary { display: grid; justify-content: normal; padding: 16px 14px; }
  .sidebar .nav-link { justify-content: flex-start; height: auto; padding: 6px 9px; }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 0 10px; }
  .top-tabs { display: none; }
  .lichess-link span, .balance-button small, .balance-button > svg:last-child { display: none; }
  .balance-button { padding: 0 8px; }
  main { padding: 9px; }
  .hero { min-height: 410px; }
  .hero > img { object-position: 65% center; }
  .hero-shade { background: linear-gradient(180deg, rgba(7,10,14,.35), rgba(7,10,14,.95) 68%); }
  .hero-content { position: absolute; inset: auto 0 65px; width: 100%; padding: 20px; }
  .hero h1 { font-size: 32px; }
  .hero-content p { font-size: 11px; }
  .hero-meta { display: grid; width: 100%; padding: 0 20px 16px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { align-items: flex-start; }
  .right-column { grid-template-columns: 1fr; }
  .feature-strip { grid-template-columns: 1fr 1fr; }
  .feature-strip > span { min-height: 44px; border-bottom: 1px solid var(--line-soft); }
  .match-row { grid-template-columns: 1fr 70px; }
  .match-row .match-cell { display: none; }
  .page-heading { align-items: flex-start; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .segmented { display: grid; grid-template-columns: repeat(4, 1fr); }
  .segmented button { min-width: 0; }
  .match-table { overflow-x: auto; }
  .match-table-head, .full-match-row { min-width: 700px; }
  .profile-grid { grid-template-columns: 1fr; }
  .game-heading { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .game-layout { display: block; }
  .game-side-panel { grid-template-columns: 1fr; margin-top: 14px; }
  .board-player time { min-width: 72px; font-size: 18px; }
  .chess-runtime-stage { width: 100%; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr; }
  .hero-actions { align-items: stretch; flex-direction: column; width: 170px; }
  .hero-meta { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .hero-meta span + span { padding-left: 8px; }
  .page-heading { flex-direction: column; }
  .wallet-balance > strong { font-size: 27px; }
}
