:root {
  --paper: #f3efe4;
  --paper-2: #e7e0d1;
  --ink: #1c2428;
  --muted: #5c675f;
  --line: #d5cbb8;
  --seal: #9c2f2a;
  --seal-dark: #74221e;
  --celadon: #1f6a56;
  --card: #fffdf8;
  --shadow: 0 10px 30px rgba(48, 36, 22, 0.06);
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "PMingLiU", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(156, 47, 42, 0.08), transparent 50%),
    linear-gradient(180deg, #f7f3ea 0%, var(--paper) 240px);
  min-height: 100vh;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--seal-dark); }

.shell { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.seal {
  width: 52px; height: 52px;
  border: 2px solid var(--seal);
  color: var(--seal);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0;
  transform: rotate(-8deg);
  background: rgba(156, 47, 42, 0.04);
}
.brand h1 { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: 0.08em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.note { color: var(--muted); font-size: 12px; max-width: 360px; line-height: 1.5; }

.subjects, .nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip, .nav button, .btn, .btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
}
.chip.active, .nav button.active { background: var(--ink); color: #f6f1e6; border-color: var(--ink); }
.btn { background: var(--seal); color: #fffaf4; border-color: var(--seal); border-radius: 8px; }
.btn:hover { background: var(--seal-dark); }
.btn-ghost { border-radius: 8px; background: var(--card); }
.btn.small, .btn-ghost.small { padding: 4px 8px; font-size: 13px; }

.layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin-top: 16px; }
.layout.single { grid-template-columns: 1fr; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}
textarea { min-height: 88px; width: 100%; }

.paper-list { display: flex; flex-direction: column; gap: 10px; }
.paper {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
}
.paper:hover { border-color: #c4b49a; }
.paper h3 { margin: 0 0 6px; font-size: 16px; }
.meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; color: var(--celadon);
}

.question { border-top: 1px dashed var(--line); padding: 12px 0; }
.question header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.stem { line-height: 1.7; }
.options { margin: 8px 0 0; padding: 0; list-style: none; }
.options li { padding: 3px 0; }
.answer {
  background: #e7f0ea;
  border-left: 3px solid var(--celadon);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
}
.figure { margin-top: 8px; }
.muted { color: var(--muted); }
.warn { color: var(--seal-dark); font-size: 13px; }
.error { background: #fdecea; color: #74221e; padding: 10px 12px; border-radius: 8px; }

.tree { list-style: none; margin: 0; padding-left: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 14px; border-left: 1px solid var(--line); }
.tree button.link {
  background: none; border: 0; padding: 3px 0; text-align: left; width: 100%;
}
.tree button.link:hover, .tree button.link.on { color: var(--seal-dark); }
.node-type { color: var(--muted); font-size: 12px; margin-right: 4px; }

.basket { position: sticky; top: 12px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 12px; }
.footer { margin-top: 28px; color: var(--muted); font-size: 12px; }
.login-card { max-width: 420px; margin: 28px auto; display: grid; gap: 10px; }
.login-card h2 { margin: 0; font-family: var(--serif); }

@media (max-width: 860px) {
  .layout, .split { grid-template-columns: 1fr; }
  .brand h1 { font-size: 26px; }
  .note { display: none; }
}
