:root {
  color-scheme: light;
  --paper: #fbf8f2;
  --ink: #1e2029;
  --muted: #4a4d5e;
  --muted-light: #707386;
  --coral: #e65a3c;
  --coral-dark: #c24024;
  --coral-wash: #ffede6;
  --teal: #229c9a;
  --teal-dark: #156d6c;
  --teal-wash: #e5f6f4;
  --yellow: #f0a82d;
  --yellow-wash: #fff8e8;
  --green: #2e8b57;
  --green-wash: #e8f7ee;
  --line: #ded7ca;
  --line-strong: #c8bead;
  --white: #ffffff;
  --shadow: 0 8px 24px rgba(40, 32, 24, .06);
  --shadow-hover: 0 14px 34px rgba(40, 32, 24, .10);
  --round: 16px;

  /* Typography Scale - Điều chỉnh linh hoạt qua --font-scale, sắc nét từ xa */
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-scale: 1;
  --fs-title-main: calc(clamp(28px, 3.2vw, 36px) * var(--font-scale));  /* Tiêu đề màn hình chào */
  --fs-title: calc(clamp(22px, 2.4vw, 26px) * var(--font-scale));       /* Tiêu đề chặng & bản đồ */
  --fs-title-sub: calc(18.5px * var(--font-scale));                     /* Tiêu đề mục / thẻ */
  --fs-content-lg: calc(18.5px * var(--font-scale));                    /* Nội dung câu hỏi mở, quiz */
  --fs-content: calc(16.5px * var(--font-scale));                       /* Nội dung bài học, diễn giải */
  --fs-content-dense: calc(15.5px * var(--font-scale));                 /* Ô bảng so sánh, chú thích */
  --fs-tag: calc(13px * var(--font-scale));                             /* Nhãn, nút bấm phụ, gợi ý */

  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* Color Theme Palettes */
[data-theme="blue-amber"] {
  --coral: #2872e0;
  --coral-dark: #1952a8;
  --coral-wash: #eaf2ff;
  --teal: #e59218;
  --teal-dark: #b86f05;
  --teal-wash: #fdf5e7;
}

[data-theme="emerald-violet"] {
  --coral: #109868;
  --coral-dark: #0a6947;
  --coral-wash: #e6f7f0;
  --teal: #8243c2;
  --teal-dark: #5e2894;
  --teal-wash: #f3ecfb;
}

[data-theme="ruby-cyan"] {
  --coral: #d82b4b;
  --coral-dark: #a1142e;
  --coral-wash: #fdebee;
  --teal: #0896b0;
  --teal-dark: #056677;
  --teal-wash: #e5f6f9;
}

* { box-sizing: border-box; }

/* Desktop Presentation Base (Chuẩn 100vh không cuộn màn hình) */
html, body {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(215, 175, 125, .28) 1px, transparent 1px);
  background-size: 24px 24px;
  line-height: 1.45;
  font-size: 16px;
  touch-action: manipulation;
}

button, a, input, select, textarea { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Shortcut reminder spans */
.kbd-hint {
  display: inline;
  opacity: .85;
  font-weight: 700;
  margin-left: 2px;
}

/* Main Shell (Desktop 100vh) */
.site-shell {
  width: min(98%, 1380px);
  height: 100vh;
  max-height: 100vh;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 0 0 34px;
}

/* Topbar Header */
.topbar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
  border-bottom: 2px solid var(--line);
  padding: 0 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  min-width: 0;
}
.brand strong { color: var(--coral-dark); }
.brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--coral);
  border-radius: 9px;
  box-shadow: 0 2.5px 0 var(--coral-dark);
  transform: rotate(-3deg);
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }

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

.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font-size: var(--fs-tag);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.03);
  transition: all .16s ease;
  white-space: nowrap;
}
.topbar-action-btn:hover {
  background: #fdfaf6;
  border-color: var(--coral);
  color: var(--coral-dark);
  transform: translateY(-1px);
}
.topbar-action-btn.is-active {
  background: var(--coral-wash);
  border-color: var(--coral);
  color: var(--coral-dark);
}

.btn-editor {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-wash);
}
.btn-editor:hover {
  border-color: var(--teal-dark);
  color: var(--teal-dark);
}

.progress-pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 99px;
  padding: 5px 12px;
  color: var(--ink);
  background: var(--white);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: .2s ease;
  white-space: nowrap;
}
.progress-pill:hover {
  border-color: var(--yellow);
  transform: translateY(-1px);
}
.progress-star { color: var(--yellow); font-size: 15px; }

/* Travel Overlay */
.travel-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  background: radial-gradient(circle at center, #fff6da 0, #ffdf9d 48%, #ffbd7b 100%);
  pointer-events: none;
}
.travel-overlay.is-traveling { visibility: visible; opacity: 1; pointer-events: auto; }
.travel-core {
  position: relative;
  z-index: 2;
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  border: 7px solid #fff0c8;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 27%, #ffd886 0 9%, transparent 10%), linear-gradient(145deg, #ffad62, #f37c55 75%);
  box-shadow: inset -8px -10px 0 rgba(205, 85, 55, .12), 0 0 70px 18px rgba(243, 124, 85, .32);
  animation: enter-the-atom 1s cubic-bezier(.62,.02,.8,.48) both;
}
.travel-core .nucleus-face { transform: scale(1.15); }
.travel-orbit {
  position: absolute;
  z-index: 1;
  width: 260px;
  height: 110px;
  border: 4px solid rgba(255,255,255,.75);
  border-radius: 50%;
  animation: orbit-rush 1s cubic-bezier(.55,.05,.8,.4) both;
}
.travel-orbit-two {
  border-color: rgba(242, 128, 88, .5);
  transform: rotate(58deg);
  animation-delay: .04s;
}
.travel-caption {
  position: absolute;
  z-index: 3;
  bottom: 12%;
  left: 20px;
  right: 20px;
  margin: 0;
  color: #7c3b24;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}
.travel-glint { position: absolute; z-index: 3; top: 27%; left: 25%; color: #fff; font-size: 30px; animation: glint-away .75s ease both; }
.travel-glint-two { top: 62%; left: auto; right: 23%; color: #f18862; animation-delay: .08s; }

/* Main Views */
main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  animation: scene-in .30s cubic-bezier(.22,.8,.26,1) both;
}
.view.is-active { display: flex; flex-direction: column; justify-content: space-between; }
.view.is-leaving {
  display: flex;
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: scene-out .18s ease both;
}

@keyframes scene-in {
  from { opacity: 0; transform: translateY(8px) scale(.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes scene-out {
  to { opacity: 0; transform: translateY(-8px) scale(1.005); }
}

/* ==========================================================================
   1. LANDING VIEW (MÀN KHỞI ĐỘNG)
   ========================================================================== */
.landing-view {
  position: relative;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}
.landing-view.is-active,
.landing-view.is-leaving {
  display: flex;
  flex-direction: column;
}

.landing-decor {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  user-select: none;
}
.decor-star-one { top: 12%; left: 16%; color: var(--yellow); font-size: 24px; animation: twinkle 3s ease-in-out infinite; }
.decor-star-two { top: 18%; right: 18%; color: var(--teal); font-size: 20px; animation: twinkle 3.5s ease-in-out infinite 1s; }
.decor-dot-one { bottom: 20%; left: 22%; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); opacity: .4; }
.decor-dot-two { bottom: 24%; right: 22%; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); opacity: .4; }

.landing-content {
  position: relative;
  z-index: 2;
  width: min(840px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0;
  margin: auto 0;
}

.atom-stage { width: 120px; height: 120px; position: relative; display: grid; place-items: center; isolation: isolate; }
.atom-stage-large { width: 130px; height: 130px; margin-bottom: 2px; }
.atom-glow {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(246, 150, 81, .28);
  filter: blur(20px);
  z-index: -1;
  animation: glow 3.6s ease-in-out infinite;
}
.nucleus {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border: 4px solid #fff0c8;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 27%, #ffd886 0 9%, transparent 10%), linear-gradient(145deg, #ffad62, #f37c55 75%);
  box-shadow: inset -5px -6px 0 rgba(205, 85, 55, .12), 0 6px 18px rgba(217, 114, 65, .25);
}
.nucleus-large { width: 72px; height: 72px; border-width: 4px; }
.nucleus-face { width: 32px; height: 22px; position: relative; display: block; }
.nucleus-face i { position: absolute; top: 3px; width: 4.5px; height: 6.5px; background: #61362d; border-radius: 50%; }
.nucleus-face i:first-child { left: 5px; }
.nucleus-face i:nth-child(2) { right: 5px; }
.nucleus-face b { position: absolute; bottom: 3px; left: 50%; width: 12px; height: 6px; border-bottom: 2px solid #61362d; border-radius: 50%; transform: translateX(-50%); }

.orbit {
  position: absolute;
  inset: 12px -4px;
  border: 2px solid rgba(97, 184, 183, .65);
  border-radius: 50%;
  transform: rotate(-34deg);
  animation: orbit-wobble 6s ease-in-out infinite alternate;
}
.orbit-two { inset: 14px -2px; border-color: rgba(242, 133, 100, .65); transform: rotate(35deg); animation-delay: -.9s; }
.orbit-three { inset: 26px -14px; border-color: rgba(114, 174, 127, .68); transform: rotate(69deg); animation-delay: -1.7s; }
.orbit-electron {
  position: absolute;
  top: 50%;
  left: -6px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 2px 4px rgba(47, 66, 70, .2);
}
.electron-blue { background: #3fa5af; }
.electron-green { background: #7aa545; }
.electron-pink { background: #e06c85; }
.atom-twinkle { position: absolute; color: var(--yellow); font-size: 18px; animation: twinkle 2.4s ease-in-out infinite; }
.twinkle-a { top: 4px; right: 6px; }
.twinkle-b { bottom: 12px; left: 6px; color: #4aa3a7; font-size: 15px; animation-delay: -1.1s; }

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 6px;
  color: #8c5540;
  font-size: var(--fs-tag);
  font-weight: 800;
}
.eyebrow-line { width: 22px; height: 2px; background: #dfa88d; }

.landing-content h1 {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-title-main);
  font-weight: 900;
  line-height: 1.2;
}
.title-orange { color: var(--coral-dark); }
.title-blue { color: var(--teal-dark); }
.title-amp { color: var(--yellow); font-size: .92em; }

.warmup-card {
  margin: 10px auto 14px;
  padding: 12px 20px;
  max-width: min(680px, 90vw);
  border-radius: var(--round);
  border: 2px solid var(--line-strong);
  background: var(--white);
  box-shadow: var(--shadow);
  text-align: left;
}
.warmup-badge {
  display: inline-block;
  padding: 3px 10px;
  margin-bottom: 6px;
  border-radius: 99px;
  background: var(--yellow-wash);
  color: #92580a;
  font-size: 13px;
  font-weight: 800;
}
.warmup-card p {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-content-lg);
  font-weight: 600;
  line-height: 1.5;
}

.landing-btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(115deg, var(--coral), var(--coral-dark));
  box-shadow: 0 4px 0 var(--coral-dark), 0 8px 18px rgba(217, 99, 78, .22);
  font-size: 16.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all .16s ease;
}
.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--coral-dark), 0 12px 22px rgba(217, 99, 78, .28);
}
.primary-button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--coral-dark); }

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 20px;
  color: var(--ink);
  background: var(--white);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all .16s ease;
}
.secondary-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-wash);
  transform: translateY(-2px);
}

.landing-footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--fs-tag);
  font-weight: 700;
}
.footnote-icon { color: var(--yellow); }
.footnote-dot { color: var(--line-strong); font-size: 16px; }

.float-label {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, .96);
  border: 1.5px solid var(--line-strong);
  border-radius: 99px;
  box-shadow: 0 8px 24px rgba(40, 32, 24, .08);
  font-size: var(--fs-tag);
  font-weight: 700;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.float-label-left {
  left: 3%;
  top: 22%;
  animation: float-slow 4.5s ease-in-out infinite alternate;
}
.float-label-right {
  right: 3%;
  bottom: 22%;
  animation: float-slow 4.2s ease-in-out infinite alternate -2s;
}
.float-emoji { font-size: 22px; }

@media (max-width: 1200px) {
  .float-label { display: none !important; }
}

/* ==========================================================================
   2. MAP VIEW (BẢN ĐỒ CÁC CHẶNG BÀI HỌC)
   ========================================================================== */
.map-view {
  padding: 4px 0 2px;
  justify-content: space-between;
}

.map-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2px;
  flex-shrink: 0;
}
.map-heading .eyebrow { justify-content: flex-start; margin-bottom: 2px; }
.map-heading h2 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 800;
  line-height: 1.15;
}
.map-heading h2 span { color: var(--coral-dark); }
.section-copy {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
.map-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1.5px solid var(--line-strong);
  background: rgba(255, 255, 255, .9);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.map-scene {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 2px solid #bce1ce;
  border-radius: 20px;
  background: linear-gradient(180deg, #edf7f2 0%, #e6f3ec 55%, #daf0e4 100%);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(40, 32, 24, .06);
}

.world-landscape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.landscape-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.landscape-hill-back {
  fill: #d5eedb;
  opacity: .92;
}
.landscape-hill-front {
  fill: #c2e6cc;
  opacity: .96;
}

.map-trails {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.trail-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.trail-line.trail-metal {
  stroke: #e66a4e;
  stroke-dasharray: 6 5;
}

.trail-line.trail-nonmetal {
  stroke: #26a69a;
  stroke-dasharray: 6 5;
}

.trail-line.is-done {
  stroke: #2e8b57;
  stroke-width: 3.5;
  stroke-dasharray: none;
}

.route-card {
  position: absolute;
  z-index: 2;
  width: min(340px, 32vw);
  display: grid;
  grid-template-columns: 26px 42px 1fr 18px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-align: left;
  border: 2px solid var(--line-strong);
  border-bottom-width: 4px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(40, 32, 24, .06);
  cursor: pointer;
  transition: all .18s cubic-bezier(.2,.7,.2,1);
}
.route-card.route-metal { border-bottom-color: var(--coral); }
.route-card.route-nonmetal { border-bottom-color: var(--teal); }
.route-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 28px rgba(40, 32, 24, .12);
  border-color: var(--coral-dark);
}
.route-card.route-nonmetal:hover { border-color: var(--teal-dark); }

.route-number { align-self: center; color: #3b3d4a; font-size: 13px; font-weight: 800; }
.route-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; }
.route-icon svg { width: 22px; height: 22px; }
.icon-metal { color: var(--coral-dark); background: #fdeee7; }
.icon-nonmetal { color: var(--teal-dark); background: #e6f6f4; }

.route-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.route-category { color: var(--coral-dark); font-size: 11.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.route-nonmetal .route-category { color: var(--teal-dark); }
.route-copy strong { color: var(--ink); font-size: 18px; font-weight: 800; line-height: 1.2; }
.route-copy small { overflow: hidden; color: #5d6072; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.route-arrow { width: 16px; height: 16px; color: #888b9a; transition: all .18s ease; }
.route-card:hover .route-arrow { color: var(--coral-dark); transform: translateX(3px); }

.route-done { border-color: #6fb88e; }
.route-done::after {
  position: absolute;
  top: -10px;
  right: 14px;
  content: '✓ Đã học';
  padding: 2px 8px;
  border-radius: 99px;
  color: #176337;
  background: #def7e5;
  border: 1px solid #99dda9;
  font-size: 12px;
  font-weight: 800;
}

.map-core {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.core-orbit {
  position: absolute;
  width: 144px;
  height: 68px;
  border: 2.5px solid rgba(235, 120, 85, 0.75);
  border-radius: 50%;
  transform: rotate(32deg);
}
.orbit-sparkle {
  position: absolute;
  right: 14px;
  top: -8px;
  color: #f0a82d;
  font-size: 16px;
  display: block;
}
.core-orbit-b {
  width: 148px;
  height: 74px;
  border: 2.5px solid rgba(40, 165, 155, 0.75);
  border-radius: 50%;
  transform: rotate(-38deg);
}
.map-core .nucleus {
  width: 76px;
  height: 76px;
  border: 4px solid #fff2d4;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffd886 0 12%, transparent 13%), linear-gradient(145deg, #ff9f59, #f16846 80%);
  box-shadow: 0 8px 24px rgba(240, 106, 70, 0.28);
}
.core-caption {
  position: absolute;
  top: calc(50% + 54px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border: 1.5px solid #ded7ca;
  border-radius: 99px;
  color: #4e4a42;
  background: #ffffff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Station Summary Banner below map */
.map-summary-wrap {
  width: 100%;
  margin: 6px auto 0;
  flex-shrink: 0;
}
.summary-banner-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border: 2px solid #d29432;
  border-radius: 14px;
  background: linear-gradient(95deg, #fff9ed 0%, #fffefe 60%, #fff7eb 100%);
  box-shadow: 0 4px 14px rgba(184, 126, 34, .08);
  cursor: pointer;
  text-align: left;
  transition: all .18s ease;
}
.summary-banner-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(184, 126, 34, .15);
  border-color: #b87a1a;
}
.summary-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.summary-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: #fce8bd;
  color: #9c6204;
  font-size: 20px;
  flex-shrink: 0;
}
.summary-kicker {
  display: block;
  color: #a46407;
  font-size: 12.5px;
  font-weight: 800;
}
.summary-banner-left h3 {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}
.summary-banner-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.summary-tag {
  padding: 4px 12px;
  border-radius: 99px;
  background: #fdf0d5;
  color: #8c5203;
  font-size: 13px;
  font-weight: 800;
}
.summary-arrow {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #f5eedf;
  color: #724b17;
}

/* ==========================================================================
   3. LESSON VIEW (CHI TIẾT CHẶNG BÀI GIẢNG)
   ========================================================================== */
.lesson-view {
  padding: 4px 0;
  justify-content: space-between;
}
.lesson-toolbar {
  width: 100%;
  margin: 0 auto 4px;
  flex-shrink: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--white);
  font-size: var(--fs-tag);
  font-weight: 800;
  cursor: pointer;
  transition: all .16s ease;
}
.back-button:hover {
  color: var(--coral-dark);
  border-color: var(--coral);
  background: var(--coral-wash);
}
.lesson-toolbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.teacher-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 9px;
  background: var(--white);
  color: var(--muted);
  font-size: var(--fs-tag);
  font-weight: 800;
  cursor: pointer;
  transition: all .15s ease;
}
.teacher-tool-btn:hover {
  color: var(--teal-dark);
  border-color: var(--teal);
  background: var(--teal-wash);
}
.lesson-step {
  color: var(--muted-light);
  font-size: var(--fs-tag);
  font-weight: 800;
}

.lesson-content-wrap {
  width: 100%;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.lesson-heading {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.lesson-heading-copy { position: relative; z-index: 1; flex: 1; }
.lesson-heading .eyebrow { justify-content: flex-start; margin-bottom: 2px; }
.lesson-heading h1 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 800;
  line-height: 1.15;
}
.lesson-heading h1 span { color: var(--accent, var(--coral-dark)); }
.lesson-summary {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--fs-content);
  line-height: 1.45;
  font-weight: 500;
}
.lesson-art { position: relative; z-index: 1; flex: 0 0 68px; height: 58px; display: grid; place-items: center; }
.lesson-art-orbit {
  position: absolute;
  inset: 6px 0;
  border: 2px solid color-mix(in srgb, var(--accent, var(--coral)) 40%, transparent);
  border-radius: 50%;
  transform: rotate(-26deg);
}
.lesson-art .nucleus { width: 48px; height: 48px; border-width: 3px; }
.lesson-art .nucleus-face { transform: scale(.72); }
.lesson-art-icon {
  position: absolute;
  top: 0;
  right: 2px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent, var(--coral-dark));
  background: var(--wash, var(--coral-wash));
}
.lesson-art-icon svg { width: 16px; height: 16px; }

/* Lesson Columns (Facts vs Lab) */
.lesson-columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: stretch;
}
.fact-panel, .lab-panel {
  border: 2px solid var(--line);
  border-radius: var(--round);
  background: var(--white);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.fact-panel { padding: 12px 16px; }
.fact-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.panel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: var(--fs-title-sub);
  font-weight: 800;
}
.panel-heading-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  color: var(--accent, var(--coral-dark));
  background: var(--wash, var(--coral-wash));
}

.fact-list {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  flex: 1;
  min-height: 0;
}
.fact-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: center;
  padding: 7px 12px;
  border-radius: 12px;
  background: #fbf9f4;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all .2s ease;
}
.fact-row:hover {
  background: var(--wash, var(--coral-wash));
  border-color: color-mix(in srgb, var(--accent, var(--coral)) 30%, transparent);
}
.fact-row.is-unrevealed {
  opacity: .32;
  filter: blur(3px) grayscale(.8);
  user-select: none;
}
.fact-row.is-just-revealed {
  animation: reveal-pop .3s ease both;
  border-color: var(--accent, var(--coral));
}

@keyframes reveal-pop {
  0% { transform: scale(.98); opacity: .4; }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

.fact-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  color: var(--accent, var(--coral-dark));
  background: var(--wash, var(--coral-wash));
  font-size: 15px;
}
.fact-icon svg { width: 17px; height: 17px; }
.fact-row strong {
  display: block;
  margin: 0 0 1px;
  font-size: var(--fs-title-sub);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}
.fact-row p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-content);
  line-height: 1.42;
  font-weight: 500;
}

/* Lab Panel */
.lab-panel {
  position: relative;
  overflow: hidden;
  padding: 12px 16px;
  background: linear-gradient(155deg, var(--wash, var(--coral-wash)) 0%, #fffefa 68%);
}
.lab-panel::after {
  content: '✦';
  position: absolute;
  right: 10px;
  top: 2px;
  color: rgba(230,171,91,.4);
  font-size: 20px;
}
.lab-kicker {
  margin: 0 0 2px;
  color: var(--accent, var(--coral-dark));
  font-size: 12.5px;
  font-weight: 800;
}
.lab-title { margin: 0 0 4px; font-size: var(--fs-title-sub); font-weight: 800; }
.lab-visual {
  min-height: 60px;
  display: grid;
  place-items: center;
  margin: 4px 0 6px;
  border: 2px dashed color-mix(in srgb, var(--accent, var(--coral)) 40%, transparent);
  border-radius: 12px;
  background: rgba(255,255,255,.75);
}
.lab-visual-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent, var(--coral-dark));
}
.lab-visual-inner span {
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.lab-visual-inner b { font-size: 24px; }
.lab-visual-inner em { color: #9c8a78; font-size: 18px; font-style: normal; font-weight: 800; }
.lab-copy { margin: 0; color: var(--muted); font-size: var(--fs-content); line-height: 1.45; font-weight: 500; }

.equation {
  display: block;
  margin-top: 6px;
  padding: 6px 12px;
  border: 1.5px solid rgba(215,176,132,.4);
  border-radius: 10px;
  color: #513626;
  background: rgba(255,255,255,.9);
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}
.note-chip {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 10px;
  border: 1.5px solid #ebd9a9;
  border-radius: 10px;
  color: #6d5423;
  background: #fef8e7;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}

/* Lesson Bottom Bar */
.lesson-bottom-bar {
  width: 100%;
  margin: 0 auto;
  flex-shrink: 0;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1.5px solid var(--line);
  padding-top: 4px;
}
.reveal-status-hint {
  font-size: var(--fs-tag);
  font-weight: 700;
  color: var(--muted);
  background: #f5f2ea;
  padding: 4px 12px;
  border-radius: 8px;
}

.lesson-bottom-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quiz-trigger-btn {
  background: linear-gradient(115deg, var(--teal-dark), var(--teal));
  box-shadow: 0 3px 0 var(--teal-dark), 0 6px 14px rgba(34, 156, 154, .25);
  font-size: 15px;
  min-height: 42px;
  padding: 0 18px;
}
.quiz-trigger-btn:hover {
  box-shadow: 0 5px 0 var(--teal-dark), 0 10px 18px rgba(34, 156, 154, .32);
}
.quiz-trigger-btn.has-solved {
  background: linear-gradient(115deg, #2e8b57, #3cb371);
  box-shadow: 0 3px 0 #1b5835;
}

.lesson-next-btn {
  min-height: 42px;
  padding: 0 18px;
  font-size: 15px;
}

.lesson-view[data-tone="metal"] { --accent: var(--coral-dark); --wash: var(--coral-wash); }
.lesson-view[data-tone="nonmetal"] { --accent: var(--teal-dark); --wash: var(--teal-wash); }

/* ==========================================================================
   4. SUMMARY VIEW (BẢNG SO SÁNH 5 TIÊU CHÍ)
   ========================================================================== */
.summary-view {
  padding: 4px 0;
  justify-content: space-between;
}
.summary-inner {
  width: 100%;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.summary-header {
  text-align: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  background: #fce8bd;
  color: #92580a;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 2px;
}
.summary-header h2 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 800;
}

/* Compare Table (Zero scroll) */
.table-container {
  flex: 1;
  min-height: 0;
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow);
  display: flex;
  overflow: hidden;
}
.compare-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--fs-content-dense);
}
.compare-table th, .compare-table td {
  padding: 8px 14px;
  border-bottom: 1.5px solid var(--line);
  vertical-align: middle;
}
.compare-table th {
  background: #fbf9f4;
  font-weight: 800;
  font-size: var(--fs-title-sub);
}
.col-feature { width: 22%; color: var(--muted); }
.col-metal { width: 39%; color: var(--coral-dark); }
.col-nonmetal { width: 39%; color: var(--teal-dark); }
.head-icon { font-size: 18px; vertical-align: middle; margin-right: 4px; }

.compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table tbody tr:hover td { background: #faf8f3; }
.feature-title { font-weight: 800; color: var(--ink); font-size: 16px; }
.metal-val { line-height: 1.42; color: var(--ink); font-size: 15.5px; }
.metal-val b { color: var(--coral-dark); }
.nonmetal-val { line-height: 1.42; color: var(--ink); font-size: 15.5px; }
.nonmetal-val b { color: var(--teal-dark); }
.nonmetal-val em { color: var(--muted); font-size: 13.5px; font-weight: 600; display: block; margin-top: 1px; }

.summary-bottom-actions {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding-top: 6px;
}
.summary-bottom-actions button {
  font-size: 15px;
  font-weight: 800;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 12px;
}
.highlight-btn {
  background: linear-gradient(115deg, #d28c25, #ea9e2f);
  box-shadow: 0 4px 0 #9a6312, 0 8px 16px rgba(210, 140, 37, .24);
}

/* Presenter Hint Bar (Thanh cố định dưới đáy) */
.presenter-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #242634;
  color: #c9cddb;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 -2px 10px rgba(0,0,0,.1);
  white-space: nowrap;
  overflow: hidden;
}
.presenter-tag {
  color: var(--yellow);
  font-weight: 800;
}
kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: #393c50;
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(0,0,0,.3);
}

/* ==========================================================================
   POPUP MODALS (THỬ TÀI NHANH, THỬ THÁCH, SỔ GHI BÀI)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  background: rgba(20, 22, 33, .68);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all .20s ease;
}
.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal Sheets (Tối ưu rộng ngang 16:9 không cuộn dọc) */
.quiz-modal-sheet, .challenge-modal-sheet, .notebook-sheet, .editor-modal-sheet {
  width: min(92vw, 920px);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 18px;
  background: var(--white);
  border: 2.5px solid var(--line-strong);
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  animation: modal-in .22s cubic-bezier(.2,.8,.25,1) both;
}
.notebook-sheet { width: min(92vw, 960px); }
.editor-modal-sheet { width: min(94vw, 980px); max-height: 92vh; }

@keyframes modal-in {
  from { transform: scale(.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.quiz-modal-header, .challenge-modal-header, .notebook-header, .editor-modal-header {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--line);
  background: #fbf9f4;
  flex-shrink: 0;
}
.quiz-modal-title-wrap h2, .challenge-modal-title-wrap h2, .notebook-title-wrap h2, .editor-title-wrap h2 {
  margin: 1px 0 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}
.quiz-modal-badge, .challenge-modal-badge, .editor-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  background: #faeac4;
  color: #92580a;
  font-size: 12px;
  font-weight: 800;
}

.close-modal-btn {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 9px;
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.close-modal-btn:hover {
  background: #fce8e6;
  border-color: #e56a5e;
  color: #b02316;
}

/* Quiz Modal Body (Tối ưu Lưới 2x2 cho 4 đáp án) */
.quiz-modal-body {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-modal-question {
  margin: 0;
  font-size: var(--fs-content-lg);
  font-weight: 800;
  line-height: 1.42;
  color: var(--ink);
}
.quiz-modal-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0;
}
.quiz-modal-opt-btn {
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-size: var(--fs-content);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .16s ease;
}
.quiz-modal-opt-btn:hover {
  border-color: var(--teal);
  background: var(--teal-wash);
  transform: translateY(-1px);
}
.quiz-modal-opt-btn.is-correct {
  border-color: #2b9958;
  color: #156636;
  background: #e6f6ec;
}
.quiz-modal-opt-btn.is-wrong {
  border-color: #e56a5e;
  color: #b02316;
  background: #fdeee9;
  animation: shake .3s ease;
}

.quiz-modal-feedback {
  min-height: 28px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--muted);
}
.quiz-modal-feedback.success { color: #167a3f; }

.quiz-modal-footer, .challenge-modal-footer, .notebook-footer, .editor-modal-footer {
  padding: 10px 20px;
  border-top: 2px solid var(--line);
  background: #fbf9f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.quiz-modal-hint, .challenge-modal-hint, .notebook-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.quiz-modal-next-btn {
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: all .2s ease;
  font-size: 15px;
  min-height: 44px;
}
.quiz-modal-next-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Challenge Modal Content */
.challenge-score-pill {
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--green-wash);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}
.challenge-modal-body {
  padding: 14px 20px;
  display: grid;
  gap: 10px;
}
.challenge-item {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fcfbf8;
}
.challenge-question {
  margin: 0 0 6px;
  font-size: var(--fs-content-lg);
  font-weight: 800;
}
.challenge-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.challenge-btn {
  padding: 8px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: var(--fs-content);
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
}
.challenge-btn:hover {
  border-color: var(--teal);
  background: var(--teal-wash);
}
.challenge-btn.is-correct {
  border-color: #2b9958;
  color: #176337;
  background: #eaf8ee;
}
.challenge-btn.is-wrong {
  border-color: #e56a5e;
  color: #b02316;
  background: #fdeee9;
}
.challenge-fb {
  margin: 4px 0 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--muted);
}
.challenge-fb.success { color: #176337; }

/* Notebook Modal (Bố cục 2 cột song song) */
.notebook-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.notebook-icon { font-size: 26px; }
.notebook-title-wrap p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.notebook-body {
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.note-box {
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fdfcf9;
}
.note-box-metal { border-color: #f0c5b8; background: #fffcfb; }
.note-box-nonmetal { border-color: #bce1dc; background: #fafffe; }
.note-box-takeaway {
  grid-column: span 2;
  border-color: #eed699;
  background: #fffcf2;
}
.note-box-header {
  font-size: var(--fs-title-sub);
  font-weight: 800;
  margin-bottom: 4px;
}
.note-box-metal .note-box-header { color: var(--coral-dark); }
.note-box-nonmetal .note-box-header { color: var(--teal-dark); }
.note-box-takeaway .note-box-header { color: #9c6204; }
.note-box ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}
.note-box li, .note-box-takeaway p {
  font-size: var(--fs-content);
  line-height: 1.45;
  color: var(--ink);
}

/* ==========================================================================
   LESSON STUDIO (BỘ SOẠN THẢO BÀI GIẢNG)
   ========================================================================== */
.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-select {
  padding: 6px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.editor-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: all .16s ease;
}
.editor-btn-secondary:hover {
  background: var(--teal-wash);
  border-color: var(--teal);
  color: var(--teal-dark);
}

.editor-tabs {
  display: flex;
  background: #f6f3eb;
  border-bottom: 2px solid var(--line);
  padding: 0 16px;
  gap: 6px;
  overflow-x: auto;
}
.editor-tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all .18s ease;
  white-space: nowrap;
}
.editor-tab-btn:hover { color: var(--ink); }
.editor-tab-btn.is-active {
  color: var(--coral-dark);
  border-bottom-color: var(--coral-dark);
  background: #fff;
}

.editor-body {
  padding: 16px 20px;
  overflow-y: auto;
  max-height: 60vh;
}
.editor-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.editor-panel.is-active { display: flex; }

.form-row {
  display: flex;
  gap: 12px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group.flex-1 { flex: 1; }
.form-group.flex-2 { flex: 2; }
.form-group.align-self-end { align-self: flex-end; }

.form-group label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.form-input, .form-textarea, .form-select {
  padding: 8px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color .15s ease;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--coral);
}
.form-textarea { resize: vertical; }

.subtle-note {
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
  margin-left: 6px;
}

.editor-sub-section {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fdfcf9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sub-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sub-section-header strong {
  font-size: 14px;
  color: var(--ink);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 30px;
  border-radius: 8px;
}
.btn-subtle {
  border: 1.5px dashed var(--line-strong);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-subtle:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-wash);
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1.5px solid #e57368;
  background: #fff0ec;
  color: #ad281d;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-danger:hover { background: #fcdbd6; }

/* Routes Manager Chips in Studio */
.routes-manager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fbf9f4;
  border: 1.5px solid var(--line);
  border-radius: 12px;
}
.routes-nav-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.route-chip-btn {
  padding: 6px 12px;
  border: 2px solid var(--line-strong);
  border-radius: 99px;
  background: #fff;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.route-chip-btn:hover {
  border-color: var(--coral);
  color: var(--coral-dark);
}
.route-chip-btn.is-active {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral-dark);
}

.route-editor-box {
  padding: 14px;
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.facts-editor-list, .summary-rows-list, .challenges-editor-list, .noteboxes-editor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ed-item-card {
  padding: 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ed-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ed-item-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.editor-status-msg {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}
.editor-footer-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Typography Scale Adjuster Box in Lesson Studio */
.editor-typography-box {
  padding: 14px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: #fbf9f4;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.typography-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.typography-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.typography-header-left strong {
  font-size: 14.5px;
  color: var(--ink);
}
.typography-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--yellow-wash);
  color: #92580a;
  font-size: 12px;
  font-weight: 800;
}
.btn-autofit-font {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--teal);
  border-radius: 9px;
  background: var(--teal-wash);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all .16s ease;
}
.btn-autofit-font:hover {
  background: var(--teal);
  color: #fff;
  transform: translateY(-1px);
}
.typography-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.font-preset-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.font-preset-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.font-preset-btn:hover {
  border-color: var(--coral);
  color: var(--coral-dark);
}
.font-preset-btn.is-active {
  background: var(--coral);
  border-color: var(--coral-dark);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(230, 90, 60, .25);
}
.font-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 260px;
  flex: 1;
}
.font-slider-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.font-slider-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.font-slider-limit {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted-light);
}
.font-range-input {
  flex: 1;
  accent-color: var(--coral);
  cursor: pointer;
}
.font-scale-value {
  display: inline-block;
  min-width: 48px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1.5px solid var(--line-strong);
  font-size: 13px;
  font-weight: 800;
  color: var(--coral-dark);
}

/* Live Typography Preview Box */
.typography-live-preview {
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1.5px dashed var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.preview-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted-light);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.preview-title {
  font-size: var(--fs-title);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}
.preview-content {
  font-size: var(--fs-content);
  color: var(--muted);
  line-height: 1.45;
  font-weight: 500;
}

/* ==========================================================================
   RESPONSIVE CHO ĐIỆN THOẠI & MÀN HÌNH NHỎ (MOBILE TOUCH VIEW)
   ========================================================================== */
@media (max-width: 768px) {
  html, body {
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    font-size: 15px !important;
  }

  .site-shell {
    height: auto !important;
    min-height: 100svh !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: 24px !important;
    width: min(100% - 20px, 580px);
  }

  main {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .view {
    height: auto !important;
    overflow: visible !important;
  }

  .view.is-active {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    gap: 14px;
  }

  /* Ẩn phím tắt và thanh điều khiển máy chiếu khi xem trên điện thoại */
  .kbd-hint,
  .presenter-bar,
  .map-tip,
  .btn-fullscreen {
    display: none !important;
  }

  .topbar {
    height: 52px;
    padding: 0;
  }
  .brand { font-size: 15px; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .topbar-controls { gap: 6px; }
  .topbar-action-btn {
    padding: 5px 8px;
    font-size: 12px;
  }
  .topbar-action-btn svg { width: 15px; height: 15px; }
  .progress-pill {
    padding: 5px 9px;
    font-size: 12px;
  }

  .landing-view.is-active {
    padding: 16px 0 24px;
    min-height: calc(100svh - 80px);
  }
  .landing-content { padding: 0; }
  .atom-stage-large { width: 130px; height: 130px; }
  .nucleus-large { width: 68px; height: 68px; border-width: 4px; }
  .nucleus-large .nucleus-face { transform: scale(.72); }
  .landing-content h1 { font-size: clamp(24px, 7vw, 30px); }
  .warmup-card p { font-size: 15.5px; }
  .primary-button, .secondary-button {
    font-size: 15.5px !important;
    min-height: 44px !important;
  }

  .map-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .map-heading h2 { font-size: 21px; }
  .section-copy { font-size: 13.5px; }

  .map-scene {
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 14px !important;
    border-radius: 16px;
    margin-top: 8px;
  }
  .map-trails { display: none !important; }

  .map-core {
    order: -1;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 110px !important;
    height: 110px !important;
    margin: 4px auto 8px !important;
  }
  .core-orbit { width: 100px; height: 50px; }
  .core-orbit-b { width: 106px; height: 60px; }
  .map-core .nucleus { width: 56px; height: 56px; }
  .map-core .nucleus-face { transform: scale(.65); }
  .core-caption { bottom: -6px; font-size: 10px; padding: 2px 8px; }

  .route-card {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-height: 66px !important;
    grid-template-columns: 24px 36px 1fr 18px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
  }
  .route-number { font-size: 12px; }
  .route-icon { width: 34px; height: 34px; border-radius: 9px; }
  .route-icon svg { width: 18px; height: 18px; }
  .route-copy strong { font-size: 15px; }
  .route-copy small { font-size: 12px; }

  .summary-banner-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
  }
  .summary-banner-left { gap: 10px; }
  .summary-banner-left h3 { font-size: 16px; }
  .summary-icon { width: 34px; height: 34px; font-size: 18px; }
  .summary-banner-right {
    width: 100%;
    justify-content: space-between;
  }

  .lesson-view { padding-top: 6px; }
  .lesson-toolbar { height: auto; margin-bottom: 6px; }
  .back-button { padding: 5px 9px; font-size: 12.5px; }
  .teacher-tool-btn { padding: 5px 9px; font-size: 12px; }
  .lesson-content-wrap { height: auto !important; gap: 10px !important; }
  .lesson-heading {
    padding: 10px 14px;
    gap: 10px;
    border-radius: 14px;
  }
  .lesson-heading h1 { font-size: 20px; }
  .lesson-summary { font-size: 14px; }
  .lesson-art { flex: 0 0 54px; height: 54px; }
  .lesson-art .nucleus { width: 42px; height: 42px; }
  .lesson-art .nucleus-face { transform: scale(.60); }

  .lesson-columns {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .fact-panel, .lab-panel {
    padding: 12px !important;
    border-radius: 14px !important;
  }
  .panel-heading { font-size: 16px; }
  .fact-row {
    padding: 8px 10px;
    grid-template-columns: 26px 1fr;
    gap: 8px;
  }
  .fact-icon { width: 26px; height: 26px; font-size: 13.5px; }
  .fact-row strong { font-size: 15px; }
  .fact-row p { font-size: 13.5px; }

  .lab-title { font-size: 16px; }
  .lab-copy { font-size: 13.5px; }
  .lab-visual { min-height: 54px; margin: 4px 0 6px; }
  .equation { font-size: 15px; padding: 6px 8px; }
  .note-chip { font-size: 13px; padding: 6px 8px; }

  .lesson-bottom-bar {
    height: auto !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
    border-top: none !important;
    padding-top: 4px !important;
  }
  .reveal-status-hint { text-align: center; font-size: 12.5px; }
  .lesson-bottom-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }
  .quiz-trigger-btn, .lesson-next-btn {
    width: 100% !important;
    min-height: 42px !important;
    justify-content: center !important;
    font-size: 14.5px !important;
  }

  .summary-view { padding-top: 6px; }
  .summary-inner { height: auto !important; }
  .summary-header h2 { font-size: 20px; }
  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    margin-bottom: 10px;
  }
  .compare-table { min-width: 540px; font-size: 13.5px; }
  .compare-table th, .compare-table td { padding: 8px 10px; }
  .summary-bottom-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }
  .summary-bottom-actions button {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
  }

  /* Modals on mobile (Bottom sheets) */
  .modal-backdrop {
    padding: 8px;
    align-items: flex-end;
  }
  .quiz-modal-sheet, .challenge-modal-sheet, .notebook-sheet, .editor-modal-sheet {
    width: 100% !important;
    max-height: 88vh !important;
    border-radius: 18px 18px 8px 8px !important;
    border-width: 2px !important;
  }
  .quiz-modal-header, .challenge-modal-header, .notebook-header, .editor-modal-header {
    padding: 10px 14px;
  }
  .quiz-modal-title-wrap h2, .challenge-modal-title-wrap h2, .notebook-title-wrap h2, .editor-title-wrap h2 {
    font-size: 17px;
  }
  .quiz-modal-body, .challenge-modal-body, .notebook-body, .editor-body {
    padding: 12px 14px;
    gap: 10px;
  }
  .quiz-modal-question { font-size: 17px; }
  .quiz-modal-options {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
  .quiz-modal-opt-btn {
    min-height: 42px;
    padding: 8px 12px;
    font-size: 14.5px;
  }
  .quiz-modal-feedback { font-size: 14.5px; }
  .quiz-modal-footer, .challenge-modal-footer, .notebook-footer, .editor-modal-footer {
    padding: 10px 14px;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .quiz-modal-hint, .challenge-modal-hint, .notebook-hint {
    text-align: center;
    font-size: 12px;
  }
  .quiz-modal-next-btn {
    width: 100%;
    min-height: 40px;
    justify-content: center;
    font-size: 14.5px;
  }

  .challenge-options {
    grid-template-columns: 1fr !important;
  }
  .challenge-btn { font-size: 14px; }
  .challenge-question { font-size: 15.5px; }

  .notebook-body {
    grid-template-columns: 1fr !important;
  }
  .note-box-header { font-size: 15.5px; }
  .note-box li, .note-box-takeaway p { font-size: 13.5px; }

  .editor-header-actions { flex-wrap: wrap; gap: 6px; }
  .form-row { flex-direction: column; gap: 8px; }
}

@media (max-width: 400px) {
  .site-shell { width: min(100% - 12px, 580px); }
  .brand-text { font-size: 13.5px; }
  .topbar-action-btn span { display: none; }
  .topbar-action-btn { padding: 6px 8px; }
}

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