:root {
  --paper: #faf7f0;
  --ink: #203047;
  --teal: #159d98;
  --teal-soft: #eaf6f5;
  --orange: #f3a34a;
  --muted: #4a5d6e;
  --line: #c5ced6;
  --surface: #ffffff;
  --scrollbar-offset: 5px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  background: #c5cec8;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.player-body {
  height: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 4px;
}

button:disabled {
  opacity: .25;
  cursor: default;
}

.player {
  background: var(--paper);
  width: 100%;
  max-width: 520px;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: clamp(8px, 1.6vh, 16px) clamp(14px, 4vw, 24px) max(8px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(6px, 1.4vh, 14px);
  flex-shrink: 0;
}

.icon {
  border: 0;
  background: none;
  color: var(--ink);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon:hover:not(:disabled) {
  background: rgba(32, 48, 71, 0.05);
}

.icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progress {
  display: flex;
  gap: 4px;
  flex: 1;
  align-items: center;
  min-width: 0;
}

.progress i {
  height: 5px;
  background: #b4c0c4;
  border-radius: 9px;
  flex: 1;
  transition: background 0.2s ease;
}

.progress i.active {
  background: var(--teal);
}

#counter,
.topbar-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding: 0 2px;
}

.topbar-slide-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-slide-nav .icon {
  border: 1px solid rgba(32, 48, 71, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.topbar-slide-nav .icon:hover:not(:disabled) {
  background: #ffffff;
  border-color: rgba(21, 157, 152, 0.45);
  color: var(--teal);
}

.topbar-slide-nav .icon.is-last-slide {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.topbar-slide-nav .icon.is-last-slide:hover:not(:disabled) {
  background: #108480;
  border-color: #108480;
  color: #ffffff;
}

@media (max-width: 480px) {
  .topbar {
    gap: 6px;
  }

  .topbar .icon {
    width: 34px;
    height: 34px;
  }

  .topbar .icon svg {
    width: 19px;
    height: 19px;
  }

  #counter,
  .topbar-counter {
    font-size: 11.5px;
  }
}

/* Slide stage layout: mobile-first structure */
.stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

/* Mobile middle navigation: default hidden for large screens */
.mobile-mid-nav {
  display: none;
}

@media (max-width: 859px) {

  .art-pane,
  .text-pane {
    display: contents;
  }

  .heading {
    order: 1;
    margin-bottom: clamp(4px, 0.8vh, 10px);
    flex-shrink: 0;
  }

  .art-pane>.art {
    order: 2;
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  .art-pane>.art img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
  }

  .narrative-card {
    order: 3;
  }

  .controls-area {
    order: 4;
    flex-shrink: 0;
    margin-top: auto;
    padding-top: clamp(2px, 0.5vh, 6px);
  }

  .audio-button {
    width: 34px;
    height: 34px;
  }

  .audio-button svg {
    width: 16px;
    height: 16px;
  }

  .next {
    margin-top: clamp(4px, 0.8vh, 8px);
    padding: 4px;
    font-size: 11.5px;
  }

  .status {
    margin: 2px 0 0;
    font-size: 12px;
  }

  .action-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .laptop-next-icon,
  .laptop-shortcuts-hint {
    display: none !important;
  }

  .mobile-next-icon {
    display: block;
  }
}

/* Eyebrow and heading */
.heading {
  margin-bottom: 14px;
}

.eyebrow-btn {
  display: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0 0 10px;
  align-items: center;
  gap: 6px;
  text-align: left;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.eyebrow-btn:hover .eyebrow {
  color: var(--teal);
}

.eyebrow-btn:hover .chevron {
  transform: translateY(1px);
  color: var(--teal);
}

.eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.chevron {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

h1 {
  font-size: clamp(20px, 5.2vw, 32px);
  line-height: 1.14;
  letter-spacing: -.035em;
  margin: 0;
  font-weight: 750;
  white-space: pre-line;
}

/* Illustration area */
.art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 0;
  border-radius: 12px;
  background: var(--paper);
}

/* Immediate slide image loading overlay */
.slide-image-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--paper, #FAF7F0);
  z-index: 15;
  border-radius: inherit;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.slide-image-loader[hidden] {
  display: none !important;
}

.loader-spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid rgba(21, 157, 152, 0.2);
  border-top-color: var(--teal, #159D98);
  border-radius: 50%;
  animation: slideLoaderSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes slideLoaderSpin {
  to {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-size: 13px;
  font-weight: 650;
  color: var(--muted, #64748B);
  letter-spacing: 0.01em;
}

.art img.image-loading {
  opacity: 0 !important;
  visibility: hidden;
}


.art img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: var(--paper);
}

.art canvas {
  display: none;
}

/* Scan beam for Style 3 (Oscilloscope Beam Wipe) */
.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--teal) 20%, #5fe9e4 50%, var(--teal) 80%, transparent 100%);
  box-shadow: 0 0 14px rgba(21, 157, 152, 0.85), 0 0 4px #ffffff;
  pointer-events: none;
  z-index: 5;
  will-change: top, opacity;
}

.scan-beam.active {
  animation: scanBeamMove 0.58s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes scanBeamMove {
  0% {
    top: 0%;
    opacity: 1;
  }

  90% {
    top: 98%;
    opacity: 1;
  }

  100% {
    top: 100%;
    opacity: 0;
  }
}

/* ==========================================================================
   5 Rotating Slide Transition Animations
   ========================================================================== */

/* Style 1: Card-Deck Spring & Flip */
.anim-card-spring {
  animation: cardSpringIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  will-change: transform, opacity;
}

@keyframes cardSpringIn {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Style 2: Kinetic Directional Swipe */
.anim-swipe-up {
  animation: swipeUpIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

@keyframes swipeUpIn {
  0% {
    opacity: 0;
    transform: translateY(42px) scale(0.97);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.anim-swipe-down {
  animation: swipeDownIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

@keyframes swipeDownIn {
  0% {
    opacity: 0;
    transform: translateY(-42px) scale(0.97);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Style 3: Precision Oscilloscope Beam Wipe */
.anim-beam-wipe {
  animation: beamWipeIn 0.58s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: clip-path, filter;
}

@keyframes beamWipeIn {
  0% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    filter: brightness(1.15) contrast(1.08);
  }

  60% {
    filter: brightness(1.06) contrast(1.04);
  }

  100% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  }

  100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    filter: brightness(1) contrast(1);
  }
}

/* Style 4: Ink-Bloom & Soft Watercolor Vignette */
.anim-ink-bloom {
  animation: inkBloomIn 0.55s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  will-change: filter, transform, opacity;
}

@keyframes inkBloomIn {
  0% {
    opacity: 0.15;
    filter: blur(14px) contrast(1.25) saturate(0.85);
    transform: scale(0.95);
  }

  50% {
    opacity: 0.85;
    filter: blur(5px) contrast(1.1) saturate(0.95);
  }

  100% {
    opacity: 1;
    filter: blur(0px) contrast(1) saturate(1);
    transform: scale(1);
  }
}

/* Style 5: Staggered Storybook Zoom & Pop */
.anim-storybook-pop {
  animation: storybookPopIn 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

@keyframes storybookPopIn {
  0% {
    opacity: 0;
    transform: scale(1.07) translateY(8px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.narrative-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 12px;
  background: #ffffff;
  border: 1px solid #d3dce3;
  border-left: 4px solid var(--teal);
  border-radius: 0 16px 16px 0;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(32, 48, 71, 0.03);
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.narrative-card::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.caption {
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -.02em;
  font-weight: 600;
  margin: 0;
  white-space: pre-line;
}

.explanation {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  color: #3d5164;
}

.explanation-actions {
  display: flex;
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-top: 8px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff 8px);
}

.explanation-play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: var(--teal);
  color: white;
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 4px 14px rgba(21, 157, 152, 0.28);
}

.explanation-play:hover:not(:disabled) {
  background: #128782;
}

.explanation-play svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  fill: currentColor;
  box-sizing: border-box;
}

.explanation-play #cardPlayIcon,
.explanation-play #cardPauseIcon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Transcript overlay */
.transcript {
  position: absolute;
  bottom: 8px;
  left: 6px;
  right: 6px;
  z-index: 3;
  background: rgba(255, 255, 255, .97);
  padding: 12px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px #20304712;
  max-height: 70%;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.transcript::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}

.transcript .icon {
  height: 26px;
  width: 26px;
  font-size: 20px;
}

.transcript p {
  font-size: 15.5px;
  line-height: 1.5;
  margin: 7px 0 0;
}

.image-error {
  text-align: center;
  padding: 30px;
  font-size: 15px;
  color: var(--muted);
}

/* Footer & audio controls */
footer {
  margin-top: auto;
  padding-top: 6px;
}

.audio-row {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid rgba(32, 48, 71, 0.12);
  border-radius: 10px;
  padding: 9px 12px;
  box-shadow: 0 1px 3px rgba(32, 48, 71, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.speaking .audio-row {
  border-color: rgba(21, 157, 152, 0.32);
}

.audio-button {
  background: var(--teal);
  color: #fff;
  border: 0;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}

.audio-button:hover:not(:disabled) {
  transform: scale(1.05);
  background: #128984;
}

.audio-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.audio-button #pauseIcon {
  display: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
}

.speaking .audio-button #playIcon {
  display: none;
}

.speaking .audio-button #pauseIcon {
  display: block;
}

.audio-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.audio-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.audio-header>span:first-child {
  font-size: 13px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.audio-time {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.audio-progress-track {
  width: 100%;
  height: 3px;
  background: var(--teal-soft);
  border-radius: 999px;
  overflow: hidden;
}

.audio-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
  transition: width 0.2s linear, background-color 0.2s ease;
}

.audio-speed-btn {
  flex-shrink: 0;
  border: 1px solid rgba(32, 48, 71, 0.14);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.audio-speed-btn:hover {
  background: var(--teal-soft);
  border-color: rgba(21, 157, 152, 0.35);
  color: var(--teal);
}

.replay {
  color: var(--muted);
}

.next {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  margin-top: 14px;
  padding: 6px;
  transition: color 0.15s ease;
}

.next:hover {
  color: var(--ink);
}

.next svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

@media (max-width: 859px) {
  .narrative-card {
    position: relative;
    flex: 0 0 auto;
    min-height: auto;
    max-height: none;
    margin: 8px 0 0;
    padding: 10px 48px 10px 12px;
    gap: 6px;
    overflow: visible;
  }

  .explanation-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    margin: 0;
    padding: 0;
    background: none;
  }

  .explanation-play {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
    box-shadow: none;
  }

  .explanation-play svg {
    width: 22px;
    height: 22px;
    padding: 0;
    background: none;
  }

  #cardPlayLabel,
  .audio-row,
  {
  display: none;
}

.controls-area {
  margin-top: 0;
  padding-top: 0;
}
}

.status {
  font-size: 13px;
  text-align: center;
  margin: 4px 0 0;
  color: var(--muted);
}

/* Table of Contents Drawer Modal */
.toc-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.toc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 48, 71, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.toc-panel {
  position: relative;
  z-index: 1;
  background: var(--paper);
  width: 100%;
  max-width: 490px;
  max-height: 86svh;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(32, 48, 71, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toc-header {
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper);
}

.toc-grade {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--teal);
  display: block;
  margin-bottom: 4px;
}

.toc-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: -.02em;
}

.toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 28px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.toc-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.toc-topic-group {
  margin-bottom: 18px;
}

.toc-topic-title {
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 10px 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-lesson-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  transition: all 0.15s ease;
  gap: 10px;
}

.toc-lesson-item:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(21, 157, 152, 0.08);
}

.toc-lesson-item.active {
  background: var(--teal-soft);
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
}

.toc-lesson-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.toc-lesson-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd3d7;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.toc-lesson-item.active .toc-lesson-indicator {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(21, 157, 152, 0.25);
}

.toc-lesson-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-lesson-item.active .toc-lesson-name {
  color: #0d6e6a;
  font-weight: 700;
}

.toc-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: #f0f2ee;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.toc-lesson-item.active .toc-badge {
  background: rgba(21, 157, 152, 0.15);
  color: #0d6e6a;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse {
  to {
    transform: scaleY(.4);
  }
}

[hidden] {
  display: none !important;
}

/* Tablet portrait mode (600px - 859px) */
@media (min-width: 600px) and (max-width: 859px) {
  body.player-body {
    padding: clamp(8px, 1.8vh, 18px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #c5cec8;
  }

  .player {
    max-width: 540px;
    height: 100%;
    max-height: calc(100dvh - clamp(16px, 3.6vh, 36px));
    border-radius: 24px;
    box-shadow: 0 12px 70px #2030470c;
    padding: clamp(14px, 2vh, 22px) clamp(20px, 3vw, 32px);
  }

  .art img {
    max-height: 100%;
  }

  .toc-drawer {
    align-items: center;
    padding: 20px;
  }

  .toc-panel {
    border-radius: 20px;
    max-height: 80vh;
  }
}

/* ==========================================================================
   Laptop / Desktop View (>= 860px): 2-Column Layout (Image Left, Text Right)
   ========================================================================== */
@media (min-width: 860px) {
  body.player-body {
    padding: clamp(10px, 1.8vh, 18px) clamp(12px, 1.8vw, 24px) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    background: #c5cec8 !important;
    box-sizing: border-box;
  }

  .player {
    max-width: 100% !important;
    width: 100% !important;
    height: 100%;
    max-height: calc(100dvh - clamp(20px, 3.6vh, 36px)) !important;
    border-radius: clamp(20px, 2.5vh, 28px) !important;
    box-shadow: 0 18px 48px rgba(32, 48, 71, 0.16), 0 2px 8px rgba(32, 48, 71, 0.06);
    border: 1px solid rgba(32, 48, 71, 0.14);
    padding: clamp(8px, 1.2vh, 12px) clamp(20px, 2.5vw, 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
  }

  .topbar {
    margin-bottom: clamp(6px, 0.8vh, 10px);
    flex-shrink: 0;
  }

  .stage {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: clamp(20px, 3vw, 44px);
    align-items: start;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  /* Left Column: Image */
  .art-pane {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    order: 1;
  }

  .art-pane .art {
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    border-radius: 18px;
    background: var(--paper);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    position: relative;
  }

  .art img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    margin: 0 auto;
    display: block;
  }

  /* Right Column: Text & Controls */
  .text-pane {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    order: 2;
    padding-left: 8px;
  }

  .heading {
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .eyebrow-btn {
    margin: 0 0 clamp(4px, 0.8vh, 8px);
  }

  h1 {
    font-size: clamp(22px, min(2.5vw, 4.2vh), 36px);
    line-height: 1.14;
    letter-spacing: -.035em;
  }

  .narrative-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: clamp(10px, 1.6vh, 20px) 0;
    background: #ffffff;
    border: 1px solid #d3dce3;
    border-left: 4px solid var(--teal);
    border-radius: 0 16px 16px 0;
    padding: clamp(14px, 1.8vh, 18px) clamp(16px, 1.8vw, 22px);
    box-shadow: 0 2px 10px rgba(32, 48, 71, 0.03);
    flex-shrink: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .narrative-card::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .caption {
    font-size: clamp(14px, min(1.25vw, 2.3vh), 18px);
    line-height: 1.45;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    background: none;
    border: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .explanation {
    display: block;
    margin: 0;
    font-size: clamp(14px, min(1.15vw, 2.1vh), 16.5px);
    line-height: 1.55;
    font-weight: 500;
    color: #3d5164;
  }

  .explanation-actions {
    display: flex;
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding-top: 8px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff 8px);
  }

  .explanation-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: var(--teal);
    color: white;
    border-radius: 999px;
    padding: 8px 16px 8px 8px;
    font-size: 14px;
    font-weight: 750;
    box-shadow: 0 4px 14px rgba(21, 157, 152, 0.28);
  }

  .explanation-play:hover:not(:disabled) {
    background: #128782;
  }

  .explanation-play svg {
    width: 34px;
    height: 34px;
    padding: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    fill: currentColor;
    box-sizing: border-box;
  }

  .explanation-play #cardPlayIcon,
  .explanation-play #cardPauseIcon {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .controls-area {
    flex-shrink: 0;
    margin-top: clamp(2px, 0.8vh, 10px);
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.4vh, 14px);
  }

  .audio-button {
    width: 36px;
    height: 36px;
  }

  .audio-button svg {
    width: 17px;
    height: 17px;
  }

  .action-row {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .next {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: fit-content;
    background: var(--teal);
    color: white;
    padding: clamp(8px, 1.2vh, 11px) clamp(16px, 1.8vw, 24px);
    border-radius: 14px;
    font-size: clamp(12.5px, 1.4vh, 14px);
    font-weight: 750;
    margin: 0;
    box-shadow: 0 4px 14px rgba(21, 157, 152, 0.28);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  }

  .next:hover {
    background: #128782;
    transform: translateX(2px);
    box-shadow: 0 6px 18px rgba(21, 157, 152, 0.38);
    color: white;
  }

  .mobile-next-icon {
    display: none !important;
  }

  .laptop-next-icon {
    display: block !important;
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.4;
  }

  .laptop-shortcuts-hint {
    display: block !important;
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
  }

  .laptop-shortcuts-hint kbd {
    background: #e6eae7;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 10.5px;
    border: 1px solid #d0d7d2;
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  .toc-drawer {
    align-items: center;
    padding: 20px;
  }

  .toc-panel {
    border-radius: 24px;
    max-height: 80vh;
    box-shadow: 0 16px 50px rgba(32, 48, 71, 0.25);
  }
}

/* Compact screen height fallback (e.g. mobile landscape or small laptop windows) */
@media (max-height: 620px) {
  .topbar {
    margin-bottom: 6px !important;
  }

  .icon {
    width: 32px !important;
    height: 32px !important;
  }

  h1 {
    font-size: 20px !important;
  }

  .caption {
    margin: 6px 0 !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
  }

  .narrative-card .caption {
    margin: 0 !important;
    padding: 0 !important;
  }

  .controls-area {
    gap: 6px !important;
  }

  .audio-row {
    padding: 6px 10px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Home Page: Olearno Visual Learning Dashboard
   ========================================================================== */

/* Desktop topbar elements hidden by default on mobile */
.topbar-nav {
  display: none;
}

.avatar-meta-desktop {
  display: none;
}

/* Mobile & Small Screen (< 860px) App Shell */
@media (max-width: 859px) {

  html:has(body.home-body),
  html.home-html {
    height: 100% !important;
    overflow: hidden !important;
  }

  body.home-body {
    background: #c5cec8;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden !important;
    /* Zero window scrolling on phone */
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .home-app-shell {
    background: #faf7f0;
    width: 100%;
    max-width: 460px;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden !important;
    /* Traps scroll inside card */
    box-sizing: border-box;
  }

  @media (min-width: 480px) and (min-height: 500px) {
    .home-app-shell {
      height: min(94vh, 840px);
      max-height: 94dvh;
      border-radius: 36px;
      border: 1px solid rgba(32, 48, 71, 0.08);
      box-shadow: 0 20px 60px rgba(32, 48, 71, 0.12), 0 4px 16px rgba(32, 48, 71, 0.04);
    }
  }
}

/* 1. App Topbar - Pinned at top of card */
.app-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #faf7f0;
  position: relative;
  z-index: 100;
  border-bottom: 1px solid rgba(32, 48, 71, 0.06);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.brand-word {
  font-size: 21px;
  font-weight: 850;
  letter-spacing: -0.04em;
  color: #1A2A3E;
  white-space: nowrap !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Mobile header shows only Spark */
.brand-olearno {
  display: none;
}

.brand-spark {
  color: var(--teal);
  font-weight: 850;
  letter-spacing: -0.02em;
  white-space: nowrap !important;
}

.brand-sparkle {
  width: 17px;
  height: 17px;
  margin-left: -1px;
  margin-top: -8px;
  flex-shrink: 0;
}

.topbar-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.student-menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.avatar-button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.18s ease;
}

.avatar-button:hover {
  transform: scale(1.06);
}

.avatar-frame {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(32, 48, 71, 0.12);
  border: 2px solid #FFFFFF;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.student-menu-wrap.is-open .avatar-frame {
  border-color: #159D98;
  box-shadow: 0 0 0 3px rgba(21, 157, 152, 0.18);
}

.avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-chevron {
  display: none;
  width: 14px;
  height: 14px;
  color: #4f6374;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.student-menu-wrap.is-open .avatar-chevron {
  transform: rotate(180deg);
}

.student-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(296px, calc(100vw - 28px));
  background: #FFFFFF;
  border: 1.5px solid #d0d5db;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 14px 36px rgba(26, 42, 62, 0.16), 0 3px 10px rgba(26, 42, 62, 0.06);
  z-index: 250;
  text-align: left;
  animation: fadeIn 0.16s ease-out;
}

.student-dropdown[hidden] {
  display: none !important;
}

.student-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-dropdown-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.student-dropdown-name {
  font-size: 14px;
  font-weight: 850;
  color: #151E28;
  line-height: 1.2;
}

.student-dropdown-sub {
  font-size: 12px;
  font-weight: 700;
  color: #0D9488;
}

.student-dropdown-divider {
  height: 1px;
  background: #E8ECE6;
  margin: 10px 0 12px;
}

.student-dropdown .modal-picker-group:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Scrollable Main Content INSIDE the Card
   ========================================================================== */
.app-main-content {
  flex: 1;
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 10px 14px 24px 14px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin !important;
  scrollbar-color: rgba(32, 48, 71, 0.2) transparent !important;
  -ms-overflow-style: auto !important;
}

/* Redesigned sleek card scrollbar: seamless transparent track, floating pill thumb */
.app-main-content::-webkit-scrollbar {
  display: block !important;
  width: 5px !important;
}

.app-main-content::-webkit-scrollbar-track {
  background: transparent !important;
  margin: 12px 3px 16px 0 !important;
}

.app-main-content::-webkit-scrollbar-thumb {
  background-color: rgba(32, 48, 71, 0.18) !important;
  border-radius: 999px !important;
  border: none !important;
  transition: background-color 0.2s ease !important;
}

.app-main-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(21, 157, 152, 0.7) !important;
}

.app-main-content::-webkit-scrollbar-thumb:active {
  background-color: #159D98 !important;
}

/* ── Greeting ───────────────────────────────────────────── */
/* ── Hero: Greeting & Gamification Row ───────────────────── */
.home-hero-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.hero-greeting {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-heading {
  font-size: clamp(24px, 5.5vw, 36px);
  font-weight: 850;
  letter-spacing: -0.035em;
  color: #151E28;
  margin: 0;
  line-height: 1.15;
}

.hero-subheading {
  font-size: clamp(14px, 3.2vw, 17px);
  font-weight: 500;
  color: #3d5164;
  margin: 0;
  line-height: 1.3;
}

.hero-learning-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.12em 0.25em;
  padding-bottom: 0.2em;
}

.hero-word {
  position: relative;
  display: inline-block;
  isolation: isolate;
}

.hero-word::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.03em;
  right: -0.03em;
  bottom: -0.06em;
  height: 0.24em;
  border-radius: 50% 35% 45% 30%;
  transform: rotate(-2deg);
}

.hero-word-lessons {
  color: #087c78;
}

.hero-word-lessons::after {
  background: #c6e9df;
}

.hero-word-games {
  color: #a4511c;
  transform: rotate(-3deg);
}

.hero-word-games::after {
  background: #ffe0ad;
  transform: rotate(2deg);
}

.hero-word-flashcards {
  color: #7050a0;
}

.hero-word-flashcards::after {
  background: #e5d9f5;
}

/* Gamification Stats Card - Responsive 3-stat pill */
.gamify-stats-card {
  background: #FFFFFF;
  border: 1.5px solid #d5dce3;
  border-radius: 16px;
  padding: 7px 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.gamify-stat-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 4px 2px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease;
  border-radius: 10px;
}

.gamify-stat-item:hover {
  transform: translateY(-1px);
}

.gamify-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gamify-stat-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.goal-ring-svg {
  display: block;
  width: 22px;
  height: 22px;
}

.gamify-stat-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.gamify-value {
  font-size: 13.5px;
  font-weight: 850;
  letter-spacing: -0.02em;
  color: #151E28;
  white-space: nowrap;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gamify-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8E9CA8;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gamify-divider {
  width: 1px;
  height: 24px;
  background: #E5E7EB;
  flex-shrink: 0;
}

/* ── 2. Continue Learning Banner Card ─────────────────────── */
.home-doubt-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 18px;
  border: 1px solid #d8cce7;
  border-radius: 18px;
  background: linear-gradient(110deg, #fff, #f1eafa);
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow .18s, border-color .18s;
}

.home-doubt-card:hover {
  border-color: #a68bc5;
  box-shadow: 0 5px 18px #7050a014;
}

.home-doubt-card:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.home-doubt-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  color: #7050a0;
  background: #e9ddf6;
  border-radius: 14px;
  transform: rotate(-5deg);
}

.home-doubt-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-doubt-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.home-doubt-kicker {
  color: #7050a0;
  font-size: 9px;
  letter-spacing: .09em;
  font-weight: 800;
}

.home-doubt-copy strong {
  font-size: 21px;
  letter-spacing: -.025em;
}

.home-doubt-copy>span:last-child {
  color: #526273;
  font-size: 12px;
}

.home-doubt-action {
  margin-left: auto;
  color: #7050a0;
  background: #fff;
  border: 1px solid #d8cce7;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.home-planner-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 18px;
  border: 1.5px solid #A7F3D0;
  border-radius: 18px;
  background: linear-gradient(110deg, #FFFFFF, #ECFDF5);
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow .18s, border-color .18s, transform .18s;
}

.home-planner-card:hover {
  border-color: #059669;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.home-planner-card:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.home-planner-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  color: #059669;
  background: #D1FAE5;
  border-radius: 14px;
}

.home-planner-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-planner-kicker {
  color: #059669 !important;
  font-size: 9.5px;
  letter-spacing: .09em;
  font-weight: 800;
}

.home-planner-action {
  margin-left: auto;
  color: #059669 !important;
  background: #FFFFFF !important;
  border: 1px solid #A7F3D0 !important;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

@media (max-width: 539px) {
  .home-planner-card {
    padding: 14px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .home-planner-action {
    margin-left: 60px;
  }
}

@media (max-width: 539px) {
  .home-doubt-card {
    padding: 14px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .home-doubt-copy strong {
    font-size: 18px;
  }

  .home-doubt-action {
    margin-left: 60px;
    padding: 7px 12px;
  }
}

.continue-banner-card {
  background: linear-gradient(135deg, #b6e6de 0%, #a4ddd4 100%);
  border: 1.5px solid #86cfc4;
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 76px 1fr;
  grid-template-areas:
    "art content"
    "art action";
  column-gap: 12px;
  row-gap: 6px;
  align-items: center;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.06);
  flex-shrink: 0;
}

.continue-banner-art {
  grid-area: art;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  margin: 0;
}

.continue-thumb-frame {
  width: 76px;
  height: 72px;
  border-radius: 12px;
  background: #FAF7F0;
  border: 1.5px solid #CFECE7;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.08);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.continue-lesson-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 4px;
  background: #FAF7F0;
}

.continue-banner-content {
  grid-area: content;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.continue-eyebrow {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #0D9488;
  margin-bottom: 2px;
  line-height: 1;
}

.continue-title {
  font-size: clamp(14.5px, 4.2vw, 16.5px);
  font-weight: 850;
  letter-spacing: -0.025em;
  color: #151E28;
  margin: 0 0 1px 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-subtitle {
  font-size: 11.5px;
  font-weight: 500;
  color: #3d5164;
  margin: 0 0 4px 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-progress-block {
  display: flex;
  align-items: center;
  gap: 6px;
}

.continue-progress-track {
  width: 100%;
  max-width: 120px;
  height: 4.5px;
  background: #CFECE7;
  border-radius: 999px;
  overflow: hidden;
}

.continue-progress-fill {
  height: 100%;
  background: #0D9488;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.continue-meta {
  font-size: 11px;
  font-weight: 600;
  color: #3d5164;
}

.continue-banner-action {
  grid-area: action;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
}

.resume-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0D9488;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 750;
  padding: 5px 13px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.28);
  transition: all 0.18s ease;
  width: fit-content;
  line-height: 1.2;
}

.resume-hero-btn:hover {
  background: #0B7A70;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.38);
}

.resume-hero-btn:active {
  transform: scale(0.97);
}

.resume-hero-btn .arrow-svg {
  width: 13px;
  height: 13px;
}

/* Tablet / intermediate breakpoint: single row layout before full desktop */
@media (min-width: 540px) and (max-width: 859px) {
  .continue-banner-card {
    grid-template-columns: 84px 1fr auto;
    grid-template-areas: "art content action";
    row-gap: 0;
    column-gap: 16px;
    padding: 12px 18px;
  }

  .continue-thumb-frame {
    width: 84px;
    height: 76px;
  }

  .continue-banner-action {
    margin-left: auto;
  }

  .continue-title {
    font-size: 18px;
  }
}

/* ── 3. Explore your subjects Section ────────────────────── */
.explore-subjects-section {
  margin-bottom: 24px;
  flex-shrink: 0;
}

.explore-section-header {
  margin-bottom: 12px;
}

.explore-section-title {
  font-size: clamp(20px, 4.5vw, 24px);
  font-weight: 850;
  letter-spacing: -0.03em;
  color: #151E28;
  margin: 0;
}

.explore-controls-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-pills-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-pill-tab {
  border: none;
  background: #F1F5F9;
  color: #3d5164;
  font-size: 13.5px;
  font-weight: 650;
  padding: 6px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-pill-tab:hover:not(.active) {
  background: #c5d0da;
  color: #1E293B;
}

.filter-pill-tab.active {
  background: #0D9488;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.25);
}

.explore-search-wrap {
  position: relative;
  width: 100%;
}

.search-icon-svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  stroke: #94A3B8;
  pointer-events: none;
}

.explore-search-input {
  width: 100%;
  background: #FFFFFF;
  border: 1.5px solid #c5d0da;
  border-radius: 999px;
  padding: 9px 18px 9px 38px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1E293B;
  outline: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
  box-sizing: border-box;
}

.explore-search-input:focus {
  border-color: #0D9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #c5d0da;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  color: #3d5164;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* 4 Subject Cards Grid */
.subjects-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.subject-card {
  border-radius: 20px;
  border: 1.5px solid transparent;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(32, 48, 71, 0.08);
}

/* ── Games Section ────────────────────────────────────────── */
.games-section {
  margin-top: 10px;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.games-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.games-section-count {
  font-size: 12px;
  font-weight: 750;
  color: #0D9488;
  background: #E6FBF7;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.games-catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (max-width: 580px) {
  .games-catalog-grid {
    grid-template-columns: 1fr;
  }
}

.game-catalog-card {
  background: #FFFFFF;
  border: 1.5px solid #c5d0da;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  min-height: 160px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.game-catalog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(32, 48, 71, 0.09);
}

.game-catalog-card.game-card-maths {
  background: linear-gradient(180deg, #ffe0c2 0%, #fff1e4 100%);
  border-color: #f0b87a;
}

.game-catalog-card.game-card-maths:hover {
  border-color: #FB923C;
}

.game-catalog-card.game-card-science {
  background: linear-gradient(180deg, #c8f0e8 0%, #e5f7f3 100%);
  border-color: #8ed9cc;
}

.game-catalog-card.game-card-science:hover {
  border-color: #14B8A6;
}

.game-card-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.game-subject-pill {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}

.game-subject-pill.maths {
  background: #ffd4a8;
  color: #C2410C;
}

.game-subject-pill.science {
  background: #99e6da;
  color: #0F766E;
}

.game-meta-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: #3d5164;
}

.game-card-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.game-card-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.game-card-icon-wrap.maths-icon {
  background: #ffd4a8;
  border: 1px solid #f0b87a;
}

.game-card-icon-wrap.science-icon {
  background: #b8ebe3;
  border: 1px solid #8ed9cc;
}

.game-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.game-card-title {
  font-size: 16px;
  font-weight: 800;
  color: #151E28;
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.game-card-desc {
  font-size: 12.5px;
  color: #3d5164;
  margin: 0;
  line-height: 1.35;
  font-weight: 500;
}

.game-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed rgba(32, 48, 71, 0.08);
}

.game-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #0D9488;
  transition: transform 0.18s ease, color 0.18s ease;
}

.game-catalog-card.game-card-maths .game-play-btn {
  color: #EA580C;
}

.game-catalog-card:hover .game-play-btn {
  transform: translateX(3px);
}

.game-arrow-svg {
  width: 14px;
  height: 14px;
}

.subject-science {
  background: #b8e6de;
  border-color: #86d0c4;
}

.subject-maths {
  background: #ffd0a6;
  border-color: #e8b07a;
}

.subject-social {
  background: #f3d98c;
  border-color: #d4b45c;
}

.subject-english {
  background: #d9c0f6;
  border-color: #b99ae4;
}

.subject-card-art {
  height: 90px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.22s ease;
}

.subject-card:hover .subject-card-art {
  transform: scale(1.06);
}

.subject-art-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.subject-art-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.subject-card:hover .subject-art-img {
  transform: scale(1.08);
}

.subject-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
}

.subject-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subject-title {
  font-size: 16px;
  font-weight: 850;
  letter-spacing: -0.02em;
  color: #151E28;
  margin: 0;
  line-height: 1.15;
}

.subject-sub {
  font-size: 12px;
  font-weight: 550;
  color: #3d5164;
  line-height: 1.2;
}

.subject-circle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.subject-card:hover .subject-circle-btn {
  transform: translateX(2px) scale(1.05);
}

.subject-science .subject-circle-btn {
  background: #9edfd2;
  color: #0D9488;
}

.subject-maths .subject-circle-btn {
  background: #ffc08a;
  color: #EA580C;
}

.subject-social .subject-circle-btn {
  background: #f0cc6e;
  color: #D97706;
}

.subject-english .subject-circle-btn {
  background: #c9a8f0;
  color: #7C3AED;
}

.subjects-footer-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3d5164;
  font-size: 13.5px;
  font-weight: 500;
  margin-top: 14px;
}

.hint-book-icon {
  width: 17px;
  height: 17px;
  stroke: #3d5164;
  flex-shrink: 0;
}


/* 2. Explore Hero & Search Block */
.explore-hero-block {
  margin-bottom: 20px;
  flex-shrink: 0;
}

.explore-heading {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -0.035em;
  color: #1A2A3E;
  margin: 0 0 12px;
  line-height: 1.15;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border: 1.5px solid #E2E6E1;
  border-radius: 22px;
  padding: 9px 15px;
  box-shadow: 0 3px 12px rgba(32, 48, 71, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-wrapper:focus-within {
  border-color: #159D98;
  box-shadow: 0 0 0 3px rgba(21, 157, 152, 0.14);
}

.search-field-icon {
  width: 18px;
  height: 18px;
  stroke: #8A9CA8;
  flex-shrink: 0;
}

.explore-search-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 550;
  color: #1A2A3E;
  outline: none;
  padding: 0;
}

.explore-search-input::placeholder {
  color: #8E9FA9;
  font-weight: 500;
}

.clear-search-btn {
  background: #EEF1ED;
  border: 0;
  color: #637785;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: bold;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* Filter Pills: [All] [Lessons] [Games] */
.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.filter-pill-tab {
  border: 1.5px solid #E2E6E1;
  background: #FFFFFF;
  color: #556776;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-pill-tab:hover:not(.active) {
  background: #F4F7F2;
  color: #1A2A3E;
}

.filter-pill-tab.active {
  background: #159D98;
  border-color: #159D98;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(21, 157, 152, 0.28);
}

/* Instant Search Results Container */
.instant-results-container {
  background: #FFFFFF;
  border: 1.5px solid #E2E6E1;
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(32, 48, 71, 0.05);
  flex-shrink: 0;
}

.instant-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #EEF1ED;
}

.instant-results-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #159D98;
}

.instant-results-count {
  font-size: 11.5px;
  font-weight: 600;
  color: #4f6374;
}

.instant-results-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.instant-results-grid::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.instant-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #FAF7F0;
  border: 1px solid #E7ECE6;
  border-radius: 12px;
  gap: 10px;
  transition: background 0.15s ease;
}

.instant-card-item:hover {
  background: #F2F7F2;
}

.instant-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.instant-type-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 5px;
  width: fit-content;
}

.instant-type-badge.lesson {
  background: #E0F2F1;
  color: #00796B;
}

.instant-type-badge.game {
  background: #FFE0B2;
  color: #E65100;
}

.instant-card-title {
  font-size: 13.5px;
  font-weight: 750;
  color: #1A2A3E;
  margin: 2px 0 1px;
}

.instant-card-sub {
  font-size: 11.5px;
  color: #4f6374;
}

.instant-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #159D98;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 750;
  padding: 6px 12px;
  border-radius: 12px;
  white-space: nowrap;
}

/* 4. Science Curriculum Accordion View */
/* Keep chapter browsing compact on the dedicated subject page. */
.subject-body .curriculum-drawer-view,
.chapter-body .curriculum-drawer-view {
  margin-top: 0 !important;
  padding: 14px 18px !important;
  border-radius: 18px !important;
}

.subject-body .curriculum-view-header,
.chapter-body .curriculum-view-header {
  margin-bottom: 8px !important;
  padding-bottom: 0 !important;
  border-bottom: 0;
}

.subject-body .back-link-btn,
.chapter-body .back-link-btn {
  font-size: 12px !important;
  padding: 2px 0 !important;
}

.subject-body .curriculum-view-tag,
.chapter-body .curriculum-view-tag {
  font-size: 11px !important;
  font-weight: 500;
}

.subject-body .continue-banner-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  min-height: 0 !important;
  padding: 10px 14px !important;
  margin-bottom: 12px !important;
  border-radius: 12px !important;
}

.subject-body .continue-banner-art,
.subject-body .continue-subtitle,
.subject-body .continue-progress-block,
.subject-body .curriculum-kicker,
.subject-body .curriculum-desc {
  display: none !important;
}

.subject-body .continue-banner-content {
  flex: 1 !important;
  max-width: none !important;
  min-width: 0;
}

.subject-body .continue-eyebrow {
  font-size: 9px !important;
  margin-bottom: 4px !important;
}

.subject-body .continue-title {
  font-size: clamp(14px, 1.4vw, 18px) !important;
  margin: 0 !important;
}

.subject-body .continue-banner-action {
  flex-shrink: 0;
  margin-left: auto !important;
}

.subject-body .resume-hero-btn {
  font-size: 12px !important;
  padding: 9px 14px !important;
  white-space: nowrap;
}

.subject-body .curriculum-chapters-header {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 10px;
}

.subject-body .curriculum-header-text {
  min-width: 0;
}

.subject-body .curriculum-heading {
  font-size: clamp(20px, 2vw, 26px);
  margin: 0;
}

.subject-body .curriculum-search-bar {
  margin-bottom: 12px;
}

@media (min-width: 860px) {

  .subject-body .app-topbar,
  .chapter-body .app-topbar {
    margin-bottom: 8px !important;
  }

  .subject-body .app-main-content,
  .chapter-body .app-main-content {
    padding-top: var(--topbar-clearance) !important;
  }
}

@media (max-width: 539px) {

  .subject-body .curriculum-drawer-view,
  .chapter-body .curriculum-drawer-view {
    padding: 12px !important;
  }

  .subject-body .continue-banner-card {
    gap: 8px !important;
    padding: 10px !important;
  }

  .subject-body .resume-hero-btn {
    padding: 9px 10px !important;
  }
}

.curriculum-drawer-view {
  background: #FFFFFF;
  border: 1.5px solid #E2E6E1;
  border-radius: 24px;
  padding: 18px 16px;
  box-shadow: 0 8px 30px rgba(32, 48, 71, 0.06);
  margin-top: 10px;
  animation: slideInUp 0.25s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.curriculum-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #EEF1ED;
}

.back-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-size: 13.5px;
  font-weight: 750;
  color: #159D98;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.back-link-btn:hover {
  background: #EAF6F5;
}

.chevron-back {
  width: 15px;
  height: 15px;
}

.curriculum-view-tag {
  font-size: 12px;
  font-weight: 750;
  color: #4f6374;
}

.chapter-feature-card {
  background: linear-gradient(135deg, #1C2E42 0%, #243B55 100%);
  border-radius: 18px;
  padding: 16px;
  color: #FFFFFF;
  margin-bottom: 16px;
}

.chapter-kicker {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #F3A34A;
  display: block;
  margin-bottom: 4px;
}

.chapter-feature-title {
  font-size: 19px;
  font-weight: 850;
  letter-spacing: -0.025em;
  margin: 0 0 5px;
  color: #FFFFFF;
}

.chapter-feature-desc {
  font-size: 12.5px;
  line-height: 1.4;
  color: #CCD7DF;
  margin: 0 0 12px;
}

.chapter-feature-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.feat-stat-pill {
  font-size: 11px;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.14);
  padding: 3px 10px;
  border-radius: 10px;
  color: #F2F8F7;
}

.curriculum-filter-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.curriculum-filter-group label {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f6374;
  display: block;
  margin-bottom: 4px;
}

.custom-select-wrap {
  position: relative;
}

.custom-select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #FAF7F0;
  border: 1.5px solid #E2E6E1;
  border-radius: 10px;
  padding: 8px 28px 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1A2A3E;
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  stroke: #4f6374;
  fill: none;
  stroke-width: 2.2;
  pointer-events: none;
}

.topic-chips-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.topic-chip {
  background: #F1F4EE;
  border: 1px solid #DFE3DB;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 650;
  color: #3B4E5D;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topic-chip.active {
  background: #159D98;
  border-color: #159D98;
  color: #FFFFFF;
}

/* ==========================================================================
   Chapters Accordion & Hierarchy (Chapter -> Topic -> Lesson)
   ========================================================================== */

/* Curriculum Header & Action Controls */
.curriculum-chapters-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.curriculum-header-text {
  flex: 1;
  min-width: 200px;
}

.curriculum-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0D9488;
  display: block;
  margin-bottom: 4px;
}

.curriculum-heading {
  font-size: clamp(20px, 4.5vw, 26px);
  font-weight: 850;
  letter-spacing: -0.03em;
  color: #151E28;
  margin: 0 0 4px;
  line-height: 1.2;
}

.curriculum-desc {
  font-size: 13.5px;
  color: #3d5164;
  margin: 0;
  line-height: 1.4;
}

.curriculum-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expand-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  border: 1px solid #c5d0da;
  color: #334155;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.expand-all-btn:hover {
  background: #c5d0da;
  color: #0F172A;
  transform: translateY(-1px);
}

/* Quick Search Box */
.curriculum-search-bar {
  margin-bottom: 18px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: #94A3B8;
  pointer-events: none;
}

.curriculum-search-input {
  width: 100%;
  background: #FAF7F0;
  border: 1.5px solid #c5d0da;
  border-radius: 14px;
  padding: 10px 38px 10px 40px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1E293B;
  outline: none;
  transition: all 0.18s ease;
}

.curriculum-search-input:focus {
  background: #FFFFFF;
  border-color: #0D9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

/* Chapters Accordion List */
.chapters-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Level 1: Chapter Card */
.chapter-accordion-card {
  background: #FFFFFF;
  border: 1.5px solid #c5d0da;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chapter-accordion-card.is-expanded {
  border-color: #CCEAE5;
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.08);
}

.chapter-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
  background: #FFFFFF;
  transition: background 0.15s ease;
}

.chapter-card-header:hover {
  background: #FBFDFD;
}

/* CHAPTER IMAGE: Normal sized image (prominent card thumbnail) */
.chapter-thumb-wrap {
  width: 120px;
  height: 84px;
  min-width: 120px;
  max-width: 120px;
  border-radius: 12px;
  background: #FAF7F0;
  border: 1.5px solid #CFECE7;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.chapter-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  display: block;
}

.chapter-badge-num {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(15, 23, 42, 0.75);
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(2px);
}

.chapter-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chapter-branch-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0369A1;
  background: #E0F2FE;
  padding: 2px 7px;
  border-radius: 6px;
}

.chapter-status-pill {
  font-size: 10px;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 6px;
}

.chapter-status-pill.active {
  background: #DCFCE7;
  color: #15803D;
}

.chapter-status-pill.coming {
  background: #F1F5F9;
  color: #3d5164;
}

.chapter-title {
  font-size: clamp(16px, 3.5vw, 19px);
  font-weight: 800;
  color: #151E28;
  margin: 0;
  line-height: 1.25;
}

.chapter-desc {
  font-size: 12.5px;
  color: #3d5164;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chapter-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.chapter-stat-item {
  font-size: 11.5px;
  font-weight: 600;
  color: #3d5164;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chapter-stat-item svg {
  width: 13px;
  height: 13px;
  color: #0D9488;
}

.chapter-chevron-wrap {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: #F8FAFC;
  border: 1px solid #c5d0da;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3d5164;
  transition: transform 0.25s ease, background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.chapter-accordion-card.is-expanded .chapter-chevron-wrap {
  transform: rotate(180deg);
  background: #E6F7F5;
  color: #0D9488;
  border-color: #CCEAE5;
}

/* Chapter Topics Collapse Body */
.chapter-topics-collapse {
  display: none;
  padding: 0 16px 16px 16px;
  background: #FCFDFD;
  border-top: 1px solid #F1F5F9;
}

.chapter-accordion-card.is-expanded .chapter-topics-collapse {
  display: block;
}

.topics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.chapter-study-tabs {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid #dce6e0;
}

.chapter-study-tabs button {
  --study-accent: #087c78;
  --study-tint: #e9f5f0;
  --study-border: #a9d6c8;
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  border: 1px solid #dce3df;
  background: linear-gradient(120deg, #fff, var(--study-tint));
  color: #203047;
  border-radius: 15px;
  padding: 16px 20px;
  text-align: left;
  box-shadow: 0 2px 5px #20304705;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}

.chapter-study-tabs .study-option-flashcards {
  --study-accent: #7050a0;
  --study-tint: #f3eef9;
  --study-border: #ccbbdf;
}

.chapter-study-tabs .study-option-practice {
  --study-accent: #9b641e;
  --study-tint: #fff5e6;
  --study-border: #e5c99c;
}

.chapter-practice-panel {
  padding-top: 14px;
}

.chapter-practice-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  background: linear-gradient(120deg, #fffaf1, #fff3dd);
  border: 1px solid #e5d0aa;
  border-radius: 16px;
}

.practice-card-art {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  color: #99601a;
  background: #f9e6c4;
  border-radius: 16px;
  font-size: 30px;
  transform: rotate(-5deg);
}

.practice-card-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #99601a;
}

.chapter-practice-card h4 {
  font-size: 20px;
  margin: 5px 0;
  letter-spacing: -.025em;
}

.chapter-practice-card p {
  font-size: 12px;
  color: #526273;
  margin: 0;
  line-height: 1.5;
}

.practice-start {
  margin-left: auto;
  flex-shrink: 0;
  background: #8b5819;
  color: white;
  font-weight: 750;
  font-size: 13px;
  padding: 12px 18px;
  border-radius: 10px;
  text-decoration: none;
}

.practice-start:hover {
  background: #704510;
}

.practice-start:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.study-empty {
  grid-column: 1 / -1;
  font-size: 14px;
  color: #526273;
  padding: 10px;
}

.chapter-study-tabs button:hover {
  border-color: var(--study-border);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px #2030470c;
}

.chapter-study-tabs button[aria-selected="true"] {
  border-color: var(--study-border);
  box-shadow: inset 0 -3px 0 var(--study-accent), 0 4px 12px #20304708;
}

.study-option-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 13px;
  color: var(--study-accent);
  background: var(--study-tint);
  border: 1px solid var(--study-border);
  transform: rotate(-5deg);
}

.study-option-flashcards .study-option-icon {
  transform: rotate(5deg);
}

.study-option-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.study-option-copy {
  flex: 1;
  min-width: 0;
}

.study-option-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.025em;
}

.study-option-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 7px;
  background: #ffffffb3;
  color: var(--study-accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
}

.study-option-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: #526273;
}

.study-option-indicator {
  color: var(--study-accent);
  font-size: 20px;
  opacity: .55;
}

.chapter-study-tabs button[aria-selected="true"] .study-option-indicator {
  opacity: 1;
}

@media (min-width: 651px) and (max-width: 1100px) {
  .chapter-study-tabs button {
    padding: 14px 12px;
    gap: 10px;
  }

  .study-option-icon {
    width: 34px;
    height: 38px;
  }

  .study-option-title {
    font-size: 16px;
    gap: 5px;
    flex-wrap: wrap;
  }

  .study-option-indicator {
    display: none;
  }
}

@media (max-width: 650px) {
  .chapter-study-tabs {
    gap: 8px;
    padding: 14px 0;
  }

  .chapter-study-tabs button {
    padding: 12px 8px;
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
    min-height: 110px;
  }

  .chapter-practice-card {
    padding: 18px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .practice-card-art {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .chapter-practice-card>div {
    flex: 1;
    min-width: 160px;
  }

  .chapter-practice-card h4 {
    font-size: 17px;
  }

  .practice-start {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }

  .study-option-icon {
    width: 30px;
    height: 34px;
    border-radius: 9px;
  }

  .study-option-icon svg {
    width: 20px;
    height: 20px;
  }

  .study-option-title {
    font-size: 13px;
    gap: 4px;
    flex-wrap: wrap;
  }

  .study-option-count {
    min-width: 20px;
    height: 19px;
    font-size: 10px;
  }

  .study-option-hint {
    font-size: 10px;
  }

  .study-option-indicator {
    display: none;
  }
}

.chapter-flashcard-decks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 14px;
}

.flashcard-deck {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid #e6d5ba;
  border-radius: 16px;
  background: #fff8ed;
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}

.flashcard-deck:hover {
  border-color: #dba563;
  box-shadow: 0 4px 14px #2030470d;
}

.flashcard-deck:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.flashcard-deck-memorise {
  background: #f6f0fd;
  border-color: #ddd0ec;
}

.flashcard-deck-memorise:hover {
  border-color: #b79bd4;
}

.flashcard-deck-preview {
  width: 76px;
  flex-shrink: 0;
  transform: rotate(-4deg);
  border: 1px solid #e1d6c7;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 4px 4px 0 #eedbbd;
}

.flashcard-deck-memorise .flashcard-deck-preview {
  transform: rotate(4deg);
  box-shadow: 4px 4px 0 #e2d4f1;
}

.flashcard-deck-preview img {
  display: block;
  width: 100%;
}

.flashcard-deck-copy {
  min-width: 0;
}

.flashcard-deck-count {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #765325;
}

.flashcard-deck-memorise .flashcard-deck-count {
  color: #7050a0;
}

.flashcard-deck h4 {
  font-size: 20px;
  margin: 4px 0;
  letter-spacing: -.025em;
}

.flashcard-deck p {
  font-size: 12px;
  line-height: 1.45;
  color: #4a5d6e;
  margin: 0 0 10px;
}

.flashcard-deck-launch {
  font-size: 12px;
  font-weight: 750;
  color: #087c78;
}

@media (max-width: 650px) {
  .chapter-flashcard-decks {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .flashcard-deck {
    padding: 14px;
  }

  .flashcard-deck-preview {
    width: 62px;
  }
}

/* Level 2: Topic Accordion Item */
.topic-accordion-card {
  background: #FFFFFF;
  border: 1.2px solid #c5d0da;
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.topic-accordion-card.is-expanded {
  border-color: #0D9488;
  box-shadow: 0 3px 12px rgba(13, 148, 136, 0.06);
}

.topic-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: #FFFFFF;
  transition: background 0.15s ease;
}

.topic-card-header:hover {
  background: #F8FAFC;
}

/* TOPIC IMAGE: VERY VERY SMALL IMAGE (32px x 32px) */
.topic-micro-thumb-wrap {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  border-radius: 8px;
  background: #FAF7F0;
  border: 1px solid #CBD5E1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topic-micro-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
  display: block;
}

.topic-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.topic-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-index-badge {
  font-size: 10px;
  font-weight: 800;
  color: #0D9488;
  background: #CCFBF1;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.topic-name {
  font-size: 14px;
  font-weight: 750;
  color: #1E293B;
  margin: 0;
  line-height: 1.25;
}

.topic-meta-line {
  font-size: 11.5px;
  font-weight: 500;
  color: #3d5164;
}

.topic-chevron-wrap {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3d5164;
  transition: transform 0.22s ease, background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.topic-accordion-card.is-expanded .topic-chevron-wrap {
  transform: rotate(180deg);
  background: #E6F7F5;
  color: #0D9488;
}

/* Topic Lessons Collapse Body */
.topic-lessons-collapse {
  display: none;
  padding: 0 12px 10px 12px;
  background: #F8FAFC;
  border-top: 1px dashed #c5d0da;
}

.topic-accordion-card:not(.is-expanded) .topic-lessons-collapse {
  display: none !important;
}

.topic-accordion-card.is-expanded .topic-lessons-collapse {
  display: block !important;
}

.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
}

/* Level 3: Lesson Item */
.lesson-item-card {
  background: #FFFFFF;
  border: 1px solid #d5dce3;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.lesson-item-card:hover {
  border-color: #0D9488;
  background: #FDFEFF;
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.06);
}

/* LESSON IMAGE: VERY VERY SMALL IMAGE (38px x 38px) */
.lesson-micro-thumb-wrap {
  width: 38px;
  height: 38px;
  min-width: 38px;
  max-width: 38px;
  border-radius: 8px;
  background: #FAF7F0;
  border: 1px solid #CBD5E1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lesson-micro-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
  display: block;
}

.lesson-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sublesson-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sublesson-badge {
  font-size: 10px;
  font-weight: 800;
  color: #0D9488;
  background: #E6F7F5;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.lesson-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #1E293B;
  margin: 0;
  line-height: 1.25;
}

.lesson-meta-line {
  font-size: 11.5px;
  font-weight: 500;
  color: #3d5164;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lesson-action-col {
  flex-shrink: 0;
}

.lesson-play-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #0D9488;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 750;
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
}

.lesson-play-pill:hover {
  background: #0B7A70;
  transform: translateY(-1px);
}

.lesson-play-pill.resume {
  background: #EA580C;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
}

.lesson-play-pill.resume:hover {
  background: #C2410C;
}

.lesson-preview-pill {
  display: inline-flex;
  align-items: center;
  background: #F1F5F9;
  color: #3d5164;
  border: 1px solid #c5d0da;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lesson-preview-pill:hover {
  background: #c5d0da;
  color: #334155;
}

/* Mobile Responsiveness for Chapter Accordion */
@media (max-width: 640px) {
  .chapter-thumb-wrap {
    width: 96px;
    height: 70px;
    min-width: 96px;
    max-width: 96px;
  }

  .chapter-card-header {
    gap: 12px;
    padding: 12px;
  }

  .chapter-title {
    font-size: 15.5px;
  }

  .chapter-desc {
    font-size: 12px;
  }

  .chapter-topics-collapse {
    padding: 0 10px 12px 10px;
  }

  .topic-card-header {
    padding: 8px 10px;
    gap: 8px;
  }

  .topic-micro-thumb-wrap {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }

  .topic-name {
    font-size: 13.5px;
  }

  .lesson-item-card {
    padding: 6px 10px;
    gap: 10px;
  }

  .lesson-micro-thumb-wrap {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .lesson-name {
    font-size: 13px;
  }
}

.subject-body .topic-card-header {
  padding: 16px 18px;
  gap: 14px;
}

.subject-body .topic-micro-thumb-wrap {
  width: 46px;
  height: 46px;
  min-width: 46px;
  max-width: 46px;
  border-radius: 10px;
}

.subject-body .topic-name {
  font-size: 17px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .subject-body .topic-card-header {
    padding: 13px 12px;
    gap: 10px;
  }

  .subject-body .topic-micro-thumb-wrap {
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
  }

  .subject-body .topic-name {
    font-size: 15px;
  }
}

/* ==========================================================================
   Topic Section & PROPERLY SCALED Lesson Cards
   ========================================================================== */
.topic-section {
  margin-bottom: 22px;
}

.topic-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid #E8ECE6;
}

.topic-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #159D98;
  display: block;
}

.topic-section-title h3 {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 850;
  color: #1A2A3E;
  letter-spacing: -0.02em;
}

.topic-meta {
  font-size: 11.5px;
  font-weight: 600;
  color: #4f6374;
}

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Horizontal Lesson Card */
.lesson-card {
  background: #FFFFFF;
  border: 1.5px solid #E5EAE3;
  border-radius: 18px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(32, 48, 71, 0.03);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.lesson-card:hover {
  transform: translateY(-2px);
  border-color: #159D98;
}

/* Square Thumbnail Container with Fixed Proportions */
.card-thumb-wrap {
  width: 88px;
  height: 88px;
  min-width: 88px;
  max-width: 88px;
  border-radius: 12px;
  background: #FAF7F0;
  border: 1px solid #DCE4DE;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* Image Scaled Cleanly - Zero Overflow */
.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 3px;
  border-radius: 10px;
  background: #FAF7F0;
}

.card-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(32, 48, 71, 0.85);
  backdrop-filter: blur(4px);
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 750;
  padding: 2px 5px;
  border-radius: 4px;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.card-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-type-badge {
  background: #E0F2F1;
  color: #00796B;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
}

.card-topic-tag {
  font-size: 10.5px;
  font-weight: 650;
  color: #4f6374;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title {
  font-size: 14.5px;
  font-weight: 850;
  color: #1A2A3E;
  margin: 2px 0 2px;
  line-height: 1.25;
}

.card-meta-text {
  font-size: 11.5px;
  font-weight: 600;
  color: #4f6374;
  margin: 0 0 5px;
}

.card-progress-bar {
  width: 100%;
  max-width: 140px;
  height: 5px;
  background: #E8ECE6;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}

.card-progress-fill {
  height: 100%;
  background: #159D98;
  border-radius: 5px;
}

.card-actions-row {
  display: flex;
  align-items: center;
}

.lesson-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #159D98;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  padding: 5px 13px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(21, 157, 152, 0.25);
  transition: all 0.15s ease;
}

.lesson-action-btn:hover {
  background: #128782;
}

.lesson-action-btn .arrow-svg {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   5. Bottom Navigation Dock - Pinned at bottom of card
   ========================================================================== */
.bottom-dock-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid #E8ECE6;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
  box-shadow: 0 -4px 16px rgba(32, 48, 71, 0.04);
}

@media (min-width: 480px) and (min-height: 500px) {
  .bottom-dock-nav {
    border-bottom-left-radius: 36px;
    border-bottom-right-radius: 36px;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: #8C9DA8;
  cursor: pointer;
  padding: 3px 16px;
  border-radius: 10px;
  transition: color 0.15s ease;
}

.bottom-nav-item .nav-icon {
  width: 20px;
  height: 20px;
}

.bottom-nav-item .nav-label {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.bottom-nav-item.active {
  color: #159D98;
}

.bottom-nav-item:hover:not(.active) {
  color: #203047;
}

/* ==========================================================================
   6. Modals, Drawers & Toast inside Card Frame
   ========================================================================== */
.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 26, 38, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  border-radius: inherit;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.app-modal-sheet {
  background: #FFFFFF;
  width: 100%;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(32, 48, 71, 0.16);
  animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpSheet {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 850;
  color: #1A2A3E;
  margin: 0;
}

.modal-close-btn {
  background: #F1F4EE;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #4f6374;
  cursor: pointer;
}

.modal-picker-group {
  margin-bottom: 14px;
}

.picker-group-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4f6374;
  display: block;
  margin-bottom: 6px;
}

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

.picker-option-btn {
  border: 1.5px solid #E2E6E1;
  background: #FAF7F0;
  color: #3B4E5D;
  font-size: 13px;
  font-weight: 750;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.picker-option-btn.active {
  background: #159D98;
  border-color: #159D98;
  color: #FFFFFF;
}

.modal-footer {
  margin-top: 18px;
}

.btn-primary-action {
  width: 100%;
  background: #159D98;
  color: #FFFFFF;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  border-radius: 14px;
  cursor: pointer;
}

/* Saved Items List */
.saved-item-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid #E5EAE3;
  border-radius: 14px;
  margin-bottom: 10px;
  background: #FAF7F0;
}

.saved-icon-badge {
  font-size: 22px;
  background: #FFFFFF;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid #E2E6DF;
}

.saved-details h4 {
  font-size: 14px;
  font-weight: 800;
  color: #1A2A3E;
  margin: 0 0 2px;
}

.saved-details p {
  font-size: 11.5px;
  color: #4f6374;
  margin: 0 0 6px;
}

.saved-launch-btn {
  font-size: 12px;
  font-weight: 750;
  color: #159D98;
  text-decoration: none;
}

/* Progress Drawer Breakdown */
.progress-stats-banner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.progress-ring-block,
.progress-streak-block {
  background: #FAF7F0;
  border: 1px solid #E5EAE3;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 20px;
  font-weight: 900;
  color: #159D98;
}

.stat-caption {
  font-size: 11px;
  font-weight: 700;
  color: #4f6374;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 650;
  color: #203047;
  margin-bottom: 4px;
}

.progress-bar-wrap {
  width: 100%;
  height: 7px;
  background: #E8ECE6;
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #159D98;
  border-radius: 6px;
}

/* Floating Toast inside card */
.app-toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1A2A3E;
  color: #FFFFFF;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(26, 42, 62, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 120;
  max-width: 86%;
  text-align: center;
}

.app-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ── Student Profile & Class Switcher in Drawer ──────────── */
.drawer-class-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FAF7F0;
  border: 1.5px solid #dbe2ea;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(32, 48, 71, 0.04);
}

.drawer-class-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.drawer-class-sub {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748B;
}

.drawer-class-current {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 850;
  color: #1A2A3E;
}

.drawer-class-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #159D98;
  display: inline-block;
  flex-shrink: 0;
}

.drawer-class-change-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFFFFF;
  color: #159D98;
  border: 1.5px solid rgba(21, 157, 152, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(21, 157, 152, 0.1);
}

.drawer-class-change-btn:hover {
  background: #159D98;
  color: #FFFFFF;
  border-color: #159D98;
}

/* ==========================================================================
   Laptop / Desktop View (>= 860px): Full Responsive Dashboard Layout
   ========================================================================== */
@media (min-width: 860px) {

  html:has(body.home-body),
  html.home-html {
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  body.home-body {
    background: #c5cec8 !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: clamp(10px, 1.8vh, 18px) clamp(12px, 1.8vw, 24px) !important;
    box-sizing: border-box !important;
  }

  .home-app-shell {
    --topbar-clearance: calc(clamp(16px, 2vh, 22px) + 86px);
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    max-height: calc(100dvh - clamp(20px, 3.6vh, 36px)) !important;
    margin: 0 auto !important;
    background: #faf7f0 !important;
    border-radius: clamp(20px, 2.5vh, 28px) !important;
    box-shadow: 0 18px 48px rgba(32, 48, 71, 0.16), 0 2px 8px rgba(32, 48, 71, 0.06) !important;
    border: 1px solid rgba(32, 48, 71, 0.14) !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    grid-template-columns: minmax(0, 1fr) !important;
    overflow: hidden !important;
    position: relative !important;
  }

  /* Header wrapper should not paint its own box over the scrolling page */
  .app-header-bar {
    display: contents !important;
  }

  /* 1. Desktop Topbar Header - floats over the scroll layer so only the pill covers content */
  .app-topbar {
    grid-row: 1 !important;
    grid-column: 1 !important;
    position: relative !important;
    top: 0 !important;
    z-index: 100 !important;
    align-self: start !important;
    background: #FFFFFF !important;
    border: 1.5px solid #d0d5db !important;
    border-radius: 20px !important;
    box-shadow: 0 2px 12px rgba(32, 48, 71, 0.04) !important;
    padding: 10px 22px !important;
    margin-top: clamp(16px, 2vh, 22px) !important;
    margin-left: clamp(32px, 3.8vw, 54px) !important;
    margin-right: calc(clamp(32px, 3.8vw, 54px) + var(--scrollbar-offset, 5px)) !important;
    margin-bottom: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
  }

  .brand-word {
    font-size: 24px !important;
    font-weight: 850 !important;
    letter-spacing: -0.035em !important;
    color: #151E28 !important;
  }

  .brand-olearno {
    display: inline !important;
  }

  .brand-spark {
    color: var(--teal) !important;
    font-weight: 850 !important;
  }

  .brand-sparkle {
    width: 18px !important;
    height: 18px !important;
    margin-left: -1px !important;
    margin-top: -8px !important;
  }

  /* 3. Desktop Student Profile Pill */
  .avatar-button {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    background: #FFFFFF !important;
    border: 1.5px solid #c5d0da !important;
    padding: 4px 12px 4px 5px !important;
    border-radius: 999px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03) !important;
    cursor: pointer !important;
    transition: border-color 0.18s ease, transform 0.18s ease !important;
  }

  .avatar-button:hover,
  .student-menu-wrap.is-open .avatar-button {
    border-color: #0D9488 !important;
    transform: translateY(-1px) !important;
  }

  .avatar-frame {
    width: 34px !important;
    height: 34px !important;
  }

  .avatar-meta-desktop {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    line-height: 1.15 !important;
  }

  .avatar-meta-name {
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #151E28 !important;
  }

  .avatar-meta-grade {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #0D9488 !important;
  }

  .avatar-chevron {
    display: block !important;
  }

  /* 4. Desktop Main Content Flow - fills the card and scrolls under the menu gutter */
  .app-main-content {
    grid-row: 1 / -1 !important;
    grid-column: 1 !important;
    position: relative !important;
    z-index: 1 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    align-self: stretch !important;
    background: transparent !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    scroll-behavior: smooth !important;
    padding-top: calc(var(--topbar-clearance) + 4px) !important;
    /* Hide only the strip behind the menu pill. Content stays visible up to the pill's bottom edge. */
    clip-path: inset(var(--content-clip-top, 88px) 0 0 0);
    padding-left: clamp(32px, 3.8vw, 54px) !important;
    padding-right: clamp(32px, 3.8vw, 54px) !important;
    padding-bottom: 40px !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(32, 48, 71, 0.2) transparent !important;
    -ms-overflow-style: auto !important;
  }

  .app-main-content::-webkit-scrollbar {
    display: block !important;
    width: 5px !important;
  }

  .app-main-content::-webkit-scrollbar-track {
    background: transparent !important;
    margin: 12px 3px 16px 0 !important;
  }

  .app-main-content::-webkit-scrollbar-thumb {
    background-color: rgba(32, 48, 71, 0.18) !important;
    border-radius: 999px !important;
    border: none !important;
    transition: background-color 0.2s ease !important;
  }

  .app-main-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(21, 157, 152, 0.7) !important;
  }

  .app-main-content::-webkit-scrollbar-thumb:active {
    background-color: #159D98 !important;
  }

  /* 5. Hero Row (Greeting + Unified Stats Card) */
  .home-hero-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: clamp(16px, 2.5vw, 36px) !important;
    margin-bottom: 22px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hero-greeting {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .hero-heading {
    font-size: clamp(26px, 2.6vw, 34px) !important;
    font-weight: 850 !important;
    letter-spacing: -0.035em !important;
    color: #151E28 !important;
    margin: 0 !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }

  .hero-subheading {
    font-size: clamp(13.5px, 1.2vw, 16px) !important;
    font-weight: 500 !important;
    color: #3d5164 !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .gamify-stats-card {
    width: auto !important;
    max-width: max-content !important;
    flex: 0 0 auto !important;
    margin-left: auto !important;
    background: #FFFFFF !important;
    border: 1.5px solid #d5dce3 !important;
    border-radius: 18px !important;
    padding: 8px 18px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 14px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .gamify-stat-item {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 4px 6px !important;
    cursor: pointer !important;
  }

  .gamify-stat-icon svg {
    width: 24px !important;
    height: 24px !important;
  }

  .goal-ring-svg {
    width: 24px !important;
    height: 24px !important;
  }

  .gamify-value {
    font-size: 15px !important;
    font-weight: 850 !important;
    color: #151E28 !important;
    white-space: nowrap !important;
  }

  .gamify-label {
    font-size: 9px !important;
    font-weight: 750 !important;
    color: #8E9CA8 !important;
    letter-spacing: 0.05em !important;
    white-space: nowrap !important;
  }

  .gamify-divider {
    width: 1px !important;
    height: 28px !important;
    background: #E5E7EB !important;
    flex-shrink: 0 !important;
  }

  /* 6. Continue Learning Banner Card */
  .continue-banner-card {
    background: linear-gradient(135deg, #b6e6de 0%, #a4ddd4 100%) !important;
    border: 1.5px solid #86cfc4 !important;
    border-radius: 22px !important;
    padding: 24px 34px !important;
    margin-bottom: 28px !important;
    position: relative !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 30px !important;
    min-height: 168px !important;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.06) !important;
  }

  .continue-banner-art {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    z-index: 2 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
  }

  .continue-thumb-frame {
    width: 170px !important;
    height: 125px !important;
    border-radius: 16px !important;
    background: #FAF7F0 !important;
    border: 1.5px solid #CFECE7 !important;
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    position: relative !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.22s ease, box-shadow 0.22s ease !important;
  }

  .continue-thumb-frame:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 12px 28px rgba(13, 148, 136, 0.18), 0 4px 10px rgba(0, 0, 0, 0.06) !important;
  }

  .continue-lesson-thumb {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    padding: 6px !important;
    background: #FAF7F0 !important;
  }

  .continue-banner-content {
    position: relative !important;
    z-index: 2 !important;
    flex: 1 !important;
    max-width: 480px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .continue-eyebrow {
    font-size: 11.5px !important;
    font-weight: 850 !important;
    letter-spacing: 0.08em !important;
    color: #0D9488 !important;
    margin-bottom: 8px !important;
  }

  .continue-title {
    font-size: 34px !important;
    font-weight: 850 !important;
    letter-spacing: -0.035em !important;
    color: #151E28 !important;
    margin: 0 0 6px 0 !important;
    line-height: 1.15 !important;
  }

  .continue-subtitle {
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #3d5164 !important;
    margin: 0 0 16px 0 !important;
  }

  .continue-progress-block {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .continue-progress-track {
    width: 220px !important;
    height: 7.5px !important;
    background: #CFECE7 !important;
  }

  .continue-progress-fill {
    background: #0D9488 !important;
  }

  .continue-banner-action {
    position: relative !important;
    z-index: 2 !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  .resume-hero-btn {
    font-size: 15px !important;
    padding: 12px 26px !important;
    border-radius: 999px !important;
  }

  /* 7. Explore Section Header & Controls */
  .explore-subjects-section {
    margin-bottom: 28px !important;
    width: 100% !important;
  }

  .explore-section-header {
    margin-bottom: 14px !important;
  }

  .explore-section-title {
    font-size: 26px !important;
    font-weight: 850 !important;
    letter-spacing: -0.03em !important;
    color: #151E28 !important;
  }

  .explore-controls-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    margin-bottom: 20px !important;
  }

  .filter-pills-wrap {
    gap: 10px !important;
  }

  .filter-pill-tab {
    font-size: 14px !important;
    padding: 7px 22px !important;
  }

  .explore-search-wrap {
    width: 340px !important;
  }

  .explore-search-input {
    font-size: 14px !important;
    padding: 10px 18px 10px 40px !important;
  }

  /* Instant Search Results Box */
  .instant-results-container {
    padding: 20px 24px !important;
    border-radius: 20px !important;
    margin-bottom: 24px !important;
  }

  .instant-results-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    max-height: 400px !important;
  }

  /* 8. 4 Subjects Grid - 4 Columns */
  .subjects-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    margin-bottom: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .subject-card {
    min-height: 220px !important;
    padding: 20px 18px 18px !important;
    border-radius: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: stretch !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .subject-card-art {
    height: 120px !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .subject-art-img {
    height: 100% !important;
    max-height: 120px !important;
    max-width: 100% !important;
    object-fit: contain !important;
    mix-blend-mode: multiply !important;
  }

  .subject-card-footer {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-top: auto !important;
    box-sizing: border-box !important;
  }

  .subject-card-text {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    text-align: left !important;
  }

  .subject-title {
    font-size: 18px !important;
    font-weight: 850 !important;
    letter-spacing: -0.02em !important;
    color: #151E28 !important;
    margin: 0 !important;
    line-height: 1.15 !important;
  }

  .subject-sub {
    font-size: 13px !important;
    font-weight: 550 !important;
    color: #3d5164 !important;
    line-height: 1.2 !important;
  }

  .subject-circle-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .subjects-footer-hint {
    margin-top: 14px !important;
    font-size: 13.5px !important;
  }

  /* 9. Science Curriculum Detailed View */
  .curriculum-drawer-view {
    border-radius: 28px !important;
    padding: 32px 36px !important;
    margin-top: 24px !important;
    box-shadow: 0 10px 40px rgba(32, 48, 71, 0.08) !important;
  }

  .curriculum-view-header {
    margin-bottom: 22px !important;
    padding-bottom: 16px !important;
  }

  .back-link-btn {
    font-size: 14.5px !important;
    padding: 6px 12px !important;
  }

  .curriculum-view-tag {
    font-size: 13.5px !important;
  }

  .chapter-feature-card {
    padding: 26px 32px !important;
    border-radius: 22px !important;
    margin-bottom: 24px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 28px !important;
  }

  .chapter-feature-top {
    flex: 1 !important;
  }

  .chapter-feature-title {
    font-size: 26px !important;
    margin-bottom: 8px !important;
  }

  .chapter-feature-desc {
    font-size: 14px !important;
    margin-bottom: 0 !important;
    max-width: 680px !important;
  }

  .chapter-feature-stats {
    flex-shrink: 0 !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .feat-stat-pill {
    font-size: 12px !important;
    padding: 5px 14px !important;
    text-align: center !important;
  }

  .curriculum-filter-bar {
    grid-template-columns: 280px 280px !important;
    gap: 16px !important;
    margin-bottom: 20px !important;
  }

  .custom-select-wrap select {
    font-size: 13.5px !important;
    padding: 10px 32px 10px 14px !important;
    border-radius: 12px !important;
  }

  .topic-chips-scroll {
    gap: 8px !important;
    margin-bottom: 26px !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
  }

  .topic-chip {
    font-size: 13px !important;
    padding: 7px 16px !important;
    border-radius: 20px !important;
  }

  /* 10. Multi-Column Responsive Grid for Lessons */
  .topic-section {
    margin-bottom: 34px !important;
  }

  .topic-section-header {
    margin-bottom: 16px !important;
    padding-bottom: 8px !important;
  }

  .topic-section-title h3 {
    font-size: 18.5px !important;
  }

  .cards-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)) !important;
    gap: 16px !important;
  }

  .lesson-card {
    padding: 14px 16px !important;
    border-radius: 20px !important;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
  }

  .lesson-card:hover {
    transform: translateY(-3px) !important;
    border-color: #159D98 !important;
    box-shadow: 0 8px 24px rgba(21, 157, 152, 0.12) !important;
  }

  .card-thumb-wrap {
    width: 96px !important;
    height: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
    border-radius: 14px !important;
  }

  .card-title {
    font-size: 15.5px !important;
  }

  .card-meta-text {
    font-size: 12.5px !important;
  }

  /* 11. Modals on Laptop: Centered Dialogs instead of Bottom Sheets */
  .app-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
    padding: 24px !important;
  }

  .app-modal-sheet {
    max-width: 520px !important;
    border-radius: 26px !important;
    padding: 26px 28px !important;
    box-shadow: 0 24px 70px rgba(32, 48, 71, 0.22) !important;
    animation: popModalDesktop 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  @keyframes popModalDesktop {
    from {
      opacity: 0;
      transform: scale(0.94) translateY(8px);
    }

    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  /* 12. Desktop Toast Notification */
  .app-toast {
    position: fixed !important;
    bottom: 32px !important;
    max-width: 480px !important;
  }
}

/* ==========================================================================
   Game Slide Player (Full-stage canvas + slide chrome)
   ========================================================================== */
.game-player-body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}

.game-player {
  background: var(--paper);
  width: 100%;
  max-width: 1200px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(8px, 1.6vh, 16px) clamp(14px, 3vw, 28px) max(8px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.game-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

/* Bottom Action Bar (Docked in stage flex flow - impossible to overlap grid) */
.game-bottom-card {
  flex-shrink: 0;
  width: auto;
  max-width: min(94%, 580px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 228, 223, 0.9);
  border-radius: 20px;
  padding: 8px 18px;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(32, 48, 71, 0.08);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  position: relative;
}

.game-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.game-chips-label {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-chips-strip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-chip {
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.game-chip:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.game-chip.is-on,
.factor-house-chip.is-house-active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
  box-shadow: 0 4px 12px rgba(21, 157, 152, 0.35);
}

.game-chip.is-off {
  background: #fef2f2;
  color: #dc2626;
  border-color: #f87171;
}

.game-chip.is-unused {
  background: var(--surface);
  color: var(--ink);
}

.game-chip-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  margin-top: 1px;
}

.game-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-check-btn {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  border: 0;
  background: var(--teal);
  color: white;
  font-size: 16px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(21, 157, 152, 0.3);
  transition: all 0.15s ease;
}

.game-check-btn:hover {
  background: #12837f;
  transform: translateY(-1px);
}

.game-check-btn.is-success {
  background: #059669;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
}

.game-check-btn.is-miss {
  animation: sdMiss 0.35s ease;
  background: #dc2626;
}

.game-feedback-text {
  font-size: 13px;
  font-weight: 650;
  margin: 0;
  text-align: center;
}

.game-feedback-text.is-success {
  color: #059669;
}

.game-feedback-text.is-miss {
  color: #dc2626;
}

/* Factor stamp stack */
.game-factor-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f4f6f2;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 750;
  color: var(--ink);
  min-height: 38px;
}

.game-undo-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.game-undo-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ==========================================================================
   Native DOM District Grid
   ========================================================================== */
.district-grid-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  box-sizing: border-box;
  overflow: hidden;
}

.district-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), var(--cell-size, 48px));
  grid-template-rows: repeat(var(--rows, 6), var(--cell-size, 48px));
  gap: var(--gap, 8px);
  width: fit-content;
  height: fit-content;
  margin: auto;
  justify-content: center;
  align-content: center;
  box-sizing: border-box;
}

.lot-tile {
  width: var(--cell-size, 48px);
  height: var(--cell-size, 48px);
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: clamp(10px, calc(var(--cell-size, 48px) * 0.28), 18px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(13px, calc(var(--cell-size, 48px) * 0.38), 22px);
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 8px rgba(32, 48, 71, 0.05);
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.lot-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(21, 157, 152, 0.5);
  box-shadow: 0 6px 16px rgba(32, 48, 71, 0.08);
}

.lot-tile.is-lit {
  background: #8ed8ce;
  border-color: var(--teal);
  color: #0d6e6a;
  box-shadow: 0 4px 16px rgba(21, 157, 152, 0.25);
  transform: scale(1.02);
}

.lot-tile.is-double {
  background: #fef3c7;
  border-color: #f3a34a;
  color: #80601d;
  box-shadow: 0 3px 12px #bd943a18;
  transform: scale(1.03);
}

.lot-tile.is-darkened {
  background: #f1f3ef;
  border-color: #dbe0d7;
  color: #9ca3af;
  box-shadow: none;
  opacity: 0.65;
}

.lot-tile.target-light {
  border: 2.5px solid var(--teal);
}

.lot-tile.target-double {
  border: 2.5px solid var(--orange);
}

.lot-tile.is-marked {
  border: 3px solid #059669;
  box-shadow: 0 0 16px rgba(5, 150, 105, 0.3);
}

.lot-tile.victory-pulse {
  animation: tileVictory 0.6s ease;
}

.number-zone-heading {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  padding: 14px 16px 0;
  color: #7050a0;
  font-size: 13px;
}

.number-zone-heading span,
.number-zone-hint {
  font-size: 11px;
  color: var(--muted);
}

.number-zone-hint {
  margin: 2px 0;
  text-align: center;
}

.number-readout {
  flex-shrink: 0;
  max-width: 92%;
  max-height: 72px;
  overflow-y: auto;
  margin: 0 auto 12px;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: #7050a0;
}

.lot-tile {
  position: relative;
}

.lot-number {
  position: relative;
  z-index: 1;
  top: 17%;
  font-size: clamp(12px, calc(var(--cell-size, 48px) * .30), 19px);
}

.lot-bird {
  position: absolute;
  top: 3px;
  left: 25%;
  width: 50%;
  line-height: 0;
  pointer-events: none;
  transform-origin: center bottom;
}

.lot-bird svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

@media (max-width: 600px) {
  .lot-number {
    top: 24%;
    font-size: clamp(10px, calc(var(--cell-size, 48px) * .27), 15px);
    line-height: 1;
  }

  .lot-bird {
    top: 1px;
    left: 17.5%;
    width: 65%;
  }
}

.bird-outline {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  opacity: 1;
}

.tutorial-intro {
  width: min(420px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 32px 24px 26px;
  border: 1px solid #e5dce9;
  border-radius: 24px;
  background: #faf7f0;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 16px 60px #20304730;
}

.tutorial-intro::backdrop {
  background: #20304780;
}

.tutorial-match-examples {
  display: flex;
  justify-content: center;
  gap: 38px;
}

.tutorial-match-example {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tutorial-example-tile {
  width: 88px;
  height: 88px;
  box-sizing: border-box;
  border: 3px solid #159d98;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tutorial-example-tile svg {
  width: 46px;
  height: 36px;
  overflow: visible;
}

.tutorial-example-tile strong {
  font-size: 25px;
  line-height: 1;
}

.example-matched {
  background: #8ed8ce;
  color: #087d78;
}

.example-mismatched {
  background: #fff0f0;
  color: #b42323;
}

.tutorial-match-mark {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.mark-correct {
  color: #087d78;
}

.mark-wrong {
  color: #dc4545;
}

.tutorial-intro h2 {
  margin: 22px 0 10px;
  font-size: 26px;
  letter-spacing: -.03em;
}

.tutorial-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.tutorial-intro .nest-next-level {
  margin-top: 22px;
}

.tutorial-visual-message {
  width: min(480px, calc(100vw - 32px));
}

.tutorial-visual-message h2 {
  margin-top: 0;
}

.tutorial-number-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.tutorial-source-number {
  display: grid;
  place-items: center;
  width: 52px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 14px;
  background: #eee5f8;
  border: 2px solid #7050a0;
  color: #7050a0;
  font-size: 26px;
  font-weight: 800;
}

.tutorial-flow-arrow {
  font-size: 24px;
  color: var(--muted);
}

.tutorial-target-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.tutorial-target-number {
  display: grid;
  place-items: center;
  width: 40px;
  height: 48px;
  border: 2px solid #159d98;
  border-radius: 10px;
  background: #8ed8ce;
  color: #087d78;
  font-size: 21px;
  font-weight: 750;
  transition: background .2s, color .2s, border-color .2s;
}

.tutorial-yellow-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.tutorial-yellow-sources {
  display: flex;
  justify-content: space-between;
  width: 160px;
  font-weight: 800;
  color: white;
}

.tutorial-yellow-sources span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 68px;
  border-radius: 12px;
  background: var(--teal);
  font-size: 28px;
}

.tutorial-yellow-arrows {
  width: 160px;
  height: 55px;
  fill: none;
  stroke: var(--teal);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutorial-yellow-demo .tutorial-yellow-number {
  width: 64px;
  height: 68px;
  font-size: 28px;
}

.tutorial-yellow-demo p {
  margin: 0;
  font-size: 13px;
}

[data-demo-state="on"] .tutorial-yellow-number {
  background: #fff0c2;
  border-color: #f3a34a;
  color: #9b5c0a;
}

[data-demo-state="off"] .tutorial-target-number {
  background: #fff0f0;
  border-color: #dc4545;
  color: #b42323;
}

[data-demo-state="neutral"] .tutorial-target-number {
  background: white;
  border-color: #a1aab3;
  color: #59616b;
}

.tutorial-demo-switch {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.tutorial-demo-switch button {
  padding: 10px 12px;
  border: 1px solid #dce2e5;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.tutorial-demo-switch button[aria-pressed="true"] {
  outline: 2px solid #7050a0;
  outline-offset: 2px;
}

.tutorial-demo-switch button:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.tutorial-health-story {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  margin: 24px 0;
}

.tutorial-health-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tutorial-health-tile {
  width: 65px;
  height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid #159d98;
  border-radius: 12px;
}

.tutorial-health-tile svg {
  width: 40px;
  height: 32px;
  overflow: visible;
}

.tutorial-health-tile strong {
  font-size: 20px;
}

.health-match {
  background: #8ed8ce;
}

.tutorial-health-arrow {
  margin-top: 25px;
  color: var(--muted);
}

.tutorial-health-step small {
  font-size: 10px;
  white-space: nowrap;
}

@media (max-width: 400px) {
  .tutorial-health-tile {
    width: 50px;
    height: 66px;
  }

  .tutorial-health-story {
    gap: 3px;
  }

  .tutorial-target-number {
    width: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-target-number {
    transition: none;
  }
}

.lot-tile[data-health="0"] .lot-bird {
  animation: birdFall .65s ease-in forwards;
}

@keyframes birdFall {
  to {
    transform: translateY(14px) rotate(65deg);
    opacity: .25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lot-tile[data-health="0"] .lot-bird {
    animation: none;
    opacity: .25;
  }
}

.bird-light {
  color: #159d98;
}

.bird-double {
  color: #f3a34a;
}

.bird-dark {
  color: #7b8792;
}

.lot-tile.bird-mismatch .lot-bird {
  animation: birdShake .38s ease;
}

.lot-tile.bird-mismatch[data-health="0"] .lot-bird {
  animation: birdFall .65s ease-in forwards;
}

@keyframes birdShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-4px) rotate(-3deg);
  }

  40%,
  80% {
    transform: translateX(4px) rotate(3deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lot-tile.bird-mismatch .lot-bird {
    animation: birdPulse .38s ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lot-tile.bird-mismatch[data-health="0"] .lot-bird {
    animation: none;
    opacity: .25;
  }
}

@keyframes birdPulse {
  50% {
    opacity: .6;
  }
}

.lot-tile:focus-visible {
  outline: 3px solid #7050a0;
  outline-offset: 3px;
}

.game-controls-row,
.game-chips-strip {
  flex-wrap: wrap;
}

.factor-house-label {
  color: #7050a0;
}

.factor-house-chip {
  border-color: #cbb7df;
  background: #f7f2fc;
  color: #7050a0;
}

.game-chip:has(.number-switch) {
  min-width: 62px;
  height: 64px;
  gap: 7px;
  padding: 7px 9px;
}

.number-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 40px;
  height: 18px;
  border-radius: 20px;
  background: #e2e7e9;
  box-shadow: inset 0 1px 3px #20304725;
}

.switch-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px #20304735;
  transition: left .18s ease, background .18s ease;
  pointer-events: none;
}

.switch-symbol {
  color: #526273;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  flex: 1;
  height: 100%;
  display: grid;
  place-items: center;
}

.number-switch::before {
  content: '';
  position: absolute;
  inset: -7px 0;
}

.beacon-switch .switch-thumb {
  width: 12px;
  height: 12px;
  top: 3px;
  left: 14px;
}

.is-on .beacon-switch,
.is-house-active .house-switch {
  background: #086f6b;
}

.is-on .beacon-switch .switch-thumb {
  left: 26px;
}

.is-on .switch-symbol,
.is-house-active .house-switch .switch-symbol {
  color: #d7fffa;
}

.is-off .beacon-switch {
  background: #fbcaca;
}

.is-off .beacon-switch .switch-thumb {
  left: 2px;
  background: #dc2626;
}

.house-switch .switch-thumb {
  width: 12px;
  height: 12px;
  top: 3px;
  left: 14px;
}

.is-house-active .house-switch .switch-thumb {
  left: 26px;
}

.factor-house-chip.is-house-off {
  background: #fef2f2;
  color: #dc2626;
  border-color: #f87171;
}

.is-house-off .house-switch {
  background: #fbcaca;
}

.is-house-off .house-switch .switch-thumb {
  left: 2px;
  background: #dc2626;
}

.game-chip:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .switch-thumb {
    transition: none;
  }
}

.game-challenge-prompt {
  flex-shrink: 0;
  max-width: 92%;
  margin: 8px auto 0;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--ink);
}

.numero-nesto-title {
  flex-shrink: 0;
  margin: 18px 0 0;
  color: var(--ink);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -.04em;
}

.nest-scoreboard {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  flex-shrink: 0;
  margin: 12px 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.nest-points-badge,
.nest-lives-badge {
  min-height: 64px;
  border-radius: 18px;
  padding: 10px 16px;
  border: 1px solid #e5dce9;
  box-shadow: 0 4px 0 #e9e1eb, 0 8px 18px #20304706;
}

.nest-points-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 116px;
  background: linear-gradient(145deg, #fffaf0, #fff0d1);
  border-color: #efdab0;
  box-shadow: 0 4px 0 #ecddba, 0 8px 18px #20304706;
}

.nest-score-star {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #ad7418;
  font-size: 27px;
  background: #ffdf8c;
  box-shadow: inset 0 2px 0 #fff5c1;
  transform: rotate(-8deg);
}

.nest-hud-label {
  display: block;
  margin-bottom: 4px;
  color: #887491;
  font-size: 9px;
  line-height: 1;
  letter-spacing: .13em;
  font-weight: 800;
  text-transform: uppercase;
}

.nest-points-badge .nest-hud-label {
  color: #96762f;
}

.nest-points-badge {
  justify-content: center;
  text-align: center;
}

.nest-scoreboard strong {
  display: block;
  color: #745219;
  font-size: 25px;
  line-height: 1;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.nest-lives-badge {
  background: linear-gradient(145deg, #fff, #f8f0fa);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#livesDisplay {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nest-heart {
  width: 24px;
  height: 25px;
  display: grid;
  place-items: center;
}

.nest-heart svg {
  width: 23px;
  height: 23px;
  overflow: visible;
}

.nest-heart.is-full svg {
  filter: drop-shadow(0 2px 1px #b52b6340);
}

.heart-body {
  stroke: #bc4271;
  stroke-width: .7;
}

.is-empty .heart-body {
  stroke: #c9bbd0;
}

.is-empty .heart-gloss,
.is-empty .heart-spark {
  opacity: .25;
}

.heart-converting {
  opacity: .2;
  transition: opacity .2s;
}

.nest-heart.is-empty svg {
  fill: #ece4ee;
  stroke: #c9bbd0;
  stroke-width: 1.2;
}

@media (max-width: 380px) {
  .nest-scoreboard {
    gap: 8px;
  }

  .nest-points-badge,
  .nest-lives-badge {
    padding: 9px 12px;
  }

  .nest-heart {
    width: 20px;
  }

  .nest-heart svg {
    width: 19px;
  }
}

.game-stage.nest-winning {
  box-shadow: inset 0 0 0 2px #159d9840;
}

.nest-celebration {
  flex-shrink: 0;
  text-align: center;
  padding: 10px 16px 18px;
  animation: nestCongrats .4s ease both;
}

.nest-congratulations {
  flex-shrink: 0;
  margin: 8px 0 12px;
  text-align: center;
  font-size: 24px;
  color: var(--ink);
}

.nest-congratulations[hidden] {
  display: none;
}

.nest-level-label {
  flex-shrink: 0;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.game-player .topbar {
  gap: 10px;
}

.nest-menu-heading {
  flex: 1;
  min-width: 0;
}

.game-player .topbar .numero-nesto-title {
  overflow-wrap: anywhere;
}

.game-stage>.nest-scoreboard {
  margin: 10px 0 6px;
}

.game-stage>.nest-scoreboard .nest-points-badge {
  padding: 6px 12px;
}

.game-stage>.nest-scoreboard strong {
  font-size: 20px;
}

.game-stage #pointsBadge {
  min-height: 40px;
  min-width: 110px;
  padding: 7px 12px;
  gap: 9px;
  border-radius: 12px;
  background: #fff;
  border-color: #d9e8e3;
  box-shadow: 0 2px 8px #20304706;
}

.game-stage #pointsBadge>div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.game-stage #pointsBadge .nest-hud-label {
  margin: 0;
  color: #64817c;
  font-size: 10px;
  letter-spacing: .06em;
}

.game-stage #pointsBadge strong {
  color: #116e68;
  font-size: 21px;
  font-weight: 800;
}

.game-stage #pointsBadge .nest-score-star {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #e8f5ef;
  color: #159d98;
  font-size: 20px;
  box-shadow: none;
  transform: none;
}

.game-bottom-card .nest-level-control .nest-level-badge:not(:disabled):hover {
  background: #3c6635;
  border-color: #3c6635;
}

.game-player .game-bottom-card .nest-level-control {
  flex-basis: calc(100% + 36px);
  width: calc(100% + 36px);
  margin: 0 -18px -12px;
  display: flex;
  justify-content: center;
}

.nest-level-control .nest-level-badge {
  min-width: 96px;
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid #e2e4df;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  font: inherit;
  cursor: pointer;
  gap: 8px;
}

.nest-level-control .nest-level-badge>div {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.game-bottom-card .nest-level-control .nest-level-badge {
  width: 100%;
  min-height: 36px;
  border-width: 1px 0 0;
  border-radius: 0 0 19px 19px;
  background: #e5f2df;
  color: #38633a;
  border-color: #cfdfc5;
}

.nest-level-control .nest-hud-label {
  margin: 0;
  color: #38633a;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: none;
}

.nest-level-control strong {
  display: inline;
  font-size: 14px;
  color: #38633a;
  line-height: 1;
}

.nest-level-control strong[hidden] {
  display: none;
}

.nest-level-control #levelRound {
  color: #38633a;
}

.game-bottom-card .nest-level-control .nest-level-badge:not(:disabled) {
  background: #4c7d42;
  color: #fff;
  border-color: #4c7d42;
}

.nest-level-control .nest-level-badge:not(:disabled) .nest-hud-label {
  color: #fff;
}

.nest-level-control .nest-level-badge:disabled {
  opacity: 1;
  cursor: default;
}

.nest-level-arrow {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nest-level-badge:disabled .nest-level-arrow {
  display: none;
}

.nest-level-badge:not(:disabled) {
  border-color: var(--teal);
  box-shadow: none;
}

.nest-level-badge:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.nest-undo-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.nest-undo-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nest-undo-btn:disabled {
  opacity: .45;
  cursor: default;
}

.nest-undo-btn:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.game-player .topbar .numero-nesto-title {
  margin: 0;
  font-size: clamp(16px, 2.2vw, 23px);
}

.game-player .topbar .nest-level-label {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.game-player .topbar .nest-scoreboard {
  margin: 0;
}

.game-player .topbar .nest-level-badge {
  min-width: 64px;
}

#levelRound {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #96762f;
}

#levelRound[hidden] {
  display: none;
}

.game-player .topbar .nest-points-badge {
  padding: 6px 10px;
  gap: 6px;
}

.game-player .topbar .nest-scoreboard strong {
  font-size: 20px;
}

.game-player .topbar .nest-score-star {
  font-size: 20px;
}

@media (max-width: 520px) {
  .game-player .topbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .game-player .topbar .icon {
    width: 30px;
    height: 34px;
  }

  .game-player .topbar .nest-level-label {
    font-size: 10px;
  }

  .game-player .topbar .nest-points-badge {
    padding: 5px 7px;
  }

  .game-player .topbar .nest-score-star {
    display: none;
  }

  .game-player .topbar .nest-scoreboard strong {
    font-size: 17px;
  }

  .game-player .topbar .skip-tutorial-btn {
    order: 1;
    margin-left: auto;
  }
}

.nest-next-level {
  margin-top: 12px;
  padding: 6px 16px;
  border: 1px solid #0d847f;
  border-radius: 6px;
  background: var(--teal);
  color: white;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
  cursor: pointer;
}

.nest-next-level:hover {
  background: #128983;
}

.nest-next-level:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

#celebrationAchievement {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.nest-celebration>span {
  font-size: 36px;
  color: #f3a34a;
}

.nest-celebration h2 {
  margin: 8px 0;
  font-size: 25px;
  color: var(--ink);
}

.nest-celebration p {
  margin: 0;
  color: #7050a0;
  font-weight: 700;
}

.nest-win-effects {
  position: absolute;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
}

.nest-confetti {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 12px;
  border-radius: 2px;
  animation: nestConfetti .85s ease-in both;
}

@keyframes nestConfetti {
  to {
    top: 110%;
    transform: translateX(var(--drift)) rotate(520deg);
    opacity: .3;
  }
}

.nest-flying-heart {
  position: fixed;
  z-index: 40;
  animation: nestHeartFly .6s cubic-bezier(.4, 0, .2, 1) both;
}

@keyframes nestHeartFly {
  35% {
    transform: translate(calc(var(--heart-x) * .35), calc(var(--heart-y) - 24px)) scale(1.2);
  }

  to {
    transform: translate(var(--heart-x), var(--heart-y)) scale(.25);
    opacity: 0;
  }
}

.points-awarded {
  animation: nestScoreGlow .65s ease both;
}

@keyframes nestScoreGlow {
  45% {
    transform: scale(1.12);
    box-shadow: 0 0 0 4px #159d9820;
  }
}

@keyframes nestCongrats {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-stage.nest-winning .district-grid {
  outline: 2px solid #159d9840;
  outline-offset: 8px;
  border-radius: 12px;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .nest-confetti {
    display: none;
  }

  .nest-flying-heart {
    animation-name: birdPulse;
  }

  .points-awarded {
    animation: none;
    box-shadow: 0 0 0 4px #ffdc8270;
  }

  .nest-celebration {
    animation: none;
  }
}

.lot-tile:disabled,
.game-chip:disabled {
  cursor: default;
}

.game-player-body .lot-tile:disabled,
.game-player-body .game-chip:disabled {
  opacity: 1;
}

.game-status-accessible {
  margin: 6px 0;
  min-height: 20px;
  text-align: center;
}

#feedbackMsg {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.number-activation-dot {
  position: fixed;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px white, 0 0 12px currentColor;
  color: var(--teal);
  pointer-events: none;
  z-index: 1000;
}

.number-activation-dot.activation-off {
  background: #dc2626;
  color: #dc2626;
}

.number-activation-dot.activation-unused {
  background: #7b8792;
  color: #7b8792;
}

.tutorial-coach {
  flex-shrink: 0;
  width: min(90%, 580px);
  padding: 10px 14px;
  box-sizing: border-box;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.tutorial-coach[hidden] {
  display: none;
}

.tutorial-coach p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}

.tutorial-colours {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  font-weight: 700;
}

.tutorial-teal {
  color: #087d78;
}

.tutorial-gold {
  color: #956000;
}

.tutorial-grey {
  color: #59616b;
}

.tutorial-highlight {
  outline: 3px solid #159d98;
  outline-offset: 3px;
}

.game-player-body .bird-dark {
  color: #dc4545;
}

.skip-tutorial-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}

.skip-tutorial-btn[hidden] {
  display: none;
}

.game-player-body .bird-neutral {
  color: #7b8792;
}

.is-tutorial .lot-tile:disabled {
  opacity: 1;
}

.game-player-body .lot-tile[data-glow="dark"] {
  border-color: #edb5b5;
  opacity: 1;
}

.game-player-body .lot-tile[data-glow="dark"],
.game-player-body .health-mismatch {
  background: #fff0f0;
  color: #b42323;
}

.game-player-body .lot-tile.is-neutral {
  background: #fff;
  border-color: #dce2e5;
}

.game-player-body .lot-tile[data-bird-role="light"] {
  border-color: #159d98;
  border-width: 3px;
}

.game-player-body .lot-tile[data-bird-role="dark"] {
  border-color: #dc4545;
  border-width: 3px;
}

.game-player-body .lot-tile[data-bird-role="neutral"],
.game-player-body .lot-tile[data-bird-role="none"] {
  border: .5px solid rgba(32, 48, 71, .12);
  box-shadow: none;
}

.game-player-body .lot-tile[data-bird-role="double"] {
  border-color: #f3a34a;
  border-width: 3px;
}

.is-tutorial .game-bottom-card {
  margin-bottom: 42px;
}

.is-tutorial .game-controls-row[hidden] {
  display: none;
}

.number-switch[data-tutorial-point]::after {
  content: '\261D\FE0F';
  position: absolute;
  top: 19px;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  animation: tutorialFinger 1s ease-in-out infinite;
}

.number-switch[data-tutorial-point="on"]::after {
  content: '\1F448';
  left: 42px;
  top: -5px;
  animation-name: tutorialFingerHorizontal;
}

.number-switch[data-tutorial-point="off"]::after {
  content: '\1F449';
  right: 42px;
  top: -5px;
  animation-name: tutorialFingerHorizontal;
}

.number-switch[data-tutorial-point="unused"]::after {
  left: 50%;
  transform: translateX(-50%);
  animation-name: tutorialFingerMiddle;
}

@keyframes tutorialFinger {
  50% {
    transform: translateY(5px);
  }
}

@keyframes tutorialFingerHorizontal {
  50% {
    transform: translateX(3px);
  }
}

@keyframes tutorialFingerMiddle {
  50% {
    transform: translate(-50%, 5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .number-switch[data-tutorial-point]::after {
    animation: none;
  }
}

.game-player-body .game-bottom-card {
  max-width: min(94%, 800px);
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  padding: 12px 18px;
}

.game-player-body .game-controls-row {
  flex-direction: column;
  gap: 6px;
}

.game-player-body .game-controls-row.divisor-panel,
.game-player-body .game-controls-row.multiplier-panel {
  padding: 12px 14px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel-background);
}

.divisor-panel {
  --panel-background: #f0e8f8;
  --panel-border: #ddcbed;
  --panel-label: #67418c;
}

.multiplier-panel {
  --panel-background: #fbeadc;
  --panel-border: #efd0b5;
  --panel-label: #8b5029;
}

.game-player-body .game-controls-row .game-chips-label {
  color: var(--panel-label);
}

.game-player-body .game-controls-row[hidden] {
  display: none;
}

.game-player-body .game-chips-strip {
  justify-content: center;
}

.game-stage.nest-winning .number-switch[data-tutorial-point]::after {
  display: none;
}

.game-stage.nest-winning .tutorial-highlight {
  outline: none;
}

.game-player .topbar .nest-celebration {
  padding: 0;
  margin: 0;
  flex-shrink: 0;
}

.game-player .topbar .nest-celebration[hidden] {
  display: none;
}

.game-player .topbar .nest-next-level {
  margin: 0;
  padding: 8px 12px;
  max-width: 160px;
  font-size: 12px;
}

.game-bottom-card .nest-celebration {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.game-bottom-card .nest-celebration[hidden] {
  display: none;
}

.game-bottom-card .nest-celebration h2 {
  font-size: 20px;
  margin: 4px 0;
}

.game-bottom-card .nest-next-level {
  margin-top: 0;
}

.game-bottom-card .nest-next-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
}

.nest-next-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes tileVictory {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
    box-shadow: 0 0 24px rgba(21, 157, 152, 0.5);
  }

  100% {
    transform: scale(1);
  }
}

/* Page assemble: each region arrives in order, then returns to normal
   so hover transforms and fixed bars are not left transformed. */
@keyframes assembleIn {
  from {
    opacity: 0;
    translate: 0 18px;
  }

  to {
    opacity: 1;
    translate: none;
  }
}

.home-body .app-topbar,
.home-body .hero-greeting,
.home-body .gamify-stats-card,
.home-body .continue-banner-card,
.home-body .explore-subjects-section .explore-section-header,
.home-body .subject-card,
.home-body .games-section-header,
.home-body .game-catalog-card,
.player-body.assembled .topbar,
.player-body.assembled .heading,
.player-body.assembled .art,
.player-body.assembled .narrative-card,
.player-body.assembled .audio-row,
.player-body.assembled .action-row,
.player-body.assembled .next,
.player-body.assembled .laptop-shortcuts-hint {
  animation: assembleIn 0.52s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.player-body:not(.assembled) .topbar,
.player-body:not(.assembled) .heading,
.player-body:not(.assembled) .art,
.player-body:not(.assembled) .narrative-card,
.player-body:not(.assembled) .audio-row,
.player-body:not(.assembled) .action-row,
.player-body:not(.assembled) .next,
.player-body:not(.assembled) .laptop-shortcuts-hint {
  opacity: 0;
}

.home-body .app-topbar {
  animation-delay: 0.02s;
}

.home-body .hero-greeting {
  animation-delay: 0.1s;
}

.home-body .gamify-stats-card {
  animation-delay: 0.2s;
}

.home-body .continue-banner-card {
  animation-delay: 0.32s;
}

.home-body .explore-subjects-section .explore-section-header {
  animation-delay: 0.44s;
}

.home-body .subject-card:nth-child(1) {
  animation-delay: 0.54s;
}

.home-body .subject-card:nth-child(2) {
  animation-delay: 0.64s;
}

.home-body .subject-card:nth-child(3) {
  animation-delay: 0.74s;
}

.home-body .subject-card:nth-child(4) {
  animation-delay: 0.84s;
}

.home-body .games-section-header {
  animation-delay: 0.96s;
}

.home-body .game-catalog-card:nth-child(1) {
  animation-delay: 1.06s;
}

.home-body .game-catalog-card:nth-child(2) {
  animation-delay: 1.16s;
}

.home-body .game-catalog-card:nth-child(3) {
  animation-delay: 1.26s;
}

.home-body .game-catalog-card:nth-child(4) {
  animation-delay: 1.36s;
}

.player-body.assembled .topbar {
  animation-delay: 0.02s;
}

.player-body.assembled .heading {
  animation-delay: 0.12s;
}

.player-body.assembled .art {
  animation-delay: 0.24s;
}

.player-body.assembled .narrative-card {
  animation-delay: 0.38s;
}

.player-body.assembled .audio-row {
  animation-delay: 0.44s;
}

.player-body.assembled .action-row,
.player-body.assembled .next {
  animation-delay: 0.5s;
}

.player-body.assembled .laptop-shortcuts-hint {
  animation-delay: 0.6s;
}

/* ==========================================================================
   Lesson Completion Modal & End-of-Lesson Experience
   ========================================================================== */
.lesson-complete-drawer {
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1.8vh, 16px);
}

.lesson-complete-panel {
  max-width: 440px;
  width: 100%;
  max-height: min(92dvh, calc(100vh - 20px));
  border-radius: 24px !important;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(32, 48, 71, 0.28), 0 0 0 1px rgba(21, 157, 152, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: center;
  position: relative;
  animation: completePopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes completePopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.complete-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px 0;
  flex-shrink: 0;
}

.complete-body {
  padding: 0 clamp(16px, 4vw, 24px) clamp(14px, 2.2vh, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.complete-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.complete-badge-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(21, 157, 152, 0.16) 0%, rgba(243, 163, 74, 0.22) 100%);
  border: 2px solid rgba(21, 157, 152, 0.25);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(21, 157, 152, 0.18);
  animation: completeBadgeBounce 2.5s ease-in-out infinite alternate;
}

@keyframes completeBadgeBounce {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(-3px) scale(1.05);
  }
}

.complete-emoji {
  font-size: 24px;
  line-height: 1;
}

.complete-body .toc-grade {
  font-size: 10px;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.complete-heading {
  margin: 2px 0 clamp(4px, 1vh, 8px);
  font-size: clamp(15.5px, 3.6vw, 18px);
  line-height: 1.25;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.complete-next-card {
  width: 100%;
  background: linear-gradient(145deg, #ffffff 0%, #f4faf9 100%);
  border: 1.5px solid #d2e8e6;
  border-radius: 16px;
  padding: clamp(8px, 1.4vh, 12px) 14px;
  margin: 2px 0 clamp(8px, 1.6vh, 14px);
  text-align: center;
  box-shadow: 0 4px 14px rgba(32, 48, 71, 0.04);
  flex-shrink: 0;
}

.next-card-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.next-lesson-preview {
  width: 80px;
  height: 100px;
  max-height: 15vh;
  aspect-ratio: 4 / 5;
  margin: 0 auto clamp(4px, 0.8vh, 8px);
  border-radius: 10px;
  overflow: hidden;
  background: #FAF7F0;
  box-shadow: 0 3px 10px rgba(32, 48, 71, 0.08);
  border: 1.5px solid rgba(21, 157, 152, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.next-lesson-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.next-card-title {
  margin: 0;
  font-size: clamp(13.5px, 3vw, 15px);
  font-weight: 750;
  color: var(--ink);
  line-height: 1.25;
}

.next-card-prompt {
  display: none !important;
}

.complete-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto;
  position: sticky;
  bottom: 0;
  background: var(--paper);
  padding-top: 4px;
}

.complete-primary-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--teal) 0%, #0d7f7b 100%);
  color: white;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 750;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(21, 157, 152, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.complete-primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(21, 157, 152, 0.38);
}

.complete-primary-btn:active {
  transform: translateY(1px);
}

.complete-primary-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.complete-secondary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.complete-secondary-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.complete-secondary-btn:hover {
  background: #f6f8f7;
  border-color: #a4b3be;
}

.complete-secondary-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Last slide button accent styling: "Finish lesson" button with crisp white font */
.next.is-last-slide {
  background: var(--teal) !important;
  color: #ffffff !important;
  font-weight: 750 !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 16px rgba(21, 157, 152, 0.35) !important;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease !important;
}

.next.is-last-slide:hover {
  background: #11817c !important;
  color: #ffffff !important;
  box-shadow: 0 6px 20px rgba(21, 157, 152, 0.45) !important;
}

.next.is-last-slide #nextLabel,
.next.is-last-slide span {
  color: #ffffff !important;
}

.next.is-last-slide svg,
.next.is-last-slide .laptop-next-icon,
.next.is-last-slide .mobile-next-icon {
  stroke: #ffffff !important;
  color: #ffffff !important;
  stroke-width: 2.5 !important;
}

@media (max-width: 859px) {
  .next.is-last-slide {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 10px 20px !important;
    margin: 12px auto 0 !important;
    width: auto !important;
    font-size: 13.5px !important;
  }

  .next.is-last-slide .mobile-next-icon {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    stroke: #ffffff !important;
    stroke-width: 2.5 !important;
  }
}

.game-stage #pointsBadge .nest-hud-label[hidden] {
  display: none;
}

/* Subject Switcher Tabs in Curriculum View */
.subject-switcher-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 14px 2px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.subject-switcher-tabs::-webkit-scrollbar {
  display: none;
}

.subject-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  color: #4A5568;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.subject-switch-btn:hover {
  background: #F7FAFC;
  border-color: #CBD5E0;
  color: #2D3748;
}

.subject-switch-btn.active {
  background: #159D98;
  border-color: #159D98;
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(21, 157, 152, 0.25);
}


/* Slide navigation button styles (Back and Next buttons) */
.action-row {
  display: flex !important;
  align-items: center;
  gap: 12px;
}

.slide-nav-btn {
  display: inline-flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border-radius: 14px;
  font-family: inherit;
  font-size: clamp(12.5px, 1.4vh, 14px);
  font-weight: 750;
  line-height: 1;
  padding: clamp(8px, 1.2vh, 11px) clamp(16px, 1.8vw, 24px);
  min-height: 40px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.slide-nav-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Previous (Back) button styling */
.prev-btn {
  background: var(--paper, #FAF7F0);
  color: var(--ink, #203047);
  border: 1.5px solid rgba(32, 48, 71, 0.2);
  box-shadow: 0 2px 6px rgba(32, 48, 71, 0.06);
}

.prev-btn:hover:not(:disabled) {
  background: #ffffff;
  border-color: rgba(32, 48, 71, 0.4);
  box-shadow: 0 4px 12px rgba(32, 48, 71, 0.1);
  transform: translateX(-1px);
}

.prev-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.prev-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

/* Next button styling */
.next-btn {
  background: var(--teal, #159D98);
  color: #ffffff;
  border: 1.5px solid transparent;
  box-shadow: 0 4px 14px rgba(21, 157, 152, 0.28);
}

.next-btn:hover:not(:disabled) {
  background: #128782;
  transform: translateX(2px);
  box-shadow: 0 6px 18px rgba(21, 157, 152, 0.38);
  color: #ffffff;
}

.next-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.next-btn:disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.next-btn.is-last-slide {
  background: var(--teal, #159D98) !important;
  color: #ffffff !important;
}

@media (max-width: 859px) {
  .action-row {
    width: 100%;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 12px;
  }

  .action-row .status:empty {
    display: none;
  }

  .slide-nav-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 999px;
    gap: 0;
  }

  .slide-nav-btn #prevLabel,
  .slide-nav-btn #nextLabel {
    display: none;
  }
}


/* ==========================================================================
   Chapter Level & Dedicated Chapter Page Styles
   ========================================================================== */

/* Chapter Entry Card (Subject Level List View - container is static; action buttons are interactive) */
.chapter-entry-card {
  cursor: default;
}

.chapter-entry-card .chapter-card-header {
  cursor: default !important;
}

.chapter-entry-card .chapter-card-header:hover {
  background: #FFFFFF !important;
}

/* Subject Page Top Header */
.subject-page-top-header {
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #F1F5F9;
  margin-bottom: 8px;
}

.subject-main-heading {
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 900;
  color: #151E28;
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

/* ==========================================================================
   Segmented Pill Bar: Unified 3-Way Capsule Action Control
   ========================================================================== */

.chapter-card-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  padding: 16px 20px !important;
  background: #FFFFFF !important;
  border-radius: 18px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.chapter-card-top {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  min-width: 0;
}

.chapter-thumb-wrap {
  width: 86px;
  height: 62px;
  min-width: 86px;
  max-width: 86px;
  border-radius: 12px;
  background: #FAF7F0;
  border: 1.5px solid #E2E8F0;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.chapter-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chapter-branch-badge {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0369A1;
  background: #E0F2FE;
  padding: 2.5px 8px;
  border-radius: 6px;
  display: inline-block;
}

.chapter-title {
  font-size: 17px;
  font-weight: 850;
  color: #151E28;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

/* Three Separate Editorial Icon-Top / Text-Bottom Action Buttons */
.chapter-tile-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

.chapter-tile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 10px 8px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  background: #FFFFFF;
  color: #151E28;
  border: 1.5px solid #E5E7EB;
  border-bottom-width: 2.5px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  user-select: none;
  text-align: center;
  white-space: nowrap;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.tile-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.chapter-tile-btn:active {
  transform: translateY(1px);
  border-bottom-width: 1.5px;
}

/* 1. Lessons (Editorial Slate + Teal Accent) */
.chapter-tile-btn.tile-lessons.active {
  border-color: #D2EBE6;
  border-bottom-color: #0D9488;
}

.chapter-tile-btn.tile-lessons.active:hover {
  background: #F2FBF9;
  color: #0F766E;
  border-color: #5EEAD4;
  border-bottom-color: #0D9488;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.12);
}

/* 2. Flashcards (Editorial Slate + Indigo Accent) */
.chapter-tile-btn.tile-flashcards.active {
  border-color: #DCDFF9;
  border-bottom-color: #6366F1;
}

.chapter-tile-btn.tile-flashcards.active:hover {
  background: #F5F6FF;
  color: #4338CA;
  border-color: #A5B4FC;
  border-bottom-color: #6366F1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

/* 3. Practice (Editorial Slate + Terracotta-Amber Accent) */
.chapter-tile-btn.tile-practice.active {
  border-color: #F4DEC9;
  border-bottom-color: #EA580C;
}

.chapter-tile-btn.tile-practice.active:hover {
  background: #FFF8F3;
  color: #C2410C;
  border-color: #FDBA74;
  border-bottom-color: #EA580C;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.12);
}

.chapter-tile-btn.active:hover .tile-btn-icon {
  transform: translateY(-1px) scale(1.06);
}

/* Coming Soon Tile Button */
.chapter-tile-btn.coming {
  background: #FAF9F6;
  color: #6B7280;
  border-color: #E5E7EB;
  border-bottom-color: #D1D5DB;
  box-shadow: none;
  cursor: pointer;
}

.chapter-tile-btn.coming .tile-btn-icon svg {
  opacity: 0.45;
  filter: grayscale(0.8);
}

.chapter-tile-btn.coming:hover {
  background: #F3F4F6;
  color: #374151;
  border-color: #D1D5DB;
  transform: translateY(-1px);
}

/* Tablet & Mobile Responsive Stacked Layout */
@media (max-width: 879px) {
  .chapter-card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 15px 16px !important;
  }

  .chapter-card-top {
    width: 100% !important;
  }

  .chapter-tile-actions {
    grid-template-columns: repeat(3, 1fr) !important;
    width: 100% !important;
    gap: 8px !important;
  }
}

@media (max-width: 680px) {
  .chapter-card-header {
    padding: 14px !important;
    gap: 11px !important;
  }

  .chapter-card-top {
    gap: 12px !important;
  }

  .chapter-thumb-wrap {
    width: 74px !important;
    height: 54px !important;
    min-width: 74px !important;
    max-width: 74px !important;
  }

  .chapter-title {
    font-size: 15.5px !important;
    line-height: 1.3 !important;
  }

  .chapter-branch-badge {
    font-size: 10px !important;
    padding: 2px 7px !important;
  }

  .chapter-tile-actions {
    gap: 7px !important;
  }

  .chapter-tile-btn {
    padding: 9px 6px 7px !important;
    border-radius: 11px !important;
    font-size: 11.5px !important;
    gap: 4px !important;
  }

  .tile-btn-icon {
    width: 22px !important;
    height: 22px !important;
  }

  .tile-btn-icon svg {
    width: 19px !important;
    height: 19px !important;
  }
}

@media (max-width: 380px) {
  .chapter-tile-actions {
    gap: 5px !important;
  }

  .chapter-tile-btn {
    padding: 8px 4px 6px !important;
    font-size: 10.5px !important;
    gap: 4px !important;
  }

  .tile-btn-icon svg {
    width: 18px !important;
    height: 18px !important;
  }
}

.chapter-card-action {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.chapter-open-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  background: #F0FDF4;
  color: #166534;
  border: 1.5px solid #BBF7D0;
  transition: all 0.18s ease;
}

.chapter-open-pill.active {
  background: #E6F7F5;
  color: #0D9488;
  border-color: #B8E6DF;
}

.chapter-entry-card:hover .chapter-open-pill.active {
  background: #0D9488;
  color: #FFFFFF;
  border-color: #0D9488;
}

.chapter-entry-card:hover .chapter-open-pill:not(.active) {
  background: #1E293B;
  color: #FFFFFF;
  border-color: #1E293B;
}

/* Chapter Dedicated Page Layout & Styles */
.chapter-page-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 60px;
}

/* ==========================================================================
   CHAPTER PAGE DESIGN SYSTEM (Aligned with subject.html & index.html)
   ========================================================================== */

.chapter-page-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* 1. Chapter Page Header: Integrated editorial header cohesive with the white sheet */
.chapter-hero-banner {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid #E8ECE6;
  border-radius: 0;
  padding: 4px 0 18px;
  margin-bottom: 16px;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  flex-shrink: 0;
}

.chapter-banner-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1;
}

.chapter-banner-thumb-frame {
  width: 64px;
  height: 50px;
  min-width: 64px;
  border-radius: 12px;
  background: #FAF7F0;
  border: 1.5px solid #E2E8F0;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex-shrink: 0;
}

.chapter-banner-thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  display: block;
}

.chapter-banner-thumb-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(15, 23, 42, 0.85);
  color: #FFFFFF;
  font-size: 8px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.chapter-banner-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.chapter-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chapter-branch-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0369A1;
  background: #E0F2FE;
  padding: 2px 7px;
  border-radius: 6px;
}

.chapter-branch-badge.mode-lessons {
  color: #0F766E;
  background: #CCFBF1;
}

.chapter-branch-badge.mode-flashcards {
  color: #5B21B6;
  background: #EDE9FE;
}

.chapter-branch-badge.mode-practice {
  color: #B45309;
  background: #FEF3C7;
}

.chapter-status-pill {
  font-size: 10px;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 6px;
}

.chapter-status-pill.active {
  background: #DCFCE7;
  color: #15803D;
}

.chapter-status-pill.coming {
  background: #F1F5F9;
  color: #4A5D6E;
}

.chapter-banner-title {
  font-size: clamp(19px, 2.8vw, 24px);
  font-weight: 850;
  color: #151E28;
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.22;
}

.chapter-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chapter-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  font-size: 12.5px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.chapter-quick-btn.action-back {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
  background: #FFFFFF;
  border-color: #CBD5E1;
  color: #334155;
}

.chapter-quick-btn.action-back:hover {
  background: #F1F5F9;
  border-color: #0D9488;
  color: #0D9488;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.chapter-quick-btn.action-cards {
  border-color: #B8E6DF;
  color: #0D9488;
}

.chapter-quick-btn.action-cards:hover {
  background: #0D9488;
  border-color: #0D9488;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.25);
}

.chapter-quick-btn.action-practice {
  border-color: #FDE68A;
  color: #B45309;
}

.chapter-quick-btn.action-practice:hover {
  background: #D97706;
  border-color: #D97706;
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.25);
}

/* 2. Sections Stack: Lessons, Flashcards, Practice */
.chapter-sections-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 6px;
}

.chapter-page-section {
  scroll-margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chapter-section-title {
  font-size: clamp(20px, 2.5vw, 24px);
  font-weight: 850;
  color: #151E28;
  margin: 0 0 2px 0;
  letter-spacing: -0.02em;
}

/* 4. Lesson Accordion Cards (Elevated to match chapter-accordion-card quality) */
.topics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topic-accordion-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-accordion-card:hover {
  border-color: #B8E6DF;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.08);
}

.topic-accordion-card.is-expanded {
  border-color: #159D98;
  box-shadow: 0 4px 18px rgba(13, 148, 136, 0.1);
}

.topic-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  background: #FFFFFF;
  transition: background 0.15s ease;
}

.topic-card-header:hover {
  background: #FBFDFD;
}

.topic-thumb-frame {
  width: 58px;
  height: 44px;
  min-width: 58px;
  border-radius: 10px;
  background: #FAF7F0;
  border: 1.5px solid #CFECE7;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.topic-thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
  display: block;
}

.topic-thumb-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(15, 23, 42, 0.75);
  color: #FFFFFF;
  font-size: 8px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.topic-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topic-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-index-badge {
  font-size: 10.5px;
  font-weight: 800;
  color: #0D9488;
  background: #E6F7F5;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.topic-name {
  font-size: 15.5px;
  font-weight: 800;
  color: #151E28;
  margin: 0;
  line-height: 1.3;
}

.topic-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #4A5D6E;
  margin-top: 2px;
}

.topic-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.topic-meta-item svg {
  width: 13px;
  height: 13px;
  color: #0D9488;
}

.topic-meta-dot {
  color: #CBD5E1;
}

.topic-chevron-wrap {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  transition: transform 0.22s ease, background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.topic-accordion-card.is-expanded .topic-chevron-wrap {
  transform: rotate(180deg);
  background: #E6F7F5;
  color: #0D9488;
}

/* Sub-lessons Drawer */
.topic-lessons-collapse {
  display: none;
  padding: 12px 16px 14px 16px;
  background: #FAFBFB;
  border-top: 1.5px dashed #E2E8F0;
}

.topic-accordion-card:not(.is-expanded) .topic-lessons-collapse {
  display: none !important;
}

.topic-accordion-card.is-expanded .topic-lessons-collapse {
  display: block !important;
}

.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-item-card {
  background: #FFFFFF;
  border: 1.2px solid #E2E8F0;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.16s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  cursor: pointer;
}

.lesson-item-card:hover {
  border-color: #159D98;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(21, 157, 152, 0.08);
}

.lesson-thumb-frame {
  width: 44px;
  height: 36px;
  min-width: 44px;
  border-radius: 8px;
  background: #FAF7F0;
  border: 1px solid #CFECE7;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
  display: block;
}

.lesson-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sublesson-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sublesson-badge {
  font-size: 10px;
  font-weight: 800;
  color: #0D9488;
  background: #E6F7F5;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.lesson-name {
  font-size: 13.5px;
  font-weight: 750;
  color: #1E293B;
  margin: 0;
  line-height: 1.25;
}

.lesson-meta-line {
  font-size: 11.5px;
  font-weight: 500;
  color: #4A5D6E;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lesson-meta-line svg {
  color: #0D9488;
}

.lesson-action-col {
  flex-shrink: 0;
}

.lesson-play-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #159D98;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 750;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(21, 157, 152, 0.25);
}

.lesson-play-pill:hover {
  background: #0E7F7B;
  transform: scale(1.02);
}

.lesson-play-pill.resume {
  background: #EA580C;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.25);
}

.lesson-play-pill.resume:hover {
  background: #C2410C;
}

.lesson-preview-pill {
  display: inline-flex;
  align-items: center;
  background: #F1F5F9;
  color: #4A5D6E;
  border: 1px solid #CBD5E1;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lesson-preview-pill:hover {
  background: #E2E8F0;
  color: #1E293B;
}

/* 5. Flashcard Decks: High Quality Card Design */
.chapter-flashcard-decks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.flashcard-deck-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.flashcard-deck-card:hover {
  border-color: #A78BFA;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.12);
}

.flashcard-deck-art-wrap {
  width: 80px;
  height: 60px;
  min-width: 80px;
  border-radius: 10px;
  background: #FAF7F0;
  border: 1.5px solid #DDD6FE;
  box-shadow: 3px 3px 0 #EDE9FE;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.flashcard-deck-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.flashcard-deck-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.flashcard-deck-kicker-line {
  margin-bottom: 2px;
}

.flashcard-deck-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7C3AED;
}

.flashcard-deck-heading {
  font-size: 17.5px;
  font-weight: 850;
  color: #1E1B4B;
  margin: 0 0 3px;
  line-height: 1.25;
}

.flashcard-deck-summary {
  font-size: 12.5px;
  color: #4A5D6E;
  margin: 0;
  line-height: 1.4;
}

.flashcard-deck-action {
  flex-shrink: 0;
}

.flashcard-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.25);
  white-space: nowrap;
  transition: all 0.16s ease;
}

.flashcard-launch-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.35);
}

/* 6. Chapter Practice: High Quality Card Design */
.chapter-practice-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 20px;
  padding: 18px 22px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.2s ease;
}

.chapter-practice-card:hover {
  border-color: #FCD34D;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.12);
}

.practice-card-icon-wrap {
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1.5px solid #FCD34D;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #B45309;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.1);
}

.practice-card-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.practice-card-kicker-line {
  margin-bottom: 2px;
}

.practice-card-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #D97706;
}

.practice-card-heading {
  font-size: 17.5px;
  font-weight: 850;
  color: #1E293B;
  margin: 0 0 3px;
  line-height: 1.25;
}

.practice-card-summary {
  font-size: 12.5px;
  color: #4A5D6E;
  margin: 0;
  line-height: 1.4;
}

.practice-card-action {
  flex-shrink: 0;
}

.practice-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.25);
  white-space: nowrap;
  transition: all 0.16s ease;
}

.practice-start-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.35);
}

/* 7. Responsive Breakpoints */
@media (max-width: 680px) {
  .chapter-hero-banner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 2px 0 12px;
  }

  .chapter-banner-left {
    flex: 1;
    min-width: 0;
    gap: 12px;
  }

  .chapter-banner-thumb-frame {
    width: 52px;
    height: 42px;
    min-width: 52px;
  }

  .chapter-banner-actions {
    width: auto;
    flex-shrink: 0;
  }

  .chapter-quick-btn {
    flex: 0 0 auto;
    justify-content: center;
  }

  .flashcard-deck-card,
  .chapter-practice-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }

  .flashcard-deck-action,
  .practice-card-action {
    width: 100%;
  }

  .flashcard-launch-btn,
  .practice-start-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   Teacher Mode Toggle & Lesson Plan Card Styles
   ========================================================================== */

.topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.teacher-mode-toggle-wrap {
  display: inline-flex;
  align-items: center;
}

.teacher-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 1.5px solid #D5DEE7;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 750;
  color: #475569;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.18s ease;
  user-select: none;
}

.teacher-mode-btn:hover {
  border-color: #0D9488;
  color: #0F172A;
  transform: translateY(-1px);
}

.teacher-mode-btn.is-active {
  background: #F0FDF4;
  border-color: #10B981;
  color: #065F46;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.18);
}

.teacher-toggle-icon {
  display: inline-flex;
  align-items: center;
  color: #64748B;
}

.teacher-mode-btn.is-active .teacher-toggle-icon {
  color: #059669;
}

.teacher-toggle-switch {
  display: inline-flex;
  align-items: center;
  width: 28px;
  height: 16px;
  background: #CBD5E1;
  border-radius: 999px;
  padding: 2px;
  transition: background 0.2s ease;
  margin-left: 2px;
}

.teacher-toggle-thumb {
  width: 12px;
  height: 12px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(0);
}

.teacher-mode-btn.is-active .teacher-toggle-switch {
  background: #10B981;
}

.teacher-mode-btn.is-active .teacher-toggle-thumb {
  transform: translateX(12px);
}

/* Lesson Plan Tile on Subject Page Cards */
.chapter-tile-btn.tile-planner {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #334155;
}

.chapter-tile-btn.tile-planner:hover {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.15);
}

.chapter-tile-btn.tile-planner .tile-btn-icon {
  background: #DBEAFE;
  color: #2563EB;
}

/* Visibility rules when not in teacher mode */
body:not(.role-teacher) .teacher-only {
  display: none !important;
}

body.role-teacher .student-only {
  display: none !important;
}

/* Chapter Hero Planner Action */
.chapter-quick-btn.action-planner {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
}

.chapter-quick-btn.action-planner:hover {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #1E40AF;
  transform: translateY(-1px);
}