:root {
  --paper: #f4f1ea;
  --paper-deep: #ebe6dc;
  --white: #fffcf8;
  --ink: #1c2430;
  --navy: #0c2340;
  --muted: #5c6672;
  --line: #e4dfd4;
  --green: #1f6b4a;
  --green-press: #184f37;
  --green-soft: #e7f3ec;
  --green-line: #c5dfd1;
  --gold: #c4a15a;
  --gold-deep: #8a6d34;
  --gold-soft: #f8f1de;
  --danger: #9b2c2c;
  --danger-soft: #f8eeee;
  --shadow: 0 1px 2px rgba(28, 36, 48, 0.04);
  --radius: 12px;
  --control: 8px;
  --sq: 56px;
  --light: #f6f1e6;
  --dark: #7e9a86;
  --font: "Segoe UI", "Segoe UI Variable", system-ui, sans-serif;
  --serif: "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--green); }

.app { min-height: 100vh; }

.screen { min-height: 100vh; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.55rem; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.015em; }
h3 { font-size: 0.98rem; font-weight: 650; }

.muted { color: var(--muted); }
.small { font-size: 0.84rem; }
.tiny { font-size: 0.75rem; letter-spacing: 0.01em; }

.logo {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; background: white; flex: none;
}
.side .logo { width: 44px; height: 44px; }
.logo.tiny-logo { width: 36px; height: 36px; }

.word {
  font-weight: 720; letter-spacing: -0.03em; color: var(--navy);
}
.word .math { color: var(--green); }
.tagline {
  color: var(--green); font-weight: 620; letter-spacing: 0.04em;
  font-size: 0.78rem; text-transform: uppercase;
}

.btn {
  border: 1px solid transparent;
  background: var(--white);
  border-radius: var(--control);
  padding: 0.7rem 1rem;
  min-height: 44px;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { border-color: var(--green); background: var(--green-soft); }
.btn:active { background: #d7ebdf; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;
}
.btn.primary { background: var(--green); color: white; }
.btn.primary:hover { background: var(--green-press); }
.btn.quiet { background: transparent; box-shadow: none; color: var(--ink); }
.btn.danger { color: var(--danger); background: var(--white); border-color: #ead6d6; }
.btn.gold { background: var(--gold-soft); color: var(--gold-deep); border-color: #ead9b0; }
.btn.block { width: 100%; }
.btn.large { min-height: 56px; font-size: 1.15rem; font-weight: 650; border-radius: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 0.84rem; font-weight: 620; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], select, textarea {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--control);
  padding: 0.7rem 0.8rem;
  min-height: 44px;
}
textarea { min-height: 88px; resize: vertical; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--green-line); }
.back {
  background: none; border: 0; color: var(--green); font-weight: 680;
  padding: 0 0 10px; min-height: 32px;
}
.back:hover { text-decoration: underline; }
.pad { padding: 1.1rem 1.15rem; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 0.15rem 0.55rem;
  font-size: 0.75rem; font-weight: 650; letter-spacing: 0.02em;
  background: var(--paper-deep); color: var(--muted);
}
.pill.open { background: var(--green-soft); color: var(--green); }
.pill.closed { background: #eef0f2; color: #4e5966; }
.pill.draft { background: #f3efe4; color: #6d6248; }
.pill.ready { background: var(--green-soft); color: var(--green); }
.pill.live-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
}

.notice {
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  color: #184f37;
  border-radius: var(--control);
  padding: 0.75rem 0.85rem;
  font-size: 0.9rem;
}
.warn {
  background: var(--danger-soft);
  border: 1px solid #ead6d6;
  color: var(--danger);
  border-radius: var(--control);
  padding: 0.75rem 0.85rem;
  font-size: 0.9rem;
}

/* Welcome */
.welcome {
  display: grid;
  grid-template-columns: minmax(280px, 460px) minmax(280px, 460px);
  gap: 48px;
  align-items: center;
  justify-content: center;
  padding: 48px 28px 72px;
  min-height: 100vh;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
button.brand-lockup {
  border: 0; background: transparent; padding: 0; text-align: left;
  box-shadow: none; min-height: 0; width: 100%;
}
button.brand-lockup:hover { background: transparent; }
.brand-lockup .word { font-size: 1.7rem; }
.welcome h1 { font-size: 2rem; line-height: 1.15; margin: 8px 0 10px; }
.welcome .lede { font-size: 1.05rem; color: var(--muted); max-width: 38ch; }
.join-hero {
  margin-top: 28px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.join-hero p { color: var(--muted); }
.teacher-row { display: flex; gap: 10px; margin-top: 14px; }
.teacher-row .btn { flex: 1; }
.legal-foot {
  margin-top: 28px; color: var(--muted); font-size: 0.82rem; line-height: 1.55;
}
.legal-foot strong { color: var(--ink); font-weight: 640; }
.welcome-board-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.welcome-caption { text-align: center; color: var(--muted); font-size: 0.88rem; }

/* Auth */
.auth-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px 48px;
}
.auth-card { width: min(420px, 100%); padding: 28px 24px; }
.auth-card h1 { margin: 12px 0 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.linkish { background: none; border: 0; color: var(--green); padding: 0; min-height: 0; font-weight: 620; }

/* Teacher shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
  min-width: 0;
}
.side .word { font-size: 1rem; letter-spacing: -0.03em; }
.side .brand-lockup { gap: 8px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  text-align: left; background: transparent; border: 0; border-radius: 8px;
  padding: 0.65rem 0.7rem; color: var(--ink); min-height: 40px;
  font-weight: 620; transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--green-soft); color: var(--green); }
.nav-link.active { background: var(--green); color: white; }
.nav-link.active:hover { background: var(--green-press); color: white; }
.side .grow { flex: 1; }
.main { padding: 28px 32px 48px; max-width: 980px; min-width: 0; }
[data-screen="live"] .main,
[data-screen="reports"] .main { max-width: 1120px; }
.kicker { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.continue-card, .live-card { padding: 18px 18px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.section-gap { margin-top: 22px; }
.action-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.action-pair button { min-height: 72px; text-align: left; padding: 14px 16px; }
.action-pair strong { display: block; font-size: 1.05rem; }
.action-pair span { color: var(--muted); font-size: 0.86rem; }

.list { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip {
  border: 1px solid var(--line); background: var(--white); border-radius: 999px;
  padding: 0.35rem 0.75rem; min-height: 36px;
}
.chip.on { background: var(--green); color: white; border-color: var(--green); }

.assign-page {
  min-height: 100vh;
  background:
    radial-gradient(900px 220px at 100% 0%, rgba(196, 161, 90, 0.16), transparent 60%),
    linear-gradient(180deg, #f8f5ee 0%, var(--paper) 280px);
}
.assign-top {
  display: flex; align-items: center;
  padding: 14px 28px;
  background: rgba(255, 252, 248, 0.9);
  border-bottom: 1px solid var(--line);
}
.assign-brand {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: 0; padding: 0; box-shadow: none; min-height: 0;
}
.assign-brand img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: white;
  box-shadow: 0 2px 8px rgba(12, 35, 64, 0.08);
}
.assign-brand:hover { background: transparent; }
.assign-brand .word { display: block; font-size: 1.35rem; line-height: 1; }
.assign-brand .tagline { display: block; margin-top: 4px; }
.assign-body { padding: 18px 28px 36px; max-width: 1280px; }
.assign-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; flex-wrap: wrap; margin-bottom: 14px;
}
.assign-title h1 { font-size: 1.7rem; color: var(--navy); }
.assign-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin-top: 8px; color: var(--muted);
}
.assign-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.assign-actions .btn {
  background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(12, 35, 64, 0.04); cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.assign-actions .btn:hover {
  background: #f4f8f5; border-color: #b7cfc2;
  box-shadow: 0 4px 12px rgba(12, 35, 64, 0.08);
}
.btn.assign-close { color: #9b2c2c; border-color: #e7cfcf; background: #fff; }
.assign-actions .btn.assign-close:hover {
  background: #fdf6f6; border-color: #e4bcbc; color: #9b2c2c;
  box-shadow: 0 4px 12px rgba(155, 44, 44, 0.08);
}
.share-panel {
  display: flex; align-items: center; gap: 16px;
  width: fit-content; max-width: 100%;
  margin: 0 0 14px; padding: 12px;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 28px rgba(12, 35, 64, 0.08);
}
.share-panel .qr-box { width: 132px; height: 132px; }
.share-actions { display: flex; flex-direction: column; gap: 8px; }
.assign-more { margin-top: 22px; color: var(--muted); }
.assign-more summary { cursor: pointer; }
.assign-more .warn { margin: 10px 0; max-width: 520px; }
.class-board { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.activity-switch {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; width: 100%; min-width: 0;
}
.activity-switch .chip {
  flex: 0 0 auto; white-space: nowrap; cursor: pointer;
  min-height: 40px; padding: 0.35rem 0.95rem;
  background: var(--white); border: 1px solid #ddd6c8;
  box-shadow: 0 1px 2px rgba(12, 35, 64, 0.04);
  font-weight: 650; color: var(--navy);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.activity-switch .chip:hover {
  background: #f7f4ee; border-color: #cfc6b6;
  box-shadow: 0 4px 12px rgba(12, 35, 64, 0.08);
}
.activity-switch .chip.on {
  background: var(--green); color: white; border-color: var(--green);
  box-shadow: 0 6px 16px rgba(31, 107, 74, 0.22);
}
.activity-switch .chip.on:hover {
  background: #1b5e41; border-color: #1b5e41;
  box-shadow: 0 6px 16px rgba(31, 107, 74, 0.28);
}
.activity-summary {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 16px;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 8px 22px rgba(12, 35, 64, 0.05);
}
.activity-summary h2 { color: var(--navy); font-size: 1.15rem; }
.activity-kicker { color: var(--green); font-weight: 750; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.activity-prompt {
  margin-top: 4px; color: var(--muted); max-width: 62ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.activity-facts { display: flex; gap: 18px; flex: none; }
.activity-facts span { display: block; color: var(--muted); font-size: 0.75rem; }
.activity-facts strong { color: var(--navy); font-size: 1.05rem; }
.status-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.status-col {
  display: flex; flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 240px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(12, 35, 64, 0.05);
}
.status-col h2 {
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.status-col h2 strong { margin-left: auto; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status-dot.correct { background: var(--green); }
.status-dot.trying { background: #2f6fad; }
.status-dot.time { background: #c47b2b; }
.status-dot.none { background: #9aa3ad; }
.status-col.correct h2 { background: #eef7f2; color: #184f37; }
.status-col.trying h2 { background: #eef4fa; color: #1d4e7a; }
.status-col.time h2 { background: #fbf6ee; color: #8a5a1e; }
.status-col.none h2 { background: #f6f4ef; color: #4e5966; }
.status-scroll { flex: 1; display: flex; flex-direction: column; max-height: max(220px, calc(100vh - 460px)); overflow: auto; }
.status-name {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto;
  align-items: center; gap: 8px;
  width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid #f0ebe3;
  padding: 9px 12px; min-height: 42px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.status-name:hover {
  background: #eef6f1;
  box-shadow: inset 3px 0 0 #b7d4c4;
}
.status-name.on {
  background: var(--green-soft);
  box-shadow: inset 3px 0 0 var(--green);
}
.status-name .rank { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.status-name .who {
  min-width: 0; color: var(--ink); font-weight: 620;
}
.status-name .name { min-width: 0; overflow-wrap: anywhere; }
.status-name .overall {
  flex: none; color: var(--navy); font-size: 0.75rem; font-weight: 720;
  font-variant-numeric: tabular-nums; background: #f3efe6; border-radius: 999px; padding: 1px 6px;
}
.status-name .when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.student-drawer {
  position: fixed; top: 86px; right: 16px; bottom: 16px;
  width: min(340px, calc(100vw - 32px));
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: -10px 16px 36px rgba(12, 35, 64, 0.12);
  padding: 18px 18px 22px; overflow: auto; z-index: 30;
}
.student-drawer h2 { color: var(--navy); margin-bottom: 12px; padding-right: 64px; }
.drawer-close {
  position: absolute; top: 14px; right: 14px;
  min-height: 34px; padding: 0.3rem 0.7rem; cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: 8px; color: var(--navy);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.drawer-close:hover { background: #f7f4ee; border-color: #cfc6b6; box-shadow: 0 3px 8px rgba(12, 35, 64, 0.08); }
.drawer-kicker { color: var(--green); font-weight: 750; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.drawer-main { margin-top: 6px; color: var(--ink); }
.drawer-main strong { color: var(--navy); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.drawer-percent { color: var(--navy); font-size: 1.55rem; font-weight: 720; font-variant-numeric: tabular-nums; margin: 2px 0 8px; }
.drawer-line { color: var(--muted); margin-top: 2px; }
.lesson-results { list-style: none; padding: 0; margin: 16px 0 0; }
.lesson-results li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.92rem; }
.lesson-results .st-correct { color: var(--green); font-weight: 700; }
.lesson-results .st-trying { color: #2f6fad; font-weight: 700; }
.lesson-results .st-time { color: #c47b2b; font-weight: 700; }
.lesson-results .st-none { color: var(--muted); font-weight: 650; }
.screen.student-open .assign-body { padding-right: 372px; }
.assign-actions .btn:focus-visible,
.activity-switch .chip:focus-visible,
.status-name:focus-visible,
.drawer-close:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.assign-actions .btn.assign-close:focus-visible { outline-color: #c98a8a; }
@media (max-width: 1100px) {
  .screen.student-open .assign-body { padding-right: 16px; }
}
@media (max-width: 720px) {
  .student-drawer { top: 12px; left: 12px; right: 12px; width: auto; }
}
.status-empty {
  margin: auto; padding: 28px 16px; text-align: center; color: var(--muted);
}
.student-detail { padding: 14px 16px; }
.student-detail h2 { margin-bottom: 6px; }
.detail-list { margin: 10px 0 0; padding-left: 18px; }
.detail-list li { margin: 4px 0; }
@media (max-width: 980px) {
  .assign-body { padding: 16px; }
  .status-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-scroll { max-height: 320px; }
}
@media (max-width: 560px) {
  .assign-top { padding: 12px 16px; }
  .status-columns { grid-template-columns: 1fr; }
  .activity-summary { flex-direction: column; align-items: flex-start; }
}
.member {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.member:last-child { border-bottom: 0; }
.member strong { font-size: 1.05rem; }

/* Assignment created */
.code-digits {
  display: flex; gap: 8px; justify-content: center; margin: 8px 0 4px;
}
.digit, .code-box {
  width: 54px; height: 64px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--white);
  display: grid; place-items: center;
  font-size: 1.8rem; font-weight: 700; letter-spacing: 0;
}
.code-box { text-align: center; padding: 0; }
.qr-box {
  width: 168px; height: 168px; background: white; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px;
}
.qr-grid { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(11, 1fr); gap: 2px; }
.qr-grid b { background: var(--ink); border-radius: 1px; }
.qr-grid b.off { background: transparent; }

/* Studio */
.studio { height: 100vh; display: grid; grid-template-rows: auto 1fr; background: var(--paper); overflow: hidden; }
.studio-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--white); border-bottom: 1px solid var(--line);
  position: relative; z-index: 4;
}
.tip { position: relative; }
.tip:hover::after, .tip:focus-visible::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--navy); color: white; font-size: 0.75rem; font-weight: 650;
  padding: 0.28rem 0.5rem; border-radius: 6px; white-space: nowrap;
  pointer-events: none; z-index: 5;
}
.studio-top .spacer { flex: 1; }
.lesson-name { display: flex; flex-direction: column; gap: 1px; min-width: 180px; }
.lesson-title {
  border: 1px solid transparent; background: transparent; border-radius: 8px;
  font-weight: 720; font-size: 1rem; color: var(--navy);
  padding: 2px 8px; min-height: 32px; min-width: 220px;
}
.lesson-title:hover { border-color: var(--line); background: var(--paper); }
.lesson-title:focus { border-color: var(--green); background: var(--white); outline: none; }
.studio-home {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 12px 0 4px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  color: var(--navy); font-weight: 720;
}
.studio-home:hover { border-color: var(--green); background: var(--green-soft); }
.studio-home .logo { width: 28px; height: 28px; }
.studio-body {
  display: grid;
  grid-template-columns: 250px minmax(320px, 1fr) 320px;
  min-height: 0;
}
.timeline { border-right: 1px solid var(--line); padding: 12px; overflow: auto; background: #faf8f4; }
.moment {
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; margin-bottom: 8px; text-align: left; width: 100%;
}
.moment.on { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.moment .tiny { color: var(--muted); }
.stage-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px; gap: 8px; min-width: 0; min-height: 0; height: 100%;
}
.stage-label { font-weight: 650; }
.panel { border-left: 1px solid var(--line); background: var(--white); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs { display: grid; grid-template-columns: 1fr 1fr 1fr; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; min-height: 44px; font-weight: 650; color: var(--muted);
}
.tabs button.on { color: var(--green); box-shadow: inset 0 -2px 0 var(--green); }
.panel-body { padding: 12px 12px 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#piecePalette { grid-template-columns: repeat(6, 44px); width: max-content; }
.tool, .piece-btn {
  border: 1px solid var(--line); background: var(--white); border-radius: 8px;
  min-height: 40px; padding: 4px;
}
.tool { font-size: 0.78rem; line-height: 1.15; }
.tool.on, .piece-btn.on { border-color: var(--green); background: var(--green-soft); }
.acc { display: flex; flex-direction: column; gap: 6px; }
.acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--white); color: var(--navy); font-weight: 720; text-align: left;
}
.acc-head.open { border-color: var(--green); background: var(--green-soft); }
.acc-chev { color: var(--muted); font-weight: 650; }
.acc-body { display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 6px; }
.piece-btn { width: 44px; height: 44px; padding: 2px; }
.group-label { font-size: 0.72rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.board-frame {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 14px;
  box-shadow: var(--shadow);
}
.board-outer { display: grid; grid-template-columns: auto auto; gap: 4px; align-items: center; }
.ranks, .files { display: grid; color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.ranks { grid-template-rows: repeat(8, var(--sq)); align-items: center; justify-items: center; padding-right: 2px; }
.files { grid-template-columns: repeat(8, var(--sq)); justify-items: center; height: 18px; }
.board {
  width: calc(var(--sq) * 8);
  height: calc(var(--sq) * 8);
  display: grid;
  grid-template-columns: repeat(8, var(--sq));
  grid-template-rows: repeat(8, var(--sq));
  position: relative;
  border-radius: 2px;
  overflow: hidden;
}
.sq { position: relative; }
.sq.light { background: var(--light); }
.sq.dark { background: var(--dark); }
.board.theme-smart { --light: #f6f1e6; --dark: #7e9a86; }
.board.theme-blue { --light: #e7eef3; --dark: #8aa0b2; }
.board.theme-brown { --light: #f6ead3; --dark: #c4a484; }
.board.theme-contrast { --light: #ffffff; --dark: #2c333c; }
.piece.author { pointer-events: auto; cursor: grab; }
.sq.picked { box-shadow: inset 0 0 0 3px var(--navy); }
.sq.anchor { box-shadow: inset 0 0 0 3px var(--green); }
.sq.mark-on { box-shadow: inset 0 0 0 2px var(--green); }
.sq.over { box-shadow: inset 0 0 0 3px var(--green); }
.sq-glow, .sq-wash { position: absolute; inset: 0; pointer-events: none; }
.sq-mark {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: calc(var(--sq) * 0.46); line-height: 1;
  pointer-events: none; text-shadow: 0 1px 0 rgba(255,255,255,0.55);
}
.theme-picks { display: flex; flex-direction: column; gap: 6px; }
.theme-picks button { display: flex; align-items: center; gap: 8px; text-align: left; }
.mini { width: 28px; height: 28px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 4px; overflow: hidden; flex: none; }
.mini i { display: block; }
.theme-picks button.on { border-color: var(--green); background: var(--green-soft); }
.piece {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  pointer-events: none;
}
.overlay {
  position: absolute; inset: 4px;
  display: grid; place-items: center;
  font-weight: 750; pointer-events: auto;
  border: 0; background: transparent; padding: 0;
}
.overlay.num {
  color: var(--green); font-size: calc(var(--sq) * 0.42);
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.overlay.star, .overlay.star.size-sm, .overlay.star.size-md, .overlay.star.size-lg { inset: auto 2px 2px auto; width: 42%; height: 42%; }
.overlay.star svg { width: 100%; height: 100%; display: block; }
.overlay.star.has-cap, .overlay.star.has-cap.size-md { inset: 4px; width: auto; height: auto; }
.overlay.star.has-cap.size-sm { inset: 18%; width: auto; height: auto; }
.overlay.star.has-cap.size-lg { inset: 0; width: auto; height: auto; }
.overlay.has-cap { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 0 1px 1px; }
.overlay.has-cap .obj-body { flex: 1 1 auto; min-height: 0; width: 100%; display: grid; place-items: center; }
.overlay.has-cap .obj-body svg, .overlay.has-cap .obj-body img { width: 78%; height: 78%; }
.overlay .obj-cap {
  flex: none; max-width: 100%;
  font-size: max(8px, calc(var(--sq) * 0.15)); font-weight: 650; line-height: 1.05;
  color: var(--navy); background: rgba(255, 252, 248, 0.92);
  border-radius: 3px; padding: 0 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}
.overlay.math { color: var(--ink); font-size: calc(var(--sq) * 0.4); }
.overlay.selected { outline: 2px solid var(--green); outline-offset: -2px; border-radius: 6px; }
.sq-num {
  position: absolute; left: 3px; top: 2px; font-size: 0.62rem; color: rgba(28,36,48,0.45); font-weight: 700;
}
.arrow-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.arrow-layer .arrow-hit { pointer-events: stroke; cursor: pointer; }
.overlay.ball svg, .overlay.obstacle svg, .overlay.flower svg, .overlay.flag svg,
.overlay.crown svg, .overlay.key svg, .overlay.gem svg, .overlay.door svg {
  width: 70%; height: 70%; display: block;
}

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--white);
}

/* Child */
.child {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 16px 32px;
}
.child-card { width: min(520px, 100%); }
.child h1 { font-size: 1.8rem; text-align: center; }
.child .center { text-align: center; }
.name-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.name-list button {
  min-height: 64px; font-size: 1.25rem; font-weight: 680; text-align: left; padding: 0 18px;
  border-radius: 14px;
}
.activity-top { width: min(640px, 100%); display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.prompt {
  width: min(640px, 100%);
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; font-size: 1.2rem; font-weight: 650; margin-bottom: 12px;
}
.answer-row { width: min(640px, 100%); display: flex; gap: 8px; margin-top: 12px; }
.answer-row input { flex: 1; font-size: 1.3rem; min-height: 56px; }
.timer-pill {
  background: var(--white); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.35rem 0.8rem; font-variant-numeric: tabular-nums; font-weight: 700;
}
.timer-pill.challenge { border-color: #ead9b0; background: var(--gold-soft); }

/* Presentation */
.present {
  height: 100vh; background: #f7f4ee;
  display: grid; grid-template-rows: auto 1fr auto;
}
.present-bar, .present-controls {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 16px; background: var(--white); border-bottom: 1px solid var(--line);
}
.present-controls { border-bottom: 0; border-top: 1px solid var(--line); justify-content: center; }
.present-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.notes {
  width: min(720px, 100%); background: #fffdf8; border: 1px dashed var(--line);
  border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: 0.9rem;
}

/* Reports + certificate */
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.cert-page { padding: 28px 16px 48px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.a4 {
  width: min(760px, 100%);
  aspect-ratio: 210 / 297;
  background: #fffdf8;
  border: 10px solid var(--navy);
  outline: 1px solid var(--gold);
  outline-offset: -16px;
  padding: 42px 48px 28px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  position: relative;
}
.a4 .logo { width: 92px; height: 92px; }
.cert-kicker {
  margin-top: 14px; letter-spacing: 0.22em; font-size: 0.78rem;
  font-weight: 750; color: var(--navy); text-transform: uppercase;
}
.a4 h1 {
  font-family: var(--serif); font-weight: 600; font-size: 2.15rem;
  color: var(--navy); margin-top: 6px;
}
.award { font-family: var(--serif); color: var(--gold-deep); font-size: 1.65rem; margin: 8px 0 4px; font-style: italic; }
.cert-name {
  font-family: var(--serif); font-size: 2.7rem; font-weight: 650;
  color: var(--navy); margin: 6px 0 4px; letter-spacing: -0.02em;
}
.gold-rule { width: 120px; height: 2px; background: var(--gold); border: 0; margin: 10px 0; }
.presented { letter-spacing: 0.16em; font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.sign-row { margin-top: auto; width: 100%; display: flex; justify-content: space-between; gap: 24px; padding: 12px 8px 8px; font-size: 0.85rem; }
.sign-row div { width: 42%; border-top: 1px solid var(--navy); padding-top: 8px; color: var(--navy); }
.card-award {
  width: min(440px, 100%);
  background: #fffdf8;
  border: 6px solid var(--navy);
  outline: 1px solid var(--gold);
  outline-offset: -12px;
  border-radius: 18px;
  padding: 26px 22px;
  text-align: center;
}
.card-award .logo { width: 72px; height: 72px; }
.card-award .award { font-size: 1.4rem; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid white;
  box-shadow: 0 0 0 1px var(--line); padding: 0;
}
.swatch.on { box-shadow: 0 0 0 2px var(--green); }
.fold { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--white); }
.fold summary { font-weight: 720; cursor: pointer; color: var(--navy); }
.fold .stack { margin-top: 10px; }
.zoom-quiet { display: flex; gap: 4px; }
.zoom-quiet button {
  min-height: 32px; padding: 0 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); border-radius: 8px; font-size: 0.8rem;
}
.zoom-quiet button:hover { border-color: var(--line); color: var(--ink); background: white; }
.demo-only { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sq.from { box-shadow: inset 0 0 0 3px var(--navy); }
.sq.good { box-shadow: inset 0 0 0 3px var(--green); }
.feedback { font-weight: 750; font-size: 1.15rem; min-height: 1.4em; }

.bright-screen {
  background:
    radial-gradient(820px 240px at 100% 0%, rgba(196, 161, 90, 0.16), transparent 58%),
    linear-gradient(180deg, #f8f5ee 0%, var(--paper) 280px);
}
.bright-brand { display: flex; align-items: center; gap: 10px; }
.bright-brand .logo { width: 58px; height: 58px; }
.bright-brand .word { display: block; font-size: 1.35rem; line-height: 1; }
.bright-name {
  display: block; margin-top: 4px; color: var(--gold-deep);
  font-size: 0.78rem; font-weight: 720; letter-spacing: 0.08em; text-transform: uppercase;
}
.bright { width: min(980px, 100%); }
.bright-screen[data-screen="activity"] .bright-brand .logo { width: 40px; height: 40px; }
.bright-screen[data-screen="activity"] .bright-brand .word { font-size: 1.08rem; }
.bright-screen[data-screen="activity"] .bright-name { margin-top: 2px; font-size: 0.68rem; letter-spacing: 0.06em; }
.bright-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; width: 100%; }
.bright-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 140px; flex: 1; }
.bright-dock { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; max-width: 100%; }
.bright-timer {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--white);
  box-shadow: 0 0 0 3px #f4f1ea, 0 0 0 5px var(--gold);
}
.bright-timer span {
  color: var(--navy); font-size: 1.2rem; font-weight: 760;
  font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
}
.bright-who { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-top: 0; }
.bright-who strong { color: var(--navy); font-size: 1.05rem; }
.bright-who span { color: var(--green); font-weight: 720; font-size: 0.92rem; }
.bright-step { margin-top: 6px; color: var(--green); font-weight: 720; font-size: 0.92rem; }
.bright-progress { display: flex; gap: 7px; margin-top: 0; }
.bright-progress i { width: 10px; height: 10px; border-radius: 50%; background: #e3ddd2; }
.bright-progress i.done { background: #b7d4c4; }
.bright-progress i.on { background: var(--green); }
.bright-progress.bar { display: block; }
.bright-bar { height: 8px; border-radius: 999px; background: #e3ddd2; overflow: hidden; }
.bright-bar span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.child .bright-question {
  width: min(680px, 100%);
  margin: 12px auto 10px;
  padding: 8px 16px;
  text-align: center;
  color: var(--navy);
  font-size: 1.28rem;
  line-height: 1.3;
  background: rgba(255, 252, 248, 0.92);
  border: 1px solid #e6dfd2;
  border-radius: 14px;
}
.bright-well {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 100%;
  margin: 8px auto 0;
  background: var(--green-soft);
  border: 1px solid #d7c48a;
  border-radius: 18px;
  padding: 8px 10px 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 252, 248, 0.7);
}
.bright.is-good .bright-well { box-shadow: 0 0 0 6px rgba(31, 107, 74, 0.12), inset 0 0 0 1px rgba(255, 252, 248, 0.8); }
.bright-well .board-frame {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.bright-well .board-outer {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 0;
  width: max-content;
  margin: 0 auto;
  align-items: start;
}
.bright-well .ranks,
.bright-well .files {
  color: #31463b;
  font-size: 0.78rem;
  font-weight: 730;
  line-height: 1;
}
.bright-well .ranks { justify-items: end; padding: 0 3px 0 0; }
.bright-well .files { height: auto; padding: 3px 0 0; }
.bright-well .board { box-shadow: 0 0 0 1px rgba(28, 36, 48, 0.18); }
.board.theme-s-green { --light: #f6f1e6; --dark: #7e9a86; }
.board.theme-s-blue { --light: #e8f2f8; --dark: #5d86ad; }
.board.theme-s-gold { --light: #f8f1e4; --dark: #a06d3e; }
.board.theme-s-meadow { --light: #f1f7ec; --dark: #5c946c; }
.bright-tools {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  width: auto;
  margin: 0;
}
.bright-tools > button {
  min-width: 40px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #d5d0c6;
  border-radius: 12px;
  background: #fffcf8;
  color: var(--navy);
  font-weight: 720;
  cursor: pointer;
}
.bright-tools > button svg { display: block; }
.bright-tools > button.on { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.bright-swatches {
  position: static;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex: 1 0 100%;
  width: min(320px, 100%);
  margin-top: 2px;
  padding: 8px;
  background: #fffcf8;
  border: 1px solid #e6dfd2;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(12, 35, 64, 0.08);
}
.bright-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 10px 4px 6px;
  border: 1px solid #d5d0c6;
  border-radius: 10px;
  background: #fffcf8;
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 680;
  cursor: pointer;
}
.bright-swatch.on { border-color: var(--green); background: var(--green-soft); }
@media (hover: hover) {
  .bright-tools > button:hover,
  .bright-swatch:hover { background: #fff; border-color: #b7cfc2; }
  .bright-tools > button.on:hover { background: var(--green-soft); border-color: var(--green); }
}
.bright-controls { width: min(640px, 100%); margin: 14px auto 0; }
.bright-controls.answer-row { width: min(640px, 100%); }
.bright-choices { display: grid; gap: 8px; }
.bright-choice {
  min-height: 52px; text-align: left; padding: 0 16px;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  font-weight: 650; color: var(--navy); cursor: pointer;
}
.bright-choice:hover:not(:disabled) { background: #f4f8f5; border-color: #b7cfc2; }
.bright-choice:disabled, .bright-controls input:disabled, .bright-controls button:disabled { opacity: 0.55; }
.bright-hint { color: var(--muted); text-align: center; margin-top: 4px; }
.bright-feedback {
  width: min(640px, 100%);
  min-height: 0;
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.12rem;
  font-weight: 720;
}
.bright-feedback:empty { display: none; margin: 0; }
.bright-feedback.good { color: var(--green); background: #e7f6ee; border-radius: 14px; padding: 10px 14px; }
.bright-feedback.bad { color: var(--muted); font-weight: 650; }
.bright-feedback.time { color: var(--gold-deep); background: var(--gold-soft); border-radius: 14px; padding: 10px 14px; }
.bright-check {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--green); color: white; font-size: 0.95rem;
}
.bright-explain { width: min(640px, 100%); margin: 8px auto 0; color: var(--ink); }
.bright-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(640px, 100%); margin: 8px auto 0; }
.bright-complete { width: min(560px, 100%); margin: 24px auto; text-align: center; }
.bright-complete .logo { width: 96px; height: 96px; }
.bright-complete h1 { margin-top: 18px; color: var(--navy); font-size: 2rem; }
.complete-name { margin-top: 8px; color: var(--green); font-size: 1.35rem; font-weight: 720; }
.complete-lesson { margin-top: 8px; color: var(--ink); font-size: 1.1rem; }
.complete-title { margin-top: 14px; color: var(--navy); font-weight: 680; }
.complete-score { margin-top: 8px; color: var(--navy); font-size: 1.25rem; font-weight: 760; }
.complete-time { margin-top: 4px; color: var(--gold-deep); }
.complete-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
@media (min-width: 800px) {
  .bright-screen[data-screen="activity"] .child { padding: 10px 28px 12px; }
  .bright-screen[data-screen="activity"] .bright-question { margin: 10px auto 8px; font-size: 1.22rem; }
  .bright-screen[data-screen="activity"] .bright-well { padding: 8px 10px 10px; }
  .bright-screen[data-screen="activity"] .bright-well .board-frame { padding: 0; }
  .bright-screen[data-screen="activity"] .bright-controls { margin-top: 8px; }
  .bright-screen[data-screen="activity"] .answer-row input { min-height: 46px; font-size: 1.12rem; }
  .bright-screen[data-screen="activity"] .bright-feedback:not(:empty) { margin-top: 6px; font-size: 1.05rem; }
  .bright-screen[data-screen="activity"] .bright-actions { margin-top: 4px; }
  .bright-screen[data-screen="activity"] .bright-actions .btn { min-height: 42px; }
}
@media (min-width: 800px) and (max-height: 860px) {
  .bright-screen[data-screen="activity"] .child { padding: 6px 28px 6px; }
  .bright-screen[data-screen="activity"] .bright-timer { width: 56px; height: 56px; }
  .bright-screen[data-screen="activity"] .bright-timer span { font-size: 1.05rem; }
  .bright-screen[data-screen="activity"] .bright-question { margin: 6px auto 6px; padding: 6px 12px; }
  .bright-screen[data-screen="activity"] .bright-well { padding: 6px 8px 8px; }
  .bright-screen[data-screen="activity"] .bright-well .board-frame { padding: 0; }
  .bright-screen[data-screen="activity"] .bright-tools > button { min-width: 36px; min-height: 36px; }
  .bright-screen[data-screen="activity"] .bright-controls { margin-top: 6px; }
  .bright-screen[data-screen="activity"] .answer-row input { min-height: 42px; }
  .bright-screen[data-screen="activity"] .bright-feedback:not(:empty) { margin-top: 4px; }
  .bright-screen[data-screen="activity"] .bright-explain { margin-top: 4px; }
  .bright-screen[data-screen="activity"] .bright-actions { margin-top: 2px; }
}
@media (max-width: 720px) {
  .bright-screen[data-screen="activity"] .child,
  .bright-screen[data-screen="complete"] .child,
  .bright-screen[data-screen="join"] .child,
  .bright-screen[data-screen="join-name"] .child { padding: 16px 14px 28px; }
  .bright-brand .logo { width: 44px; height: 44px; }
  .bright-brand .word { font-size: 1.12rem; }
  .bright-screen[data-screen="activity"] .bright-head { align-items: flex-start; }
  .bright-screen[data-screen="activity"] .bright-dock { width: 100%; justify-content: space-between; }
  .bright-screen[data-screen="activity"] .bright-tools { flex-wrap: wrap; }
  .bright-screen[data-screen="activity"] .bright-timer { width: 58px; height: 58px; }
  .bright-screen[data-screen="activity"] .bright-timer span { font-size: 1.05rem; }
  .bright-screen[data-screen="activity"] .bright-question { font-size: 1.12rem; }
  .bright-screen[data-screen="activity"] .bright-swatches { width: 100%; margin-top: 4px; box-shadow: none; }
  .bright-well { padding: 8px; border-radius: 16px; }
  .bright-tools > button { min-width: 44px; min-height: 44px; }
  .bright-actions .btn { width: auto; flex: 1 1 140px; }
  .complete-actions .btn { width: 100%; }
}
.choices { display: flex; flex-direction: column; gap: 8px; width: min(520px, 100%); }
.choices button { min-height: 56px; font-size: 1.15rem; font-weight: 700; text-align: left; padding: 0 16px; }
.overlay.size-sm { inset: 18%; }
.overlay.size-lg { inset: 0; font-size: calc(var(--sq) * 0.55); }
.overlay .obj-cap, .overlay.num .obj-cap, .overlay.math .obj-cap, .overlay.size-lg .obj-cap {
  font-size: max(8px, calc(var(--sq) * 0.15));
  font-weight: 650;
  line-height: 1.05;
  text-shadow: none;
}
.piece.movable { pointer-events: auto; cursor: grab; }
.add-activity { width: 100%; margin-top: 4px; }

.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: white; border-radius: 999px;
  padding: 0.6rem 1rem; font-size: 0.88rem; z-index: 5;
}

.drawer-toggle { display: none; }

@media (max-width: 980px) {
  .studio { height: auto; overflow: visible; }
  .welcome { grid-template-columns: 1fr; padding-top: 32px; gap: 28px; }
  .welcome-board-wrap { order: 2; }
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 20px 16px 40px; }
  .action-pair { grid-template-columns: 1fr; }
  .studio-body { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .timeline {
    border-right: 0; border-bottom: 1px solid var(--line);
    display: flex; gap: 8px; overflow-x: auto; padding: 10px;
  }
  .moment { min-width: 180px; margin: 0; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .drawer-toggle { display: inline-flex; }
  .studio.sheet-closed .panel-body { display: none; }
  .row-card { grid-template-columns: 1fr; }
  .a4 { aspect-ratio: auto; min-height: 640px; padding: 28px 18px; }
}

@media (max-width: 640px) {
  .digit, .code-box { width: 40px; height: 52px; font-size: 1.35rem; }
  .code-digits { gap: 6px; }
  .teacher-row { flex-direction: column; }
  .answer-row { flex-direction: column; }
  .continue-card, .live-card { flex-direction: column; align-items: flex-start; }
}
