:root {
  color-scheme: light;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e5e4;
  --paper: #f7f4ef;
  --panel: #fffcf8;
  --pass: #166534;
  --pass-bg: #dcfce7;
  --fail: #991b1b;
  --fail-bg: #fee2e2;
  --na: #1e3a5f;
  --na-bg: #e0e7ff;
  --accent: #9a3412;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
button, input { font: inherit; }
button { cursor: pointer; }
.shell { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 12px 18px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.brand, .top-actions { display: flex; align-items: center; gap: 10px; }
.brand strong, .brand span { display: block; }
.brand span, .muted { color: var(--muted); font-size: 13px; }
.mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; background: var(--ink); color: white; font-weight: 700;
}
.progress-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.track { height: 8px; background: #e7e5e4; border-radius: 99px; overflow: hidden; }
#progressBar { height: 100%; width: 0; background: var(--accent); }
.quiet {
  border: 1px solid var(--line); background: white; color: var(--ink);
  border-radius: 999px; padding: 8px 12px;
}
.quiet:disabled { opacity: 0.45; cursor: default; }
.work {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.75fr);
}
.poster-panel, .question-panel { min-height: 0; display: flex; flex-direction: column; }
.poster-toolbar, .question-body, .decisions { padding: 14px 16px; }
.poster-toolbar { display: flex; align-items: center; gap: 12px; }
#viewHint { flex: 1; }
.zoom { display: flex; gap: 6px; }
.zoom button, .choice kbd {
  border: 1px solid var(--line); background: white; border-radius: 8px; min-width: 36px; height: 32px;
}
.stage {
  position: relative; flex: 1; margin: 0 16px 16px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background:
    linear-gradient(45deg, #ece7df 25%, transparent 25%),
    linear-gradient(-45deg, #ece7df 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ece7df 75%),
    linear-gradient(-45deg, transparent 75%, #ece7df 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-color: #f3efe8;
  touch-action: none;
}
#poster {
  position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%;
  object-fit: contain; transform-origin: center center; user-select: none;
}
.stage.zoomed { cursor: grab; }
.stage.dragging { cursor: grabbing; }
.loading {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted);
}
.question-panel { background: var(--panel); border-left: 1px solid var(--line); }
.question-body { flex: 1; overflow: auto; }
.group {
  display: inline-block; padding: 4px 8px; border-radius: 999px;
  background: #ffedd5; color: #9a3412; font-size: 13px; font-weight: 700;
}
h1 { margin: 14px 0 12px; font-size: 26px; line-height: 1.35; font-weight: 700; }
.criteria { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.criteria li { display: grid; grid-template-columns: 9.5em 1fr; gap: 8px; align-items: start; padding: 8px 10px; border-radius: 10px; line-height: 1.55; }
.criteria span { font-size: 13px; font-weight: 700; }
.criteria p { margin: 0; }
.pass-line { background: var(--pass-bg); color: var(--pass); }
.na-line { background: var(--na-bg); color: var(--na); }
.fail-line { background: var(--fail-bg); color: var(--fail); }
.decisions { border-top: 1px solid var(--line); }
.decisions p { margin: 0 0 10px; }
.buttons { display: grid; grid-template-columns: 1fr; gap: 8px; }
.choice {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; border-radius: 12px; border: 1px solid transparent; font-size: 16px; font-weight: 700;
}
.choice kbd {
  display: inline-grid; place-items: center; padding: 0 6px; font-family: inherit;
}
.fail { background: var(--fail-bg); color: var(--fail); }
.na { background: var(--na-bg); color: var(--na); }
.pass { background: var(--pass-bg); color: var(--pass); }
.choice:disabled { opacity: 0.5; }
.done { flex: 1; display: grid; place-items: center; text-align: center; }
.done h1 { font-size: 36px; }
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(28, 25, 23, 0.46); padding: 20px;
}
.card {
  width: min(460px, 100%); background: white; border-radius: 18px; padding: 28px;
  box-shadow: 0 20px 60px rgba(28, 25, 23, 0.18);
}
.eyebrow { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.lead { color: var(--muted); line-height: 1.6; }
label { display: block; margin: 14px 0 6px; font-size: 14px; }
input {
  width: 100%; border: 1px solid #d6d3d1; border-radius: 10px; padding: 12px 14px; background: white;
}
.enter {
  width: 100%; margin-top: 18px; border: 0; border-radius: 12px; padding: 12px;
  background: var(--ink); color: white; font-weight: 700;
}
.error { color: var(--fail); }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: var(--ink); color: white; border-radius: 999px; padding: 10px 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  .topbar, .work { grid-template-columns: 1fr; }
  .question-panel { border-left: 0; border-top: 1px solid var(--line); }
  .stage { height: 62vh; }
  h1 { font-size: 22px; }
}
