:root {
  --blue: #2980b9;
  --blue-d: #1f6690;
  --ink: #24303a;
  --muted: #7a8894;
  --line: #e2e8ee;
  --bg: #f4f7fa;
  --yes: #2e86c1;
  --no: #e59866;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 1360px; margin: 0 auto; padding: 12px 10px 28px; }
.hidden { display: none !important; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 18px rgba(30, 50, 70, 0.06);
}
.center { text-align: center; }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.rules { color: #46545f; line-height: 1.7; padding-left: 20px; }
kbd {
  background: #eef2f6; border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 6px; font-size: 0.8rem;
}
button { cursor: pointer; font-family: inherit; }
.primary {
  margin-top: 18px; background: var(--blue); color: #fff; border: 0;
  border-radius: 10px; padding: 12px 26px; font-size: 1rem; font-weight: 600;
}
.primary:hover { background: var(--blue-d); }
#whoami { margin-top: 16px; }

/* task */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.progress { flex: 1; height: 8px; background: #eaeff4; border-radius: 6px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--blue); transition: width 0.2s; }
.counter { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.imgwrap {
  background: #fbfcfd; border: 1px solid var(--line); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  min-height: 320px; overflow: hidden;
}
.imgwrap img { max-width: 100%; max-height: 62vh; display: block; }
.qbox { margin-top: 20px; }
.question { font-size: 1.18rem; line-height: 1.5; margin: 0 0 20px; font-weight: 500; }
.question-zh { font-size: 1.05rem; line-height: 1.5; margin: -12px 0 20px; color: #55636e; }
.btns { display: flex; gap: 14px; }
.ans {
  flex: 1; border: 0; border-radius: 10px; padding: 16px; font-size: 1.1rem;
  font-weight: 700; color: #fff; position: relative;
}
.ans.yes { background: var(--yes); }
.ans.no { background: var(--no); }
.ans.neutral { background: #90a4ae; }
.ans:hover { filter: brightness(0.94); }
.ans .key {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.7rem; font-weight: 600; opacity: 0.8;
  background: rgba(255, 255, 255, 0.25); border-radius: 4px; padding: 2px 6px;
}

/* study 2: side-by-side comparison */
.question.center { text-align: center; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pane {
  margin: 0; background: #fbfcfd; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
}
.pane figcaption {
  font-weight: 700; color: var(--muted); text-align: center; padding: 6px;
  border-bottom: 1px solid var(--line); background: #f7fafc;
}
.pane img { width: 100%; max-height: 64vh; object-fit: contain; display: block; padding: 4px; }
.pane-judge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: #f8fbfd;
}
.ans.small {
  font-size: 0.95rem;
  padding: 10px 8px;
  border-radius: 8px;
}
.ans.selected {
  outline: 3px solid #1f6690;
  transform: translateY(-1px);
}
.btns.cmp-submit {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}
.btns.cmp-submit .primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.better-q {
  text-align: center; font-weight: 600; margin: 4px 0 8px; color: var(--ink);
}
.btns.cmp-better {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
}
.btns.cmp-better .ans { font-size: 0.95rem; padding: 12px 8px; }

@media (max-width: 600px) {
  .card { padding: 14px; }
  .ans .key { display: none; }
  .pair { grid-template-columns: 1fr; }
}

/* study 3: reference-fidelity (reference vs one generated render) */
.fidpair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.fidpair figure { margin: 0; }
.fidpair figcaption {
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  margin-bottom: 6px; letter-spacing: 0.03em; text-align: center;
}
.fidpair img {
  display: block; width: 100%; max-height: 46vh; object-fit: contain;
  border: 2px solid var(--line); border-radius: 10px; padding: 4px; background: #fff;
}
.fidpair figure:first-child img { border-color: var(--blue); }
@media (max-width: 700px) { .fidpair { grid-template-columns: 1fr; } }
.refrow { text-align: center; margin-bottom: 16px; }
.reflabel {
  display: inline-block; font-size: 0.8rem; font-weight: 700; color: var(--muted);
  margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase;
}
.refimg {
  display: block; margin: 0 auto; max-height: 34vh; max-width: 100%;
  border: 2px solid var(--blue); border-radius: 10px; padding: 4px; background: #fff;
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cell {
  margin: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden;
  cursor: pointer; background: #fbfcfd; transition: border-color 0.12s, transform 0.12s;
}
.cell:hover { border-color: var(--blue); transform: translateY(-2px); }
.cell img { width: 100%; display: block; }
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } }

/* test mode */
.test-badge {
  display: inline-block; background: #b03a2e; color: #fff; font-weight: 700;
  font-size: 0.78rem; padding: 3px 10px; border-radius: 6px; margin-bottom: 10px;
  letter-spacing: 0.03em;
}
.sys-label { color: #b03a2e; font-weight: 700; font-size: 0.85rem; }
.feedback {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 0.95rem;
  line-height: 1.5;
}
.fb-ok { background: #e8f6ef; border: 1px solid #27ae60; color: #1e6b45; }
.fb-bad { background: #fdecea; border: 1px solid #e74c3c; color: #a1362b; }
.fb-neutral { background: #eef2f7; border: 1px solid #90a4b8; color: #37474f; }
/* intro task guide + name entry */
.taskguide { background: #f4f8fb; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 14px 0; text-align: left; }
.taskguide .tg-title { font-weight: 700; margin: 0 0 8px; }
.taskguide ol { margin: 0; padding-left: 20px; }
.taskguide li { margin: 8px 0; line-height: 1.5; }
.taskguide .keys { display: block; margin-top: 4px; font-size: 0.82rem; color: var(--muted); }
.namerow { text-align: left; margin: 16px 0 8px; }
.namerow label { display: block; font-weight: 700; margin-bottom: 6px; }
.namerow input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 1rem;
  border: 2px solid var(--line); border-radius: 10px; outline: none;
}
.namerow input:focus { border-color: var(--blue); }
.namerow input.need { border-color: #e74c3c; background: #fdecea; }
.namerow .namehint { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; }
.s3-note { margin: 8px 0 6px; font-size: 0.82rem; opacity: 0.75; }
.s3-table {
  margin-top: 6px; border-collapse: collapse; font-size: 0.82rem; width: 100%;
  background: #fff; color: #333;
}
.s3-table th, .s3-table td {
  border: 1px solid #dfe4ea; padding: 4px 8px; text-align: center; white-space: nowrap;
}
.s3-table th { background: #f1f4f8; font-weight: 600; }
.s3-table td:first-child, .s3-table th:first-child { text-align: left; }
.s3-table tr.s3-target { background: #e8f6ef; }
.s3-table tr.s3-pick { outline: 2px solid #f39c12; }
.s3-table tr.s3-target.s3-pick { outline: 2px solid #27ae60; }
.scorebox {
  margin-top: 18px; text-align: left; background: #f4f8fb; border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px;
}
.scorebox h3 { margin: 0 0 10px; }
.scorebox p { margin: 6px 0; }
.hl-best { color: #1e8449; font-weight: 800; text-decoration: underline; }
.hl-worst { color: #c0392b; font-weight: 800; text-decoration: underline; }
