:root {
  color-scheme: light;
  --ink: #14211f;
  --muted: #66716b;
  --paper: #f7f4ec;
  --panel: #fffdf7;
  --line: #d8d0c0;
  --teal: #007d76;
  --teal-dark: #005a55;
  --gold: #d5962c;
  --red: #be4b45;
  --green: #247a4f;
  --blue: #315f8f;
  --shadow: 0 18px 50px rgba(29, 42, 38, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", "PingFang SC", sans-serif;
  background:
    linear-gradient(135deg, rgba(0, 125, 118, 0.12), transparent 32%),
    radial-gradient(circle at 92% 8%, rgba(213, 150, 44, 0.22), transparent 26%),
    repeating-linear-gradient(90deg, rgba(20, 33, 31, 0.035) 0 1px, transparent 1px 58px),
    var(--paper);
}

button,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow,
.label {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(20px, 3vw, 31px);
  line-height: 1.15;
}

h3 {
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.28;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 8px;
  min-width: min(380px, 100%);
}

.stat-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.78);
  padding: 10px 12px;
  box-shadow: 0 8px 22px rgba(20, 33, 31, 0.07);
}

.stat-strip span {
  display: block;
  font-size: 25px;
  font-weight: 900;
}

.stat-strip small,
.answer-box small {
  color: var(--muted);
}

.workbench {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.rail {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 253, 247, 0.84);
  box-shadow: var(--shadow);
}

.mode {
  min-height: 54px;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
}

.mode.active {
  color: white;
  background: var(--teal);
}

.panel {
  min-height: 590px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 28px);
  background: rgba(255, 253, 247, 0.93);
  box-shadow: var(--shadow);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

select {
  max-width: 210px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  color: white;
  background: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.question-card,
.flash-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: clamp(16px, 3vw, 28px);
}

.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: left;
  color: var(--ink);
  background: #fbfaf6;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.option:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
}

.option.correct {
  color: white;
  border-color: var(--green);
  background: var(--green);
}

.option.wrong {
  color: white;
  border-color: var(--red);
  background: var(--red);
}

.answer-box {
  margin-top: 18px;
  border-left: 5px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  background: #fff7e4;
}

.answer-box p {
  margin: 6px 0 0;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.primary,
.secondary,
.danger {
  min-height: 46px;
  border-radius: 7px;
  padding: 0 18px;
  font-weight: 900;
}

.primary {
  color: white;
  background: var(--teal);
}

.secondary {
  color: var(--ink);
  background: #eadfca;
}

.danger {
  color: white;
  background: var(--red);
}

.prompt-cn {
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.35;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  resize: vertical;
  background: #fbfaf6;
  line-height: 1.6;
}

.flash-card {
  display: grid;
  place-content: center;
  min-height: 360px;
  text-align: center;
  background:
    linear-gradient(160deg, rgba(0, 125, 118, 0.12), transparent 45%),
    white;
}

.flash-card p {
  color: var(--blue);
  font-weight: 900;
}

.flash-card h3 {
  margin: 0;
  word-break: break-word;
}

.flash-card div {
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.day-card,
.exam-card,
.wrong-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.day-card h3,
.exam-card h3 {
  margin-bottom: 10px;
  color: var(--teal-dark);
  font-size: 20px;
}

.day-card label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 9px 0;
  line-height: 1.45;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

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

.wrong-item h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.wrong-item p {
  margin-bottom: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.source-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 253, 247, 0.82);
}

.source-strip strong {
  font-size: clamp(18px, 3vw, 26px);
}

.figure-row {
  display: flex;
  gap: 8px;
}

.figure-row img {
  width: 66px;
  height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: white;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 18px, 680px);
    padding-top: 12px;
  }

  .topbar,
  .panel-head,
  .source-strip {
    display: grid;
  }

  .stat-strip {
    min-width: 0;
  }

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

  .rail {
    position: static;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 6px;
  }

  .mode {
    min-height: 48px;
    padding: 0 4px;
    font-size: 14px;
  }

  .panel {
    min-height: 0;
  }

  .toolbar,
  .actions {
    width: 100%;
  }

  select {
    flex: 1;
    max-width: none;
  }

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

  .primary,
  .secondary,
  .danger {
    padding: 0 10px;
  }

  .source-strip {
    grid-template-columns: 1fr;
  }

  .figure-row {
    overflow-x: auto;
  }
}
