:root {
  color-scheme: dark;
  --bg: #090d11;
  --panel: #11171d;
  --panel-2: #151d24;
  --ink: #edf3f2;
  --muted: #9aaba9;
  --line: #2b363b;
  --accent: #e5bd67;
  --safe: #65d3af;
  --danger: #ff8c82;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 10px; }
button { min-height: 48px; padding: 10px 16px; background: #1b242b; color: var(--ink); cursor: pointer; }
button:hover { background: #26323a; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); color: #17130a; border-color: var(--accent); font-weight: 700; }
button.danger { border-color: #834d49; color: var(--danger); }
input, select, textarea { width: 100%; padding: 12px; background: #0c1217; color: var(--ink); }
textarea { resize: vertical; }
label, legend { display: block; margin-top: 12px; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--ink); }
label.check input { width: 22px; height: 22px; }
:where(a, button, input, select, textarea):focus-visible { outline: 3px solid #f4cf7d; outline-offset: 3px; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; padding: 10px; background: var(--accent); color: #111; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px clamp(18px, 4vw, 48px); border-bottom: 1px solid var(--line); }
h1 { margin: 2px 0 0; font-size: 23px; }
h2 { margin: 0 0 16px; font-size: 19px; }
h3 { font-size: 16px; }
h4 { margin: 0 0 8px; }
h5 { margin: 0 0 8px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; letter-spacing: 2px; }
.record-status { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); white-space: nowrap; }
.record-status[data-state="recording"] { color: #101914; background: var(--safe); border-color: var(--safe); }
.record-status[data-state="teacher"] { color: var(--accent); }
main { width: min(1180px, 100%); margin: 0 auto; padding: 22px clamp(14px, 3vw, 36px) 80px; }
.panel { margin-bottom: 18px; padding: clamp(16px, 3vw, 28px); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
#teacherView { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
#teacherView > .panel { margin: 0; }
#sessionReviewList, #incidentList { max-height: 680px; overflow: auto; }
.login-panel { max-width: 560px; margin: 6vh auto; }
.demo-actions, .button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.demo-actions { margin-top: 20px; }
.form-grid { display: grid; gap: 4px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.list { display: grid; gap: 10px; margin-top: 14px; }
.list-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.list-card > button { margin: 8px 8px 0 0; }
.list-card p { color: var(--muted); }
.selectable { border-left: 3px solid var(--accent); }
.sop-editor { display: grid; gap: 12px; }
.sop-step { padding: 8px 14px 16px; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.arm-display { margin: 18px 0; padding: 22px; border: 1px solid #665633; border-radius: 16px; background: #18170f; }
.step-number { color: var(--accent); font-size: 12px; }
.step-instruction { font-size: 22px; line-height: 1.45; font-weight: 650; }
.safety-copy { color: #f1cd8c; line-height: 1.6; }
.step-list { padding-left: 24px; color: var(--muted); line-height: 1.7; }
.step-list .current { color: var(--ink); font-weight: 650; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.label-card { margin: 18px 0; padding: 26px; text-align: center; background: #f2eee1; color: #171915; border: 6px solid #171915; border-radius: 10px; }
.label-card .eyebrow { color: #4b4a40; }
.label-card p { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.label-card button { background: #171915; color: #fff; }
.tool-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.tool-section .button-row { margin-top: 10px; }
.timeline { display: grid; gap: 8px; }
.timeline-row { display: grid; grid-template-columns: 76px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-row time, .timeline-row small { color: var(--muted); }
.media-row { display: grid; gap: 10px; }
.media-row video { display: block; width: 100%; height: auto; margin-top: 10px; background: #000; }
.session-end { justify-content: flex-end; }
.severity-high, .severity-critical { border-color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translateX(-50%); width: min(520px, calc(100% - 28px)); padding: 14px 18px; background: #e6eee9; color: #132019; border-radius: 12px; box-shadow: 0 12px 40px #0008; }
.toast.critical { background: #4a201e; color: #ffe5e2; border: 1px solid var(--danger); }
.visually-hidden { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }

body[data-client="arm"] { background: #070a0c; }
body[data-client="arm"] .topbar { padding: 16px; position: sticky; top: 0; z-index: 10; background: #070a0c; }
body[data-client="arm"] main { max-width: 480px; padding: 14px 12px 60px; }
body[data-client="arm"] .panel { padding: 16px; border-radius: 14px; }
body[data-client="arm"] .arm-display { position: sticky; top: 82px; z-index: 5; }
body[data-client="arm"] .step-instruction { font-size: 20px; }
body[data-client="arm"] .action-grid { grid-template-columns: 1fr; }

@media (max-width: 760px) {
  #teacherView { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; }
  .timeline-row { grid-template-columns: 64px 1fr; }
  .timeline-row small { grid-column: 2; }
}

@media (pointer: coarse) {
  button, input, select { min-height: 48px; }
  button { padding: 13px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  :where(a, button, input, select, textarea):focus-visible { outline: 3px solid CanvasText; }
}
