:root {
  color-scheme: light dark;
  --bg: #f7f5f0;
  --surface: #fffdf8;
  --text: #1c2422;
  --dim: #6b7a76;
  --border: #ddd8cc;
  --accent: #0f3d3e;
  --accent-text: #ffffff;
  --danger: #c2402a;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101614;
    --surface: #1a211f;
    --text: #ece9e0;
    --dim: #93a39e;
    --border: #2e3835;
    --accent: #7fc4bd;
    --accent-text: #0c1a19;
    --danger: #e0785f;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; min-height: 2rem; }
input, select, textarea {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.45rem 0.7rem;
}
textarea { width: 100%; }
button {
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
button:disabled { opacity: 0.5; cursor: default; }
.btn-accent { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 500; }
.btn-danger-outline { border-color: var(--danger); color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--dim); }
.wrap { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.wrap-narrow { max-width: 36rem; margin: 0 auto; padding: 2.5rem 1rem 4rem; }
.wrap-mid { max-width: 48rem; margin: 0 auto; padding: 2rem 1rem 4rem; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0; }
.dim { color: var(--dim); }
.small { font-size: 0.85rem; }
.xsmall { font-size: 0.75rem; }
.error { color: var(--danger); font-size: 0.9rem; }
.card { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
label.lbl { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 0.25rem; }
.field input, .field select { width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; }
thead tr.head { border-bottom: 2px solid var(--accent); }
tbody tr { border-bottom: 1px solid var(--border); }
.scroll-x { overflow-x: auto; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 500; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center; padding: 0 1rem;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--surface); border-radius: var(--radius); padding: 1.25rem;
  width: 100%; max-height: 92vh; overflow-y: auto;
}
.chip {
  display: inline-block; padding: 0.1rem 0.45rem; font-size: 0.75rem; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.chip-solid { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip-danger { border-color: var(--danger); color: var(--danger); }
.rank-dot { display: inline-block; width: 0.85rem; height: 0.85rem; border: 1px solid rgba(0,0,0,0.2); border-radius: 3px; vertical-align: -0.1rem; margin-right: 0.3rem; }
.tree-children { margin: 0.35rem 0 0.35rem 1rem; padding-left: 0.9rem; border-left: 2px solid var(--border); }
@media (min-width: 640px) { .tree-children { margin-left: 1.5rem; padding-left: 1rem; } }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain > li + li { margin-top: 0.4rem; }
.eval-btn { text-align: left; }
.eval-btn.selected { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
input[type="color"] { padding: 0.15rem; height: 2.3rem; width: 3.5rem; }
.notice { border: 1px solid var(--accent); border-radius: var(--radius); padding: 0.6rem 0.8rem; font-size: 0.9rem; }
