:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --text: #1c2030;
  --muted: #646b80;
  --line: #dfe2ec;
  --accent: #4353d8;
  --accent-text: #ffffff;
  --candidate: #e8ebff;
  --warn-bg: #fff4d6;
  --warn-text: #6b4a00;
  --error: #b3261e;
  --skin: #f1c9a5;
  --hair: #3b2a2a;
  --body: #4353d8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --surface: #1c1f2b;
    --text: #eceef5;
    --muted: #9aa1b5;
    --line: #2e3243;
    --accent: #8792ff;
    --accent-text: #10121a;
    --candidate: #2a2f4d;
    --warn-bg: #3d3212;
    --warn-text: #ffdf8a;
    --error: #ff8a80;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1 { margin: 0 0 8px; font-size: 1.6rem; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 4px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
}
.lobby { max-width: 520px; margin: 6vh auto; }
.lede { color: var(--muted); margin-top: 0; }
.hint { color: var(--muted); font-size: 0.85rem; margin-bottom: 0; }
form label { display: block; margin: 14px 0; font-weight: 600; font-size: 0.9rem; }
input:not([type="checkbox"]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
textarea { resize: vertical; }
.check { display: flex; gap: 10px; font-weight: 400; color: var(--muted); align-items: flex-start; }
.check input { margin-top: 4px; }
button { font: inherit; cursor: pointer; border-radius: 8px; padding: 10px 16px; border: 1px solid var(--line); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.ghost { background: transparent; color: var(--text); }
.ghost[aria-pressed="true"], .ghost.active { border-color: var(--accent); color: var(--accent); }
.error { color: var(--error); font-size: 0.9rem; min-height: 1.2em; margin: 4px 0; }
.banner { background: var(--warn-bg); color: var(--warn-text); padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; }

/* Interview room */
.room { max-width: 1000px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.progress { color: var(--muted); font-size: 0.9rem; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 68vh; background: #0b0d14; border-radius: 16px; overflow: hidden; }
.avatar-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.preview-note { color: #c9cde0; font-size: 0.85rem; margin: 0; padding: 0 16px; text-align: center; }
.avatar { width: min(38%, 220px); height: auto; }
.av-bg { fill: #2a2f4d; }
.av-body { fill: var(--body); }
.av-skin { fill: var(--skin); }
.av-hair { fill: var(--hair); }
.av-eyes { fill: #2a2222; }
.av-mouth { fill: #a8433f; transform-origin: 100px 116px; }
.stage.speaking .av-mouth { animation: talk 0.32s infinite alternate ease-in-out; }
@keyframes talk { from { transform: scaleY(0.6); } to { transform: scaleY(3.2) scaleX(0.85); } }
@media (prefers-reduced-motion: reduce) { .stage.speaking .av-mouth { animation: none; } }
.chip { position: absolute; top: 12px; left: 12px; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; }
.stage.listening .chip { background: #1f7a4d; }
.nameplate { position: absolute; left: 12px; bottom: 12px; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 0.85rem; }
.selfview { position: absolute; right: 12px; top: 12px; width: 22%; max-width: 200px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.7); transform: scaleX(-1); background: #000; }
.caption { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); width: max-content; max-width: 86%; background: rgba(0, 0, 0, 0.7); color: #fff; padding: 8px 14px; border-radius: 10px; text-align: center; font-size: 1rem; }
.caption:empty { display: none; }
.caption.you { background: rgba(31, 60, 140, 0.85); }
.reconnect { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { margin-top: 0; }
.transcript { max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.interviewer { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.msg.candidate { align-self: flex-end; background: var(--candidate); }
.msg.scripted { border-left: 4px solid var(--accent); }
.msg small { display: block; color: var(--muted); font-size: 0.75rem; margin-bottom: 2px; }

/* Reviewer dashboard */
.admin { max-width: 980px; margin: 0 auto; padding: 24px 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }
tr.row { cursor: pointer; }
tr.row:hover { background: var(--bg); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; background: var(--bg); border: 1px solid var(--line); }
.note { color: var(--muted); font-size: 0.8rem; font-style: italic; }
.muted { color: var(--muted); }
.qcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.qcard p { margin: 4px 0; }
.detail .transcript { max-height: none; overflow: visible; }
@media (max-width: 560px) {
  .card { padding: 20px; }
  .stage { aspect-ratio: 3 / 4; }
  .selfview { width: 30%; }
}
