:root {
  --ink: #1f2430;
  --muted: #697386;
  --line: #d9e1ec;
  --paper: #fbfcff;
  --panel: #ffffff;
  --green: #2e7d60;
  --teal: #1e7b8a;
  --rose: #b75162;
  --gold: #b7791f;
  --blue: #315f9f;
  --shadow: 0 18px 50px rgba(31, 36, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(46, 125, 96, 0.14), transparent 30rem),
    linear-gradient(135deg, #f6f8fb 0%, #eef4f1 52%, #f7f2ed 100%);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.25rem;
  color: #ffffff;
  background: #22313f;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.5rem;
  font-weight: 800;
  background: #f2c15f;
  color: #22313f;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.module-panel h3,
.insight-panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 1.2rem;
}

.brand p,
.tab small,
.today-box small,
.streak small,
.eyebrow,
.section-head small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
}

.subject-tabs {
  display: grid;
  gap: 0.7rem;
}

.tab {
  display: grid;
  grid-template-columns: 2.3rem 1fr;
  align-items: center;
  gap: 0.35rem 0.75rem;
  width: 100%;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.5rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.tab span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.4rem;
  color: #22313f;
  background: #ffffff;
  font-weight: 800;
}

.tab.active {
  background: #ffffff;
  color: var(--ink);
}

.tab.active small {
  color: var(--muted);
}

.today-box {
  margin-top: auto;
  padding: 1rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
}

.today-box strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.6rem;
}

.progress-track {
  height: 0.55rem;
  margin-top: 0.9rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #f2c15f;
  transition: width 0.25s ease;
}

.learning-area {
  padding: 1.25rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar h2 {
  font-size: clamp(1.55rem, 2.6vw, 2.4rem);
}

.learning-area .eyebrow,
.section-head small {
  color: var(--muted);
}

.streak {
  min-width: 7rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  text-align: right;
}

.streak strong {
  display: block;
  font-size: 1.4rem;
}

.timer-panel {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.timer-face span {
  display: block;
  font-size: clamp(2.2rem, 7vw, 4rem);
  font-weight: 800;
  line-height: 1;
}

.timer-face small {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
}

.timer-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.text-btn {
  min-height: 2.6rem;
  border-radius: 0.45rem;
  border: 1px solid transparent;
  padding: 0 1rem;
  font-weight: 700;
}

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

.ghost-btn,
.icon-btn {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.icon-btn {
  width: 2.8rem;
  padding: 0;
}

.text-btn {
  min-height: 2rem;
  padding: 0 0.2rem;
  color: var(--blue);
  background: transparent;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1rem;
  margin-top: 1rem;
}

.module-panel,
.insight-panel {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.module-panel {
  padding: 1rem;
}

.insight-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 1rem;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.section-head h3 {
  font-size: 1.15rem;
}

.section-head.compact {
  align-items: center;
}

.knowledge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.knowledge-pill {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #2c3a4b;
  background: #f5f8fb;
  font-size: 0.86rem;
}

.prompt-box {
  padding: 1rem;
  border-left: 0.35rem solid var(--teal);
  border-radius: 0.35rem;
  background: #eef8f8;
  line-height: 1.75;
}

.prompt-box p {
  margin: 0;
}

.choices {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 2.8rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #ffffff;
  text-align: left;
}

.choice.selected {
  border-color: var(--green);
  background: #edf7f2;
}

.answer-area {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  padding: 0.85rem;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.7;
}

.coach-reply {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.45rem;
  background: #fff8e6;
  color: #553b10;
  line-height: 1.75;
}

.coach-reply.show {
  display: block;
}

.skill-bars {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.skill-bar label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.bar-track {
  height: 0.6rem;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 20%;
  border-radius: inherit;
  background: var(--rose);
}

.wrong-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
  max-height: 16rem;
  overflow: auto;
}

.wrong-item {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #ffffff;
}

.wrong-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

.wrong-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.empty {
  color: var(--muted);
  line-height: 1.6;
}

.week-dots {
  display: grid;
  grid-template-columns: repeat(7, minmax(2rem, 1fr));
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.day-dot {
  display: grid;
  place-items: center;
  min-height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.82rem;
}

.day-dot.done {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

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

  .sidebar {
    position: static;
  }

  .subject-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .today-box {
    margin-top: 0;
  }

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

@media (max-width: 640px) {
  .learning-area,
  .sidebar {
    padding: 0.85rem;
  }

  .subject-tabs,
  .timer-panel {
    grid-template-columns: 1fr;
  }

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

  .streak {
    text-align: left;
  }

  .timer-actions .primary-btn,
  .timer-actions .ghost-btn,
  .action-row .primary-btn,
  .action-row .ghost-btn {
    flex: 1 1 8rem;
  }
}
