*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
:root {
  --ink:        #0b1626;   /* near-black chrome bg */
  --ink-2:      #122238;   /* card bg */
  --ink-3:      #1b2c47;   /* raised surface */
  --line:       rgba(255,255,255,0.06);
  --text:       #eaf0f7;
  --text-dim:   #b6c5dc;
  --text-dim-2: #6b809d;
  --accent:     #3da585;   /* sage green */
  --accent-hi:  #5ec3a3;
  --warn-y:     #ffd84a;

  /* Kid (student) palette — Mushaf paper feel. */
  --paper:      #f7efd7;
  --paper-2:    #efe5c3;
  --paper-ink:  #1a2a3a;
  --paper-mute: #8a7548;
  --paper-line: rgba(0,0,0,0.10);
}
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--ink);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }

/* `hidden` must beat any `display:` rule below. */
[hidden] { display: none !important; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* HOME ------------------------------------------------------------ */
#home {
  align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(61,165,133,0.10), transparent 70%),
    radial-gradient(60% 50% at 50% 100%, rgba(100,181,255,0.05), transparent 70%),
    var(--ink);
}
.home-card { max-width: 460px; width: 100%; text-align: center; }
.home-logo {
  font-size: 56px; line-height: 1; color: var(--accent);
  opacity: .85; margin-bottom: 18px;
}
.home-card h1 {
  font-size: 40px; margin: 0 0 8px;
  letter-spacing: -0.5px; font-weight: 600;
}
.tag { color: var(--text-dim); margin: 0 0 36px; font-size: 16px; }
.big-btn {
  display: inline-block; padding: 16px 28px; border-radius: 14px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 17px;
  box-shadow: 0 8px 24px rgba(61,165,133,.35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.big-btn:hover { box-shadow: 0 10px 28px rgba(61,165,133,.45); }
.big-btn:active { transform: translateY(1px); box-shadow: 0 4px 14px rgba(61,165,133,.3); }
.big-btn.small { padding: 10px 14px; font-size: 14px; box-shadow: 0 4px 12px rgba(61,165,133,.25); }
.hint { color: var(--text-dim-2); font-size: 13px; margin-top: 16px; }

/* TEACHER HEADER -------------------------------------------------- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; gap: 10px;
  background: var(--ink-2); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.bar .left, .bar .right {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; min-width: 0;
}
.bar .left { flex: 1 1 auto; }
.btn-icon { font-size: 14px; }
.bar select {
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; color: var(--text); max-width: 260px;
  font-weight: 500;
}
.jumper {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim);
  background: var(--ink-3); padding: 3px; border-radius: 10px;
  border: 1px solid var(--line);
}
.jumper input {
  width: 56px; padding: 6px 6px; border-radius: 6px;
  background: transparent; border: 0; color: var(--text);
  text-align: center; font-variant-numeric: tabular-nums; font-weight: 500;
}
.jumper input::-webkit-inner-spin-button { opacity: 0.6; }
.dim { color: var(--text-dim-2); font-variant-numeric: tabular-nums; padding-right: 4px; }
.ghost {
  padding: 9px 14px; border-radius: 10px;
  background: transparent; border: 1px solid var(--line); color: var(--text-dim);
  font-weight: 500; transition: background .12s, border-color .12s, color .12s;
}
.ghost:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.ghost:active { transform: translateY(1px); }
/* Lesson button — opens the picker. */
.lesson-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 10px;
  border-radius: 10px;
  background: var(--ink-3);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  max-width: 280px;
  transition: background .12s, border-color .12s;
}
.lesson-btn:hover { background: var(--ink-2); border-color: rgba(255,255,255,0.12); }
.lesson-btn-icon { font-size: 14px; }
.lesson-btn-label {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: left;
}
.lesson-btn-caret { color: var(--text-dim-2); font-size: 10px; }

.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim-2); }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim-2); transition: background .2s, box-shadow .2s; }
.presence.live .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(61,165,133,0.18); }
.presence.live .presence-txt { color: var(--accent-hi); }

/* STAGE / CONTENT ------------------------------------------------- */
.stage { flex: 1; position: relative; overflow: hidden; }

.content {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 16px clamp(12px, 4vw, 48px);
  -webkit-overflow-scrolling: touch;
  font-family: "Amiri Quran", "Scheherazade New", "Noto Naskh Arabic", "Traditional Arabic", serif;
  color: #f5efe2;
  scroll-padding-top: 80px;
  scroll-padding-bottom: 80px;
}
.content-student { font-size: 1.2em; }
.content .placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%;
  color: var(--text-dim-2); font-size: 36px; line-height: 1.4;
}

.source-note {
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 12px; color: var(--text-dim-2);
  padding: 4px 10px; margin: 0 0 8px;
  border-left: 2px solid var(--line);
  direction: ltr; text-align: left;
}
.content-student .source-note { display: none; }

.block {
  padding: 14px 4px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  scroll-margin-top: 80px;
  scroll-margin-bottom: 80px;
}
.block:last-child { border-bottom: 0; }
.block-num {
  display: inline-block;
  font-family: "Inter", sans-serif;
  font-size: 12px; color: var(--text-dim-2);
  padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px;
  margin-bottom: 8px; direction: ltr;
}
.block-words {
  font-size: clamp(28px, 4.6vw, 44px);
  line-height: 2.0; text-align: center; direction: rtl;
}
.content-student .block-words {
  font-size: clamp(34px, 6.4vw, 56px);
}
.word {
  display: inline-block; padding: 0 6px; border-radius: 8px;
  transition: background-color .15s, color .15s;
  cursor: pointer; user-select: none;
}
.word.pointed {
  background: var(--warn-y);
  color: #1a1206;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,216,74,.6); }
  50%     { box-shadow: 0 0 0 10px rgba(255,216,74,0); }
}

/* PDF VIEW -------------------------------------------------------- */
.pdf-frame {
  position: absolute; inset: 0;
  transform-origin: 0 0;
  transition: transform .45s cubic-bezier(.2, .65, .2, 1);
  will-change: transform;
  pointer-events: none;
}
.pdf-canvas {
  position: absolute; inset: 0;
  z-index: 1;
  width: 100%; height: 100%;
  background: var(--ink);
}
.pdf-empty {
  position: absolute; inset: 0;
  z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.pdf-empty h2 { margin: 0 0 8px; font-size: 22px; }
.pdf-empty p { color: var(--text-dim); margin: 6px 0 16px; max-width: 420px; }
.pdf-empty .big-btn { margin-top: 8px; }

.draw-canvas {
  position: absolute; inset: 0;
  z-index: 2; pointer-events: none;
  width: 100%; height: 100%;
}
.draw-canvas.pen-on { pointer-events: auto; touch-action: none; cursor: crosshair; }
.draw-canvas.tap-on { pointer-events: auto; touch-action: none; }

/* RESUME PILL ----------------------------------------------------- */
.resume-pill {
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px;
  background: rgba(18, 34, 56, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  font-size: 13px; color: var(--text);
  animation: resume-in .3s ease-out;
}
.resume-pill .resume-text { white-space: nowrap; }
.resume-pill .resume-go {
  background: var(--accent); color: #fff;
  padding: 5px 12px; border-radius: 999px;
  font-weight: 600; font-size: 12px;
}
.resume-pill .resume-go:hover { background: var(--accent-hi); }
.resume-pill .resume-dismiss {
  width: 26px; height: 26px; border-radius: 50%;
  color: var(--text-dim); font-size: 18px; line-height: 1;
}
.resume-pill .resume-dismiss:hover { color: var(--text); background: rgba(255,255,255,0.06); }
@keyframes resume-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* WHITEBOARD MODE ------------------------------------------------- */
/* When the teacher picks "Whiteboard", the .pdf-frame becomes a clean
   sheet of paper for ad-hoc letter drawing. */
.whiteboard-active .pdf-frame {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,0.04), transparent 60%),
    var(--paper);
  box-shadow: inset 0 0 80px rgba(0,0,0,0.04);
}
.whiteboard-active .pdf-frame::before {
  /* Subtle dotted grid so straight strokes feel guided, like ruled paper. */
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(0,0,0,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.whiteboard-active.student-mode .pdf-frame {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,0.05), transparent 60%),
    var(--paper);
}

.pdf-pointer {
  position: absolute; z-index: 3;
  width: 72px; height: 72px;
  margin-left: -36px; margin-top: -36px;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 216, 74, 0.65) 0%,
    rgba(255, 216, 74, 0.35) 30%,
    rgba(255, 216, 74, 0.10) 60%,
    rgba(255, 216, 74, 0)   78%
  );
  pointer-events: none;
}
.pdf-pointer::after {
  content: ''; position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: rgba(255, 216, 74, 0.95);
  box-shadow: 0 0 8px rgba(255, 216, 74, 0.7);
}

/* FLOATING TOOL DOCK --------------------------------------------- */
.tool-dock {
  position: absolute;
  top: 50%; right: 14px;
  transform: translateY(-50%);
  z-index: 4;
  display: flex; align-items: flex-start; gap: 6px;
  pointer-events: none; /* let dock-inner + toggle catch */
  transition: right .25s ease;
}
.tool-dock.collapsed { right: -90px; }
.tool-dock.collapsed .dock-toggle { transform: rotate(180deg); }

.dock-toggle {
  pointer-events: auto;
  width: 22px; height: 64px;
  border-radius: 10px 0 0 10px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-right: 0;
  color: var(--text-dim-2);
  font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s, transform .25s;
  align-self: center;
}
.dock-toggle:hover { color: var(--text); background: var(--ink-3); }

.dock-inner {
  pointer-events: auto;
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  width: 80px;
  max-height: 84vh;
  overflow-y: auto;
}

.toolbar-group {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  padding: 2px 0;
  position: relative;
}
.toolbar-group + .toolbar-group {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 2px;
}
.toolbar-group.swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  justify-items: center;
  padding-bottom: 4px;
}

.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  width: 60px; min-height: 48px;
  padding: 6px 4px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 11px; font-weight: 500;
  transition: background .12s, border-color .12s, color .12s;
}
.tool .tool-icon { font-size: 16px; line-height: 1; }
.tool .tool-label { font-size: 10px; letter-spacing: 0.02em; }
.tool:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.tool:active { transform: translateY(1px); }
.tool[aria-pressed="true"] {
  background: rgba(61, 165, 133, 0.18);
  border-color: var(--accent);
  color: #fff;
}
.zoom-group .zoom-label { order: 2; }
.step {
  width: 32px; height: 32px; min-height: 32px;
  border-radius: 8px;
  background: transparent; border: 0; color: var(--text-dim);
  font-size: 20px; line-height: 1; padding: 0;
}
.step:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.swatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  padding: 0; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s;
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--ink-2), 0 0 0 4px #fff;
}
.zoom-label {
  display: block; text-align: center;
  font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.status-bar {
  position: absolute; bottom: 10px; left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 11px; color: var(--text-dim-2);
  padding: 4px 12px;
  background: rgba(18, 34, 56, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.status {
  margin-left: auto;
  font-size: 12px; color: var(--text-dim-2);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
}

/* STUDENT — Mushaf-paper feel ------------------------------------ */
.student-mode {
  background: var(--paper);
  color: var(--paper-ink);
  touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
.stage-student { padding: 0; }
.content-student { pointer-events: none; color: var(--paper-ink); }
.student-mode .pdf-canvas { background: var(--paper); }
.student-mode .block { border-bottom-color: var(--paper-line); }
.student-mode .block-num {
  color: var(--paper-mute);
  border-color: var(--paper-line);
}
.student-mode .word { color: var(--paper-ink); }

/* Welcoming placeholder before the teacher starts. */
.content-student .placeholder {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  font-family: "Amiri Quran", serif;
  color: var(--paper-mute);
}
.placeholder-ornament {
  font-size: clamp(72px, 12vw, 120px);
  color: var(--accent);
  opacity: 0.65;
  animation: orn-breathe 4s ease-in-out infinite;
}
@keyframes orn-breathe {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 0.75; transform: scale(1.04); }
}
.placeholder-greeting {
  font-family: "Amiri Quran", "Scheherazade New", serif;
  font-size: clamp(44px, 7vw, 72px);
  color: #4a3a1e;
  direction: rtl;
}
.placeholder-sub {
  font-family: "Inter", sans-serif;
  font-size: clamp(14px, 2vw, 17px);
  color: var(--paper-mute);
  letter-spacing: 0.2px;
}

/* Status pill on student — softer, glassy on paper. */
.status-pill {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.7); color: var(--paper-mute);
  border: 1px solid var(--paper-line);
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
  font-weight: 500;
  pointer-events: none; z-index: 5;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .35s;
}
.status-pill.hidden { opacity: 0; }

/* MODAL ---------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 10;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; max-width: 420px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modal-in .25s cubic-bezier(.2,.7,.3,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-card h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; }
.modal-card p { color: var(--text-dim); margin: 6px 0 16px; }
.link-row { display: flex; gap: 8px; margin-bottom: 12px; }
.link-row input {
  flex: 1; padding: 11px 14px; border-radius: 10px;
  background: var(--ink); border: 1px solid var(--line); color: var(--text);
  font-size: 13px;
}

/* QR code block */
.qr-code {
  display: block; margin: 4px auto 18px;
  width: 220px; height: 220px;
  background: #fff; padding: 12px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.qr-code svg { display: block; width: 100%; height: 100%; }
.qr-code img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

/* PICKER --------------------------------------------------------- */
.picker-card {
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 18px;
  width: 100%; max-width: 540px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modal-in .25s cubic-bezier(.2,.7,.3,1);
}
.picker-search {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.picker-search-icon { font-size: 16px; opacity: 0.7; }
.picker-search input {
  flex: 1; padding: 10px 12px;
  background: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 14px;
}
.picker-search input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.picker-close {
  width: 34px; height: 34px; border-radius: 8px;
  color: var(--text-dim); font-size: 22px; line-height: 1;
}
.picker-close:hover { background: rgba(255,255,255,0.06); color: var(--text); }

.picker-tabs {
  display: flex; gap: 4px; padding: 8px;
  border-bottom: 1px solid var(--line);
}
.picker-tab {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 6px; border-radius: 999px;
  background: transparent; color: var(--text-dim);
  font-size: 13px; font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background .12s, color .12s;
}
.picker-tab-icon { flex-shrink: 0; font-size: 14px; }
.picker-tab-label { overflow: hidden; text-overflow: ellipsis; }
.picker-tab:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.picker-tab.active { background: var(--accent); color: #fff; }
/* On narrow screens the 4 text labels don't fit — drop to icon-only,
   keeping a tooltip/aria label for accessibility. */
@media (max-width: 480px) {
  .picker-tab-label { display: none; }
  .picker-tab { padding: 10px 8px; }
  .picker-tab-icon { font-size: 18px; }
}

.picker-list {
  flex: 1; overflow-y: auto;
  padding: 8px;
}
.picker-empty {
  padding: 28px 18px; text-align: center;
  color: var(--text-dim);
}
.picker-empty .dim { color: var(--text-dim-2); font-size: 12px; }
.picker-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text); text-align: left;
  transition: background .1s;
}
.picker-item:hover { background: rgba(255,255,255,0.05); }
.picker-item-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink-3); border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.picker-item-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.picker-item-label {
  font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-item-sub {
  font-size: 12px; color: var(--text-dim-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-bm {
  flex-shrink: 0;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(61, 165, 133, 0.15);
  color: var(--accent-hi);
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}

/* Upload progress */
.progress {
  height: 10px; background: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; margin: 12px 0;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transition: width .15s linear;
}

/* PHONE / PORTRAIT ------------------------------------------------ */
/* The teacher header packs a lot in; on a narrow phone the controls
   were overflowing and clipping. Shrink paddings, drop button text to
   icon-only, and let everything wrap instead of getting cut off. */
@media (max-width: 640px) {
  .bar { padding: 8px; gap: 6px; }
  .bar .left, .bar .right { gap: 6px; }

  /* Ghost buttons (Upload PDF, Share link) become icon-only. */
  .ghost { padding: 9px 11px; }
  .ghost .btn-label { display: none; }
  .ghost .btn-icon { font-size: 17px; }

  /* Lesson button keeps its label but caps its width. */
  .lesson-btn { max-width: 44vw; padding: 8px 10px; }
  .lesson-btn-label { font-size: 12px; }

  /* Presence: show just the status dot, hide the words. */
  .presence .presence-txt { display: none; }

  /* Jumper slimmer so prev/next stay reachable. */
  .jumper { gap: 3px; }
  .jumper input { width: 40px; padding: 6px 2px; }
  #t-jump-label { font-size: 12px; }
  .dim { font-size: 12px; }

  /* Slimmer floating dock so it doesn't crowd the page. */
  .dock-inner { width: 66px; padding: 8px 5px; gap: 6px; }
  .tool { width: 52px; min-height: 42px; }
  .tool .tool-icon { font-size: 15px; }
  .swatch { width: 20px; height: 20px; }

  /* Modals use the full width on small screens. */
  .modal { padding: 12px; }
  .modal-card { padding: 22px; }
}

/* Very narrow phones — give the header two clean rows. */
@media (max-width: 420px) {
  .bar .left, .bar .right { flex: 1 1 100%; }
  .bar .right { justify-content: flex-end; }
  .lesson-btn { max-width: 56vw; }
}
