/* NoMiss app. One design system: a light workspace (home, courses, admin)
   and a dark "room" for live classes, like a meeting app. Phones get a top
   bar and bottom tabs; from 960px wide, a sidebar and multi-column pages. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("./vendor/fonts/plus-jakarta-sans-latin-5.3.0.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --brand: #0f6b4f;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #ffffff);
  --brand-line: color-mix(in srgb, var(--brand) 30%, #ffffff);
  --ground: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #0f1419;
  --ink-2: #374151;
  --muted: #5b6573;
  --line: #e5e7eb;
  --field: #cfd4dc;
  --live: #e5383b;
  --ok-bg: #e7f5ee;
  --ok-ink: #0b4a36;
  --warn-bg: #fff4e5;
  --warn-ink: #8a4005;
  --warn-line: #c2670a;
  --bad-bg: #fdecea;
  --bad-ink: #b3261e;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 2px 6px rgba(16, 24, 40, 0.06), 0 24px 48px rgba(16, 24, 40, 0.12);
  /* the room */
  --room: #0b0d10;
  --room-panel: #14171c;
  --room-panel-2: #1b1f26;
  --room-line: #262b33;
  --room-ink: #eef1f5;
  --room-muted: #9aa4b2;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: 15.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
img, video, iframe { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
.boot { padding: 48px 24px; color: var(--muted); text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─── App frame ─────────────────────────────────────────────────────────── */
.app { min-height: 100vh; display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 0; background: transparent; color: inherit; cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: rgba(15, 20, 25, 0.06); }
.content { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.content.narrow { max-width: 760px; }
.content > *, .stack > *, .card > *, .grid > * { min-width: 0; }
.tabs { position: sticky; bottom: 0; z-index: 10; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 12px; }
.tabs a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: 26px; font-weight: 800; line-height: 1.2; }
.page-head .lead { margin: 4px 0 0; }
.desktop-only { display: none !important; }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 272px minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
  .tabs, .mobile-only { display: none !important; }
  .desktop-only { display: revert !important; }
  .topbar { padding: 14px 32px; min-height: 68px; }
  .topbar h1 { font-size: 19px; }
  .topbar .brandmark { display: none; }
  .content { padding: 28px 32px 48px; gap: 28px; }
  .page-head h1 { font-size: 32px; }
}

/* Sidebar */
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; text-decoration: none; color: inherit; }
.side-brand strong { display: block; font-size: 16px; line-height: 1.2; }
.side-brand .tagline { display: block; font-size: 12px; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; }
.nav-item:hover { background: var(--surface-2); }
.nav-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav-label { margin: 18px 12px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.side-class { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-size: 14px; }
.side-class:hover { background: var(--surface-2); }
.side-class[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 700; }
.side-class .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--live); flex: none; box-shadow: 0 0 0 3px rgba(229, 56, 59, 0.18); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; font-size: 13.5px; }
.side-foot .who strong, .side-foot .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { color: var(--muted); font-size: 12px; }

/* ─── Marks, avatars, chips ─────────────────────────────────────────────── */
.mark { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; letter-spacing: 0.02em; }
.mark.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 19px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.course-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 12px; font-weight: 800; font-size: 12px; letter-spacing: 0.02em; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
/* A shade darker than --live: white text on it needs 4.5:1 (it was 4.23). */
.pill.live { background: #d93235; color: #fff; letter-spacing: 0.04em; }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.6s ease-in-out infinite; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--surface-2); color: var(--muted); }
.check-row.ok .check-mark { background: var(--ok-bg); color: var(--ok-ink); }
.check-row.warn .check-mark { background: var(--warn-bg); color: var(--warn-ink); }
.check-row.bad .check-mark { background: var(--bad-bg); color: var(--bad-ink); }
.check-row.bad strong { color: var(--bad-ink); }
.check-media { border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-height: 240px; margin-bottom: 12px; }
.check-media video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.range { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.range button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.range button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.range button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pill.live::before { animation: none; } * { transition: none !important; } }

/* ─── Surfaces ──────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { font-size: 16px; font-weight: 800; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 20px; }
@media (min-width: 960px) {
  .grid.two { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
  .grid.two-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side-right { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .sticky { position: sticky; top: 92px; }
}
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
ul.list, ol.list { margin: 0; padding: 0; list-style: none; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--ink); text-decoration: none; min-height: 64px; border-bottom: 1px solid var(--line); transition: background 0.15s; }
.item:last-child { border-bottom: 0; }
a.item:hover { background: var(--surface-2); }
.item .grow { flex: 1; min-width: 0; }
.item strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: 13px; color: var(--muted); }
.datebox { width: 48px; flex: none; text-align: center; line-height: 1.05; font-weight: 800; font-size: 19px; padding: 7px 0; border-radius: 12px; background: var(--surface-2); }
.datebox small { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.05em; }
.datebox.due { background: var(--bad-bg); color: var(--bad-ink); }
.datebox.due small { color: var(--bad-ink); }
.month { margin: 10px 2px 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lead { color: var(--ink-2); margin: 0; }

/* Live hero */
.live-hero { position: relative; overflow: hidden; display: grid; gap: 16px; padding: 22px; border-radius: 22px; color: #fff; text-decoration: none; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--brand) 55%, #0b0d10) 0%, #0b0d10 62%); box-shadow: var(--shadow-lg); }
.live-hero h2 { font-size: 22px; font-weight: 800; }
.live-hero .meta { color: #c9d0d9; font-size: 14px; }
.live-hero .cta { justify-self: start; }
@media (min-width: 960px) { .live-hero { grid-template-columns: 1fr auto; align-items: center; padding: 28px 32px; } .live-hero h2 { font-size: 26px; } }

/* Lecture cards (catch up) */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.lcard { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: var(--ink); text-decoration: none; transition: transform 0.15s, box-shadow 0.15s; }
.lcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.thumb { position: relative; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 85%, #000) 0%, #1b1f26 100%); }
.thumb .play { width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
.thumb .code { position: absolute; left: 12px; top: 12px; font-size: 12px; font-weight: 800; background: rgba(0, 0, 0, 0.35); padding: 3px 8px; border-radius: 8px; }
.thumb .len { position: absolute; right: 10px; bottom: 10px; font-size: 12px; font-weight: 700; background: rgba(0, 0, 0, 0.6); padding: 2px 7px; border-radius: 6px; }
.lcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.lcard .body strong { font-size: 15px; }

/* ─── Controls ──────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: filter 0.15s, background 0.15s, transform 0.05s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16px; padding: 0 24px; border-radius: 14px; }
.btn.sm { min-height: 38px; font-size: 13.5px; padding: 0 12px; border-radius: 10px; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--field); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.danger { background: #d92d2a; color: #fff; }
.btn.white { background: #fff; color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; filter: none; transform: none; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.input { min-height: 50px; padding: 0 14px; border: 1.5px solid var(--field); border-radius: 12px; background: #fff; font-size: 16px; width: 100%; transition: border-color 0.15s, box-shadow 0.15s; }
textarea.input { padding: 12px 14px; min-height: 110px; resize: vertical; line-height: 1.5; }
select.input { appearance: auto; }
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.code-input { letter-spacing: 0.45em; font-size: 28px; font-weight: 800; text-align: center; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seg button { min-height: 60px; border-radius: 12px; border: 1.5px solid var(--field); background: #fff; text-align: left; padding: 10px 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { border: 2px solid var(--brand); background: var(--brand-soft); }
.seg button strong { display: block; font-size: 14.5px; }

/* Messages */
.notice { padding: 12px 14px; border-radius: 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice.info { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.offline { background: #374151; color: #fff; text-align: center; font-size: 13.5px; padding: 8px; }
.empty { text-align: center; color: var(--muted); padding: 36px 18px; background: var(--surface); border-radius: var(--radius); border: 1.5px dashed var(--line); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, #eceef1 0%, #f6f7f9 50%, #eceef1 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Video stage (light pages) ─────────────────────────────────────────── */
.stage { position: relative; background: #0b0d10; aspect-ratio: 16 / 9; width: 100%; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.stage video, .stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; object-fit: contain; }
.stage .overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; text-align: center; padding: 20px; color: #fff; }
.stage .tags { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; z-index: 2; }
.tag { background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 8px; backdrop-filter: blur(6px); }

/* ─── The room (live class, rep studio) ─────────────────────────────────── */
.room { min-height: 100vh; background: var(--room); color: var(--room-ink); display: flex; flex-direction: column; color-scheme: dark; }
.room a { color: #8fe3bd; }
.room a.btn { color: var(--brand-ink); }
.room a.btn.ghost, .room a.ctrl { color: var(--room-ink); }
.room-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--room-line); }
.room-top .titles { flex: 1; min-width: 0; }
.room-top h1 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-top .sub { display: block; font-size: 13px; color: var(--room-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room .icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.room-body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 14px; min-height: 0; }
.room-stage { position: relative; flex: none; aspect-ratio: 16 / 9; background: #000; border-radius: 18px; overflow: hidden; border: 1px solid var(--room-line); }
.room-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; transform: scale(var(--camera-zoom, 1)); transform-origin: center; }
.room-stage video.mirror { transform: scaleX(-1) scale(var(--camera-zoom, 1)); }
.room-stage .overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.room-stage .tags { position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; z-index: 2; }
.room-stage .corner { position: absolute; top: 14px; right: 14px; z-index: 2; }
.reconnect-overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(11, 13, 16, 0.6); backdrop-filter: blur(3px); color: #fff; }
.caption-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; max-width: 88%; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 15px; line-height: 1.4; padding: 8px 14px; border-radius: 10px; text-align: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 10px; background: var(--room-panel); border: 1px solid var(--room-line); border-radius: 18px; }
.ctrl { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 76px; min-height: 58px; padding: 6px 10px; border-radius: 14px; border: 0; background: transparent; color: var(--room-ink); font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; }
.ctrl:hover { background: rgba(255, 255, 255, 0.07); }
.ctrl[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); }
.ctrl:disabled { opacity: 0.35; cursor: default; background: transparent; }
.ctrl.end { background: #d92d2a; color: #fff; min-width: 110px; flex-direction: row; gap: 8px; font-size: 15px; font-weight: 800; }
.ctrl.end:hover { background: #e5383b; }
.ctrl.zoom-control { min-width: 148px; cursor: default; }
.zoom-control input { width: 124px; min-height: 22px; margin: 0; accent-color: var(--brand); cursor: pointer; touch-action: pan-x; }
.panel { background: var(--room-panel); border: 1px solid var(--room-line); border-radius: 18px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--room-line); }
.panel-tabs button { flex: 1; min-height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--room-muted); font-weight: 700; cursor: pointer; }
.panel-tabs button[aria-selected="true"] { background: var(--room-panel-2); color: var(--room-ink); }
.panel-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }
.room .muted { color: var(--room-muted); }
.room .card { background: var(--room-panel-2); box-shadow: none; color: var(--room-ink); border: 1px solid var(--room-line); }
.room .notice.info { background: var(--room-panel-2); color: var(--room-ink); border-color: var(--room-line); }
.room .notice.warn { background: rgba(194, 103, 10, 0.18); color: #ffcf99; }
.room .notice.ok { background: rgba(15, 107, 79, 0.25); color: #a9ecc9; }
.room .notice.bad { background: rgba(217, 45, 42, 0.2); color: #ffb4ab; }
.room .input { background: var(--room-panel-2); border-color: var(--room-line); color: var(--room-ink); }
.room .field label, .room .label { color: #c9d0d9; }
.room .input::placeholder { color: #7d8794; }
.room .btn.ghost { background: transparent; color: var(--room-ink); border-color: #3a424d; }
.room .btn.ghost:hover { background: rgba(255, 255, 255, 0.06); }
.room .seg button { background: var(--room-panel-2); border-color: var(--room-line); color: var(--room-ink); }
.room .seg button[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 22%, var(--room-panel-2)); }
.room .seg .muted { color: var(--room-muted); }
.big-count { font-size: 46px; font-weight: 800; line-height: 1; color: #7ee0b5; letter-spacing: -0.03em; }
.person { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.stage-card { display: flex; justify-content: center; }
.prejoin { width: min(100%, 460px); background: rgba(20, 23, 28, 0.92); backdrop-filter: blur(10px); border: 1px solid var(--room-line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
@media (min-width: 960px) {
  .room-top { padding: 14px 24px; }
  .room-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr) auto; gap: 16px; padding: 16px 24px 20px; height: calc(100vh - 69px); }
  .room-stage { aspect-ratio: auto; grid-column: 1; grid-row: 1; height: 100%; }
  .controls { grid-column: 1; grid-row: 2; justify-self: center; }
  /* Same grid cell as the stage: the card floats over the camera. */
  .stage-card { grid-column: 1; grid-row: 1; align-self: center; justify-self: center; z-index: 3; width: min(100%, 460px); }
  .panel { grid-column: 2; grid-row: 1 / span 2; }
}

/* Chat */
.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble { padding: 11px 14px; border-radius: 16px; max-width: 88%; white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; }
.bubble.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.room .bubble.them { background: var(--room-panel-2); border-color: var(--room-line); }
.cite { font-size: 12px; opacity: 0.75; margin-top: 6px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 50px; max-height: 160px; }
.chat-layout { display: grid; gap: 16px; }
@media (min-width: 960px) { .chat-layout { grid-template-columns: 280px minmax(0, 1fr); align-items: start; } }
.chat-box { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 60vh; }
.chat-box .thread { flex: 1; padding: 18px; overflow-y: auto; }
.chat-box .composer { padding: 12px; border-top: 1px solid var(--line); }

/* ─── Sign-in ───────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; background: var(--surface); }
.auth-art { display: none; }
.auth-form { display: flex; flex-direction: column; justify-content: center; gap: 26px; padding: 40px 24px; width: 100%; max-width: 460px; margin: 0 auto; }
@media (min-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .auth-art { display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; color: #fff; background: radial-gradient(110% 120% at 0% 100%, color-mix(in srgb, var(--brand) 70%, #000) 0%, #0b0d10 70%); }
  .auth-art h2 { font-size: 44px; line-height: 1.08; font-weight: 800; max-width: 520px; letter-spacing: -0.03em; }
  .auth-art ul { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; color: #d6dbe2; font-size: 16px; }
  .auth-art li { display: flex; gap: 12px; align-items: center; }
  .auth-art li span { width: 30px; height: 30px; border-radius: 10px; background: rgba(255, 255, 255, 0.12); display: inline-flex; align-items: center; justify-content: center; flex: none; }
}

/* ─── Admin ─────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.table-wrap { position: relative; overflow-x: auto; max-width: 100%; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
th { text-align: left; font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 8px; background: var(--brand); border-radius: 4px; }
.join-code { font-size: 30px; font-weight: 800; letter-spacing: 0.22em; font-variant-numeric: tabular-nums; }

/* ─── Feels like a phone app ─────────────────────────────────────────────── */
html { -webkit-tap-highlight-color: transparent; }
button, a, .ctrl, .tabs a, .nav-item { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
/* Clear of the notch and the home bar on iPhones (viewport-fit=cover). */
@media (max-width: 959px) {
  .topbar, .room-top { padding-top: max(12px, env(safe-area-inset-top)); }
  .room-body { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .content { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}
/* In the installed app, our own pull-to-refresh replaces the browser's. */
@media (display-mode: standalone) { body { overscroll-behavior-y: contain; } }
.content { animation: page-in 0.18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pull { display: flex; align-items: flex-end; justify-content: center; overflow: hidden; color: var(--muted); font-size: 22px; }
.pull span { padding-bottom: 6px; transition: transform 0.15s, color 0.15s; }
.pull span.ready { transform: rotate(180deg); color: var(--brand); }
.app-card { border: 1px solid var(--brand-line); background: linear-gradient(0deg, var(--surface), var(--surface)); }
/* Bottom sheets */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(11, 13, 16, 0.45); display: flex; align-items: flex-end; justify-content: center; animation: fade-in 0.15s ease-out; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--surface); color: var(--ink); border-radius: 22px 22px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-lg); animation: sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet:focus { outline: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; }
@media (min-width: 960px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; } .sheet-grip { display: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .content, .sheet, .sheet-backdrop { animation: none; } }

/* ─── Demo ───────────────────────────────────────────────────────────────── */
.demo-card { gap: 14px; border: 1px dashed var(--brand-line); }
/* Stacked on phones: two buttons side by side would not fit a 390px screen. */
.demo-choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 560px) { .demo-choices { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.demo-choices .btn { min-height: 50px; }
.demo-card > a.small, .auth-form > a.small { display: inline-block; padding: 10px 0; }
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px 6px 16px; padding-top: max(6px, env(safe-area-inset-top)); background: var(--ink); color: #fff; font-size: 14px; }
.demo-bar-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.demo-bar-actions { display: flex; gap: 6px; flex: none; }
.demo-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.08); color: #fff; font: inherit; font-weight: 700; font-size: 13.5px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.demo-chip:hover { background: rgba(255, 255, 255, 0.16); }
.pill.wrap { white-space: normal; max-width: 100%; line-height: 1.35; }
.thumb.notes { aspect-ratio: 16 / 7; }
@media (min-width: 960px) { .demo-bar .demo-chip.desktop-only { display: inline-flex !important; } }

/* The student invited to speak, over the class picture. */
.floor-card { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 16px; background: rgba(11, 13, 16, 0.92); color: #fff; border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.floor-card strong { display: flex; align-items: center; gap: 8px; font-size: 16px; }
@media (min-width: 960px) { .floor-card { left: auto; width: 360px; } }

/* ─── Elections (screens-elections.js, screens-vote.js) ─────────────────── */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; }
.chip-check input { accent-color: var(--brand); }
.election-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; color: inherit; text-decoration: none; }
.election-card:hover { box-shadow: var(--shadow-lg); }
.election-title { font-size: 17px; font-weight: 800; }
.steps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.steps button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-height: 40px; padding: 0 14px; font: inherit; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.steps button.done { color: var(--ok-ink); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok-ink) 30%, #fff); }
.steps button[aria-current="step"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.post-block { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.post-block summary { cursor: pointer; color: var(--brand); font-weight: 700; padding: 6px 0; }
.add-candidate { padding: 10px 0 4px; }
.face { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.roll-text { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13.5px; white-space: pre; overflow: auto; }
.copy-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.copy-link > .muted { grid-column: 1 / -1; }
.booth-code, .poster-qr { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.qr { border-radius: 10px; border: 1px solid var(--line); background: #fff; flex: none; max-width: 100%; height: auto; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.04em; font-weight: 600; }
.big-code { font-size: 26px; letter-spacing: 0.12em; }
.turnout-count { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.turnout-count small { font-size: 16px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.bar.thick, .bar.thick > span { height: 14px; border-radius: 7px; }
.hours { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(40px, 1fr); gap: 10px; align-items: end; min-height: 160px; overflow-x: auto; }
.hours .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.hours .col b { font-size: 13px; font-variant-numeric: tabular-nums; }
.hours .col i { display: block; width: 100%; max-width: 48px; background: var(--brand); border-radius: 8px 8px 2px 2px; }
.hours .col span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.group-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; gap: 10px; align-items: center; font-size: 14px; }
.group-row .small { text-align: right; font-variant-numeric: tabular-nums; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li, .seal-line { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed li:last-child, .seal-line:last-child { border-bottom: 0; }
.feed time, .seal-line time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.danger-card { border: 2px solid var(--bad-ink); }
.post-result { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.post-result:last-child { border-bottom: 0; }
.post-result h3 { font-size: 16px; font-weight: 800; margin: 0; }
.result-line { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 6px 12px; align-items: center; }
.result-line .name { font-weight: 700; }
.result-line .name small { color: var(--muted); font-weight: 600; }
.result-line .votes { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.result-line .bar { grid-column: 1 / -1; }
@media (max-width: 599px) { .list .item:has(.row) { flex-wrap: wrap; } .list .item .row { width: 100%; } }
/* The ballot (booth and phone), the booth tablet, phone voting, the public results page */
.ballot { gap: 14px; }
.ballot-card { background: var(--surface); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.ballot-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ballot-head h3 { font-size: 20px; font-weight: 800; margin: 0; }
.choices { display: grid; gap: 10px; }
@media (min-width: 700px) { .booth-screen .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font: inherit; font-size: 17px; text-align: left; cursor: pointer; }
.choice-text { flex: 1; min-width: 0; }
.choice b { display: block; font-weight: 800; }
.choice small { display: block; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.choice .tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--field); flex: none; display: grid; place-items: center; }
.choice[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.choice[aria-pressed="true"] .tick { background: var(--brand); border-color: var(--brand); }
.choice[aria-pressed="true"] .tick::after { content: ""; width: 10px; height: 6px; border: 3px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.booth-screen .choice { min-height: 72px; font-size: 19px; }
.face.big { width: 96px; height: 96px; }
.linkbtn { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; padding: 6px 0; text-align: left; align-self: flex-start; }
.ballot-foot { position: sticky; bottom: 0; padding: 10px 0 calc(6px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to bottom, transparent, var(--ground) 30%); display: flex; flex-direction: column; gap: 8px; }
.review-list { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 4px 18px; }
.review-line { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.review-line:last-child { border-bottom: 0; }
.review-line span:first-child { color: var(--muted); font-weight: 600; }
.review-line span:last-child { font-weight: 800; text-align: right; }
.vote-h { font-size: 24px; font-weight: 800; margin: 0; }
.done-screen { align-items: center; text-align: center; padding-top: 20px; }
.done-mark { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-ink); display: grid; place-items: center; font-size: 36px; font-weight: 800; }
.receipt { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 19px; font-weight: 600; letter-spacing: 0.05em; padding: 14px 16px; background: var(--surface); border: 2px dashed color-mix(in srgb, var(--brand) 35%, #fff); border-radius: 14px; overflow-wrap: anywhere; text-align: center; max-width: 100%; }
.receipt b { color: var(--brand); }
.countdown { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.booth-screen { min-height: 100vh; display: flex; flex-direction: column; background: var(--ground); }
.booth-head { background: var(--brand); color: var(--brand-ink); padding: 14px 20px; display: flex; align-items: center; gap: 12px; }
.booth-mark { background: #fff; color: var(--brand); }
.booth-titles { display: flex; flex-direction: column; min-width: 0; }
.booth-titles strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.booth-titles span { font-size: 13px; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.booth-no { margin-left: auto; font-weight: 800; background: rgba(255, 255, 255, 0.16); padding: 6px 12px; border-radius: 10px; white-space: nowrap; }
.booth-body { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 24px 20px 30px; display: flex; flex-direction: column; gap: 16px; }
.booth-center { display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center; flex: 1; gap: 16px; min-height: 60vh; }
.wait-mark { font-size: 64px; color: var(--brand); line-height: 1; }
.code-entry { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 26px; letter-spacing: 0.25em; text-align: center; text-transform: uppercase; max-width: 320px; }
.vote-page { min-height: 100vh; background: var(--ground); }
.app-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.app-top .booth-titles span { color: var(--muted); opacity: 1; }
.vote-body { max-width: 560px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 16px; }
.public-page { max-width: 780px; margin: 0 auto; padding: 20px 16px 40px; }
.public-title { font-size: 24px; font-weight: 800; margin: 0; line-height: 1.2; }
.receipt-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.9; }
.voter-row { gap: 10px; padding: 14px; }
/* A parent's result check (screens-result-check.js) */
.result-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px; margin: 0; }
.result-facts dt { font-size: 12px; color: var(--muted); }
.result-facts dd { margin: 0; font-weight: 700; }
table.result-table { min-width: 0; }
.result-table th, .result-table td { padding: 8px 10px; }
.result-table tbody th { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; color: var(--ink); background: none; border-bottom: 1px solid var(--line); }

/* A pupil's ID card in the app (screens-idcard.js): the school's colour, the photo, the QR code. */
.id-card { max-width: 360px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #ffffff; }
.id-band { background: var(--card, var(--brand)); color: #ffffff; font-weight: 700; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; padding: 10px 14px; }
.id-body { display: flex; gap: 12px; padding: 12px 14px; align-items: flex-start; flex-wrap: wrap; }
.id-photo { width: 88px; height: 88px; border-radius: 10px; object-fit: cover; flex: none; }
.id-photo.empty { display: grid; place-items: center; background: var(--bg-soft, #f2f4f7); color: var(--muted); font-size: 12px; }
.id-facts { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 140px; overflow-wrap: anywhere; }
.id-qr { display: flex; align-items: center; gap: 12px; padding: 0 14px 14px; flex-wrap: wrap; }
.id-qr svg { flex: none; }

/* Atlas's shared parents' address with no school chosen (screens-find-school.js). */
.find-school { padding-top: 40px; }
.find-brand { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 18px; font-weight: 800; }
.find-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #132a57; color: #f5b301; font-size: 16px; }
