:root {
  --primary: #5C48D3; --primary-soft: #EEEAFB; --background: #F5F6FA;
  --surface: #FFFFFF; --ink: #252638; --muted: #717386; --border: #E7E8F0;
  --success: #267967; --danger: #BD4056; --amber: #B57622; --teal: #29998A;
  --coral: #E87969; --blue: #5D90D7; --radius-control: 10px; --radius-card: 18px;
  --scroll-thumb: #B8BACB; --scroll-track: #F0F1F6;
  --font-body: 'Segoe UI', Arial, sans-serif; --font-display: 'Trebuchet MS', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; border: 2px solid var(--scroll-track); }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background: var(--primary); }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body { margin: 0; background: var(--background); color: var(--ink); font: 15px/1.55 var(--font-body); }
button, input, select, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), a, select:not(:disabled), input[type=radio], input[type=checkbox], summary { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
svg { width: 20px; height: 20px; flex-shrink: 0; vertical-align: middle; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.045em; overflow-wrap: anywhere; }
h1 { font-size: 32px; line-height: 1.2; font-weight: 700; }
h2 { font-size: 21px; line-height: 1.35; }
h3 { font-size: 18px; }
small, .muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; font-weight: 700; color: var(--primary); }
.numeric { font-variant-numeric: tabular-nums; }
.btn { min-height: 42px; border: 1px solid transparent; border-radius: var(--radius-control); padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .16s, transform .16s, border-color .16s; }
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover:not(:disabled) { background: #4c39bd; }
.btn.outline { background: var(--surface); border-color: var(--border); }
.btn.outline:hover:not(:disabled) { border-color: #c5bfeb; background: #f8f7ff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }
.btn.danger { color: var(--danger); background: #fff1f3; }
.btn.danger:hover:not(:disabled) { background: #fbe0e6; }
.btn.icon-only { padding: 10px; width: 40px; }
.btn.small-btn { padding: 7px 12px; min-height: 34px; font-size: 12px; }
.btn[aria-busy=true] { opacity: .65; position: relative; pointer-events: none; }
.full { width: 100%; }
.bank-selection { padding: 20px; margin-bottom: 20px; }
.bank-selection .field { max-width: 560px; margin-bottom: 0; }
.bank-check { width: 24px; height: 24px; accent-color: var(--primary); flex-shrink: 0; }
.bank-page-choice { display: inline-flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
.bank-page-choice input { width: 24px; height: 24px; accent-color: var(--primary); }
.bank-selection select { max-width: 100%; }
.toolbar .field { margin: 0; min-width: 160px; }
.personal-scores { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.personal-scores .player-score { display: flex; flex-direction: column; align-items: flex-start; margin: 0; padding: 14px; border-radius: var(--radius-control); border: 1px solid var(--border); }
.personal-scores .player-score strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.personal-scores .player-score:first-child { background: var(--primary-soft); }
.heading-actions { flex-wrap: wrap; }
@media (max-width: 720px) { .toolbar .field { width: 100%; } .bank-selection { padding: 16px; } .bank-selection .btn { white-space: normal; } }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 100; padding: 12px; background: white; }
.skip-link:focus { top: 10px; }
.initial-loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.layout { min-height: 100vh; padding-left: 224px; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 224px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; padding: 28px 18px 20px; z-index: 15; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); font: 700 26px var(--font-display); letter-spacing: -.055em; }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.sidebar .brand { padding: 0 9px; }
.brand-dot { color: var(--primary); }
.workspace-label { margin: 39px 13px 13px; color: #9698a8; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.side-nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; border-radius: 9px; padding: 11px 13px; color: var(--muted); font-size: 13px; font-weight: 500; }
.nav-item:hover { background: var(--background); color: var(--ink); text-decoration: none; }
.nav-item.active { color: var(--primary); background: var(--primary-soft); font-weight: 650; }
.nav-item .nav-count { margin-left: auto; font-size: 10px; background: white; border-radius: 5px; padding: 1px 6px; }
.side-divider { height: 1px; background: var(--border); margin: 22px 10px; }
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
.tip-box { background: #f6f4fc; border-radius: 12px; padding: 16px; font-size: 12px; }
.tip-box .tip-icon { color: var(--primary); display: block; margin-bottom: 9px; }
.tip-box strong { font-size: 13px; }
.tip-box p { color: var(--muted); margin: 7px 0 13px; }
.side-user { display: flex; gap: 10px; align-items: center; padding: 21px 8px 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #f0e3d3; color: #806043; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.side-user strong { display: block; font-size: 12px; }
.side-user small { font-size: 10px; }
.topbar { min-height: 76px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.86); display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 0 36px; }
.breadcrumbs { display: flex; gap: 12px; font-size: 12px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.breadcrumbs span:last-child { color: var(--ink); }
.topbar-right { display: flex; gap: 18px; align-items: center; }
.connection { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.connection::before { content: ''; width: 6px; height: 6px; background: var(--success); border-radius: 50%; }
.connection.offline::before { background: var(--danger); }
.topbar .btn { font-size: 11px; }
.main { padding: 33px 36px 36px; max-width: 1390px; margin: auto; }
.page-heading { display: flex; gap: 24px; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.page-heading .subtitle { margin-top: 9px; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; align-items: center; gap: 8px; padding-top: 3px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin-bottom: 28px; }
.stat { border: 1px solid var(--border); border-radius: 12px; padding: 17px 20px; background: var(--surface); display: flex; align-items: center; gap: 15px; }
.stat-icon { width: 41px; height: 41px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.stat-icon.teal { background: #e9f5f2; color: var(--teal); }
.stat-icon.amber { background: #f9f1e4; color: var(--amber); }
.stat-number { font: 700 23px var(--font-display); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 15px; }
.section-heading h2 { font-size: 18px; }
.section-heading .small { font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(265px, 1fr); gap: 22px; margin-bottom: 26px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); overflow: hidden; }
.panel-pad { padding: 24px; }
.feature { position: relative; }
.feature-top { min-height: 232px; background: #eeebfa; position: relative; padding: 26px; overflow: hidden; }
.feature-top .feature-text { max-width: 70%; position: relative; z-index: 1; }
.feature-top h2 { margin: 15px 0 10px; font-size: 27px; max-width: 320px; }
.feature-top p { font-size: 12px; color: #6d6589; max-width: 315px; }
.feature-illustration { position: absolute; right: 10px; top: 26px; width: 205px; height: 185px; }
.feature-illustration svg { width: 100%; height: 100%; }
.pill { display: inline-flex; gap: 6px; align-items: center; border-radius: 6px; padding: 4px 8px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 600; }
.pill.draft { background: white; color: #756d92; }
.pill.lobby { background: #e5f3ed; color: var(--success); }
.pill.running { background: #ede8ff; color: var(--primary); }
.pill.paused { background: #fff1d7; color: var(--amber); }
.pill.finished { background: #e6f4ee; color: var(--success); }
.feature-meta { position: relative; z-index: 1; display: flex; gap: 17px; color: #726888; font-size: 11px; margin-top: 21px; flex-wrap: wrap; }
.feature-meta span { display: flex; align-items: center; gap: 6px; }
.feature-meta svg { width: 14px; height: 14px; }
.feature-bottom { padding: 17px 24px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.feature-bottom .buttons { display: flex; gap: 9px; }
.mini-attendance { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.checklist { padding: 23px 24px; }
.checklist h3 { margin-bottom: 4px; }
.checklist .intro { font-size: 11px; color: var(--muted); }
.step { display: flex; gap: 12px; margin-top: 20px; align-items: flex-start; }
.step-number { width: 25px; height: 25px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-size: 10px; color: var(--muted); flex-shrink: 0; }
.step-number.done { color: var(--success); background: #e8f5ed; border-color: transparent; }
.step strong { display: block; font-size: 12px; font-weight: 600; }
.step p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.checklist .btn { margin-top: 20px; font-size: 11px; }
.race-panel { padding: 22px 26px 19px; }
.race-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.race-top h2 { font-size: 18px; }
.race-top p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--success); font-weight: 600; }
.live-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.race-rows { display: grid; gap: 17px; }
.race-row { display: grid; grid-template-columns: 155px minmax(0,1fr) 65px; gap: 18px; align-items: center; }
.team-label { display: flex; gap: 9px; align-items: center; min-width: 0; }
.mascot { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--team-color) 12%, white); color: var(--team-color); flex-shrink: 0; }
.team-purple { --team-color: var(--primary); }
.team-teal { --team-color: var(--teal); }
.team-coral { --team-color: var(--coral); }
.team-blue { --team-color: var(--blue); }
.team-amber { --team-color: var(--amber); }
.team-label strong { font-size: 12px; overflow-wrap: anywhere; }
.rank { font: 12px var(--font-body); color: var(--muted); width: 12px; flex-shrink: 0; }
.track { height: 24px; position: relative; background: repeating-linear-gradient(90deg, #edeef4 0px, #edeef4 1px, transparent 1px, transparent 25%), #f7f8fb; border-radius: 6px; margin-right: 12px; }
.track::after { content: ''; position: absolute; width: 1px; right: 0; top: -5px; bottom: -5px; background: #d4d3df; }
.track-fill { position: relative; height: 100%; border-radius: 6px; background: color-mix(in srgb, var(--team-color) 26%, white); width: max(2%, var(--progress)); transition: width .7s cubic-bezier(.2,.8,.2,1); }
.track-fill::before { content: ''; position: absolute; height: 8px; top: 8px; left: 0; right: 0; background: var(--team-color); opacity: .65; border-radius: 4px; }
.track-end { position: absolute; right: -13px; top: -5px; height: 34px; width: 34px; display: grid; place-items: center; border: 3px solid white; border-radius: 11px; color: white; background: var(--team-color); z-index: 1; }
.track-end svg { width: 18px; height: 18px; }
.score { text-align: right; font: 700 17px var(--font-display); font-variant-numeric: tabular-nums; }
.score small { font: 10px var(--font-body); margin-left: 4px; }
.race-axis { display: flex; justify-content: space-between; margin: 17px 96px 0 173px; font-size: 9px; color: #9a9dad; }
.race-footer { padding-top: 15px; margin-top: 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: space-between; font-size: 10px; color: var(--muted); }
.race-footer span { display: flex; align-items: center; gap: 6px; }
.race-footer svg { width: 13px; height: 13px; }
.bottom-note { text-align: center; color: #9a9cab; font-size: 10px; margin-top: 24px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.search-wrap { flex: 1; min-width: 180px; max-width: 400px; position: relative; }
.search-wrap > svg { position: absolute; top: 12px; left: 12px; color: var(--muted); width: 18px; }
.search-wrap input { width: 100%; padding-left: 40px; padding-right: 38px; }
.search-wrap .clear-search { position: absolute; right: 4px; top: 3px; width: 34px; min-height: 34px; padding: 6px; }
.field { display: block; margin-bottom: 17px; }
.field > span:first-child, .field > label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 7px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; color: var(--ink); border: 1px solid #dcdde7; border-radius: 9px; padding: 10px 12px; background: white; min-height: 44px; transition: border-color .16s; }
input::placeholder, textarea::placeholder { color: #a1a2b0; }
input:hover, select:hover, textarea:hover { border-color: #b5aecf; }
textarea { resize: none; min-height: 100px; }
.field small { display: block; font-size: 11px; margin-top: 5px; }
.field input[aria-invalid=true], .field textarea[aria-invalid=true], .field select[aria-invalid=true] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12px; margin-top: 5px; }
.form-error { border-radius: 9px; background: #fff1f3; color: var(--danger); padding: 12px; margin: 12px 0; font-size: 12px; white-space: pre-line; }
.form-error:empty { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.password-wrap button { position: absolute; top: 3px; right: 4px; }
.event-cards { display: grid; gap: 15px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.event-card { padding: 22px; }
.event-card .top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.event-card h3 { margin-bottom: 8px; }
.event-card p { font-size: 12px; color: var(--muted); min-height: 38px; }
.card-meta { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; font-size: 11px; color: var(--muted); }
.card-meta span { display: flex; gap: 5px; align-items: center; }
.card-meta svg { width: 14px; height: 14px; }
.card-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.pagination { display: flex; justify-content: space-between; gap: 20px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 20px; }
.pagination nav { display: flex; gap: 6px; }
.empty { padding: 48px 24px; text-align: center; }
.empty-icon { width: 54px; height: 54px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 16px; margin: 0 auto 17px; }
.empty-icon svg { width: 26px; height: 26px; }
.empty h3 { margin-bottom: 9px; }
.empty p { color: var(--muted); font-size: 13px; max-width: 400px; margin: 0 auto 18px; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 25px; overflow-x: auto; }
.tab { padding: 13px 4px; color: var(--muted); font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab:hover { text-decoration: none; color: var(--primary); }
.tab span { margin-left: 5px; font-size: 10px; background: var(--primary-soft); border-radius: 4px; padding: 2px 5px; }
.event-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 22px; }
.stack { display: grid; gap: 20px; align-content: start; }
.invite-box { padding: 26px; text-align: center; }
.invite-code { font: 700 42px 'Consolas', monospace; letter-spacing: .15em; color: var(--primary); margin: 17px 0 12px; font-variant-numeric: tabular-nums; }
.invite-box p { font-size: 12px; color: var(--muted); margin-top: 8px; }
.invite-box .buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.address-line { display: block; font-size: 11px; overflow-wrap: anywhere; padding: 9px; background: var(--background); border-radius: 7px; margin: 12px 0; }
.notice { padding: 14px 16px; border: 1px solid #e2dbf5; border-radius: 10px; background: #f5f2ff; color: #6f619a; font-size: 12px; display: flex; align-items: flex-start; gap: 10px; }
.notice.warning { background: #fff8ea; color: #8b652c; border-color: #efe1c5; }
.notice.offline-banner { margin-bottom: 18px; background: #fff1f3; color: var(--danger); border-color: #f1d1d7; }
.control-title { display: flex; gap: 12px; align-items: center; margin-bottom: 15px; }
.control-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.question-list { display: grid; gap: 12px; }
.question-row { padding: 18px 20px; display: flex; gap: 16px; align-items: flex-start; }
.question-index { color: var(--muted); font: 12px 'Consolas', monospace; width: 23px; padding-top: 3px; }
.question-body { flex: 1; min-width: 0; }
.question-body h3 { font: 600 14px var(--font-body); line-height: 1.5; letter-spacing: 0; margin-bottom: 8px; overflow-wrap: anywhere; }
.question-tags { display: flex; gap: 13px; color: var(--muted); font-size: 11px; flex-wrap: wrap; align-items: center; }
.question-row .row-actions { display: flex; gap: 3px; }
.question-row .btn { min-height: 32px; width: 32px; padding: 7px; }
.question-row .btn svg { width: 16px; height: 16px; }
.team-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.team-card { padding: 20px; }
.team-card .team-label strong { font-size: 16px; }
.team-card .mascot { width: 43px; height: 43px; }
.team-card .mascot svg { width: 26px; height: 26px; }
.team-members { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.member { background: var(--background); border-radius: 6px; padding: 5px 9px; font-size: 12px; }
.member.captain { background: var(--primary-soft); color: var(--primary); }
.team-card .team-card-footer { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 18px; }
.team-code-small { color: var(--primary); font: 700 15px 'Consolas',monospace; letter-spacing: .12em; }
dialog { border: 1px solid var(--border); padding: 0; border-radius: 18px; width: min(600px, calc(100% - 32px)); max-height: calc(100dvh - 40px); color: var(--ink); background: var(--surface); box-shadow: 0 24px 70px #20194625; }
dialog::backdrop { background: #22203970; backdrop-filter: blur(3px); }
dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
dialog > form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 42px); width: 100%; overflow: hidden; }
.modal-header { display: flex; gap: 20px; justify-content: space-between; align-items: center; padding: 22px 26px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 22px; }
.modal-header .btn { min-height: 32px; width: 32px; }
.modal-body { padding: 24px 26px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-header, .modal-footer { flex-shrink: 0; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 26px; display: flex; gap: 9px; justify-content: flex-end; background: var(--surface); }
.option-field { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 10px; margin-top: 10px; }
.option-field textarea { min-width: 0; line-height: 1.5; }
.option-field input[type=radio], .option-field input[type=checkbox] { accent-color: var(--primary); width: 18px; height: 18px; }
.upload-zone { border: 1px dashed #bdb4e7; border-radius: 12px; background: #f8f6ff; padding: 20px; text-align: center; }
.upload-zone .btn { margin: 8px 0; }
.upload-zone small { display: block; }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-preview { height: 150px; width: 100%; object-fit: contain; border-radius: 9px; background: var(--background); margin-top: 10px; }
.import-summary { max-height: 220px; overflow: auto; margin-top: 14px; font-size: 12px; }
.import-item { border-top: 1px solid var(--border); padding: 10px 0; }
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 40; max-width: min(370px,calc(100vw - 48px)); }
.toast { background: var(--ink); color: white; border-radius: 10px; padding: 13px 18px; font-size: 13px; box-shadow: 0 8px 30px #25263818; }
.toast.error { background: var(--danger); }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr; }
.auth-story { background: #eeebfa; padding: 45px 8vw; display: flex; flex-direction: column; justify-content: center; position: relative; }
.auth-story > .brand { position: absolute; top: 36px; left: 8vw; }
.auth-story h1 { font-size: clamp(36px,4vw,58px); line-height: 1.14; margin: 24px 0; }
.auth-story p { color: #71678a; max-width: 380px; }
.auth-story .race-panel { margin-top: 34px; border: none; }
.auth-story .race-row { grid-template-columns: 100px minmax(0,1fr) 45px; gap: 10px; }
.auth-story .race-row strong { font-size: 11px; }
.auth-story .rank { display: none; }
.auth-story .race-axis, .auth-story .race-footer { display: none; }
.auth-form { align-self: center; padding: 40px 60px; max-width: 480px; width: 100%; margin: auto; }
.auth-form h2 { font-size: 28px; margin-bottom: 12px; }
.auth-form > p { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.auth-form .auth-links { margin-top: 23px; text-align: center; font-size: 12px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.guide-card { padding: 24px; }
.guide-card h3 { margin: 12px 0 8px; }
.guide-card p, .guide-card li { color: var(--muted); font-size: 13px; }
.guide-card ol, .guide-card ul { padding-left: 19px; }
.result-winner { padding: 30px; text-align: center; background: #f4f0ff; }
.result-winner .trophy { width: 70px; height: 70px; color: var(--amber); margin: 0 auto 15px; }
.result-winner .trophy svg { width: 70px; height: 70px; }
.result-winner h2 { font-size: 30px; margin-bottom: 8px; }
.result-winner p { color: var(--muted); font-size: 13px; }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 9px; height: 13px; background: var(--confetti-color); left: var(--confetti-left); animation: fall 4.5s var(--confetti-delay) ease-in both; }
@keyframes fall { to { transform: translateY(110vh) rotate(780deg); } }
.player-page { min-height: 100vh; background: #f1eef9; padding: 26px 20px 50px; }
.player-header { max-width: 780px; margin: 0 auto 32px; display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.player-header .brand { font-size: 25px; }
.player-header .brand img { width: 34px; height: 34px; }
.player-main { max-width: 580px; margin: auto; }
.player-panel { padding: 32px; background: white; border: 1px solid var(--border); border-radius: 22px; }
.player-panel h1 { font-size: 29px; margin-bottom: 12px; }
.player-panel > p { color: var(--muted); font-size: 14px; margin-bottom: 25px; }
.join-code-input { font: 700 28px 'Consolas',monospace; letter-spacing: .18em; text-transform: uppercase; text-align: center; min-height: 64px; }
.join-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 25px; }
.join-mode a { text-align: center; border-radius: 9px; padding: 10px; background: var(--background); color: var(--muted); font-size: 12px; }
.join-mode a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.join-mode a:hover { text-decoration: none; background: var(--primary-soft); }
.player-panel .field > span:first-child { font-size: 13px; }
.player-panel .btn.full { min-height: 48px; font-size: 14px; }
.player-bottom { text-align: center; font-size: 11px; color: var(--muted); margin-top: 22px; }
.mascot-picker { display: grid; grid-template-columns: repeat(8,1fr); gap: 7px; margin: 10px 0 20px; }
.mascot-choice { display: grid; place-items: center; border: 2px solid transparent; border-radius: 10px; height: 44px; background: var(--background); color: var(--muted); }
.mascot-choice svg { width: 25px; height: 25px; }
.mascot-choice.selected { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.mascot-choice:hover { background: var(--primary-soft); }
.color-picker { display: flex; gap: 13px; margin: 10px 0 25px; }
.color-choice { width: 37px; height: 37px; border-radius: 50%; background: var(--team-color); border: 3px solid white; outline: 2px solid transparent; }
.color-choice.selected { outline-color: var(--team-color); }
.color-choice.selected::after { content: '✓'; color: white; font-weight: 700; }
.color-choice:hover { transform: scale(1.08); }
.team-custom-preview { display: flex; align-items: center; gap: 13px; background: var(--background); padding: 18px; border-radius: 14px; margin-bottom: 25px; }
.team-custom-preview .mascot { width: 52px; height: 52px; }
.team-custom-preview .mascot svg { width: 30px; height: 30px; }
.team-custom-preview strong { font-size: 18px; }
.player-team-name { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.player-team-name .mascot { width: 54px; height: 54px; }
.player-team-name .mascot svg { width: 30px; height: 30px; }
.player-team-name h1 { margin-bottom: 3px; font-size: 25px; }
.team-invite { background: #f5f2fc; padding: 22px; border-radius: 15px; text-align: center; margin-bottom: 24px; }
.team-invite .invite-code { font-size: 48px; margin: 9px 0 16px; }
.team-invite .buttons { display: flex; gap: 8px; justify-content: center; }
.team-invite p { color: var(--muted); font-size: 12px; }
.waiting-block { text-align: center; padding: 26px 12px 10px; }
.waiting-block .waiting-icon { margin: 0 auto 15px; width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.waiting-block .waiting-icon svg { width: 28px; height: 28px; }
.waiting-block h2 { margin-bottom: 8px; }
.waiting-block p { font-size: 13px; color: var(--muted); }
.question-progress { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 17px; }
.timer { font: 700 19px 'Consolas',monospace; color: var(--primary); background: var(--primary-soft); border-radius: 7px; padding: 7px 12px; min-width: 66px; text-align: center; }
.timer.urgent { color: var(--danger); background: #fff1f3; }
.question-figure { margin: 18px 0; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); }
.question-figure figcaption { display: flex; justify-content: flex-end; margin-top: 10px; }
.question-image { display: block; max-width: 100%; width: 100%; height: clamp(160px,45vw,270px); object-fit: contain; background: var(--surface); }
.question-topic { display: inline-block; margin-bottom: 10px; color: var(--primary); font-size: 13px; font-weight: 600; }
.player-question-title { font-size: 23px; overflow-wrap: anywhere; }
.question-metadata { margin: 20px 0; font-size: 13px; }
.question-metadata summary { margin-bottom: 15px; color: var(--primary); }
.zoom-stage { overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.zoom-stage img { display: block; width: 100%; max-width: none; }
.zoom-stage.enlarged img { width: 200%; }
.answer-options { display: grid; gap: 10px; margin: 24px 0; }
.answer-option { display: flex; align-items: center; gap: 12px; border: 2px solid var(--border); border-radius: 12px; min-height: 60px; padding: 12px 15px; cursor: pointer; transition: background .15s, border-color .15s; }
.answer-option:hover { background: #f8f6ff; border-color: #c6bfea; }
.answer-option:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); }
.answer-option input { width: 17px; height: 17px; accent-color: var(--primary); flex-shrink: 0; }
.answer-option span { overflow-wrap: anywhere; font-size: 15px; }
.answer-option .option-letter { color: var(--muted); font: 700 13px 'Consolas',monospace; }
.player-score { margin-bottom: 17px; display: flex; justify-content: space-between; font-size: 12px; }
.player-score strong { color: var(--primary); }
.display-page { min-height: 100vh; padding: 36px 5vw 50px; background: var(--background); }
.display-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 35px; }
.display-title { text-align: center; margin-bottom: 30px; }
.display-title h1 { font-size: clamp(30px,4vw,50px); }
.display-title p { margin-top: 12px; color: var(--muted); font-size: 17px; }
.display-page .race-panel { max-width: 1400px; margin: auto; padding: 35px; }
.display-page .race-rows { gap: 28px; }
.display-page .race-row { grid-template-columns: 210px minmax(0,1fr) 100px; gap: 24px; }
.display-page .team-label strong { font-size: 20px; }
.display-page .mascot { width: 46px; height: 46px; border-radius: 13px; }
.display-page .track { height: 40px; }
.display-page .track-fill::before { height: 12px; top: 14px; }
.display-page .track-end { width: 50px; height: 50px; right: -20px; }
.display-page .track-end svg { width: 29px; height: 29px; }
.display-page .score { font-size: 28px; }
.display-page .score small { font-size: 12px; }
.display-page .race-axis { margin-left: 234px; margin-right: 128px; font-size: 12px; }
.display-page .race-footer { font-size: 13px; }
.display-footer { text-align: center; margin-top: 28px; color: var(--muted); font-size: 15px; }
.display-page .result-winner { max-width: 1400px; margin: 0 auto 25px; border-radius: 18px; }
.display-page .result-winner h2 { font-size: 40px; }
.review-row { border-top: 1px solid var(--border); padding: 18px 0; font-size: 13px; }
.review-row h3 { font-size: 15px; margin: 8px 0; }
.status-correct { color: var(--success); }
.status-incorrect { color: var(--danger); }
@media (max-width: 1150px) {
  .layout { padding-left: 195px; } .sidebar { width: 195px; padding: 26px 12px; }
  .sidebar .brand { font-size: 23px; } .main { padding: 27px 25px; } .topbar { padding: 0 25px; }
  .dashboard-grid { grid-template-columns: minmax(0,1.6fr) minmax(235px,1fr); gap: 17px; }
  .feature-top { padding: 23px; } .feature-illustration { right: -32px; opacity: .85; width: 180px; }
  .feature-bottom { flex-wrap: wrap; } .feature-top .feature-text { max-width: 80%; }
  .checklist { padding: 22px 19px; } .race-row { grid-template-columns: 135px minmax(0,1fr) 60px; gap: 14px; }
  .race-axis { margin-left: 149px; margin-right: 86px; }
  .topbar-right .btn { display: none; }
}
@media (max-width: 1000px) {
  .dashboard-grid, .event-grid { grid-template-columns: 1fr; }
  .checklist { display: none; } .feature-illustration { right: 20px; width: 190px; }
  .feature-top .feature-text { max-width: 70%; } .stat { padding: 15px 14px; gap: 10px; }
  .stat-icon { width: 34px; height: 34px; } .stat-label { font-size: 10px; }
  .auth-story { padding: 50px 5vw; } .auth-story .race-panel { padding: 20px 15px; }
  .auth-form { padding: 35px; }
}
@media (max-width: 720px) {
  .layout { padding-left: 0; }
  .sidebar { position: relative; width: auto; padding: 17px 20px 0; bottom: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { font-size: 24px; padding: 0; } .sidebar .brand img { width: 33px; height: 33px; }
  .workspace-label, .side-divider, .sidebar-bottom, .sidebar .secondary-nav { display: none; }
  .sidebar .secondary-nav { display: flex; margin-top: 3px; }
  .side-nav { display: flex; gap: 4px; overflow-x: auto; margin-top: 15px; }
  .nav-item { border-radius: 8px 8px 0 0; padding: 10px 12px; font-size: 12px; white-space: nowrap; gap: 7px; }
  .nav-item svg { width: 16px; height: 16px; } .nav-count { display: none; }
  .topbar { min-height: 49px; padding: 0 20px; } .breadcrumbs { font-size: 10px; gap: 7px; }
  .connection { font-size: 9px; } .main { padding: 24px 20px; }
  h1 { font-size: 27px; } .page-heading { flex-direction: column; gap: 14px; margin-bottom: 22px; }
  .page-heading .subtitle { font-size: 12px; } .heading-actions { padding-top: 0; width: 100%; flex-wrap: wrap; }
  .stats { gap: 9px; margin-bottom: 23px; } .stat { display: block; padding: 13px; }
  .stat-icon { width: 28px; height: 28px; margin-bottom: 10px; } .stat-icon svg { width: 16px; height: 16px; }
  .stat-number { font-size: 23px; } .stat-label { line-height: 1.35; margin-top: 6px; }
  .feature-top { padding: 23px; min-height: 250px; } .feature-top h2 { font-size: 25px; }
  .feature-illustration { right: -28px; top: 60px; width: 145px; opacity: .55; }
  .feature-top .feature-text { max-width: 85%; } .feature-top p { max-width: 250px; }
  .feature-meta { gap: 10px; } .feature-bottom { padding: 16px 20px; }
  .feature-bottom .buttons { width: 100%; } .feature-bottom .btn { flex: 1; padding: 10px 12px; font-size: 11px; }
  .race-panel { padding: 20px 16px; } .race-row { grid-template-columns: 99px minmax(0,1fr) 46px; gap: 10px; }
  .team-label { gap: 6px; } .team-label strong { font-size: 10px; } .rank { display: none; }
  .mascot { width: 26px; height: 26px; border-radius: 8px; } .mascot svg { width: 16px; height: 16px; }
  .track { height: 18px; } .track-fill::before { top: 6px; height: 6px; }
  .track-end { width: 27px; height: 27px; right: -10px; top: -4px; border-radius: 8px; border-width: 2px; }
  .track-end svg { width: 15px; height: 15px; } .score { font-size: 15px; } .score small { font-size: 8px; }
  .race-axis { margin-left: 109px; margin-right: 68px; font-size: 8px; }
  .race-footer { flex-direction: column; gap: 5px; } .race-top h2 { font-size: 17px; }
  .event-cards, .team-grid, .guide-grid { grid-template-columns: 1fr; }
  .tabs { gap: 18px; } .toolbar { gap: 8px; } .toolbar .btn { padding: 10px 12px; font-size: 11px; }
  .search-wrap { max-width: none; flex-basis: 100%; } .question-row { padding: 16px 13px; gap: 8px; }
  .question-index { width: 18px; } .question-row .row-actions { flex-direction: column; }
  .question-row .move-button { display: flex; } .question-body h3 { font-size: 13px; }
  .modal-body { padding: 20px; } .modal-header, .modal-footer { padding: 16px 20px; }
  .btn.icon-only { min-height: 44px; width: 44px; } .modal-header .btn { min-height: 44px; width: 44px; }
  .nav-item, .tabs a { min-height: 44px; }
  .field-row { gap: 12px; } .auth-layout { display: block; } .auth-story { padding: 95px 25px 35px; }
  .auth-story > .brand { top: 24px; left: 25px; } .auth-story h1 { font-size: 35px; margin: 15px 0; }
  .auth-story .race-panel { display: none; } .auth-story p { font-size: 13px; } .auth-form { padding: 30px 25px; max-width: 500px; }
  .player-page { padding: 20px 14px 40px; } .player-header { margin-bottom: 25px; }
  .player-panel { padding: 24px 20px; } .player-panel h1 { font-size: 26px; }
  .player-panel { font-size: 16px; } .player-panel input, .player-panel .answer-option span { font-size: 16px; }
  .player-panel .btn { min-height: 46px; font-size: 14px; white-space: normal; }
  .player-question-title { font-size: 21px; line-height: 1.4; }
  .question-progress { gap: 12px; } .question-progress > span:first-child { flex: 1; min-width: 0; }
  .mascot-picker { grid-template-columns: repeat(4,1fr); gap: 10px; } .mascot-choice { height: 50px; }
  .team-custom-preview { margin-bottom: 22px; } .team-custom-preview .mascot { width: 47px; height: 47px; }
  .team-invite { padding: 20px 14px; } .team-invite .btn { font-size: 12px; }
  .display-page { padding: 22px 16px 35px; } .display-header .brand { font-size: 21px; }
  .display-header .brand img { width: 30px; height: 30px; } .display-page .race-panel { padding: 24px 16px; }
  .display-page .race-row { grid-template-columns: 100px minmax(0,1fr) 50px; gap: 12px; }
  .display-page .team-label strong { font-size: 12px; } .display-page .mascot { width: 28px; height: 28px; }
  .display-page .track { height: 25px; } .display-page .track-fill::before { top: 9px; height: 7px; }
  .display-page .track-end { width: 35px; height: 35px; right: -14px; }
  .display-page .track-end svg { width: 20px; height: 20px; } .display-page .score { font-size: 20px; }
  .display-page .race-axis { margin-left: 112px; margin-right: 72px; font-size: 9px; }
  .display-page .race-footer { font-size: 11px; } .display-page .result-winner h2 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; } *, *::before, *::after { transition-duration: 0s; animation-duration: 0s; }
  .confetti-layer { display: none; } .spinner { animation: none; }
}
@media (forced-colors: active) {
  * { scrollbar-color: auto; } .btn, .pill, .mascot, .track-end { border: 1px solid ButtonText; }
  .track-fill { background: Highlight; } .color-choice { forced-color-adjust: none; }
}
.quiz-selection { margin-bottom: 20px; }
.quiz-selection .control-actions { margin-bottom: 12px; }
.quiz-selection .field { margin: 0; min-width: 210px; }
.question-choice { display: flex; align-items: center; gap: 10px; }
.question-selected { border-color: var(--primary); background: var(--primary-soft); }
.trash-batch { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 20px; }
.trash-batch ul { padding: 0; list-style: none; }
.trash-batch li { display: flex; align-items: center; gap: 12px; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 8px 0; }
.trash-batch li span { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .quiz-selection .field { width: 100%; min-width: 0; }
  .question-choice { gap: 8px; }
  .question-row { flex-wrap: wrap; }
  .question-row .row-actions { width: 100%; flex-direction: row; justify-content: flex-end; gap: 5px; }
  .question-row .btn { width: 44px; min-height: 44px; }
}
