:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #172033;
  --muted: #66758a;
  --line: #d7e0ea;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --blue: #2563eb;
  --red: #dc2626;
  --amber: #b45309;
  --green-soft: #e7f7f3;
  --blue-soft: #eaf1ff;
  --red-soft: #fff1f2;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

html,
body {
  width: 100%;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  font-size: 20px;
}

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

.brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.mode-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  text-align: left;
  background: transparent;
  color: #344054;
  font-weight: 700;
}

.nav-item span,
.nav-item small {
  display: block;
}

.nav-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.nav-item.active,
.mode-button.active {
  background: var(--green-soft);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--accent-strong);
}

.nav-item.active small {
  color: var(--accent-strong);
}

.sidebar-panel,
.metric,
.panel,
.tool-panel,
.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
}

.sidebar-panel strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

.sidebar-panel small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.6;
}

.label,
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.topbar h1,
.panel h2 {
  margin: 4px 0 0;
  line-height: 1.2;
}

.topbar h1 {
  font-size: 34px;
}

.top-actions,
.button-row,
.question-actions,
.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.secondary-action {
  color: var(--muted);
}

.danger-button {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.wide {
  width: 100%;
  justify-content: center;
}

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

.metric {
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-card {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f0faf8 100%);
  box-shadow: var(--shadow);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  margin-bottom: 14px;
}

.goal-card,
.readiness-card,
.section-intro,
.exam-shortcuts {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.goal-card,
.readiness-card {
  padding: 18px;
}

.subject-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.subject-tab {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.subject-tab.active {
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 6px 18px rgba(23, 32, 51, 0.08);
}

.goal-card h2 {
  margin: 6px 0 8px;
  font-size: 28px;
  line-height: 1.25;
}

.goal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.readiness-card {
  display: grid;
  align-content: start;
  gap: 10px;
}

.readiness-card strong {
  display: block;
  font-size: 34px;
}

.readiness-card small {
  color: var(--muted);
  line-height: 1.6;
}

.quick-entry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}

.quick-entry button,
.exam-shortcuts button {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  text-align: left;
}

.quick-entry strong,
.quick-entry span,
.exam-shortcuts strong,
.exam-shortcuts span {
  display: block;
}

.quick-entry span,
.exam-shortcuts span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.section-intro {
  margin-bottom: 14px;
  padding: 14px 16px;
}

.section-intro strong,
.section-intro span {
  display: block;
}

.section-intro span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

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

.hero-card h2 {
  margin: 6px 0 8px;
  max-width: 740px;
  font-size: 28px;
  line-height: 1.25;
}

.hero-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.plan-card,
.sprint-card {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  text-align: left;
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.06);
}

.plan-card strong,
.sprint-card strong {
  display: block;
  font-size: 19px;
  line-height: 1.25;
}

.plan-card span,
.sprint-card span,
.plan-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.plan-card em {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 12px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.plan-card.active,
.sprint-card.active {
  border-color: rgba(15, 118, 110, 0.42);
  background: var(--green-soft);
}

.plan-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.plan-pill {
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

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

.plan-pill span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

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

.formula-item {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.formula-item strong {
  display: block;
  margin-bottom: 8px;
}

.formula-item span {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.sprint-intro {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.panel {
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="number"],
input[type="search"],
input[type="file"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--text);
}

.progress-ring {
  width: 70px;
  height: 70px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) 0deg, var(--line) 0deg);
  color: var(--text);
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.day-row,
.focus-item,
.coverage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.day-row strong,
.focus-item strong {
  display: block;
}

.day-row span,
.focus-item span,
.coverage-item span {
  color: var(--muted);
  font-size: 13px;
}

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

.tool-panel {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 14px;
  box-shadow: var(--shadow);
}

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

.toggle-list label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
}

.question-panel {
  min-width: 0;
}

.question-card {
  overflow: hidden;
  box-shadow: var(--shadow);
}

.question-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  background: #fff7ed;
  color: var(--amber);
}

.badge.good {
  background: var(--green-soft);
  color: var(--accent-strong);
}

.question-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.55;
}

.favorite-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--amber);
  font-size: 22px;
  line-height: 1;
}

.question-media {
  padding: 18px 18px 0;
}

.question-media img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.options {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.option {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
}

.option .letter {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  font-weight: 800;
}

.option.selected {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--blue-soft);
}

.option.correct {
  border-color: rgba(15, 118, 110, 0.55);
  background: var(--green-soft);
}

.option.wrong {
  border-color: rgba(220, 38, 38, 0.5);
  background: var(--red-soft);
}

.answer-panel {
  margin: 0 18px 18px;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.answer-panel strong {
  display: block;
  margin-bottom: 8px;
}

.answer-panel p {
  margin: 0;
  color: #475467;
  line-height: 1.7;
}

.question-actions {
  justify-content: space-between;
  padding: 0 18px 18px;
}

.empty {
  padding: 36px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 20px;
}

.empty p {
  margin: 0 0 16px;
  line-height: 1.7;
}

.hint-box,
.body-copy {
  color: var(--muted);
  line-height: 1.7;
}

.hint-box {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.exam-layout {
  display: grid;
  gap: 18px;
}

.exam-live {
  display: grid;
  gap: 14px;
}

.exam-bar {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exam-bar span {
  color: var(--red);
  font-weight: 900;
  font-size: 20px;
}

.exam-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-cell {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.sheet-cell.done {
  background: var(--green-soft);
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--accent-strong);
}

.schema {
  margin: 16px 0 0;
  max-height: 280px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.55;
}

.coverage {
  display: grid;
  gap: 10px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  min-height: 42px;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    padding: 12px 14px;
    z-index: 20;
  }

  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
  }

  .nav-item {
    width: 100%;
    min-height: 48px;
    min-width: 0;
    padding: 4px 2px;
    text-align: center;
    border-radius: 8px;
    font-size: 13px;
  }

  .nav-item small {
    display: none;
  }

  .nav-item[data-view="manage"] {
    display: none;
  }

  .nav-item[data-view="sprint"] {
    display: none;
  }

  .sidebar-panel {
    display: none;
  }

  .main {
    padding: 18px 14px 92px;
  }

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

  .plan-grid,
  .sprint-intro,
  .quick-entry,
  .exam-shortcuts,
  .home-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .formula-list,
  .plan-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell,
  .main,
  .view,
  .hero-card,
  .home-hero,
  .goal-card,
  .readiness-card,
  .metrics,
  .quick-entry,
  .plan-grid,
  .split,
  .workspace,
  .panel,
  .tool-panel,
  .question-card,
  .sprint-intro {
    max-width: 100%;
    min-width: 0;
  }

  .main {
    width: 100%;
    overflow: hidden;
    padding-left: 14px;
    padding-right: 14px;
  }

  .goal-card,
  .readiness-card,
  .subject-switch,
  .home-actions,
  .quick-entry button,
  .exam-shortcuts button,
  .metric,
  .plan-card,
  .sprint-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .subject-tab {
    min-width: 0;
    padding-left: 4px;
    padding-right: 4px;
  }

  .topbar,
  .exam-bar,
  .question-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .secondary-action {
    display: none;
  }

  .hero-card {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .hero-card h2 {
    font-size: 23px;
  }

  .hero-card h2,
  .hero-card p,
  .goal-card h2,
  .goal-card p,
  .plan-card strong,
  .plan-card span,
  .sprint-card strong,
  .sprint-card span {
    overflow-wrap: anywhere;
    word-break: break-all;
  }

  .hero-card .primary-button {
    width: 100%;
  }

  .top-actions,
  .button-row,
  .pager {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-actions button,
  .button-row button,
  .pager button {
    width: 100%;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  .metrics,
  .daily-grid,
  .plan-grid,
  .sprint-intro,
  .quick-entry,
  .home-hero,
  .exam-shortcuts {
    grid-template-columns: 1fr;
  }

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

  .goal-card h2 {
    font-size: 24px;
  }

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

  .metric {
    min-height: 70px;
    padding: 10px 8px;
  }

  .metric span {
    font-size: 11px;
  }

  .metric strong {
    margin-top: 6px;
    font-size: 22px;
  }

  .nav-item {
    font-size: 12px;
  }

  .question-title {
    font-size: 19px;
  }

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

  .sidebar-panel small {
    display: none;
  }
}
