/* Classroom screen: fills the window under the site's header; its widgets in a grid that reflows, and on a
   phone the page simply scrolls. */
.wbx-wrap {
  position: relative;
  height: calc(100vh - var(--hdr, 64px));
  height: calc(100dvh - var(--hdr, 64px));
  min-height: 560px;
}
.csx {
  --csx-bg: #0f172a;
  --csx-card: #1e293b;
  --csx-fg: #f8fafc;
  --csx-soft: #94a3b8;
  --csx-line: #334155;
  --csx-accent: #38bdf8;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--csx-bg);
  color: var(--csx-fg);
  font: 15px/1.4 var(--sans, Inter, system-ui, sans-serif);
  overflow: auto;
}
.csx[data-bg='sky'] { --csx-bg: #075985; --csx-card: #0c4a6e; --csx-line: #0369a1; --csx-soft: #bae6fd; }
.csx[data-bg='green'] { --csx-bg: #14532d; --csx-card: #166534; --csx-line: #15803d; --csx-soft: #bbf7d0; --csx-accent: #fde68a; }
.csx[data-bg='purple'] { --csx-bg: #3b0764; --csx-card: #581c87; --csx-line: #7e22ce; --csx-soft: #e9d5ff; --csx-accent: #f0abfc; }
.csx[data-bg='light'] { --csx-bg: #f1f5f9; --csx-card: #ffffff; --csx-fg: #0b1220; --csx-soft: #475569; --csx-line: #e2e8f0; --csx-accent: #0284c7; }
.csx [hidden] { display: none !important; }
.csx button, .csx input, .csx textarea { font: inherit; }
.csx-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--csx-line);
}
.csx-top h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0; margin-right: auto; color: var(--csx-fg); }
.csx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.csx-chip, .csx-btn {
  border: 1px solid var(--csx-line);
  background: transparent;
  color: var(--csx-fg);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.csx-chip[aria-pressed='true'] { background: var(--csx-accent); border-color: var(--csx-accent); color: #0b1220; }
.csx-btn.main { background: var(--csx-accent); border-color: var(--csx-accent); color: #0b1220; }
.csx-btn:disabled { opacity: 0.5; cursor: default; }
.csx-swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--csx-line); cursor: pointer; }
.csx-swatch[aria-pressed='true'] { outline: 2px solid var(--csx-accent); outline-offset: 2px; }
.csx-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: minmax(220px, 1fr);
  gap: 14px;
  padding: 14px;
}
.csx-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--csx-card);
  border: 1px solid var(--csx-line);
  container-type: inline-size;
}
.csx-card h2 { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--csx-soft); }
.csx-body { flex: 1; display: grid; place-items: center; text-align: center; min-height: 0; }
.csx-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin-top: 8px; }
.csx-row input[type='text'] { width: 82px; border: 1px solid var(--csx-line); border-radius: 999px; padding: 6px 10px; background: transparent; color: var(--csx-fg); text-align: center; font-variant-numeric: tabular-nums; }
.csx-soft { color: var(--csx-soft); font-size: 13px; }
/* timer */
.csx-time { font-size: clamp(44px, 25cqi, 200px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -0.02em; }
.csx-card[data-state='soon'] { background: #78350f; border-color: #b45309; color: #fff; --csx-fg: #fff; --csx-soft: #fde68a; }
.csx-card[data-state='over'] { background: #7f1d1d; border-color: #b91c1c; color: #fff; --csx-fg: #fff; --csx-soft: #fecaca; }
.csx-bar { height: 8px; width: 100%; border-radius: 999px; background: rgba(148, 163, 184, 0.25); overflow: hidden; margin-top: 10px; }
.csx-bar div { height: 100%; width: 100%; background: var(--csx-accent); transition: width 0.25s linear; }
/* names */
.csx-name { font-size: clamp(28px, 13cqi, 110px); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.csx-name.idle { font-size: clamp(18px, 2.4vw, 28px); color: var(--csx-soft); font-weight: 600; }
.csx-card textarea { width: 100%; min-height: 110px; margin-top: 8px; border: 1px solid var(--csx-line); border-radius: 10px; padding: 8px 10px; background: transparent; color: var(--csx-fg); resize: vertical; }
.csx-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--csx-soft); }
/* noise */
.csx-meter { width: 100%; }
.csx-level { font-size: clamp(30px, 14cqi, 96px); font-weight: 800; line-height: 1; }
.csx-nbar { position: relative; height: 22px; border-radius: 999px; background: rgba(148, 163, 184, 0.25); overflow: hidden; margin: 12px 0 4px; }
.csx-nbar > div { height: 100%; width: 0; background: #22c55e; transition: width 0.1s linear, background 0.3s; }
.csx-nbar > i { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--csx-fg); opacity: 0.8; }
.csx-card[data-noise='ok'] .csx-nbar > div { background: #f59e0b; }
.csx-card[data-noise='loud'] { background: #7f1d1d; border-color: #ef4444; color: #fff; --csx-fg: #fff; --csx-soft: #fecaca; }
.csx-card[data-noise='loud'] .csx-nbar > div { background: #ef4444; }
.csx-card input[type='range'] { width: 140px; accent-color: var(--csx-accent); }
/* traffic light */
.csx-light { display: flex; gap: 12px; padding: 12px 16px; border-radius: 999px; background: #0b1220; }
.csx-light button { width: clamp(44px, 18cqi, 110px); height: clamp(44px, 18cqi, 110px); border-radius: 50%; border: 0; cursor: pointer; opacity: 0.22; transition: opacity 0.2s, box-shadow 0.2s; }
.csx-light button[data-c='red'] { background: #ef4444; }
.csx-light button[data-c='amber'] { background: #f59e0b; }
.csx-light button[data-c='green'] { background: #22c55e; }
.csx-light button[aria-pressed='true'] { opacity: 1; box-shadow: 0 0 28px currentColor; }
.csx-light button[data-c='red'][aria-pressed='true'] { color: #ef4444; }
.csx-light button[data-c='amber'][aria-pressed='true'] { color: #f59e0b; }
.csx-light button[data-c='green'][aria-pressed='true'] { color: #22c55e; }
.csx-lightlabel { margin-top: 12px; font-size: clamp(20px, 2.8vw, 40px); font-weight: 700; outline: none; min-width: 4ch; }
/* now / next */
.csx-now { display: grid; gap: 10px; width: 100%; text-align: left; }
.csx-now b { display: block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--csx-accent); }
.csx-now div[contenteditable] { font-size: clamp(20px, 2.6vw, 38px); font-weight: 700; line-height: 1.2; padding: 4px 6px; margin: 0 -6px; border-radius: 8px; outline: none; overflow-wrap: anywhere; min-height: 1.3em; }
.csx-now div[contenteditable]:focus { background: rgba(148, 163, 184, 0.15); }
.csx-now div.next { font-size: clamp(16px, 2vw, 28px); font-weight: 600; color: var(--csx-soft); }
.csx-now div[contenteditable]:empty::before { content: attr(data-placeholder); color: var(--csx-soft); opacity: 0.7; }
.csx-error { color: #fecaca; font-size: 13px; margin: 6px 0 0; }
.csx:fullscreen .csx-grid { padding: 2vh 2vw; gap: 2vh; }
@media (max-width: 700px) {
  .wbx-wrap { height: auto; min-height: 0; }
  .csx { position: static; overflow: visible; }
  .csx-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .csx-card { min-height: 220px; }
}
.csx[data-bg='light'] .csx-error { color: #b91c1c; }
