:root {
  --blue: #006ab3;
  --blue-dark: #004f86;
  --orange: #f7b800;
  --magenta: #ad007c;
  --ink: #172033;
  --muted: #617086;
  --page: #eef3f8;
  --card: #fff;
  --line: #dbe4ee;
  --ok: #168544;
  --danger: #c92d3d;
  --radius: 16px;
  --shadow: 0 12px 35px rgba(31, 55, 78, .11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Lato, Arial, sans-serif;
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
button, select, input[type="checkbox"] { touch-action: manipulation; }
button { cursor: pointer; }
h1, h2, h3 { margin-top: 0; font-family: Arial, sans-serif; line-height: 1.15; }
h1 { letter-spacing: -.025em; }
p { margin: .45rem 0 1rem; }
a { color: var(--blue); }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 .4rem;
  color: var(--blue);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow.light { color: #a9d8f7; }
.lead { color: var(--muted); font-size: 1.04rem; }
.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .68rem 1rem;
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:hover { filter: brightness(.97); }
.btn-primary { color: #fff; background: var(--blue); }
.btn-accent { color: #2d2600; background: var(--orange); }
.btn-outline { color: var(--blue); border: 2px solid var(--blue); background: #fff; }
.btn-ghost { color: var(--muted); background: transparent; }
.btn-wide { width: 100%; }
.btn-magenta { color: #fff; background: var(--magenta); }
.btn-success { color: #fff; background: var(--ok); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-light { color: var(--blue-dark); background: #fff; }
.btn-ghost-light { color: #fff; border: 1px solid rgba(255,255,255,.45); background: transparent; }
.btn:disabled { cursor: not-allowed; opacity: .48; }

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 5%, rgba(247,184,0,.2), transparent 25rem),
    radial-gradient(circle at 90% 90%, rgba(173,0,124,.12), transparent 30rem),
    linear-gradient(145deg, #e8f3fa, #f7f9fc);
}
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 2rem 1rem; }
.login-card {
  width: min(100%, 630px);
  padding: clamp(1.4rem, 4vw, 2.6rem);
  border-top: 7px solid var(--orange);
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 70px rgba(36, 61, 86, .18);
}
.login-card.compact { max-width: 480px; }
.login-brand { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.login-brand img { width: 150px; max-height: 62px; object-fit: contain; object-position: left center; }
.subject-badge { padding: .4rem .7rem; border-radius: 999px; color: var(--blue-dark); background: #dff1fc; font-size: .8rem; font-weight: 800; }
.login-form { display: grid; gap: .7rem; margin-top: 1.4rem; }
label { font-weight: 800; }
input, textarea, select {
  width: 100%;
  min-height: 46px;
  padding: .72rem .82rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: 3px solid rgba(0,106,179,.14); }
.privacy-box { margin: .8rem 0 .25rem; padding: 1rem; border-left: 5px solid var(--magenta); border-radius: 10px; background: #fff3fb; }
.privacy-box h2 { margin-bottom: .35rem; font-size: 1rem; }
.privacy-box p { font-size: .9rem; }
details summary { min-height: 44px; padding: .6rem 0; color: var(--magenta); cursor: pointer; font-weight: 800; }
.details-copy { padding-top: .3rem; border-top: 1px solid #eed2e7; }
.check-row { display: flex; align-items: flex-start; gap: .7rem; margin: .35rem 0; font-size: .9rem; }
.check-row input { width: 22px; min-height: 22px; margin-top: 1px; }
.teacher-link { display: block; margin-top: 1.3rem; color: #7c8795; font-size: .8rem; text-align: center; }
.notice { padding: .8rem 1rem; border-radius: 9px; font-weight: 700; }
.notice.danger { color: #8d1724; background: #fde8eb; }

.app-header, .dashboard-header {
  color: #fff;
  background: linear-gradient(125deg, #071d31, #063e68 60%, #006ab3);
}
.header-inner, .dashboard-header {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0;
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 112px; }
.header-inner h1, .dashboard-header h1 { margin-bottom: .2rem; font-size: clamp(1.35rem, 3vw, 2rem); }
.header-inner p { margin: 0; opacity: .88; }
.header-logo { width: 116px; height: 68px; object-fit: contain; object-position: left center; }
.user-chip { display: flex; flex-direction: column; margin-left: auto; padding: .55rem .8rem; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; text-align: right; }
.user-chip small { opacity: .65; }

.workspace, .dashboard { width: min(1120px, calc(100% - 2rem)); margin: 1.2rem auto 6rem; }
.progress-panel {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 2fr;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}
.progress-copy { display: flex; flex-direction: column; }
.progress-copy span { color: var(--muted); font-size: .8rem; }
.progress-track { height: 12px; overflow: hidden; border-radius: 999px; background: #dfe8f0; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--orange)); transition: width .35s ease; }
.tabs { display: flex; gap: .55rem; margin: 1rem 0; padding-bottom: .3rem; overflow-x: auto; scrollbar-width: thin; }
.tab-btn {
  flex: 0 0 auto;
  min-height: 46px;
  padding: .7rem 1rem;
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #fff;
  font-weight: 900;
}
.tab-btn.active { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(0,106,179,.25); }
.tab-panel { display: none; animation: reveal .22s ease; }
.tab-panel.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } }

.section-intro, .task-card, .backup-panel, .dashboard-section {
  padding: clamp(1rem, 3vw, 1.6rem);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}
.section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }
.legend { display: grid; gap: .35rem; color: var(--muted); font-size: .84rem; }
.dot { display: inline-block; width: 12px; height: 12px; margin-right: .35rem; border: 1px solid #aaa; border-radius: 50%; }
.dot.red { background: #d83f58; }.dot.white { background: white; }.dot.pink { background: #f3a1b6; }
.material-grid { display: grid; gap: .75rem; }
.material-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.material-disclosure summary {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  color: var(--blue-dark);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.material-disclosure summary::-webkit-details-marker { display: none; }
.material-disclosure summary:focus-visible { outline: 3px solid rgba(0,106,179,.28); outline-offset: -3px; }
.material-disclosure summary small { display: block; color: var(--muted); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.material-disclosure summary strong { display: block; margin-top: .12rem; font: 700 1.2rem Arial, sans-serif; }
.disclosure-action { display: flex; min-height: 44px; align-items: center; gap: .65rem; padding: .5rem .75rem; border-radius: 999px; color: var(--blue); background: #e7f3fb; font-size: .84rem; font-weight: 900; }
.disclosure-action i { width: 11px; height: 11px; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s ease; }
.hide-label { display: none; }
.material-disclosure[open] { border-color: #9fc8e3; }
.material-disclosure[open] summary { border-bottom: 1px solid var(--line); background: #f6fbfe; }
.material-disclosure[open] .show-label { display: none; }
.material-disclosure[open] .hide-label { display: inline; }
.material-disclosure[open] .disclosure-action i { transform: rotate(225deg) translate(-1px, -1px); }
.material-content { padding: 1rem; animation: reveal .2s ease; }
.material-card img { display: block; width: 100%; margin-bottom: .8rem; border: 1px solid var(--line); border-radius: 8px; }
.material-pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: .8rem; }
.material-pages img { margin-bottom: 0; }
.material-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.ios-note { padding: .8rem 1rem; border-radius: 10px; color: #525e6d; background: #e7eef5; font-size: .86rem; }

.task-card { border-top: 6px solid var(--orange); }
.tab-panel .task-card + .task-card { margin-top: 1rem; }
.task-head { display: grid; grid-template-columns: auto 1fr minmax(150px, 190px); align-items: center; gap: 1rem; margin-bottom: 1.4rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.task-head h2 { margin: 0; }
.task-number { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; color: #302600; background: var(--orange); font-size: 1.4rem; font-weight: 900; }
.level-control { color: var(--muted); font-size: .75rem; }
.level-control select { margin-top: .25rem; font-weight: 800; }
.task-visual {
  margin: 0 0 1.35rem;
  overflow: hidden;
  border: 1px solid #cbdce9;
  border-radius: 14px;
  background: #edf5fa;
}
.task-visual img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
}
.task-visual-large img { max-height: 460px; }
.task-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #cbdce9;
}
.task-visual-grid img {
  height: 100%;
  max-height: none;
  background: #fff;
}
.task-visual-grid-four img { max-height: 330px; }
.task-visual figcaption {
  margin: 0;
  padding: .65rem .85rem;
  border-top: 1px solid #cbdce9;
  color: #486076;
  background: #f7fbfe;
  font-size: .86rem;
  font-weight: 700;
}
.match-list, .ratio-grid { display: grid; gap: .8rem; }
.match-row, .ratio-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: 11px; }
.ratio-grid > div { align-items: flex-start; flex-direction: column; }
.ratio-grid small { display: block; color: var(--muted); }
.choice-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice-pills button, .word-bank button, .gap {
  min-height: 44px;
  padding: .55rem .75rem;
  border: 2px solid #bfd1e0;
  border-radius: 10px;
  color: var(--blue-dark);
  background: #f7fbfe;
  font-weight: 800;
}
.choice-pills button.selected { color: #fff; border-color: var(--blue); background: var(--blue); }
.choice-pills button.correct { color: #fff; border-color: var(--ok); background: var(--ok); }
.choice-pills button.incorrect { color: #fff; border-color: var(--danger); background: var(--danger); }
.word-bank { display: flex; flex-wrap: wrap; gap: .5rem; padding: .8rem; border-radius: 11px; background: #edf6fc; }
.word-bank button.used { opacity: .38; }
.gap-sentence { line-height: 3; font-size: 1.04rem; }
.gap { display: inline-flex; min-width: 86px; margin: 0 .2rem; color: var(--magenta); border-color: #ddb6d3; background: #fff7fc; }
.gap.filled { color: #fff; border-color: var(--magenta); background: var(--magenta); }
.punnett { display: grid; grid-template-columns: repeat(3, minmax(65px, 100px)); width: fit-content; margin: 1rem auto; border: 2px solid var(--blue-dark); }
.punnett > * { display: grid; min-height: 64px; place-items: center; border: 1px solid #9ab0c3; }
.punnett strong { background: #e7f3fb; }
.cycle-cell { border: 1px solid #9ab0c3; background: #fff; font-size: 1.1rem; font-weight: 900; }
.structured-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.structured-grid label { color: var(--blue-dark); }
.structured-grid input { margin-top: .3rem; }
.cross-meta, .cross-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}
.cross-meta label, .cross-results label { color: var(--blue-dark); }
.cross-meta input, .cross-results input { margin-top: .3rem; }
.punnett-input {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 120px));
  width: fit-content;
  margin: 1rem auto;
  overflow: hidden;
  border: 3px solid var(--blue-dark);
  border-radius: 10px;
  background: #fff;
}
.punnett-input > * {
  width: 100%;
  min-height: 68px;
  border: 1px solid #9ab0c3;
  border-radius: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 900;
}
.punnett-input > *:nth-child(2),
.punnett-input > *:nth-child(3),
.punnett-input > *:nth-child(4),
.punnett-input > *:nth-child(7) { background: #e7f3fb; }
.corner-cell { display: grid; place-items: center; color: var(--blue-dark); background: #fff5cf; }
.glossary-table {
  display: grid;
  grid-template-columns: minmax(150px, .65fr) minmax(260px, 2fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.glossary-table > * { margin: 0; padding: .75rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; }
.glossary-table > *:nth-child(even) { border-right: 0; }
.glossary-table > *:nth-last-child(-n+2) { border-bottom: 0; }
.glossary-table strong { display: flex; align-items: center; color: var(--blue-dark); background: #f4f9fc; }
.glossary-table textarea { min-height: 86px; }
.glossary-head { color: #fff; background: var(--blue); font-weight: 900; }
.hint { color: var(--muted); font-size: .84rem; text-align: center; }
.feedback { display: none; margin-top: 1rem; padding: .8rem 1rem; border-radius: 10px; }
.feedback.show { display: block; }
.feedback.ok { color: #0d6834; background: #e1f6e9; }
.feedback.info { color: #0a5586; background: #e4f3fc; }
.feedback.error { color: #8d1724; background: #fde8eb; }
.task-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }

.backup-panel { display: grid; grid-template-columns: 1fr auto; gap: 1rem; margin-top: 1rem; border-left: 6px solid var(--blue); }
.backup-actions { display: flex; flex-wrap: wrap; align-content: center; justify-content: flex-end; gap: .5rem; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.json-fallback { grid-column: 1 / -1; padding-top: 1rem; border-top: 1px solid var(--line); }
.json-fallback textarea { min-height: 180px; font-family: Consolas, monospace; font-size: .78rem; }
.logout-form { position: fixed; right: 1rem; bottom: 1rem; }

.tutor-toggle { position: fixed; right: 1rem; bottom: 4.5rem; display: flex; min-height: 58px; align-items: center; gap: .5rem; padding: .45rem .8rem; border: 0; border-radius: 999px; color: #fff; background: var(--magenta); box-shadow: 0 12px 30px rgba(85,0,60,.25); font-weight: 900; z-index: 20; }
.tutor-toggle img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #fff; }
.tutor-panel { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; display: none; width: min(410px, calc(100% - 2rem)); max-height: min(680px, calc(100vh - 2rem)); padding: 1rem; overflow: auto; border-radius: 18px; background: #fff; box-shadow: 0 20px 70px rgba(18, 30, 45, .3); }
.tutor-panel.open { display: block; }
.tutor-panel header { display: flex; align-items: center; justify-content: space-between; margin: -1rem -1rem 1rem; padding: 1rem; border-radius: 18px 18px 0 0; color: #fff; background: var(--magenta); }
.tutor-panel header div { display: flex; flex-direction: column; }
.tutor-panel header small { opacity: .8; }
.tutor-panel header button { width: 44px; height: 44px; border: 0; color: #fff; background: transparent; font-size: 2rem; }
.chat-log { display: grid; gap: .6rem; min-height: 130px; max-height: 290px; margin-bottom: .8rem; padding: .7rem; overflow-y: auto; border-radius: 10px; background: #f2f5f8; }
.chat-message { max-width: 88%; padding: .7rem .8rem; border-radius: 12px; white-space: pre-wrap; }
.chat-message.assistant { justify-self: start; background: #fff; }
.chat-message.user { justify-self: end; color: #fff; background: var(--blue); }
.chat-status { margin: .5rem 0; color: var(--muted); font-size: .82rem; }
.chat-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

body.reader-open { overflow: hidden; }
.worksheet-reader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: var(--ink);
  background: #dfe8ef;
}
.worksheet-reader.open { display: grid; }
.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem clamp(1rem, 3vw, 2rem);
  color: #fff;
  background: linear-gradient(125deg, #071d31, #063e68 60%, #006ab3);
  box-shadow: 0 4px 18px rgba(7,29,49,.25);
}
.reader-header h2 { margin: 0; font-size: clamp(1.15rem, 2.5vw, 1.7rem); }
.reader-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.reader-mode.active { box-shadow: inset 0 0 0 3px var(--orange); }
.reader-stage {
  min-height: 0;
  padding: clamp(.65rem, 2vw, 1.25rem);
  overflow: auto;
  overscroll-behavior: contain;
}
.reader-view { display: none; width: min(1120px, 100%); min-height: 100%; margin: 0 auto; }
.reader-view.active { display: flex; align-items: flex-start; justify-content: center; }
.reader-image-pages { display: grid; width: 100%; gap: 1rem; justify-items: center; }
.reader-page-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 45px rgba(20,39,56,.2);
}
#reader-pdf-view { height: 100%; }
#reader-pdf-object {
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 45px rgba(20,39,56,.2);
}
.reader-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem clamp(1rem, 3vw, 2rem);
  border-top: 1px solid #bdcbd7;
  color: #486076;
  background: #f8fbfd;
  font-size: .86rem;
}

.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.header-actions form { margin: 0; }
.dashboard { display: grid; gap: 1rem; }
.dashboard-section h2 { margin-bottom: .8rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.count-badge { display: grid; min-width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-weight: 900; }
.count-badge.magenta { background: var(--magenta); }
.student-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.student-card { position: relative; display: flex; min-height: 170px; overflow: hidden; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fafdff; }
.student-card:hover { border-color: var(--blue); }
.student-card-link { display: flex; flex: 1; flex-direction: column; padding: 1rem; color: var(--ink); text-decoration: none; }
.student-card-link > small { color: var(--muted); }
.student-delete-btn { min-height: 44px; padding: .55rem .8rem; border: 0; border-top: 1px solid #f0c5ca; color: #a51f2f; background: #fff3f4; font-weight: 900; }
.student-delete-btn:hover { color: #fff; background: var(--danger); }
.student-delete-btn:disabled { cursor: wait; opacity: .55; }
.online-dot { position: absolute; top: 1rem; right: 1rem; width: 11px; height: 11px; border-radius: 50%; background: #aab4c0; }
.online-dot.online { background: #20b75a; box-shadow: 0 0 0 4px #dff6e8; }
.student-metrics { display: grid; gap: .25rem; margin-top: auto; color: var(--muted); font-size: .82rem; }
.request-list, .snapshot-list { display: grid; gap: .7rem; }
.request-card, .snapshot-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem; border: 1px solid var(--line); border-radius: 11px; }
.request-card small, .snapshot-row small { display: block; color: var(--muted); }
.request-card p { margin-bottom: 0; }
.request-actions, .snapshot-row > div:last-child { display: flex; flex-wrap: wrap; gap: .45rem; }
.empty-state { color: var(--muted); font-style: italic; }
.detail-layout { grid-template-columns: 1.25fr .75fr; }
.timeline { display: grid; gap: .8rem; }
.timeline article { display: grid; grid-template-columns: 18px 1fr; gap: .6rem; }
.timeline-dot { width: 12px; height: 12px; margin-top: .35rem; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px #fff3c9; }
.timeline small { display: block; color: var(--muted); }
.timeline p { white-space: pre-wrap; }
.teacher-chat-log { display: grid; gap: .6rem; }

@media (max-width: 760px) {
  .header-logo { display: none; }
  .header-inner { min-height: 104px; }
  .user-chip { display: none; }
  .progress-panel, .backup-panel { grid-template-columns: 1fr; }
  .task-head { grid-template-columns: auto 1fr; }
  .level-control { grid-column: 1 / -1; }
  .material-grid, .structured-grid, .detail-layout { grid-template-columns: 1fr; }
  .section-intro, .dashboard-header { align-items: flex-start; flex-direction: column; }
  .dashboard-header { width: 100%; padding: 1rem; }
  .header-actions { justify-content: flex-start; }
  .match-row, .request-card, .snapshot-row { align-items: flex-start; flex-direction: column; }
  .backup-actions { justify-content: flex-start; }
  .reader-header { align-items: flex-start; flex-direction: column; }
  .reader-controls { width: 100%; justify-content: flex-start; }
  .reader-controls .btn { flex: 1 1 auto; }
  .reader-footer span { display: none; }
  .reader-footer .btn { width: 100%; }
  .task-visual-grid { grid-template-columns: 1fr; }
  .material-pages { grid-template-columns: 1fr; }
  .glossary-table { grid-template-columns: 1fr; }
  .glossary-table > * { border-right: 0; }
  .glossary-head:nth-child(2) { display: none; }
  .glossary-table strong, .glossary-free input { border-bottom: 0; }
}

@media (min-width: 761px) and (max-width: 900px) {
  .backup-panel { grid-template-columns: 1fr; }
  .backup-actions { justify-content: flex-start; }
}

@media print {
  .tabs, .tutor-toggle, .tutor-panel, .worksheet-reader, .logout-form, .backup-panel, .task-actions { display: none !important; }
  .tab-panel { display: block !important; break-inside: avoid; margin-bottom: 1rem; }
  .app-header { color: #000; background: #fff; }
  .task-card, .section-intro { box-shadow: none; border: 1px solid #bbb; }
}
