:root {
  --ink: #1f2933;
  --muted: #66737f;
  --line: #d9dfe7;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --accent: #3f5f86;
  --accent-dark: #2e4868;
  --accent-soft: #edf2f8;
  --danger: #a54038;
  --success: #2b7551;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
.topbar { height: 60px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #fff; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.save-status { color: var(--muted); font-size: 13px; }
.app-shell { width: min(1120px, calc(100% - 40px)); margin: 32px auto 72px; }
.app-shell.formal-active { width: min(1440px, calc(100% - 32px)); margin: 16px auto 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 32px; box-shadow: 0 8px 24px rgba(31, 41, 51, .045); }
.narrow { width: min(560px, 100%); margin: 10vh auto 0; }
h1, h2, h3 { margin: 0 0 14px; line-height: 1.28; }
h1 { font-size: clamp(26px, 4vw, 38px); }
h2 { font-size: 25px; }
h3 { font-size: 18px; }
p { line-height: 1.75; margin: 10px 0; }
.muted { color: var(--muted); }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .08em; margin-bottom: 10px; }
.stack { display: grid; gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
label { display: block; font-weight: 600; margin-bottom: 7px; }
input[type="text"], input[type="number"], select { width: 100%; height: 46px; border: 1px solid #b8c5ce; border-radius: 6px; padding: 0 13px; font-size: 16px; color: var(--ink); background: #fff; }
input[type="text"]:focus, input[type="number"]:focus, select:focus { outline: 3px solid rgba(63, 95, 134, .18); border-color: var(--accent); }
button { border: 0; border-radius: 6px; padding: 11px 17px; font-size: 15px; font-weight: 700; cursor: pointer; color: #fff; background: var(--accent); transition: background .15s ease, transform .15s ease; }
button:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .45; }
button.secondary { color: var(--ink); background: #edf1f3; }
button.secondary:hover:not(:disabled) { background: #dfe7eb; }
button.ghost { color: var(--accent-dark); background: transparent; border: 1px solid #b7ccd0; }
button.danger { background: var(--danger); }
.button-link { display: inline-flex; align-items: center; justify-content: center; width: fit-content; min-height: 46px; padding: 11px 17px; border-radius: 6px; color: #fff; background: var(--accent); font-size: 15px; font-weight: 700; text-decoration: none; }
.button-link:hover { color: #fff; background: var(--accent-dark); }
.text-link { color: var(--accent-dark); font-size: 14px; font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.notice { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 13px 16px; border-radius: 4px; }
.error { color: var(--danger); font-size: 14px; }
.success { color: var(--success); font-size: 14px; }
.progress-line { height: 7px; border-radius: 99px; background: #e3e9ed; overflow: hidden; margin: 14px 0 25px; }
.progress-line > span { display: block; height: 100%; background: var(--accent); }
.list { margin: 0; padding-left: 21px; line-height: 1.9; }
.list li { margin: 5px 0; }
.participant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.participant-grid label { margin-bottom: 7px; }
.participant-grid > div { min-width: 0; }
.participant-headphone { grid-column: 1 / -1; }
.label-note { color: var(--muted); font-size: 13px; font-weight: 500; }
.lookup-help { color: var(--muted); font-size: 13px; line-height: 1.6; }
.lookup-status { min-height: 21px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.lookup-status.success { color: var(--success); }
.lookup-status.error { color: var(--danger); }
.environment-confirmation { margin-top: 18vh; text-align: center; padding: 48px 38px; }
.environment-confirmation p { margin: 18px auto 0; color: #3f4d5b; font-size: 18px; line-height: 1.8; }
.environment-actions { display: flex; justify-content: center; margin-top: 30px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-card { min-height: 110px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); display: grid; gap: 6px; justify-items: center; font-size: 13px; }
.choice-card:hover:not(:disabled), .choice-card.selected { border-color: var(--accent); background: var(--accent-soft); transform: none; }
.scale-endpoints { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; font-size: 13px; color: var(--muted); }
.scale-endpoints > span { max-width: 48%; }
.scale-endpoints > span:last-child { margin-left: auto; text-align: right; }
.guidance-list { border-top: 1px solid var(--line); }
.guidance-section { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 18px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.guidance-index { color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .08em; padding-top: 3px; }
.guidance-content h3 { margin-bottom: 9px; }
.guidance-content p { margin: 0 0 16px; color: #3f4d5b; }
.guidance-endpoints { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dimension-hint { display: flex; gap: 10px; align-items: baseline; margin: 4px 0 15px; padding: 11px 13px; border-left: 3px solid #8ea5c0; background: #f8fafc; color: #4b5968; font-size: 14px; line-height: 1.7; }
.hint-label { flex: 0 0 auto; color: var(--accent-dark); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.prompt-keyword { color: var(--accent-dark); font-weight: 700; }
.formal-shell { display: grid; gap: 10px; padding: 18px 24px 20px; }
.formal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.formal-head .eyebrow { margin-bottom: 4px; }
.formal-head h2 { margin-bottom: 6px; }
.trial-meta { color: var(--muted); font-size: 14px; }
.progress-line { margin: 4px 0 8px; }
.formal-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: center; min-height: 0; }
.video-wrap { width: 100%; aspect-ratio: 16 / 9; max-height: calc(100dvh - 185px); background: #101719; border-radius: 7px; overflow: hidden; display: grid; place-items: center; scroll-margin-top: 16px; }
.video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; background: #101719; }
.video-placeholder { width: 100%; height: 100%; padding: 20px; display: grid; place-items: center; text-align: center; color: #d7e5e8; background: #18272b; line-height: 1.8; }
.score-panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 18px; }
.score-panel h3 { margin-bottom: 8px; }
.dimension-hint { margin: 2px 0 8px; padding: 8px 11px; font-size: 13px; line-height: 1.5; }
.score-buttons { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 8px 0 4px; }
.score-button { min-height: 44px; padding: 0; display: grid; place-items: center; color: var(--ink); background: #f0f4f5; border: 1px solid #ccd8dd; text-align: center; line-height: 1; }
.score-button:hover:not(:disabled), .score-button.selected { color: #fff; background: var(--accent); border-color: var(--accent); }
.score-reminder { min-height: 22px; color: var(--danger); font-size: 14px; line-height: 1.6; }
.break-panel, .finish-panel { text-align: center; padding: 55px 30px; }
.break-panel .row, .finish-panel .row { justify-content: center; margin-top: 25px; }
.hidden-preload { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.footer-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.formal-shell .footer-actions { margin-top: 10px; }
.formal-shell .footer-actions .right { justify-content: flex-end; }
.footer-actions .right { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.admin-panel { margin-top: 10vh; }
.admin-note { font-size: 13px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.admin-export-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.button-link.disabled { color: #7b8794; background: #e2e7ec; pointer-events: none; cursor: not-allowed; }
.match-list { min-width: 0; }
.match-heading { margin-bottom: 10px; color: var(--accent-dark); font-size: 14px; font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; }
.match-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.match-table th, .match-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.match-table th { color: var(--muted); background: #f8fafc; font-weight: 700; }
.match-table tr:last-child td { border-bottom: 0; }
.table-checkbox { display: inline-flex; align-items: center; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.empty-state { padding: 18px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .topbar { padding: 0 17px; }
  .app-shell { width: min(100% - 24px, 1120px); margin-top: 18px; }
  .panel { padding: 21px 17px; }
  .practice-layout { grid-template-columns: 1fr; }
  .participant-grid { grid-template-columns: 1fr; }
  .participant-headphone { grid-column: auto; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-buttons { gap: 5px; }
  .score-button { padding: 8px 4px; }
  .app-shell.formal-active { width: min(100% - 16px, 1120px); margin-top: 8px; }
  .formal-shell { padding: 14px 10px; }
  .formal-workspace { grid-template-columns: 1fr; gap: 12px; }
  .video-wrap { max-height: none; }
  .score-panel { padding: 14px 12px; }
  .guidance-section { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 20px 0; }
  .guidance-endpoints { grid-template-columns: 1fr; gap: 6px; }
  .dimension-hint { display: block; }
  .hint-label { display: block; margin-bottom: 3px; }
  .admin-export-row { grid-template-columns: 1fr; }
}

@media (min-width: 761px) and (max-width: 980px) {
  .formal-workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
  .score-panel { padding: 14px; }
  .formal-shell .footer-actions .right { display: grid; width: 100%; }
}

@media (min-width: 761px) and (max-height: 720px) {
  .formal-head .eyebrow { display: none; }
  .formal-head h2 { margin-bottom: 3px; font-size: 21px; }
  .formal-shell { gap: 6px; padding-top: 12px; padding-bottom: 12px; }
  .video-wrap { max-height: calc(100dvh - 155px); }
  .score-panel { padding-top: 13px; padding-bottom: 13px; }
}
