:root {
  --ink: #18212f;
  --muted: #647084;
  --line: #dbe3ee;
  --paper: #fffdf8;
  --soft: #f6f8fb;
  --coral: #ff6b5f;
  --teal: #09a8a8;
  --green: #55bd6b;
  --yellow: #ffc83d;
  --blue: #3778ff;
  --rose: #ff87aa;
  --shadow: 0 18px 45px rgba(24, 33, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 200, 61, 0.28), transparent 32rem),
    linear-gradient(135deg, #fff8e8 0%, #eefcf8 45%, #f7fbff 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  color: #fff;
  background: linear-gradient(180deg, #17334d 0%, #1b5b61 58%, #226c57 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  color: #17334d;
  background: var(--yellow);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
}

.profile-box {
  display: grid;
  gap: 8px;
  margin: -14px 0 20px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.11);
}

.profile-box label {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 800;
}

.profile-box select {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  color: #17334d;
  background: #fff;
  font-weight: 800;
}

.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.profile-row .icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  color: #17334d;
  background: #ffc83d;
}

.profile-box small {
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
}

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

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  background: transparent;
}

.nav-item.active {
  color: #17334d;
  background: #fff;
  font-weight: 800;
}

.streak-box {
  position: absolute;
  right: 18px;
  bottom: 24px;
  left: 18px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.streak-box span,
.streak-box strong {
  display: block;
}

.streak-box strong {
  margin: 6px 0 14px;
  font-size: 28px;
}

.mini-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.mini-bars i {
  height: 28px;
  border-radius: 5px;
  background: var(--yellow);
}

main {
  padding: 28px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.hero.panel.active {
  display: grid;
}

.loop-strip.panel.active {
  display: grid;
}

.task-grid.panel.active {
  display: grid;
}

.hero {
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 28px;
  align-items: stretch;
  min-height: 360px;
  padding: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy {
  align-self: center;
}

.level-row,
.progress-head,
.section-title,
.reward-row,
.library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.level-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.level-chip,
.energy-chip,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #eef7ff;
}

.level-chip {
  color: #8d3f00;
  background: #fff1b7;
}

.energy-chip {
  color: #006b65;
  background: #dff8f4;
}

h1 {
  max-width: 780px;
  margin: 24px 0 16px;
  font-size: 48px;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 span {
  color: var(--coral);
}

.hero-text {
  max-width: 640px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.progress-wrap {
  max-width: 620px;
}

.progress-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef4;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--yellow), var(--green));
  transition: width 0.35s ease;
}

.hero-art {
  position: relative;
  min-height: 310px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #dff8f4;
}

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

.buddy-trigger {
  text-align: left;
}

.tap-hint {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 9px 12px;
  border-radius: 999px;
  color: #17334d;
  background: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(24, 33, 47, 0.16);
}

.loop-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.loop-step {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 112px;
  padding: 16px;
  border: 1px solid rgba(219, 227, 238, 0.9);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(24, 33, 47, 0.07);
}

.loop-step > span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  background: var(--blue);
}

.loop-step.learn > span {
  background: var(--teal);
}

.loop-step.practice > span {
  background: var(--coral);
}

.loop-step.review > span {
  background: #704ecf;
}

.loop-step strong {
  display: block;
  margin-bottom: 5px;
  font-size: 17px;
}

.loop-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.task-grid {
  grid-template-columns: 1.35fr 0.8fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.daily-mission,
.focus-card,
.boss-card,
.page-panel,
.wrongbook,
.coverage-card,
.diagnose-card,
.gap-plan-card,
.engine-card {
  padding: 22px;
  border: 1px solid rgba(219, 227, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 28px rgba(24, 33, 47, 0.08);
}

.section-title {
  margin-bottom: 18px;
  font-weight: 900;
}

.wide {
  margin-bottom: 22px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-size: 20px;
}

.mission-list,
.rescue-list,
.book-list {
  display: grid;
  gap: 12px;
}

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

.mission-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-weight: 900;
}

.mission h3,
.boss-card h2 {
  margin: 0;
  font-size: 18px;
}

.mission p,
.boss-card p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.check-button {
  width: 34px;
  height: 34px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.check-button.done {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.timer {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 170px;
}

.timer strong {
  font-size: 52px;
  color: var(--teal);
}

.timer button,
.primary-action {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  color: #fff;
  background: var(--coral);
  font-weight: 900;
}

.reward-row {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.reward-row b,
.success {
  color: #146b36;
}

.danger {
  color: #9a2f1b;
  background: #ffe3dc;
}

.boss-card {
  background:
    linear-gradient(135deg, rgba(255, 200, 61, 0.25), transparent 55%),
    rgba(255, 255, 255, 0.88);
}

.primary-action {
  margin-top: 18px;
  background: var(--blue);
}

.page-panel {
  margin-top: 18px;
}

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

.loop-card {
  min-height: 520px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.loop-card > b {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  color: #006b65;
  background: #dff8f4;
}

.loop-card h2 {
  margin: 14px 0 8px;
  font-size: 24px;
}

.loop-card p,
.quiz-item p,
.empty-state,
.fsrs-card p,
.deck-tile p,
.mastery-tile p {
  color: var(--muted);
  line-height: 1.55;
}

.source-list,
.quiz-list,
.review-queue {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.source-row,
.queue-row,
.quiz-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.source-row {
  display: grid;
  grid-template-columns: 48px 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.source-row strong,
.source-row span {
  font-weight: 900;
}

.source-row span {
  color: var(--coral);
}

.source-row small {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.quiz-box {
  margin-top: 14px;
}

.quiz-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
}

.quiz-box select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.quiz-box .primary-action {
  width: 100%;
}

.quiz-item {
  background: #fff;
}

.quiz-item.ok {
  border-color: rgba(85, 189, 107, 0.65);
  background: #f0fbf4;
}

.quiz-item.hesitate {
  border-color: rgba(255, 200, 61, 0.9);
  background: #fffaf0;
}

.quiz-item.wrong {
  border-color: rgba(255, 107, 95, 0.72);
  background: #fff3f0;
}

.quiz-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.quiz-actions button,
.option-list button,
.game-options button,
.queue-row button,
.fsrs-actions button,
.reason-picker button,
.mastery-tile button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #17334d;
  background: #fff;
  font-weight: 900;
}

.option-list,
.game-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.option-list button,
.game-options button {
  min-height: 48px;
  padding: 10px 12px;
  text-align: left;
}

.option-list button.correct,
.game-options button.correct {
  border-color: rgba(85, 189, 107, 0.72);
  color: #146b36;
  background: #eaf8ef;
}

.option-list button.picked-wrong,
.game-options button.picked-wrong {
  border-color: rgba(255, 107, 95, 0.72);
  color: #9a2f1b;
  background: #fff0ee;
}

.question-stem {
  font-size: 18px;
  font-weight: 900;
}

.type-tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  margin-top: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #704ecf;
  background: #f0ebff;
  font-size: 12px;
  font-weight: 900;
}

.question-hint,
.quiz-feedback span,
.game-feedback span {
  display: block;
  color: var(--muted);
  line-height: 1.55;
}

.quiz-feedback,
.game-feedback {
  min-height: 42px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--soft);
}

.quiz-item.easy,
.quiz-item.good {
  border-color: rgba(85, 189, 107, 0.65);
  background: #f0fbf4;
}

.quiz-item.hard {
  border-color: rgba(255, 200, 61, 0.9);
  background: #fffaf0;
}

.quiz-item.again {
  border-color: rgba(255, 107, 95, 0.72);
  background: #fff3f0;
}

.reason-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.reason-picker span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 900;
}

.queue-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 86px 34px;
  gap: 8px;
  align-items: center;
  background: #fff;
}

.queue-row b {
  color: #704ecf;
}

.queue-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.queue-row em {
  display: inline-block;
  margin-left: 6px;
  color: #9a2f1b;
  font-style: normal;
  font-weight: 900;
}

.queue-row small {
  color: var(--muted);
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
}

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

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 360px;
  gap: 18px;
}

.method-lab {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.method-module {
  min-height: 250px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.method-module > strong {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  color: #704ecf;
  background: #f0ebff;
  font-size: 12px;
}

.method-module h3 {
  margin: 12px 0 8px;
  font-size: 20px;
}

.method-module p,
.module-output,
.pipeline span,
.role-grid span {
  color: var(--muted);
  line-height: 1.55;
}

.method-module textarea {
  width: 100%;
  min-height: 124px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
  font: 13px Consolas, monospace;
}

.module-output {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.module-output div,
.pipeline span {
  display: block;
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
}

.module-output b,
.module-output span,
.module-output small {
  display: block;
}

.badge-shelf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.quest-badge {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid #d7dde8;
  border-radius: 50%;
  color: #647084;
  background: #f8fafc;
  font-weight: 900;
}

.quest-badge.level-1,
.quest-badge.level-2 {
  color: #fff;
  background: var(--blue);
}

.quest-badge.level-3,
.quest-badge.level-4 {
  color: #fff;
  background: var(--green);
}

.quest-badge.level-5 {
  color: #17334d;
  border-color: #e6b400;
  background: var(--yellow);
}

.role-grid {
  display: grid;
  gap: 10px;
}

.role-grid button {
  display: block;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: var(--soft);
  text-align: left;
}

.role-grid strong,
.role-grid span {
  display: block;
}

.pipeline {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.game-stage,
.game-map {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.game-stage {
  min-height: 520px;
  background:
    linear-gradient(135deg, rgba(255, 200, 61, 0.18), transparent 42%),
    linear-gradient(180deg, #ffffff, #f7fbff);
}

.game-topbar,
.game-actions,
.game-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-topbar {
  margin-bottom: 22px;
}

.game-topbar h2 {
  margin: 12px 0 0;
  font-size: 28px;
}

.game-score {
  flex-wrap: wrap;
}

.level-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.level-tools label {
  color: var(--muted);
  font-weight: 900;
}

.level-tools select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.timer-chip {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-radius: 8px;
  color: #8d3f00;
  background: #fff1b7;
  font-weight: 900;
  text-align: center;
}

.game-score span {
  min-width: 88px;
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
  text-align: center;
  font-weight: 900;
}

.game-question {
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid rgba(55, 120, 255, 0.22);
  border-radius: 8px;
  background: #fff;
}

.game-question strong {
  display: block;
  font-size: 24px;
  line-height: 1.35;
}

.game-question p {
  margin: 10px 0;
  color: var(--muted);
}

.game-question small {
  color: #704ecf;
  font-weight: 900;
}

.game-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.game-level-map {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.type-coverage {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.type-coverage strong {
  font-size: 14px;
}

.type-coverage div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-coverage span {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.type-coverage .covered {
  color: #146b36;
  background: #e8f8ee;
}

.type-coverage .missing {
  color: #9a2f1b;
  background: #ffe3dc;
}

.level-dot {
  display: grid;
  gap: 4px;
  min-height: 70px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--soft);
}

.level-dot span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #cbd5e1;
  font-weight: 900;
}

.level-dot.current {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(55, 120, 255, 0.14);
}

.level-dot.passed span,
.level-dot.level-5 span {
  background: var(--yellow);
}

.level-dot.level-3 span,
.level-dot.level-4 span {
  color: #fff;
  background: var(--green);
}

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

.fsrs-queue,
.reason-stats,
.interleave-deck,
.mastery-grid {
  display: grid;
  gap: 12px;
}

.fsrs-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.fsrs-card strong {
  display: block;
}

.fsrs-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.reason-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  overflow: hidden;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reason-row span,
.reason-row strong {
  position: relative;
  z-index: 1;
}

.reason-row i {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 107, 95, 0.15);
}

.interleave-deck {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.deck-tile,
.mastery-tile {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.deck-tile span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-weight: 900;
}

.deck-tile strong,
.mastery-tile strong,
.mastery-tile span {
  display: block;
}

.deck-tile small {
  color: #704ecf;
  font-weight: 900;
}

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

.mastery-tile {
  border-left: 8px solid #cbd5e1;
}

.mastery-tile.level-1 {
  border-left-color: #8cc8ff;
}

.mastery-tile.level-2 {
  border-left-color: var(--blue);
}

.mastery-tile.level-3 {
  border-left-color: var(--green);
}

.mastery-tile.level-4 {
  border-left-color: #704ecf;
}

.mastery-tile.level-5 {
  border-left-color: var(--yellow);
  background: #fffaf0;
}

.mastery-tile button {
  width: 100%;
  margin-top: 10px;
}

.ai-card {
  background:
    linear-gradient(135deg, rgba(9, 168, 168, 0.12), transparent 48%),
    #fff;
}

.director-card {
  background:
    linear-gradient(135deg, rgba(255, 200, 61, 0.22), transparent 42%),
    linear-gradient(180deg, #ffffff, #f8fbff);
}

.director-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(260px, 1fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.director-brief,
.director-output {
  display: grid;
  align-content: start;
  gap: 10px;
}

.director-brief strong,
.director-output strong {
  font-size: 18px;
  color: #0a766f;
}

.director-brief p,
.director-output div {
  color: var(--muted);
  line-height: 1.7;
}

.director-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.director-roles {
  display: grid;
  gap: 10px;
}

.director-role {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.director-role b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
}

.director-role strong,
.director-role small {
  display: block;
}

.director-role small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.director-output {
  min-height: 230px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.director-output div {
  white-space: pre-wrap;
}

.ai-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.ai-inputs,
.ai-output {
  display: grid;
  gap: 10px;
}

.ai-inputs label {
  font-weight: 900;
}

.ai-inputs select,
.ai-inputs textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.ai-inputs select {
  min-height: 42px;
}

.ai-inputs textarea {
  resize: vertical;
  line-height: 1.65;
}

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

.ai-output {
  align-content: start;
  min-height: 250px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.ai-output strong {
  color: var(--teal);
}

.ai-output div {
  white-space: pre-wrap;
  color: var(--muted);
  line-height: 1.7;
}

.ai-output code {
  color: #17334d;
  font-weight: 900;
}

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

.sub-title {
  margin-top: 22px;
}

.mindmap-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.mindmap-tools .segmented {
  margin-bottom: 0;
}

.mindmap-tools .primary-action,
.mindmap-tools .secondary-action {
  margin-top: 0;
  white-space: nowrap;
}

.mindmap-canvas {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  min-height: 430px;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 200, 61, 0.16), transparent 45%),
    linear-gradient(180deg, #fff, #f7fbff);
}

.mindmap-center {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 210px;
  place-items: center;
  align-content: center;
  padding: 22px;
  border: 4px solid #fff;
  border-radius: 50%;
  color: #17334d;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 200, 61, 0.8)),
    url("./assets/knowledge-universe.png") center / cover;
  text-align: center;
  box-shadow: 0 18px 45px rgba(24, 33, 47, 0.16);
}

.mindmap-center strong,
.mindmap-center span {
  display: block;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
}

.mindmap-center strong {
  font-size: 24px;
}

.mindmap-branches {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mindmap-branches::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: -26px;
  height: 2px;
  background: linear-gradient(90deg, rgba(9, 168, 168, 0.35), transparent);
}

.mind-node {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 7px;
  min-height: 138px;
  border: 1px solid var(--line);
  border-left: 8px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: 0 8px 18px rgba(24, 33, 47, 0.06);
}

.mind-node b {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: #006b65;
  background: #dff8f4;
}

.mind-node strong,
.mind-node span,
.mind-node small {
  display: block;
}

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

.mind-node.level-1,
.mind-node.level-2 {
  border-left-color: var(--blue);
}

.mind-node.level-3,
.mind-node.level-4 {
  border-left-color: var(--green);
}

.mind-node.level-5 {
  border-left-color: var(--yellow);
  background: #fffaf0;
}

.gap-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

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

.segment-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #405066;
  background: #fff;
  font-weight: 900;
}

.segment-button.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.diagnose-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

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

.diagnose-item input {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  accent-color: var(--coral);
}

.diagnose-item strong,
.diagnose-item span {
  display: block;
}

.diagnose-item span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.gap-plan {
  display: grid;
  gap: 12px;
}

.plan-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.plan-step:hover,
.plan-step:focus-visible {
  border-color: rgba(55, 120, 255, 0.65);
  box-shadow: 0 12px 26px rgba(55, 120, 255, 0.12);
  outline: 0;
  transform: translateY(-1px);
}

.plan-step b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
}

.plan-step strong,
.plan-step span {
  display: block;
}

.plan-step span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.plan-step em {
  display: block;
  margin-top: 8px;
  color: var(--blue);
  font-style: normal;
  font-weight: 900;
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.plan-actions .primary-action,
.plan-actions .secondary-action {
  min-height: 34px;
  margin-top: 0;
  padding: 0 12px;
  font-size: 13px;
}

.subject-card {
  position: relative;
  min-height: 240px;
  padding: 20px;
  border-radius: 8px;
  color: #fff;
  overflow: hidden;
}

.subject-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -38px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.subject-card h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.subject-card p {
  min-height: 52px;
  margin: 0;
  line-height: 1.55;
}

.subject-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.subject-stats span {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
}

.library-tools {
  margin-bottom: 16px;
  justify-content: flex-start;
}

.library-tools input,
.library-tools select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.library-tools input {
  width: min(520px, 100%);
}

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

.book-color {
  width: 10px;
  height: 70px;
  border-radius: 999px;
}

.book h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.book p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.book-meta {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.book-meta span {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: #405066;
  font-size: 12px;
  font-weight: 800;
}

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

.stepper {
  width: 92px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
}

.review-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.rescue-item {
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.rescue-item strong {
  display: block;
  margin-bottom: 6px;
}

.rescue-item span {
  color: var(--muted);
}

.coverage-list {
  display: grid;
  gap: 12px;
  padding-left: 20px;
  line-height: 1.7;
}

.floating-buddy {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  border: 4px solid #fff;
  border-radius: 50%;
  color: #17334d;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 200, 61, 0.78)),
    url("./assets/knowledge-universe.png") center / cover;
  box-shadow: 0 16px 36px rgba(24, 33, 47, 0.22);
}

.floating-buddy span {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 900;
}

.buddy-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(12, 20, 31, 0.42);
}

.buddy-modal.open {
  display: grid;
}

.buddy-card {
  position: relative;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
  width: min(760px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(12, 20, 31, 0.28);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #405066;
  background: var(--soft);
  font-size: 24px;
}

.buddy-avatar {
  min-height: 260px;
  border-radius: 8px;
  overflow: hidden;
  background: #dff8f4;
}

.buddy-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.buddy-copy {
  align-self: center;
  padding-right: 28px;
}

.buddy-copy h2 {
  margin: 14px 0 10px;
  font-size: 30px;
  line-height: 1.2;
}

.buddy-copy p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.buddy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

#buddyLine {
  white-space: pre-line;
  max-height: 280px;
  overflow: auto;
  line-height: 1.7;
}

.mindmap-debug-panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 28px));
  max-height: 72vh;
  padding: 14px;
  border: 1px solid #bfd0e4;
  border-radius: 8px;
  color: #17334d;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(12, 20, 31, 0.24);
}

.mindmap-debug-panel strong {
  font-size: 16px;
}

.mindmap-debug-status {
  padding: 10px;
  border-radius: 8px;
  background: #eef8ff;
  color: #405066;
  line-height: 1.6;
}

.mindmap-debug-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.mindmap-debug-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #2f66d0;
  font-size: 12px;
  font-weight: 900;
}

.mindmap-debug-panel pre {
  overflow: auto;
  max-height: 240px;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #132033;
  color: #e6f2ff;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.secondary-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  color: #17334d;
  background: #fff;
  font-weight: 900;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    height: auto;
  }

  .nav-list {
    grid-column: 1 / -1;
    grid-template-columns: repeat(8, 1fr);
  }

  .streak-box {
    position: static;
  }

  .hero,
  .loop-strip,
  .loop-board,
  .engine-grid,
  .game-shell,
  .method-lab,
  .ai-layout,
  .director-layout,
  .mindmap-canvas,
  .interleave-deck,
  .mastery-grid,
  .task-grid,
  .subject-grid,
  .review-layout,
  .gap-layout {
    grid-template-columns: 1fr 1fr;
  }

  .hero-copy {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  main {
    padding: 14px;
  }

  .sidebar {
    padding: 16px;
  }

  .nav-list,
  .hero,
  .loop-strip,
  .loop-board,
  .engine-grid,
  .game-shell,
  .method-lab,
  .ai-layout,
  .director-layout,
  .mindmap-canvas,
  .mindmap-tools,
  .interleave-deck,
  .mastery-grid,
  .task-grid,
  .subject-grid,
  .review-layout,
  .gap-layout,
  .segmented,
  .buddy-card,
  .book {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 34px;
  }

  .hero {
    padding: 20px;
  }

  .hero-art {
    min-height: 220px;
  }

  .library-tools {
    display: grid;
  }

  .source-row,
  .queue-row,
  .quiz-actions,
  .option-list,
  .game-options,
  .game-topbar,
  .game-actions,
  .mindmap-branches,
  .fsrs-actions,
  .reason-picker {
    grid-template-columns: 1fr;
  }

  .book-actions {
    justify-content: space-between;
  }

  .floating-buddy {
    right: 14px;
    bottom: 14px;
    width: 68px;
    height: 68px;
  }

  .buddy-copy {
    padding-right: 0;
  }

  .buddy-avatar {
    min-height: 180px;
  }
}
