:root {
  --bg: #ebe4d8;
  --ink: #16181d;
  --muted: #6d645b;
  --line: rgba(22, 24, 29, 0.1);
  --card: rgba(255, 252, 247, 0.94);
  --gold: #9a7844;
  --gold-soft: #f4ecdf;
  --seal: #8c3430;
  --deep: #12151b;
  --deep-2: #1c212b;
  --ok: #1c4f48;
  --ok-bg: #e7f2ee;
  --warn: #8a4518;
  --warn-bg: #fff1e4;
  --shadow: 0 18px 50px rgba(28, 22, 14, 0.08);
  --serif: "Palatino Linotype", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(156, 120, 68, 0.18), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(140, 52, 48, 0.08), transparent 55%),
    var(--bg);
  font-family: var(--sans);
  line-height: 1.7;
  letter-spacing: 0.01em;
}
::selection { background: #e7d3ae; color: var(--ink); }
a { color: var(--ok); text-decoration: none; }
a:hover { color: var(--seal); }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 6vw;
  position: sticky;
  top: 0;
  z-index: 20;
  color: #f6f1e8;
  background: rgba(18, 21, 27, 0.92);
  border-bottom: 1px solid rgba(201, 164, 106, 0.35);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #f6f1e8;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.12em;
  text-decoration: none;
}
.brand small {
  display: block;
  margin-top: 1px;
  color: rgba(246, 241, 232, 0.62);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
}
.seal {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(201, 164, 106, 0.85);
  color: #e7d3ae;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  box-shadow: inset 0 0 0 4px rgba(201, 164, 106, 0.15);
}
nav { display: flex; gap: 8px; }
nav a {
  color: rgba(246, 241, 232, 0.78);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
}
nav a:hover, nav a.active {
  color: #1c212b;
  background: #f3eadc;
}
main { width: min(1160px, calc(100% - 32px)); margin: 36px auto 48px; }
.foot {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
}
.page-head { margin-bottom: 22px; max-width: 760px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
}
h1 {
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: 0.02em;
  text-wrap: balance;
}
h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 12px;
  text-wrap: balance;
}
.lede { color: var(--muted); margin: 0; max-width: 640px; font-size: 16px; }
.grid { display: grid; grid-template-columns: 380px 1fr; gap: 22px; align-items: start; margin-top: 26px; }
.card, .panel, .auth {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card { padding: 22px; }
.panel { padding: 26px; }
.card h2, .panel h2 { font-size: 24px; }
.subjects, .choices { display: flex; flex-wrap: wrap; gap: 8px; }
.subjects label, .choices label {
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.subjects input, .choices input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.subjects label:has(input:checked), .choices label:has(input:checked) {
  border-color: transparent;
  background: var(--deep);
  color: #f6f1e8;
  font-weight: 700;
}
label.field, .field {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 16px 0 8px;
}
select, input[type="text"], input[type="password"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  outline: none;
}
select:focus, input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  border-color: rgba(154, 120, 68, 0.7);
  box-shadow: 0 0 0 4px rgba(154, 120, 68, 0.12);
}
textarea { min-height: 148px; resize: vertical; }
input[type="file"] { width: 100%; font: inherit; color: var(--muted); }
.drop {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 92px;
  padding: 16px 16px 16px 18px;
  border-radius: 16px;
  border: 1px dashed rgba(154, 120, 68, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.4), rgba(244, 236, 223, 0.7));
  cursor: pointer;
  overflow: hidden;
}
.drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.drop strong { display: block; font-size: 15px; letter-spacing: 0; }
.drop small { display: block; margin-top: 2px; color: var(--muted); letter-spacing: 0; font-size: 13px; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--deep);
  color: #f6f1e8;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { background: #2a3140; color: #fff; }
button.secondary, .button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.secondary:hover, .button.secondary:hover { background: #fff; color: var(--ink); }
button.danger {
  background: transparent;
  color: var(--seal);
  border: 1px solid rgba(140, 52, 48, 0.25);
  min-height: 36px;
  padding: 6px 12px;
}
button.danger:hover { background: #fff6f4; color: var(--seal); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.banner, .warn, .note, .ok {
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.banner, .warn { background: var(--warn-bg); color: var(--warn); }
.note { background: var(--gold-soft); color: #5c4a32; }
.ok { background: var(--ok-bg); color: var(--ok); }
.answer-plate {
  margin: 8px 0 18px;
  padding: 18px 20px 8px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #fff, #f8f1e6);
  border: 1px solid rgba(154, 120, 68, 0.22);
}
.answer {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.45;
  margin: 6px 0 12px;
}
.meta { color: var(--muted); font-size: 13px; letter-spacing: 0; }
.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hit + .hit, .block + .block { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.hit {
  padding: 14px 0 2px;
}
img.formula {
  max-width: min(100%, 520px);
  max-height: 240px;
  vertical-align: middle;
  background: white;
  border-radius: 8px;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 18px; }
.stats .card { padding: 16px 18px; box-shadow: none; }
.stats strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
th:first-child, td:first-child { white-space: nowrap; width: 7rem; }
tbody tr:hover td { background: rgba(244, 236, 223, 0.45); }
img.shot {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #1c212b;
  border-radius: 16px;
  margin-bottom: 16px;
}
th { color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; }
.tag, .pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  background: #f3eee6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}
.pill { margin-left: 8px; vertical-align: 3px; }
.pill.same, .tag.trained { background: var(--ok-bg); color: var(--ok); }
.pill.similar, .tag.failed, .tag.skipped { background: var(--warn-bg); color: var(--warn); }
.pill.none { background: #efeae2; color: var(--muted); }
#ai-box {
  margin-top: 8px;
  padding: 18px 18px 8px;
  border-radius: 18px;
  background: var(--deep);
  color: #f6f1e8;
}
#ai-box h2, #ai-box .meta { color: #f6f1e8; }
#ai-box .pill.none { background: rgba(246, 241, 232, 0.12); color: #f6f1e8; }
#ai-body {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.85;
  padding-bottom: 12px;
}
#ai-status:empty { display: none; }
.empty-steps { margin: 18px 0 0; padding: 0; list-style: none; }
.empty-steps li {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.empty-steps span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--serif);
  font-weight: 700;
}
.log {
  white-space: pre-wrap;
  background: var(--deep);
  color: #f4efe6;
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 16px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
}
.pager { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.two { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 18px; }
.preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.stack { margin-top: 18px; }
code {
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.92em;
  background: var(--gold-soft);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}
.page-auth main {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
}
.auth { width: min(440px, 100%); padding: 34px 32px 26px; }
.auth h1 { font-size: 36px; }
@media (max-width: 860px) {
  .top { padding: 12px 16px; }
  .brand { font-size: 18px; letter-spacing: 0.08em; }
  .brand small { display: none; }
  nav a { padding: 8px 10px; font-size: 13px; }
  main { margin-top: 22px; }
  h1 { font-size: 30px; }
  .grid, .two, .stats { grid-template-columns: 1fr; }
  .card, .panel, .auth { border-radius: 18px; }
  .answer { font-size: 28px; }
}
