:root {
  color-scheme: light;
  --ink: #17261d;
  --muted: #617068;
  --paper: #fbfaec;
  --band: #fff0bd;
  --line: #cbd7ca;
  --green: #245c3b;
  --green-soft: #dcebd8;
  --yellow: #f2c14d;
  --red: #d85c41;
  --red-soft: #ffe0d5;
  --blue: #267b78;
  --blue-soft: #d8efea;
  --violet: #6c5aa8;
  --violet-soft: #e9e3ff;
  --shadow: 0 14px 32px rgba(35, 49, 41, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: #f7f5ea;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  margin: 0;
  color: var(--ink);
  background: #0c1d16;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  letter-spacing: 0;
  overscroll-behavior-x: none;
  touch-action: pan-y manipulation;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.app-shell {
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--theme-deep, #0c1d16) 96%, #000 4%), color-mix(in srgb, var(--theme-mid, #173925) 94%, #000 6%) 36%, rgba(232, 239, 219, 0.98) 82%),
    url("./assets/snake-habitat-v1.webp") center top / 100% auto no-repeat;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto 16px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--pet-accent, var(--yellow));
  box-shadow: inset 0 -4px 0 rgba(34, 49, 41, 0.12);
  display: grid;
  place-items: center;
  color: var(--ink);
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
  color: #fff8dc;
}

.brand p {
  margin: 3px 0 0;
  color: #c9d8cc;
  font-size: 15px;
}

.nav {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(6, 24, 17, 0.72);
  backdrop-filter: blur(12px);
}

.nav button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 6px;
  color: #d8e1da;
  background: transparent;
  font-size: 17px;
}

.nav button.is-active {
  color: #142118;
  background: var(--pet-accent, var(--yellow));
}

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

.sound-toggle {
  display: grid;
  flex: 0 0 72px;
  place-items: center;
  width: 72px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: #142118;
  background: var(--pet-accent, var(--yellow));
  font-weight: 900;
  cursor: pointer;
}

.sound-toggle span,
.sound-toggle small {
  display: block;
  line-height: 1;
}

.sound-toggle span {
  font-size: 19px;
}

.sound-toggle small {
  margin-top: 2px;
  font-size: 11px;
}

.main {
  max-width: 1180px;
  margin: 0 auto;
}

.hero-band {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid rgba(242, 193, 77, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--theme-deep, #06160f) 94%, #000 6%) 0%, color-mix(in srgb, var(--theme-mid, #081d14) 80%, transparent) 48%, rgba(8, 24, 18, 0.18) 100%),
    url("./assets/snake-habitat-v1.webp") center / cover no-repeat;
  box-shadow: var(--shadow);
}

.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 22px;
  min-height: 360px;
  padding: 34px;
}

.hero-copy h2 {
  max-width: 680px;
  margin: 0;
  font-size: 36px;
  line-height: 1.15;
  color: #fff8dc;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--pet-accent, var(--yellow));
  font-size: 15px;
  font-weight: 900;
}

.hero-copy p {
  max-width: 640px;
  margin: 12px 0 20px;
  color: #e2ebe4;
  font-size: 18px;
  line-height: 1.7;
}

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

.hero-band .ghost {
  color: #fff8dc;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(9, 31, 22, 0.72);
}

.hero-pet {
  align-self: end;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #fff8dc;
  text-align: center;
}

.hero-pet-copy span,
.hero-pet-copy strong,
.hero-pet-copy small {
  display: block;
}

.hero-pet-copy span,
.hero-pet-copy small {
  color: #d8e1da;
  font-size: 14px;
}

.hero-pet-copy strong {
  margin: 3px 0;
  font-size: 23px;
}

.snake-sprite {
  display: block;
  background-image: url("./assets/snake-collection-v1.webp");
  background-repeat: no-repeat;
  background-position: var(--snake-x) var(--snake-y);
  background-size: 300% 200%;
}

.theme-creature {
  display: grid;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pet-accent) 78%, #fff 12%), color-mix(in srgb, var(--theme-mid, #245c3b) 82%, #000 8%));
  font-weight: 900;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}

.pet-photo {
  display: block;
  object-fit: cover;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--pet-accent) 52%, #fff 20%), color-mix(in srgb, var(--theme-mid, #245c3b) 78%, #000 10%));
}

.hero-snake {
  width: 156px;
  height: 156px;
  border: 4px solid var(--pet-accent);
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.46), 0 0 0 8px rgba(255, 255, 255, 0.1);
  animation: snake-breathe 3.2s ease-in-out infinite;
}

.hero-snake.theme-creature {
  font-size: 74px;
}

.hero-snake.pet-photo {
  object-position: center;
}

.app-shell[data-theme="dinosaur"] .pet-photo {
  box-sizing: border-box;
  padding: 6px;
  object-fit: contain;
  background: #f8f7ee;
}

.scene {
  position: relative;
  min-height: 198px;
  border-left: 1px dashed rgba(47, 111, 99, 0.24);
}

.map-road {
  position: absolute;
  left: 22px;
  right: 14px;
  bottom: 34px;
  height: 62px;
  border-bottom: 14px solid rgba(47, 111, 99, 0.22);
  transform: rotate(-4deg);
}

.detective {
  position: absolute;
  left: 42px;
  bottom: 60px;
  width: 86px;
  height: 108px;
}

.detective .hat {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 78px;
  height: 28px;
  border-radius: 8px 8px 4px 4px;
  background: var(--green);
}

.detective .head {
  position: absolute;
  left: 17px;
  top: 26px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff6d6;
  border: 3px solid var(--ink);
}

.detective .body {
  position: absolute;
  left: 24px;
  top: 76px;
  width: 40px;
  height: 28px;
  border-radius: 8px 8px 4px 4px;
  background: var(--yellow);
  border: 3px solid var(--ink);
}

.bubble {
  position: absolute;
  right: 6px;
  top: 22px;
  width: 178px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid rgba(34, 49, 41, 0.18);
  font-weight: 700;
  line-height: 1.4;
}

.station-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.station {
  position: relative;
  min-height: 88px;
  border-radius: 8px;
  border: 1px solid rgba(242, 193, 77, 0.34);
  border-top: 4px solid var(--pet-accent, var(--yellow));
  background: rgba(250, 249, 235, 0.94);
  padding: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.station:hover,
.station:focus-visible {
  border-color: var(--green);
  background: #fff;
  outline: 0;
}

.station-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.station strong {
  display: block;
  font-size: 17px;
}

.station span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 16px;
}

.section-band {
  margin-top: 16px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid rgba(36, 92, 59, 0.2);
  background: rgba(248, 248, 235, 0.92);
  box-shadow: 0 12px 26px rgba(5, 25, 17, 0.1);
}

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

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: 23px;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.metric-grid,
.skill-grid,
.mistake-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.skill-card,
.mistake-card,
.question-card,
.parent-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 15px;
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.skill-card {
  min-height: 134px;
}

.skill-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.skill-card h3 {
  margin: 0;
  font-size: 19px;
}

.skill-card p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.skill-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #1b5b4f;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e7eadf;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--pet-accent, var(--yellow)));
}

.unlock-track {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.7fr);
  gap: 18px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(36, 92, 59, 0.18);
  border-radius: 8px;
  background: #eef3df;
}

.unlock-copy strong,
.unlock-copy span {
  display: block;
}

.unlock-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.unlock-progress {
  height: 12px;
}

.reward-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 16px 0;
  padding: 18px;
  border: 2px solid rgba(242, 193, 77, 0.48);
  border-radius: 8px;
  background: #fff8d8;
  box-shadow: var(--shadow);
}

.reward-console h2 {
  margin: 0 0 8px;
  font-size: 27px;
}

.reward-console p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.6;
}

.reward-rule {
  font-size: 15px;
}

.reward-console-actions {
  display: grid;
  gap: 10px;
  min-width: 190px;
}

.home-lottery-panel {
  display: grid;
  grid-template-columns: minmax(270px, 0.8fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin: 16px 0;
  padding: 18px;
  border: 2px solid rgba(242, 193, 77, 0.56);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8d8, #f0f8ea);
  box-shadow: var(--shadow);
}

.home-lottery-wheel .lottery-wheel-wrap {
  min-height: 270px;
}

.home-lottery-wheel .lottery-wheel {
  width: min(250px, 62vw);
}

.home-lottery-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.home-lottery-copy h2 {
  margin: 0;
  font-size: 27px;
}

.home-lottery-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.home-lottery-target,
.home-lottery-backfill {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.home-lottery-target strong,
.home-lottery-target small,
.home-lottery-backfill strong,
.home-lottery-backfill span {
  display: block;
}

.home-lottery-target small,
.home-lottery-backfill span {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
}

.home-lottery-backfill {
  grid-template-columns: 1fr;
  border-left: 5px solid var(--yellow);
}

.home-lottery-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lottery-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 16, 10, 0.8);
}

.lottery-panel {
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  border: 2px solid rgba(242, 193, 77, 0.6);
  background: #fff8d8;
  box-shadow: var(--shadow);
}

.lottery-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.lottery-head h2 {
  margin: 0 0 8px;
  font-size: 27px;
}

.lottery-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.lottery-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.lottery-wheel-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
}

.lottery-wheel {
  position: relative;
  display: grid;
  place-items: center;
  width: min(300px, 72vw);
  aspect-ratio: 1;
  border: 10px solid #fffdf4;
  border-radius: 50%;
  background: conic-gradient(var(--wheel-gradient));
  box-shadow: 0 18px 45px rgba(20, 45, 30, 0.28), inset 0 0 0 4px rgba(23, 57, 37, 0.24);
  transform: rotate(var(--wheel-rotation, 0deg));
  transition: transform 850ms cubic-bezier(0.18, 0.8, 0.22, 1);
}

.lottery-wheel.is-spinning {
  animation: wheelResultSpin 1.05s cubic-bezier(0.16, 0.84, 0.18, 1) both;
}

.lottery-wheel::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 253, 244, 0.72);
}

.wheel-center {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 6px solid #fffdf4;
  border-radius: 50%;
  background: var(--theme-deep);
  color: #fff8dd;
  font-size: 24px;
  font-weight: 900;
  transform: rotate(calc(-1 * var(--wheel-rotation, 0deg)));
}

.wheel-pointer {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 34px solid var(--red);
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.22));
  transform: translateX(-50%);
  transform-origin: 50% 160px;
}

.wheel-pointer.is-spinning {
  animation: pointerOrbitSpin 1.05s cubic-bezier(0.16, 0.84, 0.18, 1) both;
}

.wheel-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.wheel-legend span,
.lottery-rules {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.wheel-legend strong,
.lottery-rules strong {
  color: var(--ink);
  font-size: 15px;
}

.wheel-legend small,
.lottery-rules span {
  color: var(--muted);
  line-height: 1.45;
}

.lottery-side {
  display: grid;
  gap: 12px;
}

.lottery-result {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.fragment-result {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
}

.jackpot-result {
  border: 2px solid rgba(242, 193, 77, 0.9);
  background: linear-gradient(135deg, #fff3b0, #ffffff 55%, #eaf7ee);
}

.lottery-result-popup {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 16, 10, 0.72);
}

.lottery-result-panel {
  width: min(520px, 100%);
  padding: 18px;
  border-radius: 8px;
  border: 3px solid rgba(242, 193, 77, 0.82);
  background: #fffdf4;
  box-shadow: var(--shadow);
}

.lottery-result-panel h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

@keyframes wheelResultSpin {
  from {
    transform: rotate(calc(var(--wheel-rotation, 0deg) - 1080deg));
  }
  72% {
    transform: rotate(calc(var(--wheel-rotation, 0deg) + 14deg));
  }
  to {
    transform: rotate(var(--wheel-rotation, 0deg));
  }
}

@keyframes pointerOrbitSpin {
  0% {
    transform: translateX(-50%) rotate(-1260deg);
  }
  70% {
    transform: translateX(-50%) rotate(20deg);
  }
  86% {
    transform: translateX(-50%) rotate(-8deg);
  }
  100% {
    transform: translateX(-50%) rotate(0deg);
  }
}

.lottery-result strong,
.lottery-result span {
  display: block;
}

.lottery-result strong {
  font-size: 20px;
}

.lottery-result span {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
}

.lottery-snake {
  width: 72px;
  height: 72px;
  border: 3px solid var(--pet-accent);
  border-radius: 50%;
}

.lottery-snake.theme-creature {
  font-size: 34px;
}

.lottery-snake.pet-photo,
.runner-snake.pet-photo {
  object-fit: cover;
}

.checkin-panel,
.focus-panel,
.tracking-panel,
.mini-result {
  margin: 16px 0;
}

.checkin-panel,
.tracking-panel,
.mini-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.checkin-panel h2,
.tracking-panel h2,
.focus-card h2 {
  margin: 0 0 8px;
  font-size: 25px;
}

.checkin-panel p,
.tracking-panel p,
.focus-card p,
.mini-result span {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.tracking-panel {
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  border: 2px solid rgba(38, 123, 120, 0.26);
  background: #edf7f1;
}

.tracking-main,
.tracking-side {
  min-width: 0;
}

.tracking-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.tracking-meter span {
  color: #1b5b4f;
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.tracking-side {
  display: grid;
  gap: 7px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.tracking-side strong,
.tracking-side span,
.tracking-side small {
  display: block;
}

.tracking-side strong {
  font-size: 20px;
}

.tracking-side span,
.tracking-side small {
  color: var(--muted);
  line-height: 1.45;
}

.tracking-side button {
  margin-top: 4px;
}

.tracking-result {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--blue-soft);
}

.tracking-result strong,
.tracking-result span {
  display: block;
}

.tracking-result span {
  color: #244f77;
  line-height: 1.45;
}

.checkin-actions {
  display: grid;
  gap: 10px;
  min-width: 210px;
}

.streak-track {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.streak-track span {
  display: grid;
  place-items: center;
  min-height: 32px;
  border-radius: 8px;
  color: var(--muted);
  background: #eef3df;
  font-weight: 900;
}

.streak-track span.is-active {
  color: #142118;
  background: var(--pet-accent, var(--yellow));
}

.streak-track span.is-special {
  border: 2px solid var(--yellow);
}

.focus-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.mode-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.diagnostic-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.5fr) auto;
  gap: 16px;
  align-items: center;
  margin: 16px 0;
  padding: 18px;
  border: 1px solid rgba(45, 128, 109, 0.25);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.diagnostic-panel h2,
.diagnostic-panel p { margin: 4px 0; }

.diagnostic-panel p { color: var(--muted); line-height: 1.5; }

.diagnostic-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.diagnostic-metrics div {
  display: grid;
  gap: 2px;
  min-height: 82px;
  padding: 10px;
  border-radius: 8px;
  background: var(--blue-soft);
}

.diagnostic-metrics strong { font-size: 24px; }
.diagnostic-metrics small { color: var(--muted); line-height: 1.3; }

.mode-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  border: 1px solid rgba(36, 92, 59, 0.18);
  border-radius: 8px;
  background: var(--paper);
  padding: 13px;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(5, 25, 17, 0.08);
}

.mode-card span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-size: 15px;
  font-weight: 900;
}

.mode-card strong {
  font-size: 18px;
}

.mode-card small {
  color: var(--muted);
  line-height: 1.45;
}

.focus-card {
  padding: 18px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.focus-card button {
  margin-top: 14px;
}

.coach-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.coach-row:first-of-type {
  border-top: 0;
}

.coach-row strong,
.coach-row span,
.coach-row small {
  display: block;
}

.coach-row span,
.coach-row small {
  color: var(--muted);
  line-height: 1.45;
}

.penalty-result,
.no-xp {
  border-color: rgba(216, 92, 65, 0.46);
  color: #7b2e22;
  background: var(--red-soft);
}

.xp-reward {
  border-color: rgba(38, 123, 120, 0.36);
  color: #1b5b4f;
  background: var(--blue-soft);
}

.primary,
.secondary,
.ghost,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
}

.primary {
  color: #fff;
  background: var(--green);
}

.secondary {
  color: var(--ink);
  background: var(--yellow);
}

.ghost {
  color: var(--green);
  background: #fff;
  border: 1px solid rgba(47, 111, 99, 0.24);
}

.danger {
  color: var(--red);
  background: var(--red-soft);
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 14px;
  font-weight: 900;
}

.review-list {
  display: grid;
  gap: 10px;
}

.review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.review-row strong {
  display: block;
  font-size: 17px;
}

.review-row span {
  color: var(--muted);
  font-size: 14px;
}

.mistake-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.diagnosis-grid,
.mistake-clusters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.diagnosis-card {
  padding: 14px;
  border-radius: 8px;
  background: var(--blue-soft);
}

.diagnosis-card h3 {
  margin: 8px 0;
  font-size: 19px;
}

.diagnosis-card p,
.diagnosis-card small {
  display: block;
  margin: 0;
  color: #244f77;
  line-height: 1.5;
}

.mistake-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 15px;
}

.empty {
  padding: 26px;
  border: 1px dashed rgba(47, 111, 99, 0.3);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
  text-align: center;
}

.snake-den {
  overflow: hidden;
}

.snake-star-total {
  min-width: 100px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #322500;
  background: var(--yellow);
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

.snake-draw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--green-soft);
}

.snake-draw-row span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

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

.pet-card {
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}

.pet-card.is-selected {
  border-color: var(--pet-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pet-accent) 26%, transparent);
}

.pet-card.is-locked {
  opacity: 0.66;
  cursor: not-allowed;
}

.pet-card.is-locked .pet-portrait {
  filter: grayscale(1) brightness(0.58);
}

.pet-portrait {
  width: 100%;
  aspect-ratio: 1.35 / 1;
  border-bottom: 4px solid var(--pet-accent);
}

.pet-portrait.theme-creature {
  font-size: 72px;
}

.pet-portrait.pet-photo {
  object-position: center;
}

.pet-card-body {
  display: block;
  min-height: 190px;
  padding: 14px;
}

.pet-card-body > span,
.pet-card-body > strong,
.pet-card-body > small {
  display: block;
}

.pet-card-body > strong {
  margin: 6px 0;
  font-size: 22px;
}

.pet-card-body > span:not(.pet-status) {
  color: var(--green);
  font-size: 15px;
  font-weight: 800;
}

.fragment-meter {
  display: block;
  height: 9px;
  margin-top: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eadf;
}

.fragment-meter > i {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--pet-accent));
}

.pet-card-body > small {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.pet-status {
  color: #6c4d00;
  font-size: 13px;
  font-weight: 900;
}

.resource-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.resource-pills span {
  padding: 9px 12px;
  border-radius: 8px;
  color: #322500;
  background: var(--yellow);
  font-weight: 900;
}

.pet-progress-text {
  margin-top: 8px;
  color: var(--muted) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.attr-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.attr-grid em {
  padding: 5px 7px;
  border-radius: 6px;
  color: #1b5b4f;
  background: var(--green-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.pet-actions {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pet-actions button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.safety-note {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 5px solid var(--red);
  border-radius: 6px;
  color: #513126;
  background: var(--red-soft);
}

.safety-note span {
  line-height: 1.55;
}

.runner {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 16, 10, 0.78);
}

.runner-panel {
  width: min(900px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 8px;
  border-top: 6px solid var(--pet-accent, var(--yellow));
  background: #f7f7e9;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.runner-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 245, 0.94);
  backdrop-filter: blur(10px);
}

.runner-head strong {
  display: block;
  font-size: 20px;
}

.runner-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.runner-snake {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border: 3px solid var(--pet-accent);
  border-radius: 50%;
}

.runner-snake.theme-creature {
  font-size: 25px;
}

.runner-snake.pet-photo {
  object-position: center;
}

.runner-head span {
  display: block;
  color: var(--muted);
  font-size: 15px;
  margin-top: 2px;
}

.runner-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.star-counter {
  min-width: 66px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #5b4600 !important;
  background: #fff1a8;
  font-size: 16px !important;
  font-weight: 900;
  text-align: center;
}

.runner-body {
  padding: 18px;
}

.round-target {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-radius: 8px;
  color: #244f77;
  background: var(--blue-soft);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
}

.weekly-direct-note {
  margin-bottom: 16px;
  padding: 11px 12px;
  border-radius: 8px;
  color: #5b4600;
  background: #fff1a8;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.45;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.step {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 15px;
}

.step.is-active {
  color: var(--ink);
  border-color: rgba(247, 201, 72, 0.8);
  background: #fff2bd;
  font-weight: 800;
}

.question-stem {
  margin: 0 0 14px;
  font-size: 25px;
  line-height: 1.7;
}

.question-stem mark {
  border-radius: 6px;
  padding: 0 3px;
  color: inherit;
}

.stem-number {
  background: #fff1a8;
}

.stem-key {
  background: var(--blue-soft);
}

.mission-label {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 900;
}

.choice-grid,
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice,
.chip {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  font-size: 18px;
  line-height: 1.5;
  cursor: pointer;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
}

.choice-letter {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
}

.choice.is-selected .choice-letter {
  color: #fff;
  background: var(--pet-accent, var(--green));
}

.choice.is-selected,
.chip.is-selected {
  border-color: var(--pet-accent, var(--green));
  background: var(--green-soft);
}

.choice.is-wrong {
  border-color: var(--red);
  background: var(--red-soft);
}

.hint {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #244f77;
  font-size: 17px;
  line-height: 1.55;
}

.check-step {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border: 2px solid rgba(242, 193, 77, 0.72);
  border-radius: 8px;
  background: #fff7cf;
  color: #5b4600;
  padding: 10px 12px;
  font-size: 18px;
  font-weight: 900;
  text-align: left;
}

.check-step span {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: #b67800;
}

.check-step.is-checked {
  border-color: var(--green);
  background: var(--green-soft);
  color: #1b5b4f;
}

.check-step.is-checked span {
  background: var(--green);
}

.scratchpad-panel {
  margin-top: 14px;
  border: 2px solid rgba(47, 111, 99, 0.22);
  border-radius: 8px;
  background: #f4f1df;
  overflow: hidden;
}

.scratchpad-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.scratchpad-head span {
  color: var(--muted);
  font-size: 14px;
}

.scratchpad-head button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
}

.scratchpad-canvas {
  display: block;
  width: 100%;
  height: 230px;
  background:
    linear-gradient(#e8dfc4 1px, transparent 1px) 0 0 / 100% 46px,
    linear-gradient(90deg, rgba(232, 223, 196, 0.55) 1px, transparent 1px) 0 0 / 46px 100%,
    #fffdf4;
  cursor: crosshair;
  touch-action: none;
}

.answer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.answer-input {
  width: min(260px, 100%);
  min-height: 48px;
  border: 2px solid rgba(47, 111, 99, 0.24);
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
  font-size: 20px;
  outline: none;
}

.answer-input:focus {
  border-color: var(--green);
}

.feedback {
  margin-top: 15px;
  border-radius: 8px;
  padding: 14px;
  font-size: 18px;
  line-height: 1.7;
}

.feedback.good {
  background: var(--green-soft);
  color: #1b5b4f;
}

.feedback.bad {
  background: var(--red-soft);
  color: #8d2f20;
}

.reward {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--pet-accent, var(--yellow));
  border-radius: 8px;
  color: #5b4600;
  background: #fff7cf;
}

.has-success.pet-effect-pit-viper .runner-snake {
  animation: snake-breathe 0.7s ease-in-out 2;
}

.has-success.pet-effect-krait {
  box-shadow: 0 0 0 5px #eef5f8, 0 0 30px rgba(210, 230, 240, 0.7);
}

.has-success.pet-effect-cobra .runner-snake {
  animation: cobra-pulse 0.65s ease-out 2;
}

.has-success.pet-effect-rattlesnake .runner-snake {
  animation: rattle 0.16s linear 5;
}

.has-success.pet-effect-black-mamba .runner-snake {
  animation: mamba-dash 0.7s ease-out;
}

.has-success.pet-effect-king-cobra {
  box-shadow: 0 0 0 6px rgba(242, 193, 77, 0.72), 0 0 42px rgba(242, 193, 77, 0.78);
}

@keyframes snake-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.025); }
}

@keyframes cobra-pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 154, 82, 0.72); }
  100% { box-shadow: 0 0 0 16px rgba(217, 154, 82, 0); }
}

@keyframes rattle {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(5deg); }
}

@keyframes mamba-dash {
  0% { transform: translateX(-20px); opacity: 0.3; }
  60% { transform: translateX(5px); opacity: 1; }
  100% { transform: translateX(0); }
}

@keyframes unlock-pop {
  0% { transform: scale(0.88); opacity: 0; }
  70% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}

.reward span {
  font-size: 24px;
}

.runner-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.parent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.parent-wide {
  grid-column: 1 / -1;
}

.parent-panel h3 {
  margin: 0 0 10px;
  font-size: 19px;
}

.parent-panel p,
.parent-panel li {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.parent-panel ul,
.parent-panel ol {
  margin: 0;
  padding-left: 20px;
}

.transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.transfer-message {
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.feedback-loop {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.feedback-loop span,
.tracking-parent-metrics span {
  display: block;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  color: #1b5b4f;
  background: var(--green-soft);
  font-weight: 900;
  text-align: center;
}

.tracking-parent-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tracking-parent-metrics strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 20px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.theme-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--pet-accent);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--theme-soft), #fffdf4);
}

.theme-card.is-active {
  box-shadow: inset 0 0 0 2px var(--pet-accent);
}

.theme-card strong,
.theme-card span,
.theme-card small {
  display: block;
  min-width: 0;
}

.theme-card strong {
  font-size: 18px;
}

.theme-card span,
.theme-card small {
  color: var(--muted);
  line-height: 1.35;
}

.theme-mark {
  display: grid !important;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  background: var(--theme-mid);
  font-size: 19px;
  font-weight: 900;
}

.theme-card button {
  margin-top: 4px;
  min-height: 36px;
  padding: 0 10px;
  font-size: 14px;
}

.parent-lock {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 16, 10, 0.78);
}

.parent-lock-panel {
  width: min(460px, 100%);
  padding: 18px;
  border-radius: 8px;
  border-top: 6px solid var(--pet-accent, var(--yellow));
  background: var(--paper);
  box-shadow: var(--shadow);
}

.parent-lock-panel h2 {
  margin: 0 0 8px;
  font-size: 25px;
}

.parent-lock-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.password-field {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 900;
}

.password-field input {
  width: 100%;
  min-height: 48px;
  border: 2px solid rgba(47, 111, 99, 0.24);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  font-size: 20px;
}

.lock-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #7b2e22;
  background: var(--red-soft);
  font-weight: 900;
}

.code {
  display: block;
  margin-top: 8px;
  padding: 10px;
  overflow-x: auto;
  border-radius: 8px;
  background: #1f2d29;
  color: #fff8dd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 860px) {
  .topbar,
  .hero-content,
  .panel-grid,
  .reward-console,
  .home-lottery-panel,
  .lottery-head,
  .lottery-layout,
  .checkin-panel,
  .tracking-panel,
  .focus-panel,
  .parent-grid {
    grid-template-columns: 1fr;
  }

  .diagnostic-panel { grid-template-columns: 1fr; }
  .diagnostic-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    flex: 1;
    overflow-x: auto;
  }

  .top-actions {
    width: 100%;
  }

  .hero-content {
    display: block;
  }

  .hero-band {
    background-position: 60% center;
  }

  .hero-copy h2 {
    font-size: 34px;
  }

  .scene {
    min-height: 170px;
    margin-top: 18px;
    border-left: 0;
    border-top: 1px dashed rgba(47, 111, 99, 0.24);
  }

  .hero-pet {
    grid-template-columns: 120px minmax(0, 180px);
    justify-content: end;
    justify-items: start;
    align-items: center;
    margin-top: 24px;
    text-align: left;
  }

  .hero-snake {
    width: 120px;
    height: 120px;
  }

  .station-strip,
  .metric-grid,
  .skill-grid,
  .theme-grid,
  .mode-panel,
  .diagnosis-grid,
  .feedback-loop,
  .mistake-clusters,
  .mistake-grid,
  .choice-grid,
  .chip-grid,
  .stepper {
    grid-template-columns: 1fr;
  }

  .station-strip,
  .metric-grid,
  .mode-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .unlock-track {
    grid-template-columns: 1fr;
  }

  .tracking-meter {
    grid-template-columns: 1fr;
  }

  .reward-console-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .home-lottery-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lottery-wheel-wrap {
    min-height: 280px;
  }

  .checkin-actions {
    min-width: 0;
  }

  .resource-pills {
    justify-content: flex-start;
  }

  .runner {
    padding: 0;
  }

  .runner-panel {
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 520px) {
  .mode-panel,
  .diagnostic-metrics { grid-template-columns: 1fr; }
  .station-strip,
  .metric-grid,
  .mode-panel,
  .tracking-parent-metrics {
    grid-template-columns: 1fr;
  }

  .runner-head {
    align-items: flex-start;
  }

  .runner-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .pet-grid {
    grid-template-columns: 1fr;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }

  .wheel-legend {
    grid-template-columns: 1fr;
  }

  .home-lottery-actions {
    grid-template-columns: 1fr;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .lottery-modal {
    padding: 0;
  }

  .lottery-panel {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .hero-pet {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .hero-snake {
    width: 92px;
    height: 92px;
  }

  .sound-toggle {
    flex-basis: 68px;
    width: 68px;
  }

  .reward-console-actions {
    grid-template-columns: 1fr;
  }

  .scratchpad-head {
    grid-template-columns: 1fr auto;
  }

  .scratchpad-head span {
    grid-column: 1 / -1;
  }

  .scratchpad-canvas {
    height: 210px;
  }
}

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

/* 学习探险队：英语学科 */
.subject-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9px;
  background: rgba(6, 24, 17, 0.72);
}

.subject-switcher button {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  color: #d8e1da;
  background: transparent;
  font-size: 16px;
  font-weight: 800;
}

.subject-switcher button.is-active {
  color: #142118;
  background: var(--pet-accent, var(--yellow));
}

.subject-switcher button.is-coming {
  color: #94a59a;
  cursor: default;
}

.english-page {
  display: grid;
  gap: 18px;
  padding-bottom: 32px;
}

.english-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 20px;
  min-height: 300px;
  padding: 28px;
  border: 1px solid rgba(242, 193, 77, 0.46);
  border-radius: 12px;
  color: #fff8dc;
  background: linear-gradient(112deg, rgba(9, 29, 20, 0.98), rgba(22, 71, 70, 0.9)), url("./assets/snake-habitat-v1.webp") center / cover;
  box-shadow: var(--shadow);
}

.english-hero h2 {
  max-width: 720px;
  margin: 8px 0 12px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
}

.english-hero p {
  max-width: 720px;
  margin: 0 0 20px;
  color: #e2ebe4;
  line-height: 1.75;
}

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

.english-cover {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  color: #dbe9de;
  text-align: center;
}

.english-cover-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 186px;
  overflow: hidden;
  border: 5px solid #fff8dc;
  border-radius: 5px;
  background: linear-gradient(160deg, #eaf4de, #78a876 55%, #2c6245);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.english-cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.english-cover-frame span {
  display: none;
  color: #244e3a;
  font-size: 17px;
  line-height: 1.5;
}

.english-cover-frame.fallback span {
  display: block;
}

.english-cover small {
  font-size: 12px;
}

.english-message {
  padding: 12px 16px;
  border: 1px solid #f0c86a;
  border-radius: 10px;
  color: #684a12;
  background: #fff7d7;
  font-size: 16px;
  font-weight: 700;
}

.english-actions button {
  min-height: 44px;
}

.english-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.english-metrics > div,
.english-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 8px 20px rgba(35, 49, 41, 0.07);
}

.english-metrics > div {
  display: grid;
  gap: 4px;
  padding: 16px;
}

.english-metrics strong {
  color: var(--green);
  font-size: 27px;
}

.english-metrics span {
  color: var(--muted);
  font-size: 14px;
}

.english-metrics i,
.english-progress {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #e4ece2;
}

.english-metrics i::before,
.english-progress::before {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7cae56, #2c8177);
  content: "";
}

.english-section-head,
.english-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.english-section-head {
  padding: 4px 2px 0;
}

.english-section-head h3,
.english-panel-head h3 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 22px;
}

.english-day-label,
.english-counter {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.english-map {
  display: grid;
  grid-template-columns: repeat(20, minmax(24px, 1fr));
  gap: 6px;
  padding: 15px;
  border: 1px solid #cbd7ca;
  border-radius: 12px;
  background: #f1f7ec;
}

.english-day {
  display: grid;
  place-items: center;
  min-height: 31px;
  border: 1px solid #c7d5c2;
  border-radius: 50%;
  color: #6d7e71;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.english-day.done {
  color: #fff;
  border-color: #5b9b5b;
  background: #5b9b5b;
}

.english-day.current {
  color: #4d3813;
  border-color: #e4ad38;
  background: #f7d572;
  box-shadow: 0 0 0 3px rgba(242, 193, 77, 0.25);
}

.english-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.english-panel {
  padding: 18px;
}

.english-card-grid,
.english-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.english-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d7e2d4;
  border-radius: 10px;
  background: #fbfff9;
}

.english-card.is-new {
  border-color: #9cc7c0;
  background: #f2fbf7;
}

.english-card.is-core {
  box-shadow: inset 4px 0 0 #f1c457;
}

.english-card-top,
.english-record-row,
.english-word-line,
.english-filter {
  display: flex;
  align-items: center;
  gap: 7px;
}

.english-card-top {
  justify-content: space-between;
}

.english-chip {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border-radius: 99px;
  color: #4f6556;
  background: #e9f0e7;
  font-size: 11px;
  font-weight: 900;
}

.english-chip.new {
  color: #1f6862;
  background: #d7efeb;
}

.english-chip.old {
  color: #6b725e;
  background: #eef1df;
}

.english-word-line strong {
  overflow: hidden;
  color: #1c563e;
  font-size: 23px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.english-speak {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e8f3e6;
  cursor: pointer;
}

.english-speak.compact {
  flex-basis: 44px;
  width: 44px;
  height: 44px;
}

.english-meaning {
  min-height: 38px;
  margin: 0;
  color: #5d6d63;
  font-size: 15px;
  line-height: 1.45;
}

.english-skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.english-skill,
.english-record,
.english-play-record,
.english-filter button {
  min-height: 44px;
  border: 1px solid #c8d8c6;
  border-radius: 7px;
  color: #345945;
  background: #f5faf1;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.english-skill span {
  display: inline-block;
  margin-right: 4px;
  color: #6e9871;
  font-size: 11px;
}

.english-skill.is-done {
  border-color: #7eb289;
  color: #205f3b;
  background: #e0f3df;
}

.english-record-row {
  flex-wrap: wrap;
}

.english-record {
  padding: 0 10px;
}

.english-record.is-recording {
  color: #fff;
  border-color: #c85a43;
  background: #c85a43;
}

.english-play-record {
  padding: 0 10px;
  color: #255e72;
  border-color: #a8ced6;
  background: #e9f7fa;
}

.english-record-row small {
  margin-left: auto;
  color: #789080;
  font-size: 11px;
}

.english-core-note {
  color: #9b6a13;
  font-size: 12px;
  font-weight: 900;
}

.english-library-note {
  color: #78887d;
  font-size: 12px;
  font-weight: 700;
}

.english-side {
  display: grid;
  gap: 18px;
}

.english-spell-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.english-spell-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 11px;
  border: 1px solid #f0dc9a;
  border-radius: 9px;
  background: #fffaf0;
}

.english-spell-card > div:first-child {
  display: grid;
  gap: 4px;
}

.english-spell-card strong {
  color: #5e4a1a;
  font-size: 15px;
}

.english-spell-card small,
.english-spell-card em {
  color: #8b8067;
  font-size: 11px;
  font-style: normal;
}

.english-spell-card input {
  min-width: 0;
  min-height: 44px;
  grid-column: 1 / 2;
  padding: 0 10px;
  border: 1px solid #dccb9e;
  border-radius: 7px;
  color: #243a2a;
  background: #fff;
}

.english-spell-card .primary.small {
  grid-column: 2 / 3;
  grid-row: 2;
  min-height: 44px;
  padding: 0 12px;
}

.english-spell-card em {
  grid-column: 1 / -1;
}

.english-note {
  border-color: #b8d7d2;
  background: #eef9f7;
}

.english-note strong {
  color: #256862;
}

.english-note p,
.english-library-copy {
  margin: 8px 0 0;
  color: #5f7067;
  font-size: 14px;
  line-height: 1.65;
}

.english-library {
  padding-bottom: 22px;
}

.english-filter button {
  min-height: 44px;
  padding: 0 10px;
  font-size: 12px;
}

.english-filter button.is-active {
  color: #fff;
  border-color: #2b7869;
  background: #2b7869;
}

.english-empty {
  grid-column: 1 / -1;
  padding: 26px;
  color: #708074;
  border: 1px dashed #c5d4c4;
  border-radius: 10px;
  text-align: center;
}

.english-more {
  display: block;
  min-height: 44px;
  margin: 16px auto 0;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .english-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .english-hero {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .english-cover {
    display: none;
  }

  .english-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .english-map {
    grid-template-columns: repeat(10, minmax(24px, 1fr));
  }

  .english-card-grid,
  .english-library-grid {
    grid-template-columns: 1fr;
  }

  .english-section-head,
  .english-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .subject-switcher button {
    min-height: 44px;
    padding: 0 9px;
  }
}
