:root {
  --bg: #fff8e8;
  --paper: #ffffff;
  --ink: #25304f;
  --muted: #69708a;
  --line: #ffe2a8;
  --green: #2fc06d;
  --blue: #48a7ff;
  --orange: #ff9f2f;
  --red: #ff5f70;
  --purple: #8b6dff;
  --yellow: #ffd45a;
  --shadow: 0 16px 0 rgba(37, 48, 79, 0.08), 0 22px 42px rgba(255, 159, 47, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 212, 90, 0.38) 0 46px, transparent 48px),
    radial-gradient(circle at 92% 18%, rgba(72, 167, 255, 0.22) 0 58px, transparent 60px),
    radial-gradient(circle at 18% 86%, rgba(47, 192, 109, 0.16) 0 70px, transparent 72px),
    linear-gradient(135deg, #fff8e8 0%, #ecf8ff 52%, #fff0f4 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

img,
svg {
  max-width: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(37, 48, 79, 0.12) 0 3px, transparent 4px),
    radial-gradient(circle, rgba(255, 159, 47, 0.22) 0 5px, transparent 6px);
  background-position: 24px 28px, 96px 86px;
  background-size: 128px 128px, 180px 180px;
  opacity: 0.52;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 4px solid #ffe09b;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px 20px;
  box-shadow: 0 8px 0 rgba(255, 212, 90, 0.32);
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 4px solid #25304f;
  border-radius: 18px 18px 22px 14px;
  background: linear-gradient(145deg, #2fc06d, #48a7ff);
  color: white;
  font-size: 28px;
  font-weight: 900;
  transform: rotate(-4deg);
  box-shadow: 0 7px 0 #25304f;
}

.brand strong {
  display: block;
  font-size: 20px;
  font-weight: 900;
  color: #25304f;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.top-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 8px;
}

.nav-btn {
  min-height: 42px;
  border: 3px solid #25304f;
  border-radius: 18px;
  background: #ffffff;
  color: #25304f;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 5px 0 #25304f;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.nav-btn:hover {
  transform: translateY(-2px);
  background: #fff5d6;
}

.nav-btn.active {
  background: #ffd45a;
  color: white;
  color: #25304f;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #25304f;
}

.shell {
  display: grid;
  height: calc(100% - 76px);
  grid-template-columns: 292px minmax(0, 1fr);
}

.home-mode .top-nav,
.home-mode .sidebar {
  display: none;
}

.home-mode .shell {
  display: block;
}

.home-mode .content {
  height: calc(100vh - 76px);
}

.sidebar {
  overflow-y: auto;
  border-right: 4px solid #ffe09b;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
  position: relative;
  z-index: 1;
}

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

.stats-panel div {
  border: 3px solid #25304f;
  border-radius: 20px;
  background: #ecfff4;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 5px 0 #25304f;
}

.stats-panel strong {
  display: block;
  color: var(--green);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.stats-panel span {
  display: block;
  margin-top: 5px;
  color: #36634f;
  font-size: 12px;
  font-weight: 900;
}

.side-title {
  margin: 0 0 10px;
  color: #30415d;
  font-size: 14px;
  font-weight: 900;
}

.unit-list {
  display: grid;
  gap: 8px;
}

.unit-card {
  width: 100%;
  border: 3px solid #25304f;
  border-radius: 20px;
  background: #ffffff;
  padding: 12px;
  color: #24364b;
  text-align: left;
  box-shadow: 0 5px 0 #25304f;
  transition: border 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.unit-card:hover {
  transform: translateY(-2px) rotate(-0.5deg);
  background: #fff8d9;
}

.unit-card.active {
  border-color: #172033;
  background: #7bdcff;
  color: #25304f;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #25304f;
}

.unit-card strong {
  display: block;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.unit-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 800;
}

.unit-card.active small {
  color: #c7d2e2;
}

.unit-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #ecfdf3;
  color: #147a50;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 8px;
}

.badge.warn {
  background: #fff3e4;
  color: #b05a10;
}

.content {
  overflow-y: auto;
  padding: clamp(14px, 2.4vw, 24px);
  position: relative;
  z-index: 1;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  min-height: 220px;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  overflow: hidden;
  border: 4px solid #25304f;
  border-radius: 32px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.22) 0 42px, transparent 44px),
    linear-gradient(135deg, #48a7ff, #8b6dff 52%, #ff8fb3);
  color: white;
  box-shadow: var(--shadow);
}

.hero-text {
  padding: 28px;
}

.eyebrow {
  margin: 0;
  width: fit-content;
  border-radius: 999px;
  background: #fff;
  color: #25304f;
  font-size: 14px;
  font-weight: 900;
  padding: 7px 12px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.hero h1 {
  margin: 8px 0 10px;
  font-size: 34px;
  line-height: 1.15;
  text-shadow: 0 4px 0 rgba(37, 48, 79, 0.22);
}

.hero p {
  margin: 0;
  color: #d6e3f1;
  font-weight: 700;
  line-height: 1.8;
}

.visual-board {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.18);
}

.fireworks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.fireworks span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffd45a;
  box-shadow:
    0 -34px #ffd45a,
    28px -18px #7bdcff,
    30px 18px #ff8fa3,
    0 34px #2fc06d,
    -28px 18px #ffffff,
    -30px -18px #ff9f2f;
  animation: firework-pop 1.2s ease-out infinite;
}

.fireworks span:nth-child(1) { left: 18%; top: 26%; animation-delay: 0s; }
.fireworks span:nth-child(2) { left: 46%; top: 18%; animation-delay: 0.18s; }
.fireworks span:nth-child(3) { left: 78%; top: 28%; animation-delay: 0.34s; }
.fireworks span:nth-child(4) { left: 28%; top: 68%; animation-delay: 0.52s; }
.fireworks span:nth-child(5) { left: 62%; top: 72%; animation-delay: 0.7s; }
.fireworks span:nth-child(6) { left: 86%; top: 60%; animation-delay: 0.88s; }

@keyframes firework-pop {
  0% {
    transform: scale(0.15);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  72% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

.cube-scene {
  display: grid;
  grid-template-columns: repeat(4, 28px);
  grid-auto-rows: 28px;
  gap: 8px;
  justify-content: center;
}

.cube {
  border: 2px solid #25304f;
  border-radius: 9px;
  background: linear-gradient(135deg, #ffd45a, #ff9f2f);
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.12), 0 5px 0 #25304f;
}

.mini-chart {
  display: flex;
  height: 86px;
  align-items: end;
  justify-content: center;
  gap: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  padding: 12px;
}

.bar {
  width: 24px;
  border: 2px solid #25304f;
  border-radius: 10px 10px 4px 4px;
  background: #73d5ff;
}

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

.catalog-page {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.split-catalog {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.catalog-column {
  display: grid;
  gap: 14px;
}

.catalog-title {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.2;
}

.catalog-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  overflow: hidden;
  border: 4px solid #25304f;
  border-radius: 30px;
  background: white;
  box-shadow: 0 9px 0 #25304f, 0 18px 34px rgba(37, 48, 79, 0.12);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.catalog-card:nth-child(3n + 1) {
  background: #fff8d9;
}

.catalog-card:nth-child(3n + 2) {
  background: #eaf7ff;
}

.catalog-card:nth-child(3n + 3) {
  background: #fff0f6;
}

.catalog-card:hover {
  transform: translateY(-3px) rotate(-0.3deg);
  box-shadow: 0 12px 0 #25304f, 0 22px 38px rgba(37, 48, 79, 0.14);
}

.home-mode .catalog-card {
  grid-template-columns: 142px minmax(0, 1fr);
}

.catalog-index {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  background: repeating-linear-gradient(-35deg, #25304f 0 12px, #334263 12px 24px);
  color: white;
  padding: 18px;
}

.catalog-index span {
  font-size: 18px;
  font-weight: 900;
}

.catalog-index strong {
  width: fit-content;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: #ffd45a;
  color: #25304f;
  font-size: 12px;
  padding: 6px 10px;
}

.catalog-index .status-ok {
  background: #eafbf2;
  color: #147a50;
}

.catalog-body {
  padding: 18px;
  min-width: 0;
}

.catalog-body h2 {
  margin: 0;
  font-size: clamp(18px, 2vw, 22px);
  color: #25304f;
}

.catalog-body p {
  margin: 8px 0 0;
  color: #52657c;
  font-weight: 700;
  line-height: 1.7;
  font-size: 14px;
}

.catalog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.catalog-tags span {
  border-radius: 999px;
  border: 2px solid #25304f;
  background: #ffffff;
  color: #24435e;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 10px;
}

.catalog-tags .warn {
  background: #fff3e4;
  color: #b05a10;
}

.panel,
.question-card,
.wrong-card {
  border: 4px solid #25304f;
  border-radius: 28px;
  background: white;
  box-shadow: 0 8px 0 #25304f, 0 18px 36px rgba(37, 48, 79, 0.12);
}

.panel {
  padding: 20px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
}

.point-list,
.tip-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.point-list li,
.tip-list li {
  border-radius: 16px;
  background: #f8fbff;
  padding: 13px 14px;
  color: #30415d;
  font-weight: 700;
  line-height: 1.7;
}

.tip-list li {
  background: #fff7ec;
  color: #9a4e12;
}

.key-term,
.key-number,
.key-symbol {
  display: inline-block;
  vertical-align: baseline;
  border-radius: 10px;
  padding: 0 0.22em;
  line-height: 1.28;
}

.key-term {
  color: #e24b2c;
  background: #fff0df;
  box-shadow: inset 0 -0.28em 0 rgba(255, 190, 64, 0.45);
}

.key-number {
  color: #1665d8;
  background: #eaf4ff;
  font-weight: 900;
}

.key-symbol {
  color: #147a50;
  background: #e7f8ed;
  font-weight: 900;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary,
.secondary,
.danger {
  min-height: 44px;
  border: 3px solid #25304f;
  border-radius: 18px;
  padding: 0 18px;
  font-weight: 900;
  box-shadow: 0 5px 0 #25304f;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.primary:hover,
.secondary:hover,
.danger:hover {
  transform: translateY(-2px);
}

.primary:active,
.secondary:active,
.danger:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #25304f;
}

.primary {
  background: #2fc06d;
  color: #ffffff;
}

.secondary {
  background: #ffd45a;
  color: #25304f;
}

.danger {
  background: #ff8fa3;
  color: #25304f;
}

.game-shell {
  display: grid;
  gap: 18px;
}

.game-map {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  border: 4px solid #25304f;
  border-radius: 28px;
  background: #fff8d9;
  padding: 16px;
  box-shadow: 0 7px 0 #25304f;
}

.star-node {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 3px solid #25304f;
  border-radius: 50%;
  background: #ffffff;
  color: #25304f;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 5px 0 #25304f;
}

.star-node.done {
  background: #ffd45a;
  color: #25304f;
}

.star-node.current {
  background: #7bdcff;
  transform: translateY(-4px) rotate(-6deg);
  animation: bounce-star 0.9s ease-in-out infinite alternate;
}

@keyframes bounce-star {
  from {
    transform: translateY(-2px) rotate(-5deg);
  }
  to {
    transform: translateY(-8px) rotate(5deg);
  }
}

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

.score-box {
  border: 4px solid #25304f;
  border-radius: 24px;
  background: linear-gradient(135deg, #25304f, #5145a6);
  color: white;
  padding: 18px;
  box-shadow: 0 7px 0 #25304f;
}

.score-box span {
  display: block;
  color: #b9c7dc;
  font-size: 13px;
  font-weight: 900;
}

.score-box strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  font-weight: 900;
}

.question-card {
  padding: 22px;
  min-width: 0;
}

.game-question-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.reward-pill {
  display: inline-flex;
  align-items: center;
  border: 3px solid #25304f;
  border-radius: 999px;
  background: #ecfff4;
  color: #147a50;
  font-size: 13px;
  font-weight: 900;
  padding: 7px 12px;
  box-shadow: 0 4px 0 #25304f;
}

.question-card h2 {
  margin: 8px 0 16px;
  font-size: 26px;
}

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

.choice {
  min-height: 76px;
  border: 3px solid #25304f;
  border-radius: 22px;
  background: #ffffff;
  color: #24364b;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 5px 0 #25304f;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.choice:hover,
.choice.selected {
  background: #dffbea;
  transform: translateY(-2px);
}

.answer-input {
  width: 100%;
  max-width: 340px;
  min-height: 52px;
  border: 3px solid #25304f;
  border-radius: 18px;
  background: #ffffff;
  padding: 0 16px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  outline: none;
  box-shadow: 0 5px 0 #25304f;
}

.answer-input:focus {
  background: #fff8d9;
}

.feedback {
  margin-top: 14px;
  border: 3px solid #25304f;
  border-radius: 20px;
  background: #eaf7ff;
  color: #254c69;
  font-weight: 800;
  line-height: 1.7;
  padding: 14px;
  box-shadow: 0 4px 0 rgba(37, 48, 79, 0.12);
}

.game-feedback {
  background: #fff0f6;
  color: #8f3157;
}

.math-frac {
  display: inline-flex;
  width: fit-content;
  min-width: 1.15em;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 0.12em;
  color: inherit;
  font-family: "Times New Roman", "Cambria Math", "Microsoft YaHei", serif;
  font-size: 0.92em;
  font-weight: 900;
  line-height: 0.95;
  transform: translateY(-0.03em);
}

.math-frac span:first-child {
  display: block;
  width: 100%;
  border-bottom: 2px solid currentColor;
  padding: 0 0.14em 0.08em;
  text-align: center;
}

.math-frac span:last-child {
  display: block;
  width: 100%;
  padding: 0.08em 0.14em 0;
  text-align: center;
}

.practice-list {
  display: grid;
  gap: 14px;
}

.question-meta {
  margin: 0;
  color: #25815d;
  font-size: 13px;
  font-weight: 900;
}

.result {
  margin-top: 12px;
  border: 3px solid #25304f;
  border-radius: 18px;
  padding: 12px;
  font-weight: 800;
  line-height: 1.7;
}

.result.good {
  background: #ebfbf2;
  color: #147a50;
}

.result.bad {
  background: #fff0e8;
  color: #b04f12;
}

.wrong-list {
  display: grid;
  gap: 14px;
}

.wrong-card {
  padding: 18px;
}

.wrong-card h3 {
  margin: 8px 0 12px;
}

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

.wrong-pair p {
  margin: 0;
  border: 3px solid #25304f;
  border-radius: 18px;
  padding: 12px;
  font-weight: 800;
}

.wrong-pair p:first-child {
  background: #fff0f0;
  color: #bd3030;
}

.wrong-pair p:last-child {
  background: #ebfbf2;
  color: #147a50;
}

.wrong-review {
  margin: 16px 0;
  border: 3px dashed #75b7ff;
  border-radius: 20px;
  background: #f7fbff;
  padding: 14px;
}

.wrong-review h4 {
  margin: 4px 0 10px;
  font-size: 18px;
}

.review-question {
  border: 2px solid rgba(37, 48, 79, 0.18);
  border-radius: 16px;
  background: #ffffff;
  padding: 12px;
  margin-bottom: 12px;
}

.review-question h4 {
  margin: 6px 0 10px;
  font-size: 17px;
}

.choice-grid.small {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.empty {
  border: 4px dashed #25304f;
  border-radius: 32px;
  background: white;
  padding: 40px 20px;
  text-align: center;
  box-shadow: 0 8px 0 rgba(37, 48, 79, 0.12);
}

.empty strong {
  display: block;
  font-size: 24px;
}

.empty p {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 920px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  html,
  body,
  #app {
    height: auto;
    min-height: 100%;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
  }

  .top-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-btn {
    min-height: 40px;
    border-width: 2px;
    border-radius: 14px;
    box-shadow: 0 3px 0 #25304f;
    font-size: 12px;
  }

  .shell {
    display: block;
    height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }

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

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

  .cards-grid,
  .choice-grid,
  .game-top,
  .wrong-pair {
    grid-template-columns: 1fr;
  }

  .split-catalog,
  .catalog-card {
    grid-template-columns: 1fr;
  }

  .content {
    overflow: visible;
    padding: 14px;
  }

  .hero {
    min-height: 0;
  }

  .catalog-title {
    font-size: 24px;
  }
}

@media (max-width: 560px) {
  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-width: 3px;
    font-size: 24px;
    box-shadow: 0 5px 0 #25304f;
  }

  .brand strong {
    font-size: 17px;
  }

  .brand small {
    font-size: 11px;
  }

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

  .unit-list {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 25px;
  }

  .hero-text {
    padding: 18px;
  }

  .visual-board {
    padding: 16px;
  }

  .catalog-card {
    border-width: 3px;
    border-radius: 24px;
    box-shadow: 0 6px 0 #25304f;
  }

  .catalog-index {
    gap: 8px;
    padding: 14px;
  }

  .catalog-index span {
    font-size: 16px;
  }

  .catalog-body {
    padding: 14px;
  }

  .action-row {
    width: 100%;
  }

  .action-row .primary,
  .action-row .secondary,
  .action-row .danger {
    width: 100%;
  }

  .panel,
  .question-card,
  .wrong-card {
    border-width: 3px;
    border-radius: 24px;
    box-shadow: 0 6px 0 #25304f;
  }

  .question-card h2 {
    font-size: 21px;
    line-height: 1.45;
  }

  .choice {
    min-height: 58px;
    border-width: 3px;
    font-size: 16px;
  }

  .score-box strong {
    font-size: 24px;
  }

  .star-node {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
}
