/*
 * 配色刻意保持中性灰阶：任何品牌色出现在图片旁边都会干扰对画面的判断。
 */
:root {
  --bg: #12141a;
  --surface: #1b1e26;
  --surface-2: #23262f;
  --line: #313540;
  --text: #eceef2;
  --text-dim: #9aa0ac;
  --accent: #4c8dff;
  --accent-soft: rgba(76, 141, 255, 0.14);
  --canvas: #ebecee;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100vh; }
.screen--center { display: grid; place-items: center; padding: 40px 20px; }
[hidden] { display: none !important; }

/* 盲测页整屏不滚动：顶栏 + 标头 + 图片区（弹性）+ 作答面板 */
#screen-test {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------------------------------------------------------- 卡片 / 开始页 */

.card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
}
.card--wide { max-width: 720px; }

h1 { margin: 0 0 12px; font-size: 22px; letter-spacing: -0.01em; }
.lede { margin: 0 0 20px; color: var(--text-dim); }
.lede b { color: var(--text); font-weight: 600; }
.hint { color: var(--text-dim); font-size: 13px; margin: 10px 0 0; }

.dims { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.dims li {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
}
.dims b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.dims span { color: var(--text-dim); }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; }
.field input,
.field select {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}
/* 去掉系统样式后要自己补箭头，否则看着像普通输入框，没人会去点 */
.field select {
  appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238b90a0' stroke-width='1.6' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field input:focus,
.field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* 名字和职位并排，避免开始页因为多一个字段而变长 */
.field-row { display: grid; grid-template-columns: 1fr 130px; gap: 12px; }
.field-row .field { margin-bottom: 18px; }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover:not(:disabled) { background: #2b2f3a; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn--primary:hover:not(:disabled) { background: #3f7ff0; }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.btn--tiny { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------ 顶部进度 */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar__progress { flex: 1; display: flex; align-items: center; gap: 14px; }
.topbar__progress > span { font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.tag { font-size: 13px; color: var(--text-dim); }

.bar { flex: 1; height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar__fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.25s; }

/* ------------------------------------------------------------ 图片舞台 */

.heads {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 5px 16px 0;
}
.head {
  text-align: center;
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

/* 图片区吃掉剩余高度；min-height:0 让内部网格能被压缩而不是把面板顶出屏幕 */
.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 间隔必须明显大于套图内部的 8px，否则分不清哪几张属于哪一边 */
  gap: 40px;
  padding: 6px 16px;
  /* 居中的分隔线，进一步区分两套图 */
  background: linear-gradient(var(--line), var(--line)) center / 1px 100% no-repeat;
}

/* 行列数与格子尺寸由 app.js 按图片长宽比精算后写成内联样式，这里只是加载中的占位 */
.set {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  grid-template-rows: repeat(var(--rows, 2), 1fr);
  gap: 8px;
  min-height: 0;
  justify-content: center;
  align-content: center;
}
.set figure {
  margin: 0;
  min-height: 0;
  min-width: 0;
  cursor: zoom-in;
  border-radius: 6px;
  overflow: hidden;
  /* 深色占位：未加载时一眼看出是「加载中」，不会被误当成空白图 */
  background: var(--surface-2);
}
/* contain 让不同长宽比的图都完整可见，同时保证整屏不溢出 */
.set img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: var(--canvas);
}
.set figure.is-missing { background: var(--surface-2); cursor: default; }

/* --------------------------------------------------------- 底部作答面板 */

.panel {
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 9px 16px;
}
/* 整组图加载完才可作答：避免一边已显示、另一边还在加载时就投票 */
.panel.is-loading { opacity: 0.45; pointer-events: none; }
.panel__rows { flex: 1; display: grid; gap: 3px; }
.panel__side {
  flex: none;
  width: 168px;
  display: grid;
  gap: 4px;
  justify-items: center;
}
.panel__side .btn { width: 100%; padding: 8px 14px; }
.panel__side .hint { margin: 0; text-align: center; font-size: 11.5px; line-height: 1.3; }

.row {
  display: grid;
  grid-template-columns: 92px 1fr 1fr 1fr;
  align-items: center;
  gap: 8px;
}
/* 维度解释改成 title 悬停提示，换来更矮的面板和更大的图 */
.row__label { font-size: 13px; cursor: help; white-space: nowrap; }

.choice {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-dim);
  border-radius: 7px;
  padding: 4px 12px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  justify-content: center;
}
/* 「差不多」要能选但不该显眼，否则会变成省事的默认答案 */
.choice--tie { background: transparent; }
.choice:hover { background: #2b2f3a; color: var(--text); }
.choice[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
.choice kbd {
  font: inherit;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  min-width: 18px;
  text-align: center;
}
.choice[aria-pressed="true"] kbd { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------ 完成 / 汇总 */

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }

.stats { margin-top: 22px; display: grid; gap: 22px; }
.stats h2 { font-size: 15px; margin: 0 0 10px; }
.stats table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stats th, .stats td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.stats th { color: var(--text-dim); font-weight: 500; }
.stats td { font-variant-numeric: tabular-nums; }
.stats .meter { display: flex; align-items: center; gap: 8px; }
.stats .meter__bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.stats .meter__fill { height: 100%; background: var(--accent); }

/* ------------------------------------------------------------- 放大查看 */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 11, 14, 0.94);
  display: grid;
  place-items: center;
  padding: 24px;
  cursor: zoom-out;
  overflow: auto;
}
.lightbox img { max-width: min(1400px, 100%); height: auto; border-radius: 8px; }
/* 高清图还在路上时先用网格图顶着，轻微降透明度暗示「还会更清晰」 */
.lightbox img.is-preview { opacity: 0.82; }

@media (max-width: 900px) {
  /* 窄屏放不下并排的标签，让它独占一行 */
  .row { grid-template-columns: repeat(3, 1fr); }
  .row__label { grid-column: 1 / -1; }
  .card { padding: 24px; }
}
