:root {
  color-scheme: dark;
  --primary: #55aa33;
  --primary-hot: #7ee255;
  --secondary: #3ab3da;
  --tertiary: #8b5a2b;
  --neutral: #1a1a1a;
  --neutral-2: #242424;
  --ink: #eeeeea;
  --muted: #cbd9c2;
  --panel: rgba(26, 26, 26, 0.82);
  --panel-border: rgba(85, 170, 51, 0.46);
  --font-headline: "Space Mono", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", monospace;
  --font-body: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-label: "JetBrains Mono", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", monospace;
  --font-cn: "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font-body);
  background: #111711;
  color: var(--ink);
  letter-spacing: 0;
}

body.logged-out {
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body.logged-out .world-shell {
  min-height: auto;
}

body.logged-out.showcase-active .brand-en,
body.logged-out.showcase-active .brand-cn,
body.logged-out.showcase-active .student-card,
body.logged-out.showcase-active .dock {
  opacity: 0;
  pointer-events: none;
}

button {
  font: inherit;
  color: inherit;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ui-icon,
.task-icon svg {
  width: 1em;
  height: 1em;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.world-shell {
  min-height: 100vh;
  background: linear-gradient(180deg, #101410 0 7%, #232a25 45%, #4d3b2c 100%);
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 80;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5.2vw;
  background: rgba(26, 26, 26, 0.93);
  border-bottom: 1px solid rgba(85, 170, 51, 0.34);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: max-content auto;
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: 12px;
  gap: 1px;
  font-family: var(--font-headline);
  font-weight: 900;
  font-style: normal;
  letter-spacing: 0;
  color: var(--primary-hot);
  transform: skewX(-8deg);
  line-height: 1;
  transition: left 0.35s ease, top 0.35s ease, transform 0.35s ease;
}

body.logged-out .brand {
  position: static;
  width: 0;
  height: 0;
  overflow: visible;
  text-align: center;
  transform: none;
  pointer-events: none;
}

body.logged-out .brand-en {
  display: block;
  position: fixed;
  left: 50%;
  top: 27vh;
  z-index: 20;
  width: min(82vw, 1080px);
  font-size: clamp(3.2rem, 5.7vw, 6.25rem);
  line-height: 0.98;
  transform: translate(-50%, -50%) skewX(-8deg);
  pointer-events: none;
}

body.logged-out .brand-cn {
  display: block;
  position: fixed;
  left: 50%;
  top: 63vh;
  z-index: 20;
  margin-top: 0;
  font-size: clamp(1.45rem, 2.4vw, 3rem);
  transform: translate(-50%, -50%) skewX(-8deg);
  pointer-events: none;
}

.brand-en {
  grid-column: 1 / -1;
  font-size: clamp(1.15rem, 2.1vw, 1.8rem);
  text-shadow: 0 0 12px rgba(85, 170, 51, 0.72);
}

.brand-subrow {
  grid-column: 1 / -1;
  grid-row: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
}

.brand-en span {
  display: inline;
}

body.logged-out .brand-en span {
  display: block;
  white-space: nowrap;
}

.brand-cn {
  grid-column: auto;
  font-family: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(0.86rem, 1.38vw, 1.28rem);
  font-weight: 900;
  color: #79d858;
  text-shadow:
    0 0 6px rgba(126, 226, 85, 0.92),
    0 0 14px rgba(85, 170, 51, 0.72),
    0 0 28px rgba(85, 170, 51, 0.42);
  letter-spacing: 0.08em;
}

.top-actions {
  position: relative;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
}

.screenshot-trigger {
  width: 42px;
  padding: 0;
}

.screenshot-trigger .ui-icon {
  width: 19px;
  height: 19px;
}

body.logged-out .topbar {
  justify-content: flex-start;
  padding-left: 5vw;
}

body.logged-out .top-chip,
body.logged-out .model-select-wrap,
body.logged-out .icon-button {
  display: none;
}

body.logged-out .top-chip {
  display: flex;
}

.icon-button,
.login-trigger,
.admin-trigger,
.top-chip,
.model-select-wrap {
  border: 1px solid transparent;
  background: transparent;
  min-width: 42px;
  height: 42px;
  cursor: pointer;
  pointer-events: auto;
}

.icon-button {
  font-size: 1.45rem;
  color: #d7dfce;
}

.login-trigger,
.admin-trigger,
.top-chip,
.model-select-wrap {
  font-family: var(--font-label);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 8px;
  color: #e9f2e4;
}

.login-trigger:hover,
.admin-trigger:hover,
.top-chip:hover,
.model-select-wrap:hover {
  border-color: rgba(85, 170, 51, 0.48);
  background: rgba(85, 170, 51, 0.14);
}

.admin-trigger {
  border-color: rgba(85, 170, 51, 0.34);
  background: rgba(85, 170, 51, 0.1);
}

.admin-trigger span:first-child {
  color: var(--secondary);
  font-weight: 900;
}

.top-chip {
  justify-content: center;
  min-width: 52px;
  background: var(--primary);
  color: #0b1608;
  font-weight: 900;
}

.model-select-wrap {
  min-width: 178px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.model-select-wrap span {
  color: var(--secondary);
  font-weight: 900;
}

.model-select {
  width: 100%;
  height: 40px;
  padding: 0 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  pointer-events: none;
}

.model-select option {
  background: var(--neutral);
  color: var(--ink);
}

.login-avatar {
  font-size: 1.45rem;
  color: #d7dfce;
}

.login-panel,
.admin-panel {
  position: absolute;
  top: 56px;
  right: 0;
  z-index: 140;
  display: grid;
  gap: 8px;
  width: 180px;
  padding: 12px;
  border: 1px solid rgba(85, 170, 51, 0.48);
  border-radius: 12px;
  background: rgba(26, 26, 26, 0.9);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(24px) saturate(1.3);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: 0.22s ease;
}

.login-panel {
  right: 92px;
}

.admin-panel {
  right: 0;
  width: 190px;
}

.login-panel.open,
.admin-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.login-panel button,
.admin-panel button {
  font-family: var(--font-label);
  border: 1px solid rgba(85, 170, 51, 0.3);
  border-radius: 8px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.logout-option {
  display: none;
}

body.logged-in .logout-option {
  display: block;
}

.forest-stage {
  --dock-bottom-space: 30px;
  --dock-block-size: 98px;
  --avatar-foot-offset: 37px;
  --avatar-render-height: clamp(160px, 17.5vh, 190px);
  --avatar-dock-gap: clamp(8px, 1.2vh, 14px);
  position: relative;
  min-height: 100vh;
  padding-top: 78px;
  overflow: hidden;
  isolation: isolate;
}

.forest-stage::before {
  content: "";
  position: absolute;
  inset: 78px 0 0;
  z-index: -2;
  background:
    radial-gradient(circle at 78% 30%, rgba(139, 90, 43, 0.28), transparent 25%),
    radial-gradient(circle at 38% 48%, rgba(85, 170, 51, 0.18), transparent 24%),
    linear-gradient(90deg, rgba(5, 22, 24, 0.85), rgba(22, 28, 26, 0.28), rgba(80, 60, 43, 0.65));
}

.forest-stage::after {
  content: "";
  position: absolute;
  inset: 78px 0 0;
  z-index: 12;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
}

.sky-glow {
  position: absolute;
  inset: 78px 0 0;
  background: radial-gradient(circle at 50% 28%, transparent 0 25%, rgba(0, 0, 0, 0.34) 66%, rgba(0, 0, 0, 0.56));
  backdrop-filter: blur(1.2px);
}

.brand-date-tools {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 3px;
  margin-left: 0;
}

.student-date-card {
  position: static;
  z-index: 55;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  width: max-content;
  max-width: min(300px, 34vw);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary-hot);
  font-family: var(--font-label);
  font-size: 0.64rem;
  line-height: 1;
  text-shadow: 0 0 10px rgba(85, 170, 51, 0.55);
  transform: none;
  pointer-events: none;
  user-select: none;
}

.student-date-card:hover {
  color: var(--primary);
  text-shadow: 0 0 14px rgba(126, 226, 85, 0.72);
}

.student-date-card:focus-visible {
  outline: 1px solid rgba(126, 226, 85, 0.75);
  outline-offset: 4px;
}

.student-date-card strong,
.student-date-card span {
  display: inline;
  white-space: nowrap;
}

.student-date-card span {
  margin-left: 1px;
  color: var(--primary-hot);
  font-size: 0.6rem;
  text-shadow: 0 0 8px rgba(85, 170, 51, 0.42);
}

body.logged-out .student-date-card {
  display: none;
}

body.logged-out .brand-date-tools {
  display: none;
}

.time-tool-trigger {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(126, 226, 85, 0.42);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.1);
  color: var(--primary-hot);
  box-shadow: 0 0 10px rgba(85, 170, 51, 0.18);
  cursor: pointer;
}

.time-tool-trigger .ui-icon {
  width: 13px;
  height: 13px;
}

.time-tool-trigger:hover {
  border-color: rgba(126, 226, 85, 0.75);
  background: rgba(126, 226, 85, 0.18);
}

.time-tool-trigger:focus-visible {
  outline: 1px solid rgba(126, 226, 85, 0.8);
  outline-offset: 3px;
}

.time-tools-popover[hidden] {
  display: none;
}

.time-tools-popover {
  position: fixed;
  top: 7px;
  left: 440px;
  z-index: 1200;
}

.time-tools-panel {
  position: relative;
  width: 100%;
  min-height: 64px;
  padding: 6px 35px 6px 8px;
  border: 1px solid rgba(85, 170, 51, 0.55);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(12, 18, 14, 0.96), rgba(20, 31, 19, 0.92));
  box-shadow: 0 0 26px rgba(85, 170, 51, 0.22);
  color: var(--ink);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: max-content 92px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.time-tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.time-tools-header span {
  display: block;
  color: var(--primary);
  font-family: var(--font-label);
  font-size: 0.72rem;
}

.time-tools-header strong {
  display: block;
  margin-top: 0;
  font-size: 0.78rem;
  white-space: nowrap;
}

.time-tools-close {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}

.time-tools-now {
  display: none;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
  padding: 7px 9px;
  border: 1px solid rgba(85, 170, 51, 0.3);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.08);
  font-family: var(--font-label);
  font-size: 0.72rem;
}

.time-tools-now strong {
  color: var(--primary-hot);
}

.time-tools-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 0;
}

.time-tools-tabs button,
.time-tool-actions button {
  min-height: 28px;
  border: 1px solid rgba(85, 170, 51, 0.45);
  border-radius: 7px;
  background: rgba(16, 22, 18, 0.8);
  color: var(--ink);
  padding: 4px 5px;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.time-tools-tabs button.active,
.time-tool-actions button.is-primary {
  background: var(--primary);
  color: #061006;
  box-shadow: 0 0 16px rgba(126, 226, 85, 0.35);
}

.time-tool-section {
  display: grid;
  grid-template-columns: minmax(88px, 0.8fr) minmax(142px, 1.2fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.time-tool-section[hidden] {
  display: none !important;
}

.time-display {
  display: block;
  width: 100%;
  padding: 6px 4px;
  border: 1px solid rgba(85, 170, 51, 0.36);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--primary-hot);
  text-align: center;
  font-family: var(--font-headline);
  font-size: 1rem;
  text-shadow: 0 0 16px rgba(85, 170, 51, 0.45);
}

.time-tool-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.countdown-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.time-tool-section[data-time-section="countdown"] {
  grid-template-columns: minmax(88px, 0.8fr) minmax(82px, 0.7fr) minmax(104px, 0.9fr);
}

.time-tools-popover.is-compact .time-tools-header strong {
  display: none;
}

.time-tools-popover.is-compact .time-tools-panel {
  grid-template-columns: 80px minmax(0, 1fr);
}

.time-tool-section[data-time-section="countdown"] .time-tool-actions {
  grid-template-columns: repeat(2, 1fr);
}

.countdown-inputs label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.countdown-inputs input {
  width: 100%;
  border: 1px solid rgba(85, 170, 51, 0.32);
  border-radius: 7px;
  background: rgba(4, 8, 5, 0.78);
  color: var(--ink);
  padding: 7px 8px;
  font: inherit;
}

.time-lap-list {
  display: none;
  max-height: 62px;
  overflow: auto;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.time-lap-list li {
  padding: 4px 0;
}

.time-tool-note {
  display: none;
  min-height: 18px;
  margin: 0;
  color: var(--primary);
  font-size: 0.72rem;
}

@media (max-width: 760px) {
  .time-tools-popover {
    left: 12px;
    right: 12px;
    top: 72px;
  }

  .time-tools-panel {
    width: auto;
  }
}

@media (max-width: 1180px) {
  .time-tools-popover {
    top: 78px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
  }

  .time-tools-panel {
    grid-template-columns: max-content 112px minmax(0, 1fr);
  }
}

.fireflies {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}

.fireflies::before,
.fireflies::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  animation: fireflyDrift 26s ease-in-out infinite alternate;
}

.fireflies::before {
  opacity: 0.58;
  background-image:
    radial-gradient(circle at 8% 24%, rgba(126, 226, 85, 0.82) 0 2px, transparent 5px),
    radial-gradient(circle at 18% 52%, rgba(255, 232, 129, 0.72) 0 2px, transparent 5px),
    radial-gradient(circle at 34% 67%, rgba(126, 226, 85, 0.76) 0 2px, transparent 5px),
    radial-gradient(circle at 44% 35%, rgba(58, 179, 218, 0.68) 0 2px, transparent 5px),
    radial-gradient(circle at 57% 76%, rgba(126, 226, 85, 0.8) 0 2px, transparent 5px),
    radial-gradient(circle at 71% 29%, rgba(255, 232, 129, 0.66) 0 2px, transparent 5px),
    radial-gradient(circle at 84% 62%, rgba(126, 226, 85, 0.74) 0 2px, transparent 5px),
    radial-gradient(circle at 96% 43%, rgba(58, 179, 218, 0.62) 0 2px, transparent 5px);
}

.fireflies::after {
  opacity: 0.42;
  animation-duration: 31s;
  animation-delay: -9s;
  background-image:
    radial-gradient(circle at 12% 82%, rgba(126, 226, 85, 0.7) 0 1px, transparent 4px),
    radial-gradient(circle at 24% 19%, rgba(58, 179, 218, 0.58) 0 1px, transparent 4px),
    radial-gradient(circle at 39% 48%, rgba(255, 232, 129, 0.62) 0 1px, transparent 4px),
    radial-gradient(circle at 52% 22%, rgba(126, 226, 85, 0.7) 0 1px, transparent 4px),
    radial-gradient(circle at 64% 57%, rgba(58, 179, 218, 0.56) 0 1px, transparent 4px),
    radial-gradient(circle at 76% 80%, rgba(126, 226, 85, 0.62) 0 1px, transparent 4px),
    radial-gradient(circle at 89% 18%, rgba(255, 232, 129, 0.58) 0 1px, transparent 4px),
    radial-gradient(circle at 97% 72%, rgba(126, 226, 85, 0.66) 0 1px, transparent 4px);
}

.fireflies i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7ee255;
  opacity: 0.72;
  box-shadow: 0 0 10px #7ee255, 0 0 24px rgba(126, 226, 85, 0.7);
  animation: fireflyDrift 11s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

.fireflies i:nth-child(1) { left: 10%; top: 31%; animation-duration: 13s; }
.fireflies i:nth-child(2) { left: 23%; top: 69%; width: 4px; height: 4px; animation-duration: 17s; animation-delay: -4s; }
.fireflies i:nth-child(3) { left: 35%; top: 38%; background: #ffe881; box-shadow: 0 0 8px #ffe881, 0 0 18px rgba(255, 232, 129, 0.42); animation-duration: 19s; animation-delay: -8s; }
.fireflies i:nth-child(4) { left: 48%; top: 59%; width: 4px; height: 4px; animation-duration: 15s; animation-delay: -2s; }
.fireflies i:nth-child(5) { left: 62%; top: 35%; background: #3ab3da; box-shadow: 0 0 8px #3ab3da, 0 0 18px rgba(58, 179, 218, 0.48); animation-duration: 21s; animation-delay: -11s; }
.fireflies i:nth-child(6) { left: 74%; top: 66%; width: 4px; height: 4px; animation-duration: 16s; animation-delay: -6s; }
.fireflies i:nth-child(7) { left: 86%; top: 42%; animation-duration: 18s; animation-delay: -13s; }
.fireflies i:nth-child(8) { left: 92%; top: 78%; width: 3px; height: 3px; opacity: 0.48; animation-duration: 23s; animation-delay: -9s; }
.fireflies i:nth-child(9) { left: 6%; top: 61%; width: 4px; height: 4px; animation-duration: 20s; animation-delay: -5s; }
.fireflies i:nth-child(10) { left: 14%; top: 78%; width: 3px; height: 3px; animation-duration: 18s; animation-delay: -10s; }
.fireflies i:nth-child(11) { left: 28%; top: 24%; background: #ffe881; box-shadow: 0 0 8px #ffe881, 0 0 18px rgba(255, 232, 129, 0.38); animation-duration: 22s; animation-delay: -14s; }
.fireflies i:nth-child(12) { left: 31%; top: 54%; width: 4px; height: 4px; animation-duration: 16s; animation-delay: -7s; }
.fireflies i:nth-child(13) { left: 41%; top: 73%; width: 3px; height: 3px; animation-duration: 25s; animation-delay: -18s; }
.fireflies i:nth-child(14) { left: 46%; top: 28%; background: #3ab3da; box-shadow: 0 0 8px #3ab3da, 0 0 18px rgba(58, 179, 218, 0.4); animation-duration: 19s; animation-delay: -3s; }
.fireflies i:nth-child(15) { left: 53%; top: 67%; animation-duration: 21s; animation-delay: -16s; }
.fireflies i:nth-child(16) { left: 58%; top: 19%; width: 3px; height: 3px; animation-duration: 17s; animation-delay: -12s; }
.fireflies i:nth-child(17) { left: 66%; top: 50%; width: 4px; height: 4px; animation-duration: 24s; animation-delay: -21s; }
.fireflies i:nth-child(18) { left: 69%; top: 79%; background: #ffe881; box-shadow: 0 0 8px #ffe881, 0 0 18px rgba(255, 232, 129, 0.36); animation-duration: 20s; animation-delay: -8s; }
.fireflies i:nth-child(19) { left: 77%; top: 27%; width: 3px; height: 3px; animation-duration: 23s; animation-delay: -15s; }
.fireflies i:nth-child(20) { left: 81%; top: 58%; animation-duration: 18s; animation-delay: -1s; }
.fireflies i:nth-child(21) { left: 88%; top: 23%; background: #3ab3da; box-shadow: 0 0 8px #3ab3da, 0 0 18px rgba(58, 179, 218, 0.38); animation-duration: 26s; animation-delay: -19s; }
.fireflies i:nth-child(22) { left: 95%; top: 36%; width: 4px; height: 4px; animation-duration: 22s; animation-delay: -6s; }
.fireflies i:nth-child(23) { left: 4%; top: 84%; width: 3px; height: 3px; animation-duration: 28s; animation-delay: -20s; }
.fireflies i:nth-child(24) { left: 51%; top: 84%; width: 3px; height: 3px; animation-duration: 24s; animation-delay: -9s; }
.fireflies i:nth-child(25) { left: 9%; top: 44%; animation-duration: 19s; animation-delay: -12s; }
.fireflies i:nth-child(26) { left: 15%; top: 29%; width: 3px; height: 3px; animation-duration: 24s; animation-delay: -2s; }
.fireflies i:nth-child(27) { left: 20%; top: 74%; background: #ffe881; animation-duration: 21s; animation-delay: -17s; }
.fireflies i:nth-child(28) { left: 25%; top: 58%; width: 4px; height: 4px; animation-duration: 18s; animation-delay: -7s; }
.fireflies i:nth-child(29) { left: 30%; top: 83%; width: 3px; height: 3px; animation-duration: 27s; animation-delay: -20s; }
.fireflies i:nth-child(30) { left: 36%; top: 28%; background: #3ab3da; animation-duration: 20s; animation-delay: -11s; }
.fireflies i:nth-child(31) { left: 40%; top: 62%; animation-duration: 22s; animation-delay: -5s; }
.fireflies i:nth-child(32) { left: 45%; top: 77%; width: 4px; height: 4px; animation-duration: 25s; animation-delay: -22s; }
.fireflies i:nth-child(33) { left: 50%; top: 38%; background: #ffe881; animation-duration: 18s; animation-delay: -14s; }
.fireflies i:nth-child(34) { left: 55%; top: 17%; width: 3px; height: 3px; animation-duration: 28s; animation-delay: -6s; }
.fireflies i:nth-child(35) { left: 60%; top: 71%; animation-duration: 21s; animation-delay: -19s; }
.fireflies i:nth-child(36) { left: 65%; top: 33%; width: 4px; height: 4px; animation-duration: 23s; animation-delay: -8s; }
.fireflies i:nth-child(37) { left: 70%; top: 51%; background: #3ab3da; animation-duration: 20s; animation-delay: -15s; }
.fireflies i:nth-child(38) { left: 75%; top: 68%; width: 3px; height: 3px; animation-duration: 26s; animation-delay: -4s; }
.fireflies i:nth-child(39) { left: 79%; top: 37%; background: #ffe881; animation-duration: 22s; animation-delay: -18s; }
.fireflies i:nth-child(40) { left: 83%; top: 84%; width: 4px; height: 4px; animation-duration: 29s; animation-delay: -24s; }
.fireflies i:nth-child(41) { left: 87%; top: 55%; animation-duration: 18s; animation-delay: -10s; }
.fireflies i:nth-child(42) { left: 91%; top: 31%; width: 3px; height: 3px; animation-duration: 27s; animation-delay: -21s; }
.fireflies i:nth-child(43) { left: 94%; top: 87%; background: #3ab3da; animation-duration: 24s; animation-delay: -13s; }
.fireflies i:nth-child(44) { left: 3%; top: 69%; width: 4px; height: 4px; animation-duration: 20s; animation-delay: -16s; }
.fireflies i:nth-child(45) { left: 47%; top: 12%; animation-duration: 23s; animation-delay: -3s; }
.fireflies i:nth-child(46) { left: 73%; top: 15%; width: 3px; height: 3px; animation-duration: 30s; animation-delay: -25s; }
.fireflies i:nth-child(47) { left: 32%; top: 12%; background: #ffe881; animation-duration: 26s; animation-delay: -9s; }
.fireflies i:nth-child(48) { left: 98%; top: 57%; width: 4px; height: 4px; animation-duration: 21s; animation-delay: -1s; }

.pixel-hills {
  position: absolute;
  inset: auto 0 0;
  height: 25vh;
  opacity: 0.55;
  background:
    linear-gradient(135deg, transparent 0 16%, #122315 16% 34%, transparent 34%) 3% 100% / 190px 140px no-repeat,
    linear-gradient(135deg, transparent 0 18%, #182b18 18% 45%, transparent 45%) 86% 100% / 260px 190px no-repeat,
    linear-gradient(135deg, transparent 0 22%, #132114 22% 44%, transparent 44%) 0 100% / 120px 90px repeat-x;
  image-rendering: pixelated;
}

.ancient-tree {
  position: absolute;
  inset: 78px 0 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.tree-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  image-rendering: auto;
  filter: saturate(0.98) contrast(1.05) brightness(0.8);
}

.tree-video-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(0.98) contrast(1.05) brightness(0.8);
  background: transparent;
}

.ancient-tree::before,
.ancient-tree::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ancient-tree::before {
  z-index: 2;
  background:
    radial-gradient(circle at 50% 42%, transparent 0 38%, rgba(0, 0, 0, 0.26) 67%, rgba(0, 0, 0, 0.58) 100%),
    linear-gradient(180deg, rgba(10, 14, 12, 0.18), transparent 34%, rgba(0, 0, 0, 0.42) 100%);
}

.ancient-tree::after {
  z-index: 3;
  background: linear-gradient(180deg, transparent 68%, rgba(10, 10, 9, 0.72) 100%);
}

.tree-breeze {
  position: absolute;
  z-index: 4;
  opacity: 0.32;
  mix-blend-mode: screen;
  filter: blur(3px);
  background:
    radial-gradient(circle at 18% 38%, rgba(126, 226, 85, 0.34), transparent 19%),
    radial-gradient(circle at 46% 22%, rgba(85, 170, 51, 0.42), transparent 24%),
    radial-gradient(circle at 78% 48%, rgba(199, 240, 186, 0.22), transparent 17%);
  animation: treeBreeze 8s ease-in-out infinite alternate;
}

.tree-breeze-a {
  left: 13%;
  top: 6%;
  width: 34%;
  height: 33%;
}

.tree-breeze-b {
  right: 7%;
  top: 3%;
  width: 42%;
  height: 36%;
  animation-duration: 9.5s;
  animation-delay: -2.2s;
}

.tree-breeze-c {
  left: 36%;
  top: 19%;
  width: 30%;
  height: 24%;
  opacity: 0.22;
  animation-duration: 7.2s;
  animation-delay: -4s;
}

.tree-vines {
  display: none;
}

.moon-missions {
  position: absolute;
  inset: 0;
  z-index: 35;
  pointer-events: none;
}

.student-week-status {
  position: absolute;
  left: 24px;
  top: 96px;
  max-width: min(620px, 70vw);
  color: #c7d5bb;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  pointer-events: none;
}
.student-week-status p { margin: 0 0 4px; }


.war-token-entry { position:absolute; left:49.65%; top:75%; z-index:48; width:72px; height:96px; display:grid; place-items:center; text-decoration:none; transform:translate(-50%,-50%); cursor:pointer; }
.war-token-entry img { width:36px; height:84px; object-fit:contain; image-rendering:pixelated; pointer-events:none; filter:brightness(.58) saturate(.72) contrast(.9); opacity:.92; }
.war-token-entry:focus-visible { outline:1px solid rgba(218,168,77,.78); outline-offset:2px; }

.moon-task {
  position: absolute;
  width: 58px;
  min-height: 58px;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  color: #ecefe8;
  text-align: left;
  font-family: var(--font-label);
  animation: taskFloat 3.2s ease-in-out infinite alternate;
}

.moon-marker *,
.task-icon *,
.dock-item *,
.login-trigger *,
.top-chip *,
.stat-card * {
  pointer-events: none;
}

.login-panel.open,
.login-panel.open *,
.admin-panel.open,
.admin-panel.open *,
.model-select,
.close-dialog,
.primary-action,
.sheet-close {
  pointer-events: auto;
}

.moon-task::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -98px;
  width: 1px;
  height: 98px;
  background: linear-gradient(transparent, rgba(199, 240, 186, 0.3), rgba(199, 240, 186, 0.12));
}

.moon-marker {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(199, 240, 186, 0.24);
  border-radius: 8px;
  background: rgba(26, 26, 26, 0.66);
  color: rgba(221, 228, 213, 0.62);
  font-size: 2.05rem;
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.04), 0 10px 22px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  transition: 0.24s ease;
}

.moon-marker svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.moon-task.completed .moon-marker {
  border-color: var(--primary-hot);
  color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.2);
  box-shadow: 0 0 24px rgba(126, 226, 85, 0.72), inset 0 0 18px rgba(126, 226, 85, 0.22);
}

body.logged-out .moon-task,
body.logged-out .dock-item {
  cursor: pointer;
}

.task-card-content {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: clamp(250px, 21vw, 322px);
  min-height: 156px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 10px 12px;
  padding: 22px 28px;
  border: 1px solid rgba(85, 170, 51, 0.42);
  border-radius: 8px;
  background: rgba(26, 26, 26, 0.86);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.38), inset 0 0 18px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px) saturate(1.1);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.72);
  transform-origin: center;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.moon-task.active {
  z-index: 12;
}

.moon-task.active .moon-marker {
  opacity: 0;
  transform: scale(0.66);
}

.moon-task.active .task-card-content {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.task-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  grid-column: 1;
  grid-row: 1;
  color: var(--secondary);
  font-size: 1.55rem;
  text-shadow: 0 0 14px currentColor;
}

.moon-task h3 {
  grid-column: 2 / 4;
  grid-row: 1;
  margin: 0;
  font-family: var(--font-cn);
  font-size: clamp(1rem, 1.3vw, 1.32rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}

.moon-task p {
  grid-column: 1 / 4;
  grid-row: 2;
  margin: 0;
  color: #e1e5dc;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(0.88rem, 1.05vw, 1.05rem);
  line-height: 1.38;
}

.moon-task b {
  grid-column: 1 / 3;
  grid-row: 3;
  color: var(--primary-hot);
  font-family: var(--font-label);
  font-weight: 800;
  font-size: 0.95rem;
}

.moon-task em {
  grid-column: 3;
  grid-row: 3;
  justify-self: end;
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--primary-hot);
  color: #0c1c08;
  font-style: normal;
  font-family: var(--font-label);
  font-weight: 900;
}

.moon-task.active .task-card-content {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.24);
  box-shadow: 0 0 28px rgba(85, 170, 51, 0.72), inset 0 0 18px rgba(126, 226, 85, 0.25);
}

.chinese { left: 42%; top: 36%; }
.math { left: 59%; top: 39%; animation-delay: -0.8s; }
.english { left: 74%; top: 48%; animation-delay: -1.3s; }
.explore { left: 56%; top: 49%; animation-delay: -1.9s; }
.technology { left: 17%; top: 45%; animation-delay: -0.4s; }
.kindness { left: 27%; top: 41%; animation-delay: -1.6s; }

.student-card {
  position: fixed;
  left: 16vw;
  top: auto;
  bottom: calc(
    var(--dock-bottom-space) + var(--dock-block-size) + var(--avatar-dock-gap) - var(--avatar-foot-offset)
  );
  z-index: 75;
  width: clamp(210px, 24vh, 270px);
  min-width: 0;
  height: clamp(320px, 40vh, 390px);
  min-height: 0;
  pointer-events: none;
  transition: transform 0.72s cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: transform;
}

.student-card-female {
  left: auto;
  right: 16vw;
  top: auto;
  width: clamp(210px, 24vh, 270px);
  min-width: 0;
}

body.logged-in.gender-male .student-card-female,
body.logged-in.gender-female .student-card-male {
  display: none;
}

.level-card,
.stat-card,
.dock,
.task-dialog {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38), inset 0 0 20px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(22px) saturate(1.22);
}

.level-card {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: calc(var(--avatar-foot-offset) + var(--avatar-render-height) + clamp(7px, 1vh, 11px));
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  min-width: 168px;
  padding: 13px 18px;
  border-radius: 8px;
  text-align: center;
  font-family: var(--font-label);
  color: var(--primary-hot);
  text-shadow: 0 0 8px rgba(85, 170, 51, 0.58);
  overflow: visible;
  z-index: 6;
}

.student-card.teacher-voice-live .level-card {
  border-color: rgba(121, 232, 82, 0.96);
  animation: teacherVoiceCardBreath 1.55s ease-in-out infinite;
}

@keyframes teacherVoiceCardBreath {
  0%, 100% {
    box-shadow: 0 0 8px rgba(121, 232, 82, 0.34), 0 18px 42px rgba(0, 0, 0, 0.38), inset 0 0 16px rgba(121, 232, 82, 0.06);
  }
  50% {
    box-shadow: 0 0 25px rgba(121, 232, 82, 0.88), 0 18px 42px rgba(0, 0, 0, 0.38), inset 0 0 22px rgba(121, 232, 82, 0.16);
  }
}

.level-card span {
  font-size: 1.25rem;
}

.level-card strong {
  font-size: 1rem;
  white-space: nowrap;
}

.level-card i {
  width: 120px;
  height: 8px;
  margin: 0 auto;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary-hot) 0 var(--level-progress, 0%), rgba(255, 255, 255, 0.13) var(--level-progress, 0%));
}

.level-card small {
  color: #b9c8b3;
  font-size: 0.66rem;
  line-height: 1;
  text-shadow: none;
}

.teacher-voice-button,
.teacher-chat-button {
  position: absolute;
  top: 10px;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  border: 2px solid #7b8278;
  border-radius: 999px;
  background: rgba(120, 128, 118, 0.22);
  color: #b9c0b4;
  box-shadow: 0 0 10px rgba(140, 150, 138, 0.2);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.teacher-voice-button {
  right: 10px;
}

.teacher-chat-button {
  left: 10px;
}

.teacher-voice-button:hover,
.teacher-chat-button:hover {
  transform: scale(1.08);
  border-color: #c6d0c0;
  color: #ecf8e7;
  box-shadow: 0 0 14px rgba(210, 230, 205, 0.34);
}

.teacher-voice-button.listening,
.teacher-chat-button.listening {
  transform: scale(1.08);
  border-color: var(--primary);
  background: rgba(121, 232, 82, 0.22);
  color: var(--primary);
  box-shadow: 0 0 20px rgba(121, 232, 82, 0.72);
}

.teacher-voice-button.listening,
.teacher-chat-button.listening {
  animation: voicePulse 1.3s ease-in-out infinite;
}

.teacher-voice-button.connecting,
.teacher-chat-button.connecting {
  border-color: #e2b75d;
  background: rgba(192, 133, 42, 0.24);
  color: #ffe0a0;
  box-shadow: 0 0 14px rgba(226, 183, 93, 0.48);
  animation: teacherVoiceConnecting 0.9s steps(2, end) infinite;
}

.teacher-voice-button.failed,
.teacher-chat-button.failed {
  border-color: #ff5663;
  background: rgba(255, 86, 99, 0.34);
  color: #ffd9dd;
  box-shadow: 0 0 18px rgba(255, 86, 99, 0.65);
}

.teacher-voice-button .ui-icon,
.teacher-chat-button .ui-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex: 0 0 auto;
  stroke-width: 2.4;
}

.teacher-chat-button .ui-icon {
  width: 13px;
  height: 13px;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 12px rgba(121, 232, 82, 0.35); }
  50% { box-shadow: 0 0 26px rgba(121, 232, 82, 0.82); }
}

@keyframes teacherVoiceConnecting {
  50% { opacity: 0.55; }
}

.teacher-chat-popover {
  position: absolute;
  left: -8px;
  top: auto;
  bottom: calc(100% + 12px);
  width: min(320px, 78vw);
  height: 260px;
  min-width: 260px;
  min-height: 170px;
  max-width: min(78vw, 720px);
  max-height: min(72vh, 680px);
  display: none;
  z-index: 80;
  padding: 12px;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  border: 1px solid rgba(121, 232, 82, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(30, 42, 29, 0.96), rgba(12, 18, 13, 0.98));
  box-shadow: 0 0 26px rgba(121, 232, 82, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  text-align: left;
  text-shadow: none;
  pointer-events: auto;
}

.teacher-chat-resize-handle {
  position: absolute;
  z-index: 4;
  touch-action: none;
}

.teacher-chat-resize-handle.top {
  top: -4px;
  left: 12px;
  right: 12px;
  height: 10px;
  cursor: ns-resize;
}

.teacher-chat-resize-handle.left,
.teacher-chat-resize-handle.right {
  top: 12px;
  bottom: 12px;
  width: 10px;
  cursor: ew-resize;
}

.teacher-chat-resize-handle.left { left: -4px; }
.teacher-chat-resize-handle.right { right: -4px; }

.teacher-chat-resize-handle.top-left,
.teacher-chat-resize-handle.top-right {
  top: -5px;
  width: 14px;
  height: 14px;
}

.teacher-chat-resize-handle.top-left {
  left: -5px;
  cursor: nwse-resize;
}

.teacher-chat-resize-handle.top-right {
  right: -5px;
  cursor: nesw-resize;
}

.teacher-chat-popover::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -9px;
  width: 16px;
  height: 16px;
  border-right: 1px solid rgba(121, 232, 82, 0.72);
  border-bottom: 1px solid rgba(121, 232, 82, 0.72);
  background: rgba(12, 18, 13, 0.98);
  transform: rotate(45deg);
}

.teacher-chat-popover.open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.teacher-chat-title {
  color: var(--primary);
  font-family: var(--font-pixel);
  font-size: 0.78rem;
  font-weight: 900;
}

.teacher-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.teacher-movement-lock {
  /* The teacher container is click-through; opt this control back into hit testing. */
  pointer-events: auto;
  position: absolute; right: 5px; bottom: 4px; width: 22px; height: 22px;
  padding: 2px; border: 1px solid #51634a; border-radius: 4px;
  color: #a4b59a; background: #152015; cursor: pointer; z-index: 5;
}
.teacher-movement-lock[aria-pressed="true"] { color: #91e86b; border-color: #91e86b; }
.teacher-movement-lock svg { width: 14px; height: 14px; }
.teacher-chat-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.teacher-image-button,
.teacher-chat-clear-button {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  padding: 0;
  border: 1px solid rgba(121, 232, 82, 0.72);
  border-radius: 5px;
  background: rgba(121, 232, 82, 0.12);
  color: var(--primary);
  font: 700 1.15rem/1 var(--font-label);
  cursor: pointer;
}

.teacher-chat-clear-button {
  color: #ff9b8f;
  border-color: rgba(255, 112, 96, 0.65);
  background: rgba(112, 24, 18, 0.2);
  font-size: 1rem;
}

.teacher-image-button:hover,
.teacher-image-button:focus-visible,
.teacher-chat-clear-button:hover,
.teacher-chat-clear-button:focus-visible {
  background: rgba(121, 232, 82, 0.25);
  box-shadow: 0 0 12px rgba(121, 232, 82, 0.45);
}

.teacher-image-bubble {
  padding: 5px;
}

.teacher-image-bubble img {
  display: block;
  width: min(150px, 100%);
  max-height: 120px;
  border-radius: 5px;
  object-fit: cover;
  cursor: zoom-in;
}

.teacher-image-bubble img:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.teacher-image-preview {
  width: min(94vw, 1200px);
  max-width: 1200px;
  height: min(90vh, 850px);
  padding: 0;
  border: 1px solid rgba(121, 232, 82, 0.75);
  border-radius: 10px;
  background: rgba(5, 18, 10, 0.98);
  color: var(--text);
  box-shadow: 0 0 32px rgba(57, 255, 20, 0.28);
}

.teacher-image-preview::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.teacher-image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(121, 232, 82, 0.35);
}

.teacher-image-preview-head button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(121, 232, 82, 0.6);
  border-radius: 5px;
  background: rgba(121, 232, 82, 0.12);
  color: var(--primary);
  font-size: 1.4rem;
  cursor: pointer;
}

.teacher-image-preview-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: calc(100% - 53px);
  padding: 18px;
  overflow: auto;
  box-sizing: border-box;
}

.teacher-image-preview-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  image-rendering: auto;
}

.screenshot-editor {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #050805;
  color: var(--text);
  box-shadow: 0 0 42px rgba(85, 170, 51, 0.38);
}

.screenshot-editor::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.screenshot-editor-head,
.screenshot-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(121, 232, 82, 0.2);
  background: rgba(18, 31, 19, 0.96);
}

.screenshot-editor-head {
  position: absolute;
  top: 14px;
  right: 16px;
  left: 16px;
  z-index: 6;
  justify-content: space-between;
  border: 0;
  border-radius: 8px;
  background: rgba(12, 18, 13, 0.78);
  backdrop-filter: blur(8px);
}

.screenshot-editor-actions .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screenshot-editor-head button,
.screenshot-editor-actions button {
  min-height: 32px;
  border: 1px solid rgba(121, 232, 82, 0.42);
  border-radius: 5px;
  background: rgba(121, 232, 82, 0.09);
  color: var(--text);
  cursor: pointer;
}

.screenshot-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050805;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.capturing-page-screenshot .screenshot-trigger {
  visibility: hidden;
}

.screenshot-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screenshot-selection {
  position: absolute;
  border: 2px solid #79e852;
  background: rgba(121, 232, 82, 0.09);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42), 0 0 16px rgba(121, 232, 82, 0.55);
  pointer-events: none;
}

.screenshot-selection::after {
  content: attr(data-size);
  position: absolute;
  right: -1px;
  bottom: -28px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(12, 18, 13, 0.92);
  color: #dfffd4;
  font: 12px/1.4 var(--font-label);
  white-space: nowrap;
}

.screenshot-simple-tools {
  display: flex;
  gap: 6px;
}

.screenshot-simple-tools button,
.screenshot-editor-actions > button {
  width: 38px;
  min-width: 38px;
  height: 36px;
  padding: 0;
  font: 700 1.15rem/1 var(--font-label);
}

[data-screenshot-mode="text"] span {
  font-family: Arial, sans-serif;
  font-size: 1rem;
}

.screenshot-simple-tools button.active {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 9px rgba(121, 232, 82, 0.35);
}

.screenshot-editor-actions {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 6;
  justify-content: flex-end;
  border: 1px solid rgba(121, 232, 82, 0.28);
  border-radius: 8px;
  background: rgba(12, 18, 13, 0.9);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.screenshot-editor.loading .screenshot-canvas-wrap {
  pointer-events: none;
  opacity: 0.68;
}

.screenshot-editor.loading::after {
  content: "正在截取当前屏幕…";
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 8;
  translate: -50% -50%;
  padding: 10px 16px;
  border: 1px solid rgba(121, 232, 82, 0.42);
  border-radius: 7px;
  background: rgba(12, 18, 13, 0.92);
  color: var(--primary);
  font-family: var(--font-label);
}

.screenshot-editor.loading .screenshot-simple-tools,
.screenshot-editor.loading [data-screenshot-send] {
  pointer-events: none;
  opacity: 0.45;
}

.teacher-chat-log {
  min-height: 0;
  max-height: none;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

@media (prefers-reduced-motion: reduce) {
  .student-card.teacher-voice-live .level-card {
    animation: none;
    box-shadow: 0 0 18px rgba(121, 232, 82, 0.65), 0 18px 42px rgba(0, 0, 0, 0.38);
  }
}

.teacher-chat-log:empty::before {
  content: "暂无对话记录";
  display: block;
  color: rgba(234, 244, 226, 0.7);
  font-family: var(--font-body);
  font-size: 0.82rem;
}

.avatar-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.runner-rig {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.runner-rig::before {
  content: none;
}

.particle-line {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: calc(var(--avatar-foot-offset) - 3px);
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--secondary), var(--primary-hot), transparent);
  filter: drop-shadow(0 0 10px var(--secondary));
  animation: linePulse 1.8s linear infinite;
}

.particle-line::before,
.particle-line::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 42px 2px 0 var(--primary-hot), 116px -1px 0 #edf7e8, 180px 1px 0 var(--secondary);
  animation: particleRun 1.45s linear infinite;
}

.particle-line::after {
  animation-delay: -0.72s;
  opacity: 0.6;
}

.student-avatar {
  position: absolute;
  left: 50%;
  bottom: var(--avatar-foot-offset);
  width: auto;
  height: var(--avatar-render-height);
  max-width: 44%;
  max-height: none;
  transform: translateX(-50%);
  object-fit: contain;
  image-rendering: pixelated;
  filter: none;
}

.female-avatar-img {
  position: absolute;
  left: 50%;
  bottom: var(--avatar-foot-offset);
  width: auto;
  max-width: 44%;
  max-height: none;
  height: var(--avatar-render-height);
  transform: translateX(-50%);
  object-fit: contain;
  image-rendering: auto;
}

.female-avatar-img:not([src]),
.female-avatar-img[src=""],
.female-avatar-img.missing {
  display: none;
}

.female-avatar-img + .female-avatar {
  display: none;
}

.female-avatar-img:not([src]) + .female-avatar,
.female-avatar-img[src=""] + .female-avatar,
.female-avatar-img.missing + .female-avatar {
  display: block;
}

.female-avatar {
  position: absolute;
  left: 50%;
  bottom: var(--avatar-foot-offset);
  width: 94px;
  height: 170px;
  transform: translateX(-50%);
  image-rendering: pixelated;
}

.female-avatar span {
  position: absolute;
  display: block;
  image-rendering: pixelated;
}

.female-avatar .hair.back {
  left: 17px;
  top: 22px;
  width: 60px;
  height: 70px;
  background: #4b2435;
  box-shadow: inset 0 10px 0 #6f3652, inset 0 -12px 0 #321722;
}

.female-avatar .head {
  left: 25px;
  top: 34px;
  width: 45px;
  height: 45px;
  background: #f0b58a;
  box-shadow: inset 0 -7px 0 #d48662, 0 0 0 3px #5b2e28;
}

.female-avatar .hair.bangs {
  left: 21px;
  top: 24px;
  width: 54px;
  height: 24px;
  background: #6f3652;
  box-shadow: 14px -8px 0 #8a4869, 28px 4px 0 #4b2435;
}

.female-avatar .eye {
  top: 55px;
  width: 9px;
  height: 9px;
  background: #11313a;
  box-shadow: 0 0 0 2px #dff7ef;
}

.female-avatar .eye.left { left: 35px; }
.female-avatar .eye.right { left: 56px; }

.female-avatar .body {
  left: 24px;
  top: 82px;
  width: 48px;
  height: 58px;
  background: #6a3bb8;
  box-shadow:
    inset 0 12px 0 #7ee255,
    inset -8px 0 0 #2b6b55,
    inset 8px 0 0 #2b6b55,
    0 0 0 3px #16281f;
}

.female-avatar .scarf {
  left: 31px;
  top: 82px;
  width: 34px;
  height: 12px;
  background: #bff6aa;
}

.female-avatar .arm {
  top: 88px;
  width: 13px;
  height: 48px;
  background: #2b6b55;
  box-shadow: inset 0 -9px 0 #f0b58a, 0 0 0 2px #16281f;
}

.female-avatar .arm.left { left: 9px; }
.female-avatar .arm.right { right: 8px; }

.female-avatar .leg {
  top: 138px;
  width: 16px;
  height: 28px;
  background: #202d47;
  box-shadow: inset 0 -6px 0 #f3d0be, 0 0 0 2px #111923;
}

.female-avatar .leg.left { left: 30px; }
.female-avatar .leg.right { right: 30px; }

.runner-rig.jump .student-avatar,
.runner-rig.jump .female-avatar-img,
.runner-rig.jump .female-avatar {
  animation: avatarTap 0.82s ease;
}

.stats-stack {
  position: absolute;
  right: 3vw;
  top: 13vh;
  z-index: 25;
  display: grid;
  gap: 14px;
}

body.logged-out .stats-stack {
  opacity: 0;
  pointer-events: none;
  transform: translateX(28px);
}

.stat-card {
  width: 196px;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  text-align: left;
  font-family: var(--font-label);
  cursor: pointer;
  pointer-events: auto;
}

.stat-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border-radius: 9px;
  font-size: 1.75rem;
}

.heart { background: #a80f18; }
.gem { background: var(--secondary); color: #03191e; }
.clock { background: var(--tertiary); }
.report { background: #55aa33; color: #091807; }
.mastery { background: #6f55b5; color: #fff; }

.stat-card small {
  display: block;
  margin-bottom: 5px;
  color: #dde4d5;
  font-family: var(--font-label);
  font-size: 0.78rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  font-family: var(--font-label);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.18;
}

.stat-card.reward-pulse,
.level-card.reward-pulse {
  animation: rewardPulse 0.72s ease;
}

@keyframes rewardPulse {
  0%, 100% { filter: brightness(1); }
  38% {
    filter: brightness(1.5);
    box-shadow: 0 0 28px rgba(126, 226, 85, 0.45), inset 0 0 20px rgba(255, 255, 255, 0.08);
  }
}

.dock {
  position: absolute;
  left: 50%;
  bottom: var(--dock-bottom-space);
  z-index: 70;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 10px;
  width: min(980px, calc(100vw - 40px));
  padding: 14px 42px;
  border-radius: 42px;
}

.dock-item {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 70px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  color: #e9efe3;
  font-family: var(--font-label);
  font-weight: 700;
}

.dock-item span {
  font-size: 1.55rem;
  display: grid;
  place-items: center;
}

.dock-item em {
  font-style: normal;
  font-size: 0.88rem;
}

.dock-item.active {
  color: #0b210e;
  background: var(--primary-hot);
  box-shadow: 0 0 24px rgba(85, 170, 51, 0.55);
}

body.logged-out .dock-item.active {
  color: #e9efe3;
  background: transparent;
  box-shadow: none;
}

.landing-showcase {
  display: none;
}

body.logged-out .landing-showcase {
  position: relative;
  z-index: 20;
  display: block;
  min-height: 100vh;
  padding: 120px clamp(18px, 6vw, 96px) 140px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(5, 10, 7, 0.78), rgba(7, 18, 10, 0.72) 28%, rgba(8, 10, 8, 0.86)),
    url("./assets/tree-bg-source.png") center top / cover fixed;
  border-top: 1px solid rgba(126, 226, 85, 0.28);
}

.landing-showcase::before,
.landing-showcase::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.landing-showcase::before {
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(85, 170, 51, 0.2), transparent 25%),
    radial-gradient(circle at 78% 40%, rgba(58, 179, 218, 0.13), transparent 26%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.36), transparent 50%, rgba(0, 0, 0, 0.4));
}

.landing-showcase::after {
  inset: auto 0 0;
  height: 220px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.68));
}

.showcase-bg-fireflies {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.showcase-bg-fireflies i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7ee255;
  box-shadow: 0 0 14px rgba(126, 226, 85, 0.82);
  opacity: 0.42;
  animation: showcaseFirefly 8s ease-in-out infinite alternate;
}

.showcase-bg-fireflies i:nth-child(1) { left: 12%; top: 18%; animation-duration: 9s; }
.showcase-bg-fireflies i:nth-child(2) { left: 32%; top: 26%; animation-duration: 11s; }
.showcase-bg-fireflies i:nth-child(3) { left: 72%; top: 16%; animation-duration: 10s; }
.showcase-bg-fireflies i:nth-child(4) { left: 84%; top: 38%; animation-duration: 12s; }
.showcase-bg-fireflies i:nth-child(5) { left: 19%; top: 62%; animation-duration: 13s; }
.showcase-bg-fireflies i:nth-child(6) { left: 50%; top: 72%; animation-duration: 9.5s; }
.showcase-bg-fireflies i:nth-child(7) { left: 68%; top: 58%; animation-duration: 12.5s; }
.showcase-bg-fireflies i:nth-child(8) { left: 92%; top: 75%; animation-duration: 10.5s; }

@keyframes showcaseFirefly {
  from { transform: translate3d(-8px, 10px, 0) scale(0.8); opacity: 0.22; }
  50% { opacity: 0.72; }
  to { transform: translate3d(18px, -22px, 0) scale(1.15); opacity: 0.38; }
}

.showcase-hero,
.showcase-card,
.showcase-game,
.showcase-footer {
  position: relative;
  z-index: 2;
}

.showcase-hero {
  max-width: 960px;
  margin: 0 auto 90px;
  text-align: center;
}

.showcase-hero h2 {
  margin: 12px 0;
  color: #f4f7ef;
  font-family: var(--font-cn);
  font-size: clamp(2.1rem, 5.5vw, 5.2rem);
  line-height: 1.02;
  text-shadow: 0 0 18px rgba(126, 226, 85, 0.42);
}

.showcase-hero p:not(.dialog-kicker),
.showcase-footer p {
  margin: 0 auto;
  max-width: 720px;
  color: #d7e3d0;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  line-height: 1.65;
}

.showcase-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
}

.showcase-timeline {
  position: absolute;
  left: 50%;
  top: 390px;
  bottom: 220px;
  z-index: 1;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(126, 226, 85, 0.75), rgba(58, 179, 218, 0.35), transparent);
  box-shadow: 0 0 22px rgba(126, 226, 85, 0.32);
  transform: translateX(-50%);
}

.showcase-card {
  display: grid;
  grid-template-columns: minmax(300px, 1.04fr) minmax(280px, 0.86fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  width: min(1180px, 100%);
  margin: 0 auto 110px;
  padding: clamp(6px, 1.2vw, 14px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.showcase-card.reverse {
  grid-template-columns: minmax(280px, 0.86fr) minmax(300px, 1.04fr);
}

.showcase-card.reverse figure {
  order: 2;
}

.showcase-card figure {
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(126, 226, 85, 0.64);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 34px rgba(85, 170, 51, 0.34), inset 0 0 22px rgba(126, 226, 85, 0.08);
  cursor: zoom-in;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.showcase-card figure:hover {
  transform: translateY(-2px);
  border-color: rgba(126, 226, 85, 0.9);
  box-shadow: 0 0 42px rgba(85, 170, 51, 0.42), inset 0 0 22px rgba(126, 226, 85, 0.08);
}

.showcase-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.showcase-card span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid rgba(126, 226, 85, 0.46);
  border-radius: 6px;
  background: rgba(85, 170, 51, 0.16);
  color: var(--primary-hot);
  font: 800 0.82rem var(--font-label);
}

.showcase-card h3,
.showcase-footer h3 {
  margin: 16px 0 12px;
  color: #f4f7ef;
  font-family: var(--font-cn);
  font-size: clamp(1.65rem, 3.2vw, 3rem);
  line-height: 1.08;
}

.showcase-card p {
  margin: 0 0 18px;
  color: #dce7d7;
  font-size: 1.02rem;
  line-height: 1.58;
}

.showcase-game {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  width: min(1080px, 100%);
  min-height: 260px;
  margin: -24px auto 112px;
  padding: clamp(28px, 5vw, 54px);
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(126, 226, 85, 0.48);
  background:
    linear-gradient(90deg, rgba(9, 18, 10, 0.92), rgba(9, 26, 12, 0.62), rgba(5, 10, 7, 0.82)),
    url("./assets/showcase/showcase-tree.png") left center / 58% auto no-repeat,
    url("./assets/showcase/showcase-learning.png") right center / 48% auto no-repeat;
  box-shadow: 0 0 42px rgba(85, 170, 51, 0.22);
}

.showcase-game::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 28% 38%, rgba(126, 226, 85, 0.2), transparent 28%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0.72));
}

.showcase-game > * {
  position: relative;
  z-index: 1;
}

.showcase-game span {
  display: inline-flex;
  padding: 6px 12px;
  border: 1px solid rgba(126, 226, 85, 0.48);
  border-radius: 6px;
  background: rgba(85, 170, 51, 0.18);
  color: var(--primary-hot);
  font: 800 0.82rem var(--font-label);
}

.showcase-game h3 {
  margin: 18px 0 12px;
  color: #f4f7ef;
  font-family: var(--font-cn);
  font-size: clamp(2rem, 4.4vw, 4.5rem);
  line-height: 1;
  text-shadow: 0 0 18px rgba(126, 226, 85, 0.36);
}

.showcase-game p {
  max-width: 620px;
  margin: 0;
  color: #dce7d7;
  font-size: 1.08rem;
  line-height: 1.62;
}

.showcase-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.showcase-card li {
  position: relative;
  padding-left: 22px;
  color: #cad8c3;
  line-height: 1.45;
}

.showcase-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 8px;
  height: 8px;
  background: var(--primary-hot);
  box-shadow: 0 0 12px rgba(126, 226, 85, 0.72);
}

.showcase-footer {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 34px);
  border: 0;
  border-radius: 0;
  text-align: center;
  background: transparent;
  box-shadow: none;
}

.showcase-footer .primary-action {
  margin-top: 24px;
}

.reveal-card {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.55s ease, transform 0.55s ease, border-color 0.55s ease, box-shadow 0.55s ease;
}

.reveal-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.showcase-card.in-view {
  filter: drop-shadow(0 0 24px rgba(85, 170, 51, 0.12));
}

.showcase-preview {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 3vw, 42px);
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
}

.showcase-preview.open {
  display: flex;
}

.showcase-preview img {
  display: block;
  max-width: min(94vw, 1500px);
  max-height: 86vh;
  object-fit: contain;
  border: 1px solid rgba(126, 226, 85, 0.78);
  border-radius: 10px;
  background: #070b08;
  box-shadow: 0 0 54px rgba(85, 170, 51, 0.36);
}

.showcase-preview-close {
  position: fixed;
  top: 24px;
  right: 26px;
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(126, 226, 85, 0.5);
  border-radius: 8px;
  color: #f4f7ef;
  background: rgba(26, 26, 26, 0.9);
  font: 900 1.35rem var(--font-label);
  cursor: pointer;
}

.showcase-preview-close:hover {
  border-color: var(--primary-hot);
  color: var(--primary-hot);
}

.page-sheet {
  position: absolute;
  left: 0;
  right: 0;
  top: 78px;
  bottom: 142px;
  z-index: 65;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 34px 6vw;
  border-bottom: 1px solid rgba(85, 170, 51, 0.45);
  background: rgba(18, 20, 18, 0.88);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.42), inset 0 -1px 0 rgba(126, 226, 85, 0.18);
  backdrop-filter: blur(24px) saturate(1.2);
  transform: translateY(calc(-100% - 80px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.2, 0.86, 0.2, 1), opacity 0.24s ease;
}

.page-sheet.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.learning-sheet {
  position: absolute;
  left: 0;
  right: 0;
  top: 78px;
  bottom: 142px;
  z-index: 72;
  padding: 26px 6vw 28px;
  border-bottom: 1px solid rgba(85, 170, 51, 0.45);
  background: rgba(10, 14, 11, 0.9);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.46), inset 0 -1px 0 rgba(126, 226, 85, 0.18);
  backdrop-filter: blur(22px) saturate(1.22);
  transform: translateY(calc(-100% - 80px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.2, 0.86, 0.2, 1), opacity 0.24s ease;
}

.learning-sheet.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.report-sheet {
  position: absolute;
  inset: 78px 0 142px;
  z-index: 73;
  padding: 24px 5vw 26px;
  border-bottom: 1px solid rgba(85, 170, 51, 0.45);
  background: rgba(8, 13, 9, 0.94);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.52), inset 0 -1px 0 rgba(126, 226, 85, 0.18);
  backdrop-filter: blur(24px) saturate(1.18);
  transform: translateY(calc(-100% - 80px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.2, 0.86, 0.2, 1), opacity 0.24s ease;
}

.report-sheet.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mastery-sheet {
  position: absolute;
  inset: 78px 0 142px;
  z-index: 74;
  padding: 20px 3vw 22px;
  border-bottom: 1px solid rgba(85, 170, 51, 0.5);
  background: rgba(5, 13, 9, 0.97);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(16px) saturate(1.16);
  transform: translateY(calc(-100% - 80px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.2, 0.86, 0.2, 1), opacity 0.24s ease;
}

.mastery-sheet.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mastery-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.mastery-head {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(460px, 0.92fr);
  align-items: stretch;
  gap: 20px;
  padding-right: 64px;
}

.mastery-title-block {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.mastery-head h2 {
  margin: 2px 0 4px;
  font-family: var(--font-headline);
  font-size: clamp(1.7rem, 3vw, 3rem);
  letter-spacing: 0;
}

.mastery-head p {
  margin: 0;
  color: var(--muted);
}

.mastery-overall {
  min-width: 112px;
  padding: 8px 12px;
  border: 1px solid rgba(117, 231, 79, 0.5);
  border-radius: 6px;
  background: rgba(20, 43, 19, 0.75);
  text-align: right;
}

.mastery-overall span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.mastery-overall strong {
  color: var(--primary-hot);
  font-size: 1.65rem;
}

.mastery-head-stats {
  min-width: 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.mastery-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 8px;
}

.mastery-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.mastery-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.mastery-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.mastery-pyramid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
  padding: 0 2px 20px;
  background: transparent;
  scrollbar-color: rgba(126, 226, 85, 0.55) rgba(0, 0, 0, 0.18);
}

.mastery-subject-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 12px;
  border: 1px solid rgba(85, 170, 51, 0.48);
  border-radius: 6px;
  background: rgba(10, 22, 13, 0.88);
  box-shadow: inset 0 1px rgba(196, 255, 176, 0.04), 0 0 22px rgba(74, 188, 46, 0.05);
}

.mastery-subject-head {
  min-height: 50px;
  margin-bottom: 10px;
  padding: 0 3px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(85, 170, 51, 0.3);
}

.mastery-subject-head div,
.mastery-subject-head span,
.mastery-subject-head small {
  display: block;
}

.mastery-subject-head span {
  color: var(--primary-hot);
  font-size: 1.08rem;
  font-weight: 800;
}

.mastery-subject-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
}

.mastery-subject-head strong {
  color: var(--primary-hot);
  font-size: 1.35rem;
}

.mastery-grade-groups {
  height: calc(100% - 60px);
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: grid;
  align-content: start;
  gap: 10px;
  scrollbar-color: rgba(126, 226, 85, 0.55) rgba(0, 0, 0, 0.18);
}

.mastery-grade-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(85, 170, 51, 0.2);
}

.mastery-grade-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.mastery-grade-label {
  min-height: 100%;
  border: 1px solid rgba(117, 231, 79, 0.45);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(29, 67, 23, 0.52);
  color: var(--primary-hot);
}

.mastery-grade-label b {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0;
}

.mastery-grade-label small {
  color: var(--muted);
  font-size: 0.56rem;
}

.mastery-tier {
  width: var(--tier-width);
  min-width: 680px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 9px;
  border: 1px solid rgba(85, 170, 51, 0.45);
  border-radius: 6px;
  background: rgba(13, 25, 16, 0.86);
  box-shadow: 0 0 20px rgba(74, 188, 46, 0.06);
}

.mastery-grade {
  display: grid;
  place-items: center;
  color: var(--primary-hot);
  font-weight: 800;
  writing-mode: vertical-rl;
}

.mastery-tier-subjects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mastery-subject-column h3 {
  margin: 0 0 7px;
  color: var(--primary-hot);
  text-align: center;
  font-size: 0.82rem;
}

.mastery-node-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 8px;
}

.mastery-node {
  min-height: 58px;
  border: 1px solid rgba(106, 143, 98, 0.45);
  border-radius: 5px;
  padding: 7px 5px;
  display: grid;
  gap: 3px;
  place-items: center;
  background: #18201a;
  color: #dce6d9;
  font: inherit;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.mastery-node:hover,
.mastery-node.selected {
  transform: translateY(-2px);
  border-color: #d5ffc7;
  box-shadow: 0 0 18px rgba(117, 231, 79, 0.32);
}

.mastery-node b {
  font-size: 0.7rem;
  letter-spacing: 0;
}

.mastery-node small {
  color: #aab4a7;
  font-size: 0.6rem;
}

.mastery-node .node-status {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.mastery-node.mastered {
  border-color: #75e74f;
  background: rgba(39, 99, 24, 0.85);
  color: #dfffd6;
  box-shadow: 0 0 16px rgba(117, 231, 79, 0.42);
}

.mastery-node.progressing {
  border-color: #3ab3da;
  background: rgba(15, 70, 87, 0.68);
  color: #bdefff;
}

.mastery-node.started {
  border-color: #d19a4f;
  background: rgba(85, 55, 20, 0.62);
  color: #ffdca9;
}

.mastery-node.empty {
  opacity: 0.66;
}

.mastery-detail {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(85, 170, 51, 0.45);
  border-radius: 6px;
  padding: 9px 11px;
  background: rgba(14, 23, 16, 0.92);
  scrollbar-color: rgba(126, 226, 85, 0.55) rgba(0, 0, 0, 0.18);
}

.mastery-detail h3 {
  margin: 1px 0 3px;
  color: var(--primary-hot);
}

.mastery-detail > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.mastery-detail-bar {
  height: 5px;
  margin: 6px 0 7px;
  overflow: hidden;
  background: #303831;
}

.mastery-detail-bar span {
  display: block;
  width: var(--score);
  height: 100%;
  background: var(--primary-hot);
  box-shadow: 0 0 10px rgba(117, 231, 79, 0.5);
}

.mastery-evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.mastery-evidence-grid article {
  padding: 5px 6px;
  border: 1px solid rgba(106, 143, 98, 0.35);
  border-radius: 5px;
  background: #1b211d;
}

.mastery-evidence-grid strong,
.mastery-evidence-grid span {
  display: block;
}

.mastery-evidence-grid strong {
  color: var(--primary-hot);
  font-size: 0.86rem;
}

.mastery-evidence-grid span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.56rem;
}

@media (max-width: 1100px) {
  .mastery-head { grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1fr); }
  .mastery-node-grid { grid-template-columns: repeat(2, minmax(62px, 1fr)); }
}

@media (max-width: 800px) {
  .mastery-sheet { padding: 14px 12px 18px; }
  .mastery-head { grid-template-columns: 1fr; align-items: flex-start; padding-right: 48px; }
  .mastery-overall { min-width: 116px; }
  .mastery-pyramid { overflow: auto; }
  .mastery-pyramid { grid-template-columns: repeat(3, minmax(310px, 1fr)); }
  .mastery-detail { min-height: 112px; }
}

.report-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.report-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-right: 72px;
}

.report-head h2 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.report-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--font-label);
}

.report-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(85, 170, 51, 0.32);
  border-radius: 8px;
  background: rgba(24, 27, 24, 0.76);
}

.report-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-label);
  font-weight: 700;
}

.report-tabs button.active {
  background: var(--primary-hot);
  color: #10200f;
  box-shadow: 0 0 18px rgba(126, 226, 85, 0.3);
}

.report-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.report-layout > .report-history { grid-column: 1 / -1; padding: 8px 12px; }
.report-history select { color: #baf79f; background: #152015; border: 1px solid #426235; padding: 6px; max-width: 100%; }
.report-dashboard.network-dashboard { padding: 12px; display: flex; flex-direction: column; overflow: hidden; min-height: 460px; background: radial-gradient(ellipse at 50% 30%, #173025 0%, #07110d 65%); }
.network-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 12px; color: #9bd57f; }
.network-toolbar strong { margin-right: auto; }
.network-toolbar button { background: #172718; color: #a7ed8c; border: 1px solid #47683b; border-radius: 5px; padding: 5px 9px; cursor: pointer; }
.network-stage { flex: 1; min-height: 300px; position: relative; }
.network-stage canvas { width: 100%; height: 100%; position: absolute; inset: 0; touch-action: none; cursor: grab; }
.network-stage canvas:active { cursor: grabbing; }
.network-legend, .network-detail { font-size: 11px; line-height: 1.7; color: #a4b89b; padding-top: 8px; }
.network-legend { color: #8bf36c; }
.network-legend span { color: #d5a557; }
.network-legend b { color: #f47670; font-weight: normal; }
.network-legend i { color: #657e69; font-style: normal; }
.network-dashboard > select { color: #baf79f; background: #102015; border: 1px solid #426235; margin-top: 8px; padding: 6px; max-width: 100%; }

.report-history,
.report-dashboard,
.report-analysis {
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(85, 170, 51, 0.3);
  border-radius: 8px;
  background: rgba(23, 26, 23, 0.78);
  scrollbar-color: rgba(126, 226, 85, 0.55) rgba(0, 0, 0, 0.18);
}

.report-history,
.report-analysis {
  padding: 16px;
}

.report-history h3,
.report-analysis h3,
.report-chart-card h3 {
  margin: 0;
  color: var(--primary-hot);
  font-family: var(--font-label);
  font-size: 0.94rem;
}

.report-period-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.report-period-list button {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid rgba(199, 240, 186, 0.16);
  border-radius: 6px;
  padding: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
}

.report-period-list button.active {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.16);
  box-shadow: inset 3px 0 var(--primary-hot);
}

.report-period-list span,
.report-period-list i {
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-style: normal;
}

.report-dashboard {
  padding: 12px;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.report-kpis article,
.report-chart-card {
  border: 1px solid rgba(199, 240, 186, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
}

.report-kpis article {
  display: grid;
  gap: 3px;
  padding: 12px;
}

.report-kpis small,
.report-kpis span {
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.72rem;
}

.report-kpis strong {
  color: var(--primary-hot);
  font-family: var(--font-headline);
  font-size: 1.55rem;
}

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.report-chart-card {
  min-height: 210px;
  padding: 14px;
}

.report-chart-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.report-chart-card > header b {
  color: var(--ink);
  font-family: var(--font-label);
  font-weight: 500;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 18px;
}

.report-donut {
  width: 138px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 0 0 26px rgba(126, 226, 85, 0.1);
}

.report-donut::before {
  content: "";
  grid-area: 1 / 1;
  width: 78px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #151a15;
}

.report-donut span {
  grid-area: 1 / 1;
  z-index: 1;
  color: var(--ink);
  font-family: var(--font-headline);
  font-size: 1.5rem;
}

.chart-legend {
  display: grid;
  gap: 7px;
}

.chart-legend span {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-legend i {
  width: 8px;
  height: 8px;
}

.chart-legend b {
  color: var(--ink);
  font-weight: 500;
}

.daily-bars {
  height: 150px;
  display: flex;
  align-items: end;
  gap: 5px;
  padding-top: 10px;
  border-bottom: 1px solid rgba(199, 240, 186, 0.12);
}

.daily-bars > div {
  flex: 1;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 5px;
}

.daily-bars i {
  width: 100%;
  min-height: 6px;
  background: linear-gradient(180deg, var(--primary-hot), #3f8731);
  box-shadow: 0 0 10px rgba(126, 226, 85, 0.22);
}

.daily-bars span {
  color: var(--muted);
  font-size: 0.62rem;
  text-align: center;
}

.empty-report {
  align-self: center;
  width: 100%;
  color: var(--muted);
  text-align: center;
}

.trend-svg {
  width: 100%;
  height: 150px;
  overflow: visible;
}

.chart-grid-line {
  fill: none;
  stroke: rgba(199, 240, 186, 0.09);
  stroke-width: 0.8;
}

.trend-line {
  fill: none;
  stroke: var(--primary-hot);
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.trend-svg circle {
  fill: #3ab3da;
  vector-effect: non-scaling-stroke;
}

.radar-wrap {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 15px;
}

.radar-wrap svg {
  width: 160px;
  height: 160px;
}

.radar-grid {
  fill: rgba(126, 226, 85, 0.025);
  stroke: rgba(199, 240, 186, 0.18);
  stroke-width: 1;
}

.radar-value {
  fill: rgba(126, 226, 85, 0.24);
  stroke: var(--primary-hot);
  stroke-width: 1.5;
}

.radar-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.radar-legend span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.72rem;
}

.radar-legend b {
  color: var(--primary-hot);
}

.heatmap-card {
  grid-column: 1 / -1;
  min-height: 120px;
}

.time-heatmap {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}

.time-heatmap span {
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(126, 226, 85, calc(var(--heat) * 0.7));
  border-radius: 5px;
  background: rgba(85, 170, 51, var(--heat));
  color: var(--ink);
  font-family: var(--font-label);
}

.report-analysis {
  display: grid;
  align-content: start;
  gap: 10px;
}

.report-analysis section {
  border-bottom: 1px solid rgba(199, 240, 186, 0.1);
  padding-bottom: 10px;
}

.report-analysis p,
.report-analysis li {
  color: #dce4d8;
  line-height: 1.5;
  font-size: 0.84rem;
}

.report-analysis ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.analysis-badge {
  width: fit-content;
  border: 1px solid rgba(126, 226, 85, 0.35);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--primary-hot);
  font-family: var(--font-label);
  font-size: 0.7rem;
}

.student-report-star {
  color: var(--primary-hot);
  text-align: center;
  font-size: 3rem;
  text-shadow: 0 0 20px rgba(126, 226, 85, 0.75);
}

.encouragement-card {
  border: 1px solid rgba(126, 226, 85, 0.35) !important;
  border-radius: 7px;
  padding: 12px;
  background: rgba(85, 170, 51, 0.1);
}

.calendar-day.has-activity {
  box-shadow: inset 0 -3px #3ab3da;
}

.calendar-day.has-report b {
  position: absolute;
  top: 2px;
  right: 2px;
  color: var(--primary-hot);
  font-size: 0.55rem;
}

.learning-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
}

.learning-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-right: 72px;
}

.learning-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-headline);
  font-size: clamp(2rem, 4vw, 4.2rem);
}

.learning-head [data-learning-meta] {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: var(--font-label);
}

.learning-sheet.chinese-mode,
.learning-sheet.math-mode,
.learning-sheet.english-mode {
  padding: 18px 4.6vw 22px;
}

.learning-sheet.chinese-mode .learning-shell,
.learning-sheet.math-mode .learning-shell,
.learning-sheet.english-mode .learning-shell {
  gap: 12px;
}

.learning-sheet.chinese-mode .learning-head,
.learning-sheet.math-mode .learning-head,
.learning-sheet.english-mode .learning-head {
  align-items: stretch;
  padding-right: 58px;
}

.learning-sheet.chinese-mode .learning-head > div:first-child,
.learning-sheet.math-mode .learning-head > div:first-child,
.learning-sheet.english-mode .learning-head > div:first-child {
  flex: 0 0 min(430px, 29vw);
}

.learning-sheet.chinese-mode .learning-head h2,
.learning-sheet.math-mode .learning-head h2,
.learning-sheet.english-mode .learning-head h2 {
  max-width: min(560px, 44vw);
  font-size: clamp(1.28rem, 2.2vw, 2.25rem);
  line-height: 1.06;
}

.learning-sheet.chinese-mode .learning-head [data-learning-meta],
.learning-sheet.math-mode .learning-head [data-learning-meta],
.learning-sheet.english-mode .learning-head [data-learning-meta] {
  margin-top: 6px;
  font-size: 0.82rem;
}

.learning-sheet.chinese-mode .learning-source,
.learning-sheet.math-mode .learning-source,
.learning-sheet.english-mode .learning-source {
  margin-top: 6px;
  padding: 3px 7px;
  font-size: 0.64rem;
}

.learning-countdown {
  display: inline-flex;
  min-width: 118px;
  min-height: 34px;
  margin: 7px 0 0;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(242, 209, 150, 0.55);
  border-radius: 5px;
  color: #ffe1a6;
  background: rgba(139, 90, 35, 0.2);
  box-shadow: 0 0 14px rgba(242, 209, 150, 0.12);
  font-family: var(--font-label);
  font-size: 0.92rem;
}

.learning-countdown[hidden] {
  display: none;
}

.math-head-overview {
  flex: 1 1 auto;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.1fr);
  gap: 12px;
  align-self: end;
}

.math-head-overview[hidden] {
  display: none;
}

.learning-sheet.chinese-mode .learning-icon,
.learning-sheet.chinese-mode .learning-visual,
.learning-sheet.chinese-mode .learning-content-panel,
.learning-sheet.math-mode .learning-icon,
.learning-sheet.math-mode .learning-visual,
.learning-sheet.math-mode .learning-content-panel,
.learning-sheet.english-mode .learning-icon,
.learning-sheet.english-mode .learning-visual,
.learning-sheet.english-mode .learning-content-panel {
  display: none;
}

.learning-sheet.chinese-mode .learning-body,
.learning-sheet.math-mode .learning-body,
.learning-sheet.english-mode .learning-body {
  max-width: none;
  margin: 0;
  grid-template-columns: 1fr;
  overflow: hidden;
}

.learning-source {
  display: inline-flex;
  margin: 10px 0 0;
  padding: 5px 9px;
  border: 1px solid rgba(126, 226, 85, 0.5);
  border-radius: 5px;
  color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.13);
  font-family: var(--font-label);
  font-size: 0.72rem;
}

.learning-source.fallback {
  border-color: rgba(218, 158, 86, 0.55);
  color: #f2c18c;
  background: rgba(139, 90, 35, 0.22);
}

.learning-sheet.preview-mode [data-learning-title],
.learning-sheet.preview-mode [data-learning-goal],
.learning-sheet.preview-mode [data-learning-companion],
.learning-sheet.preview-mode [data-learning-prompt],
.learning-sheet.preview-mode [data-learning-hint],
.learning-sheet.preview-mode [data-learning-success] {
  outline: 1px dashed rgba(126, 226, 85, 0.5);
  outline-offset: 5px;
  border-radius: 4px;
  cursor: text;
}

.learning-sheet.preview-mode [data-learning-title]:focus,
.learning-sheet.preview-mode [data-learning-goal]:focus,
.learning-sheet.preview-mode [data-learning-companion]:focus,
.learning-sheet.preview-mode [data-learning-prompt]:focus,
.learning-sheet.preview-mode [data-learning-hint]:focus,
.learning-sheet.preview-mode [data-learning-success]:focus {
  outline-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.12);
}

.learning-sheet.preview-mode .challenge-choice[contenteditable="true"] {
  border-style: dashed;
  border-color: rgba(126, 226, 85, 0.62);
  cursor: text;
}

.learning-sheet.preview-mode .challenge-choice[contenteditable="true"]:focus {
  outline: 1px solid var(--primary-hot);
  background: rgba(85, 170, 51, 0.16);
}

.learning-sheet.preview-mode .subject-lesson [contenteditable="true"] {
  outline: 1px dashed rgba(126, 226, 85, 0.5);
  outline-offset: 3px;
  border-radius: 4px;
  cursor: text;
}

.learning-sheet.preview-mode .subject-lesson [contenteditable="true"]:focus {
  outline-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.12);
}

.learning-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(126, 226, 85, 0.5);
  border-radius: 8px;
  color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.12);
  box-shadow: 0 0 24px rgba(126, 226, 85, 0.28);
}

.learning-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.learning-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(360px, 1fr);
  gap: 18px;
  overflow: hidden;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.subject-lesson {
  grid-column: 1 / -1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(260px, 0.95fr) minmax(300px, 1.15fr);
  gap: 14px;
  overflow: hidden;
}

.subject-lesson[hidden] {
  display: none;
}

.learning-sheet.chinese-mode .subject-lesson,
.learning-sheet.math-mode .subject-lesson,
.learning-sheet.english-mode .subject-lesson {
  height: 100%;
  grid-template-columns: minmax(320px, 1fr) minmax(430px, 1.12fr) minmax(360px, 1fr);
  gap: 18px;
}

.learning-sheet.chinese-mode .subject-lesson {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lesson-column {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(85, 170, 51, 0.34);
  border-radius: 9px;
  background: rgba(26, 26, 26, 0.72);
  box-shadow: inset 0 0 22px rgba(126, 226, 85, 0.06);
}

.learning-sheet.chinese-mode .lesson-column,
.learning-sheet.math-mode .lesson-column,
.learning-sheet.english-mode .lesson-column {
  height: 100%;
  align-content: stretch;
  padding: 16px;
}

.math-tools-panel {
  grid-column: 1;
  grid-row: 1;
  grid-template-rows: auto minmax(0, 1fr);
}

.math-intro {
  display: grid;
  gap: 10px;
}

.math-challenge-copy {
  padding: 11px;
  border: 1px dashed rgba(126, 226, 85, 0.26);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.07);
}

.math-challenge-copy small {
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.math-challenge-copy p {
  margin: 6px 0 0;
  color: #dfe7d9;
  line-height: 1.45;
}

.math-challenge-copy.geometry-tips {
  border-style: solid;
  border-color: rgba(72, 178, 216, 0.38);
  background: linear-gradient(90deg, rgba(72, 178, 216, 0.1), rgba(85, 170, 51, 0.06));
}

.math-challenge-copy.geometry-tips small {
  color: #79d8f5;
}

.scratch-head {
  display: grid;
  gap: 9px;
}

.math-problems-panel {
  grid-column: 2;
  grid-row: 1;
}

.math-solutions-panel {
  grid-column: 3;
  grid-row: 1;
}

.english-question-panel {
  grid-column: 1;
  grid-row: 1;
}

.english-visual-panel {
  grid-column: 2;
  grid-row: 1;
  place-items: stretch;
  align-content: stretch;
}

.english-reading-panel {
  grid-column: 3;
  grid-row: 1;
}

.chinese-question-panel {
  grid-column: 1;
  grid-row: 1;
}

.chinese-visual-panel {
  grid-column: 2;
  grid-row: 1;
  place-items: stretch;
  align-content: start;
}

.chinese-reading-panel {
  grid-column: 3;
  grid-row: 1;
}

.math-problems-panel,
.math-solutions-panel,
.chinese-question-panel,
.chinese-reading-panel,
.english-question-panel,
.english-reading-panel {
  align-content: start;
}

.lesson-column h3 {
  margin: 0;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.lesson-goal {
  padding: 11px;
  border: 1px solid rgba(126, 226, 85, 0.25);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.1);
}

.lesson-goal small {
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.lesson-goal p {
  margin: 6px 0 0;
}

.lesson-question {
  padding: 12px;
  border: 1px solid rgba(199, 240, 186, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.math-illustrated-question { display: grid; gap: 12px; min-width: 0; }
.math-illustrated-question h4 { margin: 0; font-size: 1rem; line-height: 1.65; }
.math-result-label { display: grid; gap: 6px; color: #c2cfba; font-size: .8rem; }
.math-visual { margin: 0; padding: 12px; border: 1px solid #536b39; border-radius: 3px; background: #f6f2dc; color: #253923; box-shadow: 3px 3px 0 #142410; }
.math-visual figcaption { font-size: .75rem; color: #526846; margin-bottom: 8px; }
.math-visual svg { display: block; width: 100%; max-height: 420px; font-family: system-ui, sans-serif; color: #253923; }
.math-visual svg rect { fill: #e5edc5; stroke: #66834b; stroke-width: 1.5; }
.math-visual svg text { fill: #253923; }
.math-visual svg .mv-line { stroke: #66834b; stroke-width: 2; fill: none; }
.math-visual svg .mv-accent { fill: #c8dca2; }
.math-visual svg .mv-bar { fill: #9fc975; }
.math-illustrated-question .geometry-diagram { max-width: 420px; justify-self: center; }

.lesson-question h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.geometry-question {
  display: grid;
  grid-template-columns: minmax(145px, 0.72fr) minmax(190px, 1fr);
  column-gap: 13px;
  align-items: center;
}

.geometry-question .geometry-diagram {
  grid-column: 1;
  grid-row: 1 / span 3;
}

.geometry-question h4,
.geometry-question input,
.geometry-question .answer-state {
  grid-column: 2;
}

.geometry-diagram {
  width: 100%;
  min-height: 142px;
  margin: 0;
  display: grid;
  align-content: center;
  border: 1px solid rgba(121, 216, 245, 0.32);
  border-radius: 7px;
  overflow: hidden;
  background:
    linear-gradient(rgba(121, 216, 245, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 216, 245, 0.045) 1px, transparent 1px),
    rgba(7, 14, 12, 0.82);
  background-size: 16px 16px;
}

.geometry-diagram svg {
  width: 100%;
  height: 142px;
  overflow: visible;
}

.geometry-diagram figcaption {
  padding: 0 8px 7px;
  color: #a7b9b0;
  font-size: 0.68rem;
  text-align: center;
}

.geometry-shape,
.geometry-face,
.geometry-grid-cell {
  fill: rgba(85, 170, 51, 0.13);
  stroke: #79d8f5;
  stroke-width: 2.3;
  vector-effect: non-scaling-stroke;
}

.geometry-face:nth-of-type(even),
.geometry-secondary {
  fill: rgba(126, 226, 85, 0.15);
}

.geometry-grid-cell {
  fill: rgba(126, 226, 85, 0.09);
  stroke: rgba(121, 216, 245, 0.86);
  stroke-width: 1.6;
}

.geometry-cut {
  fill: none;
  stroke: #ffcf73;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
}

.geometry-guide {
  fill: none;
  stroke: #ffcf73;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.geometry-point {
  fill: #ffcf73;
}

.geometry-label {
  fill: #eef7ea;
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 0;
}

.lesson-options {
  display: grid;
  gap: 7px;
}

.lesson-question input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(199, 240, 186, 0.24);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(9, 12, 10, 0.7);
  font: inherit;
}

.lesson-question input.answer-correct {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.18);
}

.lesson-question input.answer-wrong {
  border-color: #ff6262;
  background: rgba(180, 32, 32, 0.16);
}

.open-answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.voice-input-btn.listening {
  color: #101b0d;
  background: var(--primary-hot);
  box-shadow: 0 0 16px rgba(126, 226, 85, 0.35);
}

.ai-perspective-card {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(126, 226, 85, 0.42);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.1);
  box-shadow: inset 0 0 16px rgba(126, 226, 85, 0.06);
}

.ai-perspective-card[hidden] {
  display: none;
}

.ai-perspective-card.fallback {
  border-color: rgba(218, 158, 86, 0.48);
  background: rgba(139, 90, 35, 0.13);
}

.ai-perspective-card small,
.ai-perspective-card h5,
.ai-perspective-card p,
.ai-perspective-card strong {
  margin: 0;
}

.ai-perspective-card small,
.ai-perspective-card h5,
.ai-perspective-card strong {
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.ai-perspective-card p {
  color: var(--ink);
  line-height: 1.55;
}

.perspective-loading {
  color: var(--muted);
}

.answer-state {
  display: block;
  min-height: 18px;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--font-label);
}

.answer-state.correct {
  color: var(--primary-hot);
}

.answer-state.attempted {
  color: #ff5a5f;
  font-size: 1.1rem;
  text-shadow: 0 0 10px rgba(255, 90, 95, 0.34);
}

.visual-column {
  place-items: center;
  align-content: center;
}

.chinese-visual-panel .learning-generated-image,
.chinese-generated-image,
.english-visual-panel .learning-generated-image,
.english-generated-image {
  width: 100%;
  max-height: min(48vh, 520px);
  object-fit: contain;
  border: 1px solid rgba(126, 226, 85, 0.32);
  border-radius: 8px;
  background: rgba(9, 12, 10, 0.64);
  box-shadow: 0 0 24px rgba(126, 226, 85, 0.12);
}

.chinese-visual-panel .pixel-scene,
.english-visual-panel .pixel-scene {
  width: 100%;
  min-height: 320px;
}

.chinese-focus-group {
  width: 100%;
  display: grid;
  gap: 8px;
}

.chinese-keyword-chip {
  min-height: 42px;
  align-content: center;
}

.chinese-keyword-chip small {
  display: none;
}

.chinese-focus-group h4 {
  margin: 0;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.key-sentence-list {
  display: grid;
  gap: 7px;
}

.key-sentence-chip {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(126, 226, 85, 0.32);
  border-left: 3px solid var(--primary-hot);
  border-radius: 5px;
  color: #e9f2e4;
  background: rgba(85, 170, 51, 0.09);
  text-align: left;
  line-height: 1.5;
  cursor: pointer;
}

.key-sentence-chip:hover,
.key-sentence-chip:focus-visible {
  background: rgba(85, 170, 51, 0.18);
  box-shadow: 0 0 14px rgba(126, 226, 85, 0.16);
  outline: none;
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.keyword-row span,
.keyword-row .keyword-chip {
  padding: 6px 9px;
  border: 1px solid rgba(126, 226, 85, 0.45);
  border-radius: 5px;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.keyword-chip {
  display: grid;
  min-width: 86px;
  gap: 3px;
  text-align: center;
  cursor: pointer;
  background: rgba(8, 16, 10, 0.64);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.keyword-chip:hover,
.keyword-chip:focus-visible {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.16);
  box-shadow: 0 0 14px rgba(126, 226, 85, 0.22);
  transform: translateY(-1px);
  outline: none;
}

.keyword-chip strong {
  color: var(--primary-hot);
  font-size: 0.95rem;
}

.keyword-chip small {
  color: #e5ecdf;
  font-family: var(--font-body);
  font-size: 0.82rem;
}

.daily-sentence-stack {
  width: 100%;
  display: grid;
  gap: 8px;
}

.daily-sentence-stack h4 {
  margin: 0;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.daily-sentence-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(126, 226, 85, 0.28);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.09);
}

.daily-sentence-card strong {
  color: #f0f6ec;
}

.daily-sentence-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.selectable-reading {
  margin: 0;
  color: #e5ecdf;
  line-height: 1.9;
  font-size: 1.04rem;
  user-select: text;
}

.keyword-highlight {
  padding: 0 2px;
  border-radius: 3px;
  color: var(--primary-hot);
  background: rgba(126, 226, 85, 0.13);
  box-shadow: 0 0 10px rgba(126, 226, 85, 0.16);
  cursor: pointer;
}

.keyword-highlight:hover,
.keyword-highlight:focus-visible {
  color: #101b0d;
  background: var(--primary-hot);
  outline: 1px solid rgba(236, 255, 226, 0.75);
}

.chinese-reading-text {
  white-space: pre-wrap;
}

.chinese-breakdown {
  display: grid;
  gap: 5px;
  margin: 8px 0;
}

.chinese-breakdown p {
  padding: 6px 8px;
  border-left: 2px solid rgba(126, 226, 85, 0.6);
  background: rgba(126, 226, 85, 0.07);
}

.chinese-preview-notes {
  width: 100%;
  display: grid;
  gap: 8px;
}

.chinese-preview-notes > h4 {
  margin: 0;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.chinese-note-editor {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px dashed rgba(126, 226, 85, 0.36);
  border-radius: 7px;
  background: rgba(8, 14, 9, 0.56);
}

.chinese-note-editor strong,
.chinese-note-editor span,
.chinese-note-editor p {
  margin: 0;
  padding: 4px 6px;
  color: #e8f0e3;
  background: rgba(255, 255, 255, 0.035);
}

.chinese-note-editor strong {
  color: var(--primary-hot);
}

.challenge-choice.answer-correct {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.24);
  box-shadow: 0 0 14px rgba(126, 226, 85, 0.22);
}

.challenge-choice.answer-wrong {
  border-color: #ff6262;
  background: rgba(180, 32, 32, 0.2);
  box-shadow: 0 0 12px rgba(255, 70, 70, 0.18);
}

.selection-tip {
  color: var(--muted);
  font-family: var(--font-label);
}

.reading-translation {
  padding: 10px 12px;
  border: 1px solid rgba(126, 226, 85, 0.24);
  border-radius: 7px;
  background: rgba(10, 16, 12, 0.55);
}

.reading-translation summary {
  color: var(--primary-hot);
  font-family: var(--font-label);
  cursor: pointer;
}

.reading-translation p {
  margin: 10px 0 0;
  color: #dce8d5;
  line-height: 1.75;
}

.speech-controls,
.drawing-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.speech-controls button,
.drawing-tools button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(126, 226, 85, 0.4);
  border-radius: 5px;
  background: rgba(20, 25, 21, 0.78);
  color: var(--ink);
  font-family: var(--font-label);
  cursor: pointer;
}

.drawing-tools button.active {
  color: #0c200e;
  background: var(--primary-hot);
}

.speech-voice-note {
  color: rgba(199, 240, 186, 0.68);
  font-family: var(--font-label);
  font-size: 0.78rem;
  line-height: 1.45;
}

.scratch-canvas {
  width: 100%;
  height: min(48vh, 460px);
  border-radius: 7px;
  touch-action: none;
  cursor: crosshair;
}

.learning-sheet.math-mode .scratch-canvas {
  height: 100%;
  min-height: 390px;
  box-shadow: inset 0 0 0 1px rgba(73, 68, 46, 0.16), 0 0 18px rgba(126, 226, 85, 0.08);
}

.solution-column details {
  padding: 12px;
  border: 1px solid rgba(199, 240, 186, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
}

.solution-column summary {
  color: var(--primary-hot);
  cursor: pointer;
  font-family: var(--font-label);
}

.solution-column p {
  color: #dfe7d9;
  line-height: 1.5;
}

.annotation-popover {
  position: fixed;
  z-index: 110;
  width: min(320px, calc(100vw - 30px));
  max-height: min(520px, calc(100vh - 175px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 15px;
  border: 1px solid rgba(126, 226, 85, 0.55);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(18, 21, 18, 0.98);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.52), 0 0 25px rgba(126, 226, 85, 0.14);
}

/* Explore, AI technology and habit lessons share the compact three-column learning shell. */
.learning-sheet.explore-mode,
.learning-sheet.technology-mode,
.learning-sheet.habit-mode {
  padding: 18px 4.6vw 22px;
}

.learning-sheet.explore-mode .learning-shell,
.learning-sheet.technology-mode .learning-shell,
.learning-sheet.habit-mode .learning-shell {
  gap: 12px;
}

.learning-sheet.explore-mode .learning-head,
.learning-sheet.technology-mode .learning-head,
.learning-sheet.habit-mode .learning-head {
  align-items: stretch;
  padding-right: 58px;
}

.learning-sheet.explore-mode .learning-head > div:first-child,
.learning-sheet.technology-mode .learning-head > div:first-child,
.learning-sheet.habit-mode .learning-head > div:first-child {
  flex: 0 0 min(430px, 29vw);
}

.learning-sheet.explore-mode .learning-head h2,
.learning-sheet.technology-mode .learning-head h2,
.learning-sheet.habit-mode .learning-head h2 {
  max-width: min(560px, 44vw);
  font-size: clamp(1.28rem, 2.2vw, 2.25rem);
  line-height: 1.06;
}

.learning-sheet.explore-mode .learning-head [data-learning-meta],
.learning-sheet.technology-mode .learning-head [data-learning-meta],
.learning-sheet.habit-mode .learning-head [data-learning-meta] {
  margin-top: 6px;
  font-size: 0.82rem;
}

.learning-sheet.explore-mode .learning-source,
.learning-sheet.technology-mode .learning-source,
.learning-sheet.habit-mode .learning-source {
  margin-top: 6px;
  padding: 3px 7px;
  font-size: 0.64rem;
}

.learning-sheet.explore-mode .learning-icon,
.learning-sheet.explore-mode .learning-visual,
.learning-sheet.explore-mode .learning-content-panel,
.learning-sheet.technology-mode .learning-icon,
.learning-sheet.technology-mode .learning-visual,
.learning-sheet.technology-mode .learning-content-panel,
.learning-sheet.habit-mode .learning-icon,
.learning-sheet.habit-mode .learning-visual,
.learning-sheet.habit-mode .learning-content-panel {
  display: none;
}

.learning-sheet.explore-mode .learning-body,
.learning-sheet.technology-mode .learning-body,
.learning-sheet.habit-mode .learning-body {
  max-width: none;
  margin: 0;
  grid-template-columns: 1fr;
  overflow: hidden;
}

.learning-sheet.explore-mode .subject-lesson,
.learning-sheet.technology-mode .subject-lesson,
.learning-sheet.habit-mode .subject-lesson {
  height: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.learning-sheet.explore-mode .lesson-column,
.learning-sheet.technology-mode .lesson-column,
.learning-sheet.habit-mode .lesson-column {
  height: 100%;
  align-content: start;
  padding: 16px;
}

.explore-clue-panel,
.explore-steps-panel,
.explore-thinking-panel,
.technology-observe-panel,
.technology-lab-panel,
.technology-create-panel,
.habit-theme-panel,
.habit-record-panel,
.habit-response-panel {
  grid-row: 1;
}

.explore-scene {
  display: grid;
  gap: 10px;
}

.explore-scene img {
  width: 100%;
  max-height: 34vh;
  object-fit: cover;
  border: 1px solid rgba(126, 226, 85, 0.35);
  border-radius: 7px;
}

.explore-scene p,
.safety-note p,
.habit-follow-up span {
  margin: 0;
  color: #dfe7d9;
  line-height: 1.5;
}

.pixel-clue-scene {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid rgba(126, 226, 85, 0.35);
  border-radius: 7px;
  background:
    linear-gradient(#102a1c 0 58%, #26391e 58%),
    #102a1c;
}

.pixel-clue-scene::before {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 18%;
  height: 42%;
  border: 12px solid #5b3b23;
  border-bottom: 0;
  box-shadow: inset 0 0 0 5px #182b18;
}

.pixel-clue-scene i {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: var(--primary-hot);
  box-shadow: 0 0 16px var(--primary-hot);
  animation: fireflyClue 2.4s ease-in-out infinite alternate;
}

.pixel-clue-scene i:nth-child(1) { left: 18%; top: 27%; }
.pixel-clue-scene i:nth-child(2) { left: 48%; top: 18%; animation-delay: -0.7s; background: #3ab3da; }
.pixel-clue-scene i:nth-child(3) { right: 18%; top: 34%; animation-delay: -1.3s; }
.pixel-clue-scene i:nth-child(4) { right: 37%; bottom: 16%; animation-delay: -1.8s; background: #f3cf75; }

@keyframes fireflyClue {
  to { transform: translate(9px, -12px); opacity: 0.45; }
}

.clue-list,
.explore-step-list,
.thinking-timeline,
.stamina-rounds,
.habit-ideas {
  display: grid;
  gap: 9px;
}

.clue-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 9px;
  border: 1px solid rgba(199, 240, 186, 0.2);
  border-radius: 7px;
  color: transparent;
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
}

.clue-card span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 4px;
  color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.14);
}

.clue-card.discovered {
  color: var(--ink);
  border-color: rgba(126, 226, 85, 0.55);
  background: rgba(85, 170, 51, 0.12);
}

.explore-step {
  padding: 12px;
  border: 1px solid rgba(199, 240, 186, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.explore-step.locked {
  opacity: 0.32;
  pointer-events: none;
  filter: grayscale(1);
}

.explore-step header {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
}

.explore-step header span,
.thinking-timeline article span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(126, 226, 85, 0.48);
  border-radius: 4px;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.explore-step h4 {
  margin: 2px 0 10px;
  line-height: 1.4;
}

.explore-options,
.explore-input-row {
  display: grid;
  gap: 7px;
}

.explore-options button,
.explore-input-row button,
.explore-input-row input,
.stamina-counter-actions button,
.effort-picker button,
.mood-picker button,
.habit-record-actions button {
  min-height: 40px;
  border: 1px solid rgba(199, 240, 186, 0.25);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--ink);
  background: rgba(9, 12, 10, 0.72);
  font: inherit;
}

.explore-options button.answer-correct { border-color: var(--primary-hot); background: rgba(85, 170, 51, 0.18); }
.explore-options button.answer-wrong { border-color: #ff6262; background: rgba(180, 32, 32, 0.16); }
.explore-step-feedback { margin: 9px 0 0; line-height: 1.45; }
.explore-step-feedback.correct { color: var(--primary-hot); }
.explore-step-feedback.retry { color: #f3c289; }

.thinking-timeline article {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  padding: 10px;
  border-left: 2px solid var(--primary-hot);
  background: rgba(85, 170, 51, 0.08);
}

.thinking-timeline article p {
  margin: 2px 0 0;
  line-height: 1.45;
}

.final-thinking,
.alternative-thinking {
  padding: 12px;
  border: 1px solid rgba(199, 240, 186, 0.2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
}

.final-thinking summary,
.alternative-thinking summary {
  color: var(--primary-hot);
  cursor: pointer;
  font-family: var(--font-label);
}

.technology-observe-panel,
.technology-lab-panel,
.technology-create-panel {
  overflow-y: auto;
  scrollbar-color: rgba(126, 226, 85, 0.45) rgba(255, 255, 255, 0.04);
}

.technology-panel-head,
.technology-lab-panel > header,
.technology-create-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.technology-panel-head span,
.tech-section-label {
  color: #55d8ff;
  font: 700 0.75rem var(--font-label);
  text-transform: uppercase;
}

.technology-panel-head b {
  padding: 4px 8px;
  border: 1px solid rgba(85, 216, 255, 0.4);
  border-radius: 5px;
  color: #9cecff;
  background: rgba(23, 120, 151, 0.14);
  font-family: var(--font-label);
}

.technology-preview-controls {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  gap: 8px;
}

.technology-preview-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.technology-preview-controls label:nth-last-child(-n+2) { grid-column: 1 / -1; }

.technology-preview-controls select,
.technology-preview-controls input,
.technology-preview-controls textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(85, 216, 255, 0.3);
  border-radius: 5px;
  padding: 5px 8px;
  color: var(--ink);
  background: #0b100d;
  font: inherit;
}

.technology-preview-controls textarea {
  min-height: 74px;
  resize: vertical;
}

.technology-scene {
  display: grid;
  gap: 9px;
}

.technology-scene img {
  width: 100%;
  aspect-ratio: 1.22;
  object-fit: cover;
  border: 1px solid rgba(85, 216, 255, 0.38);
  border-radius: 7px;
}

.technology-scene p,
.technology-reflection p,
.technology-next p,
.technology-example span {
  margin: 0;
  line-height: 1.5;
}

.technology-fallback-scene {
  position: relative;
  min-height: 245px;
  overflow: hidden;
  border: 1px solid rgba(85, 216, 255, 0.34);
  border-radius: 7px;
  background:
    linear-gradient(rgba(85, 216, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85, 216, 255, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(126, 226, 85, 0.2), transparent 38%),
    #0b1716;
  background-size: 22px 22px, 22px 22px, auto, auto;
}

.tech-bot,
.tech-chip,
.tech-signal {
  position: absolute;
  display: block;
}

.tech-bot {
  left: 38%;
  top: 25%;
  width: 84px;
  height: 112px;
  border: 8px solid #163d43;
  background: #7ee255;
  box-shadow: 0 0 22px rgba(126, 226, 85, 0.35);
}

.tech-bot::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 18px;
  width: 12px;
  height: 12px;
  background: #07110f;
  box-shadow: 34px 0 #07110f;
}

.tech-chip {
  left: 12%;
  bottom: 14%;
  width: 58px;
  height: 48px;
  border: 5px solid #3ab3da;
  background: #15201c;
}

.tech-signal {
  right: 13%;
  top: 20%;
  width: 56px;
  height: 56px;
  border: 5px solid #55d8ff;
  border-radius: 50%;
  box-shadow: 0 0 20px #3ab3da, inset 0 0 14px rgba(85, 216, 255, 0.4);
}

.technology-knowledge,
.technology-options,
.technology-components {
  display: grid;
  gap: 8px;
}

.technology-knowledge button,
.technology-options button,
.technology-components button {
  min-height: 46px;
  border: 1px solid rgba(199, 240, 186, 0.22);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
  font: inherit;
  text-align: left;
}

.technology-knowledge button {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
}

.technology-knowledge button span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 4px;
  color: #07110f;
  background: var(--primary-hot);
  font-family: var(--font-label);
}

.technology-knowledge button p { margin: 0; }
.technology-knowledge button.active,
.technology-components button.active {
  border-color: #55d8ff;
  background: rgba(58, 179, 218, 0.14);
  box-shadow: inset 3px 0 #55d8ff;
}

.technology-lab-panel > header {
  display: grid;
  justify-content: stretch;
  padding: 12px;
  border: 1px solid rgba(126, 226, 85, 0.28);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.08);
}

.technology-lab-panel > header small,
.technology-reflection small,
.technology-next small {
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.technology-lab-panel h3,
.technology-create-panel h3 {
  margin: 5px 0 0;
  font-size: 1.05rem;
  line-height: 1.4;
}

.technology-challenge {
  display: grid;
  gap: 10px;
}

.technology-challenge h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.technology-options button.answer-correct {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.18);
}

.technology-options button.answer-wrong {
  border-color: #ff6262;
  background: rgba(180, 32, 32, 0.16);
}

.technology-feedback {
  min-height: 44px;
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.04);
}

.technology-feedback.correct { color: var(--primary-hot); }
.technology-feedback.retry { color: #ffb2a7; }

.technology-reflection,
.technology-example,
.technology-next {
  padding: 11px;
  border: 1px solid rgba(199, 240, 186, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.technology-components {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.technology-create-panel textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid rgba(85, 216, 255, 0.32);
  border-radius: 7px;
  padding: 12px;
  color: var(--ink);
  background: #0b100d;
  font: inherit;
  line-height: 1.55;
}

.technology-result {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(126, 226, 85, 0.5);
  border-radius: 7px;
  background: rgba(85, 170, 51, 0.12);
}

.technology-result > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #07110f;
  background: var(--primary-hot);
  box-shadow: 0 0 16px rgba(126, 226, 85, 0.32);
}

.technology-result small,
.technology-result strong,
.technology-result p {
  display: block;
  margin: 0 0 4px;
}

.technology-result strong { color: var(--primary-hot); }

.stamina-figure {
  position: relative;
  width: min(210px, 70%);
  aspect-ratio: 1;
  margin: 4px auto;
  border: 1px solid rgba(126, 226, 85, 0.28);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 68%, rgba(126, 226, 85, 0.18), transparent 46%), #101511;
}

.stamina-figure span {
  position: absolute;
  display: block;
  background: #7ee255;
  box-shadow: 0 0 8px rgba(126, 226, 85, 0.35);
}

.figure-head { width: 38px; height: 38px; left: calc(50% - 19px); top: 17%; }
.figure-body { width: 50px; height: 66px; left: calc(50% - 25px); top: 37%; }
.figure-arm { width: 58px; height: 14px; top: 42%; transform-origin: center; }
.figure-arm.left { right: 55%; transform: rotate(-24deg); }
.figure-arm.right { left: 55%; transform: rotate(24deg); }
.figure-leg { width: 17px; height: 62px; top: 63%; transform-origin: top; }
.figure-leg.left { left: 38%; transform: rotate(13deg); }
.figure-leg.right { right: 38%; transform: rotate(-13deg); }

.stamina-figure i {
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 8%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #3ab3da, var(--primary-hot), transparent);
  box-shadow: 0 0 10px #3ab3da;
}

.safety-note {
  padding: 10px;
  border: 1px solid rgba(242, 193, 140, 0.35);
  border-radius: 7px;
  background: rgba(139, 90, 35, 0.14);
}

.safety-note strong { color: #f2c18c; }
.stamina-list h4, .effort-picker h4, .habit-ideas h4, .mood-picker h4 { margin: 0; color: var(--primary-hot); }
.stamina-list p, .habit-ideas p { margin: 0; padding: 8px 10px; background: rgba(255, 255, 255, 0.04); }

.stamina-counter-panel {
  place-items: center;
  align-content: center !important;
  text-align: center;
}

.tempo-display {
  display: grid;
  gap: 2px;
  color: var(--muted);
}
.tempo-display strong { color: var(--primary-hot); font-size: 1.8rem; }
.stamina-count { display: flex; align-items: baseline; gap: 8px; }
.stamina-count strong { color: var(--ink); font-family: var(--font-headline); font-size: clamp(4rem, 9vh, 7rem); }
.stamina-count span { color: var(--muted); font-size: 1.2rem; }

.stamina-plus {
  width: min(210px, 75%);
  aspect-ratio: 1.65;
  border: 1px solid #8cf166;
  border-radius: 8px;
  color: #0d1d0b;
  background: var(--primary-hot);
  box-shadow: 0 0 28px rgba(126, 226, 85, 0.28);
  font: 700 2.5rem var(--font-headline);
}

.stamina-counter-actions,
.effort-picker,
.mood-picker,
.habit-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rest-clock {
  min-width: 126px;
  padding: 8px 14px;
  border: 1px solid rgba(242, 209, 150, 0.55);
  border-radius: 6px;
  color: #ffe1a6;
  background: rgba(139, 90, 35, 0.2);
  font: 1.25rem var(--font-label);
}

.stamina-round {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 10px;
  border: 1px solid rgba(199, 240, 186, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
}

.stamina-round i {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-hot) calc(var(--progress) * 100%), rgba(255,255,255,.1) 0);
}
.stamina-round.complete { border-color: rgba(126, 226, 85, 0.55); }
.effort-picker button.active, .mood-picker button.active { color: #0d1d0b; background: var(--primary-hot); }

.stamina-preview-settings {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}
.stamina-preview-settings label { display: grid; gap: 4px; color: var(--muted); font-size: .78rem; }
.stamina-preview-settings input { width: 100%; min-height: 36px; padding: 5px 8px; color: var(--ink); background: #0d110e; border: 1px solid rgba(199,240,186,.24); border-radius: 5px; }

.habit-pixel-scene {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid rgba(126, 226, 85, 0.3);
  border-radius: 8px;
  background: linear-gradient(#102019 0 62%, #28351f 62%);
}
.habit-pixel-scene span { position: absolute; width: 34px; height: 34px; background: #55aa33; box-shadow: 0 0 16px rgba(126,226,85,.4); }
.habit-pixel-scene span:nth-child(1) { left: 24%; bottom: 22%; }
.habit-pixel-scene span:nth-child(2) { left: 45%; bottom: 32%; width: 48px; height: 48px; }
.habit-pixel-scene span:nth-child(3) { right: 20%; bottom: 20%; background: #f0b166; }
.habit-pixel-scene i { position: absolute; left: 15%; right: 15%; bottom: 12%; height: 3px; background: linear-gradient(90deg, transparent, #3ab3da, var(--primary-hot), transparent); }

.habit-theme-panel > small { color: var(--primary-hot); font-family: var(--font-label); }
.habit-theme-panel > h3 { font-size: 1.18rem; line-height: 1.45; }
.habit-record-panel textarea {
  width: 100%;
  min-height: 48vh;
  resize: none;
  padding: 16px;
  border: 1px solid rgba(199, 240, 186, 0.24);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(9, 12, 10, 0.72);
  font: inherit;
  line-height: 1.65;
}
.habit-record-actions .primary-action { margin-left: auto; }
.habit-follow-up { display: grid; gap: 5px; padding: 11px; border-left: 3px solid var(--primary-hot); background: rgba(85,170,51,.08); }
.habit-private-note { color: var(--muted); font-size: .8rem; }
.habit-response-panel { place-items: stretch; align-content: center !important; }
.habit-response-empty { padding: 20px; border: 1px dashed rgba(126,226,85,.28); border-radius: 8px; color: var(--muted); text-align: center; }
.habit-response-card { position: relative; display: grid; gap: 22px; padding: 24px; border: 1px solid rgba(126,226,85,.5); border-radius: 9px; background: linear-gradient(145deg, rgba(85,170,51,.16), rgba(10,14,11,.82)); box-shadow: 0 0 28px rgba(126,226,85,.12); }
.habit-response-card[hidden],
.habit-response-empty[hidden] { display: none; }
.habit-response-card > p { margin: 0; color: var(--ink); font-size: 1.08rem; line-height: 1.7; }
.habit-response-card > div { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid rgba(126,226,85,.22); }
.habit-response-card small { color: var(--muted); }
.habit-response-card strong { color: var(--primary-hot); }
.response-spark { color: var(--primary-hot); font-size: 2rem; }

@media (max-width: 980px) {
  .learning-sheet.explore-mode .learning-head,
  .learning-sheet.technology-mode .learning-head,
  .learning-sheet.habit-mode .learning-head {
    display: grid;
  }
  .learning-sheet.explore-mode .learning-head > div:first-child,
  .learning-sheet.technology-mode .learning-head > div:first-child,
  .learning-sheet.habit-mode .learning-head > div:first-child {
    flex-basis: auto;
  }
  .learning-sheet.explore-mode .subject-lesson,
  .learning-sheet.technology-mode .subject-lesson,
  .learning-sheet.habit-mode .subject-lesson {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .learning-sheet.explore-mode .lesson-column,
  .learning-sheet.technology-mode .lesson-column,
  .learning-sheet.habit-mode .lesson-column {
    height: auto;
    min-height: 420px;
  }
}

.annotation-popover::-webkit-scrollbar {
  width: 7px;
}

.annotation-popover::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: rgba(126, 226, 85, 0.48);
}

.annotation-popover[hidden] {
  display: none;
}

.annotation-popover h4,
.annotation-popover p {
  margin: 6px 0;
}

.annotation-source {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.annotation-translation {
  color: #f2f6ee;
  font-weight: 800;
}

.example-sentence {
  padding: 8px;
  border: 1px dashed rgba(126, 226, 85, 0.28);
  border-radius: 6px;
  background: rgba(126, 226, 85, 0.08);
}

.annotation-close {
  position: absolute;
  top: 7px;
  right: 7px;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.tian-grid {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--primary-hot);
  background:
    linear-gradient(45deg, transparent 49%, rgba(126, 226, 85, 0.18) 50%, transparent 51%),
    linear-gradient(-45deg, transparent 49%, rgba(126, 226, 85, 0.18) 50%, transparent 51%);
  color: var(--primary-hot);
  font-size: 2.1rem;
}

.word-combos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.word-combos span {
  padding: 4px 7px;
  background: rgba(85, 170, 51, 0.14);
  color: var(--primary-hot);
}

.compact-btn {
  min-height: 37px;
  margin-top: 8px;
  padding: 0 10px;
}

.learning-visual,
.learning-content-panel {
  border: 1px solid rgba(85, 170, 51, 0.34);
  border-radius: 10px;
  background: rgba(26, 26, 26, 0.72);
  box-shadow: inset 0 0 22px rgba(126, 226, 85, 0.06);
}

.learning-visual {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 20px;
  overflow: hidden;
}

.learning-generation-note {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(218, 158, 86, 0.4);
  border-radius: 7px;
  color: #f2c18c;
  background: rgba(139, 90, 35, 0.18);
  font-family: var(--font-label);
  font-size: 0.78rem;
}

.learning-generation-note[hidden] {
  display: none;
}

.learning-visual p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}

.learning-generated-image {
  width: min(100%, 520px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 0 38px rgba(126, 226, 85, 0.18);
}

.pixel-scene {
  position: relative;
  width: min(78%, 360px);
  aspect-ratio: 1;
  image-rendering: pixelated;
  border: 1px solid rgba(126, 226, 85, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(126, 226, 85, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(126, 226, 85, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 52% 36%, rgba(126, 226, 85, 0.34), transparent 28%),
    linear-gradient(180deg, #132314, #080d0a 70%);
  background-size: 24px 24px, 24px 24px, auto, auto;
  box-shadow: 0 0 32px rgba(126, 226, 85, 0.22), inset 0 0 42px rgba(0, 0, 0, 0.42);
}

.pixel-scene span {
  position: absolute;
  display: block;
  border-radius: 3px;
  background: var(--primary-hot);
  box-shadow: 0 0 18px rgba(126, 226, 85, 0.58);
}

.pixel-scene span:nth-child(1) {
  left: 24%;
  top: 24%;
  width: 32%;
  height: 18%;
}

.pixel-scene span:nth-child(2) {
  right: 22%;
  top: 42%;
  width: 18%;
  height: 30%;
  background: var(--secondary);
}

.pixel-scene span:nth-child(3) {
  left: 28%;
  bottom: 20%;
  width: 42%;
  height: 10%;
  background: var(--tertiary);
}

.pixel-scene span:nth-child(4) {
  right: 24%;
  top: 22%;
  width: 10%;
  height: 10%;
  background: #f0ffd9;
}

.learning-content-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.learning-goal {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(126, 226, 85, 0.28);
  border-radius: 8px;
  background: rgba(85, 170, 51, 0.1);
}

.learning-goal small,
.learning-practice h3,
.learning-checklist h3,
.learning-section-list h3 {
  font-family: var(--font-label);
  color: var(--primary-hot);
}

.learning-goal p,
.learning-intro,
.learning-section-list p {
  margin: 7px 0 0;
  color: #dfe7d9;
  line-height: 1.55;
}

.companion-line {
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 7px;
  color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.11);
  font-family: var(--font-label);
}

.micro-play-card {
  padding: 16px;
  border: 1px solid rgba(126, 226, 85, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.micro-play-card h3 {
  margin: 0 0 7px;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.challenge-prompt {
  margin: 0 0 14px;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
}

.choice-grid {
  display: grid;
  gap: 9px;
}

.challenge-choice {
  min-height: 46px;
  border: 1px solid rgba(199, 240, 186, 0.24);
  border-radius: 7px;
  background: rgba(10, 12, 10, 0.7);
  color: var(--ink);
  font: inherit;
  text-align: left;
  padding: 10px 13px;
  cursor: pointer;
}

.challenge-choice:hover {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.16);
}

.challenge-input-row,
.tap-counter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.challenge-input-row input {
  flex: 1;
  min-height: 46px;
  border: 1px solid rgba(199, 240, 186, 0.24);
  border-radius: 7px;
  padding: 0 12px;
  background: rgba(10, 12, 10, 0.7);
  color: var(--ink);
  font: inherit;
}

.tap-counter strong {
  font-family: var(--font-headline);
  font-size: 2.2rem;
  color: var(--primary-hot);
}

.challenge-feedback {
  min-height: 1.4em;
  margin: 13px 0 0;
  color: var(--muted);
}

.challenge-feedback.success {
  color: var(--primary-hot);
}

.challenge-feedback.retry {
  color: #ffc994;
}

.learning-hint,
.lesson-result {
  padding: 12px 14px;
  border-radius: 8px;
  font-family: var(--font-label);
}

.learning-hint {
  color: #f2d196;
  background: rgba(139, 90, 43, 0.22);
}

.lesson-result {
  color: #dfe7d9;
  background: rgba(85, 170, 51, 0.12);
}

.lesson-result strong {
  color: var(--primary-hot);
}

.lesson-result p {
  margin: 7px 0 0;
}

.learning-actions .primary-action:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.learning-section-list {
  display: grid;
  gap: 10px;
}

.learning-section-list article,
.learning-practice,
.learning-checklist {
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.learning-section-list h3,
.learning-practice h3,
.learning-checklist h3 {
  margin: 0 0 8px;
}

.learning-practice ul,
.learning-checklist ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #dfe7d9;
  line-height: 1.45;
}

.learning-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.preview-save-action {
  margin-right: auto;
}

.page-sheet h2 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: clamp(2rem, 4vw, 4.2rem);
  color: var(--ink);
}

.sheet-placeholder {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.parent-planner {
  min-height: 0;
  overflow: visible;
  padding-bottom: 180px;
}

.account-wallet-trigger { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; min-width: 88px; min-height: 44px; padding: 5px 12px; border: 1px solid #3e542b; border-radius: 8px; color: #e9f6dd; background: #20251c; cursor: pointer; text-align: left; }
.account-wallet-trigger[hidden] { display: none; }
.account-wallet-trigger span { font-size: 10px; line-height: 1.2; color: #b6c8a7; white-space: nowrap; }
.account-wallet-trigger strong { font-family: ui-monospace, Consolas, monospace; font-size: 17px; line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.account-wallet-trigger:hover { background: #2c3823; border-color: #7bdf44; }
.account-wallet-trigger:focus-visible { outline: 2px solid #7bdf44; outline-offset: 3px; }
.account-wallet-dialog { position: fixed; box-sizing: border-box; width: min(680px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); margin: auto; overflow-y: auto; padding: 30px; border: 3px solid #354b32; border-radius: 18px; color: #29392b; background: #faf8ed; box-shadow: 0 18px 70px #10241355; }
.account-wallet-dialog::backdrop { background: #17231dcc; }
.account-wallet-dialog h2 { margin: 6px 38px 10px 0; font-size: 28px; }
.account-wallet-dialog h3 { margin: 0 0 8px; font-size: 18px; }
.wallet-close { position: absolute; right: 18px; top: 15px; width: 38px; height: 38px; border: 1px solid #cbd2c1; border-radius: 10px; background: #fffdf5; color: #354b32; font-size: 26px; cursor: pointer; }
.wallet-description, .wallet-recharge p { margin: 0 0 16px; color: #626b5c; line-height: 1.6; }
.wallet-owner { font-size: 13px; overflow-wrap: anywhere; }
.wallet-summary { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; margin: 18px 0 24px; }
.wallet-summary > div { display: flex; flex-direction: column; gap: 10px; padding: 18px 14px; border: 1px solid #d8ddce; border-radius: 12px; background: #fffdf7; }
.wallet-summary > .wallet-balance { background: #e8f0db; border-color: #a9bc91; }
.wallet-summary span { font-size: 13px; }
.wallet-summary strong { font-size: 32px; }
.wallet-summary small, .wallet-recharge small { color: #626b5c; line-height: 1.6; }
.wallet-recharge { padding: 20px; border: 1px solid #d8ddce; border-radius: 12px; background: #fffdf7; }
.wallet-recharge .primary-action:disabled { opacity: .65; cursor: not-allowed; }
.wallet-recharge small { display: block; margin-top: 12px; }
.wallet-records { margin-top: 24px; }
.wallet-record-controls { display: flex; gap: 8px; border-bottom: 1px solid #d8ddce; padding-bottom: 10px; }
.wallet-record-controls button { padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; color: #626b5c; background: transparent; cursor: pointer; font: inherit; }
.wallet-record-controls button[aria-pressed="true"] { color: #294829; border-color: #a9bc91; background: #e8f0db; font-weight: 700; }
.wallet-empty { padding: 26px 12px; color: #626b5c; text-align: center; line-height: 1.7; font-size: 14px; }
.wallet-footnote { border-top: 1px solid #d8ddce; padding-top: 16px; margin-bottom: 0; font-size: 12px; color: #626b5c; line-height: 1.7; }
.account-wallet-dialog button:focus-visible { outline: 3px solid #638644; outline-offset: 3px; }
@media (max-width: 520px) {
  .account-wallet-dialog { padding: 22px 16px; }
  .wallet-summary { grid-template-columns: 1fr 1fr; }
  .wallet-summary .wallet-balance { grid-column: 1 / -1; }
}

.page-sheet.parent-mode {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}

.page-sheet.parent-mode > h2 {
  display: none;
}

.page-sheet.subject-mode {
  display: block;
  overflow: hidden;
  padding: 20px 5vw 18px;
}

.page-sheet.subject-mode > .dialog-kicker,
.page-sheet.subject-mode > h2 {
  display: none;
}

.page-sheet.knowledge-mode {
  display: block;
  overflow: hidden;
  padding: 20px 5vw 18px;
}

.page-sheet.knowledge-mode > .dialog-kicker,
.page-sheet.knowledge-mode > h2 {
  display: none;
}

.subject-center {
  height: 100%;
  min-height: 0;
}

.knowledge-base {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
}

.knowledge-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.knowledge-head h3 {
  margin: 2px 0 0;
  font-family: var(--font-headline);
  font-size: clamp(2rem, 3.4vw, 3.4rem);
  color: var(--ink);
}

.knowledge-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.knowledge-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  cursor: pointer;
}

.knowledge-category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  border: 1px solid rgba(126, 226, 85, 0.3);
  background: rgba(8, 12, 9, 0.62);
}

.knowledge-category-tabs button {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 10px 16px;
  border: 1px solid rgba(126, 226, 85, 0.25);
  color: var(--muted);
  background: rgba(31, 34, 31, 0.78);
  font: 800 0.95rem var(--font-label);
  cursor: pointer;
}

.knowledge-category-tabs button.active {
  color: #10180d;
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 18px rgba(126, 226, 85, 0.24);
}

.knowledge-file-strip {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 10px;
  border: 1px solid rgba(85, 170, 51, 0.24);
  background: rgba(13, 18, 14, 0.58);
}

.knowledge-file-strip strong {
  flex: 0 0 auto;
  color: var(--primary);
  font-family: var(--font-label);
}

.knowledge-file-strip span {
  flex: 0 0 auto;
  display: inline-grid;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid rgba(126, 226, 85, 0.25);
  background: rgba(31, 34, 31, 0.82);
  color: var(--ink);
}

.knowledge-file-strip small,
.knowledge-file-strip em {
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
}

.knowledge-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.knowledge-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(85, 170, 51, 0.32);
  background: rgba(8, 12, 9, 0.6);
}

.knowledge-panel > header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(126, 226, 85, 0.18);
  background: rgba(15, 19, 16, 0.86);
}

.knowledge-panel h4,
.knowledge-panel h5 {
  margin: 0;
  color: var(--primary);
  font-family: var(--font-label);
}

.knowledge-scroll {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  scroll-behavior: smooth;
}

.knowledge-detail {
  padding: 14px;
  border: 1px solid rgba(126, 226, 85, 0.2);
  border-radius: 8px;
  background: rgba(31, 34, 31, 0.78);
}

.knowledge-detail.active {
  border-color: var(--primary);
  box-shadow: 0 0 18px rgba(126, 226, 85, 0.16);
}

.knowledge-detail h5 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.knowledge-detail p,
.knowledge-detail li,
.mind-node-card p {
  color: var(--muted);
  line-height: 1.65;
}

.knowledge-detail ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.mind-map {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 18px;
  padding: 18px;
}

.mind-root,
.mind-branches button {
  border: 1px solid rgba(126, 226, 85, 0.28);
  color: var(--ink);
  background: rgba(31, 34, 31, 0.82);
  cursor: pointer;
}

.mind-root {
  min-width: 180px;
  padding: 14px 20px;
  color: #10180d;
  background: var(--primary);
  font: 900 1.08rem var(--font-label);
  box-shadow: 0 0 24px rgba(126, 226, 85, 0.22);
}

.mind-branches {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.mind-branches button {
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 12px;
  text-align: left;
}

.mind-branches button.active {
  border-color: var(--primary);
  background: rgba(43, 87, 31, 0.72);
  box-shadow: 0 0 20px rgba(126, 226, 85, 0.16);
}

.mind-branches span {
  color: var(--primary);
  font: 900 1rem var(--font-label);
}

.mind-branches small {
  color: var(--muted);
  line-height: 1.45;
}

.mind-node-card {
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px solid rgba(126, 226, 85, 0.22);
  border-radius: 8px;
  background: rgba(31, 34, 31, 0.78);
}

.mind-node-card small {
  color: var(--primary);
  font-family: var(--font-label);
}

.page-sheet.knowledge-mode {
  padding: 18px 4.8vw 16px;
}

.page-sheet.knowledge-mode .sheet-placeholder {
  height: 100%;
  min-height: 0;
  max-width: none;
  width: 100%;
}

.knowledge-base {
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  gap: 12px;
}

.knowledge-head {
  min-height: 50px;
  padding-right: 58px;
}

.knowledge-head h3 {
  margin: 0;
  font-size: clamp(1.65rem, 2.5vw, 2.75rem);
  line-height: 1;
  text-shadow: 0 0 16px rgba(126, 226, 85, 0.26);
}

.knowledge-grid {
  grid-template-columns: minmax(280px, var(--knowledge-left, 52%)) 12px minmax(280px, 1fr);
  gap: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid rgba(85, 170, 51, 0.28);
  background: rgba(4, 8, 5, 0.44);
}

.knowledge-panel {
  border: 0;
  border-radius: 0;
  background: rgba(8, 12, 9, 0.44);
}

.knowledge-summary {
  border-right: 1px solid rgba(85, 170, 51, 0.24);
}

.knowledge-map {
  border-left: 1px solid rgba(85, 170, 51, 0.24);
}

.knowledge-panel > header {
  min-height: 84px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px 16px 12px;
}

.knowledge-panel > header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.knowledge-summary {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.knowledge-category-tabs {
  padding: 0;
  border: 0;
  background: transparent;
}

.knowledge-category-tabs button {
  min-width: 118px;
  padding: 9px 14px;
}

.knowledge-file-strip {
  min-height: 42px;
  margin: 0 16px 10px;
  padding: 8px;
}

.knowledge-scroll {
  padding: 0 16px 16px;
  gap: 12px;
}

.knowledge-detail {
  border-radius: 6px;
  padding: 16px;
}

.knowledge-detail h5 {
  font-size: 1.16rem;
}

.knowledge-resizer {
  position: relative;
  z-index: 3;
  width: 12px;
  height: 100%;
  border: 0;
  border-inline: 1px solid rgba(126, 226, 85, 0.24);
  background:
    linear-gradient(90deg, transparent, rgba(126, 226, 85, 0.28), transparent),
    rgba(9, 14, 10, 0.72);
  cursor: col-resize;
}

.knowledge-resizer::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 74px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(126, 226, 85, 0.72);
  box-shadow: 0 0 18px rgba(126, 226, 85, 0.42);
}

body.resizing-knowledge {
  cursor: col-resize;
  user-select: none;
}

.mind-map {
  place-items: center;
  align-content: center;
  gap: 24px;
  padding: 22px;
}

.mind-root {
  min-width: 220px;
  min-height: 66px;
}

.mind-branches {
  max-width: 760px;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  align-items: stretch;
}

.mind-branches button {
  min-height: 126px;
  border-radius: 6px;
}

.mind-node-card {
  margin: 0 18px 18px;
}

.page-sheet.knowledge-mode {
  left: 0;
  right: 0;
  top: 72px;
  bottom: 110px;
  padding: 8px 22px 14px;
}

.page-sheet.knowledge-mode > .sheet-close {
  top: 18px;
  right: 22px;
  z-index: 20;
}

.knowledge-base {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
}

.knowledge-head {
  position: relative;
  min-height: 48px;
  padding-right: 420px;
}

.knowledge-head h3 {
  margin: 0;
  font-size: clamp(1.65rem, 2.5vw, 2.75rem);
  line-height: 1;
}

.knowledge-actions {
  position: absolute;
  top: 0;
  right: 74px;
  z-index: 18;
}

.knowledge-category-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 5px 12px;
  border: 1px solid rgba(85, 170, 51, 0.36);
  background: rgba(5, 10, 6, 0.62);
}

.knowledge-category-row > strong {
  flex: 0 0 auto;
  color: var(--primary);
  font: 900 0.95rem var(--font-label);
}

.knowledge-category-row .knowledge-category-tabs {
  min-width: 0;
  flex: 1;
  overflow-x: auto;
}

.knowledge-grid {
  grid-template-columns: minmax(0, var(--knowledge-left, 50%)) 12px minmax(0, 1fr);
  width: 100%;
}

.knowledge-category-menu {
  position: fixed;
  z-index: 60;
  min-width: 128px;
  padding: 6px;
  border: 1px solid rgba(126, 226, 85, 0.4);
  border-radius: 6px;
  background: rgba(13, 18, 14, 0.96);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.38), 0 0 18px rgba(126, 226, 85, 0.12);
}

.knowledge-category-menu[hidden] {
  display: none;
}

.knowledge-category-menu button {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  background: transparent;
  font: 800 0.86rem var(--font-label);
  text-align: left;
  cursor: pointer;
}

.knowledge-category-menu button:hover {
  color: #10180d;
  background: var(--primary);
}

.knowledge-menu-rename {
  display: grid;
  gap: 7px;
  min-width: 190px;
}

.knowledge-menu-rename[hidden],
.knowledge-menu-actions[hidden] {
  display: none;
}

.knowledge-menu-rename input {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(126, 226, 85, 0.42);
  border-radius: 4px;
  color: var(--ink);
  background: rgba(5, 9, 6, 0.96);
  font: 800 0.9rem var(--font-body);
  outline: none;
}

.knowledge-menu-rename input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(126, 226, 85, 0.18);
}

.knowledge-menu-rename > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.knowledge-panel > header {
  min-height: 72px;
}

.knowledge-scroll,
.mind-map {
  scrollbar-gutter: stable;
}

.knowledge-map {
  min-width: 0;
}

.subject-center-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(420px, 0.9fr) 1fr;
  align-items: center;
  gap: 22px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  background: linear-gradient(#101511 78%, transparent);
}

.subject-center-head h3 {
  margin: 2px 0 0;
  font-family: var(--font-headline);
  font-size: clamp(2rem, 3.4vw, 3.5rem);
  color: var(--ink);
}

.subject-center-tabs {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 58px;
  border: 1px solid rgba(126, 226, 85, 0.34);
  background: rgba(10, 13, 10, 0.72);
}

.subject-center-tabs button {
  border: 0;
  border-right: 1px solid rgba(126, 226, 85, 0.22);
  color: var(--muted);
  background: transparent;
  font: 700 1rem var(--font-label);
  cursor: pointer;
}

.subject-center-tabs button:last-child {
  border-right: 0;
}

.subject-center-tabs button.active {
  color: #10180d;
  background: var(--primary);
  box-shadow: 0 0 22px rgba(126, 226, 85, 0.28);
}

.subject-center-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  height: calc(100% - 92px);
  min-height: 0;
}

.grade-rail,
.subject-center-main {
  min-height: 0;
  border: 1px solid rgba(85, 170, 51, 0.3);
  background: rgba(8, 12, 9, 0.58);
}

.grade-rail {
  overflow-y: auto;
  padding: 12px;
}

.grade-rail h4 {
  margin: 0 0 10px;
  color: var(--primary);
  font-family: var(--font-label);
}

.grade-rail-group {
  margin-bottom: 6px;
}

.grade-rail-group > button,
.grade-rail-group > div button {
  width: 100%;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font: 700 0.9rem var(--font-body);
  cursor: pointer;
}

.grade-rail-group > button {
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

.grade-rail-group > button span {
  transition: transform 0.2s ease;
}

.grade-rail-group.open > button span {
  transform: rotate(90deg);
}

.grade-rail-group > div {
  display: none;
  padding: 0 6px 7px 12px;
}

.grade-rail-group.open > div {
  display: grid;
  gap: 4px;
}

.grade-rail-group > div button {
  padding: 8px 10px;
  border-left: 2px solid rgba(126, 226, 85, 0.18);
}

.grade-rail-group > div button.active {
  color: #10180d;
  border-color: var(--primary);
  background: var(--primary);
}

.subject-center-main {
  position: relative;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
}

.subject-content-toolbar {
  position: sticky;
  top: -14px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -14px -14px 14px;
  padding: 14px;
  border-bottom: 1px solid rgba(85, 170, 51, 0.24);
  background: rgba(15, 19, 16, 0.96);
}

.subject-content-toolbar div {
  display: grid;
  gap: 4px;
}

.subject-content-toolbar b {
  color: var(--ink);
}

.subject-content-toolbar span {
  color: var(--muted);
  font-size: 0.84rem;
}

.textbook-list,
.exam-list {
  display: grid;
  gap: 12px;
}

.textbook-row,
.exam-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 126px;
  padding: 14px 18px;
  border: 1px solid rgba(126, 226, 85, 0.28);
  background: rgba(31, 34, 31, 0.82);
}

.textbook-row.placeholder {
  opacity: 0.68;
  border-style: dashed;
}

.textbook-cover {
  display: grid;
  place-content: center;
  overflow: hidden;
  width: 72px;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #10180d;
  background: var(--primary);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.28);
  text-align: center;
}

.textbook-cover.pdf-cover {
  position: relative;
  background: #202420;
}

.textbook-cover.pdf-cover iframe {
  position: absolute;
  inset: 0;
  width: 310%;
  height: 310%;
  border: 0;
  transform: scale(0.323);
  transform-origin: 0 0;
  pointer-events: none;
}

.textbook-cover.pdf-cover span {
  display: none;
}

.textbook-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  grid-area: 1 / 1;
}

.textbook-cover span {
  font: 900 1rem var(--font-headline);
}

.textbook-cover small {
  color: #173211;
  font-size: 0.66rem;
}

.textbook-copy h4,
.exam-row h4 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-size: 1.12rem;
}

.textbook-copy h4 button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.textbook-copy h4 button:hover {
  color: var(--primary);
  text-shadow: 0 0 12px rgba(126, 226, 85, 0.45);
}

.textbook-copy small,
.exam-row small {
  color: var(--primary);
}

.textbook-copy p,
.exam-row p {
  margin: 0;
  color: var(--muted);
}

.textbook-actions {
  display: flex;
  gap: 8px;
}

.textbook-admin-form {
  position: absolute;
  inset: 18px;
  z-index: 8;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--primary);
  background: rgba(20, 23, 20, 0.98);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.52);
}

.textbook-admin-form[hidden] {
  display: none;
}

.textbook-admin-form header,
.textbook-admin-form footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.textbook-admin-form header button {
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
}

.textbook-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0;
}

.textbook-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.textbook-form-grid input,
.textbook-form-grid select {
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  border: 1px solid rgba(126, 226, 85, 0.3);
  color: var(--ink);
  background: #0c100d;
}

.textbook-reader {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.textbook-reader header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.textbook-reader iframe {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(126, 226, 85, 0.34);
  background: #202420;
}

.textbook-reader-dialog {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: stretch;
  justify-items: stretch;
  padding: 0;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(8px);
}

.textbook-reader-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid rgba(126, 226, 85, 0.55);
  background: rgba(14, 17, 14, 0.96);
  box-shadow: 0 0 32px rgba(85, 170, 51, 0.18);
}

.textbook-reader-card header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(126, 226, 85, 0.26);
}

.textbook-reader-card header small {
  display: block;
  color: var(--primary);
  margin-bottom: 3px;
}

.textbook-reader-card header div:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.textbook-reader-card header button,
.textbook-reader-card header a.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.textbook-reader-card header .reader-copy-link {
  width: auto;
  min-width: 86px;
  padding: 0 14px;
  white-space: nowrap;
}

.textbook-reader-card header a.secondary-action {
  width: auto;
  min-width: 88px;
  padding: 0 14px;
  white-space: nowrap;
}

.textbook-reader-card iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #202420;
}

.textbook-reader-card > p {
  margin: 0;
  padding: 8px 16px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  border-top: 1px solid rgba(126, 226, 85, 0.18);
}

.exam-row {
  grid-template-columns: 120px minmax(0, 1fr) auto auto;
}

.exam-month {
  color: var(--primary);
  font: 900 1.28rem var(--font-label);
}

.exam-score-mini {
  display: flex;
  gap: 8px;
}

.exam-score-mini span {
  display: grid;
  min-width: 58px;
  padding: 7px;
  color: var(--muted);
  background: rgba(8, 10, 8, 0.55);
  text-align: center;
  font-size: 0.7rem;
}

.exam-score-mini b {
  color: var(--ink);
  font-size: 1rem;
}

.exam-row.failed {
  border-color: rgba(240, 120, 120, 0.55);
}

.subject-loading {
  display: grid;
  place-items: center;
  min-height: 360px;
  color: var(--primary);
  font: 700 1rem var(--font-label);
}

.exam-workspace {
  min-height: 100%;
}

.exam-workspace-head {
  position: sticky;
  top: -14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -14px -14px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(126, 226, 85, 0.3);
  background: rgba(13, 17, 14, 0.98);
}

.exam-workspace-head h4 {
  margin: 3px 0;
  color: var(--ink);
  font-size: 1.25rem;
}

.exam-workspace-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.exam-clock {
  min-width: 124px;
  padding: 10px 14px;
  border: 1px solid rgba(241, 179, 111, 0.5);
  color: #ffd59b;
  background: rgba(61, 39, 15, 0.52);
  text-align: center;
  font: 900 1.45rem var(--font-label);
}

.exam-workspace-body {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: start;
}

.exam-section-nav,
.exam-progress-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(126, 226, 85, 0.25);
  background: rgba(27, 31, 27, 0.84);
}

.exam-section-nav span {
  padding: 8px;
  border-left: 2px solid var(--primary);
  color: var(--muted);
}

.exam-paper {
  display: grid;
  gap: 12px;
  padding-bottom: 120px;
}

.exam-question {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(126, 226, 85, 0.22);
  background: rgba(32, 35, 32, 0.82);
}

.exam-question legend {
  display: flex;
  width: 100%;
  align-items: start;
  gap: 8px;
  color: var(--ink);
  line-height: 1.45;
}

.exam-question legend span {
  color: var(--primary);
}

.exam-question legend b {
  margin-left: auto;
  color: var(--tertiary);
  white-space: nowrap;
}

.exam-question input[type="text"],
.exam-question > input,
.exam-question textarea {
  box-sizing: border-box;
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: 1px solid rgba(126, 226, 85, 0.28);
  color: var(--ink);
  background: #0d110e;
  resize: vertical;
}

.exam-options {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.exam-options label {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  cursor: pointer;
}

.exam-options label:has(input:checked) {
  border-color: var(--primary);
  color: var(--ink);
  background: rgba(85, 170, 51, 0.15);
}

.exam-number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.exam-number-grid button {
  aspect-ratio: 1;
  border: 1px solid rgba(126, 226, 85, 0.24);
  color: var(--muted);
  background: #101410;
  cursor: pointer;
}

.exam-number-grid button.answered {
  color: #10180d;
  background: var(--primary);
}

.exam-progress-panel p {
  color: var(--muted);
  font-size: 0.76rem;
}

.exam-result header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.exam-result h3 {
  margin: 4px 0;
  color: var(--primary);
  font: 900 4rem var(--font-headline);
}

.exam-result h3 small {
  color: var(--muted);
  font-size: 1.2rem;
}

.exam-result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.exam-result-stats span {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(126, 226, 85, 0.22);
  color: var(--muted);
  background: rgba(31, 34, 31, 0.78);
}

.exam-result-stats b {
  color: var(--ink);
  font-size: 1.3rem;
}

.exam-review {
  display: grid;
  gap: 10px;
  padding-bottom: 100px;
}

.exam-review article {
  padding: 13px;
  border-left: 3px solid var(--tertiary);
  background: rgba(40, 35, 28, 0.76);
}

.exam-review p {
  color: var(--muted);
}

@media (max-width: 980px) {
  .page-sheet.subject-mode,
  .page-sheet.knowledge-mode {
    padding-inline: 18px;
  }

  .subject-center-head {
    grid-template-columns: 1fr;
  }

  .subject-center-tabs {
    grid-column: 1;
  }

  .subject-center-layout {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .knowledge-head {
    align-items: start;
    flex-direction: column;
  }

  .textbook-row,
  .exam-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .textbook-actions,
  .exam-score-mini,
  .exam-row > .primary-action {
    grid-column: 2;
    justify-self: start;
  }

  .exam-workspace-body {
    grid-template-columns: 1fr;
  }

  .exam-section-nav,
  .exam-progress-panel {
    position: static;
  }

  .exam-section-nav {
    display: flex;
    overflow-x: auto;
  }
}

@media (max-width: 680px) {
  .page-sheet.knowledge-mode {
    overflow-y: auto;
  }

  .knowledge-base {
    height: auto;
  }

  .knowledge-actions {
    flex-wrap: wrap;
  }

  .mind-branches {
    grid-template-columns: 1fr;
  }

  .subject-center-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .grade-rail {
    max-height: 180px;
  }

  .subject-center-main {
    min-height: 520px;
  }

  .textbook-form-grid,
  .exam-result-stats {
    grid-template-columns: 1fr;
  }
}

.parent-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.parent-toolbar h3,
.task-library h3 {
  margin: 0;
  font-family: var(--font-headline);
  color: var(--ink);
}

.parent-toolbar h3 {
  font-size: clamp(1.4rem, 2.7vw, 2.6rem);
}

.selected-week {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.86rem;
}

.year-calendar {
  margin-bottom: 14px;
  border: 1px solid rgba(85, 170, 51, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(10, 12, 10, 0.42);
}

.year-calendar.expanded {
  padding-bottom: 12px;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.year-calendar.expanded .calendar-head {
  margin-bottom: 10px;
}

.calendar-head h3 {
  margin: 0;
  color: var(--primary-hot);
  font-family: var(--font-label);
  font-size: 0.95rem;
}

.calendar-nav,
.calendar-toggle {
  width: 32px;
  height: 30px;
  margin-left: 6px;
  border: 1px solid rgba(85, 170, 51, 0.36);
  border-radius: 6px;
  background: rgba(26, 26, 26, 0.72);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-label);
}

.calendar-nav {
  font-size: 1.2rem;
}

.calendar-toggle {
  width: auto;
  min-width: 62px;
  padding: 0 10px;
  color: var(--primary-hot);
  font-weight: 800;
}

.months-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  max-height: min(42vh, 520px);
  overflow-y: auto;
  padding-right: 8px;
}

.month-card {
  border: 1px solid rgba(199, 240, 186, 0.12);
  border-radius: 7px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.month-card h4 {
  margin: 0 0 6px;
  color: #e9efe3;
  font-family: var(--font-label);
  font-size: 0.82rem;
}

.calendar-weekheads,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.calendar-weekheads {
  margin-bottom: 4px;
  color: rgba(223, 231, 217, 0.58);
  font-family: var(--font-label);
  font-size: 0.62rem;
  text-align: center;
}

.calendar-empty,
.calendar-day {
  min-width: 0;
  aspect-ratio: 1;
}

.calendar-day {
  position: relative;
  border: 1px solid transparent;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(238, 238, 234, 0.72);
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.62rem;
}

.calendar-day.has-tasks {
  color: var(--ink);
  background: rgba(85, 170, 51, 0.14);
}

.calendar-day.selected-week-day {
  border-color: var(--primary-hot);
  box-shadow: 0 0 10px rgba(126, 226, 85, 0.34);
}

.calendar-day i {
  position: absolute;
  right: 1px;
  bottom: 1px;
  display: grid;
  place-items: center;
  min-width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary-hot);
  color: #10200f;
  font-style: normal;
  font-size: 0.5rem;
}

.parent-actions,
.edit-task-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-action,
.icon-add {
  border: 1px solid rgba(85, 170, 51, 0.42);
  border-radius: 8px;
  background: rgba(26, 26, 26, 0.74);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-label);
  font-weight: 800;
}

.secondary-action {
  min-height: 42px;
  padding: 0 14px;
}

.secondary-action:hover,
.icon-add:hover {
  border-color: var(--primary-hot);
  background: rgba(85, 170, 51, 0.22);
}

.secondary-action.danger {
  border-color: rgba(255, 160, 140, 0.42);
  color: #ffd2c8;
}

.progress-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.progress-chip {
  border: 1px solid rgba(199, 240, 186, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--font-label);
}

.progress-chip small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.progress-chip strong {
  color: var(--primary-hot);
}

.planner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  min-height: 0;
}

.week-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(136px, 1fr));
  gap: 10px;
  min-height: 360px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.day-column {
  min-width: 136px;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(85, 170, 51, 0.26);
  border-radius: 8px;
  background: rgba(10, 12, 10, 0.46);
}

.day-column.drag-over {
  border-color: var(--primary-hot);
  box-shadow: 0 0 22px rgba(126, 226, 85, 0.28);
}

.day-head {
  padding: 12px;
  border-bottom: 1px solid rgba(199, 240, 186, 0.12);
  font-family: var(--font-label);
  font-weight: 900;
  color: var(--primary-hot);
}

.day-dropzone {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 280px;
  padding: 10px;
}

.empty-day {
  display: grid;
  place-items: center;
  min-height: 92px;
  border: 1px dashed rgba(199, 240, 186, 0.18);
  border-radius: 8px;
  color: rgba(223, 231, 217, 0.5);
  font-family: var(--font-label);
  font-size: 0.78rem;
  text-align: center;
}

.task-library {
  min-height: 360px;
  max-height: min(54vh, 560px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(85, 170, 51, 0.3);
  border-radius: 8px;
  padding: 14px;
  background: rgba(26, 26, 26, 0.68);
}

.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.icon-add {
  width: 38px;
  height: 38px;
  font-size: 1.35rem;
}

.library-list {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.library-task,
.planned-task {
  border: 1px solid rgba(199, 240, 186, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  cursor: grab;
  color: var(--ink);
  text-align: left;
}

.library-task {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  font-family: var(--font-label);
}

.library-actions {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.library-delete,
.library-rename {
  position: relative;
  z-index: 3;
  touch-action: manipulation;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(26, 26, 26, 0.72);
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 1.1rem;
}

.library-delete {
  border: 1px solid rgba(255, 160, 140, 0.42);
  color: #ffd2c8;
}

.library-rename {
  border: 1px solid rgba(126, 230, 90, 0.45);
  color: var(--primary);
}

.custom-task-rename-dialog {
  width: min(440px, calc(100vw - 32px));
}

.custom-task-rename-form {
  display: grid;
  gap: 18px;
}

.custom-task-rename-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-label);
}

.custom-task-rename-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(126, 230, 90, 0.42);
  border-radius: 6px;
  padding: 0 11px;
  background: #0a100bcc;
  color: var(--ink);
  font: inherit;
}

.custom-task-rename-form input:focus {
  outline: 2px solid rgba(126, 230, 90, 0.22);
  border-color: var(--primary-hot);
}

.library-task svg,
.planned-task svg {
  width: 1.35em;
  height: 1.35em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.library-task span:first-child,
.planned-task .planned-icon {
  display: grid;
  place-items: center;
  color: var(--primary-hot);
}

.library-task em,
.planned-task em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.75rem;
}

.planned-task {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  padding: 10px;
  font-family: var(--font-label);
}

.planned-task.preview {
  border-color: rgba(126, 226, 85, 0.58);
  background: rgba(85, 170, 51, 0.16);
}

.planned-task strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.planned-task p {
  margin: 0;
  color: #dde4d5;
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.35;
}

.planned-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--primary-hot);
  font-size: 0.72rem;
}

.task-curriculum-meta,
.mission-curriculum-meta {
  display: block;
  margin: 3px 0 6px;
  color: #8cecff;
  font-family: var(--font-label);
  font-size: 0.68rem;
  line-height: 1.3;
}

.planner-status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--primary-hot);
  font-family: var(--font-label);
}

.edit-task-dialog {
  z-index: 95;
  width: min(780px, calc(100vw - 40px));
}

.edit-task-form {
  display: grid;
  gap: 13px;
}

.edit-type-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.edit-type-row:has(.subject-grade-field[hidden]) {
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.34fr);
}

.edit-type-row > label {
  min-width: 0;
}

.edit-task-form [hidden] {
  display: none !important;
}

.grade-warning {
  margin: -3px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(218, 158, 86, 0.48);
  border-radius: 6px;
  background: rgba(139, 90, 35, 0.15);
  color: #f2c18c;
  font-family: var(--font-label);
  font-size: 0.76rem;
  line-height: 1.45;
}

.edit-task-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.85rem;
}

.edit-task-form input,
.edit-task-form select,
.edit-task-form textarea {
  border: 1px solid rgba(199, 240, 186, 0.22);
  border-radius: 6px;
  padding: 11px;
  background: rgba(10, 12, 10, 0.68);
  color: var(--ink);
  font: inherit;
  outline: none;
  resize: vertical;
}

.edit-task-actions {
  justify-content: end;
}

.learning-preview {
  min-height: 54px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px;
  border: 1px dashed rgba(199, 240, 186, 0.22);
  border-radius: 8px;
  background: rgba(10, 12, 10, 0.46);
  color: var(--muted);
  font-family: var(--font-label);
}

.learning-preview.ready {
  border-style: solid;
  border-color: rgba(126, 226, 85, 0.52);
  background: rgba(85, 170, 51, 0.12);
  color: var(--ink);
  box-shadow: inset 0 0 18px rgba(126, 226, 85, 0.08);
}

.learning-preview strong {
  color: var(--primary-hot);
}

.learning-preview b {
  color: #8cecff;
  font-family: var(--font-label);
  font-size: 0.82rem;
  font-weight: 700;
}

.learning-preview.fallback {
  border-style: solid;
  border-color: rgba(218, 158, 86, 0.5);
  color: #f2c18c;
  background: rgba(139, 90, 35, 0.16);
}

.learning-preview.fallback strong {
  color: #f2c18c;
}

.generate-learning-action {
  margin-right: auto;
}

.learning-ready {
  color: var(--primary-hot) !important;
}

.primary-action.compact {
  width: auto;
  min-height: 42px;
  margin-top: 0;
  padding: 0 16px;
}

@media (max-width: 720px) {
  .knowledge-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .knowledge-scroll,
  .mind-map {
    max-height: 360px;
  }

  .knowledge-resizer {
    display: none;
  }

  .edit-type-row,
  .edit-type-row:has(.subject-grade-field[hidden]) {
    grid-template-columns: 1fr;
  }
}

.sheet-close {
  position: absolute;
  top: 22px;
  right: 5vw;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(199, 240, 186, 0.24);
  border-radius: 8px;
  background: rgba(26, 26, 26, 0.72);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 1.5rem;
}

.page-sheet.subject-mode > .sheet-close {
  top: 18px;
  right: 5vw;
  z-index: 12;
  width: auto;
  min-width: 86px;
  height: 44px;
  padding: 0 18px;
  border-color: rgba(126, 226, 85, 0.62);
  background: rgba(17, 28, 14, 0.86);
  color: var(--primary);
  box-shadow: 0 0 18px rgba(126, 226, 85, 0.16);
  font-size: 0.98rem;
}

.page-sheet.subject-mode > .sheet-close::before {
  content: "⌃";
  margin-right: 8px;
}

.page-sheet.subject-mode > .sheet-close:hover {
  border-color: rgba(126, 226, 85, 0.9);
  background: rgba(38, 78, 28, 0.84);
  color: #f4fff0;
}

.task-dialog {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 34;
  width: min(520px, calc(100vw - 40px));
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 28px;
  border-radius: 18px;
  color: var(--ink);
  transform: translate(-50%, -50%);
}

.auth-dialog {
  z-index: 90;
}

.register-dialog {
  width: min(920px, calc(100vw - 40px));
}

.task-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.close-dialog {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.dialog-kicker {
  margin: 0 0 8px;
  color: var(--primary-hot);
}

.task-dialog h2 {
  margin: 0 0 20px;
  font-family: var(--font-headline);
  font-size: 1.7rem;
}

.teacher-voice-dialog {
  width: min(660px, calc(100vw - 36px));
}

.teacher-voice-intro {
  margin: -8px 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.teacher-voice-status {
  padding: 10px 12px;
  border: 1px solid rgba(126, 226, 85, 0.35);
  border-radius: 10px;
  background: rgba(126, 226, 85, 0.08);
  color: var(--primary-hot);
  font-weight: 800;
}

.teacher-voice-log {
  display: grid;
  gap: 10px;
  min-height: 150px;
  max-height: 280px;
  margin-top: 14px;
  padding: 12px;
  overflow: auto;
  border: 1px solid rgba(126, 226, 85, 0.22);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.voice-bubble {
  width: fit-content;
  max-width: min(88%, 520px);
  padding: 10px 12px;
  border: 1px solid rgba(126, 226, 85, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  line-height: 1.55;
}

.voice-bubble.student {
  justify-self: end;
  border-color: rgba(59, 171, 218, 0.36);
  background: rgba(59, 171, 218, 0.12);
}

.voice-bubble.teacher {
  justify-self: start;
  border-color: rgba(126, 226, 85, 0.38);
  background: rgba(126, 226, 85, 0.1);
}

.teacher-voice-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.dialog-grid div,
.time-list li {
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.ai-plan-mode-dialog {
  max-height: 90vh;
  overflow-y: auto;
  width: min(620px, calc(100vw - 40px));
}

.weekly-count-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.weekly-count-grid label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weekly-count-grid input { width: 72px; padding: 8px; color: var(--primary); background: #101a11; border: 1px solid #426235; border-radius: 5px; }
.weekly-subject-rule { display: grid; gap: 7px; padding: 10px; border: 1px solid rgba(85,170,51,.24); border-radius: 7px; background: rgba(255,255,255,.025); }
.weekly-subject-rule textarea { width: 100%; min-height: 52px; resize: vertical; padding: 8px 9px; border: 1px solid #426235; border-radius: 5px; background: #101a11; color: var(--ink); font: inherit; line-height: 1.4; }
.weekly-subject-rule textarea:focus { outline: 1px solid var(--primary-hot); border-color: var(--primary-hot); }
.weekly-subject-rule textarea::placeholder { color: rgba(203,217,194,.55); }
.weekly-subject-rule label span { display: inline-flex; align-items: center; gap: 7px; }
.weekly-subject-rule label small { padding: 2px 5px; border: 1px solid rgba(126,230,90,.35); border-radius: 4px; color: var(--primary-hot); font-size: .65rem; }
.weekly-subject-rule.is-custom { border-color: rgba(126,230,90,.42); background: rgba(85,170,51,.055); }
.plan-mode-card[aria-pressed="true"] { border-color: var(--primary); background: rgba(121,232,82,.12); }

.ai-plan-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.plan-mode-card {
  display: grid;
  min-height: 150px;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border: 1px solid rgba(126, 226, 85, 0.42);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(22, 42, 21, 0.92), rgba(14, 18, 15, 0.94));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.plan-mode-card:hover,
.plan-mode-card:focus-visible {
  border-color: rgba(126, 226, 85, 0.95);
  box-shadow: 0 0 24px rgba(126, 226, 85, 0.18);
  outline: none;
}

.plan-mode-card strong {
  color: var(--primary-hot);
  font-family: var(--font-headline);
  font-size: 1.15rem;
}

.plan-mode-card span {
  color: var(--muted);
  line-height: 1.55;
}

.dialog-grid small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--font-label);
}

.primary-action {
  width: 100%;
  margin-top: 22px;
  border: 0;
  border-radius: 8px;
  padding: 15px;
  background: var(--primary-hot);
  color: #10200f;
  cursor: pointer;
  font-weight: 800;
}

.register-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(85, 170, 51, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.form-panel h3 {
  margin: 0 0 4px;
  color: var(--primary-hot);
  font-family: var(--font-label);
  font-size: 1rem;
}

.register-form label,
.parent-login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-label);
  font-size: 0.85rem;
}

.register-form input,
.register-form select,
.parent-login-form input {
  min-height: 40px;
  border: 1px solid rgba(199, 240, 186, 0.22);
  border-radius: 6px;
  padding: 0 11px;
  background: rgba(10, 12, 10, 0.68);
  color: var(--ink);
  font: inherit;
  outline: none;
}

.register-form input:focus,
.register-form select:focus,
.parent-login-form input:focus {
  border-color: var(--primary-hot);
  box-shadow: 0 0 0 2px rgba(126, 226, 85, 0.16);
}

.wechat-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.wechat-row input {
  min-height: 0;
  width: 18px;
  height: 18px;
}

.form-note,
.form-message,
.auth-copy {
  margin: 0;
  color: #dfe7d9;
  line-height: 1.45;
}

.form-note {
  font-size: 0.86rem;
}

.form-message {
  grid-column: 1 / -1;
  min-height: 1.3em;
  color: var(--primary-hot);
  font-family: var(--font-label);
  font-size: 0.9rem;
}

.register-form > .primary-action {
  grid-column: 1 / -1;
}

.parent-login-form {
  display: grid;
  gap: 14px;
}

.time-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.time-list li {
  display: flex;
  justify-content: space-between;
}

@keyframes leafSway {
  from { translate: -5px 0; filter: brightness(0.95); }
  to { translate: 7px 3px; filter: brightness(1.08); }
}

@keyframes vineSway {
  from { transform: rotate(-1.1deg) translateX(-2px); }
  to { transform: rotate(2.6deg) translateX(3px); }
}

@keyframes treeBreeze {
  from { transform: translate3d(-8px, -2px, 0) rotate(-0.3deg) scale(0.99); }
  to { transform: translate3d(10px, 4px, 0) rotate(0.35deg) scale(1.02); }
}

@keyframes taskFloat {
  from { transform: translateY(-5px); }
  to { transform: translateY(7px); }
}

@keyframes fireflyDrift {
  0% { transform: translate3d(0, 0, 0) scale(0.65); opacity: 0.2; }
  18% { transform: translate3d(17px, -22px, 0) scale(1); opacity: 0.82; }
  43% { transform: translate3d(-31px, 13px, 0) scale(0.78); opacity: 0.42; }
  68% { transform: translate3d(22px, 34px, 0) scale(1.12); opacity: 0.74; }
  100% { transform: translate3d(-12px, -18px, 0) scale(0.7); opacity: 0.28; }
}

@keyframes linePulse {
  from { opacity: 0.55; transform: scaleX(0.72); }
  50% { opacity: 1; transform: scaleX(1); }
  to { opacity: 0.55; transform: scaleX(0.72); }
}

@keyframes particleRun {
  from { transform: translateX(-18px); }
  to { transform: translateX(78px); }
}

@keyframes avatarTap {
  0%, 100% { translate: 0 0; }
  45% { translate: 0 -34px; }
  72% { translate: 0 -4px; }
}

@media (max-width: 900px) {
  .forest-stage {
    --dock-bottom-space: 12px;
    --dock-block-size: 90px;
    --avatar-foot-offset: 32px;
    --avatar-render-height: clamp(146px, 20vh, 170px);
  }

  body {
    overflow: auto;
  }

  .ancient-tree {
    inset: 78px 0 0;
  }

  .tree-bg {
    min-width: 1120px;
    object-position: 52% 50%;
  }

  .stats-stack {
    top: 100px;
    right: 16px;
  }

  .stat-card {
    width: 156px;
    min-height: 64px;
    padding: 10px;
    gap: 10px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 1.35rem;
  }

  .student-card {
    left: 10px;
    top: auto;
    width: 218px;
    min-width: 0;
    height: 330px;
    min-height: 0;
  }

  .level-card {
    top: auto;
  }

  .avatar-stage {
    width: 100%;
  }

  .moon-task {
    width: 48px;
    min-height: 48px;
  }

  .moon-marker {
    width: 48px;
    height: 48px;
    font-size: 1.65rem;
  }

  .task-card-content {
    width: 210px;
    min-height: 126px;
    padding: 14px;
    gap: 6px 8px;
  }

  .moon-task p {
    display: none;
  }

  .chinese { left: 38%; top: 30%; }
  .math { left: 56%; top: 39%; }
  .english { left: 72%; top: 48%; }
  .explore { left: 48%; top: 49%; }

  .dock {
    grid-template-columns: repeat(5, 1fr);
    padding: 10px;
    bottom: 12px;
  }

  .page-sheet {
    bottom: 90px;
    padding: 24px 18px;
  }

  .learning-sheet {
    bottom: 90px;
    padding: 22px 18px;
  }

  .report-sheet {
    bottom: 90px;
    padding: 20px 16px;
  }

  .report-head {
    align-items: start;
    flex-direction: column;
    padding-right: 50px;
  }

  .report-tabs {
    grid-template-columns: repeat(5, minmax(70px, 1fr));
    overflow-x: auto;
  }

  .report-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .report-history,
  .report-dashboard,
  .report-analysis {
    overflow: visible;
  }

  .report-history {
    max-height: 220px;
    overflow: auto;
  }

  .report-kpis,
  .report-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .heatmap-card {
    grid-column: 1 / -1;
  }

  .learning-head {
    align-items: start;
    flex-direction: column;
    padding-right: 52px;
  }

  .learning-sheet.chinese-mode .learning-head h2,
  .learning-sheet.math-mode .learning-head h2,
  .learning-sheet.english-mode .learning-head h2 {
    max-width: none;
    font-size: clamp(1.15rem, 7vw, 1.8rem);
  }

  .learning-sheet.chinese-mode .learning-head > div:first-child,
  .learning-sheet.math-mode .learning-head > div:first-child,
  .learning-sheet.english-mode .learning-head > div:first-child {
    flex: 0 1 auto;
  }

  .math-head-overview {
    width: 100%;
  }

  .learning-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .subject-lesson {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .learning-sheet.chinese-mode .subject-lesson,
  .learning-sheet.math-mode .subject-lesson,
  .learning-sheet.english-mode .subject-lesson {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .math-tools-panel,
  .math-problems-panel,
  .math-solutions-panel,
  .chinese-question-panel,
  .chinese-visual-panel,
  .chinese-reading-panel,
  .english-question-panel,
  .english-visual-panel,
  .english-reading-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .math-head-overview {
    grid-template-columns: 1fr;
  }

  .lesson-column {
    min-height: 240px;
    overflow: visible;
  }

  .learning-sheet.chinese-mode .lesson-column,
  .learning-sheet.math-mode .lesson-column,
  .learning-sheet.english-mode .lesson-column {
    height: auto;
    overflow: visible;
  }

  .scratch-canvas {
    height: 360px;
  }

  .learning-sheet.math-mode .scratch-canvas {
    height: 360px;
    min-height: 360px;
  }

  .geometry-question {
    grid-template-columns: 1fr;
  }

  .geometry-question .geometry-diagram,
  .geometry-question h4,
  .geometry-question input,
  .geometry-question .answer-state {
    grid-column: 1;
    grid-row: auto;
  }

  .geometry-diagram {
    max-width: 440px;
    justify-self: center;
  }

  .learning-visual {
    min-height: 260px;
  }

  .learning-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .learning-actions > * {
    flex: 1 1 180px;
  }

  .parent-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .progress-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .months-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planner-layout {
    grid-template-columns: 1fr;
  }

  .task-library {
    order: -1;
    min-height: auto;
    max-height: 280px;
  }

  .library-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-board {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .day-column {
    min-width: 0;
  }

  .dock-item {
    min-height: 58px;
    font-size: 0.82rem;
  }

  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .ai-plan-mode-grid {
    grid-template-columns: 1fr;
  }

  .register-form {
    grid-template-columns: 1fr;
  }

  body.logged-out .brand-en {
    top: 27vh;
    width: min(92vw, 760px);
    font-size: clamp(2.35rem, 10vw, 4.4rem);
  }

  body.logged-out .brand-cn {
    top: 58vh;
  }
}

@media (max-width: 900px) {
  body.logged-out .landing-showcase {
    padding: 96px 16px 118px;
  }

  .showcase-hero {
    margin-bottom: 56px;
  }

  .showcase-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .showcase-timeline {
    left: 24px;
    top: 320px;
  }

  .showcase-card,
  .showcase-card.reverse {
    grid-template-columns: 1fr;
    gap: 22px;
    margin-bottom: 56px;
  }

  .showcase-game {
    flex-direction: column;
    align-items: flex-start;
    min-height: 300px;
    margin-bottom: 64px;
    background:
      linear-gradient(180deg, rgba(5, 10, 7, 0.84), rgba(8, 18, 10, 0.72), rgba(5, 10, 7, 0.9)),
      url("./assets/showcase/showcase-tree.png") center center / cover no-repeat;
  }

  .showcase-card.reverse figure {
    order: 0;
  }

  .showcase-card h3,
  .showcase-footer h3 {
    font-size: clamp(1.45rem, 8vw, 2.2rem);
  }
}

.friend-drawer {
  position: fixed;
  top: 86px;
  bottom: 112px;
  left: 0;
  z-index: 82;
  width: min(190px, 76vw);
  transform: translateX(-100%);
  transition: transform 0.24s ease;
  pointer-events: none;
}

.friend-drawer[hidden],
body.logged-out .friend-drawer {
  display: none;
}

.friend-drawer.open {
  transform: translateX(0);
}

.friend-panel {
  height: 100%;
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(85, 170, 51, 0.48);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: rgba(12, 18, 13, 0.92);
  box-shadow: 12px 0 34px rgba(0, 0, 0, 0.38), inset 0 0 24px rgba(85, 170, 51, 0.08);
  backdrop-filter: blur(18px);
  scrollbar-color: #59aa33 rgba(255, 255, 255, 0.08);
}

.friend-rail {
  position: absolute;
  right: -18px;
  top: 42%;
  transform: translateY(-50%);
  width: 18px;
  min-height: 104px;
  padding: 8px 0;
  pointer-events: auto;
  border: 1px solid rgba(119, 238, 92, 0.36);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: linear-gradient(180deg, rgba(9, 17, 11, 0.36), rgba(15, 28, 17, 0.72));
  color: #78ec55;
  font-weight: 800;
  letter-spacing: 0;
  writing-mode: horizontal-tb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(119, 238, 92, 0.08);
  opacity: 0.7;
  overflow: hidden;
}

.friend-rail span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 13px;
  transform: scale(0.86);
}

.friend-rail-caret {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid #78ec55;
  filter: drop-shadow(0 0 5px rgba(119, 238, 92, 0.75));
}

.friend-drawer.open .friend-rail-caret {
  border-left: 0;
  border-right: 6px solid #78ec55;
}

.friend-rail:hover {
  opacity: 1;
  border-color: rgba(119, 238, 92, 0.62);
  box-shadow: 0 0 16px rgba(119, 238, 92, 0.28);
}

.friend-drawer.open .friend-rail {
  opacity: 0.96;
}

.friend-panel-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  color: #78ec55;
  flex: 0 0 auto;
}

.friend-panel-head strong {
  font-size: 18px;
}

.friend-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(119, 238, 92, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #f0f6e8;
  cursor: pointer;
}

.friend-self-card,
.friend-add-form,
.friend-section {
  border: 1px solid rgba(85, 170, 51, 0.33);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  padding: 7px;
  margin-bottom: 0;
}

.friend-self-card {
  flex: 0 0 auto;
  padding: 8px;
  border-color: rgba(119, 238, 92, 0.46);
  background:
    radial-gradient(circle at 20% 20%, rgba(119, 238, 92, 0.13), transparent 42%),
    linear-gradient(135deg, rgba(29, 58, 26, 0.42), rgba(9, 15, 10, 0.86));
  box-shadow: inset 0 0 18px rgba(119, 238, 92, 0.06);
}

.friend-self-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 8px;
  align-items: center;
  gap: 7px;
}

.friend-avatar {
  width: 38px;
  height: 38px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(119, 238, 92, 0.35);
  border-radius: 8px;
  flex: 0 0 auto;
}

.friend-avatar.large {
  width: 48px;
  height: 62px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 0 18px rgba(119, 238, 92, 0.16);
}

.friend-self-main > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.friend-self-main strong,
.friend-row-main strong {
  color: #f4f8ef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-self-main strong {
  color: #78ec55;
  font-size: 14px;
}

.friend-self-main span,
.friend-row-main span,
.friend-row-main small {
  color: rgba(240, 246, 232, 0.64);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-account-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.friend-account-line > span {
  min-width: 0;
}

.friend-copy-id {
  flex: 0 0 auto;
  border: 1px solid rgba(119, 238, 92, 0.32);
  border-radius: 6px;
  background: rgba(85, 170, 51, 0.16);
  color: #78ec55;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 5px;
  cursor: pointer;
}

.friend-copy-id:hover {
  background: #78ec55;
  color: #081009;
}

.friend-self-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
  color: rgba(240, 246, 232, 0.75);
  font-size: 11px;
}

.friend-exp-track {
  width: 100%;
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.friend-exp-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #78ec55, #d4ffb5);
  box-shadow: 0 0 10px rgba(119, 238, 92, 0.42);
}

.friend-exp-copy {
  display: block;
  margin-top: 4px;
  color: rgba(240, 246, 232, 0.68);
  font-size: 10px;
  text-align: center;
}

.friend-self-meta span {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid rgba(119, 238, 92, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-section-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.friend-section-main .friend-list {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-color: #59aa33 rgba(255, 255, 255, 0.08);
}

.friend-bottom-tools {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: stretch;
  margin-top: auto;
}

.friend-add-form label {
  display: block;
  color: #78ec55;
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 12px;
}

.friend-add-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.friend-add-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(119, 238, 92, 0.32);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
  color: #f0f6e8;
  padding: 6px 6px;
  font-size: 11px;
}

.friend-add-form button,
.friend-row-actions button,
.friend-remove {
  border: 1px solid rgba(119, 238, 92, 0.45);
  border-radius: 8px;
  background: rgba(85, 170, 51, 0.18);
  color: #f0f6e8;
  font-weight: 800;
  padding: 6px 7px;
  cursor: pointer;
}

.friend-add-form button {
  width: 100%;
}

.friend-add-form button:hover,
.friend-row-actions button:hover {
  background: #78ec55;
  color: #09100a;
}

.friend-message {
  min-height: 18px;
  margin: -5px 0 0;
  font-size: 12px;
  color: #78ec55;
  flex: 0 0 auto;
}

.friend-message.error {
  color: #ff9d9d;
}

.friend-section h4 {
  margin: 0 0 6px;
  color: #f4f8ef;
  font-size: 12px;
}

.friend-request-box {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.friend-request-box .friend-list {
  overflow: auto;
  max-height: 116px;
  padding-right: 2px;
}

.friend-list {
  display: grid;
  gap: 8px;
}

.friend-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(119, 238, 92, 0.22);
  border-radius: 9px;
  background: rgba(26, 33, 27, 0.72);
}

.friend-bottom-tools .friend-row {
  grid-template-columns: auto minmax(0, 1fr);
  padding: 7px;
}

.friend-bottom-tools .friend-avatar {
  width: 30px;
  height: 30px;
}

.friend-bottom-tools .friend-row .friend-status-dot {
  display: none;
}

.friend-row-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.friend-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #777;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.16);
}

.friend-status-dot.online {
  background: #74f15d;
  box-shadow: 0 0 10px rgba(116, 241, 93, 0.8);
}

.friend-status-dot.offline {
  background: #777;
}

.friend-row-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.friend-pending {
  font-size: 12px;
  color: #b9c8b3;
}

.friend-remove {
  font-size: 11px;
  padding: 4px 7px;
  border-color: rgba(255, 135, 120, 0.45);
  color: #ffc2b8;
  background: rgba(120, 40, 30, 0.15);
}

.friend-empty {
  margin: 0;
  color: rgba(240, 246, 232, 0.58);
  font-size: 12px;
}

@media (max-width: 900px) {
  .friend-drawer {
    top: 76px;
    bottom: 96px;
    width: min(210px, 82vw);
  }
}
.ai-profile-control {
  position: relative;
}

.ai-profile-control .model-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-status-toggle {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: inherit;
  flex: 0 0 24px;
}

.ai-ready-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  color: #6d756b;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.ai-ready-dot.is-ready { color: #74f15d; }
.ai-ready-dot.is-partial { color: #f4bd55; }
.ai-ready-dot.is-offline { color: #ef6d62; }
.ai-ready-dot.is-loading {
  color: #3ab3da;
  animation: aiStatusPulse 1s ease-in-out infinite;
}

@keyframes aiStatusPulse {
  50% { opacity: .35; transform: scale(.78); }
}

.ai-profile-panel {
  position: absolute;
  z-index: 10000;
  top: calc(100% + 10px);
  right: 0;
  width: min(760px, calc(100vw - 24px));
  max-height: min(82vh, 760px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(116, 241, 93, .45);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(20, 31, 22, .96), rgba(7, 13, 9, .98));
  backdrop-filter: blur(22px) saturate(1.2);
  image-rendering: pixelated;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .5), 0 0 18px rgba(116, 241, 93, .12);
}

.ai-profile-panel[hidden] { display: none; }
.ai-profile-panel.ai-model-readonly { width: min(480px, calc(100vw - 24px)); }
.ai-profile-panel-head,
.ai-capability-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-profile-panel-head { margin-bottom: 12px; }
.ai-profile-panel-head span { color: #3ab3da; font-size: 11px; }
.ai-capability-list { display: grid; gap: 7px; }
.ai-capability-list[hidden] { display: none; }
.ai-capability-row {
  padding: 8px 9px;
  border: 1px solid rgba(116, 241, 93, .16);
  background: #1c211c;
}

.ai-capability-row > span:first-child { font-size: 12px; }
.ai-capability-state {
  max-width: 190px;
  overflow: hidden;
  color: #aeb8aa;
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-capability-row.is-ready .ai-capability-state { color: #74f15d; }
.ai-test-button {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(116, 241, 93, .5);
  background: #1b2a19;
  color: #eff7e9;
  cursor: pointer;
}

.ai-profile-message {
  min-height: 16px;
  margin: 8px 0 0;
  color: #b8c8b2;
  font-size: 10px;
}

body.logged-out .ai-profile-control { display: none; }

.ai-config-form { display: grid; gap: 12px; margin-bottom: 14px; }
.ai-config-form[hidden] { display: none; }
.ai-config-form label { display: grid; gap: 5px; min-width: 0; color: #bcd0b6; font-size: 11px; }
.ai-config-form input, .ai-config-form select { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid rgba(116,241,93,.32); border-radius: 3px; background: rgba(0,0,0,.42); color: #eef8e9; padding: 9px; }
.ai-config-form input:focus, .ai-config-form select:focus { outline: 2px solid rgba(58,179,218,.45); border-color: #3ab3da; }
.ai-config-form .ai-wide { grid-column: 1 / -1; }
.ai-config-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-config-column { min-width: 0; display: grid; align-content: start; gap: 12px; padding: 14px; border: 1px solid rgba(58,179,218,.34); border-radius: 7px; background: rgba(4,12,8,.56); box-shadow: inset 0 0 22px rgba(58,179,218,.035); }
.ai-voice-column { border-color: rgba(116,241,93,.28); }
.ai-column-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid rgba(58,179,218,.25); }
.ai-column-heading h3 { margin: 2px 0 0; color: #f2f8ed; font-size: 15px; }
.ai-column-heading small { color: #3ab3da; font-size: 8px; letter-spacing: .13em; }
.ai-active-badge { padding: 3px 6px; border: 1px solid rgba(116,241,93,.4); border-radius: 3px; color: #78ec55; background: rgba(60,125,42,.16); font-size: 9px; }
.ai-route-list { display: grid; gap: 6px; }
.ai-route-list > div, .ai-capability-config { min-width: 0; padding: 8px 9px; border: 1px solid rgba(116,241,93,.13); background: rgba(255,255,255,.025); }
.ai-route-list span { color: #a9bba4; font-size: 10px; }
.ai-route-list strong { min-width: 0; overflow: hidden; color: #7fe6ff; font: 10px/1.25 var(--font-label); text-overflow: ellipsis; white-space: nowrap; }
.ai-voice-routes strong { color: #91f274; }
.ai-capability-config { display: grid !important; gap: 7px !important; }
.ai-capability-config > span:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-key-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.ai-text-provider-card .ai-key-input, .ai-standard-provider-card .ai-key-input { grid-template-columns: minmax(0, 1fr) auto auto; }
.ai-text-provider-card label, .ai-standard-provider-card label { display: grid; gap: 4px; }
.ai-text-provider-card select, .ai-standard-provider-card select { width: 100%; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid rgba(88,223,74,.42); border-radius: 4px; color: #dcebd8; background: rgba(2,14,10,.78); font-size: 10px; }
.ai-card-test { min-height: 30px; border: 1px solid rgba(58,179,218,.65); border-radius: 4px; color: #b9f7ff; background: rgba(20,95,115,.18); cursor: pointer; }
.ai-card-test:disabled { opacity: .6; cursor: wait; }
.ai-card-test-state { overflow-wrap: anywhere; color: #8d9b89 !important; line-height: 1.45; }
.ai-card-test-state.is-testing { color: #f4bd55 !important; }
.ai-card-test-state.is-success { color: #78ec55 !important; }
.ai-card-test-state.is-error { color: #ff8d7c !important; }
.ai-key-input input { padding: 7px 8px; font-size: 10px; }
.ai-key-input button { border: 1px solid rgba(255,120,100,.42); border-radius: 3px; background: rgba(120,35,25,.18); color: #ffc2b8; padding: 0 8px; font-size: 9px; cursor: pointer; }
.ai-capability-config small { color: #7a8d76; font-size: 9px; }
.ai-capability-config small:not(:empty) { color: #78ec55; }
.ai-model-input { width: 100%; min-width: 0; height: 30px; border: 1px solid rgba(88,223,74,.42); border-radius: 4px; padding: 0 9px; color: #b9f7ff; background: rgba(2,14,10,.78); font: inherit; font-size: 11px; }
.ai-model-input:focus { outline: 1px solid rgba(60,219,255,.72); border-color: #38d7ee; }
.ai-key-state { margin: -4px 0 0; color: #78ec55; font-size: 10px; }
.ai-config-actions { display: flex; gap: 10px; }
.ai-config-actions button { flex: 1; padding: 9px; border: 1px solid #74f15d; background: rgba(80,160,55,.2); color: #eff7e9; cursor: pointer; }
.ai-config-actions .danger { border-color: rgba(255,120,100,.65); color: #ffc2b8; background: rgba(120,35,25,.22); }
.ai-profile-message { overflow-wrap: anywhere; line-height: 1.5; }
@media (max-width: 680px) { .ai-config-columns { grid-template-columns: 1fr; } .ai-config-form .ai-wide { grid-column: 1; } }

/* Phone sign-in and parent re-authentication share the existing dialog style. */
[data-phone-form] { display: grid; gap: 12px; }
[data-phone-form] label { display: grid; gap: 6px; }
[data-phone-form] input:not([type="checkbox"]) { box-sizing: border-box; width: 100%; min-height: 42px; padding: 10px; border: 1px solid #799b59; border-radius: 8px; background: #fffdf5; color: #23331e; }
[data-phone-form] [hidden] { display: none; }
[data-phone-dialog] { max-height: calc(100dvh - 32px); overflow-y: auto; }

[data-phone-form] [data-remember-field] { display: flex; align-items: center; gap: 8px; }
[data-phone-form] [data-remember-field] input { width: auto; flex: 0 0 auto; margin: 0; }

/* Weekly course draft, queue and centralized review. */
.course-review-dialog { width: min(1120px, 94vw); max-width: 1120px; max-height: 90dvh; overflow-y: auto; }
.course-review-dialog h2 { margin-right: 40px; }
.wf-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 16px; margin: 16px 0; }
.wf-cards article { padding: 18px; border: 1px solid #4d652e; border-radius: 14px; background: #172015; overflow-wrap: anywhere; }
.course-review-dialog label { display: grid; gap: 6px; margin: 10px 0; }
.course-review-dialog input:not([type=radio]):not([type=checkbox]), .course-review-dialog select, .course-review-dialog textarea { box-sizing:border-box; width:100%; padding:9px; border-radius:7px; background:#fffdf5; color:#23331e; }
.publish-course-card { padding: 16px; border: 1px solid #4d652e; border-radius: 12px; background: #172015; cursor: pointer; }
.publish-course-card input[type=checkbox] { width: 18px; height: 18px; margin: 0 8px 0 0; vertical-align: middle; accent-color: #7de342; }
.publish-course-card p { margin: 12px 0 0; line-height: 1.5; }
.course-review-dialog pre { white-space:pre-wrap; overflow-wrap:anywhere; max-height:400px; overflow:auto; font-size:12px; background:#10150f; padding:12px; }
.wf-actions { display:flex; flex-wrap:wrap; gap:8px; }
.wf-ok { color:#80e960; } .wf-attention { color:#ffc777; } .wf-muted { font-size:12px; color:#b6c6ac; line-height:1.6; }
.wf-settings { margin:18px 0; padding:16px; border:1px solid #4d652e; }
.wf-local { border-top:1px solid #4d652e; margin-top:16px; }
.course-review-dialog [data-wf-message] { color:#ffc777; }

/* Calendar task status; selection uses an outline without changing status color. */
.calendar-day.calendar-status-empty { background:#30343a; border-color:#60656c; color:#b9bec5; }
.calendar-day.calendar-status-planned { background:#153a60; border-color:#4299e1; color:#b8dcff; }
.calendar-day.calendar-status-missed { background:#5b2026; border-color:#ef5964; color:#ffd0d4; }
.calendar-day.calendar-status-complete { background:#214d29; border-color:#70bf69; color:#c5f2bf; }
.calendar-day.selected-week-day { outline:2px solid #e0d99a; outline-offset:1px; }


.wf-progress-track { height:14px; overflow:hidden; background:#30343a; border-radius:7px; }
.wf-progress-track span { display:block; height:100%; background:linear-gradient(90deg,#297bc1,#75e04b); transition:width .4s; }
.wf-progress-track span.is-indeterminate { width:35% !important; animation:wf-progress-slide 1.8s linear infinite; }
@keyframes wf-progress-slide { from { transform:translateX(-100%); } to { transform:translateX(290%); } }
.lesson-image-status { padding:24px; border:1px dashed #777; color:#d0d0d0; }


.subject-lesson .speech-controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.subject-lesson .speech-controls button { flex:0 0 auto; height:auto; min-height:36px; padding:8px 12px; }


.weekend-entry { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: 16px 10px; text-align: center; }
.weekend-entry-description { color: #8b9184; font-size: 12px; line-height: 1.6; }
.weekend-entry [data-workflow-weekend] { width: 100%; }

.wf-curriculum-heading { display: inline-block; font-size: .55em; font-weight: 500; color: #8de452; margin-left: 1rem; vertical-align: middle; line-height: 1.5; }

.attachment-editor { width:min(620px,94vw); }
.attachment-editor label { display:block; margin:16px 0; }
.attachment-editor textarea, .attachment-editor input { width:100%; box-sizing:border-box; padding:12px; }
.attachment-editor small, .attachment-editor [data-file-name] { display:block; margin-top:8px; }
.attachment-homework { width:100vw; max-width:none; height:100dvh; max-height:none; margin:0; padding:18px; box-sizing:border-box; background:#10180f; color:#e8f3df; border:0; }
.attachment-homework header, .attachment-answer nav, .attachment-draw-tools { display:flex; gap:12px; align-items:center; padding-bottom:12px; }
.attachment-homework header { justify-content:space-between; }
.attachment-workspace { display:grid; grid-template-columns:40% 1fr; gap:18px; height:calc(100% - 50px); }
.attachment-workspace section { min-width:0; overflow:auto; }
.attachment-workspace img { width:100%; height:auto; }
.attachment-workspace iframe { width:100%; height:75vh; border:0; background:white; }
.attachment-workspace pre { white-space:pre-wrap; font:inherit; }
.attachment-homework textarea { width:100%; height:65vh; padding:18px; box-sizing:border-box; font:20px/1.6 sans-serif; background:#fffdf5; color:#182316; }
.attachment-homework canvas { width:100%; aspect-ratio:1.4; background:white; touch-action:none; }
.attachment-homework.writing-full [data-reference] { display:none; }
.attachment-homework.writing-full .attachment-workspace { grid-template-columns:1fr; }
@media(max-width:700px) { .attachment-workspace { grid-template-columns:1fr; } }

.attachment-homework button:not(.primary-action) { padding:9px 14px; border:1px solid #527b38; border-radius:7px; background:#192315; color:#e6f1db; cursor:pointer; font:inherit; }
.attachment-homework button:not(.primary-action):hover { border-color:#83e84d; color:#83e84d; }
.attachment-answer footer { position:sticky; bottom:0; background:#10180f; padding:12px 0; }
.attachment-editor input::file-selector-button { padding:8px 12px; background:#25381c; color:#e8f3df; border:1px solid #527b38; border-radius:6px; cursor:pointer; }

.annotation-homework .attachment-workspace { grid-template-columns:minmax(0,7fr) minmax(280px,3fr); }
.annotation-homework .attachment-source-work { display:flex; flex-direction:column; min-height:0; overflow:hidden; }
.attachment-source-work h2, .attachment-grading h2 { margin:0 0 10px; }
.attachment-source-work [data-source-description] { margin:0 0 10px; white-space:pre-wrap; }
.attachment-annotation-tools, .attachment-page-tools { display:flex; flex-wrap:wrap; gap:7px; align-items:center; }
.attachment-source-scroll { overflow:auto; flex:1; min-height:0; background:#273022; padding:10px; }
.attachment-sheet { position:relative; width:100%; background:white; }
.annotation-homework .attachment-sheet canvas { position:absolute; inset:0; width:100%; height:100%; aspect-ratio:auto; }
.annotation-homework [data-source-canvas] { pointer-events:none; }
.annotation-homework [data-ink-canvas] { background:transparent; touch-action:none; cursor:crosshair; }
.annotation-homework [data-ink-canvas][data-mode=text] { cursor:text; }
.annotation-homework [data-text-layer], .annotation-homework [data-mark-layer] { position:absolute; inset:0; pointer-events:none; }
.annotation-homework textarea.attachment-on-source-text { position:absolute; min-height:1.3em; height:auto; padding:0; margin:0; background:transparent; color:#1455bb; border:1px dashed #1455bb55; border-radius:0; font-family:sans-serif; line-height:1.23; resize:both; pointer-events:auto; overflow:hidden; }
.annotation-homework textarea.attachment-on-source-text:focus { outline:1px solid #3e8bea; background:#ffffffa8; }
.attachment-ai-mark { position:absolute; font:700 28px sans-serif; color:#d53232; }
.attachment-ai-mark.is-correct { color:#198d38; }
.annotation-homework .attachment-source-work footer { padding:10px 0 0; background:#10180f; }
.annotation-homework .attachment-grading { padding:12px; background:#172015; border:1px solid #42642c; border-radius:9px; }
.attachment-grade-card { padding:12px; margin-top:12px; background:#202b1b; border-radius:8px; }
.attachment-grade-card h3 { margin:0 0 8px; font-size:16px; }
.attachment-grade-card p, [data-grade-summary] { font-size:14px; line-height:1.6; white-space:pre-wrap; overflow-wrap:anywhere; }
.annotation-homework.writing-full .attachment-grading { display:none; }
.annotation-homework.writing-full .attachment-workspace { grid-template-columns:1fr; }
@media(max-width:700px){.annotation-homework .attachment-workspace{grid-template-columns:1fr;}.annotation-homework .attachment-source-work{min-height:75vh;}}

.annotation-homework textarea.attachment-on-source-text:hover { border-color:#1455bb; }
.annotation-homework textarea.attachment-on-source-text.is-moving { cursor:move; outline:2px solid #3e8bea; touch-action:none; }
.annotation-homework [data-text-layer].ink-mode textarea { pointer-events:none; }
.annotation-homework [data-ink-canvas][data-mode=erase] { cursor:none; }
.attachment-eraser-cursor { position:absolute; aspect-ratio:1; transform:translate(-50%,-50%); border:2px solid #516779; border-radius:50%; background:#ffffff66; box-shadow:0 0 0 1px white; pointer-events:none; }
.attachment-eraser-cursor[hidden] { display:none; }

.reward-rule-note { display:block; font-size:10px !important; font-weight:normal; opacity:.75; line-height:1.4; margin-top:3px; }

.ai-profile-panel-head [data-billing-entry] {padding:4px 8px;font-size:12px;margin-left:6px;white-space:nowrap;}
.ai-billing-dialog {width:min(1150px,94vw);max-width:94vw;max-height:90vh;overflow:auto;color:#e5eddf;background:#131c11;}
.ai-billing-dialog header,.ai-billing-dialog nav,.ai-billing-dialog footer {display:flex;gap:10px;align-items:center;justify-content:space-between;margin-bottom:14px;}
.ai-billing-dialog nav {justify-content:flex-start;}
.billing-table-scroll {overflow:auto;max-height:60vh;margin:14px 0;}
.ai-billing-dialog table {border-collapse:collapse;width:100%;font-size:13px;}
.ai-billing-dialog th,.ai-billing-dialog td {border-bottom:1px solid #385030;padding:10px;text-align:left;white-space:nowrap;}
.ai-billing-dialog th {background:#202e19;position:sticky;top:0;}
.ai-billing-dialog form {display:grid;gap:14px;}
.ai-billing-dialog fieldset {border:1px solid #385030;border-radius:8px;display:flex;gap:12px;flex-wrap:wrap;padding:12px;}
.ai-billing-dialog label {display:flex;flex-direction:column;gap:5px;font-size:13px;}
.ai-billing-dialog input {width:180px;}
.ai-billing-dialog a {color:#8ddb51;}
.ai-billing-dialog button,.ai-profile-panel-head [data-billing-entry] {color:#e5eddf;background:#1b2417;border:1px solid #44672e;border-radius:6px;padding:8px 12px;cursor:pointer;}
.ai-billing-dialog button:hover {border-color:#8ddb51;background:#26391c;}
.ai-billing-dialog button:disabled {opacity:.5;cursor:default;}
.ai-billing-dialog input,.ai-billing-dialog select {padding:8px;border:1px solid #44672e;border-radius:6px;background:#10180d;color:#e5eddf;}
.platform-admin-entry {background:#1b2417;border:1px solid #44672e;color:#8ddb51;border-radius:7px;padding:10px;white-space:nowrap;cursor:pointer;}
.platform-admin-dialog {width:min(1380px,95vw);max-width:95vw;max-height:94vh;overflow:auto;background:#111b0e;color:#e5eddf;}
.platform-admin-dialog header,.platform-admin-dialog nav {display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:space-between;margin-bottom:15px;}
.platform-admin-dialog nav {justify-content:flex-start;}
.platform-admin-dialog button,.account-wallet-dialog [data-wallet-record],.account-wallet-dialog [data-live-usage] {background:#1c2915;border:1px solid #44672e;border-radius:6px;padding:8px 12px;color:#e5eddf;cursor:pointer;margin:3px;}
.platform-admin-dialog button:hover {border-color:#8ddb51;}
.platform-admin-dialog input {border:1px solid #44672e;background:#0c1509;border-radius:5px;color:#e5eddf;padding:8px;max-width:100%;}
.platform-admin-dialog input[type=checkbox] {width:18px;height:18px;accent-color:#8ddb51;}
.platform-admin-dialog label {display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:12px 0;}
.platform-metrics {display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px;}
.platform-metrics>div {background:#1c2915;border:1px solid #385030;border-radius:8px;padding:14px;display:flex;flex-direction:column;gap:10px;}
.platform-metrics strong {font-size:22px;color:#8ddb51;}
.platform-table-scroll {overflow:auto;max-height:62vh;margin:14px 0;}
.platform-table-scroll table {border-collapse:collapse;min-width:100%;font-size:13px;}
.platform-table-scroll td,.platform-table-scroll th {border-bottom:1px solid #385030;padding:10px;text-align:left;min-width:95px;max-width:400px;overflow-wrap:anywhere;}
.platform-table-scroll th {background:#23341a;position:sticky;top:0;white-space:nowrap;}
.platform-edit-form {padding:18px;border:1px solid #8ddb51;border-radius:8px;background:#1c2915;margin:16px 0;}
.platform-admin-dialog [data-platform-message] {color:#edc570;}
.account-wallet-dialog .platform-table-scroll th {color:#e5eddf;} .account-wallet-dialog .platform-table-scroll td {color:#263329;}

.learning-sync-status { position:fixed;bottom:110px;left:12px;z-index:95;max-width:min(360px,85vw);padding:7px 10px;border:1px solid #456432;border-radius:8px;background:#14200fee;color:#d5edc6;font-size:12px;text-align:left; }

/* Tablet controls and standalone safe areas; keep browser pinch zoom available. */
:root { --app-header-height: calc(78px + env(safe-area-inset-top, 0px)); }
.topbar { height:var(--app-header-height); padding-top:env(safe-area-inset-top,0px); padding-left:max(16px,5.2vw,env(safe-area-inset-left,0px)); padding-right:max(16px,5.2vw,env(safe-area-inset-right,0px)); }
.forest-stage { min-height:100svh; padding-top:var(--app-header-height); --dock-bottom-space:calc(30px + env(safe-area-inset-bottom,0px)); }
.forest-stage::before { top:var(--app-header-height); }
.page-sheet,.learning-sheet { top:var(--app-header-height); bottom:calc(142px + env(safe-area-inset-bottom,0px)); }
.task-dialog { max-width:calc(100vw - 24px); max-height:calc(100dvh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); overflow:auto; overscroll-behavior:contain; }
.install-help-trigger,.day-add-task { border:1px solid var(--panel-border); border-radius:8px; padding:8px 10px; background:#1d2a18; cursor:pointer; }
.install-help-trigger { font-size:0.78rem; white-space:nowrap; }
.install-dialog { width:min(560px,calc(100vw - 24px)); padding:28px; }
.install-dialog h2 { padding-right:30px; }
.install-dialog p { line-height:1.7; }
.day-head { display:flex; flex-wrap:wrap; align-items:center; gap:6px; justify-content:space-between; }
.day-add-task { font-size:0.75rem; }
.touch-task-picker { width:min(440px,calc(100vw - 24px)); padding:24px; }
.touch-task-picker label { display:grid; gap:10px; margin-block:16px; }
.touch-task-picker select { width:100%; min-height:44px; font:inherit; background:#111711; color:var(--ink); }
.touch-task-picker button { margin:6px 6px 0 0; }
.learning-sync-status { bottom:calc(110px + env(safe-area-inset-bottom,0px)); }
@media(max-width:1180px) {
 :root { --app-header-height:calc(140px + env(safe-area-inset-top,0px)); }
 .topbar { flex-direction:column; justify-content:center; align-items:stretch; gap:10px; padding-inline:max(14px,env(safe-area-inset-left,0px),env(safe-area-inset-right,0px)); }
 body.logged-in .brand { align-self:flex-start; }
 body.logged-in .brand-en { font-size:clamp(20px,3vw,30px); }
 .top-actions { flex-wrap:wrap; gap:6px; justify-content:flex-end; }
 .top-actions .model-select-wrap { max-width:170px; }
 .dock { width:calc(100vw - 24px); padding:10px 16px; grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; }
 .page-sheet,.learning-sheet { padding-inline:16px; }
}
@media(pointer:coarse) {
 button,input,select,summary { min-height:44px; }
 button,a,summary { touch-action:manipulation; }
 input,select,textarea { font-size:16px; }
 .library-actions { opacity:1; visibility:visible; }
 .task-dialog { -webkit-overflow-scrolling:touch; }
}
@media(max-width:600px) {
 :root { --app-header-height:calc(170px + env(safe-area-inset-top,0px)); }
 .top-actions { justify-content:center; }
 .dock-item em { font-size:0.75rem; }
 .install-help-trigger { font-size:0.72rem; }
}

.platform-admin-dialog [data-ai-profile-control]{display:block;width:100%}.platform-admin-dialog [data-ai-profile-control][hidden]{display:none}.platform-admin-dialog .ai-profile-panel{position:static;width:100%;max-width:none;max-height:none;box-shadow:none}.platform-admin-dialog [data-ai-config-trigger]{display:none}
/* Administrator controls for the structured mathematics pipeline. */
.math-engine-settings{margin-top:14px;padding-top:12px;border-top:1px solid #35502b}
.math-engine-settings label{display:block;margin:10px 0}
.math-engine-settings select{display:block;width:100%;margin-top:6px}
.math-engine-settings p{font-size:12px;line-height:1.6;color:#adc49b}
.wf-curriculum-fields{display:flex;flex-direction:column;gap:12px;width:100%;margin:14px 0}.wf-curriculum-fields>label{display:flex;flex-direction:column;align-items:stretch;gap:6px;width:100%}.wf-curriculum-fields select{width:100%;max-width:100%}.math-solutions-panel h4{font-size:14px;color:#a7df79;margin:16px 0 8px}.math-solutions-panel p,.math-solutions-panel li{white-space:pre-wrap;line-height:1.85}.math-solutions-panel ol{padding-left:24px}.math-solutions-panel li{margin-bottom:12px}

/* Filing information follows the homepage in normal document flow. */
body { overflow-x: hidden; overflow-y: auto; }
.site-footer-beian {
  position: static;
  padding: 16px 8px calc(16px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 12px;
  line-height: 20px;
  background: rgba(8, 15, 10, .94);
}
.site-footer-beian a { color: #cbd9c2; text-decoration: none; }
.site-footer-beian a:hover { text-decoration: underline; }
.site-footer-beian a:focus-visible { outline: 2px solid #7ee255; outline-offset: 2px; }

/* Administrator controls are opt-in from server-provided site context. */
body:not(.admin-portal-available) .admin-trigger,
body:not(.admin-portal-available) .admin-panel,
body:not(.admin-portal-available) .platform-admin-entry { display: none !important; }
.admin-host .login-trigger,
.admin-host .login-panel,
.admin-host [data-admin-action="student"],
.admin-host [data-admin-action="parent"] { display: none !important; }

/* Unified account inbox. */
.notification-trigger{position:relative}.notification-count{position:absolute;top:-3px;right:-5px;min-width:17px;padding:2px 4px;border-radius:12px;background:#c33e32;color:#fff;font-size:10px;line-height:1.2}.notification-count[hidden]{display:none}
.account-messages-dialog{width:min(680px,92vw);max-height:85vh;overflow-y:auto}.account-messages-dialog header{display:flex;justify-content:space-between;align-items:center}.account-message{margin:14px 0;padding:16px;border:1px solid #375028;border-radius:8px}.account-message.is-unread{border-left:4px solid #8fe54a}.account-message h3{margin:6px 0}.message-meta{font-size:12px;color:#afc79f}.message-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.8}.platform-edit-form textarea{display:block;width:100%;box-sizing:border-box;white-space:pre-wrap}
