/* ============================================================
   Grade 6 learning route and interactive lab components
   Kept under g6-* so this edition can live beside the existing
   grade-two skin while sharing the app's button and panel system.
   ============================================================ */

:root {
  --g6-ink: #253044;
  --g6-muted: #657187;
  --g6-line: #dfe5ee;
  --g6-paper: #ffffff;
  --g6-wash: #f5f7fb;
  --g6-navy: #31527d;
  --g6-blue: #3c7fba;
  --g6-coral: #d8684b;
  --g6-green: #3e8774;
  --g6-violet: #7664aa;
  --g6-gold: #b9822e;
  --g6-shadow: 0 14px 32px rgba(40, 55, 80, .12), 0 2px 6px rgba(40, 55, 80, .06);
  --g6-shadow-sm: 0 5px 14px rgba(40, 55, 80, .09);
}

/* Home route ------------------------------------------------- */
.g6-home {
  color: var(--g6-ink);
  max-width: 1120px;
  margin: 0 auto;
}

/* Runtime-friendly aliases used by the book-specific activity shell. */
.g6-shell,
.g6-work {
  width: min(1120px, 100%);
  margin: 0 auto;
  color: var(--g6-ink);
}

.g6-kicker {
  margin: 0 0 7px;
  color: var(--g6-blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.g6-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.g6-panel {
  padding: 22px;
  border: 1px solid var(--g6-line);
  border-radius: 18px;
  background: var(--g6-paper);
  box-shadow: var(--g6-shadow);
}

.g6-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.g6-unit {
  position: relative;
  min-height: 205px;
  padding: 17px;
  border: 1px solid var(--g6-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--g6-shadow-sm);
}

.g6-unit h3,
.g6-lesson h3 { margin: 8px 0 5px; color: var(--g6-ink); font-size: 18px; line-height: 1.28; }
.g6-unit p,
.g6-lesson p { margin: 0 0 11px; color: var(--g6-muted); font-size: 13px; font-weight: 650; line-height: 1.55; }
.g6-unit-index { color: var(--g6-blue); font-size: 12px; font-weight: 900; }
.g6-unit .g6-progress-bar { margin: 13px 0 5px; }
.g6-unit > small { color: var(--g6-muted); font-size: 11px; font-weight: 800; }
.g6-unit > .btn { margin-top: 13px; }

.g6-lessons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 18px;
}

.g6-lesson {
  display: block;
  width: 100%;
  min-height: 142px;
  padding: 16px;
  border: 1px solid var(--g6-line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--g6-shadow-sm);
  text-align: left;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.g6-lesson:hover { border-color: #abc3da; box-shadow: 0 13px 25px rgba(40, 55, 80, .12); transform: translateY(-2px); }
.g6-meta { color: var(--g6-blue); font-size: 11px; font-weight: 900; letter-spacing: .2px; }
.g6-card-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; color: var(--g6-muted); font-size: 11px; font-weight: 800; }
.g6-card-status span:last-child { color: var(--g6-gold); }

.g6-work-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 15px; }
.g6-work-head h1 { margin: 5px 0 6px; color: var(--g6-ink); font-size: clamp(24px, 4vw, 34px); line-height: 1.2; }
.g6-work-head p { margin: 0; color: var(--g6-muted); font-size: 14px; font-weight: 650; }
.g6-work-head > div:first-child { min-width: 0; }

/* Optional textbook cover/TOC reader used by the grade-specific route. */
.g6-book-reader { max-width: 960px; margin: 0 auto; }
.g6-book-spread { display: grid; place-items: center; min-height: min(70vh, 700px); margin: 15px auto; }
.g6-book-spread.double { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 12px; }
.g6-book-page { position: relative; width: min(100%, 610px); margin: 0; overflow: hidden; border: 1px solid #dbe3ed; border-radius: 10px; background: #fff; box-shadow: var(--g6-shadow); }
.g6-book-page img { display: block; width: 100%; height: auto; }
.g6-book-spread.double .g6-book-page { width: 100%; }
.g6-toc-hotspot { position: absolute; display: block; border: 0; background: transparent; cursor: pointer; }
.g6-toc-hotspot span { position: absolute; right: 8%; bottom: 9%; padding: 4px 8px; border-radius: 7px; background: rgba(49, 82, 125, .9); color: #fff; font-size: 11px; font-weight: 850; opacity: 0; transform: translateY(4px); transition: opacity .16s ease, transform .16s ease; }
.g6-toc-hotspot:hover span,
.g6-toc-hotspot:focus-visible span { opacity: 1; transform: none; }
.g6-book-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.g6-book-nav span { color: var(--g6-muted); font-size: 13px; font-weight: 800; }

.g6-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, .85fr);
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  margin: 4px 0 28px;
  border: 1px solid #dae2ee;
  border-radius: 26px;
  background: var(--g6-paper);
  box-shadow: var(--g6-shadow);
}

.g6-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(25px, 5vw, 48px);
  background: #f1f6fb;
}

.g6-hero-kicker,
.g6-section-kicker {
  color: var(--g6-blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.g6-hero-copy h1 {
  max-width: 14ch;
  margin: 7px 0 10px;
  color: var(--g6-ink);
  font-size: clamp(29px, 4vw, 46px);
  line-height: 1.1;
  letter-spacing: 0;
}

.g6-hero-copy p {
  max-width: 48ch;
  margin: 0;
  color: var(--g6-muted);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.75;
}

.g6-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.g6-stat {
  min-width: 112px;
  padding: 9px 12px;
  border: 1px solid #d4e0ee;
  border-radius: 12px;
  background: rgba(255, 255, 255, .84);
}

.g6-stat b,
.g6-stat span { display: block; }
.g6-stat b { color: var(--g6-navy); font-size: 20px; line-height: 1.15; }
.g6-stat span { margin-top: 2px; color: var(--g6-muted); font-size: 12px; font-weight: 750; }

.g6-hero-art {
  min-height: 250px;
  background: #d9e8f5;
}

.g6-hero-art img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
}

.g6-route-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 14px;
}

.g6-route-head h2 { margin: 3px 0 0; font-size: 25px; line-height: 1.2; }
.g6-route-head p { margin: 3px 0 0; color: var(--g6-muted); font-size: 14px; font-weight: 650; }

.g6-progress {
  min-width: 150px;
  color: var(--g6-muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.g6-progress-bar {
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #e4e9f0;
}

.g6-progress-bar i { display: block; height: 100%; border-radius: inherit; background: var(--g6-blue); }

.g6-chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.g6-chapter-card {
  display: flex;
  min-width: 0;
  min-height: 258px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--g6-line);
  border-radius: 18px;
  background: var(--g6-paper);
  box-shadow: var(--g6-shadow-sm);
  text-align: left;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.g6-chapter-card:hover { border-color: #afc3da; box-shadow: 0 17px 32px rgba(40, 55, 80, .14); transform: translateY(-3px); }
.g6-chapter-card:focus-within { border-color: var(--g6-blue); box-shadow: 0 0 0 3px rgba(60, 127, 186, .16); }
.g6-chapter-card.is-done { border-color: #acd3c5; }
.g6-chapter-card.is-current { border-color: var(--g6-blue); }

.g6-chapter-media {
  position: relative;
  height: 128px;
  flex: none;
  overflow: hidden;
  background: #e8edf5;
}

.g6-chapter-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.g6-chapter-card:hover .g6-chapter-media img { transform: scale(1.035); }

.g6-chapter-index {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: rgba(37, 48, 68, .86);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.g6-chapter-status {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .92);
  color: var(--g6-navy);
  font-size: 11px;
  font-weight: 850;
}

.g6-chapter-body { display: flex; flex: 1; flex-direction: column; padding: 14px 15px 15px; }
.g6-chapter-body h3 { margin: 0; color: var(--g6-ink); font-size: 18px; line-height: 1.25; }
.g6-chapter-body p { margin: 5px 0 10px; color: var(--g6-muted); font-size: 13px; font-weight: 650; line-height: 1.5; }
.g6-chapter-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.g6-chapter-tags span { padding: 3px 7px; border-radius: 6px; background: var(--g6-wash); color: var(--g6-muted); font-size: 11px; font-weight: 800; }
.g6-chapter-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--g6-blue); font-size: 13px; font-weight: 900; }
.g6-chapter-action::after { content: "→"; font-size: 18px; line-height: 1; }

.g6-tools-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.g6-tool-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--g6-line);
  border-radius: 14px;
  background: #fff;
  color: var(--g6-ink);
  box-shadow: var(--g6-shadow-sm);
  text-align: left;
}

.g6-tool-link:hover { border-color: #b3c9df; }
.g6-tool-icon { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 10px; background: #edf4fa; font-size: 19px; }
.g6-tool-link b { display: block; font-size: 14px; }
.g6-tool-link small { display: block; margin-top: 1px; color: var(--g6-muted); font-size: 11px; font-weight: 650; }

/* Chapter detail and game intro ----------------------------- */
.g6-chapter-page { max-width: 1080px; margin: 0 auto; color: var(--g6-ink); }
.g6-chapter-banner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .8fr); min-height: 205px; overflow: hidden; border: 1px solid var(--g6-line); border-radius: 22px; background: #fff; box-shadow: var(--g6-shadow); }
.g6-chapter-banner-copy { display: flex; flex-direction: column; justify-content: center; padding: 26px 30px; }
.g6-chapter-banner-copy h1 { margin: 5px 0 7px; font-size: clamp(25px, 3vw, 35px); line-height: 1.18; }
.g6-chapter-banner-copy p { max-width: 52ch; margin: 0; color: var(--g6-muted); font-size: 15px; font-weight: 650; }
.g6-chapter-banner-art { min-height: 205px; background: #e8eff7; }
.g6-chapter-banner-art img { display: block; width: 100%; height: 100%; object-fit: cover; }

.g6-game-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.g6-game-card { display: flex; align-items: flex-start; gap: 13px; min-width: 0; padding: 17px; border: 1px solid var(--g6-line); border-radius: 16px; background: #fff; box-shadow: var(--g6-shadow-sm); }
.g6-game-card.is-done { border-color: #acd3c5; background: #fbfefc; }
.g6-game-icon { display: grid; width: 45px; height: 45px; flex: none; place-items: center; border-radius: 13px; background: #edf4fa; font-size: 24px; }
.g6-game-main { min-width: 0; flex: 1; }
.g6-game-main h3 { margin: 0; color: var(--g6-ink); font-size: 17px; line-height: 1.25; }
.g6-game-main p { margin: 4px 0 9px; color: var(--g6-muted); font-size: 13px; font-weight: 650; line-height: 1.45; }
.g6-game-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--g6-muted); font-size: 11px; font-weight: 800; }
.g6-game-meta .stars { color: var(--g6-gold); letter-spacing: 1px; }
.g6-game-card .g6-game-go { align-self: center; flex: none; }

.g6-game-shell { max-width: 960px; margin: 0 auto; color: var(--g6-ink); }
.g6-game-shell .panel { border: 1px solid var(--g6-line); box-shadow: var(--g6-shadow); }
.g6-game-shell .stem { color: var(--g6-ink); }
.g6-game-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--g6-blue); font-size: 12px; font-weight: 900; letter-spacing: 1px; }
.g6-game-kicker::before { content: ""; width: 22px; height: 3px; border-radius: 9px; background: currentColor; }

/* Learn pages ------------------------------------------------ */
.g6-learn { color: var(--g6-ink); }
.g6-learn-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.g6-learn-head h2 { margin: 0; font-size: 24px; line-height: 1.25; }
.g6-learn-head p { margin: 4px 0 0; color: var(--g6-muted); font-size: 13px; font-weight: 650; }
.g6-learn-page { min-height: 120px; }
.g6-learn-page h3 { margin: 0 0 9px; color: var(--g6-navy); font-size: 20px; }
.g6-learn-page p { margin: 8px 0; font-size: 16px; line-height: 1.75; }
.g6-learn-page .lead { color: var(--g6-muted); font-weight: 650; }
.g6-learn-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--g6-line); }
.g6-step-dots { display: flex; gap: 6px; align-items: center; }
.g6-step-dots i { width: 8px; height: 8px; border-radius: 50%; background: #dce3ec; }
.g6-step-dots i.on { width: 21px; border-radius: 99px; background: var(--g6-blue); }
.g6-formula { margin: 15px auto; padding: 14px 16px; border: 1px solid #d7e4f0; border-radius: 13px; background: #f5f9fd; color: var(--g6-navy); font-size: clamp(22px, 4vw, 31px); font-weight: 900; line-height: 1.35; text-align: center; }
.g6-callout { margin: 15px 0; padding: 12px 15px; border-left: 4px solid var(--g6-coral); border-radius: 0 11px 11px 0; background: #fff6f2; color: #805042; font-size: 14px; font-weight: 750; line-height: 1.6; }
.g6-callout.blue { border-color: var(--g6-blue); background: #f3f8fc; color: #45627e; }
.g6-callout.green { border-color: var(--g6-green); background: #f1faf7; color: #386b5e; }

/* Shared lab surface --------------------------------------- */
.g6-lab {
  margin: 16px 0;
  padding: 17px;
  border: 1px solid var(--g6-line);
  border-radius: 16px;
  background: #fbfcfe;
}

.g6-lab-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.g6-lab-head h3 { margin: 0; color: var(--g6-ink); font-size: 17px; }
.g6-lab-head p { margin: 0; color: var(--g6-muted); font-size: 12px; font-weight: 700; }
.g6-lab-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 13px; }
.g6-lab-status { min-height: 24px; margin-top: 10px; color: var(--g6-muted); font-size: 13px; font-weight: 750; text-align: center; }
.g6-lab-status.good { color: var(--g6-green); }
.g6-lab-status.warn { color: var(--g6-coral); }
.g6-range { width: 100%; accent-color: var(--g6-blue); }
.g6-label { color: var(--g6-muted); font-size: 12px; font-weight: 850; }

/* Circle lab ------------------------------------------------ */
.g6-circle-lab { display: grid; grid-template-columns: minmax(220px, .9fr) minmax(0, 1.1fr); align-items: center; gap: 18px; }
.g6-circle-board { position: relative; min-height: 245px; border: 1px solid #dbe4ed; border-radius: 14px; background: #fff; }
.g6-circle-board svg { display: block; width: 100%; height: 245px; }
.g6-circle-board .radius { stroke: var(--g6-coral); stroke-width: 3; }
.g6-circle-board .diameter { stroke: var(--g6-blue); stroke-width: 2.5; stroke-dasharray: 7 5; }
.g6-circle-board .point { fill: var(--g6-navy); }
.g6-circle-board text { fill: var(--g6-ink); font-size: 13px; font-weight: 800; }
.g6-circle-tools { display: grid; gap: 11px; }
.g6-measure-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.g6-measure-list div { padding: 9px 10px; border-radius: 10px; background: #eef4fa; }
.g6-measure-list dt { color: var(--g6-muted); font-size: 11px; font-weight: 800; }
.g6-measure-list dd { margin: 2px 0 0; color: var(--g6-navy); font-size: 19px; font-weight: 900; }

/* Fraction and equation lab -------------------------------- */
.g6-fraction-lab { display: grid; gap: 13px; }
.g6-fraction-bar { display: grid; overflow: hidden; min-height: 40px; border: 2px solid #9ab5cf; border-radius: 9px; background: #fff; }
.g6-fraction-bar span { border-right: 1px solid rgba(49, 82, 125, .25); background: #d8e8f5; }
.g6-fraction-bar span:nth-child(odd) { background: #f8d5c8; }
.g6-fraction-bar span:last-child { border-right: 0; }
.g6-fraction-caption { display: flex; justify-content: space-between; color: var(--g6-muted); font-size: 12px; font-weight: 800; }
.g6-equation-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: g6-step; }
.g6-equation-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 40px; padding: 6px 9px; border: 1px solid var(--g6-line); border-radius: 9px; background: #fff; font-weight: 800; }
.g6-equation-steps li::before { counter-increment: g6-step; content: counter(g6-step); display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: #eaf1f8; color: var(--g6-blue); font-size: 12px; }
.g6-equation-steps li.current { border-color: #a8c4dd; background: #f4f9fd; }
.g6-equation-steps li.done { border-color: #afd5c8; background: #f2faf7; }

/* Cube and viewpoint lab ----------------------------------- */
.g6-cube-lab { display: grid; grid-template-columns: minmax(200px, .85fr) minmax(0, 1.15fr); gap: 16px; }
.g6-cube-grid { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: minmax(34px, 1fr); gap: 5px; max-width: 330px; margin: 0 auto; padding: 9px; border: 1px solid #d8e2ec; border-radius: 12px; background: #fff; }
.g6-cube-cell { display: grid; min-height: 35px; place-items: center; border: 1px solid #c8d8e5; border-radius: 6px; background: #f1f6fa; color: var(--g6-muted); font-size: 12px; font-weight: 900; cursor: pointer; }
.g6-cube-cell:hover { border-color: var(--g6-blue); }
.g6-cube-cell[data-height="1"] { background: #dcecf6; color: #456b88; }
.g6-cube-cell[data-height="2"] { background: #acd0e4; color: #2d5877; }
.g6-cube-cell[data-height="3"] { background: #7faec9; color: #fff; }
.g6-cube-views { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; align-items: end; }
.g6-cube-view { min-width: 0; padding: 9px 6px; border: 1px solid var(--g6-line); border-radius: 10px; background: #fff; text-align: center; }
.g6-cube-view h4 { margin: 0 0 6px; color: var(--g6-muted); font-size: 11px; }
.g6-cube-view svg { display: block; width: 100%; height: 80px; }

/* Percent and ratio labs ----------------------------------- */
.g6-percent-lab,
.g6-ratio-lab { display: grid; gap: 13px; }
.g6-percent-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; max-width: 410px; margin: 0 auto; }
.g6-percent-grid i { aspect-ratio: 1; border-radius: 3px; background: #e3e9f0; }
.g6-percent-grid i.on { background: var(--g6-coral); }
.g6-percent-readout { color: var(--g6-navy); font-size: 26px; font-weight: 900; text-align: center; }
.g6-percent-forms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.g6-percent-forms div { padding: 9px 5px; border-radius: 10px; background: #eef4fa; text-align: center; }
.g6-percent-forms small { display: block; color: var(--g6-muted); font-size: 11px; font-weight: 800; }
.g6-percent-forms b { display: block; margin-top: 2px; color: var(--g6-ink); font-size: 18px; }
.g6-ratio-track { display: flex; min-height: 44px; overflow: hidden; border-radius: 10px; border: 1px solid #d6e0ea; }
.g6-ratio-track span { display: grid; min-width: 0; place-items: center; border-right: 1px solid rgba(255,255,255,.8); color: #fff; font-size: 14px; font-weight: 900; }
.g6-ratio-track span:last-child { border-right: 0; }
.g6-ratio-track span.a { background: var(--g6-coral); }
.g6-ratio-track span.b { background: var(--g6-blue); }
.g6-ratio-track span.c { background: var(--g6-green); }
.g6-ratio-sliders { display: grid; gap: 7px; }
.g6-ratio-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 34px; align-items: center; gap: 8px; }
.g6-ratio-row b { color: var(--g6-muted); font-size: 12px; }
.g6-ratio-row output { color: var(--g6-navy); font-size: 16px; font-weight: 900; text-align: right; }

/* Charts, table, and experiment labs ------------------------ */
.g6-chart-lab { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, .72fr); gap: 15px; }
.g6-chart-board { min-height: 220px; padding: 12px; border: 1px solid #dce5ed; border-radius: 12px; background: #fff; }
.g6-chart-board svg { display: block; width: 100%; height: 210px; }
.g6-chart-board .axis { stroke: #8997a8; stroke-width: 1.5; }
.g6-chart-board .gridline { stroke: #e8edf2; stroke-width: 1; }
.g6-chart-board .bar { fill: var(--g6-blue); }
.g6-chart-board .line { fill: none; stroke: var(--g6-coral); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.g6-chart-board .dot { fill: #fff; stroke: var(--g6-coral); stroke-width: 2.5; }
.g6-chart-board text { fill: var(--g6-muted); font-size: 10px; font-weight: 750; }
.g6-chart-controls { display: grid; align-content: start; gap: 9px; }
.g6-chart-mode { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.g6-chart-mode button { min-height: 38px; border: 1px solid #d6e1eb; border-radius: 8px; background: #fff; color: var(--g6-muted); font-size: 12px; font-weight: 850; }
.g6-chart-mode button.active { border-color: var(--g6-blue); background: #edf5fb; color: var(--g6-blue); }
.g6-data-table { width: 100%; border-collapse: collapse; overflow: hidden; border: 1px solid var(--g6-line); border-radius: 10px; background: #fff; font-size: 13px; }
.g6-data-table th, .g6-data-table td { padding: 8px 9px; border-bottom: 1px solid #ebeff4; text-align: left; }
.g6-data-table th { color: var(--g6-muted); background: #f5f7fa; font-size: 11px; font-weight: 900; }
.g6-data-table tr:last-child td { border-bottom: 0; }
.g6-data-table input { width: 100%; min-width: 0; border: 1px solid #d4dee9; border-radius: 6px; padding: 5px 6px; color: var(--g6-ink); font: inherit; }
.g6-experiment-board { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(210px, .8fr); gap: 15px; align-items: center; }
.g6-drop-zone { min-height: 190px; display: grid; place-items: center; border: 2px dashed #aabfd2; border-radius: 13px; background: #f5f9fc; }
.g6-ball { width: 56px; height: 56px; border-radius: 50%; background: var(--g6-coral); box-shadow: inset -8px -10px 0 rgba(90, 31, 20, .16), 0 8px 12px rgba(40, 55, 80, .15); transition: transform .5s ease; }
.g6-ball.bounce { animation: g6-bounce .9s ease; }
@keyframes g6-bounce { 0%,100% { transform: translateY(53px) scaleY(.92); } 35% { transform: translateY(-52px) scaleY(1); } 55% { transform: translateY(0) scaleY(.9); } 72% { transform: translateY(-24px) scaleY(1); } }
.g6-experiment-readout { display: grid; gap: 8px; }
.g6-experiment-readout div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 9px 11px; border-radius: 9px; background: #fff; }
.g6-experiment-readout span { color: var(--g6-muted); font-size: 12px; font-weight: 800; }
.g6-experiment-readout b { color: var(--g6-navy); font-size: 19px; }

/* Review and answer feedback ------------------------------- */
.g6-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.g6-review-card { padding: 15px; border: 1px solid var(--g6-line); border-radius: 14px; background: #fff; }
.g6-review-card h3 { margin: 0; color: var(--g6-navy); font-size: 16px; }
.g6-review-card p { margin: 5px 0 0; color: var(--g6-muted); font-size: 13px; line-height: 1.55; }
.g6-answer-check { margin-top: 13px; padding: 12px 14px; border-radius: 10px; background: #f0f8f5; color: var(--g6-green); font-size: 14px; font-weight: 800; }

/* Interactive labs mounted by grade6-labs.js ---------------- */
.g6x {
  display: grid;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--g6-line);
  border-radius: 16px;
  background: #fff;
  color: var(--g6-ink);
  box-shadow: var(--g6-shadow-sm);
}
.g6x-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 14px; }
.g6x-title b { color: var(--g6-navy); font-size: 18px; }
.g6x-title span,
.g6x-small { color: var(--g6-muted); font-size: 12px; font-weight: 700; line-height: 1.55; }
.g6x-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; }
.g6x-controls label,
.g6x-slider { display: grid; gap: 5px; color: var(--g6-muted); font-size: 12px; font-weight: 850; }
.g6x-controls select,
.g6x-controls input[type="number"],
.g6x-controls input[type="range"] { min-width: 0; }
.g6x-controls select,
.g6x-data-inputs input {
  min-height: 34px;
  border: 1px solid #cfd9e5;
  border-radius: 8px;
  background: #fff;
  color: var(--g6-ink);
  font: inherit;
}
.g6x-controls select { padding: 0 9px; }
.g6x-controls input[type="range"],
.g6x-slider input[type="range"] { accent-color: var(--g6-blue); }
.g6x-controls output,
.g6x-slider output { color: var(--g6-navy); font-weight: 900; }
.g6x-slider { grid-template-columns: auto minmax(100px, 1fr) auto; align-items: center; }
.g6x-slider input { min-width: 0; }
.g6x-buttons,
.g6x-step-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.g6x button {
  min-height: 35px;
  padding: 7px 11px;
  border: 1px solid #cbd8e5;
  border-radius: 9px;
  background: #fff;
  color: var(--g6-navy);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}
.g6x button:hover { border-color: #8eafc9; background: #f2f7fb; transform: translateY(-1px); }
.g6x button:focus-visible,
.g6x select:focus-visible,
.g6x input:focus-visible { outline: 3px solid rgba(60, 127, 186, .3); outline-offset: 2px; }
.g6x-step-buttons button[aria-pressed="true"] { border-color: var(--g6-blue); background: #edf5fb; color: var(--g6-blue); }
.g6x-diagram { min-width: 0; overflow: hidden; border: 1px solid #e0e7ef; border-radius: 12px; background: #fbfcfe; }
.g6x-diagram svg { display: block; width: 100%; height: auto; min-height: 160px; }
.g6x-explanation { padding: 12px 14px; border-left: 4px solid var(--g6-blue); border-radius: 8px; background: #f2f7fb; color: var(--g6-muted); font-size: 13px; line-height: 1.6; }
.g6x-explanation b { color: var(--g6-navy); }
.g6x-explanation p { margin: 4px 0 0; }
.g6x-explanation small { display: block; margin-top: 7px; color: var(--g6-muted); }
.g6x-formula { margin-top: 7px; padding: 8px 10px; border-radius: 7px; background: #fff; color: var(--g6-coral); font-weight: 900; }
.g6x-cube-layout { display: grid; grid-template-columns: minmax(205px, .85fr) minmax(280px, 1.15fr); gap: 13px; align-items: center; }
.g6x-grid-axis { margin: 3px 0; color: var(--g6-muted); font-size: 11px; font-weight: 850; text-align: center; }
.g6x-height-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px; border: 1px solid #dfe7ef; border-radius: 10px; background: #f6f9fc; }
.g6x-height-grid button { display: grid; min-height: 68px; place-content: center; gap: 2px; padding: 6px 4px; border-color: #cedce8; background: #fff; }
.g6x-height-grid button b { color: var(--g6-blue); font-size: 21px; line-height: 1; }
.g6x-height-grid button span { color: var(--g6-muted); font-size: 10px; font-weight: 750; }
.g6x-height-grid button[data-height="0"] b { color: #9aa8b8; }
.g6x-cube-views { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.g6x-cube-views figure { min-width: 0; margin: 0; padding: 9px 5px 7px; border: 1px solid #dfe7ef; border-radius: 10px; background: #fbfcfe; text-align: center; }
.g6x-cube-views figcaption { color: var(--g6-navy); font-size: 11px; font-weight: 900; }
.g6x-cube-views svg { display: block; width: 100%; max-height: 136px; margin: 4px auto 0; }
.g6x-cube-views small { display: block; min-height: 2.4em; color: var(--g6-muted); font-size: 10px; line-height: 1.25; }
.g6x-orientation { fill: var(--g6-muted); font-size: 12px; font-weight: 850; }
.g6x-chart-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(205px, .65fr); gap: 12px; align-items: start; }
.g6x-chart-layout .g6x-diagram { min-height: 220px; }
.g6x-data-inputs { display: grid; gap: 7px; }
.g6x-data-inputs label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--g6-muted); font-size: 12px; font-weight: 800; }
.g6x-data-inputs label > span:first-child { display: flex; min-width: 0; align-items: center; gap: 5px; }
.g6x-data-inputs label > span:last-child { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.g6x-data-inputs i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.g6x-data-inputs input { width: 82px; padding: 5px 7px; text-align: right; }
.g6x-input-error { min-height: 1.3em; color: #bd4d38; font-size: 12px; font-weight: 800; }
.g6x-pie-value { fill: #fff; font-size: 12px; font-weight: 900; }

@media (max-width: 680px) {
  .g6x-cube-layout,
  .g6x-chart-layout { grid-template-columns: 1fr; }
  .g6x-cube-layout .g6x-diagram { order: -1; }
}

@media (max-width: 480px) {
  .g6x { padding: 13px; }
  .g6x-title b { font-size: 16px; }
  .g6x-controls { align-items: stretch; flex-direction: column; }
  .g6x-controls label { width: 100%; }
  .g6x-controls select { width: 100%; }
  .g6x-slider { grid-template-columns: 1fr auto; }
  .g6x-slider input { grid-column: 1 / -1; grid-row: 2; }
  .g6x-cube-views { gap: 5px; }
  .g6x-cube-views figcaption { font-size: 10px; }
  .g6x-data-inputs input { width: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .g6x button { transition: none; }
}

/* Responsive layout ---------------------------------------- */
@media (max-width: 820px) {
  .g6-home-hero,
  .g6-chapter-banner { grid-template-columns: 1fr; }
  .g6-hero-art,
  .g6-chapter-banner-art { min-height: 175px; }
  .g6-hero-art img,
  .g6-chapter-banner-art img { min-height: 175px; max-height: 240px; }
  .g6-chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g6-circle-lab,
  .g6-cube-lab,
  .g6-chart-lab,
  .g6-experiment-board { grid-template-columns: 1fr; }
  .g6-circle-board { max-width: 450px; width: 100%; margin: 0 auto; }
  .g6-chart-board { min-height: 200px; }
  .g6-game-list { grid-template-columns: 1fr; }
  .g6-map,
  .g6-lessons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .g6-home-hero { border-radius: 20px; }
  .g6-hero-copy { padding: 23px 19px 25px; }
  .g6-hero-copy h1 { font-size: 30px; }
  .g6-hero-copy p { font-size: 14px; }
  .g6-hero-stats { gap: 7px; margin-top: 18px; }
  .g6-stat { min-width: 0; flex: 1; padding: 8px 9px; }
  .g6-stat b { font-size: 17px; }
  .g6-stat span { font-size: 10px; }
  .g6-route-head { align-items: start; flex-direction: column; gap: 7px; }
  .g6-progress { width: 100%; text-align: left; }
  .g6-chapter-grid { grid-template-columns: 1fr; gap: 11px; }
  .g6-chapter-card { min-height: 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); }
  .g6-chapter-media { height: 100%; min-height: 160px; }
  .g6-chapter-body { padding: 13px 12px; }
  .g6-chapter-body h3 { font-size: 16px; }
  .g6-chapter-body p { font-size: 12px; }
  .g6-tools-row { grid-template-columns: 1fr; gap: 9px; }
  .g6-chapter-banner { border-radius: 18px; }
  .g6-chapter-banner-copy { padding: 22px 19px; }
  .g6-chapter-banner-copy h1 { font-size: 26px; }
  .g6-chapter-banner-copy p { font-size: 13px; }
  .g6-game-card { padding: 13px; gap: 10px; }
  .g6-game-icon { width: 39px; height: 39px; font-size: 20px; }
  .g6-game-main h3 { font-size: 15px; }
  .g6-game-main p { font-size: 12px; }
  .g6-lab { padding: 12px; border-radius: 13px; }
  .g6-lab-head { align-items: start; flex-direction: column; gap: 2px; }
  .g6-measure-list { gap: 6px; }
  .g6-measure-list dd { font-size: 17px; }
  .g6-percent-forms { gap: 5px; }
  .g6-percent-forms b { font-size: 16px; }
  .g6-cube-views { gap: 5px; }
  .g6-cube-view { padding: 7px 3px; }
  .g6-cube-view svg { height: 66px; }
  .g6-review-grid { grid-template-columns: 1fr; }
  .g6-equation-steps li { font-size: 14px; }
  .g6-map,
  .g6-lessons { grid-template-columns: 1fr; gap: 10px; }
  .g6-unit { min-height: 0; padding: 14px; }
  .g6-panel { padding: 16px; border-radius: 15px; }
  .g6-work-head { flex-direction: column; gap: 8px; }
  .g6-book-spread.double { grid-template-columns: 1fr; gap: 10px; }
  .g6-book-spread { min-height: 0; }
  .g6-toc-hotspot span { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .g6-chapter-card,
  .g6-chapter-media img,
  .g6-ball { transition: none; }
  .g6-ball.bounce { animation: none; }
}
