:root {
  --bg: #f5f2ea;
  --ink: #172027;
  --muted: #62707a;
  --line: #d8d1c3;
  --paper: #fffdf7;
  --teal: #116b67;
  --coral: #d65f45;
  --gold: #d99a29;
  --violet: #74569d;
  --space: #26345f;
  --shadow: 0 18px 50px rgba(23, 32, 39, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(17, 107, 103, 0.13), transparent 38%),
    linear-gradient(300deg, rgba(214, 95, 69, 0.12), transparent 42%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.shell {
  min-height: 100vh;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(340px, 520px);
  gap: 28px;
  align-items: center;
  min-height: 100vh;
  padding: clamp(18px, 4vw, 48px);
}

.login-art {
  min-height: min(72vh, 640px);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(23, 32, 39, 0.62), rgba(23, 32, 39, 0.08)),
    url("https://images.unsplash.com/photo-1564349683136-77e08dba1ef7?auto=format&fit=crop&w=1400&q=80") center / cover;
  box-shadow: var(--shadow);
}

.login-card,
.sidebar,
.story-panel,
.map-wrap,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: var(--shadow);
}

.login-card {
  padding: clamp(22px, 4vw, 34px);
}

.login-copy {
  color: #3f4a52;
  line-height: 1.55;
}

.login-error {
  min-height: 22px;
  margin: 10px 0 0;
  color: #b33f2c;
  font-weight: 800;
}

.code-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.code-hints span,
.scene-meta span,
.tag,
#roleBadge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef5f2;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
}

.app-view {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 22px;
  border-radius: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
}

.brand {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.brand.compact {
  grid-template-columns: 48px 1fr;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.brand.compact .brand-mark {
  width: 48px;
  height: 48px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--coral);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand h1,
.brand h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.15;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.profile-card {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.profile-card strong {
  font-size: 1.05rem;
}

.setup,
.mission-list {
  display: grid;
  gap: 10px;
}

.setup {
  margin-bottom: 16px;
}

.session-codes {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compact-head {
  margin-bottom: 0;
}

.code-display {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: 8px;
  background: #eef5f2;
}

.code-display strong {
  color: var(--teal);
  font-size: 1.65rem;
  line-height: 1;
  letter-spacing: 0.08em;
}

.code-display small {
  color: var(--muted);
  font-weight: 800;
}

.mission-tab {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-align: left;
}

.mission-tab[aria-current="true"] {
  border-color: rgba(17, 107, 103, 0.45);
  background: white;
  box-shadow: 0 10px 28px rgba(17, 107, 103, 0.12);
}

.mission-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: white;
  font-weight: 900;
}

.mission-tab small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.stage {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
  line-height: 1.05;
}

.teacher-home {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
}

.teacher-home-head {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.teacher-home-head h1 {
  margin-bottom: 0;
}

.teacher-home-head p:last-child {
  max-width: 540px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.teacher-section-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.teacher-section-tab {
  display: grid;
  gap: 7px;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.teacher-section-tab[aria-current="true"] {
  border-color: rgba(17, 107, 103, 0.48);
  background: #eef5f2;
  box-shadow: 0 10px 24px rgba(17, 107, 103, 0.12);
}

.teacher-section-tab > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 950;
}

.teacher-section-tab small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.teacher-menu-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 14px;
}

.teacher-section-detail,
.lesson-launch {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.section-title-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title-line h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.student-pill {
  align-self: start;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f4f1e8;
  color: var(--teal);
  font-weight: 900;
}

.sublesson-list,
.student-roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sublesson-card,
.student-row {
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  text-align: left;
}

.sublesson-card span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #edf7f6;
  color: var(--teal);
  font-weight: 950;
}

.student-row[aria-current="true"],
.sublesson-card:hover {
  border-color: rgba(214, 95, 69, 0.45);
  background: #fff4ee;
}

.sublesson-card small,
.student-row span,
.student-row small,
.lesson-launch small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.lesson-launch {
  display: grid;
  gap: 10px;
  align-content: start;
}

.app-view:not(.lesson-started):not(.student-mode) .topbar,
.app-view:not(.lesson-started):not(.student-mode) .play-layout,
.app-view:not(.lesson-started):not(.student-mode) .lesson-grid {
  display: none;
}

.app-view:not(.lesson-started):not(.student-mode) .teacher-home {
  min-height: calc(100vh - 48px);
  align-content: start;
}

.course-exit {
  display: none;
  position: sticky;
  top: 12px;
  z-index: 20;
  justify-self: start;
  min-height: 42px;
  margin-bottom: 14px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--coral);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(214, 95, 69, 0.2);
}

.app-view.lesson-started:not(.student-mode) .course-exit {
  display: inline-flex;
  align-items: center;
}

.app-view.lesson-started:not(.student-mode) .teacher-home {
  display: none;
}

.app-view.lesson-started:not(.student-mode) .lesson-grid > .panel {
  display: none;
}

.app-view.lesson-started:not(.student-mode)[data-course="alphabet"] .topbar,
.app-view.lesson-started:not(.student-mode)[data-course="alphabet"] .play-layout,
.app-view.lesson-started:not(.student-mode)[data-course="cards"] .topbar,
.app-view.lesson-started:not(.student-mode)[data-course="cards"] .play-layout,
.app-view.lesson-started:not(.student-mode)[data-course="tests"] .topbar,
.app-view.lesson-started:not(.student-mode)[data-course="tests"] .play-layout,
.app-view.lesson-started:not(.student-mode)[data-course="reading"] .topbar,
.app-view.lesson-started:not(.student-mode)[data-course="reading"] .play-layout {
  display: none;
}

.app-view.lesson-started:not(.student-mode)[data-course="alphabet"] .lesson-grid,
.app-view.lesson-started:not(.student-mode)[data-course="cards"] .lesson-grid,
.app-view.lesson-started:not(.student-mode)[data-course="tests"] .lesson-grid,
.app-view.lesson-started:not(.student-mode)[data-course="reading"] .lesson-grid {
  grid-template-columns: 1fr;
}

.app-view.lesson-started:not(.student-mode)[data-course="alphabet"] .alphabet-panel,
.app-view.lesson-started:not(.student-mode)[data-course="cards"] .word-panel,
.app-view.lesson-started:not(.student-mode)[data-course="tests"] .test-panel,
.app-view.lesson-started:not(.student-mode)[data-course="reading"] .reading-panel {
  display: grid;
  min-height: calc(100vh - 110px);
}

.app-view.lesson-started:not(.student-mode)[data-course="quests"] .lesson-grid {
  display: none;
}

.student-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.student-chip {
  display: grid;
  gap: 5px;
  justify-items: center;
  min-height: 108px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
}

.student-chip.active {
  border-color: rgba(214, 95, 69, 0.5);
  background: #fff4ee;
  box-shadow: 0 10px 22px rgba(214, 95, 69, 0.12);
}

.student-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef5f2;
  font-size: 1.25rem;
}

.student-avatar.big {
  width: 62px;
  height: 62px;
  font-size: 2rem;
}

.student-chip small {
  color: var(--muted);
  font-weight: 800;
}

.selected-student-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f6ee;
}

.selected-student-card h2,
.selected-student-card p {
  margin-bottom: 0;
}

.teacher-section-tabs {
  grid-template-columns: 1fr;
}

.course-entry {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  text-align: left;
}

.course-entry.active {
  border-color: rgba(17, 107, 103, 0.5);
  background: #eef5f2;
  box-shadow: 0 10px 24px rgba(17, 107, 103, 0.12);
}

.course-entry-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-size: 1.25rem;
  font-weight: 950;
}

.course-entry small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.course-title-line {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.course-sublessons {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lesson-stop {
  justify-self: center;
  margin-top: 0;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
}

.scoreboard div {
  min-height: 62px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.86);
}

.scoreboard span {
  display: block;
  font-size: 1.35rem;
  font-weight: 900;
}

.scoreboard small {
  color: var(--muted);
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(310px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.map-wrap {
  padding: 14px;
}

.scene-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.adventure-map {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 8px;
  background-color: #dce8dd;
  background-position: center;
  background-size: cover;
  isolation: isolate;
}

.adventure-map::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.hotspot {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: clamp(74px, 9vw, 112px);
  min-height: 54px;
  padding: 9px 12px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background: var(--hotspot-color, rgba(17, 107, 103, 0.88));
  color: white;
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
}

.hotspot.object {
  --hotspot-color: rgba(217, 154, 41, 0.9);
}

.hotspot.risky {
  --hotspot-color: rgba(214, 95, 69, 0.92);
}

.hotspot.active {
  outline: 4px solid rgba(255, 255, 255, 0.72);
}

.story-panel {
  padding: clamp(18px, 3vw, 24px);
}

.story-panel h2 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1.12;
}

.story-panel p {
  color: #3b464d;
  line-height: 1.55;
}

.task-box,
.dialogue-box,
.teacher-note {
  border-radius: 8px;
  background: #fff7df;
}

.task-box {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
  border-left: 5px solid var(--gold);
}

.dialogue-box {
  padding: 14px;
  background: #eef5f2;
}

.dialogue-box h3 {
  margin-bottom: 8px;
}

.dialogue-choices {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.reply-btn {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(17, 107, 103, 0.28);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 850;
  text-align: left;
}

.reply-btn small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.mini-game-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(17, 107, 103, 0.18);
  border-radius: 8px;
  background: #fffdf7;
}

.mini-game-panel h3 {
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.mini-game-panel p {
  margin-bottom: 10px;
}

.mini-selected {
  min-height: 38px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #eef5f2;
  color: #314047;
  font-size: 0.9rem;
}

.mini-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-option,
.mini-check,
.mini-reset {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 900;
}

.mini-option {
  border: 1px solid rgba(17, 107, 103, 0.24);
  background: white;
  color: var(--ink);
}

.mini-option.has-art {
  display: grid;
  grid-template-rows: 74px auto;
  align-items: center;
  justify-items: center;
  gap: 6px;
  min-height: 126px;
  padding: 8px;
}

.mini-option.has-art img {
  max-width: 100%;
  max-height: 74px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(24, 36, 31, 0.16));
}

.mini-option span {
  pointer-events: none;
}

.mini-option.selected {
  background: var(--teal);
  color: white;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mini-check {
  background: var(--teal);
  color: white;
}

.mini-reset {
  border: 1px solid var(--line);
  background: #f4f1e8;
  color: var(--muted);
}

.mini-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: #b24a35;
  font-weight: 800;
}

.mini-message.success {
  color: var(--teal);
}

.zoo-map {
  overflow: hidden;
  background: #b9e3ef;
}

.zoo-map::after {
  display: none;
}

.zoo-scene-bg,
.zoo-scene-vignette {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.zoo-scene-bg {
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.zoo-scene-vignette {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(13, 42, 35, 0.12)),
    radial-gradient(circle at 50% 40%, transparent 45%, rgba(6, 35, 29, 0.16) 100%);
  pointer-events: none;
}

.zoo-prop,
.zoo-prop-button {
  position: absolute;
  z-index: 2;
  height: auto;
  user-select: none;
  transform: translate(-50%, -50%);
}

.zoo-prop {
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 12px 12px rgba(12, 34, 28, 0.22));
}

.zoo-prop-button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.zoo-prop-button img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 12px 12px rgba(12, 34, 28, 0.24));
}

.zoo-prop-button:hover,
.zoo-prop-button:focus-visible,
.zoo-prop-button.active {
  transform: translate(-50%, -50%) scale(1.08);
  outline: none;
}

.zoo-prop-button:hover img,
.zoo-prop-button:focus-visible img,
.zoo-prop-button.active img {
  filter:
    drop-shadow(0 0 0 rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 14px rgba(255, 230, 111, 0.9))
    drop-shadow(0 14px 14px rgba(12, 34, 28, 0.24));
}

.zoo-prop.clue,
.zoo-prop.tool,
.zoo-prop.reward,
.zoo-prop-button.clue,
.zoo-prop-button.tool,
.zoo-prop-button.reward {
  z-index: 3;
}

.zoo-prop.sign,
.zoo-prop-button.sign {
  filter: drop-shadow(0 10px 10px rgba(12, 34, 28, 0.18));
}

.zoo-map .hotspot {
  display: none;
  z-index: 4;
  min-width: 94px;
  min-height: 42px;
  border-color: rgba(255, 255, 255, 0.96);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--hotspot-color, var(--teal)) 78%, white 22%), var(--hotspot-color, var(--teal)));
  color: white;
  box-shadow: 0 9px 20px rgba(12, 34, 28, 0.23), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 2px rgba(23, 32, 39, 0.45);
}

.zoo-map .hotspot::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--hotspot-color, var(--teal)) 45%, transparent);
  opacity: 0.35;
}

.zoo-map .hotspot:hover,
.zoo-map .hotspot.active {
  transform: translate(-50%, -50%) scale(1.07);
}

.ending-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(96px, 170px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: clamp(18px, 5vw, 44px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 252, 235, 0.9)),
    radial-gradient(circle at 20% 30%, rgba(255, 226, 84, 0.35), transparent 42%);
  color: var(--ink);
}

.ending-overlay img {
  width: 100%;
  max-height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(111, 83, 8, 0.22));
}

.ending-overlay h3 {
  margin: 2px 0 8px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.ending-overlay p {
  max-width: 520px;
  color: var(--muted);
  font-weight: 700;
}

.ending-overlay strong {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #116b67;
  color: white;
}

@media (max-width: 640px) {
  .ending-overlay {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    gap: 8px;
    text-align: center;
  }

  .ending-overlay img {
    max-height: 118px;
  }

  .ending-overlay h3 {
    font-size: 1.65rem;
  }

  .ending-overlay p {
    font-size: 0.9rem;
  }
}

.zoo-sky {
  fill: #b9e3ef;
}

.zoo-grass {
  fill: #82c86f;
}

.zoo-path {
  fill: #d8a260;
}

.zoo-tree,
.zoo-bamboo,
.zoo-rule {
  fill: #31a354;
}

.zoo-trunk {
  fill: #8a5a32;
}

.zoo-cage,
.zoo-bars {
  fill: #c58b3a;
}

.zoo-cage-gap {
  fill: #b9e3ef;
}

.zoo-scarf {
  fill: #2f9d55;
}

.zoo-boy,
.zoo-keeper {
  fill: #2f80ed;
}

.zoo-footprints {
  fill: #8a5a32;
}

.zoo-lion {
  fill: #d99a29;
}

.zoo-lion-face {
  fill: #f2c94c;
}

.zoo-stand,
.zoo-table {
  fill: #8a5a32;
}

.zoo-parrot {
  fill: #d94f45;
}

.zoo-question {
  fill: #7a63b8;
}

.zoo-question text,
.zoo-rule text {
  fill: #fffdf7;
  font-size: 52px;
  font-weight: 900;
}

.zoo-pond {
  fill: #62b6cb;
}

.zoo-turtle {
  fill: #639b4f;
}

.zoo-monkey {
  fill: #c8753e;
}

.zoo-monkey path {
  fill: none;
  stroke: #c8753e;
  stroke-linecap: round;
  stroke-width: 24px;
}

.zoo-wall {
  fill: #f3d6a2;
}

.zoo-floor {
  fill: #d8a260;
}

.zoo-fruit {
  fill: #f2c94c;
}

.zoo-note {
  fill: #fffdf7;
}

.zoo-note-text {
  fill: #172027;
  font-size: 30px;
  font-weight: 900;
}

.zoo-reptile {
  fill: #2f9d7e;
}

.zoo-reptile-text {
  fill: #fffdf7;
  font-size: 28px;
  font-weight: 900;
}

.zoo-panda {
  fill: #f7f7f2;
}

.zoo-panda-dark {
  fill: #172027;
}

.zoo-key {
  fill: #d99a29;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.panel {
  min-height: 245px;
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.primary-btn,
.text-btn,
.icon-btn,
.teacher-tools button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-btn {
  width: 100%;
  margin-top: 10px;
  background: var(--teal);
  color: white;
}

.text-btn {
  padding: 0;
  min-height: 0;
  background: transparent;
  color: var(--coral);
}

.icon-btn {
  width: 42px;
  background: var(--coral);
  color: white;
}

.teacher-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.teacher-tools button {
  border: 1px solid rgba(17, 107, 103, 0.24);
  background: #edf7f6;
  color: var(--teal);
}

.teacher-note {
  margin-top: 14px;
  padding: 14px;
  background: #f4f1e8;
  color: #3f494f;
  line-height: 1.45;
}

.word-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.word-card {
  display: grid;
  gap: 8px;
  min-height: 208px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.word-card.active {
  border-color: rgba(17, 107, 103, 0.45);
  box-shadow: 0 10px 24px rgba(17, 107, 103, 0.12);
}

.word-mask {
  min-height: 36px;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.word-picture {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.45;
  border-radius: 8px;
  background: color-mix(in srgb, var(--word-color, var(--teal)) 18%, white);
  color: var(--word-color, var(--teal));
  font-size: 2.4rem;
  overflow: hidden;
}

.word-picture img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.word-card p {
  margin: 0;
  color: #3f4a52;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.letter-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.letter-actions {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 6px;
}

.letter-actions button {
  min-height: 34px;
  border-radius: 8px;
  background: #edf7f6;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
}

.student-hint {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.alphabet-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.alphabet-tile {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 96px;
  padding: 7px 4px;
  border: 1px solid rgba(17, 107, 103, 0.18);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.alpha-picture {
  font-size: 1.55rem;
  line-height: 1;
}

.alphabet-tile strong {
  font-size: 1.35rem;
  line-height: 1;
}

.alphabet-tile span:not(.alpha-picture) {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alphabet-tile:hover {
  border-color: rgba(17, 107, 103, 0.45);
  background: #eef5f2;
}

.test-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.test-steps button {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.test-steps span {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: #eef5f2;
  color: var(--teal);
  font-size: 2.3rem;
  font-weight: 950;
}

.test-steps small {
  color: var(--muted);
  font-weight: 800;
}

.reading-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.reading-layout aside,
.reader-surface {
  display: grid;
  gap: 12px;
  align-content: start;
}

.reading-layout h4 {
  margin: 0;
}

.upload-book {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #edf7f6;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.library-actions select {
  width: auto;
  min-width: 190px;
}

.upload-book input {
  display: none;
}

.book-list {
  display: grid;
  gap: 8px;
}

.book-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.book-card.active {
  border-color: rgba(17, 107, 103, 0.5);
  background: #eef5f2;
}

.book-card span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f4f1e8;
  font-size: 1.35rem;
}

.book-card small,
.empty-library,
.student-corrections p {
  color: var(--muted);
  font-weight: 800;
}

.open-book,
.teacher-corrections,
.student-corrections {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.open-book {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 16px;
}

.book-cover {
  display: grid;
  place-items: center;
  width: 86px;
  height: 112px;
  border-radius: 8px;
  background: #eef5f2;
  font-size: 2.4rem;
}

.open-book h2 {
  margin-bottom: 8px;
}

.open-book p:last-child {
  color: #2f3a41;
  font-size: 1.08rem;
  font-weight: 750;
  line-height: 1.65;
}

.book-page-view {
  position: relative;
  min-height: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  overflow: hidden;
}

.book-page-view > p {
  margin: 0;
  white-space: pre-wrap;
}

.book-embed {
  width: 100%;
  min-height: 520px;
  border: 0;
  border-radius: 8px;
  background: white;
}

.annotation-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.drawing-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f6ee;
}

.media-reader audio,
.media-reader video {
  width: 100%;
}

.media-reader video {
  max-height: 520px;
  border-radius: 8px;
  background: #111;
}

.teacher-corrections ul,
.student-corrections ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.correction-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.teacher-corrections {
  border-color: rgba(214, 95, 69, 0.35);
  background: #fff4ee;
}

.student-corrections {
  background: #f8f6ee;
}

.app-view.lesson-started:not(.student-mode)[data-course="alphabet"] .alphabet-board {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start;
}

.app-view.lesson-started:not(.student-mode)[data-course="cards"] .word-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report ul {
  display: grid;
  gap: 10px;
  max-height: 285px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.report li {
  padding: 10px;
  border-radius: 8px;
  background: #f8f6ee;
  color: #3b464d;
  line-height: 1.38;
}

.student-mode #teacherSetup,
.student-mode #sessionCodes,
.student-mode #teacherHome,
.student-mode #teacherPanel {
  display: none;
}

.student-waiting {
  display: none;
  min-height: calc(100vh - 60px);
  place-items: center;
  padding: 32px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(238, 245, 242, 0.96)),
    radial-gradient(circle at 20% 20%, rgba(217, 154, 41, 0.18), transparent 34%);
}

.student-waiting > div {
  display: grid;
  gap: 12px;
  max-width: 620px;
  text-align: center;
}

.student-waiting h1 {
  margin: 0;
  color: var(--teal);
}

.student-waiting p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.5;
}

.student-mode {
  grid-template-columns: 1fr;
}

.app-view {
  grid-template-columns: 1fr;
}

.app-view .sidebar,
.student-mode .course-exit,
.student-mode .custom-panel,
.student-mode .report,
.student-mode .library-actions,
.student-mode .reading-layout aside,
.student-mode .drawing-tools,
.student-mode .teacher-corrections,
.student-mode .student-corrections:empty {
  display: none;
}

.student-mode[data-course="waiting"] .topbar,
.student-mode[data-course="waiting"] .play-layout,
.student-mode[data-course="waiting"] .lesson-grid {
  display: none;
}

.student-mode[data-course="waiting"] .student-waiting {
  display: grid;
}

.student-mode.lesson-started .student-waiting {
  display: none;
}

.student-mode.lesson-started .lesson-grid > .panel {
  display: none;
}

.student-mode.lesson-started[data-course="alphabet"] .topbar,
.student-mode.lesson-started[data-course="alphabet"] .play-layout,
.student-mode.lesson-started[data-course="cards"] .topbar,
.student-mode.lesson-started[data-course="cards"] .play-layout,
.student-mode.lesson-started[data-course="tests"] .topbar,
.student-mode.lesson-started[data-course="tests"] .play-layout,
.student-mode.lesson-started[data-course="reading"] .topbar,
.student-mode.lesson-started[data-course="reading"] .play-layout {
  display: none;
}

.student-mode.lesson-started[data-course="alphabet"] .lesson-grid,
.student-mode.lesson-started[data-course="cards"] .lesson-grid,
.student-mode.lesson-started[data-course="tests"] .lesson-grid,
.student-mode.lesson-started[data-course="reading"] .lesson-grid {
  grid-template-columns: 1fr;
  min-height: calc(100vh - 42px);
}

.student-mode.lesson-started[data-course="alphabet"] .alphabet-panel,
.student-mode.lesson-started[data-course="cards"] .word-panel,
.student-mode.lesson-started[data-course="tests"] .test-panel,
.student-mode.lesson-started[data-course="reading"] .reading-panel {
  display: grid;
  min-height: calc(100vh - 42px);
}

.student-mode.lesson-started[data-course="quests"] .lesson-grid {
  display: none;
}

.student-mode.lesson-started[data-course="reading"] .reading-layout {
  grid-template-columns: 1fr;
}

.student-mode.lesson-started[data-course="reading"] .reading-panel {
  align-content: start;
}

.student-mode.lesson-started[data-course="reading"] .open-book {
  min-height: calc(100vh - 150px);
}

@media (max-width: 1120px) {
  .app-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .setup,
  .session-codes,
  .mission-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .play-layout,
  .lesson-grid,
  .teacher-menu-layout {
    grid-template-columns: 1fr;
  }

  .teacher-section-tabs {
    grid-template-columns: 1fr;
  }

  .student-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .course-sublessons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reading-layout {
    grid-template-columns: 1fr;
  }

  .adventure-map {
    min-height: 430px;
  }
}

@media (max-width: 760px) {
  .login-view,
  .stage,
  .sidebar {
    padding: 16px;
  }

  .login-view,
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-art {
    min-height: 260px;
  }

  .setup,
  .session-codes,
  .mission-list,
  .scoreboard,
  .teacher-section-tabs,
  .sublesson-list,
  .student-roster,
  .student-mode .lesson-grid {
    grid-template-columns: 1fr;
  }

  .teacher-home-head,
  .section-title-line,
  .selected-student-card {
    display: grid;
  }

  .student-rail,
  .course-sublessons,
  .test-steps {
    grid-template-columns: 1fr;
  }

  .open-book {
    grid-template-columns: 1fr;
  }

  .word-cards,
  .alphabet-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .adventure-map {
    min-height: 360px;
  }

  .hotspot {
    width: 78px;
    min-height: 48px;
    font-size: 0.76rem;
  }
}
