:root {
  --paper: #f2eddf;
  --ink: #1e1c17;
  --muted: #6d6659;
  --line: #d2c2a5;
  --panel: #fffaf0;
  --accent: #ad3425;
  --accent-dark: #742116;
  --green: #237653;
  --gold: #d8a83e;
  --shadow: 0 20px 48px rgba(54, 40, 18, 0.14);
  --soft: #f8ead6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(173, 52, 37, 0.12), transparent 28rem),
    radial-gradient(circle at 90% 12%, rgba(35, 118, 83, 0.12), transparent 30rem),
    linear-gradient(90deg, rgba(30, 28, 23, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(30, 28, 23, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: auto, auto, 36px 36px, 36px 36px, auto;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

button,
textarea,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.08em;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-family: "STSong", "SimSun", Georgia, serif;
  max-width: 780px;
  font-size: 48px;
  line-height: 1.08;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 360px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.92);
  padding: 12px;
  box-shadow: var(--shadow);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.dot.ok {
  background: var(--green);
}

.status strong {
  margin-left: auto;
  color: var(--accent-dark);
}

.status strong + strong {
  margin-left: 0;
}

.protocol-warning {
  border: 1px solid var(--accent);
  background: #fff1e8;
  color: var(--accent-dark);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-weight: 700;
}

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

.overview div {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.84);
  padding: 14px;
  box-shadow: 0 10px 28px rgba(54, 40, 18, 0.08);
}

.overview span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.overview strong {
  display: block;
  font-size: 18px;
}

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

.sidebar,
.main-panel,
.evidence-panel {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 16px;
  padding: 12px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

select,
input {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  padding: 12px;
  line-height: 1.7;
  resize: vertical;
}

.mode-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.mode {
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  min-height: 44px;
  padding: 8px 10px;
}

.mode:hover,
.mode.active {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-dark);
}

.speed-card {
  border-top: 2px solid var(--ink);
  padding-top: 12px;
}

.speed-card span,
.speed-card small {
  display: block;
  color: var(--muted);
}

.speed-card strong {
  display: block;
  margin: 8px 0;
  font-size: 26px;
}

.hint-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 12px;
  line-height: 1.65;
}

.hint-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.main-panel {
  padding: 18px;
  min-height: 680px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.view-head p {
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.65;
}

.primary,
.ghost {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--accent-dark);
}

.primary {
  background: var(--accent);
  color: #fffaf0;
}

.ghost {
  background: transparent;
  color: var(--accent-dark);
}

.primary:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.exercise,
.recite-card,
.import-plan {
  border-top: 2px solid var(--ink);
  padding-top: 16px;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.meta-row span {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 6px 8px;
  color: var(--accent-dark);
  font-size: 13px;
}

.exercise h3,
.recite-card h3 {
  margin-bottom: 14px;
  font-size: 22px;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.feedback {
  border: 1px solid var(--line);
  background: #fffdf8;
  min-height: 120px;
  padding: 12px;
  line-height: 1.7;
}

.feedback:empty {
  display: none;
}

.score-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.score-line strong {
  font-size: 28px;
  color: var(--accent-dark);
}

.path {
  color: var(--green);
  margin: 0 0 8px;
}

.memory {
  white-space: pre-wrap;
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 12px;
  line-height: 1.7;
}

.hidden {
  display: none;
}

.search-input {
  margin-bottom: 12px;
}

.import-plan {
  line-height: 1.8;
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

pre {
  overflow: auto;
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 12px;
}

.evidence-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 14px;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.hit,
.empty {
  border: 1px solid var(--line);
  background: #fffdf8;
  padding: 12px;
}

.hit {
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.hit:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: #fffaf3;
}

.hit header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.hit small {
  display: block;
  margin: 6px 0;
  color: var(--green);
}

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

@media (max-width: 1180px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .evidence-panel {
    position: static;
    max-height: none;
  }

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

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

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 720px);
  }

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

  h1 {
    font-size: 31px;
  }

  .status {
    min-width: 0;
    flex-wrap: wrap;
  }

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