/* Học với Trụi: Graphite and sand. Charcoal surfaces, soft sand buttons, Space Grotesk headings
   over Inter. Dark but warm; the whiteboard stays white, like paper on a desk.
   Fonts are served from this site (SIL Open Font License, see /fonts). */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-vietnamese-wght-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-display: swap; font-weight: 300 700; src: url(/fonts/space-grotesk-vietnamese-wght-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-display: swap; font-weight: 300 700; src: url(/fonts/space-grotesk-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-display: swap; font-weight: 300 700; src: url(/fonts/space-grotesk-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: dark;
  --bg: #161616;          /* the room */
  --surface: #1f1f1f;     /* cards, bars, panels */
  --surface-2: #2a2a2a;   /* raised bits: date blocks, quiet buttons */
  --surface-3: #333230;   /* hover */
  --ink: #f1ece2;         /* text */
  --muted: #a9a397;
  --line: #343434;
  --accent: #e6d5b3;      /* sand: the main action */
  --accent-hover: #f0e3c8;
  --accent-ink: #1a1712;  /* text on sand */
  --accent-soft: #2e2a22; /* sand-tinted surface */
  --accent-strong: #8c7445; /* sand that shows on white (the board) */
  --warn: #f0d9a6;        /* someone at the door, visiting, spotlight */
  --warn-soft: #3a3222;
  --live: #a7ddb5;
  --live-soft: #1f3024;
  --danger: #e5534b;
  --danger-hover: #ee6a62;
  --danger-ink: #ffb4ae;
  --danger-soft: #3a2220;
  --tile: #262523;
  --tile-2: #302e2b;
  --radius: 20px;
  --gold: #e0b23f;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
  --tap: 48px;
  --head: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
#app { min-height: 100%; display: grid; }
body { font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 30px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.icon { display: inline-flex; width: 24px; height: 24px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons & fields ---------- */
.btn {
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--tap); padding: 0 1.2em; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .tool:focus-visible, .ctrl:focus-visible, .tab:focus-visible, .mini:focus-visible, .chip:focus-visible, .link:focus-visible, .thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.danger:hover { background: var(--danger-hover); }
.btn.small { min-height: 38px; padding: 0 .95em; font-size: 14px; }
.btn.big { min-height: 56px; font-size: 18px; padding: 0 1.6em; }
.btn[disabled] { opacity: .4; cursor: default; }
.field { display: grid; gap: .4em; margin: 0 0 1em; font-weight: 500; font-size: 14px; color: var(--muted); }
.input {
  width: 100%; min-height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  padding: 0 16px; font-size: 18px; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #6f6a61; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230, 213, 179, .16); }
.input.code { text-transform: uppercase; letter-spacing: .18em; font-weight: 700; text-align: center; font-size: 26px; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.85); }
.error { color: var(--danger-ink); font-weight: 500; min-height: 1.4em; margin: .25em 0 0; }
.hint { color: var(--muted); }

/* ---------- simple pages ---------- */
.page { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 32px; width: min(480px, 100%); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-logo { height: 40px; width: auto; flex: none; display: block; }
.brand-name { font-family: var(--head); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.foot { margin-top: 18px; text-align: center; }
.link { color: var(--muted); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; background: none; border: 0; padding: 8px; border-radius: 8px; }
.link:hover { color: var(--ink); text-decoration-color: var(--accent); }
.invite { display: grid; gap: 16px; justify-items: center; text-align: center; }
.invite canvas { width: 220px; height: 220px; image-rendering: pixelated; border-radius: 14px; }
.code-big { font-family: var(--head); font-size: 44px; font-weight: 700; letter-spacing: .12em; color: var(--accent); }
.link-box { width: 100%; display: flex; gap: 8px; }
.link-box input { flex: 1; min-width: 0; font-size: 14px; min-height: 42px; border-radius: 12px; border: 1px solid var(--line); padding: 0 12px; background: var(--bg); color: var(--ink); }

/* ---------- prejoin ---------- */
.prejoin { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.prejoin .card { width: min(560px, 100%); }
.card .btn.big { width: 100%; }
.input.code::placeholder { letter-spacing: .05em; font-weight: 500; }
.preview { position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: linear-gradient(160deg, var(--tile-2), var(--tile)); margin: 8px 0 16px; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview .avatar { position: absolute; inset: 0; margin: auto; }
.preview-tools { display: flex; gap: 12px; justify-content: center; margin-bottom: 16px; }
.toggle { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.toggle.off { background: var(--danger-soft); color: var(--danger-ink); }
.toggle[disabled] { opacity: .4; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 14px; padding: 12px 16px; margin: 0 0 14px; font-size: 15px; }

/* ---------- classroom shell ---------- */
.room {
  height: 100vh; height: 100dvh; display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "top top" "stage panel" "controls controls";
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--line); min-height: 60px; flex-wrap: wrap; }
.topbar .brand-logo { height: 30px; }
.topbar .brand-name { font-size: 18px; }
.place { font-family: var(--head); font-weight: 600; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.place .pill { font-family: "Inter", system-ui, sans-serif; font-size: 13px; background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-weight: 500; }
.pill { font-size: 13px; font-weight: 600; border-radius: 999px; padding: 5px 12px; }
.spacer { flex: 1; }
.code-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 0 14px; min-height: 40px; font-weight: 600; letter-spacing: .06em; }
.countdown { background: var(--warn-soft); color: var(--warn); font-weight: 600; border-radius: 999px; padding: 6px 14px; font-variant-numeric: tabular-nums; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; user-select: none; min-height: 42px; color: var(--ink); }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; flex: none; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); position: relative; margin: 0; transition: background .15s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: left .15s, background .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { left: 21px; background: var(--accent-ink); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The bar at the bottom: which board (left), the controls (middle), the drawing switches (right). */
.controls { grid-area: controls; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "left mid right"; align-items: center; gap: 6px 14px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.dock-mid { grid-area: mid; display: flex; justify-content: center; align-items: flex-start; gap: 14px; }
.dock-left { grid-area: left; justify-self: start; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.dock-right { grid-area: right; justify-self: end; display: grid; justify-items: start; }
.dock-right .switch { min-height: 36px; font-size: 14px; white-space: nowrap; }
.dock-left .tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.dock-left .tab { display: flex; align-items: center; gap: 6px; }
@media (max-width: 1000px) { .controls { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "left right" "mid mid"; } }
/* A control is a round button with its name underneath. */
.ctrl { display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; min-width: 64px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
.ctrl .icon { box-sizing: content-box; width: 20px; height: 20px; padding: 13px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); transition: background .15s; }
.ctrl:hover .icon { background: var(--accent-hover); }
.ctrl.off .icon { background: var(--danger-soft); color: var(--danger-ink); }
.ctrl.on .icon { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.ctrl.plain .icon, .ctrl.quiet .icon { background: var(--surface-2); color: var(--ink); }
.ctrl.plain:hover .icon, .ctrl.quiet:hover .icon { background: var(--surface-3); }
.ctrl.danger .icon { background: var(--danger); color: #fff; }
.ctrl.danger:hover .icon { background: var(--danger-hover); }
.ctrl:focus-visible { outline: none; }
.ctrl:focus-visible .icon { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- stage: board + videos ---------- */
.stage { grid-area: stage; position: relative; display: grid; gap: 10px; padding: 12px; min-height: 0; min-width: 0; }
.stage[data-mode="board"] { grid-template-columns: minmax(0, 1fr) 210px; grid-template-rows: minmax(0, 1fr); grid-template-areas: "board videos"; }
.room.learner .stage[data-mode="board"] { grid-template-columns: minmax(0, 1fr) 300px; }
.stage[data-mode="grid"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "videos"; }
.stage[data-mode="grid"] .board-area { display: none; }
.room .stage[data-mode="board"][data-strip="top"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: 104px minmax(0, 1fr); grid-template-areas: "videos" "board"; }
/* Learners, no board: the teacher big, everyone else in a column beside them. */
.focus { grid-area: focus; display: none; min-height: 0; min-width: 0; place-items: center; }
.stage[data-focus="on"] { grid-template-columns: minmax(0, 1fr) 220px; grid-template-areas: "focus videos"; }
.stage[data-focus="on"] .focus { display: grid; }
.stage[data-focus="on"][data-strip="top"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 110px; grid-template-areas: "focus" "videos"; }
.focus .tile { width: min(100%, calc((100dvh - 200px) * 16 / 9)); max-height: 100%; }

/* The board as big as it fits, its tools right beside it (sizes set by fitBoard in app.js). */
.board-area { grid-area: board; display: grid; min-height: 0; min-width: 0; align-content: start; justify-content: start;
  grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "tools surface"; }
.board-area .toolbar { grid-area: tools; margin-right: 8px; align-self: center; }
.board-area .surface-box { grid-area: surface; }
.board-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.board-actions:empty { display: none; }
.tab { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-weight: 500; font-size: 14px; color: var(--muted); }
.tab:hover { color: var(--ink); background: var(--surface); }
.tab.active { border-color: var(--surface-2); color: var(--ink); background: var(--surface-2); }
.tab.spot { border-color: var(--warn-soft); color: var(--warn); background: var(--warn-soft); }
.tab .icon { width: 16px; height: 16px; flex: none; }
.board-banner { font-weight: 500; font-size: 13px; color: var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 6px 12px; }
/* Drawing tools: two columns down the left of the board (a row above it on narrow screens). */
.toolbar { display: grid; grid-template-columns: repeat(2, 40px); grid-auto-rows: auto; gap: 3px; align-content: start; align-self: start; max-height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; min-width: 0; }
.toolbar[hidden] { display: none; }
.toolbar .sep { grid-column: 1 / -1; height: 1px; align-self: center; background: var(--line); margin: 0 4px; }
.toolbar .pager { display: contents; }
.toolbar .pager[hidden] { display: none; }
.page-no { grid-column: 1 / -1; display: grid; place-items: center; min-height: 22px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tool:disabled { opacity: .35; }
.toolbar .swatch { justify-self: center; }
.tool { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink); }
.tool:hover { background: var(--surface-2); }
.tool.active { background: var(--accent); color: var(--accent-ink); }
.swatch { width: 34px; height: 40px; flex: none; border-radius: 11px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); }
.size-dot { display: block; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 1.5px rgba(241, 236, 226, .5); }
.surface-box { min-width: 0; min-height: 0; display: grid; place-items: start; }
.surface { position: relative; background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.surface canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.surface .ink { cursor: crosshair; }
.surface.readonly .ink { cursor: default; }
.surface.texting .ink { cursor: text; }
.text-editor { position: absolute; margin: 0; padding: 2px 4px; border: 2px dashed var(--accent-strong); border-radius: 6px; background: rgba(255,255,255,.85); color: #1f2a37; resize: none; overflow: hidden; line-height: 1.2; font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 600; outline: none; min-width: 6em; white-space: pre-wrap; overflow-wrap: anywhere; box-sizing: border-box; }
.surface.moving .ink { cursor: grab; }
.surface.moving.grabbing .ink { cursor: grabbing; }
@media (orientation: portrait), (max-width: 760px) {
  .room.teacher .board-area, .room.learner .board-area { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "tools" "surface"; }
  .board-area .toolbar { margin: 0 0 8px; }
  .toolbar { display: flex; align-items: center; align-self: auto; overflow-x: auto; overflow-y: hidden; }
  .toolbar .sep { flex: none; width: 1px; height: auto; align-self: stretch; margin: 4px 3px; }
  .page-no { padding: 0 6px; }
}
/* The teacher's shared screen. */
.screen-area { grid-area: board; display: none; min-height: 0; min-width: 0; background: #000; border-radius: 14px; overflow: hidden; }
.screen-area video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage[data-mode="screen"] { grid-template-columns: minmax(0, 1fr) 210px; grid-template-rows: minmax(0, 1fr); grid-template-areas: "board videos"; }
.room.learner .stage[data-mode="screen"] { grid-template-columns: minmax(0, 1fr) 300px; }
.stage[data-mode="screen"] .board-area { display: none; }
.stage[data-mode="screen"] .screen-area { display: block; }
.room .stage[data-mode="screen"][data-strip="top"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: 104px minmax(0, 1fr); grid-template-areas: "videos" "board"; }

.videos { grid-area: videos; min-height: 0; min-width: 0; position: relative; }
.stage[data-mode="board"] .videos, .stage[data-mode="screen"] .videos { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; }
.stage[data-mode="board"] .tile, .stage[data-mode="screen"] .tile, .stage[data-focus="on"] .videos .tile { flex: none; width: 100%; }
.stage[data-focus="on"] .videos { display: grid; gap: 8px; align-content: start; overflow-y: auto; overscroll-behavior: contain; }
/* Learners beside the board: the teacher full width at the top, everyone else two by two. */
.room.learner .stage:is([data-mode="board"], [data-mode="screen"])[data-strip="side"] .videos { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
.room.learner .stage:is([data-mode="board"], [data-mode="screen"])[data-strip="side"] .tile.teacher { grid-column: 1 / -1; }
.room.learner .stage:is([data-mode="board"], [data-mode="screen"])[data-strip="side"] .tile:not(.teacher) .label { font-size: 11px; padding: 2px 8px 2px 6px; left: 5px; bottom: 5px; }
.stage[data-strip="top"] .videos { flex-direction: row !important; overflow-x: auto !important; overflow-y: hidden !important; display: flex !important; }
.stage[data-strip="top"] .videos .tile { width: auto !important; height: 100%; grid-column: auto !important; }
.stage[data-mode="grid"][data-focus="off"] .videos { display: grid; gap: 10px; align-content: center; justify-content: center; overflow: auto; }
.stage[data-mode="grid"][data-focus="off"] .tile { aspect-ratio: auto; }
.stage[data-mode="grid"][data-focus="off"] .tile.teacher { grid-column: span 2; grid-row: span 2; }

.tile { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(160deg, var(--tile-2), var(--tile)); border-radius: 16px; overflow: hidden; color: var(--ink); outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.me video { transform: scaleX(-1); }
.tile.speaking { outline-color: var(--accent); }
/* A raised hand: gold, with its place in the queue once there are two or more. */
.tile.hand { outline: 7px solid var(--gold); outline-offset: -7px; box-shadow: 0 0 0 2px var(--gold), 0 0 28px rgba(224, 178, 63, .6); }
.hand-badge { position: absolute; right: 8px; bottom: 8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--gold); color: #1a1408; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.hand-badge[hidden] { display: none; }
.avatar { width: 34%; max-width: 88px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-weight: 600; color: #fff; font-size: clamp(14px, 2.2vw, 28px); }
.tile .avatar { position: absolute; inset: 0; margin: auto; }
.tile .label { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); display: flex; align-items: center; gap: 4px; background: rgba(22, 22, 22, .78); color: var(--ink); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label .icon { width: 16px; height: 16px; flex: none; color: #fff; background: var(--danger); border-radius: 50%; padding: 2px; box-sizing: border-box; }
.tile .status { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(22, 22, 22, .66); font-weight: 500; font-size: 14px; }
.tile .menu-btn { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(22, 22, 22, .72); color: var(--ink); font-size: 18px; line-height: 1; }
.tile .menu-btn:hover { background: var(--surface-2); }
/* Allowed to draw on the teacher's board: a pen under the menu button. */
.pen-badge { position: absolute; top: 48px; right: 8px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.room.learner .pen-badge { top: 8px; }
.pen-badge[hidden] { display: none; }
.pen-badge .icon { width: 18px; height: 18px; }
.can-draw { display: inline-grid; vertical-align: -2px; margin-left: 6px; color: var(--accent); }
.can-draw .icon { width: 14px; height: 14px; }
.tile-menu { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px; min-width: 160px; }
.tile-menu button { text-align: left; border: 0; background: transparent; border-radius: 10px; min-height: 40px; padding: 0 10px; font-weight: 500; }
.tile-menu button:hover { background: var(--surface-2); }

/* ---------- teacher: the class column ---------- */
/* While the board is up, the faces live in the column (not beside the board). */
.room .stage[data-faces="col"][data-mode] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "board"; }
.room .stage[data-faces="col"][data-mode][data-focus="on"] { grid-template-areas: "focus"; }
.faces-slot .videos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.faces-slot .tile { width: 100%; }
.faces-slot .tile .label { font-size: 11px; padding: 2px 8px 2px 6px; left: 6px; bottom: 6px; }
.faces-slot .tile .menu-btn { width: 28px; height: 28px; font-size: 15px; top: 6px; right: 6px; }
.faces-slot .pen-badge { width: 28px; height: 28px; top: 40px; right: 6px; }
.faces-slot .pen-badge .icon { width: 15px; height: 15px; }
.faces-slot .tile-ctl .tb { width: 28px; height: 28px; }
.faces-slot .tile-ctl .tb .icon { width: 15px; height: 15px; }
.faces-slot .avatar { width: 30%; font-size: 16px; }
.ask-box { display: grid; gap: 6px; }
.ask-box:not(:empty) { margin-bottom: 10px; }
.asking-head { justify-content: flex-end; }
.rest-box:not(:empty) { margin-top: 14px; }
.col-foot { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); }
.room.teacher .panel-tabs .tab { min-height: 42px; }
.room.teacher .panel-tabs .tab .icon { width: 20px; height: 20px; }
.tab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.room.learner .tab-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
/* The teacher's microphone and camera buttons on a learner's picture. */
.tile-ctl { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; }
.tile-ctl .tb { width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; background: rgba(22, 22, 22, .72); color: var(--ink); display: grid; place-items: center; }
.tile-ctl .tb:hover { background: var(--surface-2); }
.tile-ctl .tb .icon { width: 18px; height: 18px; }
.tile-ctl .tb.off { background: var(--danger); color: #fff; }
.tile.has-ctl .label .icon { display: none; }
.stage[data-strip="top"] .tile-ctl .tb { width: 28px; height: 28px; }
.stage[data-strip="top"] .tile-ctl .tb .icon { width: 15px; height: 15px; }

/* ---------- teacher panel ---------- */
.panel { grid-area: panel; width: 244px; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); align-items: center; }
.panel-tabs .tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; min-height: 50px; border-radius: 12px; border-color: transparent; font-size: 11px; }
.panel-tabs .tab .icon { width: 18px; height: 18px; }
.tab-badge { position: absolute; top: 3px; right: 8px; min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px; background: var(--warn); color: var(--accent-ink); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.panel-title { flex: 1; display: flex; align-items: center; gap: 8px; font-family: var(--head); font-weight: 600; padding: 6px 8px; }
.panel-title .icon { width: 18px; height: 18px; }
.panel-body { flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }
.panel.chatting .panel-body, .chat-panel .panel-body { display: flex; flex-direction: column; overflow: hidden; }
.room.learner .panel { width: 300px; }
.room.teacher .panel { width: 320px; }
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; overscroll-behavior: contain; }
.msg { background: var(--surface-2); border-radius: 12px 12px 12px 4px; padding: 7px 10px; max-width: 92%; align-self: flex-start; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--accent-soft); border-radius: 12px 12px 4px 12px; }
.msg.from-teacher .who { color: var(--accent); }
.msg-head { display: flex; gap: 6px; align-items: baseline; font-size: 12px; margin-bottom: 1px; }
.msg-head .who { font-weight: 700; }
.msg-room { color: var(--muted); font-size: 11px; }
.msg-text { font-size: 14px; line-height: 1.35; white-space: pre-wrap; }
.chat-form { display: flex; gap: 6px; align-items: center; }
.chat-form .input { min-height: 42px; padding: 0 12px; font-size: 15px; border-radius: 12px; }
.chat-form .mini { width: 42px; height: 42px; background: var(--accent); color: var(--accent-ink); }
.mini.panel-close { display: none; }
@media (max-width: 1100px) {
  .panel, .room.teacher .panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 20; width: min(380px, 92vw); box-shadow: -10px 0 40px rgba(0,0,0,.5); transform: translateX(105%); transition: transform .2s; }
  .room.panel-open .panel { transform: none; }
  .mini.panel-close { display: grid; }
}
@media (min-width: 1101px) { .room:not(.panel-open) .panel { display: none; } }
.section-title { font-family: "Inter", system-ui, sans-serif; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.section-title:first-child { margin-top: 0; }
.person { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; }
.person:hover { background: var(--surface-2); }
.person .avatar { flex: none; }
.person.hand { background: rgba(224, 178, 63, .12); }
.person .mini { width: 32px; height: 32px; }
.person .mini .icon { width: 16px; height: 16px; }
.hand-av { position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: var(--gold); color: #1a1408; cursor: pointer; }
.hand-av .icon { width: 16px; height: 16px; }
.hand-n { position: absolute; right: -5px; bottom: -4px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px; background: #1a1408; color: var(--gold); font-size: 10px; font-weight: 800; line-height: 15px; text-align: center; }
.person { gap: 6px; padding: 6px 4px; }
.person .who { flex: 1; min-width: 0; }
.person .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .sub { font-size: 12px; color: var(--muted); }
.mini { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; flex: none; }
.mini:hover { background: var(--surface-3); }
.mini .icon { width: 18px; height: 18px; }
.mini.off { background: var(--danger-soft); color: var(--danger-ink); }
.mini.plain { background: transparent; color: var(--muted); }
.mini.plain:hover { background: var(--surface-2); color: var(--ink); }
.empty { color: var(--muted); padding: 10px 4px; font-size: 15px; }

.rooms-grid { display: grid; gap: 10px; }
.room-card { border: 1px solid var(--line); border-radius: 16px; padding: 10px; min-height: 64px; background: var(--bg); transition: border-color .1s, background .1s; }
.room-card.main { border-style: dashed; }
.room-card.drop { border-color: var(--accent); background: var(--accent-soft); }
.room-card.visiting { border-color: var(--warn); }
.room-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-family: var(--head); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; border-radius: 999px; border: 1px solid var(--line); padding: 0 12px; background: var(--surface-2); color: var(--ink); font-weight: 500; font-size: 14px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.chip.dragging { position: fixed; z-index: 50; pointer-events: none; box-shadow: var(--shadow); background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.ghost { opacity: .35; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper output { min-width: 2ch; text-align: center; font-family: var(--head); font-size: 22px; font-weight: 600; }
.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.thumb { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 0; overflow: hidden; text-align: left; }
.thumb canvas { display: block; width: 100%; aspect-ratio: 16 / 10; }
.thumb .cap { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 6px 8px; background: var(--surface-2); color: var(--ink); white-space: nowrap; overflow: hidden; }
.thumb.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb.spot { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }

/* ---------- overlays ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 20px; }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; width: min(440px, 100%); box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal-q { font-size: 18px; font-weight: 500; margin: 0 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
#toasts { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--accent-ink); border-radius: 999px; padding: 10px 18px; font-weight: 500; font-size: 15px; box-shadow: var(--shadow); transition: opacity .3s; max-width: 90vw; text-align: center; }
.toast.out { opacity: 0; }
.banner { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 90; }
.final { min-height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; }
.final .card { display: grid; gap: 16px; justify-items: center; }
.final-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.final-mark .icon { width: 28px; height: 28px; }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 110; background: var(--warn-soft); color: var(--warn); text-align: center; font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }

@media (max-width: 560px) {
  .topbar { padding: 6px 10px; min-height: 52px; gap: 8px; }
  .topbar .brand-name, .topbar .hide-narrow { display: none; }
  .ctrl { min-width: 54px; font-size: 11px; }
  .ctrl .icon { padding: 11px; }
  .controls { gap: 8px; }
}
@media (max-width: 420px) {
  .ctrl { min-width: 50px; }
  .controls { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .card { padding: 22px; }
  .stage { padding: 6px; gap: 6px; }
  .room .stage:is([data-mode="board"], [data-mode="screen"])[data-strip="top"] { grid-template-rows: 84px minmax(0, 1fr); }
  .tool { width: 42px; height: 42px; }
}

/* ---------- front page: one screen. Logo, headline and contact up top; Ms Trang in a card below ---------- */
body.landing { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.site-bar { position: relative; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 14px 24px; padding-top: max(14px, env(safe-area-inset-top)); }
.site-bar .btn { min-height: 44px; }
.join-wrap { position: relative; }
.join-pop { position: absolute; right: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.join-pop .btn { width: 100%; }
.landing-main { flex: 1; width: min(1060px, 100%); margin: 0 auto; padding: 0 28px clamp(18px, 4svh, 40px); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; gap: clamp(16px, 4svh, 40px); }
.hero-block { display: grid; justify-items: center; align-content: center; text-align: center; gap: clamp(10px, 2.4svh, 24px); }
.hero-logo { height: clamp(70px, 22svh, 230px); width: auto; display: block; }
.hero { margin: 0; max-width: 22ch; font-family: var(--head); font-size: clamp(24px, min(4.6vw, 4.6svh), 46px); font-weight: 600; line-height: 1.04; letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn.contact { display: inline-flex; justify-content: center; width: auto; padding: 0 28px; }
.btn.zalo { display: inline-flex; align-items: center; gap: 8px; padding: 0 24px; background: transparent; border-color: var(--accent-strong); color: var(--accent); font-weight: 600; }
.btn.zalo:hover { background: var(--surface-2); }
.btn.zalo .icon { width: 20px; height: 20px; }
.about { width: min(900px, 100%); justify-self: center; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: clamp(14px, 2.6svh, 28px) clamp(16px, 3vw, 32px); }
.portrait { width: clamp(80px, 17svh, 170px); height: auto; aspect-ratio: 1; border-radius: 50%; display: block; }
.about-text { display: grid; gap: clamp(6px, 1.2svh, 12px); }
.about-text h2 { font-family: var(--head); font-weight: 600; font-size: clamp(20px, 3svh, 28px); letter-spacing: -0.02em; margin: 0; }
.about-text p { font-size: clamp(13.5px, 1.85svh, 16px); line-height: 1.5; color: #d9d3c7; margin: 0; }
.creds { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.creds li { border: 1px solid var(--accent-strong); color: var(--accent); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 13px; white-space: nowrap; }
@media (max-width: 760px) {
  .site-bar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .join-wrap { position: static; }
  .join-pop { left: 12px; right: 12px; width: auto; top: calc(100% + 4px); }
  .site-bar .btn { padding: 0 14px; font-size: 14px; }
  .landing-main { padding: 0 16px 16px; }
  .hero-logo { height: clamp(60px, 12svh, 120px); }
  .hero { font-size: clamp(22px, 3.6svh, 30px); }
  .hero-actions { width: 100%; flex-wrap: nowrap; gap: 8px; }
  .btn.contact { flex: 1; padding: 0 12px; font-size: 16px; }
  .btn.zalo { flex: none; padding: 0 16px; font-size: 16px; }
  .about { grid-template-columns: auto 1fr; grid-template-areas: "pic name" "pic creds" "text text"; padding: 14px; gap: 8px 14px; border-radius: 22px; }
  .about-text { display: contents; }
  .portrait { grid-area: pic; width: clamp(70px, 11svh, 100px); }
  .about-text h2 { grid-area: name; align-self: end; }
  .creds { grid-area: creds; align-self: start; gap: 5px; }
  .creds li { font-size: 12px; padding: 4px 10px; }
  .about-text p { grid-area: text; font-size: clamp(13px, 1.9svh, 15.5px); }
}
.class-name { margin: 0 0 4px; color: var(--accent); font-weight: 500; }
.link-name { font-family: var(--head); font-size: 22px; font-weight: 600; color: var(--accent); word-break: break-all; }

/* ---------- teacher dashboard ---------- */
.card.wide { width: min(820px, 100%); }
.page:has(.card.wide) { place-items: start center; padding-top: 40px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.dash-head h1 { margin: 0; }
.hint.small { font-size: 13px; margin: -.5em 0 1em; }
.class-form { background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin: 14px 0 20px; }
.class-form .field { margin-bottom: .8em; }
.link-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.link-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230, 213, 179, .16); }
.link-host { padding-left: 14px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.link-input .input { border: 0; min-height: 52px; padding-left: 2px; box-shadow: none; }
.when { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.time-pick { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.time-pick select { flex: 1; min-width: 0; text-align: center; padding-left: 10px; padding-right: 10px; }
.row.end { justify-content: flex-end; gap: 10px; display: flex; }
.list-title { font-family: "Inter", system-ui, sans-serif; font-size: 13px; margin: 22px 0 10px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
details.earlier > summary { cursor: pointer; list-style: revert; }
.class-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.class-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.class-item.is-now { border-color: var(--accent); }
.class-item.is-past { opacity: .6; }
.class-date { width: 52px; height: 56px; border-radius: 14px; background: var(--surface-2); display: grid; place-content: center; text-align: center; line-height: 1.1; }
.class-date .day { font-family: var(--head); font-size: 22px; font-weight: 600; }
.class-date .mon { font-size: 12px; font-weight: 500; color: var(--muted); }
.class-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.class-title strong { font-family: var(--head); font-size: 17px; font-weight: 600; margin-right: 2px; }
.class-when { color: var(--muted); font-size: 13px; margin-top: 2px; }
.class-link { color: var(--ink); font-size: 13px; font-weight: 500; margin-top: 2px; word-break: break-all; }
.class-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 300px; }
.badge { display: inline-flex; align-items: center; height: 22px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 0 9px; white-space: nowrap; }
.badge.now { background: var(--accent); color: var(--accent-ink); }
.badge.live { background: var(--live-soft); color: var(--live); }
.badge.wait { background: var(--surface-2); color: var(--muted); }
.danger-text { color: var(--danger-ink); }
@media (max-width: 640px) {
  .card.wide { padding: 20px; }
  .page:has(.card.wide) { padding-top: 24px; }
  .class-item { grid-template-columns: 48px 1fr; }
  .class-date { width: 48px; height: 52px; }
  .class-actions { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .when { grid-template-columns: 1fr 1fr; }
  .when .field:first-child { grid-column: 1 / -1; }
}

/* ---------- admitting ---------- */
.asking-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.person[data-status=asking] { background: var(--warn-soft); border-radius: 12px; }
.person[data-status=asking] .sub { color: var(--warn); }
.pill.knock { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--warn-soft); color: var(--warn); font-weight: 600; cursor: pointer; animation: knock 1.6s ease-in-out 2; }
.pill.knock:hover { background: #4a3f2a; }
.pill.knock svg { width: 16px; height: 16px; }
@keyframes knock { 0%, 100% { transform: none; } 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } }
.ctrl { position: relative; }
.ctrl-badge { position: absolute; top: -2px; right: 6px; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px; background: var(--warn); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.ctrl-badge[hidden] { display: none; }
.asking { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 12px 0 18px; }
.asking h1 { margin: 10px 0 0; font-size: 26px; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .pill.knock { animation: none; } }
.badge.ask { background: var(--warn-soft); color: var(--warn); }
.class-form .switch { margin: 4px 0 6px; }
.asking ~ .btn { display: flex; margin: 0 auto; }
.test-row { margin: 4px 0 16px; }
.person + .row { margin-top: 12px; }
.stack > .field { margin-bottom: 0; }
.error:empty { min-height: 0; margin: 0; }

/* ---------- waiting: test camera and microphone ---------- */
.row.center { justify-content: center; }
.test-box { margin: 0 0 14px; }
.test-box .preview { margin: 0 0 10px; }
.test-box .preview video:not([src]):not([srcObject]) { background: var(--tile); }
.level { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.level .icon { width: 18px; height: 18px; }
.level-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.level-bar span { display: block; height: 100%; width: 0; background: var(--live); border-radius: 4px; transition: width .08s linear; }

/* ---------- the teacher asks to hear or see a learner ---------- */
.ask-banner { position: fixed; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); transform: translateX(-50%); z-index: 95; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: var(--surface); border: 1px solid var(--accent-strong); border-radius: 18px; padding: 10px 12px 10px 16px; box-shadow: var(--shadow); max-width: calc(100vw - 24px); }
.ask-banner > span { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.ask-banner .icon { width: 18px; height: 18px; color: var(--accent); }

/* ---------- station clock (split-flap) ---------- */
.clock { display: inline-flex; align-items: center; gap: 3px; padding: 4px; border-radius: 10px; background: #0e0e0e; border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); flex: none; font-variant-numeric: tabular-nums; }
.flap { position: relative; width: 22px; height: 32px; border-radius: 5px; background: linear-gradient(#262523 0 50%, #1f1e1c 50% 100%); display: grid; place-items: center; overflow: hidden; perspective: 80px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.04); }
.flap::after { content: ""; position: absolute; left: 0; right: 0; top: calc(50% - .5px); height: 1px; background: rgba(0,0,0,.75); }
.flap-text { font-family: var(--head); font-weight: 600; font-size: 21px; line-height: 1; color: var(--accent); transform-origin: 50% 50%; }
.flap.flip .flap-text { animation: flap .45s cubic-bezier(.3,.7,.4,1); }
@keyframes flap { 0% { transform: rotateX(-88deg); opacity: .2; } 60% { transform: rotateX(12deg); opacity: 1; } 100% { transform: rotateX(0); } }
.flap-colon { width: 4px; height: 14px; margin: 0 1px; background: radial-gradient(circle, var(--accent) 1.6px, transparent 2px) 0 0 / 4px 7px repeat-y; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .flap.flip .flap-text { animation: none; } }
@media (max-width: 560px) { .flap { width: 17px; height: 25px; } .flap-text { font-size: 16px; } .flap-colon { height: 12px; background-size: 4px 6px; } }
@media (min-width: 1101px) {
  .room.teacher .panel { margin: 12px 12px 12px 0; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
}
