:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f6f8fb;
  color: #172033;
  font-synthesis: none;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-muted: #f0f4f8;
  --ink: #172033;
  --muted: #66768a;
  --soft: #90a0b4;
  --line: #dce5ef;
  --line-strong: #c7d4e2;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f97316;
  --success: #0f9f6e;
  --danger: #d33f49;
  --warn: #c47a09;
  --live-bg: #0b1118;
  --live-panel: #111a24;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--bg); }
button, input, select, textarea { min-width: 0; font: inherit; }
button { border: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
img, video, canvas, svg { max-width: 100%; }
#app { min-width: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 850; line-height: 1.15; letter-spacing: 0; }

.app-shell { min-height: 100svh; display: flex; flex-direction: column; background: var(--bg); }
.app-shell:has(.workspace) { min-height: 100svh; background: var(--live-bg); }
.app-shell:has(.workspace) .topbar { display: none; }
body.live-room-active { overflow: hidden; background: var(--live-bg); }
body.live-room-active .app-shell { min-height: 100svh; background: var(--live-bg); }
body.live-room-active .topbar { display: none; }
body.live-room-active .site-footer { display: none; }
body.live-room-active #app, body.live-room-active .app-shell, body.live-room-active .workspace, body.live-room-active .workarea { height: 100svh; min-height: 0; }
body:has(.workspace) { overflow: hidden; background: var(--live-bg); }
body:has(.workspace) .app-shell { min-height: 100svh; background: var(--live-bg); }
body:has(.workspace) .topbar { display: none; }
body:has(.workspace) .site-footer { display: none; }
.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px clamp(16px, 4vw, 42px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); box-shadow: 0 1px 0 rgba(15, 23, 42, .02); }
.brand { display: flex; gap: 11px; align-items: center; min-width: 0; color: var(--ink); font-size: 18px; font-weight: 850; }
.brand > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: #fff; background: linear-gradient(135deg, var(--primary), #18a0b6); font-family: Georgia, serif; font-size: 22px; box-shadow: inset 0 -1px 0 rgba(255,255,255,.22); }
.topbar-meta { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.panel { width: min(960px, calc(100% - 36px)); margin: auto; padding: 42px 0; }
.intro { max-width: 680px; padding: 18px 0 30px; }
.intro p { margin-top: 14px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.label, .eyebrow { color: var(--primary); font-size: 12px; font-weight: 850; letter-spacing: 0; }
.setup-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.setup-card { padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 10px 28px rgba(24, 43, 66, .06); }
.setup-card h2 { color: var(--ink); font-size: 19px; }
.setup-card p { min-height: 50px; margin: 10px 0 22px; color: var(--muted); line-height: 1.6; }
.room-qr-panel { display: grid; grid-template-columns: 118px minmax(0, 1fr); align-items: center; gap: 16px; margin: 22px 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 10px 28px rgba(24, 43, 66, .05); }
.room-qr-panel > .label { grid-column: 1 / -1; }
.room-qr-panel img { width: 118px; height: 118px; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.room-qr-panel p:not(.label) { color: var(--muted); font-size: 13px; line-height: 1.6; }
.room-qr-loading { color: var(--soft); font-size: 13px; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; padding: 0 17px; border: 1px solid var(--primary); border-radius: 6px; color: #fff; background: var(--primary); font-weight: 800; text-align: center; transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.button:hover { border-color: var(--primary-dark); background: var(--primary-dark); box-shadow: 0 8px 18px rgba(37, 99, 235, .18); }
.button.secondary { color: var(--ink); border-color: var(--line-strong); background: #fff; box-shadow: none; }
.button.secondary:hover { border-color: var(--primary); color: var(--primary); background: #f8fbff; }
.room-input { width: 100%; height: 48px; margin: 10px 0; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font-size: 20px; letter-spacing: 2px; }
.room-input::placeholder, .management-input::placeholder { color: #98a7b8; }
.room-input:focus { border-color: var(--primary); outline: 2px solid rgba(37, 99, 235, .18); outline-offset: 0; }

.workspace { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; min-height: 100svh; background: var(--live-bg); color: #e8eef7; }
.sidebar { padding: 24px; border-right: 1px solid #263344; background: #101923; }
.room-code { margin: 8px 0 24px; color: #fff; font-size: 32px; font-weight: 900; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.device-list { display: grid; gap: 9px; margin: 12px 0 24px; }
.device { display: flex; justify-content: space-between; align-items: center; min-height: 38px; padding: 0 11px; border: 1px solid #2a3a4d; border-radius: 6px; color: #c7d4e2; font-size: 13px; background: #121e2a; }
.device .dot { width: 8px; height: 8px; border-radius: 50%; background: #66768a; }
.device.online { border-color: rgba(15, 159, 110, .45); }
.device.online .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(15, 159, 110, .14); }
.status-block { border-top: 1px solid #263344; padding-top: 18px; color: #c7d4e2; font-size: 13px; line-height: 1.65; }
.status-good { color: #5ee0ad; }
.status-warn { color: #f6c65b; }
.room-subject { margin: 7px 0 21px; color: #fff; font-size: 16px; font-weight: 850; }
.room-subject small { display: block; margin-top: 4px; color: #9babbc; font-size: 12px; font-weight: 500; }
.workarea { position: relative; min-width: 0; background: #0b1118; }
.room-toolbar { position: absolute; z-index: 5; top: 14px; left: 18px; }
.room-back-button { min-height: 36px; padding: 0 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; background: rgba(10, 16, 23, .8); color: #e8eef7; font-size: 13px; font-weight: 800; backdrop-filter: blur(8px); }
.room-back-button:hover { border-color: var(--accent); color: #ffd3a8; }

.start-area { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; padding: clamp(64px, 6vw, 76px) clamp(18px, 4vw, 44px) clamp(22px, 4vw, 44px); background: radial-gradient(circle at 50% 50%, #132034 0, #0b1118 60%); }
.role-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.role-heading h1 { color: #fff; font-size: 25px; }
.role-heading p { color: #aebdca; font-size: 14px; line-height: 1.6; }
.signal-stage { display: grid; align-content: center; justify-items: center; gap: 20px; }
.signal-label { min-height: 35px; color: #bcc9d6; font-size: 17px; }
.fire-button { width: min(54vh, 460px); aspect-ratio: 1; border-radius: 50%; color: #fff; background: #d43f48; box-shadow: inset 0 0 0 11px rgba(255,255,255,.18), 0 22px 60px rgba(212, 63, 72, .3); font-size: clamp(42px, 8vw, 72px); font-weight: 900; transition: background .16s ease, box-shadow .16s ease; }
.fire-button:active { background: #b82f38; }
.fire-button.fired { background: #526273; box-shadow: inset 0 0 0 11px rgba(255,255,255,.12), 0 18px 50px rgba(8, 13, 20, .35); }
.signal-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(620px, 100%); }
.signal-button { min-height: 56px; border: 1px solid #2d3d50; border-radius: 6px; color: #eef3f7; background: #172332; font-weight: 800; transition: background .18s ease, border-color .18s ease, color .18s ease; }
.signal-button:hover { border-color: #496179; background: #1e3042; }
.signal-button.false { color: #ffd2cf; border-color: rgba(211, 63, 73, .42); background: #351b22; }
.signal-button.reset { color: #221305; border-color: #f7b267; background: #f7b267; }

.finish-area { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; padding: 64px 18px 18px; gap: 16px; background: #0b1118; }
.camera-stage { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; border: 1px solid #263344; border-radius: 8px; background: #05080d; }
.camera-stage video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center center; background: #05080d; transform: translateZ(0); }
.camera-placeholder { color: #96a6b3; font-size: 15px; }
.finish-line { position: absolute; top: 0; bottom: 0; left: 65%; border-left: 3px solid #f7c948; pointer-events: none; }
.finish-line::before { content: "终点线"; position: absolute; top: 10px; left: 9px; padding: 3px 6px; border-radius: 4px; background: #f7c948; color: #141b25; font-size: 12px; font-weight: 850; white-space: nowrap; }
.hud { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.rec { display: inline-flex; gap: 7px; align-items: center; padding: 7px 10px; border-radius: 6px; background: rgba(8, 13, 20, .8); color: #dbe7f3; font-size: 13px; font-weight: 850; }
.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #6c7781; }
.rec.active::before { background: #eb4b51; box-shadow: 0 0 0 3px rgba(235, 75, 81, .18); }
.elapsed { padding: 7px 10px; border-radius: 6px; background: rgba(8, 13, 20, .82); color: #fff; font-size: 23px; font-weight: 900; }
.finish-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.frame-info { color: #aebdca; font-size: 13px; line-height: 1.5; }
.bitrate-control { display: grid; gap: 5px; min-width: 176px; color: #b8c7d2; font-size: 12px; font-weight: 800; }
.bitrate-control input { height: 39px; border: 1px solid #33475c; border-radius: 6px; padding: 0 10px; background: #111b27; color: #eef3f6; font-size: 14px; }
.video-button { min-width: 165px; }

.review-area { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; padding: 64px 18px 18px; gap: 16px; background: #0b1118; }
.review-video { position: relative; display: grid; min-height: 0; place-items: center; overflow: hidden; border: 1px solid #263344; border-radius: 8px; background: #05080d; }
.review-frame { position: relative; display: grid; width: 100%; height: 100%; max-width: 100%; max-height: 100%; background: #05080d; }
.review-video video { display: block; width: 100%; height: 100%; object-fit: contain; }
.review-finish-line { z-index: 2; }
.review-overlay { position: absolute; z-index: 3; top: 14px; right: 14px; padding: 9px 12px; border-radius: 6px; background: rgba(8, 13, 20, .84); color: #f7c948; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; font-weight: 900; }
.review-controls { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.icon-button { width: 52px; height: 46px; border-radius: 6px; color: #fff; background: #1a2a3b; font-size: 24px; transition: background .18s ease; }
.icon-button:hover { background: #243a51; }
.timeline { width: 100%; accent-color: var(--accent); }
.result-box { min-width: 142px; text-align: right; font-variant-numeric: tabular-nums; }
.result-box strong { display: block; color: #f7c948; font-size: 24px; }
.result-box span { color: #9eafc0; font-size: 12px; }
.confirm-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.confirm-row > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.confirm-row p { color: #aebdca; font-size: 13px; line-height: 1.6; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 10; display: grid; gap: 8px; }
.toast { max-width: min(420px, calc(100vw - 36px)); padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); box-shadow: 0 14px 34px rgba(24, 43, 66, .16); }

.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; line-height: 1.6; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.beian-link { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.beian-link img { width: 18px; height: 18px; flex: 0 0 auto; object-fit: contain; }

.login-screen { min-height: calc(100svh - 64px); display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #eef5ff 0%, #f8fafc 56%, #ffffff 100%); }
.login-card { width: min(100%, 420px); display: grid; gap: 15px; padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: 0 22px 55px rgba(24, 43, 66, .12); }
.login-card .brand { margin-bottom: 6px; }
.login-card h1 { color: var(--ink); font-size: 26px; }
.login-card p { margin-top: -4px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-contact { padding: 10px 12px; border: 1px solid #fed7aa; border-radius: 6px; background: #fff7ed; color: #9a3412 !important; font-weight: 850; }

.assessment-center { width: min(1200px, calc(100% - 36px)); margin: 0 auto; padding: 30px 0 48px; }
.assessment-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.assessment-header h1 { color: var(--ink); font-size: 28px; }
.assessment-header p { margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.assessment-account { display: flex; min-width: 0; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.assessment-account strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.text-button { border: 0; background: transparent; color: var(--primary); font-weight: 800; }
.text-button:hover { color: var(--primary-dark); text-decoration: underline; }
.assessment-nav { display: flex; gap: 6px; max-width: 100%; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.assessment-nav::-webkit-scrollbar { display: none; }
.assessment-nav-button { flex: 0 0 auto; min-height: 38px; padding: 0 13px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; transition: background .18s ease, color .18s ease; }
.assessment-nav-button:hover { color: var(--ink); background: var(--surface-muted); }
.assessment-nav-button.active { color: #fff; background: var(--primary); }
.assessment-content { padding-top: 20px; }
.live-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.live-panel { display: grid; align-content: start; gap: 15px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 28px rgba(24, 43, 66, .06); }
.live-panel h2 { color: var(--ink); font-size: 21px; line-height: 1.35; }

.management-field { display: grid; gap: 7px; color: #53647a; font-size: 13px; font-weight: 800; }
.management-field input, .management-field select, .management-field textarea, .management-input, .management-select { min-height: 42px; width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; }
.management-field textarea { min-height: 92px; resize: vertical; }
.management-field input:disabled { color: #7c8ca0; background: #eef3f8; }
.management-empty { padding: 48px 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); text-align: center; font-size: 14px; }
.management-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.management-input { width: min(100%, 280px); }
.management-select { width: auto; min-width: 140px; }
.toolbar-spacer { flex: 1; }
.management-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(24, 43, 66, .05); -webkit-overflow-scrolling: touch; }
.management-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.management-table th, .management-table td { padding: 13px 15px; border-bottom: 1px solid #edf2f7; color: #26364a; text-align: left; font-size: 13px; white-space: nowrap; }
.management-table th { background: #f8fafc; color: #64758a; font-size: 12px; font-weight: 850; }
.management-table tbody tr:hover { background: #f8fbff; }
.management-table tbody tr:last-child td { border-bottom: 0; }
.table-button { margin-right: 10px; padding: 0; border: 0; background: transparent; color: var(--primary); font-size: 13px; font-weight: 750; }
.table-button:hover { color: var(--primary-dark); text-decoration: underline; }
.table-button.danger { color: var(--danger); }
.score-cell { font-variant-numeric: tabular-nums; font-weight: 900; }
.record-status { display: inline-flex; min-height: 23px; align-items: center; padding: 0 8px; border-radius: 999px; background: #eef3f8; color: #56687d; font-size: 12px; font-weight: 850; }
.record-status.valid { background: #e5f8ef; color: #0b7a4e; }
.record-status.false_start, .record-status.void { background: #fff0f1; color: #b4232c; }

.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.profile-primary, .profile-card { min-height: 210px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 28px rgba(24, 43, 66, .05); }
.profile-primary { grid-column: 1 / -1; min-height: 238px; border-left: 4px solid var(--primary); background: #f8fbff; }
.profile-primary h2, .profile-card h2 { margin: 7px 0 0; color: var(--ink); font-size: 24px; line-height: 1.35; }
.membership-countdown { margin-top: 19px; color: var(--primary); font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.membership-countdown.expired { color: var(--danger); }
.profile-note { max-width: 620px; margin: 9px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.profile-list { display: grid; gap: 0; margin: 22px 0 0; }
.profile-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #edf2f7; }
.profile-list dt { color: var(--muted); font-size: 13px; }
.profile-list dd { margin: 0; color: var(--ink); font-size: 13px; font-weight: 850; text-align: right; }

.assessment-dialog { width: min(620px, calc(100% - 28px)); max-height: min(760px, calc(100svh - 28px)); padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); box-shadow: 0 22px 70px rgba(24, 43, 66, .28); }
.assessment-dialog::backdrop { background: rgba(15, 23, 42, .46); }
.assessment-dialog form { max-height: min(760px, calc(100svh - 28px)); overflow: auto; padding: 22px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.dialog-heading h2 { color: var(--ink); font-size: 19px; }
.dialog-close { width: 32px; height: 32px; border: 0; border-radius: 6px; background: #edf2f7; color: #4d6073; font-size: 23px; line-height: 1; }
.dialog-close:hover { background: #dfe8ef; }
.management-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.management-form-grid .full { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.batch-panel { gap: 14px; }
.device-check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.device-check-item { min-height: 176px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 28px rgba(24, 43, 66, .05); }
.device-check-item.ok { border-left: 4px solid var(--success); }
.device-check-item.failed { border-left: 4px solid var(--danger); }
.device-check-item h2 { margin-top: 8px; color: var(--ink); font-size: 22px; line-height: 1.35; }
.device-check-item.ok h2 { color: #0b7a4e; }
.device-check-item.failed h2 { color: #b4232c; }
.device-check-item p:last-child { margin-top: 11px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.device-check-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.device-check-actions .button { min-height: 42px; }
.local-video-note { margin-bottom: 14px; padding: 14px 16px; border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; background: #fff7ed; color: #78420f; font-size: 13px; line-height: 1.6; }
.batch-selection-toolbar { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; min-height: 30px; color: #53647a; font-size: 13px; }
.batch-selection-toolbar strong { color: var(--primary); font-variant-numeric: tabular-nums; }
.batch-selection-toolbar .table-button { margin: 0; }
.batch-student-list { display: grid; max-height: 286px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.batch-student { display: flex; min-height: 50px; align-items: center; gap: 11px; padding: 10px 12px; border-bottom: 1px solid #edf2f7; color: var(--ink); cursor: pointer; }
.batch-student:last-child { border-bottom: 0; }
.batch-student:hover { background: #f8fbff; }
.batch-student input { width: 17px; height: 17px; accent-color: var(--primary); }
.batch-student span { display: grid; gap: 3px; min-width: 0; }
.batch-student strong { font-size: 14px; }
.batch-student small { color: var(--muted); font-size: 12px; }
.batch-placeholder { padding: 28px 16px; color: var(--muted); font-size: 13px; text-align: center; }
.batch-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.batch-actions .button { min-height: 42px; }
.batch-history-panel { min-height: 0; }
.batch-history-list { display: grid; border-top: 1px solid var(--line); }
.batch-history-row { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: stretch; border-bottom: 1px solid var(--line); }
.batch-history-apply { display: grid; gap: 4px; min-width: 0; padding: 13px 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.batch-history-apply:hover strong { color: var(--primary); }
.batch-history-apply strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.batch-history-apply span { color: var(--muted); font-size: 12px; }
.batch-history-delete { width: 34px; border: 0; background: transparent; color: var(--danger); font-size: 22px; }
.batch-history-delete:hover { background: #fff0f1; }
.role-heading > strong { color: #f7c948; font-size: 14px; white-space: nowrap; }
.picker-summary { margin-bottom: 15px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.picker-summary strong { color: var(--primary); font-variant-numeric: tabular-nums; }
.student-picker-list { display: grid; max-height: min(420px, 55svh); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.student-picker-item { display: flex; min-height: 54px; align-items: center; gap: 11px; padding: 10px 13px; border-bottom: 1px solid #edf2f7; color: var(--ink); cursor: pointer; }
.student-picker-item:last-child { border-bottom: 0; }
.student-picker-item:hover { background: #f8fbff; }
.student-picker-item input { width: 17px; height: 17px; accent-color: var(--primary); }
.student-picker-item span { display: grid; gap: 3px; min-width: 0; }
.student-picker-item small { color: var(--muted); font-size: 12px; }
[hidden] { display: none !important; }

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .topbar { min-height: 58px; gap: 10px; padding: 10px 14px; }
  .brand { gap: 9px; font-size: 16px; }
  .brand-mark { width: 32px; height: 32px; font-size: 20px; }
  .topbar-meta { display: none; }
  .panel { width: min(100% - 28px, 960px); padding: 24px 0; }
  .intro { padding: 8px 0 20px; }
  .intro p { font-size: 14px; line-height: 1.65; }
  .setup-grid { grid-template-columns: 1fr; }
  .setup-card { padding: 18px; }
  .setup-card p { min-height: 0; margin-bottom: 18px; }
  .setup-card .button, #back-to-center, .join-panel .button { width: 100%; }
  .workspace { grid-template-columns: 1fr; min-height: 100svh; }
  .sidebar { display: none; }
  .room-toolbar { top: 10px; left: 12px; }
  .room-back-button { min-height: 40px; padding-inline: 12px; }
  .start-area, .finish-area, .review-area { min-height: 100svh; padding: 58px 12px max(12px, env(safe-area-inset-bottom)); gap: 12px; }
  .start-area { grid-template-rows: auto minmax(0, 1fr) auto; }
  .role-heading { display: grid; gap: 6px; }
  .role-heading h1 { font-size: 22px; }
  .role-heading p { font-size: 13px; }
  .role-heading > strong { white-space: normal; }
  .signal-stage { gap: 14px; }
  .signal-label { min-height: 28px; font-size: 15px; }
  .fire-button { width: min(72vw, 42vh, 330px); font-size: clamp(38px, 14vw, 58px); }
  .signal-controls { grid-template-columns: 1fr 1fr; }
  .signal-button { min-height: 50px; }
  .signal-button.reset { grid-column: 1 / -1; }
  .finish-area { position: relative; height: 100svh; min-height: 0; display: block; padding: 0; overflow: hidden; }
  .finish-area .role-heading { position: absolute; z-index: 6; top: 58px; left: 12px; right: 12px; display: block; pointer-events: none; }
  .finish-area .role-heading h1 { display: none; }
  .finish-area .role-heading p { max-width: 100%; overflow: hidden; color: rgba(232, 238, 247, .92); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 10px rgba(0,0,0,.55); }
  .finish-area .camera-stage { position: absolute; inset: 0; min-height: 0; border: 0; border-radius: 0; }
  .finish-line { border-left-width: 2px; }
  .finish-line::before { top: 92px; left: 7px; font-size: 11px; }
  .finish-area .hud { top: 92px; left: 12px; gap: 7px; }
  .rec { padding: 6px 8px; font-size: 12px; }
  .elapsed { padding: 6px 8px; font-size: 19px; }
  .finish-actions { position: absolute; z-index: 6; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr; gap: 8px; padding: 10px; border: 1px solid rgba(203, 213, 225, .2); border-radius: 8px; background: rgba(5, 8, 13, .72); box-shadow: 0 -12px 30px rgba(0,0,0,.26); backdrop-filter: blur(12px); }
  .frame-info { font-size: 11px; line-height: 1.35; }
  .bitrate-control { min-width: 0; width: 100%; }
  .bitrate-control span { display: none; }
  .bitrate-control input { height: 40px; }
  .video-button { width: 100%; min-width: 0; min-height: 46px; }
  .review-area { grid-template-rows: auto minmax(260px, 1fr) auto; }
  .review-controls { grid-template-columns: auto auto 1fr; }
  .icon-button { width: 48px; height: 46px; }
  .review-overlay { top: 10px; right: 10px; font-size: 17px; }
  .result-box { grid-column: 1 / -1; text-align: left; }
  .result-box strong { font-size: 22px; }
  .confirm-row { display: grid; }
  .confirm-row > div { display: grid; grid-template-columns: 1fr; justify-content: stretch; }
  .confirm-row .button { width: 100%; min-height: 46px; }
  .login-screen { min-height: calc(100svh - 58px); padding: 18px; }
  .login-card { padding: 24px; }
  .login-card .button { width: 100%; min-height: 48px; }
  .assessment-center { width: min(100% - 28px, 1200px); padding-top: 22px; }
  .assessment-header { display: grid; align-items: start; gap: 12px; margin-bottom: 14px; }
  .assessment-header h1 { font-size: 24px; }
  .assessment-account { width: 100%; justify-content: space-between; gap: 9px; font-size: 12px; }
  .assessment-account strong { max-width: calc(100vw - 94px); }
  .assessment-account .text-button { white-space: nowrap; }
  .assessment-nav { gap: 4px; }
  .assessment-nav-button { min-height: 42px; min-width: 0; padding: 0 10px; font-size: 13px; }
  .assessment-content { padding-top: 14px; }
  .live-grid { grid-template-columns: 1fr; }
  .live-panel { gap: 13px; padding: 18px; }
  .live-panel h2 { font-size: 19px; }
  .device-check-grid { grid-template-columns: 1fr; }
  .device-check-item { min-height: 0; padding: 18px; }
  .device-check-actions { display: grid; grid-template-columns: 1fr; }
  .device-check-actions .button { width: 100%; min-height: 46px; }
  .room-qr-panel { grid-template-columns: 1fr; }
  .room-qr-panel img { width: 112px; height: 112px; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-primary { grid-column: auto; }
  .profile-primary, .profile-card { min-height: 0; padding: 18px; }
  .membership-countdown { font-size: 28px; }
  .profile-list div { display: grid; gap: 4px; }
  .profile-list dd { text-align: left; overflow-wrap: anywhere; }
  .management-toolbar { display: grid; grid-template-columns: 1fr; }
  .management-toolbar .button, .management-input, .management-select { width: 100%; }
  .toolbar-spacer { display: none; }
  .management-table { min-width: 620px; }
  .management-empty { padding: 34px 16px; }
  .management-form-grid { grid-template-columns: 1fr; }
  .management-form-grid .full { grid-column: auto; }
  .dialog-heading { margin-bottom: 16px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr; }
  .dialog-actions .button { width: 100%; min-height: 46px; }
  .batch-selection-toolbar { grid-template-columns: 1fr auto auto; }
  .batch-selection-toolbar span { display: none; }
  .batch-student-list { max-height: 242px; }
  .batch-actions { display: grid; grid-template-columns: 1fr; }
  .batch-actions .button { width: 100%; min-height: 46px; }
  .local-video-note { padding: 12px 13px; }
  .toast-region { right: 12px; bottom: 12px; left: 12px; }
  .toast { max-width: none; }
  .site-footer { padding-inline: 14px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@supports (height: 100dvh) {
  .app-shell:has(.workspace) { min-height: 100dvh; }
  body.live-room-active .app-shell { min-height: 100dvh; }
  .workspace, .start-area, .finish-area, .review-area { min-height: 100dvh; }
  @media (max-width: 720px) {
    .finish-area { height: 100dvh; }
  }
}
