/* ============================================================
   COSMO MOOD CHECKER — Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:       #f0f4f8;
  --c-surface:  #ffffff;
  --c-border:   #dde3ea;
  --c-text:     #1a2533;
  --c-muted:    #6b7a8d;
  --c-accent:   #4f7ef8;
  --c-accent2:  #7c4ff8;
  --c-danger:   #e53e3e;
  --c-success:  #38a169;
  --c-warn:     #d97706;
  --radius:     14px;
  --shadow:     0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.14);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── SCREEN MANAGER ── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ── UTILITY ── */
.hidden  { display: none !important; }
.row     { display: flex; align-items: center; gap: 10px; }
.row-sb  { display: flex; align-items: center; justify-content: space-between; }
.col     { display: flex; flex-direction: column; }
.gap-4   { gap: 4px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-24  { gap: 24px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.text-muted   { color: var(--c-muted); font-size: 0.875rem; }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.875rem; }
.text-lg      { font-size: 1.125rem; }
.text-xl      { font-size: 1.375rem; font-weight: 600; }
.text-2xl     { font-size: 1.75rem;  font-weight: 700; }
.flex-1  { flex: 1; }
.w-full  { width: 100%; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 0.9375rem; font-weight: 600; transition: all 0.15s ease;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: #3b67e0; }
.btn-secondary { background: var(--c-border); color: var(--c-text); }
.btn-secondary:hover { background: #c8d0dc; }
.btn-danger    { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-ghost     { background: transparent; color: var(--c-accent); border: 2px solid var(--c-accent); }
.btn-ghost:hover { background: #eef2ff; }
.btn-icon      { padding: 8px; border-radius: 8px; background: var(--c-border); }
.btn-lg        { padding: 14px 28px; font-size: 1.0625rem; border-radius: 12px; }
.btn-sm        { padding: 6px 14px; font-size: 0.8125rem; border-radius: 8px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── INPUTS ── */
.input {
  width: 100%; padding: 10px 14px; border: 2px solid var(--c-border);
  border-radius: 10px; font-size: 0.9375rem; color: var(--c-text);
  background: var(--c-surface); outline: none; transition: border-color 0.15s;
}
.input:focus { border-color: var(--c-accent); }
.input-sm { padding: 7px 11px; font-size: 0.875rem; border-radius: 8px; }

.select {
  width: 100%; padding: 10px 14px; border: 2px solid var(--c-border);
  border-radius: 10px; font-size: 0.9375rem; color: var(--c-text);
  background: var(--c-surface); outline: none; cursor: pointer;
  appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%236b7a8d'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}
.select:focus { border-color: var(--c-accent); }

label { font-size: 0.875rem; font-weight: 600; color: var(--c-muted); margin-bottom: 5px; display: block; }

/* ── CARD ── */
.card {
  background: var(--c-surface); border-radius: var(--radius);
  border: 1px solid var(--c-border); box-shadow: var(--shadow);
  padding: 20px;
}
.card-sm { padding: 14px; border-radius: 10px; }

/* ── TOGGLE SWITCH ── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--c-border); border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--c-accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── PILL SELECTOR (display mode) ── */
.pill-group { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 7px 16px; border-radius: 20px; border: 2px solid var(--c-border);
  cursor: pointer; font-size: 0.875rem; font-weight: 600;
  color: var(--c-muted); background: var(--c-surface); transition: all 0.15s;
  user-select: none;
}
.pill.active { border-color: var(--c-accent); background: #eef2ff; color: var(--c-accent); }

/* ── PIN PAD ── */
.pin-display {
  display: flex; gap: 12px; justify-content: center; margin: 24px 0;
}
.pin-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--c-accent); background: transparent;
  transition: background 0.15s;
}
.pin-dot.filled { background: var(--c-accent); }

.pin-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 260px; margin: 0 auto;
}
.pin-key {
  aspect-ratio: 1; border-radius: 12px; border: none;
  background: var(--c-surface); box-shadow: var(--shadow);
  font-size: 1.375rem; font-weight: 700; cursor: pointer;
  transition: all 0.12s; display: flex; align-items: center; justify-content: center;
}
.pin-key:hover  { background: #eef2ff; color: var(--c-accent); }
.pin-key:active { transform: scale(0.93); background: var(--c-accent); color: #fff; }
.pin-key.del    { font-size: 1rem; }

/* ── HOME SCREEN ── */
#screen-home {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f3e8ff 100%);
  padding: 24px;
}
.home-logo { font-size: 4rem; margin-bottom: 8px; }
.home-title { font-size: 2rem; font-weight: 800; color: var(--c-text); }
.home-sub { color: var(--c-muted); margin-bottom: 32px; }
.pupil-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; width: 100%; max-width: 560px;
}
.pupil-card {
  background: var(--c-surface); border-radius: 14px; padding: 18px 12px;
  text-align: center; cursor: pointer; border: 2px solid var(--c-border);
  transition: all 0.15s; box-shadow: var(--shadow);
}
.pupil-card:hover { border-color: var(--c-accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pupil-card .avatar { font-size: 2.25rem; margin-bottom: 8px; }
.pupil-card .pname  { font-weight: 700; font-size: 0.9375rem; }
.pupil-card .psess  { font-size: 0.75rem; color: var(--c-muted); margin-top: 2px; }
.pupil-card.add-new {
  border-style: dashed; color: var(--c-accent); background: #f8faff;
}
.pupil-card.add-new .avatar { color: var(--c-accent); }

/* ── HEADER BAR ── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--c-surface);
  border-bottom: 1px solid var(--c-border); box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky; top: 0; z-index: 100;
}
.header-title { font-size: 1.0625rem; font-weight: 700; }

/* ── SESSION SETUP ── */
#screen-setup { background: var(--c-bg); }
#screen-setup .body { padding: 20px; max-width: 680px; margin: 0 auto; width: 100%; }

.question-toggle {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--c-surface); border-radius: 12px; border: 2px solid var(--c-border);
  cursor: pointer; transition: border-color 0.15s; user-select: none;
}
.question-toggle:hover   { border-color: var(--c-accent); }
.question-toggle.selected{ border-color: var(--c-accent); background: #f5f8ff; }
.qt-icon  { font-size: 1.5rem; width: 36px; text-align: center; }
.qt-text  { flex: 1; }
.qt-title { font-weight: 600; font-size: 0.9375rem; }
.qt-options { font-size: 0.75rem; color: var(--c-muted); margin-top: 2px; }
.qt-edited { font-size: 0.65rem; font-weight: 600; color: var(--c-accent); background: #eef2ff; border-radius: 4px; padding: 1px 5px; vertical-align: middle; }
.btn-edit-q {
  background: none; border: none; cursor: pointer; font-size: 0.95rem;
  padding: 4px 6px; border-radius: 6px; opacity: 0.45; transition: opacity 0.15s;
  flex-shrink: 0;
}
.btn-edit-q:hover { opacity: 1; background: #f0f0f0; }
.edq-option-row { display: flex; gap: 6px; align-items: center; }
.edq-option-row .edq-emoji { width: 56px; text-align: center; flex-shrink: 0; }
.edq-option-row .edq-label { flex: 1; }
.qt-check {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
  background: var(--c-surface); transition: all 0.15s;
}
.question-toggle.selected .qt-check { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

/* Question groups (collapsible sections) */
.q-group { border-radius: 12px; border: 2px solid var(--c-border); overflow: hidden; background: var(--c-surface); }
.q-group + .q-group { margin-top: 8px; }
.q-group-summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer; user-select: none;
  font-weight: 600; font-size: 0.9rem;
  background: var(--c-surface);
}
.q-group-summary::-webkit-details-marker { display: none; }
.q-group-summary::after { content: '›'; font-size: 1.25rem; color: var(--c-muted); transition: transform 0.2s; }
.q-group[open] > .q-group-summary::after { transform: rotate(90deg); }
.q-group-summary:hover { background: #f5f8ff; }
.q-group-count { font-size: 0.75rem; font-weight: 600; color: var(--c-accent); margin-right: 8px; }
.q-group-body { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 10px; }
.q-group-body .question-toggle { border-radius: 10px; }

/* Last session banner */
.last-session-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--c-surface); border: 2px solid var(--c-border);
  border-radius: 12px; padding: 14px 16px;
}
.last-session-info { display: flex; flex-direction: column; gap: 2px; }
.last-session-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--c-muted); }
.last-session-date { font-size: 0.9rem; font-weight: 600; color: var(--c-text); }

/* Saved sets */
.saved-set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--c-surface); border: 2px solid var(--c-border);
  border-radius: 12px; padding: 12px 14px;
  transition: border-color 0.2s, background 0.2s;
}
.saved-set-row.set-active {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.06);
}
.saved-set-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.saved-set-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-set-count { font-size: 0.75rem; color: var(--c-muted); }
.btn-set-active {
  background: #22c55e; color: #fff; border: 2px solid #16a34a;
  font-weight: 700;
}
.btn-set-active:hover { background: #16a34a; }

/* Setup section accordions */
.setup-accordion { border: 1.5px solid var(--c-border); border-radius: 12px; overflow: hidden; }
.setup-accordion-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: var(--c-surface); cursor: pointer;
  user-select: none; transition: background 0.12s;
}
.setup-accordion-header:hover { background: #eef2ff; }
.setup-accordion-chevron { font-size: 0.75rem; color: var(--c-muted); flex-shrink: 0; }
.setup-accordion-body {
  padding: 12px 16px 16px; background: var(--c-bg);
  overflow: hidden;
  max-height: 4000px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
}
.setup-accordion-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.cq-answers-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.22s ease;
}
.cq-answers-body.open {
  max-height: 1000px;
  opacity: 1;
}

/* Custom question cards */
.custom-q-card {
  background: var(--c-surface); border-radius: 12px;
  border: 2px solid var(--c-border); padding: 14px; gap: 10px;
}
.custom-q-card.selected { border-color: var(--c-accent2); background: #f8f5ff; }
.cq-set-warning {
  font-size: 0.78rem; font-weight: 600; color: #92400e;
  background: #fef3c7; border: 1px solid #fde68a;
  border-radius: 6px; padding: 5px 10px; margin-top: 6px;
}
.option-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.emoji-preview {
  width: 38px; height: 38px; border-radius: 8px; border: 2px dashed var(--c-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; cursor: pointer; background: var(--c-bg);
  transition: border-color 0.15s; flex-shrink: 0;
}
.emoji-preview:hover { border-color: var(--c-accent); }

/* ── EMOJI PICKER — BOTTOM SHEET ── */
.emoji-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 900;
}
.emoji-picker-overlay.hidden { display: none !important; }

.emoji-sheet {
  background: var(--c-surface);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 640px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  will-change: transform;
}

.emoji-drag-handle {
  width: 44px; height: 5px;
  background: var(--c-border); border-radius: 3px;
  margin: 10px auto 4px;
  cursor: grab; flex-shrink: 0;
}
.emoji-drag-handle:active { cursor: grabbing; }

.emoji-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 16px 8px; flex-shrink: 0;
}

.emoji-search-wrap {
  padding: 0 16px 6px; flex-shrink: 0;
}
.emoji-count {
  display: block; font-size: 0.72rem; color: var(--c-muted); margin-top: 4px;
}

.emoji-picker-content {
  flex: 1; overflow-y: auto; padding: 0 16px 32px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Section headings */
.emoji-section-title {
  font-size: 0.7rem; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 10px 0 6px;
  border-top: 1px solid var(--c-border);
  margin-top: 6px;
  position: sticky; top: 0;
  background: var(--c-surface);
  z-index: 1;
}

/* Scale groups */
.scale-group { margin-bottom: 10px; }
.scale-group-name {
  font-size: 0.68rem; color: var(--c-muted);
  margin-bottom: 3px; padding-left: 1px;
}
.scale-row {
  display: grid; gap: 4px;
}
.scale-btn {
  padding: 8px 3px; border-radius: 8px; border: 2px solid transparent;
  background: var(--c-bg); cursor: pointer;
  font-size: 0.85rem; text-align: center; line-height: 1.25;
  transition: all 0.1s; white-space: nowrap; overflow: hidden;
  letter-spacing: -1.5px;
}
.scale-btn:hover  { background: #eef2ff; border-color: var(--c-accent); }
.scale-btn:active { background: var(--c-accent); color: #fff; transform: scale(0.93); }

/* Regular emoji grid */
.emoji-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  margin-bottom: 4px;
}
.emoji-btn {
  font-size: 1.5rem; padding: 5px 2px;
  border-radius: 8px; border: none;
  cursor: pointer; background: transparent;
  transition: background 0.1s;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.emoji-btn:hover  { background: var(--c-bg); }
.emoji-btn:active { background: #eef2ff; transform: scale(0.88); }

/* ── ACTIVITY SCREEN ── */
#screen-activity {
  background: #0d1b2a;
  background-size: cover;
  background-position: center;
  position: relative; overflow: hidden;
  align-items: center;
  height: 100dvh; max-height: 100dvh; /* never scroll */
}
/* Dark scrim when a background image is active, keeps UI readable */
#screen-activity.has-bg-image::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background: rgba(5, 14, 26, 0.52);
  pointer-events: none;
}
/* VFX canvas sits above bg overlay, below UI */
#vfx-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}
/* Raise flex content above the canvas — leave absolutely-positioned overlays untouched */
#screen-activity .activity-content,
#screen-activity .answer-buttons {
  position: relative;
  z-index: 2;
}

/* Lock Controls — top-left corner */
.lock-controls {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 5px;
  z-index: 50;
}
.btn-hold, .btn-lock-toggle {
  padding: 6px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 700;
  border: none; cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: all 0.12s; letter-spacing: 0.03em;
}
.btn-hold {
  background: rgba(255,255,255,0.15); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.35);
}
.btn-hold:active, .btn-hold.holding {
  background: rgba(255,80,80,0.85); border-color: #ff5050; color: #fff;
}
.btn-lock-toggle {
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.35);
}
.btn-lock-toggle.locked {
  background: rgba(255,80,80,0.75); border-color: #ff5050; color: #fff;
}
.lock-indicator {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.25); transition: background 0.2s;
}
.lock-indicator.locked { background: #ff5050; box-shadow: 0 0 6px #ff5050; }

/* Music selector on activity screen */
.activity-music-row {
  position: absolute; top: 12px; right: 12px;
  display: flex; align-items: center; gap: 6px; z-index: 50;
}
.activity-music-row select {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  font-size: 0.75rem; font-weight: 600;
  padding: 6px 10px;
  width: auto; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.activity-music-row select option { background: #1e3a5f; color: #fff; }
.btn-music-mute {
  background: rgba(255,255,255,0.15); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.35); border-radius: 8px;
  font-size: 1rem; padding: 5px 9px; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  line-height: 1;
}
.btn-music-mute:hover { background: rgba(255,255,255,0.25); }
.btn-music-mute.muted { opacity: 0.45; }

/* Question display */
.activity-content {
  flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding: 72px 24px 8px;
  width: 100%;
}
.question-card {
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 20px;
  padding: 24px 36px 20px;
  max-width: 680px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.question-number {
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.7); margin-bottom: 16px; text-transform: uppercase;
}
.question-text {
  font-size: clamp(1.5rem, 4vw, 2.5rem); font-weight: 700; color: #fff;
  text-align: center; line-height: 1.3; max-width: 700px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.question-emoji-display {
  font-size: clamp(3rem, 10vw, 6rem); margin: 16px 0 8px;
}

/* Answer buttons */
.answer-buttons {
  flex: 1;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 20px; padding: 20px 32px 48px;
  max-width: 960px; width: 100%;
  align-self: center;
}
.answer-item {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  flex: 1 1 140px; max-width: 180px; min-width: 110px;
}
.answer-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 18px 12px; border-radius: 18px; border: 3px solid rgba(255,255,255,0.25);
  cursor: pointer; width: 100%;
  background: rgba(255,255,255,0.92); color: #1e293b;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  font-weight: 700;
}
.answer-btn .ans-emoji { font-size: 2.2rem; line-height: 1; }
.answer-btn .ans-label { font-size: 0.875rem; text-align: center; }
.answer-btn:hover:not(:disabled) { transform: translateY(-4px) scale(1.04); box-shadow: 0 10px 28px rgba(0,0,0,0.35); }
.answer-btn:active:not(:disabled) { transform: scale(0.95); }
.answer-btn:disabled { opacity: 0.25; cursor: not-allowed; transform: none !important; box-shadow: none; }
.answer-item.disabled { opacity: 0.25; pointer-events: none; }

.answer-color-dot {
  width: 22px; height: 22px; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  flex-shrink: 0;
}

.answer-item.selected-flash .answer-btn {
  animation: flash 0.35s ease;
}
@keyframes flash {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(1.8); transform: scale(1.08); }
  100% { filter: brightness(1); transform: scale(1); }
}

/* Progress bar */
.activity-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 4px; background: rgba(255,255,255,0.1);
}
.activity-progress-fill {
  height: 100%; background: var(--c-accent);
  transition: width 0.4s ease; border-radius: 0 2px 2px 0;
}

/* Wizard — JS drives all movement, CSS just sets base state */
#activity-wizard-east,
#activity-wizard-west {
  position: absolute;
  height: 200px;
  width: auto;
  z-index: 10;
  pointer-events: none;
  image-rendering: pixelated;
  visibility: hidden;
}

/* ── SUMMARY SCREEN ── */
#screen-summary { background: var(--c-bg); }
#screen-summary .body { padding: 20px; max-width: 600px; margin: 0 auto; width: 100%; }
.summary-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; background: var(--c-surface);
  border-radius: 12px; border: 1px solid var(--c-border);
}
.summary-q  { flex: 1; font-size: 0.9rem; color: var(--c-muted); }
.summary-ans { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.summary-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

/* ── DASHBOARD ── */
#screen-dashboard { background: var(--c-bg); }
#screen-dashboard .body { padding: 20px; max-width: 680px; margin: 0 auto; width: 100%; }
.pupil-row {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: var(--c-surface); border-radius: 12px;
  border: 1px solid var(--c-border); cursor: pointer; transition: all 0.15s;
}
.pupil-row:hover { border-color: var(--c-accent); transform: translateX(2px); }
.pupil-row .av { font-size: 2rem; }
.pupil-row .info { flex: 1; }
.pupil-row .pn  { font-weight: 700; }
.pupil-row .ps  { font-size: 0.8rem; color: var(--c-muted); }

/* ── PUPIL PROFILE ── */
#screen-profile { background: var(--c-bg); }
#screen-profile .body { padding: 20px; max-width: 720px; margin: 0 auto; width: 100%; }

.pupil-colour-swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform 0.1s, border-color 0.1s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.pupil-colour-swatch:hover { transform: scale(1.15); }
.pupil-colour-swatch.selected { border-color: #1e293b; transform: scale(1.18); box-shadow: 0 0 0 3px rgba(30,41,59,0.2); }

.profile-class-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: 20px; padding: 4px 10px; font-size: 0.8rem; font-weight: 600;
}
.profile-class-chip-remove {
  background: none; border: none; cursor: pointer; padding: 0 2px;
  color: var(--c-muted); font-size: 0.7rem; line-height: 1; transition: color 0.1s;
}
.profile-class-chip-remove:hover { color: #dc2626; }

.session-card {
  background: var(--c-surface); border-radius: 12px;
  border: 1px solid var(--c-border); overflow: hidden; margin-bottom: 10px;
}
.session-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer; background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
.session-header:hover { background: #e8eef8; }
.session-body { padding: 14px 16px; }

/* Session notes */
.session-notes-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
}
.session-notes-label {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--c-text-muted); margin-bottom: 8px;
}
.session-notes-display .session-notes-text {
  font-size: 0.9375rem; line-height: 1.55; color: var(--c-text);
  white-space: pre-wrap; margin-bottom: 6px;
}
.session-notes-meta {
  font-size: 0.78rem; color: var(--c-text-muted); margin-bottom: 10px;
}
.session-notes-textarea {
  width: 100%; resize: vertical; min-height: 72px; font-size: 0.9rem;
  line-height: 1.5; margin-top: 4px;
}
.session-notes-btn-row {
  display: flex; gap: 8px; margin-top: 10px;
}

/* Trend charts */
.trend-section { margin-top: 24px; }
.trend-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 80px; margin-top: 8px;
}
.trend-bar {
  flex: 1; border-radius: 6px 6px 0 0;
  min-height: 4px; transition: height 0.3s ease;
  position: relative;
}
.trend-bar::after {
  content: attr(data-label);
  position: absolute; bottom: -20px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem; color: var(--c-muted); white-space: nowrap;
}
.trend-labels { display: flex; gap: 6px; }
.trend-label-item { flex: 1; text-align: center; font-size: 0.65rem; color: var(--c-muted); }

/* Category badges */
.cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}

/* ── MODAL OVERLAY ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 900;
}
.modal-box {
  background: var(--c-surface); border-radius: 18px; padding: 28px;
  max-width: 400px; width: 90%; box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.modal-sub   { color: var(--c-muted); font-size: 0.875rem; margin-bottom: 24px; }

/* ── NEW PUPIL SCREEN ── */
#screen-new-pupil {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f3e8ff 100%);
  padding: 24px;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

/* ── LANDING & TEACHER CARDS ── */
#screen-landing {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f3e8ff 100%);
  padding: 24px; min-height: 100vh;
}
.landing-inner { display: flex; flex-direction: column; align-items: center; width: 100%; }
.teacher-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px; width: 100%; max-width: 600px; margin-top: 8px;
}
.teacher-card {
  background: var(--c-surface); border-radius: 16px; padding: 20px 14px;
  text-align: center; cursor: pointer; border: 2px solid var(--c-border);
  transition: all 0.15s; box-shadow: var(--shadow);
}
.teacher-card:hover { border-color: var(--c-accent); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.teacher-card-add { border-style: dashed; background: #f8faff; }
.teacher-card-add:hover { border-color: var(--c-accent); }
.tc-name { font-weight: 700; font-size: 0.9375rem; margin-top: 10px; }
.tc-count { font-size: 0.75rem; color: var(--c-muted); margin-top: 2px; }

/* Teacher avatars */
.teacher-avatar-xl {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.625rem; font-weight: 800; color: #fff;
  margin: 0 auto; letter-spacing: -0.5px;
}
.teacher-avatar-lg {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; font-weight: 800; color: #fff; margin: 0 auto;
}
.teacher-avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; color: #fff; flex-shrink: 0;
}

/* ── ADD TEACHER WIZARD ── */
#screen-add-teacher {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f3e8ff 100%);
  min-height: 100vh; padding: 24px;
}
.wizard-wrap { background: var(--c-surface); border-radius: 18px; max-width: 400px; width: 100%; box-shadow: var(--shadow-lg); overflow: hidden; }
.wizard-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--c-border); }
.wizard-body { padding: 28px 24px; }
.step-indicators { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-border); transition: background 0.2s; }
.step-dot.active { background: var(--c-accent); }
.wizard-step { display: none; }
.wizard-step.active { display: block; }

/* ── TEACHER HOME ── */
#screen-teacher-home { background: var(--c-bg); }
#screen-teacher-home .body { padding: 16px; max-width: 720px; margin: 0 auto; width: 100%; }

/* Accordion */
.accordion { margin-bottom: 14px; border: 1.5px solid var(--c-border); border-radius: 12px; overflow: hidden; }
.accordion-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; background: var(--c-surface); cursor: pointer;
  user-select: none; transition: background 0.12s;
}
.accordion-header:hover { background: #eef2ff; }
.accordion-label { font-weight: 700; font-size: 0.95rem; }
.accordion-meta { display: flex; align-items: center; gap: 10px; }
.accordion-count { font-size: 0.8rem; font-weight: 600; color: var(--c-muted); background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 20px; padding: 2px 10px; }
.accordion-chevron { font-size: 0.75rem; color: var(--c-muted); transition: transform 0.28s ease; }
.accordion-body {
  background: var(--c-bg);
  overflow: hidden;
  max-height: 4000px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}
.accordion-body.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Pupil panel controls */
.pupil-panel-controls {
  display: flex; gap: 8px; padding: 10px 12px;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
}
.pupil-search-input { flex: 1; min-width: 0; }
.pupil-sort-select  { flex-shrink: 0; width: auto; }

/* Pupil filter bar */
.pupil-filter-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.pill-filter {
  padding: 5px 12px; border-radius: 20px; border: 1.5px solid var(--c-border);
  background: var(--c-bg); font-size: 0.8rem; font-weight: 600; cursor: pointer;
  color: var(--c-text); transition: all 0.12s; display: flex; align-items: center; gap: 5px;
}
.pill-filter:hover { border-color: var(--c-accent); color: var(--c-accent); }
.pill-filter.active { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.pill-filter.active .pill-filter-count { background: rgba(255,255,255,0.25); color: #fff; }
.pill-filter-count { font-size: 0.72rem; background: var(--c-border); border-radius: 10px; padding: 1px 6px; }

/* Pupil list (wide-thin rows in Pupils accordion) */
.pupil-list { display: flex; flex-direction: column; }
.pupil-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--c-border);
  cursor: pointer; transition: filter 0.1s;
}
.pupil-list-row:last-child { border-bottom: none; }
.pupil-list-row:hover { filter: brightness(0.95); }
.pupil-list-avatar { font-size: 1rem; flex-shrink: 0; }
.pupil-list-name   { font-weight: 600; font-size: 0.9rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pupil-list-tags   { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pupil-list-arrow  { color: var(--c-muted); font-size: 1.1rem; flex-shrink: 0; }

/* Pupil chip with class tag */
.pupil-chip-stack { flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; }
.chip-tag { font-size: 0.7rem; color: var(--c-muted); font-weight: 500; line-height: 1; }
.chip-tag-shared { color: var(--c-accent); }

.class-section { margin-bottom: 0; border-bottom: 1px solid var(--c-border); }
.class-section:last-child { border-bottom: none; }
.class-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
.pupil-chip-grid {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px;
  background: var(--c-surface);
}
.pupil-chip {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  background: var(--c-bg); border: 1.5px solid var(--c-border);
  border-radius: 20px; cursor: pointer; transition: all 0.12s;
  font-size: 0.875rem; font-weight: 600;
}
.pupil-chip:hover { border-color: var(--c-accent); background: #eef2ff; }
.pupil-chip-add { border-style: dashed; }
.pupil-chip-removable { padding-right: 6px; }
.chip-remove-btn {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  color: var(--c-muted); font-size: 0.7rem; border-radius: 4px;
  line-height: 1; transition: all 0.1s; margin-left: 2px;
}
.chip-remove-btn:hover { background: #fee2e2; color: #dc2626; }
.pupil-chip-add-wide { width: 100%; justify-content: center; border-radius: 8px; margin-top: 4px; }
.whole-class-chip {
  width: 100%; justify-content: center; border-radius: 8px;
  background: linear-gradient(135deg, #ede9fe, #dbeafe);
  border: 1.5px solid #a5b4fc;
  color: #3730a3; font-weight: 700;
  margin-bottom: 6px;
}
.whole-class-chip:hover { background: linear-gradient(135deg, #ddd6fe, #bfdbfe); border-color: #6366f1; }

.add-to-class-pupil-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--c-bg); border: 1.5px solid var(--c-border); border-radius: 10px;
  cursor: pointer; width: 100%; text-align: left; transition: all 0.12s;
}
.add-to-class-pupil-row:hover { border-color: var(--c-accent); background: #eef2ff; }
.chip-avatar { font-size: 1rem; }

/* ── MANAGE CLASSES ── */
#screen-manage-classes { background: var(--c-bg); }
.class-row {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--c-surface); border-radius: 12px;
  border: 1px solid var(--c-border); margin-bottom: 8px;
}
.class-colour-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }

/* Colour picker */
.colour-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.colour-swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: border-color 0.15s, transform 0.12s;
}
.colour-swatch:hover   { transform: scale(1.15); }
.colour-swatch.selected { border-color: var(--c-text); transform: scale(1.15); }

/* ── RECOVERY SCREEN ── */
#screen-recovery {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f3e8ff 100%);
  min-height: 100vh; padding: 24px;
}

/* ── TEACHER LOGIN ── */
#screen-teacher-login {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f3e8ff 100%);
  min-height: 100vh; padding: 24px;
}

/* ── NEW PUPIL ── */
#screen-new-pupil { background: var(--c-bg); }

/* ── RESPONSIVE ── */
@media (max-width: 500px) {
  .answer-item { flex: 1 1 90px; max-width: 130px; min-width: 80px; }
  .answer-btn { padding: 14px 10px; }
  .answer-btn .ans-emoji { font-size: 1.7rem; }
  .question-text { font-size: 1.375rem; }
  .pin-grid { max-width: 220px; }
}
