@import url('https://fonts.googleapis.com/css2?family=Playwrite+NZ+Basic+Guides&family=Patrick+Hand&display=swap');

:root {
  --book-ink: #183153;
  --book-accent: #d35d2f;
  --book-accent-deep: #b6471d;
  --book-highlight: #ffd978;
  --book-soft: #fff7e4;
  --book-paper: #fffdf9;
  --book-line: #e8d3a3;
  --book-edge: #f3e2bc;
  --book-shadow: rgba(46, 36, 18, 0.12);
  --book-shadow-strong: rgba(46, 36, 18, 0.22);
}

.englishfun-book.theme-learn {
  background:
    radial-gradient(circle at top left, rgba(155, 213, 255, 0.28), transparent 26%),
    radial-gradient(circle at top right, rgba(255, 245, 207, 0.8), transparent 24%),
    linear-gradient(180deg, #fffdfa 0%, #f3fbff 100%);
}

.englishfun-book.theme-test-starting {
  background:
    radial-gradient(circle at top left, hsla(calc(14 + (var(--lesson-heat, 0) * 0.25)), 92%, 78%, 0.30), transparent 26%),
    radial-gradient(circle at top right, hsla(calc(32 + (var(--lesson-heat, 0) * 0.18)), 95%, 88%, 0.74), transparent 24%),
    linear-gradient(180deg, #fffdfa 0%, hsl(calc(22 + (var(--lesson-heat, 0) * 0.18)), 100%, 94%) 100%);
}

.englishfun-book.theme-test-building {
  background:
    radial-gradient(circle at top left, hsla(calc(28 + (var(--lesson-heat, 0) * 0.2)), 90%, 76%, 0.32), transparent 28%),
    radial-gradient(circle at top right, hsla(calc(40 + (var(--lesson-heat, 0) * 0.14)), 92%, 86%, 0.72), transparent 24%),
    linear-gradient(180deg, #fffdf7 0%, hsl(calc(34 + (var(--lesson-heat, 0) * 0.10)), 100%, 93%) 100%);
}

.englishfun-book.theme-test-strong {
  background:
    radial-gradient(circle at top left, hsla(calc(48 + (var(--lesson-heat, 0) * 0.16)), 78%, 74%, 0.28), transparent 28%),
    radial-gradient(circle at top right, hsla(calc(58 + (var(--lesson-heat, 0) * 0.10)), 82%, 86%, 0.74), transparent 24%),
    linear-gradient(180deg, #fbfffa 0%, hsl(calc(48 + (var(--lesson-heat, 0) * 0.06)), 92%, 93%) 100%);
}

.englishfun-book.theme-test-mastered {
  background:
    radial-gradient(circle at top left, hsla(calc(62 + (var(--lesson-heat, 0) * 0.12)), 82%, 74%, 0.28), transparent 28%),
    radial-gradient(circle at top right, hsla(calc(72 + (var(--lesson-heat, 0) * 0.08)), 88%, 86%, 0.76), transparent 24%),
    linear-gradient(180deg, #fffefb 0%, hsl(calc(58 + (var(--lesson-heat, 0) * 0.05)), 100%, 92%) 100%);
}

.englishfun-book.theme-challenge {
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.72), transparent 18%),
    radial-gradient(circle at 84% 14%, rgba(255, 245, 179, 0.58), transparent 12%),
    radial-gradient(circle at 35% 28%, rgba(197, 235, 255, 0.34), transparent 10%),
    linear-gradient(180deg, #fffaf0 0%, #eef8ff 100%);
  position: relative;
}

.englishfun-book.theme-challenge::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.7) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255,217,120,0.55) 0 1.6px, transparent 2.6px);
  background-size: 160px 160px, 220px 220px;
  background-position: 20px 30px, 110px 80px;
  opacity: 0.35;
  animation: challengeFloat 10s linear infinite;
}

@keyframes challengeFloat {
  from { transform: translateY(0); }
  to { transform: translateY(18px); }
}

.englishfun-book {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  color: var(--book-ink);
  font-family: "Aptos", "Trebuchet MS", "Microsoft JhengHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 227, 154, 0.35), transparent 26%),
    radial-gradient(circle at top right, rgba(255, 245, 207, 0.8), transparent 24%),
    linear-gradient(180deg, #fffdfa 0%, #fff7ea 100%);
}

.lesson-frame {
  border-radius: 32px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 247, 231, 0.96)),
    repeating-linear-gradient(180deg, rgba(232, 211, 163, 0.1), rgba(232, 211, 163, 0.1) 38px, rgba(255,255,255,0) 38px, rgba(255,255,255,0) 76px);
  border: 1px solid rgba(211, 93, 47, 0.14);
  box-shadow: 0 28px 70px var(--book-shadow);
}

.lesson-topbar {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.lesson-progress {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.book-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto;
  gap: 20px;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 242, 203, 0.95) 0%, rgba(255, 253, 247, 0.96) 70%),
    linear-gradient(90deg, rgba(211, 93, 47, 0.08), rgba(211, 93, 47, 0));
  border: 2px solid var(--book-edge);
  border-radius: 28px;
  padding: 30px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 24px 44px var(--book-shadow);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.book-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 217, 120, 0.42), rgba(255, 217, 120, 0) 72%);
}

.book-hero.compact {
  padding: 20px 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--book-accent);
  font-size: 12px;
  margin: 0 0 8px;
  font-weight: 700;
}

.unit-grid,
.goal-list,
.choice-grid {
  display: grid;
  gap: 16px;
}

.unit-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.unit-card,
.goal-item,
.practice-card,
.result-table-wrap,
.feedback-box,
.settings-card,
.lesson-card,
.catalog-shell {
  background: var(--book-paper);
  border: 2px solid var(--book-line);
  border-radius: 24px;
  box-shadow: 0 16px 32px var(--book-shadow);
}

.unit-card,
.goal-item,
.practice-card,
.feedback-box,
.settings-card,
.lesson-card,
.catalog-shell {
  padding: 20px;
}

.goal-item {
  display: block;
  color: var(--book-ink);
  text-decoration: none;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.03;
}

.hero-description {
  max-width: 44rem;
  font-size: 1.2rem;
  line-height: 1.8;
}

.hero-badge {
  position: relative;
  z-index: 1;
  min-width: 190px;
  padding: 20px 22px;
  background: linear-gradient(180deg, #fffdf7 0%, #ffeec4 100%);
  border: 2px dashed rgba(211, 93, 47, 0.28);
  border-radius: 22px;
  text-align: center;
  box-shadow: 0 18px 26px rgba(211, 93, 47, 0.12);
}

.hero-badge small {
  display: none;
}

.hero-badge::after {
  content: none;
}

.hero-badge-pass {
  display: block;
  margin-top: 8px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(24, 49, 83, 0.76);
}

.hero-badge strong {
  display: block;
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.05;
  margin: 6px 0;
}

.hero-badge small,
.badge-label {
  display: block;
}

.badge-label {
  color: var(--book-accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.goal-tabs-wrap {
  position: relative;
  margin: 0 0 20px;
  padding-top: 4px;
}

.goal-group + .goal-group {
  margin-top: 14px;
}

.goal-group-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(24, 49, 83, 0.72);
}

.goal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.goal-tabs.progress-style {
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.goal-tabs.single-line {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}

.goal-tab {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1 1 180px;
  min-height: 112px;
  color: var(--book-ink);
  text-decoration: none;
  background: linear-gradient(180deg, #fffaf0 0%, #f8e7bb 100%);
  border: 1px solid rgba(232, 211, 163, 0.9);
  border-bottom: 4px solid #e9ca7f;
  border-radius: 22px 22px 16px 16px;
  box-shadow: 0 10px 22px rgba(46, 36, 18, 0.08);
  padding: 14px 16px 16px;
  transform: translateY(0) rotate(-0.4deg);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.goal-tab:hover {
  transform: translateY(-3px) rotate(0deg);
  box-shadow: 0 18px 30px rgba(46, 36, 18, 0.12);
}

.goal-tab.is-active {
  background: linear-gradient(180deg, #fff0bf 0%, #ffd978 100%);
  border-color: rgba(211, 93, 47, 0.28);
  border-bottom-color: var(--book-accent);
  transform: translateY(6px) rotate(0deg);
  box-shadow: 0 12px 18px rgba(211, 93, 47, 0.16);
}

.goal-tab span {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.7);
  padding: 5px 9px;
  border-radius: 999px;
  color: rgba(24, 49, 83, 0.78);
  font-weight: 700;
}

.goal-tab strong {
  display: block;
  margin-top: 12px;
  font-size: 1.15rem;
  line-height: 1.42;
}

.goal-tab.progress-chip {
  --goal-fill: 0%;
  --goal-border: #a14ab3;
  --goal-accent: #9d45af;
  --goal-accent-strong: #8b329f;
  --goal-text-dark: #933ca8;
  position: relative;
  overflow: hidden;
  flex: 0 0 112px;
  min-width: 112px;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 1.5px solid var(--goal-border);
  transform: none;
  box-shadow: none;
}

.goal-tab.progress-chip:hover {
  transform: none;
}

.goal-tab.progress-chip.is-active {
  transform: none;
  border-color: var(--goal-accent-strong);
  box-shadow: inset 0 0 0 1px rgba(139, 50, 159, 0.14);
}

.progress-chip-fill {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: var(--goal-fill);
  height: 100%;
  margin: 0;
  padding: 0;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(180deg, var(--goal-accent) 0%, var(--goal-accent-strong) 100%);
  z-index: 0;
  transition: width 0.22s ease;
}

.progress-chip-pass {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 4;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffe6a8 0%, #ffd36d 100%) !important;
  color: #7b3c00 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(24, 49, 83, 0.12);
  color: transparent !important;
}

.progress-chip-pass::before {
  content: "\2713";
  color: #7b3c00;
  font-size: 13px;
  line-height: 1;
}

.goal-tab.progress-chip .progress-chip-label-base,
.goal-tab.progress-chip .progress-chip-label-mask {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 2;
  display: block !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  font-size: 0.98rem !important;
  line-height: 1 !important;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-align: center;
  font-weight: 700;
  box-sizing: border-box;
  transform: translateY(-50%);
}

.goal-tab.progress-chip .progress-chip-label-base {
  color: var(--goal-text-dark) !important;
}

.goal-tab.progress-chip .progress-chip-label-mask {
  z-index: 3;
  color: #ffffff !important;
  pointer-events: none;
  -webkit-clip-path: inset(0 calc(100% - var(--goal-fill)) 0 0);
  clip-path: inset(0 calc(100% - var(--goal-fill)) 0 0);
}

.goal-tab.progress-chip.heat-0 {
  --goal-border: #a14ab3;
  --goal-accent: #9d45af;
  --goal-accent-strong: #8b329f;
  --goal-text-dark: #933ca8;
}

.goal-tab.progress-chip.heat-1,
.goal-tab.progress-chip.heat-2 {
  --goal-border: #8d67c7;
  --goal-accent: #b79ae6;
  --goal-accent-strong: #9a78d3;
  --goal-text-dark: #7c55bc;
}

.goal-tab.progress-chip.heat-3,
.goal-tab.progress-chip.heat-4 {
  --goal-border: #5c8fd6;
  --goal-accent: #7fb4f4;
  --goal-accent-strong: #5f98de;
  --goal-text-dark: #3f73bf;
}

.goal-tab.progress-chip.heat-5,
.goal-tab.progress-chip.heat-6 {
  --goal-border: #4ea889;
  --goal-accent: #6ec8a8;
  --goal-accent-strong: #4fab8c;
  --goal-text-dark: #35886d;
}

.goal-tab.progress-chip.heat-7,
.goal-tab.progress-chip.heat-8 {
  --goal-border: #d49b3d;
  --goal-accent: #f0c76e;
  --goal-accent-strong: #ddaa44;
  --goal-text-dark: #9b6d16;
}

.goal-tab.progress-chip.heat-9,
.goal-tab.progress-chip.heat-10 {
  --goal-border: #d56b55;
  --goal-accent: #ee8e77;
  --goal-accent-strong: #d96a53;
  --goal-text-dark: #aa4a36;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.goal-tab.compact {
  min-height: 58px;
  padding: 10px 14px 12px;
  border-radius: 18px;
  align-items: stretch;
  justify-content: center;
  flex: 1 1 180px;
}

.goal-tab.single-line {
  flex: 0 0 120px;
  min-width: 120px;
}

.goal-tab.compact strong {
  margin-top: 0;
  font-size: 0.98rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.goal-tab.with-progress {
  gap: 8px;
}

.goal-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: rgba(24, 49, 83, 0.76);
}

.goal-progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  border: 1px solid rgba(211, 93, 47, 0.08);
  margin-top: auto;
}

.goal-progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffbf4d 0%, #d35d2f 100%);
}

.mode-switch {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  margin: 0 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(211, 93, 47, 0.12);
  box-shadow: 0 10px 24px rgba(46, 36, 18, 0.08);
}

.mode-switch-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 11px 18px;
  border-radius: 999px;
  color: var(--book-ink);
  text-decoration: none;
  font-weight: 700;
}

.mode-switch-button.is-active {
  background: linear-gradient(180deg, #ffd978 0%, #ffc95b 100%);
  color: #5e3000;
  box-shadow: 0 10px 18px rgba(211, 93, 47, 0.16);
}

.mode-summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 0 0 18px;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid rgba(211, 93, 47, 0.14);
  background: linear-gradient(135deg, rgba(255,255,255,0.78), rgba(255,247,231,0.96));
  box-shadow: 0 14px 28px rgba(46, 36, 18, 0.08);
}

.mode-summary-card h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.mode-summary-card p {
  margin: 0;
  line-height: 1.7;
}

.summary-pill {
  min-width: 130px;
  padding: 14px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffef9 0%, #ffeec4 100%);
  border: 1px solid rgba(211, 93, 47, 0.12);
  text-align: center;
}

.summary-pill span {
  display: block;
  font-size: 12px;
  color: rgba(24, 49, 83, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-pill strong {
  display: block;
  margin-top: 6px;
  font-size: 1.6rem;
}

.focus-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 247, 228, 0.85);
  border: 1px dashed rgba(211, 93, 47, 0.26);
}

.focus-strip-title {
  margin: 0;
  font-weight: 800;
  color: var(--book-accent-deep);
}

.focus-strip-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.focus-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(211, 93, 47, 0.1);
}

.focus-pill em {
  font-style: normal;
  color: var(--book-accent-deep);
  font-weight: 800;
}

.end-card {
  text-align: center;
}

@media (max-width: 760px) {
  .mode-summary-card {
    grid-template-columns: 1fr;
  }

  .lesson-line-rich {
    grid-template-columns: 1fr;
  }

  .lesson-line-action {
    width: 100%;
    text-align: center;
  }

  .mode-switch {
    display: flex;
    width: 100%;
  }

  .mode-switch-button {
    flex: 1 1 0;
    min-width: 0;
  }
}

.goal-item span,
.unit-label,
.mastery-chip {
  display: inline-block;
  font-size: 13px;
  background: linear-gradient(180deg, #fff2c9 0%, #ffe3a5 100%);
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(211, 93, 47, 0.08);
}

.goal-item strong {
  display: block;
  margin-top: 10px;
  font-size: 20px;
}

.book-button {
  display: inline-block;
  padding: 13px 20px;
  background: linear-gradient(180deg, var(--book-accent) 0%, var(--book-accent-deep) 100%);
  color: #fff;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(211, 93, 47, 0.22);
}

.book-button.secondary {
  background: linear-gradient(180deg, #fff8e7 0%, #f5e1ad 100%);
  color: var(--book-ink);
  box-shadow: none;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd978 0%, #ffc95b 100%);
  color: #5e3000;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.stage-badge.soft {
  background: linear-gradient(180deg, #fff8e7 0%, #f6e7bc 100%);
  color: var(--book-ink);
}

.metric-card {
  display: grid;
  gap: 2px;
  min-width: 106px;
  padding: 10px 12px;
  text-align: center;
  background: linear-gradient(180deg, #fff5dc 0%, #ffe7b6 100%);
}

.metric-card small,
.metric-card em {
  display: block;
  font-style: normal;
  line-height: 1.1;
}

.metric-card small {
  font-size: 11px;
  color: rgba(24, 49, 83, 0.72);
}

.metric-card strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--book-ink);
}

.metric-card em {
  font-size: 11px;
  color: rgba(24, 49, 83, 0.72);
}

.settings-card {
  margin-bottom: 24px;
}

.settings-card.standalone {
  margin-bottom: 0;
}

.catalog-shell {
  margin-top: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 232, 0.96));
}

.catalog-head h2,
.lesson-card h2 {
  margin: 0;
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.catalog-filter-block + .catalog-filter-block {
  margin-top: 18px;
}

.catalog-filter-label {
  margin: 0 0 10px;
  color: rgba(24, 49, 83, 0.74);
  font-weight: 700;
}

.catalog-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.catalog-filter-block .catalog-chip-row.compact {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.catalog-filter-block .catalog-chip-row.compact::-webkit-scrollbar {
  height: 6px;
}

.catalog-filter-block .catalog-chip-row.compact::-webkit-scrollbar-thumb {
  background: rgba(211, 93, 47, 0.24);
  border-radius: 999px;
}

.catalog-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--book-ink);
  background: linear-gradient(180deg, #fffaf0 0%, #f6e7bf 100%);
  border: 1px solid rgba(232, 211, 163, 0.95);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.lesson-line-rich {
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) auto minmax(120px, 220px) auto;
  gap: 14px;
  align-items: center;
}

.lesson-line-title {
  display: block;
  min-width: 0;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-line-progress {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lesson-line-progress.compact {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.lesson-line-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8e9 0%, #f8e7bb 100%);
  border: 1px solid rgba(211, 93, 47, 0.08);
  font-size: 13px;
}

.lesson-line-pill b,
.lesson-line-pill em {
  font-style: normal;
  font-weight: 800;
}

.lesson-line-pill.weak {
  background: linear-gradient(180deg, #fff3ee 0%, #ffd8c8 100%);
}

.lesson-line-bar-inline {
  width: 100%;
  min-width: 120px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(24, 49, 83, 0.08);
}

.lesson-line-bar-heat i,
.teacher-cell-bar.lesson-line-bar-heat i {
  background: linear-gradient(
    90deg,
    hsl(calc(188 - (var(--lesson-heat, 0) * 0.9)), 72%, 62%) 0%,
    hsl(calc(54 - (var(--lesson-heat, 0) * 0.18)), 88%, 58%) 56%,
    hsl(calc(18 + (var(--lesson-heat, 0) * 0.08)), 74%, 48%) 100%
  );
}

.lesson-line-bar-inline i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #83d1ff 0%, #4fb975 48%, #d35d2f 100%);
}

.lesson-line-action {
  white-space: nowrap;
}

.teacher-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border-radius: 24px;
  border: 1px solid rgba(211, 93, 47, 0.12);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 32px rgba(46, 36, 18, 0.08);
}

.teacher-progress-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.teacher-progress-table th,
.teacher-progress-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(232, 211, 163, 0.5);
  vertical-align: top;
}

.teacher-progress-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #fff5da 0%, #ffefc7 100%);
  color: var(--book-ink);
  text-align: left;
}

.teacher-progress-table thead th strong,
.teacher-progress-table thead th span {
  display: block;
}

.teacher-progress-table thead th strong {
  margin-top: 4px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.teacher-progress-table thead th span {
  font-size: 11px;
  color: rgba(24, 49, 83, 0.68);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.student-col {
  min-width: 150px;
}

.summary-col {
  min-width: 120px;
}

.unit-col {
  min-width: 140px;
}

.student-card-mini strong,
.student-card-mini span {
  display: block;
}

.student-card-mini strong {
  font-size: 1rem;
  line-height: 1.4;
}

.student-card-mini span {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(24, 49, 83, 0.62);
}

.teacher-summary-stack {
  display: grid;
  gap: 8px;
}

.teacher-summary-stack span {
  display: inline-flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 248, 231, 0.88);
}

.teacher-cell {
  display: grid;
  gap: 6px;
}

.teacher-cell-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.teacher-cell-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(24, 49, 83, 0.08);
}

.teacher-cell-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd978 0%, #4fb975 100%);
}

.teacher-cell-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 230, 220, 0.8);
  color: var(--book-accent-deep);
}

.teacher-cell-flag.is-ok {
  background: rgba(221, 248, 214, 0.95);
  color: #20663c;
}

.student-detail-link {
  color: var(--book-ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(24, 49, 83, 0.2);
}

.student-detail-link:hover {
  color: var(--book-accent-deep);
  border-bottom-color: rgba(211, 93, 47, 0.4);
}

/* Teacher notice (for subject teachers) */
.teacher-notice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 220, 80, 0.18);
  border: 1px solid rgba(200, 160, 0, 0.35);
  border-radius: 8px;
  color: #7a5c00;
  font-size: 0.93rem;
  font-weight: 600;
  margin-top: 4px;
}

/* Teacher filter form (grade/class chips + search) */
.teacher-filter-form {
  display: contents;
}

/* Search row */
.teacher-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.teacher-search-input {
  flex: 1 1 200px;
  min-width: 180px;
  max-width: 320px;
  padding: 8px 14px;
  border: 1.5px solid rgba(24, 49, 83, 0.22);
  border-radius: 40px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--book-ink);
  background: rgba(255, 255, 255, 0.8);
  outline: none;
  transition: border-color 0.2s;
}

.teacher-search-input:focus {
  border-color: var(--book-accent);
  background: #fff;
}

.teacher-search-btn {
  padding: 8px 20px;
  border-radius: 40px;
  border: none;
  background: var(--book-accent);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}

.teacher-search-btn:hover {
  background: var(--book-accent-deep);
  transform: translateY(-1px);
}

.teacher-search-clear {
  font-size: 0.85rem;
  color: rgba(24, 49, 83, 0.55);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(24, 49, 83, 0.18);
  transition: color 0.15s, border-color 0.15s;
}

.teacher-search-clear:hover {
  color: var(--book-accent-deep);
  border-color: rgba(211, 93, 47, 0.4);
}

/* Student class tag in rows */
.student-class-tag {
  display: inline-block;
  font-size: 0.78rem;
  color: rgba(24, 49, 83, 0.55);
  margin-top: 2px;
}

/* ── Teacher class filter bar (dropdown version) ── */
.teacher-class-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 16px 20px;
  margin: 0 0 4px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(24, 49, 83, 0.12);
  border-radius: 14px;
  backdrop-filter: blur(6px);
}

.teacher-class-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.teacher-filter-label-inline {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(24, 49, 83, 0.65);
  white-space: nowrap;
}

.teacher-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 32px 7px 14px;
  border: 1.5px solid rgba(24, 49, 83, 0.2);
  border-radius: 40px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23183153' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--book-ink);
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s;
  min-width: 96px;
}

.teacher-select:focus {
  border-color: var(--book-accent);
}

.teacher-select:hover {
  border-color: rgba(24, 49, 83, 0.38);
}

.teacher-class-filter-search {
  flex: 1 1 160px;
}

.teacher-class-filter-search .teacher-search-input {
  max-width: none;
  width: 100%;
}

.teacher-class-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.empty-state-inline {
  padding: 18px;
  text-align: center;
  color: rgba(24, 49, 83, 0.72);
}

.student-report-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.report-card h2 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  line-height: 1.35;
}

.report-pill-row {
  margin-bottom: 14px;
}

.report-metric-block + .report-metric-block {
  margin-top: 14px;
}

.report-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 700;
}

.report-subcopy {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(24, 49, 83, 0.7);
}

.report-weakness {
  margin: 16px 0 18px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 247, 228, 0.86);
  border: 1px dashed rgba(211, 93, 47, 0.22);
}

.report-weakness span,
.report-weakness strong {
  display: block;
}

.report-weakness span {
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--book-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.catalog-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(46, 36, 18, 0.08);
}

.catalog-chip.is-active {
  background: linear-gradient(180deg, #fff0bf 0%, #ffd978 100%);
  border-color: rgba(211, 93, 47, 0.28);
}

.catalog-chip span {
  font-weight: 800;
}

.catalog-chip small {
  color: rgba(24, 49, 83, 0.68);
}

.catalog-chip.compact {
  min-width: 64px;
  flex: 0 0 64px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 0;
}

.lesson-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    linear-gradient(180deg, rgba(255, 250, 238, 0.95), rgba(255, 244, 221, 0.95));
}

.lesson-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.lesson-kicker {
  margin: 0 0 6px;
  color: rgba(24, 49, 83, 0.68);
  font-size: 0.92rem;
  font-weight: 700;
}

.lesson-card h3 {
  margin: 0;
  font-size: 1.55rem;
  color: var(--book-accent-deep);
}

.lesson-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(232, 211, 163, 0.9);
  font-weight: 700;
}

.lesson-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: rgba(24, 49, 83, 0.75);
}

.stage-grid {
  margin-top: 20px;
}

.stage-card.is-empty {
  opacity: 0.82;
  background:
    linear-gradient(180deg, rgba(252, 249, 242, 0.96), rgba(245, 239, 225, 0.96));
}

.disabled-look {
  opacity: 0.72;
  cursor: default;
  pointer-events: none;
  text-align: center;
}

.settings-form.stacked {
  grid-template-columns: minmax(0, 1fr);
  max-width: 520px;
}

.settings-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.settings-head h2 {
  margin: 0 0 6px;
}

.settings-copy {
  margin: 0;
  color: rgba(24, 49, 83, 0.72);
}

.settings-saved {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef7d8;
  color: #3d6a25;
  font-weight: 700;
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto auto;
  gap: 16px;
  align-items: center;
}

.settings-field {
  display: grid;
  gap: 8px;
}

.settings-field span {
  font-weight: 700;
}

.settings-field input[type="range"] {
  width: 100%;
}

.settings-select {
  border: 2px solid rgba(232, 211, 163, 0.95);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fffefb;
  color: var(--book-ink);
  font-size: 1rem;
}

.settings-rate {
  min-width: 110px;
}

.settings-rate span {
  display: block;
  color: rgba(24, 49, 83, 0.72);
}

.settings-rate strong {
  font-size: 1.5rem;
}

.prompt,
.answer-hint {
  font-size: 24px;
  line-height: 1.5;
}

.prompt {
  margin: 0;
}

.prompt-panel {
  margin: 18px 0 22px;
  padding: 22px 24px;
  background:
    linear-gradient(180deg, rgba(255, 250, 238, 0.95), rgba(255, 243, 217, 0.95));
  border: 2px dashed rgba(232, 211, 163, 0.9);
  border-radius: 22px;
}

.prompt-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.voice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-voice-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #fff8e7 0%, #f5e1ad 100%);
  color: var(--book-ink);
  font-weight: 700;
  cursor: pointer;
}

.mini-voice-button:hover {
  filter: brightness(0.98);
}

.choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 20px 0;
}

.choice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px dashed rgba(232, 211, 163, 0.95);
  border-radius: 18px;
  padding: 18px 16px;
  background: #fffefb;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.choice-option:hover {
  transform: translateY(-2px);
  border-color: rgba(211, 93, 47, 0.4);
  box-shadow: 0 12px 24px rgba(46, 36, 18, 0.08);
}

.choice-option span {
  font-size: 1.15rem;
  font-weight: 700;
}

.practice-form textarea {
  width: 100%;
  border: 2px solid rgba(232, 211, 163, 0.95);
  border-radius: 18px;
  padding: 16px 18px;
  min-height: 120px;
  font-size: 18px;
  background: #fffefb;
  box-sizing: border-box;
}

.practice-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.practice-heading h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.goal-hint {
  margin: 0;
  color: rgba(24, 49, 83, 0.72);
  font-size: 1rem;
}

.practice-stage {
  padding: 28px;
  border-radius: 28px;
  box-shadow: 0 22px 36px rgba(46, 36, 18, 0.1);
}

.practice-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.reading-box {
  margin-top: 18px;
  padding: 20px;
  background: linear-gradient(180deg, #fff8e8 0%, #fff1cd 100%);
  border: 2px dashed var(--book-line);
  border-radius: 18px;
}

.typing-stage-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 250, 238, 0.95), rgba(255, 243, 217, 0.95));
  border: 1px solid rgba(232, 211, 163, 0.9);
}

.typing-stage-intro p {
  margin: 0;
  color: rgba(24, 49, 83, 0.78);
}

.reading-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.speech-button {
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.speech-button:hover {
  transform: translateY(-1px);
}

.speech-button.start {
  background: linear-gradient(180deg, #1f8f6a 0%, #146c50 100%);
  color: #fff;
  box-shadow: 0 10px 18px rgba(20, 108, 80, 0.22);
}

.speech-button.stop {
  background: linear-gradient(180deg, #eef3f8 0%, #dfe7f1 100%);
  color: #17324f;
  border: 1px solid rgba(23, 50, 79, 0.12);
}

.reading-status {
  margin-top: 14px;
  color: rgba(24, 49, 83, 0.72);
  font-weight: 700;
}

.reading-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(232, 211, 163, 0.8);
}

.reading-result.is-correct {
  background: #f2faea;
  border-color: #95c27d;
}

.reading-result.is-wrong {
  background: #fff1ea;
  border-color: #e29575;
}

.phonics-click-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.phonics-word-button {
  border: 0;
  background: transparent;
  color: var(--book-ink);
  font: inherit;
  padding: 0 2px;
  border-bottom: 2px dashed rgba(61, 119, 224, 0.35);
  cursor: pointer;
}

.phonics-word-button:hover {
  color: var(--book-accent-deep);
  border-bottom-color: rgba(211, 93, 47, 0.42);
}

.phonics-tipline {
  margin: 10px 0 0;
  color: rgba(24, 49, 83, 0.72);
}

.phonics-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(24, 49, 83, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.phonics-dialog {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #fffdf8 0%, #fff5da 100%);
  border: 2px solid var(--book-line);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 28px 60px rgba(46, 36, 18, 0.18);
}

.phonics-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.phonics-dialog-head h3 {
  margin: 0;
  font-size: 2rem;
}

.phonics-preview {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px dashed rgba(232, 211, 163, 0.95);
  font-size: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.phonics-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.phonics-preview-piece {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 2px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.phonics-preview-piece.is-active {
  background: #ffe59e;
  transform: translateY(-1px);
}

.phonics-section {
  margin-top: 18px;
}

.phonics-section-title {
  margin: 0 0 10px;
  font-weight: 800;
  color: var(--book-accent-deep);
}

.phonics-syllables {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.phonics-syllable,
.phonics-chunk {
  border: 0;
  cursor: pointer;
}

.phonics-syllable {
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f0f7ff 0%, #dfefff 100%);
  color: #17324f;
  font-weight: 800;
}

.phonics-syllable.is-active {
  background: linear-gradient(180deg, #ffe7ac 0%, #ffd978 100%);
}

.phonics-chunks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.phonics-chunk {
  text-align: left;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(232, 211, 163, 0.95);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.phonics-chunk strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.25rem;
}

.phonics-chunk em {
  display: block;
  margin-bottom: 8px;
  color: var(--book-accent-deep);
  font-style: normal;
  font-weight: 800;
}

.phonics-chunk small {
  display: block;
  margin-bottom: 8px;
  color: rgba(24, 49, 83, 0.6);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.phonics-chunk span {
  display: block;
  color: rgba(24, 49, 83, 0.76);
  line-height: 1.6;
}

.phonics-chunk.is-active {
  background: linear-gradient(180deg, #fff0bf 0%, #ffe4a0 100%);
  box-shadow: 0 10px 18px rgba(211, 93, 47, 0.12);
  transform: translateY(-2px);
}

.phonics-type-vowel,
.phonics-type-vowel_team,
.phonics-type-r_controlled {
  border-left: 5px solid #4f9cc0;
}

.phonics-type-consonant,
.phonics-type-blend {
  border-left: 5px solid #d35d2f;
}

.speak-button {
  align-self: center;
}

.book-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback-box.correct {
  border-color: #7fb069;
  background: linear-gradient(180deg, #f7fff2 0%, #eff9e7 100%);
}

.feedback-box.wrong {
  border-color: #d65a31;
  background: linear-gradient(180deg, #fff8f4 0%, #fff0e9 100%);
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 49, 83, 0.32);
  backdrop-filter: blur(5px);
}

.feedback-modal.is-closing {
  opacity: 0;
  transition: opacity 0.26s ease;
}

.feedback-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 28px 26px 24px;
  border-radius: 28px;
  border: 2px solid rgba(232, 211, 163, 0.9);
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 246, 224, 0.96));
  box-shadow: 0 28px 60px rgba(24, 49, 83, 0.24);
  text-align: center;
  animation: feedback-pop-in 0.24s ease;
}

.feedback-modal.correct .feedback-dialog {
  border-color: rgba(127, 176, 105, 0.5);
  background: linear-gradient(180deg, #f9fff4 0%, #eef9e7 100%);
}

.feedback-modal.correct {
  align-items: flex-start;
  justify-content: center;
  padding-top: 112px;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.feedback-modal.correct .feedback-dialog {
  width: min(360px, calc(100vw - 32px));
  box-shadow: 0 18px 36px rgba(24, 49, 83, 0.14);
}

.feedback-modal.wrong .feedback-dialog {
  border-color: rgba(214, 90, 49, 0.34);
  background: linear-gradient(180deg, #fffaf7 0%, #fff0e8 100%);
}

.feedback-dialog-eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--book-accent);
}

.feedback-dialog h3 {
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.1;
}

.feedback-answer-label {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(24, 49, 83, 0.7);
}

.feedback-answer-text {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.5;
  font-weight: 700;
  color: var(--book-ink);
  word-break: break-word;
}

.feedback-answer-text.is-short {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(24, 49, 83, 0.76);
}

.feedback-dialog-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

@keyframes feedback-pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-table {
  width: 100%;
  border-collapse: collapse;
}

.result-table th,
.result-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--book-line);
  text-align: left;
}

.is-correct {
  background: #f5fbef;
}

.is-wrong {
  background: #fff3ef;
}

.back-link {
  display: inline-block;
  color: var(--book-accent-deep);
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

@media (max-width: 700px) {
  .englishfun-book {
    padding: 12px 12px 28px;
  }

  .lesson-frame {
    padding: 12px;
  }

  .book-hero {
    grid-template-columns: 1fr;
    padding: 24px 20px;
  }

  .prompt,
  .answer-hint {
    font-size: 20px;
  }

  .goal-tab {
    min-height: auto;
    flex-basis: 100%;
  }

  .goal-tabs.single-line {
    flex-wrap: nowrap;
  }

  .goal-tab.single-line {
    flex: 0 0 108px;
    min-width: 108px;
  }

  .practice-stage {
    padding: 20px;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

  .typing-stage-intro {
    align-items: flex-start;
  }
}

.guided-card {
  margin-bottom: 18px;
}

.guided-reference {
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fff9eb 0%, #fff0c9 100%);
  border: 2px solid rgba(232, 211, 163, 0.9);
}

.guided-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(24, 49, 83, 0.68);
}

.guided-reference strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1.4;
}

.practice-form textarea.skyline-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 200px;
  max-height: 200px;
  font-size: 2.35rem;
  line-height: 1.75;
  letter-spacing: 0.01em;
  border: 1px solid rgba(124, 148, 180, 0.42);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 252, 255, 0.98));
  font-family: "Playwrite NZ Basic Guides", "Patrick Hand", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  padding: 14px 18px;
  caret-color: var(--book-accent-deep);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
  resize: none;
  overflow-y: auto;
}

.practice-form textarea.skyline-textarea::placeholder {
  font-family: "Aptos", "Trebuchet MS", "Microsoft JhengHei", sans-serif;
  font-size: 1rem;
  letter-spacing: normal;
}

.skyline-note {
  margin: 10px 4px 0;
  color: rgba(24, 49, 83, 0.7);
  font-size: 0.95rem;
  line-height: 1.6;
}

.keyboard-helper-toggle {
  margin-bottom: 12px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #eff6ff 0%, #dfefff 100%);
  color: #17324f;
  font-weight: 700;
  cursor: pointer;
}

.keyboard-helper-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 49, 83, 0.42);
  backdrop-filter: blur(4px);
}

.keyboard-helper {
  width: min(980px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 22px;
  border-radius: 28px;
  border: 2px solid rgba(232, 211, 163, 0.95);
  background:
    radial-gradient(circle at top right, rgba(255, 217, 120, 0.18), transparent 24%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 246, 224, 0.95));
  box-shadow: 0 26px 60px rgba(46, 36, 18, 0.24);
}

.keyboard-helper-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.keyboard-helper-head h3 {
  margin: 0;
}

.keyboard-helper-close {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e8eef5;
  color: #17324f;
  cursor: pointer;
}

.finger-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(232, 211, 163, 0.8);
}

.finger-dot {
  display: inline-block;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.keyboard-layout {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(245, 250, 255, 0.82));
  border: 1px solid rgba(24, 49, 83, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.keyboard-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.key {
  min-width: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
  border: 1px solid rgba(23, 50, 79, 0.08);
  position: relative;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, outline-color 0.16s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.key.wide {
  min-width: 88px;
}

.key.space {
  min-width: 260px;
}

.finger-lp { background: #ffd6d9; }
.finger-lr { background: #ffe5be; }
.finger-lm { background: #fff1b8; }
.finger-li { background: #daf2c9; }
.finger-ri { background: #caeef2; }
.finger-rm { background: #d8e5ff; }
.finger-rr { background: #ead8ff; }
.finger-rp { background: #f7d6ff; }
.finger-th { background: #e6e6e6; }

.key-function {
  outline: 2px solid rgba(68, 136, 219, 0.38);
  outline-offset: -2px;
}

.key-punctuation {
  outline: 2px solid rgba(211, 93, 47, 0.32);
  outline-offset: -2px;
}

.key.is-linked-active {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(24, 49, 83, 0.16);
  border-color: rgba(24, 49, 83, 0.24);
}

.key-function.is-linked-active {
  outline-color: rgba(68, 136, 219, 0.92);
}

.key-punctuation.is-linked-active {
  outline-color: rgba(211, 93, 47, 0.92);
}

.keyboard-note-guides {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.keyboard-note-group {
  display: grid;
  gap: 8px;
  padding: 16px 18px 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(232, 211, 163, 0.8);
}

.keyboard-note-title {
  margin: 0;
  color: rgba(24, 49, 83, 0.82);
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.keyboard-note-group:first-child .keyboard-note-title::before,
.keyboard-note-group:last-child .keyboard-note-title::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 900;
}

.keyboard-note-group:first-child .keyboard-note-title::before {
  content: ".,";
  color: #8d3c16;
  background: rgba(255, 224, 200, 0.9);
}

.keyboard-note-group:last-child .keyboard-note-title::before {
  content: "Fn";
  color: #22558a;
  background: rgba(221, 236, 255, 0.95);
}

.keyboard-note-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.keyboard-note-chip {
  appearance: none;
  border: 1px solid rgba(232, 211, 163, 0.92);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf8 0%, #fff5de 100%);
  color: var(--book-ink);
  padding: 12px 14px;
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  font-weight: 700;
}

.keyboard-note-chip strong {
  color: var(--book-accent);
  display: inline-block;
  margin-left: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
}

.keyboard-note-chip.punctuation {
  border-color: rgba(211, 93, 47, 0.2);
}

.keyboard-note-chip.function {
  border-color: rgba(68, 136, 219, 0.24);
}

.keyboard-note-chip:hover,
.keyboard-note-chip:focus-visible,
.keyboard-note-chip.is-linked-active {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(46, 36, 18, 0.12);
}

.keyboard-note-chip.punctuation.is-linked-active {
  background: linear-gradient(180deg, #fff4ea 0%, #ffe6ce 100%);
  border-color: rgba(211, 93, 47, 0.56);
}

.keyboard-note-chip.function.is-linked-active {
  background: linear-gradient(180deg, #eef6ff 0%, #ddecff 100%);
  border-color: rgba(68, 136, 219, 0.58);
}

@media (max-width: 720px) {
  .goal-tabs.progress-style {
    gap: 10px;
  }

  .goal-tab.progress-chip {
    flex-basis: 108px;
    min-width: 108px;
    min-height: 48px;
    padding: 0 12px;
  }

  .progress-chip-label {
    font-size: 0.92rem;
  }

  .keyboard-helper-modal {
    padding: 12px;
  }

  .keyboard-helper {
    padding: 16px;
  }

  .keyboard-layout {
    padding: 12px;
  }

  .key.space {
    min-width: 180px;
  }

  .keyboard-note-group {
    padding: 14px;
  }
}

.keyboard-notes {
  margin-top: 16px;
  color: rgba(24, 49, 83, 0.76);
}

.keyboard-notes p {
  display: none;
}

.recognition-builder {
  display: grid;
  gap: 16px;
}

.recognition-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.recognition-slots,
.recognition-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.recognition-slot,
.recognition-tile {
  border: 2px dashed #e9c978;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffaf0 0%, #fff2cc 100%);
  color: var(--book-ink);
  padding: 12px 16px;
  min-width: 72px;
  min-height: 56px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.recognition-slot:hover,
.recognition-tile:hover,
.recognition-slot.is-speaking {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(211, 93, 47, 0.12);
  border-color: #d65d2f;
}

.recognition-slot.is-filled {
  border-style: solid;
}

.recognition-hint {
  margin: 0;
  color: rgba(24, 49, 83, 0.76);
}

.recognition-hint.is-correct {
  color: #2c8a53;
  font-weight: 700;
}

.recognition-hint.is-wrong {
  color: #c95e2a;
  font-weight: 700;
}

.recognition-word-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.recognition-word-card {
  border: 1px solid rgba(214, 179, 92, 0.45);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 248, 230, 0.86);
}

.recognition-word-card strong,
.recognition-word-card span {
  display: block;
}

.recognition-word-card strong {
  margin-bottom: 6px;
}

@media (max-width: 700px) {
  .book-hero {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    width: 100%;
  }

  .catalog-chip {
    min-width: 0;
    width: 100%;
  }

  .lesson-card-top {
    flex-direction: column;
  }

  .key.space {
    min-width: 180px;
  }

  .practice-form textarea.skyline-textarea {
    min-height: 180px;
    max-height: 180px;
    padding: 12px 14px;
    font-size: 1.8rem;
  }
}

/* Responsive and first-screen optimization */
.practice-card.practice-stage {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.prompt-panel {
  margin: 8px 0 10px;
  padding: 18px 20px;
}

.choice-grid {
  margin: 8px 0 10px;
}

.choice-option {
  padding: 16px 14px;
}

.practice-actions {
  align-items: center;
  margin-top: 12px;
}

.reading-box {
  margin-top: 8px;
  padding: 16px 18px;
}

.typing-stage-intro {
  margin-bottom: 10px;
  padding: 14px 16px;
}

.guided-card {
  margin-bottom: 10px;
}

.guided-reference {
  padding: 14px 16px;
}

.guided-reference strong {
  font-size: 1.35rem;
}

.practice-form textarea.skyline-textarea {
  min-height: 154px;
  max-height: 154px;
  font-size: 2rem;
  line-height: 1.55;
  padding: 12px 16px;
}

.skyline-note {
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.recognition-builder {
  gap: 12px;
}

.recognition-bank {
  max-height: 168px;
  overflow-y: auto;
  padding-right: 4px;
}

.recognition-slot,
.recognition-tile {
  min-height: 50px;
  padding: 10px 14px;
}

@media (max-width: 860px) {
  .englishfun-book {
    padding: 10px 10px 18px;
  }

  .lesson-frame {
    padding: 10px;
    border-radius: 22px;
  }

  .lesson-topbar {
    gap: 10px;
    margin-bottom: 10px;
  }

  .lesson-progress {
    gap: 8px;
  }

  .mastery-chip {
    padding: 6px 10px;
    font-size: 12px;
  }

  .book-hero {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
    margin-bottom: 12px;
  }

  .hero-copy h1 {
    font-size: clamp(1.8rem, 7vw, 2.6rem);
    margin-bottom: 6px;
  }

  .hero-description {
    font-size: 1rem;
    line-height: 1.55;
  }

  .hero-badge {
    min-width: 0;
    width: 100%;
    padding: 12px 14px;
  }

  .hero-badge strong {
    font-size: 1.3rem;
  }

  .goal-tabs-wrap {
    margin-bottom: 12px;
  }

  .goal-group + .goal-group {
    margin-top: 10px;
  }

  .goal-group-title {
    margin-bottom: 6px;
    font-size: 0.88rem;
  }

  .goal-tab.single-line {
    flex: 0 0 94px;
    min-width: 94px;
  }

  .goal-tab.compact {
    min-height: 50px;
    padding: 0 12px;
  }

  .goal-tab.compact strong {
    font-size: 0.9rem;
  }

  .practice-card.practice-stage {
    padding: 14px;
    gap: 12px;
    border-radius: 22px;
  }

  .practice-heading h2 {
    font-size: clamp(1.45rem, 5vw, 2rem);
    margin-bottom: 4px;
  }

  .goal-hint {
    font-size: 0.92rem;
  }

  .prompt,
  .answer-hint {
    font-size: 1.42rem;
    line-height: 1.35;
  }

  .prompt-panel {
    margin: 4px 0 8px;
    padding: 14px;
    border-radius: 18px;
  }

  .prompt-row {
    gap: 10px;
    align-items: flex-start;
  }

  .voice-actions,
  .reading-controls,
  .recognition-actions,
  .practice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }

  .voice-actions > *,
  .reading-controls > *,
  .recognition-actions > *,
  .practice-actions > * {
    width: 100%;
    text-align: center;
  }

  .choice-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .choice-option span {
    font-size: 1rem;
  }

  .reading-box {
    padding: 14px;
  }

  .typing-stage-intro {
    align-items: flex-start;
    gap: 10px;
  }

  .guided-reference strong {
    font-size: 1.12rem;
  }

  .practice-form textarea.skyline-textarea {
    min-height: 132px;
    max-height: 132px;
    padding: 10px 12px;
    font-size: 1.45rem;
    line-height: 1.45;
  }

  .skyline-note {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .recognition-bank {
    max-height: 136px;
  }

  .recognition-slot,
  .recognition-tile {
    min-height: 46px;
    min-width: 56px;
    padding: 8px 12px;
    border-radius: 14px;
  }

  .phonics-dialog {
    padding: 16px;
    border-radius: 20px;
  }

  .phonics-dialog-head h3 {
    font-size: 1.45rem;
  }

  .phonics-preview {
    margin-top: 12px;
    padding: 14px;
    font-size: 1.5rem;
  }
}

@media (max-height: 860px) {
  .englishfun-book {
    padding-top: 12px;
    padding-bottom: 18px;
  }

  .book-hero {
    padding: 14px 18px;
    margin-bottom: 10px;
  }

  .hero-description {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .goal-tabs-wrap {
    margin-bottom: 10px;
  }

  .practice-card.practice-stage {
    padding: 16px;
  }

  .prompt,
  .answer-hint {
    font-size: 1.4rem;
  }

  .practice-form textarea.skyline-textarea {
    min-height: 122px;
    max-height: 122px;
    font-size: 1.5rem;
    line-height: 1.4;
  }

  .recognition-bank {
    max-height: 120px;
  }
}

@media (max-height: 760px) {
  .hero-badge,
  .goal-group-title,
  .skyline-note {
    display: none;
  }

  .practice-actions {
    position: sticky;
    bottom: 8px;
    z-index: 4;
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 253, 247, 0.94);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 24px rgba(46, 36, 18, 0.12);
  }
}

/* Home lesson list bar view */
.lesson-list-view {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.lesson-list-view .lesson-card {
  padding: 14px 18px;
  border-radius: 18px;
}

.lesson-line {
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) auto minmax(120px, 220px) minmax(112px, 132px);
  align-items: center;
  gap: 14px;
  width: 100%;
}

.lesson-line-title {
  min-width: 0;
  font-size: 1.04rem;
  color: var(--book-ink);
  white-space: nowrap;
}

.lesson-line-meta {
  min-width: 0;
  font-size: 0.95rem;
  color: rgba(24, 49, 83, 0.82);
  white-space: nowrap;
}

.lesson-line-meta b {
  color: var(--book-accent-deep);
  font-size: 1rem;
}

.lesson-line-meta-muted {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-line-action {
  justify-self: end;
  min-width: 112px;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .lesson-list-view .lesson-card {
    padding: 12px 14px;
  }

  .catalog-filter-block .catalog-chip-row.compact {
    gap: 8px;
  }

  .lesson-line {
    grid-template-columns: minmax(180px, 1.4fr) auto minmax(96px, 150px) minmax(104px, 120px);
    gap: 12px;
  }

  .lesson-line-rich {
    grid-template-columns: minmax(180px, 1.4fr) auto minmax(96px, 150px) minmax(104px, 120px);
  }

  .lesson-line-progress.compact {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .lesson-list-view {
    gap: 10px;
  }

  .lesson-list-view .lesson-card {
    padding: 14px;
    border-radius: 18px;
  }

  .lesson-line {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .lesson-line-title,
  .lesson-line-meta {
    white-space: normal;
  }

  .lesson-line-rich {
    grid-template-columns: 1fr;
  }

  .lesson-line-progress.compact {
    flex-wrap: wrap;
  }

  .lesson-line-bar-inline {
    min-width: 0;
  }

  .lesson-line-action {
    justify-self: stretch;
    width: 100%;
  }

  .catalog-chip.compact {
    min-width: 54px;
    flex: 0 0 54px;
  }
}

.challenge-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 18px;
  border: 1px dashed rgba(216, 121, 43, 0.35);
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255, 244, 214, 0.92), rgba(255, 251, 241, 0.98));
  color: var(--ink, #173f73);
}

.challenge-notice strong {
  flex: 0 0 auto;
  font-size: 0.98rem;
}

.challenge-notice span {
  flex: 1 1 auto;
  font-size: 0.92rem;
  line-height: 1.6;
}

.challenge-notice.unlocked {
  border-color: rgba(64, 148, 99, 0.4);
  background: linear-gradient(90deg, rgba(233, 252, 240, 0.96), rgba(255, 250, 239, 0.98));
}

.teacher-challenge-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(233, 243, 255, 0.92);
  border: 1px solid rgba(111, 153, 211, 0.28);
}

.teacher-challenge-label {
  flex: 1 1 auto;
  font-size: 0.94rem;
  color: var(--book-ink);
  font-weight: 700;
}

@media (max-width: 640px) {
  .goal-tabs.progress-style {
    margin-right: -4px;
  }

  .goal-tab.progress-chip {
    flex-basis: 102px;
    min-width: 102px;
  }

  .challenge-notice {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
  }

  .teacher-challenge-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .teacher-challenge-toolbar .book-button {
    width: 100%;
    text-align: center;
  }
}
