:root {
  color-scheme: dark;
  --bg: #0b111b;
  --surface: #121a27;
  --surface-raised: #1a2434;
  --line: #263449;
  --text: #e8ecf2;
  --muted: #9aa8bb;
  --accent: #f97316;
  --accent-text: #fb923c;
  --success: #34d399;
  --danger: #f87171;
  --radius: 16px;
  --rail: 220px;
  /* Clash colors are independent so the two sides can be tuned together. */
  --clash-you: #17345b;
  --clash-opponent: #212b3b;
  --clash-edge: #f97316;
  --clash-your-muted: #c0d5f0;
  --clash-opponent-muted: #c9d1dd;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 'DM Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a, summary, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button, summary { cursor: pointer; }
button:disabled, input:disabled { cursor: default; opacity: .44; }
a { color: var(--accent-text); text-decoration: none; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 4px; }
svg { width: 22px; height: 22px; flex: none; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-weight: 700; letter-spacing: -.015em; line-height: 1.08; }
h1 { font-size: 46px; }
h2 { font-size: 30px; }
h3 { font-size: 25px; }
p { margin: 10px 0; }
button { border: 0; }
.primary, .secondary { min-height: 52px; width: 100%; padding: 13px 18px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; font-weight: 600; line-height: 1.4; text-align: center; transition: background .15s, border-color .15s; }
.primary { background: var(--accent); color: var(--bg); border: 1px solid transparent; }
.primary:hover:not(:disabled) { background: #fb923c; }
.secondary { color: var(--text); background: transparent; border: 1px solid #384a63; }
.secondary:hover:not(:disabled) { background: #ffffff05; border-color: #7186a3; }
.button-row { display: flex; gap: 12px; }
.button-row > * { flex: 1; min-width: 0; }
.button-arrow { margin-left: auto; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-width: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--text); }
.icon-button:hover { background: #ffffff07; }
.text-link, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 13px 'DM Sans', sans-serif; color: var(--accent-text); background: transparent; border: 0; min-height: 44px; padding: 6px 0; }
.text-link svg, .text-button svg { width: 17px; height: 17px; }
label { display: block; margin: 18px 0 7px; font-size: 13px; color: var(--muted); }
input, select { width: 100%; min-height: 52px; border-radius: var(--radius); padding: 12px 16px; background: var(--surface); color: var(--text); border: 1px solid #384a63; font-size: 16px; }
input::placeholder { color: #7e8ca1; }
input:focus, select:focus { border-color: var(--accent-text); }
input:disabled { opacity: .65; }
.accent { color: var(--accent-text); }
.muted, .small, .tiny { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; line-height: 1.6; }
.eyebrow { font-size: 11px; letter-spacing: .11em; font-weight: 600; color: var(--muted); margin: 0 0 9px; }
.tag { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #3a4b63; border-radius: 999px; padding: 5px 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.tag[data-state=connected] { color: var(--success); border-color: #276752; }
.tag[data-state=error] { color: var(--danger); border-color: #8b4646; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.section-heading h2 { font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 600; letter-spacing: 0; line-height: 1.5; }
.section-heading > .text-link { margin: -10px 0; }
.empty-note { padding: 20px 0; font-size: 14px; color: var(--muted); line-height: 1.7; }
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 38px 12px; text-align: center; }
.empty-state > svg { color: var(--accent-text); height: 32px; width: 32px; margin-bottom: 18px; }
.empty-state p { color: var(--muted); max-width: 420px; font-size: 14px; margin: 14px 0 24px; }
.empty-state > .primary, .empty-state > .secondary { max-width: 350px; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.avatar { display: grid; place-items: center; border-radius: 50%; background: #2c394b; color: var(--text); font-weight: 700; flex-shrink: 0; }
.avatar-small { width: 36px; height: 36px; font-size: 18px; }
.avatar-large { width: 76px; height: 76px; font-size: 36px; }
.error { color: #fca5a5 !important; }
#message { color: var(--accent-text); font-size: 13px; overflow-wrap: anywhere; }
#message:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Persistent desktop rail; the same navigation becomes a mobile bottom bar. */
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: var(--rail); padding: 30px 22px; background: #0e1623; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { color: var(--text); font: 700 34px 'Barlow Condensed', sans-serif; letter-spacing: -.035em; display: inline-flex; gap: 0; align-items: baseline; }
.brand span { color: var(--text); }
.brand i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 3px; }
.sidebar-caption { margin: 6px 0 38px; color: #75869f; font-size: 8px; letter-spacing: .12em; }
.main-nav { display: flex; flex-direction: column; gap: 8px; }
.main-nav a { color: var(--muted); display: flex; align-items: center; gap: 14px; border-radius: 12px; padding: 13px 15px; min-height: 52px; font-size: 14px; font-weight: 600; }
.main-nav a:hover { color: var(--text); background: #ffffff03; }
.main-nav a[aria-current=page] { color: var(--accent-text); background: #f9731614; }
.sidebar-play { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--line); margin-top: 25px; padding: 24px 15px; font-size: 14px; font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 20px 10px 0; }
.sidebar-footer p { color: #75869f; font-size: 11px; }
.app-header { min-height: 92px; margin-left: var(--rail); padding: 20px 44px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.mobile-brand { display: none; }
.header-status { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-player { display: flex; align-items: center; gap: 12px; color: var(--text); text-align: right; }
.header-player strong { font-size: 14px; display: block; max-width: 170px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.header-player small { color: var(--muted); display: block; font-size: 11px; margin-top: 1px; }
.header-actions > button { color: var(--muted); }
.app-main { max-width: 1300px; margin-left: var(--rail); padding: 34px 44px 60px; }
.page-heading { display: flex; gap: 12px; align-items: center; margin-bottom: 30px; }
.page-heading .back-button { margin-left: -12px; }
.page-heading .eyebrow { font-size: 10px; margin-bottom: 4px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Home is the reference dashboard, with data from the player's own history. */
.welcome-strip { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.welcome-strip h1 { font-size: 44px; }
.welcome-strip .eyebrow { font-size: 10px; }
.home-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
.home-start { display: flex; flex-direction: column; gap: 14px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: center; }
.summary-grid > div { min-width: 0; }
.summary-grid span { color: var(--muted); font-size: 13px; }
.summary-grid strong { display: block; font: 700 38px 'Barlow Condensed', sans-serif; margin: 3px 0; line-height: 1.15; }
.summary-grid small { display: block; font-size: 10px; color: #8394ae; }
.home-summary { padding: 23px 15px; }
.home-play { justify-content: flex-start; padding: 17px 22px; font-size: 17px; min-height: 60px; }
.home-start > .secondary { justify-content: flex-start; padding-left: 22px; }
.home-start > .tiny { margin: 2px 0; }
.personal-record { display: flex; gap: 14px; align-items: center; border-top: 1px solid var(--line); padding: 23px 0; margin-top: 8px; }
.record-icon { display: grid; place-items: center; height: 43px; width: 43px; color: var(--accent-text); background: #f9731610; border-radius: 12px; flex-shrink: 0; }
.personal-record strong { display: block; font: 700 32px 'Barlow Condensed', sans-serif; line-height: 1.15; }
.personal-record small { font: 400 12px 'DM Sans', sans-serif; color: var(--muted); }
.personal-record .tiny { margin: 3px 0 0; font-size: 10px; }
.personal-record > a { margin-left: auto; }
.history-section > .section-heading { margin: 0 0 17px; min-height: 24px; }
.history-section > .tiny { font-size: 11px; margin-top: 15px; }
.history-panel { padding: 0 20px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li + li { border-top: 1px solid var(--line); }
.history-link { display: flex; gap: 16px; align-items: center; justify-content: space-between; color: var(--text); padding: 16px 0; min-height: 82px; }
.history-link:hover .history-name { color: var(--accent-text); }
.history-name { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.history-score { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.history-meta { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.outcome-badge { border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #64748b20; color: #bac5d5; }
.outcome-badge.win { background: #34d3991c; color: var(--success); }
.outcome-badge.loss { background: #f871711c; color: var(--danger); }
.outcome-badge.provisional { background: #f9731614; color: var(--accent-text); }

/* Mode chooser and live lobby are distinct states. */
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.mode-card { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.mode-title { display: flex; gap: 14px; align-items: center; }
.mode-title > svg { color: var(--accent-text); width: 26px; height: 26px; }
.mode-title h2 { font-size: 30px; }
.mode-title p { font-size: 13px; color: var(--muted); margin: 5px 0 0; }
.mode-card .button-row { margin-top: auto; }
.mode-card > .tiny { font-size: 11px; margin: -5px 0 0; }
.mode-card > .text-link { justify-content: flex-start; min-height: 24px; }
.mode-card .primary > .tiny { font-size: 10px; color: inherit; }
.unavailable-card { background: #101825; }
.join-form label { margin-top: 0; }
.join-row { display: flex; gap: 10px; }
.join-row input { width: 100%; min-width: 0; text-transform: uppercase; letter-spacing: .13em; }
.join-row button { width: 85px; flex-shrink: 0; }
.lobby-status { color: var(--muted); font-size: 13px; margin: 20px 0 0; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 25px; align-items: start; }
.lobby-card { text-align: center; padding: 28px; }
.lobby-search-symbol { width: 58px; height: 58px; margin: 8px auto 22px; border: 1px solid #f9731640; border-radius: 50%; color: var(--accent-text); background: #f973160a; display: grid; place-items: center; }
.lobby-card h2 { font-size: 35px; }
.wait-clock { display: flex; flex-direction: column; gap: 4px; margin: 26px 0; }
.wait-clock span { color: var(--muted); font-size: 13px; }
.wait-clock strong { font: 700 44px 'Barlow Condensed', sans-serif; }
.room-code-box { position: relative; padding: 22px 12px 10px; margin: 20px 0; border: 1px dashed #40516a; border-radius: 14px; background: var(--bg); }
.room-code-box > span { display: block; color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.room-code-box > strong { display: block; margin: 8px 0 0; font: 700 38px 'Barlow Condensed', sans-serif; letter-spacing: .12em; color: var(--accent-text); }
.players { padding: 0; list-style: none; margin: 20px 0; text-align: left; }
.players li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 13px; }
.players li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.player-ready, .player-waiting { font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.player-ready { color: var(--success); }
.player-waiting { color: var(--muted); }
#leave { margin-top: 14px; }
.queue-fallback { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 25px; }
.queue-fallback > p { font-size: 13px; color: var(--muted); }
.tip-box { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); text-align: left; padding-top: 20px; margin-top: 30px; }
.tip-box > span { color: var(--accent-text); font-size: 12px; font-weight: 600; }
.tip-box p { color: var(--muted); font-size: 13px; margin: 0; }
.camera-setup h2 { font-size: 22px; }
.setup-preview { aspect-ratio: 4/3; position: relative; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.setup-preview video { width: 100%; height: 100%; object-fit: contain; }
#setup-placeholder { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px; color: var(--muted); }
#setup-placeholder svg { width: 30px; height: 30px; margin-bottom: 15px; }
#setup-placeholder strong { color: var(--text); font-size: 14px; }
#setup-placeholder p { max-width: 230px; font-size: 12px; }
.front-camera { transform: scaleX(-1); }
.camera-setup > .secondary { margin-top: 12px; }
.camera-setup > .small { font-size: 12px; margin-top: 14px; }
.sharing-note { border-top: 1px solid var(--line); display: flex; gap: 10px; padding-top: 18px; margin-top: 18px; }
.sharing-note > svg { width: 18px; height: 18px; margin-top: 2px; color: var(--accent-text); }
.sharing-note strong { font-size: 12px; font-weight: 600; }
.sharing-note p { font-size: 11px; color: var(--muted); margin: 4px 0 0; }

/* Profile, stats and genuine empty states. */
.profile-identity { display: flex; gap: 22px; align-items: center; margin: 16px 0 30px; }
.profile-identity h1 { font-size: 42px; }
.profile-identity p { margin: 5px 0 9px; font-size: 13px; }
.profile-main > .panel { max-width: none; padding: 26px; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 24px 0; }
.chart-empty { height: 210px; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; isolation: isolate; text-align: center; overflow: hidden; }
.chart-grid { position: absolute; inset: 15px 0; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent, transparent 39px, #26344970 40px); z-index: -1; }
.chart-empty strong { font: 700 28px 'Barlow Condensed', sans-serif; background: var(--surface); padding: 4px 14px; }
.chart-empty p { background: var(--surface); font-size: 12px; color: var(--muted); padding: 2px 12px; max-width: 290px; margin-top: 7px; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; }
.calendar-weekdays { margin-bottom: 9px; color: var(--muted); font-size: 11px; }
.calendar-days > span { min-height: 33px; display: grid; place-items: center; border-radius: 8px; background: #1e2938; color: var(--muted); font-size: 12px; }
.calendar-days > .calendar-blank { background: transparent; }
.calendar-days > .played { background: #f9731630; color: #fdba74; border: 1px solid #a65021; }
.calendar-days > .today { outline: 1px solid #708099; outline-offset: 1px; }
.calendar-legend { font-size: 11px; color: var(--muted); margin-top: 14px; }
.calendar-legend span { display: flex; align-items: center; gap: 7px; }
.calendar-legend i { display: inline-block; width: 10px; height: 10px; background: #f9731650; border: 1px solid #a65021; border-radius: 3px; }
.gap-card h3 { font: 600 16px 'DM Sans', sans-serif; line-height: 1.5; }
.gap-card p { color: var(--muted); font-size: 13px; margin-top: 10px; }
.settings-panel > summary { display: flex; justify-content: space-between; min-height: 35px; font-weight: 600; font-size: 15px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.settings-grid form > button { margin-top: 18px; }
.settings-actions { display: flex; gap: 12px; border-top: 1px solid var(--line); margin-top: 26px; padding-top: 22px; }
.settings-actions > * { flex: 1; }
.stats-rating-grid { display: grid; grid-template-columns: 1.5fr .8fr; gap: 22px; }
.percentile-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.percentile-panel > strong { font: 700 64px 'Barlow Condensed', sans-serif; }
.percentile-panel p { color: var(--muted); font-size: 12px; max-width: 210px; }
.stats-section { margin-top: 30px; }
.performance-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.performance-grid .panel > span { color: var(--muted); font-size: 12px; }
.performance-grid strong { display: block; font: 700 40px 'Barlow Condensed', sans-serif; margin-top: 6px; }
.performance-grid small { color: var(--muted); font-size: 10px; display: block; margin-top: 8px; }
.stats-activity-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 22px; }
.score-chart { min-height: 240px; display: flex; align-items: center; position: relative; }
.score-chart svg { width: 100%; height: 240px; overflow: visible; }
.score-chart .empty-note { text-align: center; padding: 30px; }
.chart-axis { fill: var(--muted); font: 11px 'DM Sans', sans-serif; }
.search-field { position: relative; }
.search-field > svg { position: absolute; top: 15px; left: 15px; color: var(--muted); }
.search-field input { padding-left: 47px; }
.friends-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.social-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.social-row > div:first-child { min-width:0; }
.social-row strong, .social-row small { display:block; }
.social-row small { margin-top:6px; color:var(--muted); font-size:12px; }
.social-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.social-actions button { min-height:44px; padding:10px 14px; }
.social-actions > button { width:auto; flex:none; }
.page-friends .page-heading, .page-inbox .page-heading { justify-content:space-between; flex-wrap:wrap; }
.page-friends .page-heading > div, .page-inbox .page-heading > h1 { flex:1; min-width:150px; }
.page-friends .page-heading h1 { white-space:nowrap; }
.page-friends .page-heading > .secondary, .page-inbox .page-heading > .secondary { width:auto; flex:none; }
.page-friends .search-field { display:flex; align-items:stretch; gap:8px; }
.page-friends .search-field input { min-width:0; flex:1; }
.page-friends .search-field .primary { width:auto; flex:none; }
.inbox-link { color:var(--accent-text); font-size:13px; padding:12px 8px; white-space:nowrap; }
.notification-unread { border-left:3px solid var(--accent); padding-left:14px; }
.support-report { margin-top:20px; text-align:left; border-top:1px solid var(--line); padding-top:18px; }
.support-report form { display:grid; gap:12px; padding-top:14px; }
.support-report textarea { min-height:90px; resize:vertical; }
.support-report textarea, #review-form textarea { width:100%; padding:12px; background:var(--surface); color:var(--text); border:1px solid #384a63; border-radius:12px; font:inherit; }
#review-metrics { white-space:pre-wrap; overflow-wrap:anywhere; max-height:400px; overflow:auto; }
.support-report .checkbox-row { display:flex; align-items:flex-start; gap:10px; line-height:1.6; }
.support-report .checkbox-row input { width:20px; height:20px; margin-top:3px; flex:none; }
.review-canvas { width:100%; height:auto; background:#09111d; border:1px solid var(--line); border-radius:12px; }
@media(max-width:700px) { .social-row { align-items:flex-start; flex-direction:column; } .social-actions { justify-content:flex-start; } .inbox-link { font-size:11px; padding:10px 4px; } .page-inbox .page-heading { flex-wrap:wrap; } }
.skills-hero { display: flex; gap: 30px; align-items: center; padding: 38px; margin-bottom: 24px; }
.skill-icon { width: 100px; height: 100px; border: 1px solid #f9731640; border-radius: 50%; background: #f973160a; display: grid; place-items: center; flex-shrink: 0; color: var(--accent-text); }
.skill-icon svg { height: 46px; width: 46px; }
.skills-hero h2 { font-size: 40px; margin-top: 16px; }
.skills-hero p { color: var(--muted); max-width: 560px; font-size: 14px; margin: 15px 0 25px; }
.skills-hero .primary { width: auto; min-width: 260px; }

/* Logged-out home and account screen. */
.public-header { max-width: 1280px; padding: 25px 44px; display: flex; align-items: center; justify-content: space-between; margin: auto; }
.landing-main { max-width: 1200px; margin: 0 auto; padding: 35px 44px 60px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 90px; align-items: center; }
.landing-copy h1 { font-size: clamp(66px, 6vw, 90px); line-height: 1.02; margin: 15px 0 25px; letter-spacing: -.025em; }
.landing-copy h1 > span { color: var(--accent-text); }
.landing-description { color: var(--muted); font-size: 17px; line-height: 1.6; }
.landing-clash { height: 150px; position: relative; border-radius: 16px; background: linear-gradient(160deg, var(--clash-you) 49.5%, var(--clash-edge) 49.6%, var(--clash-edge) 50.2%, var(--clash-opponent) 50.3%); overflow: hidden; margin-top: 30px; }
.landing-clash > div { position: absolute; display: flex; flex-direction: column; gap: 4px; left: 20px; top: 18px; }
.landing-clash > div:nth-child(2) { inset: auto 20px 18px auto; text-align: right; }
.landing-clash span { font-size: 9px; letter-spacing: .1em; color: #c0d5f0; }
.landing-clash strong { font-size: 18px; font-weight: 600; }
.landing-clash small { font-size: 11px; color: #b8c6d9; }
.landing-clash .landing-vs { position: absolute; top: calc(50% - 17px); left: calc(50% - 17px); display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--accent); border-radius: 50%; background: var(--bg); color: var(--text); font-size: 11px; font-weight: 700; }
.landing-flow { font-size: 12px; color: var(--muted); text-align: center; margin: 18px 0 26px; }
.landing-flow i { color: var(--accent-text); font-style: normal; padding: 0 9px; }
.landing-actions { display: flex; flex-direction: column; gap: 12px; }
.landing-actions > p { font-size: 11px; text-align: center; margin: 0; }
.account-panel { display: none; padding: 30px; }
.account-panel h2 { font-size: 38px; margin-top: 9px; }
.account-panel .account-back { display: none; }
.tabs { display: flex; gap: 4px; padding: 4px; background: #1e2938; border-radius: 14px; margin: 22px 0; }
.tabs button { flex: 1; min-height: 44px; border-radius: 10px; color: var(--text); background: transparent; font-weight: 600; font-size: 14px; }
.tabs button.active { color: var(--bg); background: var(--accent); }
.password-field { position: relative; }
.password-field input { padding-right: 52px; }
.password-field .icon-button { position: absolute; right: 4px; top: 4px; color: var(--muted); }
.account-panel form > .primary { margin-top: 24px; }
.account-panel form > .tiny { font-size: 11px; margin-top: 13px; }
.auth-footnote { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; font-size: 11px; color: var(--muted); }
.landing-desktop-note { border-left: 1px solid var(--line); padding-left: 45px; }
.landing-desktop-note h2 { font-size: 56px; margin: 20px 0; }
.landing-desktop-note p { color: var(--muted); font-size: 15px; margin: 20px 0 30px; }
body[data-auth-view=true] .account-panel { display: block; }
body[data-auth-view=true] .landing-actions, body[data-auth-view=true] .landing-desktop-note { display: none; }
.social-auth { display: grid; gap: 8px; margin: 18px 0; }
.social-auth .secondary { margin: 0; width: 100%; }
.social-auth .secondary:disabled { opacity: .45; cursor: not-allowed; }
.register-only > label, .completion-panel form > label { display: block; margin-top: 13px; }
.account-panel select, .completion-panel select { width: 100%; }
.consent-list { display: grid; gap: 10px; margin: 18px 0; }
.consent-list label { display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 10px; align-items: start; margin:0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.consent-list label > span { min-width:0; }
.consent-list input[type=checkbox] { width:18px; height:18px; min-height:18px; padding:0; margin:2px 0 0; align-self:start; }
.consent-list a { color: var(--accent-text); }
.login-only { margin-top: 14px; }
.completion-main, .policy-main { width: min(720px, calc(100% - 32px)); margin: 46px auto 90px; }
.completion-panel, .policy-panel { padding: clamp(24px, 5vw, 44px); }
.completion-panel h1, .policy-panel h1 { font-size: clamp(38px, 7vw, 62px); margin: 8px 0 14px; }
.completion-panel form { margin-top: 24px; }
.completion-panel .primary { margin-top: 18px; width: 100%; }
.completion-panel [data-profile-step] > label:first-child, .account-panel [data-signup-step] > label:first-child { margin-top:20px; }
.completion-panel [data-profile-step] { animation: setup-appear .16s ease-out; }
@keyframes setup-appear { from { opacity:.5; transform:translateY(4px); } to { opacity:1; transform:none; } }
@media(prefers-reduced-motion:reduce) { .completion-panel [data-profile-step] { animation:none; } }
.verification-step { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }
.verification-step .secondary { width: 100%; }
.policy-panel p { line-height: 1.7; }
.identity-settings { display: grid; gap: 10px; align-content: start; }
.identity-settings p { margin: 0; }
.identity-settings .secondary { width: 100%; margin: 0; text-align: center; }
.danger-button { margin-top: 10px; border: 1px solid #8f3030; background: transparent; color: #ffb4b4; padding: 12px 16px; cursor: pointer; }

/* Camera setup, Clash, Record, verification and results. */
.duel-main { max-width: none; }
.match-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.match-heading h1 { font-size: 36px; }
.match-heading .eyebrow { font-size: 9px; margin-bottom: 3px; }
.match-heading > .tag { margin-left: auto; }
.notice { color: var(--muted); font-size: 12px; margin: 0 0 22px; }
.duel-card { position: relative; display: grid; gap: 20px; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); grid-template-areas: 'status status' 'controls camera' 'details details' 'bottom bottom'; }
.duel-topline { grid-area: status; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.duel-topline p { color: var(--muted); font-size: 12px; margin: 0; }
.duel-topline > .tag { font-size: 10px; }
.camera-controls { grid-area: controls; }
.camera-controls h2 { font-size: 36px; }
.camera-controls p { color: var(--muted); font-size: 13px; }
.camera-controls #connect { margin-top: 20px; }
.camera-stage { grid-area: camera; position: relative; min-height: 280px; aspect-ratio: 16/10; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.camera-stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
#camera-placeholder { position: absolute; inset: 0; color: #718198; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; font-size: 12px; }
#camera-placeholder svg { height: 32px; width: 32px; }
.record-hud { position: absolute; top: 15px; left: 15px; right: 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.record-hud > div { display: flex; align-items: center; gap: 8px; background: #0b111bde; border: 1px solid #ffffff0a; border-radius: 999px; padding: 7px 13px; min-height: 40px; }
.hud-player { max-width: 45%; }
.hud-player > span { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-player small { font-size: 10px; color: var(--muted); }
.hud-clock strong { font: 700 29px/1 'Barlow Condensed', sans-serif; font-variant-numeric: tabular-nums; }
.hud-clock svg, .hud-privacy svg { height: 18px; width: 18px; }
.hud-privacy span { font-size: 11px; }
.record-indicator { display: none; position: absolute; left: 20px; bottom: 20px; font-size: 10px; letter-spacing: .08em; padding: 6px 10px; border-radius: 5px; background: #0b111bcc; align-items: center; gap: 6px; }
.record-indicator > i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.scoreboard, .processing-lag, .result-actions, .diagnostics, .duel-bottom, .result-breakdown, .duel-warning, .result-panel, .verification, .reaction-panel, .tracking-panel { min-width: 0; }
.scoreboard { display: none; grid-area: scores; }
.duel-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.score-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 19px; display: flex; flex-direction: column; gap: 6px; }
.score-label { display: flex; align-items: center; gap: 9px; min-width: 0; }
.score-label small { font-size: 12px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.score-label .avatar-small { width: 28px; height: 28px; font-size: 12px; }
.score-card > strong { font: 700 56px/1 'Barlow Condensed', sans-serif; margin-top: 9px; }
.score-mine > strong { color: var(--accent-text); }
.score-card > span, .running-streak { font-size: 12px; color: var(--muted); }
.score-card > .result-video { display: none; }
.processing-lag { grid-area: lag; color: var(--muted); font-size: 12px; margin: 0; }
.tracking-panel { grid-area: tracking; display: grid; grid-template-columns: 100px 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.tracking-label { grid-column: 1/-1; padding: 8px 12px; display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); border-bottom: 1px solid var(--line); }
#analysed-preview { width: 100px; height: 80px; object-fit: contain; align-self: center; }
.tracking-panel p { font-size: 10px; padding: 7px 12px; margin: 0; align-self: center; }
.duel-warning { grid-area: warning; font-size: 12px; color: #fdba74; margin: 0; }
.duel-warning:empty { display: none; }
.duel-bottom { grid-area: bottom; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.duel-bottom > a { margin-right: auto; }
.duel-bottom > button { width: 145px; min-height: 48px; }
.resign-button { border-color: #79505b; color: #fca5a5; }
.diagnostics { grid-area: details; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 11px; }
.diagnostics summary { min-height: 35px; }
.diagnostics p { font-size: 11px; overflow-wrap: anywhere; }
.clash-screen { position: fixed; z-index: 30; inset: 0 0 0 var(--rail); background: var(--clash-opponent); overflow: auto; }
.clash-screen::before { content: ''; position: absolute; inset: 0; background: var(--clash-you); clip-path: polygon(0 0, 100% 0, 0 100%); }
.clash-screen::after { content: ''; position: absolute; inset: 0; background: var(--clash-edge); clip-path: polygon(99.7% 0, 100% 0, .3% 100%, 0 100%); pointer-events: none; }
.clash-side { position: absolute; width: min(50%, 480px); padding: 34px; z-index: 1; }
.clash-you { left: 4%; top: 6%; color: var(--clash-your-muted); }
.clash-opponent { right: 4%; bottom: 6%; text-align: right; color: var(--clash-opponent-muted); }
.clash-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.clash-side h2 { color: #f6f8fc; font-family: 'DM Sans', sans-serif; font-size: clamp(28px, 3vw, 44px); line-height: 1.15; margin: 12px 0 8px; letter-spacing: -.025em; overflow-wrap: anywhere; }
.clash-side p { font-size: 13px; margin: 0; }
.clash-metrics { display: flex; gap: 32px; margin-top: 25px; }
.clash-metrics span { font-size: 11px; display: block; }
.clash-metrics strong { color: #f4f7fc; font: 700 32px 'Barlow Condensed', sans-serif; display: block; margin-top: 5px; }
.clash-opponent .clash-metrics { justify-content: flex-end; }
.countdown-display { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; width: 100px; height: 100px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); border: 3px solid var(--clash-edge); font: 700 68px/1 'Barlow Condensed', sans-serif; box-shadow: 0 0 0 10px #0b111b20; }
.clash-brand { position: absolute; right: 28px; top: 24px; color: #cbd5e1; font: 700 26px 'Barlow Condensed', sans-serif; }
.clash-resign { position: absolute; z-index: 4; bottom: 20px; left: 28px; font-size: 12px; color: #e2e8f0; }
body[data-match-stage=record] .duel-main { padding-top: 22px; }
body[data-match-stage=record] .match-heading, body[data-match-stage=record] .notice { display: none; }
[data-stage=record] .duel-card { grid-template-columns: minmax(0, 1.6fr) minmax(290px, .8fr); grid-template-areas: 'camera status' 'camera scores' 'camera lag' 'camera tracking' 'warning warning' 'bottom bottom' 'details details'; align-items: start; }
[data-stage=record] .camera-stage { min-height: min(65vh, 700px); aspect-ratio: auto; align-self: stretch; }
[data-stage=record] .duel-topline { flex-direction: column; align-items: flex-start; gap: 8px; }
[data-stage=record] .scoreboard { display: block; }
[data-stage=record] .score-card { padding: 14px; }
[data-stage=record] .score-card > strong { font-size: 47px; }
[data-stage=record] .score-label .avatar { display: none; }
[data-stage=record] .record-indicator { display: flex; }
[data-stage=record] .running-streak { display: none; }
[data-stage=verification] .duel-card { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); grid-template-areas: 'status status' 'verification reaction' 'verification scores' 'verification warning' 'bottom bottom' 'details details'; align-items: start; }
[data-stage=verification] .scoreboard { display: block; }
[data-stage=verification] .tracking-panel { display: none; }
.reaction-panel { grid-area: reaction; text-align: center; }
.reaction-panel > p { margin: 0 0 12px; font-size: 10px; }
.reaction-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.reaction-list button { border: 1px solid #384a63; background: transparent; padding: 6px 10px; min-height: 32px; border-radius: 999px; font-size: 12px; color: var(--text); opacity: .5; }
.verification { grid-area: verification; padding: 28px; text-align: center; }
.verification-heading h2 { font-size: 36px; margin-top: 15px; }
.verification-heading p { color: var(--muted); font-size: 13px; margin: 9px 0 22px; }
.verification-spinner { display: inline-block; width: 38px; height: 38px; border: 3px solid #3c2d24; border-top-color: var(--accent); border-radius: 50%; animation: turn 1.2s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
progress { appearance: none; border: 0; background: #263449; overflow: hidden; border-radius: 999px; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #263449; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
#verification-bar { width: 100%; height: 10px; display: block; margin-top: 18px; }
#verification-percent { display: block; margin: 12px 0 22px; font-size: 14px; }
.verification-steps { padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; text-align: left; margin: 0; }
.verification-steps li { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 7px; }
.verification-steps li::before { content: ''; display: inline-block; width: 13px; height: 13px; border: 1px solid #4b5d76; border-radius: 50%; flex: none; }
.verification-steps .done { color: #d3dde9; }
.verification-steps .done::before { background: var(--success); border-color: var(--success); box-shadow: inset 0 0 0 3px var(--surface); }
.verification-steps .current::before { border-color: var(--accent-text); background: #f9731633; }
.verification-timelines { text-align: left; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 22px; }
.verification-timelines p { font-size: 11px; color: var(--muted); margin: 5px 0; line-height: 1.7; }
.verification-timelines #verification-estimate { color: #d3dde9; margin-top: 12px; }
[data-stage=result] .duel-card { max-width: 1000px; margin: auto; grid-template-columns: 1fr; grid-template-areas: 'status' 'result' 'scores' 'breakdown' 'actions' 'bottom' 'details'; }
[data-stage=result] .scoreboard { display: block; }
.result-panel { grid-area: result; text-align: center; padding: 12px 0 4px; }
.result-symbol { color: var(--accent-text); display: block; font-size: 26px; margin-bottom: 8px; }
.result-panel .eyebrow { font-size: 10px; color: var(--muted); margin: 0; }
.result-panel h2 { font-size: 54px; margin: 9px 0 12px; }
.result-panel > p:not(.eyebrow) { color: var(--muted); font-size: 13px; max-width: 520px; margin: 10px auto; }
#result-best { display: none; }
[data-stage=result] .score-card { position: relative; }
[data-stage=result] .score-card > strong { font-size: 66px; }
[data-stage=result] .score-card > .result-video { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #7e8ca1; aspect-ratio: 16/9; min-height: 130px; margin-top: 14px; background: #0b111b; border: 1px solid var(--line); border-radius: 11px; font-size: 11px; }
.result-video .text-button { font-size: 11px; min-height: 30px; }
.result-breakdown { grid-area: breakdown; }
.result-breakdown > .section-heading { margin-top: 12px; }
.best-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.best-row > span { width: 85px; flex: none; color: var(--muted); font-size: 12px; }
.best-row progress { width: 100%; height: 10px; }
.best-row > strong { font-size: 15px; min-width: 22px; text-align: right; }
.best-row:nth-child(2) progress::-webkit-progress-value { background: #8295b1; }
.best-row:nth-child(2) progress::-moz-progress-bar { background: #8295b1; }
.touch-log-panel, .processing-report { margin-top: 15px; padding: 16px 20px; }
.touch-log-panel > summary, .processing-report > summary { display: flex; align-items: center; justify-content: space-between; font-size: 13px; min-height: 30px; }
.touch-log-note, .processing-total { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 8px 0 14px; }
.touch-log-grid, .processing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.touch-log-grid > section, .processing-grid > section { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #0e1826; }
.touch-log-grid h3, .processing-grid h3 { margin: 0 0 10px; font-size: 13px; }
.touch-log { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow: auto; }
.touch-log li { padding: 10px 0; border-top: 1px solid var(--line); }
.touch-log li:first-child { border-top: 0; padding-top: 0; }
.touch-log li > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.touch-log strong { font-size: 12px; }
.touch-log time { color: var(--accent-text); font: 700 11px/1 var(--font-body); }
.touch-log p { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 5px 0 0; }
.touch-log .streak-end { padding: 7px 9px; border-radius: 7px; background: #172335; color: #c7d3e2; }
.touch-log .reason-unknown { border-left: 2px solid #f59e0b; color: #e7c8a8; }
.touch-log .touch-log-empty { color: var(--muted); font-size: 11px; }
.processing-grid dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; margin: 0; }
.processing-grid dt { color: var(--muted); font-size: 10px; }
.processing-grid dd { margin: 0; color: #dbe5f1; font: 700 11px/1.4 var(--font-body); text-align: right; }
.result-actions { grid-area: actions; display: flex; gap: 14px; }
.result-actions > button { flex: 1; }
.result-actions:has(> [hidden]):not(:has(> button:not([hidden]))) { display: none; }
dialog { max-width: 420px; width: calc(100% - 32px); padding: 28px; background: var(--surface); color: var(--text); border: 1px solid #4b5d76; border-radius: 20px; box-shadow: 0 30px 80px #0008; }
dialog::backdrop { background: #080d16d9; }
dialog h2 { font-size: 36px; margin-top: 14px; }
dialog p { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 14px 0 24px; }
dialog .button-row button { font-size: 13px; padding: 12px; }

@media(min-width:1540px) {
  .app-main { margin-right: auto; margin-left: calc(var(--rail) + (100vw - var(--rail) - 1300px) / 2); }
}
@media(max-width:1099px) and (min-width:701px) {
  :root { --rail: 84px; }
  .app-sidebar { padding: 27px 14px; }
  .app-sidebar .brand { font-size: 0; justify-content: center; }
  .app-sidebar .brand::before { content: 'td'; font: 700 32px 'Barlow Condensed', sans-serif; }
  .sidebar-caption, .sidebar-play, .sidebar-footer, .main-nav a > span { display: none; }
  .main-nav { margin-top: 40px; gap: 12px; }
  .main-nav a { padding: 15px; justify-content: center; }
  .app-header { padding: 18px 28px; min-height: 82px; }
  .app-main { padding: 28px; }
  .home-grid { grid-template-columns: 1fr; gap: 32px; }
  .home-start { display: grid; grid-template-columns: 1fr 1fr; }
  .home-summary { grid-column: 1/-1; }
  .home-start > .tiny { grid-column: 1/-1; }
  .personal-record { grid-column: 1/-1; padding-bottom: 0; }
  .home-play { min-height: 54px; }
  .performance-grid { grid-template-columns: 1fr 1fr; }
  .stats-rating-grid, .stats-activity-grid { grid-template-columns: 1.3fr 1fr; gap: 16px; }
  .profile-grid { gap: 16px; }
  .lobby-grid { gap: 18px; }
  .panel, .mode-card { padding: 20px; }
  .mode-card { gap: 16px; }
  .mode-card .button-row { flex-direction: column; gap: 10px; }
  .mode-title { align-items: flex-start; }
  .mode-title h2 { font-size: 29px; }
  .lobby-card h2 { font-size: 30px; }
  .clash-side { padding: 24px; width: 55%; }
  .clash-metrics { gap: 20px; }
  .clash-metrics strong { font-size: 28px; }
  .duel-card { grid-template-columns: 1fr 1.2fr; }
  [data-stage=record] .duel-card { grid-template-columns: 1.3fr 1fr; }
  .hud-privacy { display: none !important; }
  [data-stage=record] .duel-scores { gap: 10px; }
  [data-stage=record] .score-card { padding: 12px; }
  [data-stage=record] .score-card > strong { font-size: 42px; }
  [data-stage=verification] .duel-card { grid-template-columns: 1fr; grid-template-areas: 'status' 'reaction' 'verification' 'scores' 'warning' 'bottom' 'details'; max-width: 700px; margin: auto; }
  .skills-hero { padding: 28px; gap: 22px; }
  .landing-main { gap: 40px; padding: 35px 30px; }
  .landing-copy h1 { font-size: 68px; }
}
@media(max-width:700px) {
  :root { --rail: 0px; }
  body { font-size: 14px; }
  .app-sidebar { inset: auto 0 0; width: 100%; height: calc(65px + env(safe-area-inset-bottom)); padding: 0 12px env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--line); background: var(--surface); z-index: 15; }
  .app-sidebar > :not(.main-nav) { display: none; }
  .main-nav { flex-direction: row; gap: 0; height: 64px; justify-content: space-around; }
  .main-nav a { flex: 1; min-height: 64px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 0; border-radius: 0; font-size: 11px; }
  .main-nav a[aria-current=page] { background: transparent; }
  .main-nav a svg { width: 22px; height: 22px; }
  .app-header { min-height: 83px; margin: 0; padding: 17px 24px; border: 0; }
  .header-status { font-size: 11px; gap: 7px; border: 1px solid #4b3930; color: var(--accent-text); border-radius: 999px; padding: 5px 9px; }
  .header-status .status-dot { background: var(--accent-text); width: 5px; height: 5px; }
  .header-actions { gap: 4px; }
  .header-player { gap: 9px; }
  .header-player strong { font-size: 12px; max-width: 125px; }
  .header-player small { font-size: 10px; }
  .header-actions > button { width: 32px; min-width: 32px; }
  .header-actions > button svg { width: 17px; height: 17px; }
  .app-main { margin: 0; padding: 8px 24px calc(95px + env(safe-area-inset-bottom)); }
  h1 { font-size: 36px; }
  h2 { font-size: 28px; }
  .panel { padding: 17px; border-radius: 14px; }
  .page-heading { margin: 4px 0 24px; gap: 6px; }
  .page-heading .eyebrow { font-size: 9px; }
  .page-heading .back-button { margin-left: -13px; }
  .page-heading h1 { font-size: 35px; }
  .welcome-strip { margin: 0 0 17px; }
  .welcome-strip h1 { font-size: 33px; }
  .welcome-strip .eyebrow { font-size: 8px; margin-bottom: 5px; }
  .welcome-strip > .tag { display: none; }
  .home-grid { display: flex; flex-direction: column; gap: 25px; }
  .home-start, .history-section { width: 100%; }
  .home-summary { padding: 18px 13px; }
  .summary-grid { gap: 8px; }
  .summary-grid span { font-size: 12px; }
  .summary-grid strong { font-size: 31px; }
  .summary-grid small { font-size: 9px; }
  .home-start { gap: 12px; }
  .home-play { min-height: 52px; font-size: 16px; justify-content: center; }
  .home-play .button-arrow { display: none; }
  .home-start > .secondary { justify-content: center; }
  .home-start > .tiny { display: none; }
  .personal-record { display: none; }
  .history-section > .section-heading { margin-bottom: 12px; }
  .history-section > .section-heading h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
  .history-section > .section-heading .text-link { font-size: 11px; }
  .history-panel { padding: 0 16px; }
  .history-link { min-height: 82px; padding: 14px 0; }
  .history-name { font-size: 14px; }
  .history-section > .tiny { font-size: 10px; }
  .mode-grid { grid-template-columns: 1fr; gap: 16px; }
  .mode-card { padding: 18px; gap: 17px; }
  .mode-title h2 { font-size: 29px; }
  .mode-title p { font-size: 13px; }
  .mode-card .button-row .primary, .mode-card .button-row .secondary { font-size: 13px; padding: 12px 9px; }
  .lobby-grid { grid-template-columns: 1fr; gap: 18px; }
  .lobby-card { padding: 24px 20px; }
  .lobby-card h2 { font-size: 34px; }
  .lobby-search-symbol { margin-top: 0; }
  .wait-clock { margin: 20px 0; }
  .camera-setup { order: 2; }
  .setup-preview { aspect-ratio: 4/3; }
  .camera-setup > .small { font-size: 12px; }
  .room-code-box > strong { font-size: 38px; }
  .profile-identity { margin: 10px 0 20px; gap: 17px; }
  .profile-identity .avatar-large { width: 64px; height: 64px; font-size: 30px; }
  .profile-identity h1 { font-size: 34px; }
  .profile-main > .panel { padding: 20px 14px; }
  .profile-grid, .stats-rating-grid, .stats-activity-grid, .friends-layout, .two-column { grid-template-columns: 1fr; gap: 17px; }
  .profile-grid { margin-top: 18px; }
  .profile-grid .empty-state { padding: 25px 8px; }
  .chart-empty { height: 200px; }
  .chart-empty strong { font-size: 27px; }
  .calendar-days > span { min-height: 33px; }
  .settings-grid { grid-template-columns: 1fr; gap: 18px; }
  .settings-actions { flex-direction: column; }
  .stats-rating-grid .percentile-panel { min-height: 170px; }
  .percentile-panel > strong { font-size: 44px; }
  .performance-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .performance-grid .panel { padding: 16px; }
  .performance-grid strong { font-size: 34px; }
  .performance-grid .panel > span { font-size: 12px; }
  .stats-section { margin-top: 24px; }
  .stats-section > .section-heading > span { max-width: 160px; text-align: right; font-size: 10px; }
  .skills-hero { flex-direction: column; align-items: flex-start; padding: 25px 20px; gap: 22px; }
  .skill-icon { width: 58px; height: 58px; }
  .skill-icon svg { height: 28px; width: 28px; }
  .skills-hero h2 { font-size: 34px; }
  .skills-hero .primary { width: 100%; min-width: 0; }
  .public-header { padding: 23px 24px 0; }
  .public-header .brand { font-size: 28px; }
  .public-header > .text-link { font-size: 12px; }
  .landing-main { display: block; padding: 25px 24px 35px; }
  .landing-copy > .eyebrow { display: none; }
  .landing-copy h1 { font-size: 49px; line-height: 1.06; margin: 5px 0 18px; }
  .landing-description { font-size: 15px; margin: 0 0 18px; }
  .landing-clash { margin-top: 24px; height: 135px; }
  .landing-clash > div { left: 14px; top: 13px; }
  .landing-clash > div:nth-child(2) { right: 14px; bottom: 13px; }
  .landing-clash strong { font-size: 15px; }
  .landing-clash small { font-size: 10px; }
  .landing-flow { font-size: 11px; margin: 16px 0 28px; }
  .landing-flow i { padding: 0 5px; }
  .landing-actions { margin-top: 35px; }
  .landing-actions > p { margin-top: 3px; font-size: 10px; }
  .landing-desktop-note { display: none; }
  .account-panel { border: 0; padding: 0; background: transparent; }
  .account-panel h2 { font-size: 36px; }
  .account-panel .account-back { display: inline-flex; margin-bottom: 6px; }
  body[data-auth-view=true] .landing-copy { display: none; }
  body[data-auth-view=true] .public-header > .text-link { visibility: hidden; }
  .auth-footnote { font-size: 11px; }
  .duel-main { padding: 5px 20px calc(90px + env(safe-area-inset-bottom)); }
  .match-heading { gap: 6px; margin-bottom: 14px; }
  .match-heading > a { margin-left: -10px; }
  .match-heading h1 { font-size: 33px; }
  .match-heading > .tag { font-size: 9px; padding: 5px 8px; }
  .match-heading .eyebrow { font-size: 8px; }
  .notice { font-size: 11px; }
  .duel-card { display: flex; flex-direction: column; gap: 16px; }
  .camera-stage { order: 2; min-height: 240px; aspect-ratio: 4/3; }
  .camera-controls { order: 3; }
  .camera-controls h2 { font-size: 30px; }
  .camera-controls p { font-size: 12px; }
  .duel-topline { order: 1; }
  .duel-topline p { font-size: 11px; }
  .duel-topline .tag { font-size: 9px; }
  .duel-bottom { order: 12; }
  .diagnostics { order: 13; }
  .duel-warning { order: 10; }
  .processing-lag { order: 8; }
  .tracking-panel { order: 9; }
  .result-actions { order: 11; }
  .scoreboard { order: 7; }
  .reaction-panel { order: 2; }
  .verification { order: 3; width: 100%; }
  .result-panel { order: 2; }
  .result-breakdown { order: 9; }
  .duel-scores { gap: 12px; }
  .score-card { padding: 14px; }
  .score-card > strong { font-size: 48px; }
  .score-card > span, .running-streak { font-size: 11px; }
  .score-label { gap: 7px; }
  .score-label small { font-size: 11px; }
  .score-label .avatar-small { height: 23px; width: 23px; font-size: 11px; }
  .clash-screen { inset: 0; }
  .clash-side { width: 76%; padding: 0; }
  .clash-you { left: 24px; top: 70px; }
  .clash-opponent { right: 24px; bottom: 75px; }
  .clash-side h2 { font-size: 30px; max-width: 260px; margin: 10px 0 8px; }
  .clash-opponent h2 { margin-left: auto; }
  .clash-side p { font-size: 12px; }
  .clash-metrics { gap: 25px; margin-top: 20px; }
  .clash-metrics strong { font-size: 30px; }
  .countdown-display { width: 88px; height: 88px; font-size: 60px; }
  .clash-brand { font-size: 24px; top: 20px; right: 24px; }
  .clash-resign { left: 24px; bottom: max(15px, env(safe-area-inset-bottom)); }
  body[data-match-stage=clash] .app-sidebar { visibility: hidden; }
  body[data-match-stage=record] .app-header, body[data-match-stage=record] .app-sidebar { display: none; }
  body[data-match-stage=record] .duel-main { padding: 0; }
  [data-stage=record] .duel-card { display: block; min-height: 100svh; }
  [data-stage=record] .camera-stage { width: 100%; height: 100svh; min-height: 600px; aspect-ratio: auto; border: 0; border-radius: 0; background: var(--surface); }
  [data-stage=record] .record-hud { top: max(16px, env(safe-area-inset-top)); left: 16px; right: 16px; gap: 8px; }
  [data-stage=record] .record-hud > div { padding: 7px 10px; }
  [data-stage=record] .hud-player { max-width: 46%; }
  [data-stage=record] .hud-player span { font-size: 12px; }
  [data-stage=record] .hud-player small { display: none; }
  [data-stage=record] .hud-clock strong { font-size: 28px; }
  [data-stage=record] .hud-privacy { gap: 5px; }
  [data-stage=record] .hud-privacy svg { height: 15px; width: 15px; }
  [data-stage=record] .hud-privacy span { font-size: 10px; }
  [data-stage=record] .scoreboard { position: absolute; left: 16px; right: 16px; top: 80px; pointer-events: none; }
  [data-stage=record] .duel-scores { display: flex; justify-content: space-between; gap: 20px; }
  [data-stage=record] .score-card { background: #0b111be0; border-color: #ffffff12; padding: 9px 13px; min-width: 72px; max-width: 44%; gap: 1px; }
  [data-stage=record] .score-card > strong { font-size: 33px; margin: 3px 0; }
  [data-stage=record] .score-card > span { display: none; }
  [data-stage=record] .score-label small { font-size: 9px; }
  [data-stage=record] .duel-topline { position: absolute; top: 160px; left: 16px; right: 16px; align-items: center; }
  [data-stage=record] .duel-topline > p { background: #0b111bcc; border-radius: 999px; padding: 5px 10px; font-size: 9px; }
  [data-stage=record] .duel-topline > .tag { display: none; }
  [data-stage=record] .processing-lag { position: absolute; bottom: 94px; left: 20px; right: 20px; text-align: center; font-size: 10px; padding: 7px 10px; border-radius: 9px; background: #0b111bd9; }
  [data-stage=record] .tracking-panel { position: absolute; left: 16px; bottom: 140px; width: 115px; display: flex; flex-direction: column; background: #0b111bd9; }
  [data-stage=record] .tracking-label { font-size: 7px; padding: 5px; gap: 4px; }
  [data-stage=record] #analysed-preview { width: 100%; height: 70px; }
  [data-stage=record] .tracking-panel p { display: none; }
  [data-stage=record] .record-indicator { bottom: 140px; left: auto; right: 16px; font-size: 8px; }
  [data-stage=record] .duel-bottom { position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 20px; right: 20px; display: flex; gap: 12px; }
  [data-stage=record] .duel-bottom > button { flex: 1; background: #0b111bd9; }
  [data-stage=record] .diagnostics { display: none; }
  [data-stage=record] .duel-warning { position: absolute; top: 194px; left: 20px; right: 20px; background: #0b111bd9; padding: 7px 10px; border-radius: 9px; font-size: 10px; }
  [data-stage=verification] .duel-card { display: flex; }
  [data-stage=verification] .match-heading { margin-bottom: 18px; }
  [data-stage=verification] .scoreboard { width: 100%; }
  [data-stage=verification] .duel-bottom { width: 100%; }
  .verification { padding: 23px 17px; }
  .verification-heading h2 { font-size: 30px; }
  .verification-heading p { font-size: 12px; }
  .verification-steps { gap: 14px 10px; }
  .verification-steps li { font-size: 10px; }
  .verification-timelines p { font-size: 10px; }
  .reaction-list button { font-size: 11px; padding: 5px 10px; min-height: 30px; }
  .reaction-panel { width: 100%; }
  .reaction-panel > p { font-size: 9px; }
  [data-stage=result] .duel-card { display: flex; gap: 18px; }
  [data-stage=result] .scoreboard { width: 100%; }
  [data-stage=result] .score-card > strong { font-size: 55px; }
  [data-stage=result] .score-card > .result-video { aspect-ratio: 4/3; min-height: 100px; font-size: 9px; gap: 7px; padding: 8px; text-align: center; }
  [data-stage=result] .score-card { padding: 13px; }
  .result-panel { width: 100%; padding-top: 0; }
  .result-panel h2 { font-size: 46px; }
  .result-panel > p:not(.eyebrow) { font-size: 12px; }
  .result-breakdown, .result-actions { width: 100%; }
  .result-actions { flex-direction: column; gap: 12px; }
  .result-breakdown > .section-heading h2 { font-size: 15px; }
  .result-breakdown > .section-heading .tiny { font-size: 10px; }
  .best-row > span { width: 65px; font-size: 11px; }
  .best-row { gap: 10px; }
  .touch-log-panel, .processing-report { padding: 14px 17px; }
  .touch-log-grid, .processing-grid { grid-template-columns: 1fr; }
  .duel-bottom { width: 100%; }
  .duel-bottom > button { width: 115px; font-size: 13px; }
  .duel-bottom > a { font-size: 12px; }
}
@media(max-width:370px) {
  .app-header { padding-left: 18px; padding-right: 18px; }
  .app-main { padding-left: 18px; padding-right: 18px; }
  .header-player strong { max-width: 95px; }
  .header-status { font-size: 10px; }
  .primary, .secondary { font-size: 14px; }
  .clash-side h2 { font-size: 27px; }
  .clash-metrics { gap: 18px; }
  .clash-metrics strong { font-size: 27px; }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* Keep match controls inside the viewport and give match stages their own space. */
[data-stage=result] .score-card > .result-video { height: 135px; min-height: 0; aspect-ratio: auto; }
[data-stage=result] .running-streak { display: none; }
[data-stage=verification] .notice, [data-stage=result] .notice { display: none; }
@media(max-width:700px) {
  .page-duel .app-header { display: none; }
  body[data-match-stage=verification] .app-sidebar,
  body[data-match-stage=result] .app-sidebar { display: none; }
  body[data-match-stage=verification] .duel-main,
  body[data-match-stage=result] .duel-main { padding-bottom: 32px; }
  [data-stage=record] .duel-bottom { width: auto; }
  [data-stage=result] .score-card > .result-video { height: 105px; }
}

/* Center Play action: bottom bar on phones, compact rail on tablets. */
.main-nav a.nav-play { display: none; }
@media (max-width:1099px) and (min-width:701px) {
 .main-nav a.nav-play { display:flex; color:#09202a; background:#72e2ca; }
 .main-nav a.nav-play > .nav-play-disc { display:flex; }
}
@media (max-width:700px) {
 .main-nav a.nav-play { display:flex; position:relative; padding-top:28px; color:#72e2ca; }
 .nav-play-disc { position:absolute; top:0; left:50%; transform:translate(-50%,-50%); width:60px; height:60px; border-radius:50%; background:#72e2ca; color:#09202a; border:5px solid var(--surface); display:grid; place-items:center; }
 .main-nav .nav-play-disc svg { width:26px; height:26px; margin-left:3px; }
 .main-nav a.nav-play[aria-current=page] .nav-play-disc { outline:2px solid #72e2ca; outline-offset:2px; }
 .main-nav a.nav-play:focus-visible { outline:2px solid var(--text); outline-offset:-2px; }
}
.shared-tracking { position:relative; margin:18px 0; padding:16px; border:1px solid var(--line); border-radius:var(--radius); }
.shared-tracking label { display:flex; align-items:flex-start; gap:10px; line-height:1.5; }
.shared-tracking input { width:20px; height:20px; min-height:20px; margin:2px 0 0; flex:none; }
.shared-tracking-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:12px; }
.shared-tracking canvas { display:block; width:100%; aspect-ratio:3/4; background:var(--bg); border-radius:10px; }
.shared-tracking figcaption { color:var(--muted); font-size:12px; margin-top:6px; }
.shared-tracking figure { margin:0; min-width:0; }

/* Focused account setup and essential-cookie notice. */
.cookie-notice { position:fixed; z-index:100; left:16px; right:16px; bottom:max(16px,env(safe-area-inset-bottom)); max-width:640px; margin:auto; padding:16px; display:flex; gap:16px; align-items:center; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.cookie-notice p { margin:0; font-size:13px; line-height:1.6; }
.cookie-notice button { width:auto; min-width:76px; flex:none; }
.cookie-notice[hidden] { display:none; }
.cookie-policy-link { position:fixed; bottom:12px; left:16px; z-index:3; color:var(--muted); font-size:12px; }
.completion-panel input[readonly] { background:transparent; color:var(--muted); border-color:transparent; box-shadow:none; padding-left:0; cursor:default; }
.completion-actions { display:grid; grid-template-columns:48px minmax(0,1fr); align-items:center; gap:12px; margin-top:24px; }
.completion-actions .primary { margin:0; grid-column:2; }
.completion-actions:has(.back-step[hidden]) .primary { grid-column:1/-1; }
.back-step { width:44px; height:48px; min-height:48px; display:inline-grid; place-items:center; }
.experience-choices { border:0; padding:0; margin:0; display:grid; gap:12px; }
.experience-choices legend { margin-bottom:16px; color:var(--muted); font-size:14px; }
.experience-choices label { display:flex; gap:12px; align-items:center; border:1px solid var(--line); border-radius:12px; padding:16px; cursor:pointer; }
.experience-choices label:has(input:checked) { border-color:var(--accent); background:var(--surface-raised); }
.experience-choices input { width:20px; height:20px; min-height:20px; flex:none; margin:0; }
.experience-choices strong,.experience-choices small { display:block; }
.experience-choices small { color:var(--muted); margin-top:6px; }
.password-field > .icon-button { display:grid; place-items:center; width:44px; min-height:44px; }
#password-message { min-height:1.5em; font-size:14px; }
@media(max-width:480px) { .cookie-notice { align-items:stretch; flex-direction:column; } .cookie-notice button { align-self:flex-end; } }
