:root {
  color-scheme: light;
  --green-950: #103d2a;
  --green-900: #174f36;
  --green-800: #216344;
  --green-600: #2b9866;
  --cream: #fffaf0;
  --paper: #fffdf7;
  --wood: #9a5a2b;
  --wood-light: #d69a57;
  --ink: #16231e;
  --muted: #52635c;
  --purple: #7044b8;
  --pink: #d94269;
  --shadow: 0 14px 36px rgb(49 33 17 / 15%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 2% 10%, rgb(255 255 255 / 72%) 0 9%, transparent 34%),
    linear-gradient(90deg, #d2a26e 0 12px, #f2dfbe 12px calc(100% - 12px), #bd8150 calc(100% - 12px)),
    #f0dfc2;
}

button, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid #ffce54; outline-offset: 3px; }

.classroom {
  width: min(100%, 1040px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgb(255 250 240 / 95%), rgb(248 235 210 / 93%));
  box-shadow: 0 0 32px rgb(67 42 18 / 16%);
}

.lesson-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 13px 16px 18px;
  overflow: hidden;
  color: white;
  background: linear-gradient(120deg, #113e2a, #1e6846);
  border: 1px solid #3c815b;
  border-radius: 18px 18px 11px 11px;
  box-shadow: 0 5px 0 #a56b38, 0 8px 15px rgb(26 62 40 / 19%);
}

.back-button { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; color: white; font-size: 34px; line-height: 1; text-decoration: none; border-radius: 12px; }
.brand-block { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; color: #174f36; background: #d8f4d5; border: 2px solid #a2daa9; border-radius: 50%; font-weight: 850; font-size: 13px; }
.eyebrow { margin: 0 0 2px; color: #cae8d5; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; overflow: hidden; font-size: clamp(17px, 4vw, 21px); line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.lesson-meta { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; font-size: 12px; font-weight: 650; }
.level-chip { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 7px; color: #183a2b; background: #fff1a7; border-radius: 10px; font-weight: 900; font-size: 15px; }
.progress-track { position: absolute; right: 16px; bottom: 8px; left: 69px; height: 4px; overflow: hidden; background: rgb(255 255 255 / 26%); border-radius: 9px; }
.progress-track span { display: block; width: 16%; height: 100%; background: #7de7a8; border-radius: inherit; }

.activity-nav { display: flex; gap: 6px; margin: 20px 0 17px; padding: 2px 1px 7px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #b4c8b9 transparent; }
.activity { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 6px 11px 6px 7px; flex: 0 0 auto; color: #34483e; background: rgb(255 255 255 / 76%); border: 1px solid #dacdb5; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 700; }
.activity:hover { background: white; }
.activity.is-current { color: white; background: #1c754d; border-color: #1c754d; box-shadow: 0 3px 8px rgb(25 88 57 / 20%); }
.step-dot { display: grid; place-items: center; width: 27px; height: 27px; color: #63429d; background: #eadcff; border-radius: 50%; font-size: 12px; font-weight: 900; }
.is-current .step-dot { color: #1b6946; background: #c9f4d5; }

.smart-board { margin-top: 0; }
.board-frame { position: relative; padding: 9px; background: linear-gradient(130deg, #8d4c21, #df9d54 15%, #8e4c23 30%, #ca8340 53%, #73401f); border: 1px solid #7e4b27; border-radius: 20px; box-shadow: var(--shadow), inset 0 0 0 2px rgb(255 210 132 / 50%); }
.board-surface { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, 22%); gap: clamp(10px, 3vw, 28px); min-height: 330px; padding: clamp(17px, 3vw, 30px); overflow: hidden; color: #fffef1; background:
    radial-gradient(ellipse at 15% 30%, rgb(255 255 255 / 6%), transparent 40%),
    repeating-linear-gradient(0deg, transparent 0 35px, rgb(255 255 255 / 2%) 36px 37px),
    linear-gradient(140deg, #0f5136, #0c402b 54%, #155b3c);
  border: 2px solid #54815d;
  border-radius: 13px;
  box-shadow: inset 0 0 26px rgb(0 0 0 / 18%);
}
.board-copy { min-width: 0; align-self: center; }
.board-label { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 13px; padding: 7px 12px; color: #ffef9b; border: 1px solid #c3cb68; border-radius: 10px; font-size: 12px; font-weight: 850; letter-spacing: .04em; }
.board-led { width: 9px; height: 9px; background: #f7da68; border-radius: 50%; box-shadow: 0 0 9px #ffeb70; }
.board-kicker { margin: 0 0 5px; color: #cee6c5; font-size: 13px; font-weight: 650; }
.lesson-phrase { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 5.3vw, 44px); line-height: 1.22; letter-spacing: -.025em; overflow-wrap: anywhere; }
.lesson-phrase strong { color: #f6df73; font-weight: 700; }
.thai-translation { margin: 10px 0 18px; color: #e0efdf; font-size: clamp(14px, 2.4vw, 18px); line-height: 1.5; }
.board-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.board-notes > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; padding: 9px 10px; border: 1px solid rgb(243 222 115 / 70%); border-radius: 10px; font-size: 12px; line-height: 1.35; }
.note-title { margin-bottom: 2px; color: #ffe583; font-size: 12px; font-weight: 850; }
.board-notes b { padding: 0 3px; color: #f8df6c; }
.note-tip { color: #f4e89c; }
.luna-figure { position: relative; display: flex; min-width: 0; align-self: end; flex-direction: column; align-items: center; justify-content: end; margin: 0; }
.luna-figure img { display: block; width: 100%; max-width: 186px; max-height: 285px; aspect-ratio: 3 / 4; object-fit: contain; object-position: bottom; filter: drop-shadow(0 7px 5px rgb(0 0 0 / 18%)); }
.luna-figure figcaption { position: relative; width: max-content; max-width: 190px; margin: 7px 0; padding: 9px 12px; color: #26362d; background: #fffdf5; border: 1px solid #ead8b9; border-radius: 15px 15px 15px 4px; box-shadow: 0 5px 12px rgb(0 0 0 / 12%); text-align: center; font-size: 12px; font-weight: 850; }
.luna-figure figcaption span { display: block; margin-top: 2px; color: #45554a; font-size: 11px; font-weight: 600; }
.wood-tray { display: flex; align-items: center; gap: 5px; height: 9px; margin: 0 16px; background: linear-gradient(#e9b96e, #8a4b21 45%, #c07b3b); border-radius: 0 0 7px 7px; }
.chalk { width: 28px; height: 3px; margin-left: 10px; background: #f8edc1; border-radius: 3px; }
.chalk-two { width: 17px; background: #dceacf; }
.board-caption { margin: 10px 6px 0; color: #526354; font-size: 12px; font-weight: 650; }
.board-caption span { margin-right: 5px; color: #946425; }

.dialogue-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 17px 0 8px; }
.line-card { display: grid; grid-template-columns: 40px auto; align-items: center; gap: 0 10px; min-height: 78px; padding: 12px 14px; background: var(--paper); border: 1px solid #e7d9c1; border-radius: 17px; box-shadow: 0 4px 12px rgb(69 49 29 / 7%); }
.line-number { display: grid; grid-row: span 2; place-items: center; width: 38px; height: 38px; color: white; background: #138b59; border-radius: 50%; font-size: 19px; font-weight: 900; }
.student-card .line-number { background: var(--purple); }
.line-label { display: flex; align-items: center; gap: 7px; }
.line-speaker { color: #176644; font-size: 13px; font-weight: 850; }
.student-card .line-speaker { color: #6940a4; }
.line-action { color: #52635c; font-size: 11px; font-weight: 700; }
.line-card p { margin: 3px 0 0; overflow-wrap: anywhere; font-size: clamp(14px, 2.7vw, 17px); font-weight: 700; line-height: 1.35; }
.demo-status { min-height: 20px; margin: 9px 3px; color: #425148; text-align: center; font-size: 12px; line-height: 1.4; }

.lesson-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 10px 0 0; padding-bottom: 2px; }
.control-button { display: flex; min-width: 0; min-height: 64px; align-items: center; justify-content: center; flex-direction: column; gap: 3px; padding: 6px; color: #18372a; background: rgb(255 253 247 / 92%); border: 1px solid #d7c5a6; border-radius: 16px; box-shadow: 0 4px 8px rgb(66 47 24 / 10%); cursor: pointer; font-size: 12px; font-weight: 800; }
.control-button:hover { filter: brightness(1.04); }
.control-button:active { transform: translateY(1px); }
.control-icon { display: grid; min-height: 28px; place-items: center; font-size: 24px; line-height: 1; }
.speak-button { color: #fff; background: #d93e66; border-color: #c42d56; }
.next-button { color: #fff; background: #218657; border-color: #1d754b; }

@media (min-width: 700px) {
  .classroom { padding: 24px 32px 30px; }
  .lesson-header { min-height: 88px; }
  .activity-nav { justify-content: center; gap: 10px; margin: 23px 0 20px; }
  .activity { min-width: 128px; justify-content: center; font-size: 13px; }
  .board-surface { min-height: 440px; padding: 30px 38px; }
  .board-copy { max-width: 620px; }
  .lesson-phrase { font-size: clamp(38px, 4vw, 54px); }
  .luna-figure img { max-height: 390px; }
  .luna-figure figcaption { font-size: 14px; }
  .luna-figure figcaption span { font-size: 12px; }
  .dialogue-lines { gap: 16px; margin-top: 20px; }
  .line-card { min-height: 88px; padding: 15px 20px; }
  .lesson-controls { gap: 14px; max-width: 620px; margin: 13px auto 0; }
  .control-button { min-height: 76px; font-size: 14px; }
}

@media (max-width: 430px) {
  .classroom { padding-right: 12px; padding-left: 12px; }
  .lesson-header { gap: 7px; padding-right: 10px; padding-left: 9px; }
  .back-button { width: 40px; flex-basis: 40px; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; font-size: 11px; }
  .eyebrow { font-size: 8px; }
  .lesson-meta { gap: 5px; font-size: 10px; }
  .level-chip { min-width: 31px; height: 32px; font-size: 13px; }
  .progress-track { left: 57px; }
  .activity-nav { margin: 16px 0 12px; }
  .activity { gap: 5px; padding-right: 9px; font-size: 11px; }
  .step-dot { width: 25px; height: 25px; }
  .board-frame { padding: 6px; border-radius: 15px; }
  .board-surface { grid-template-columns: minmax(0, 1fr) minmax(76px, 26%); gap: 5px; min-height: 315px; padding: 13px 10px 13px 13px; }
  .board-label { gap: 6px; margin-bottom: 10px; padding: 6px 8px; font-size: 10px; }
  .board-kicker { font-size: 11px; }
  .lesson-phrase { font-size: clamp(22px, 6vw, 27px); }
  .thai-translation { margin: 8px 0 12px; font-size: 12px; }
  .board-notes { grid-template-columns: 1fr; gap: 5px; }
  .board-notes > div { gap: 2px; padding: 6px 7px; font-size: 10px; }
  .note-title { font-size: 10px; }
  .note-tip { display: none; }
  .luna-figure img { max-height: 180px; }
  .luna-figure figcaption { max-width: 92px; margin: 0 0 5px; padding: 6px 7px; font-size: 10px; }
  .luna-figure figcaption span { font-size: 9px; }
  .wood-tray { height: 7px; }
  .dialogue-lines { grid-template-columns: 1fr; gap: 7px; margin: 13px 0 5px; }
  .line-card { grid-template-columns: 32px minmax(0, 1fr); gap: 0 8px; min-height: 64px; padding: 8px 10px; border-radius: 13px; }
  .line-number { width: 29px; height: 29px; font-size: 14px; }
  .line-speaker { font-size: 12px; }
  .line-action { font-size: 11px; }
  .line-card p { font-size: 14px; }
  .demo-status { font-size: 11px; }
  .lesson-controls { gap: 6px; }
  .control-button { min-height: 58px; padding: 4px; border-radius: 13px; font-size: 11px; }
  .control-icon { min-height: 25px; font-size: 21px; }
}

@media (max-width: 350px) {
  .brand-mark { display: none; }
  .lesson-meta { flex-direction: column; align-items: flex-end; }
  .board-surface { grid-template-columns: minmax(0, 1fr) 68px; padding-left: 9px; }
  .lesson-phrase { font-size: 21px; }
  .line-card { grid-template-columns: 24px minmax(0, 1fr); gap: 0 5px; padding: 8px 6px; }
  .line-number { width: 23px; height: 23px; font-size: 12px; }
  .line-speaker { font-size: 10px; }
  .line-card p { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
