/* ===========================================================
   硬件设计图盲评系统 —— 样式（深色主题）
   =========================================================== */
:root {
  --bg:        #0f1216;
  --bg-2:      #151a21;
  --panel:     #1a212a;
  --panel-2:   #212a35;
  --line:      #2b3644;
  --line-2:    #3a4757;
  --text:      #e6edf5;
  --text-dim:  #9aa9bb;
  --text-mute: #6b7b8d;
  --brand:     #4c9aff;
  --brand-2:   #2f6fd0;
  --ok:        #3fb950;
  --warn:      #d29922;
  --danger:    #f85149;
  --radius:    10px;
  --radius-sm: 7px;
  --shadow:    0 8px 28px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 600; line-height: 1.35; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p  { margin: 0 0 .8em; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,18,22,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--brand), #7c5cff);
  display: grid; place-items: center; font-size: 14px;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  padding: 6px 13px; border-radius: 999px; color: var(--text-dim);
  font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }
.who {
  font-size: 12.5px; color: var(--text-mute);
  border-left: 1px solid var(--line); padding-left: 14px; white-space: nowrap;
}
.who b { color: var(--text-dim); font-weight: 600; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 72px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { color: var(--text-dim); font-size: 13.5px; margin: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.card.tight { padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { margin-left: auto; }
.card.flat { background: var(--bg-2); }

.stat { text-align: left; }
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; }
.stat .lbl { color: var(--text-dim); font-size: 12.5px; }
.stat.accent .num { color: var(--brand); }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }
.stat.danger .num { color: var(--danger); }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span.lab { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; }
label.field > span.lab .req { color: var(--danger); margin-left: 3px; }
label.field .hint { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(76,154,255,.18);
}
textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
input[type=file] {
  width: 100%; padding: 9px 10px; background: var(--bg);
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 13px; cursor: pointer;
}
input[type=file]:hover { border-color: var(--brand); }
input[type=radio], input[type=checkbox] { accent-color: var(--brand); }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; min-width: 0; }

label.check {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--bg); font-size: 14px; cursor: pointer;
}
label.check:hover { border-color: var(--brand); }
label.check input[type=checkbox] { width: 17px; height: 17px; flex: none; cursor: pointer; }

/* div 形式的字段组（内含单选框等，不能用 label 包裹） */
div.field { display: block; margin-bottom: 14px; }
div.field > span.lab { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; }
div.field > span.lab .req { color: var(--danger); margin-left: 3px; }
div.field .hint { font-size: 12px; color: var(--text-mute); margin-top: 5px; }

/* ---------- 参赛题目选择 / 题目筛选 ---------- */
.topic-pick { display: flex; gap: 10px; flex-wrap: wrap; }
label.topic-opt {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 10px 18px; min-width: 132px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 14px; transition: .15s;
}
label.topic-opt:hover { border-color: var(--brand); }
label.topic-opt input[type=radio] { width: 17px; height: 17px; flex: none; margin: 0; cursor: pointer; }
label.topic-opt:has(input:checked) { border-color: var(--brand); background: rgba(76,154,255,.10); }
label.topic-opt input:checked ~ span { color: #7cb8ff; font-weight: 600; }

.topic-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border-radius: 999px; font-size: 13px; line-height: 1.7;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text-dim);
}
a.chip:hover { border-color: var(--brand); color: var(--text); text-decoration: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip b { font-weight: 600; font-size: 12px; opacity: .9; }

/* ---------- 查分（大号分数） ---------- */
.score-big {
  font-size: 46px; font-weight: 700; letter-spacing: -1.5px;
  line-height: 1.1; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.score-big .unit { font-size: 15px; font-weight: 500; color: var(--text-dim); margin-left: 8px; letter-spacing: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; border: 1px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--brand-2); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text-dim); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #349546; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #d1382f; }
.btn.warn { background: var(--warn); color: #1b1b1b; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }

/* ---------- 提示 ---------- */
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; border: 1px solid; }
.flash.ok     { background: rgba(63,185,80,.10);  border-color: rgba(63,185,80,.35);  color: #7ee787; }
.flash.error  { background: rgba(248,81,73,.10);  border-color: rgba(248,81,73,.35);  color: #ff9d97; }
.flash.warn   { background: rgba(210,153,34,.10); border-color: rgba(210,153,34,.35); color: #e3b341; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.7; border: 1px solid; white-space: nowrap;
}
.badge.blue   { background: rgba(76,154,255,.13); border-color: rgba(76,154,255,.4); color: #7cb8ff; }
.badge.green  { background: rgba(63,185,80,.13);  border-color: rgba(63,185,80,.4);  color: #7ee787; }
.badge.gray   { background: rgba(154,169,187,.10);border-color: rgba(154,169,187,.32);color: #9aa9bb; }
.badge.red    { background: rgba(248,81,73,.13);  border-color: rgba(248,81,73,.4);  color: #ff9d97; }
.badge.yellow { background: rgba(210,153,34,.13); border-color: rgba(210,153,34,.4); color: #e3b341; }
.badge.purple { background: rgba(124,92,255,.15); border-color: rgba(124,92,255,.4); color: #b6a2ff; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--panel-2); color: var(--text-dim); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(76,154,255,.045); }
td.mono, .mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.dim { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mt1 { margin-top: 10px; } .mt2 { margin-top: 20px; } .mt3 { margin-top: 30px; }
.mb1 { margin-bottom: 10px; } .mb2 { margin-bottom: 20px; }

/* ---------- 图片网格 ---------- */
.img-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.img-card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.img-card .thumb {
  display: block; width: 100%; height: 150px; object-fit: cover;
  background: #0a0d11; cursor: zoom-in;
}
.img-card .meta { padding: 7px 10px; font-size: 12px; color: var(--text-dim); }
.img-card .meta .nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-block { margin-bottom: 22px; }
.cat-block > h3 { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 14px; }
.cat-block > h3 .cnt { font-weight: 400; font-size: 12px; color: var(--text-mute); }

.file-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 9px; margin-top: 8px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px;
}
.file-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; flex: none; }
.file-chip-icon { font-size: 20px; flex: none; }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
#previewBox { display: flex; flex-direction: column; }
.preview-box { display: flex; flex-direction: column; }

/* ---------- 多 PCB 板卡 ---------- */
.board-list { display: flex; flex-direction: column; gap: 14px; margin: 0 0 14px; }
.board-block { padding: 14px 16px; border-style: dashed; }
.board-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.board-head .board-name { flex: 1 1 220px; margin-bottom: 0; }
.board-head .board-name input { max-width: 340px; }
.board-tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 600; line-height: 1.6;
  background: rgba(76,154,255,.13); border: 1px solid rgba(76,154,255,.4); color: #7cb8ff;
}
.board-group { border-left: 3px solid rgba(76,154,255,.45); padding-left: 14px; }
.sub-cat { margin: 12px 0 0; }
.sub-cat > h4 {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-mute); font-weight: 600; margin: 0 0 7px;
}
.sub-cat > h4 .cnt { font-weight: 400; }
.sub-title { font-size: 13px; color: var(--text-dim); font-weight: 600; margin: 0 0 8px; }

/* 表单里的已上传缩略条（右上角 ✕ 删除） */
.strip { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 10px; }
.strip-item { position: relative; width: 96px; }
.strip-item img {
  display: block; width: 96px; height: 72px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line); background: #0a0d11; cursor: zoom-in;
}
.strip-del {
  position: absolute; top: -7px; right: -7px; width: 21px; height: 21px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2);
  color: var(--text-dim); font-size: 11px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.strip-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- 空状态 ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--text-mute); }
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; opacity: .6; }

/* ---------- 首页大卡片 ---------- */
.hero {
  padding: 34px 30px; border-radius: 14px; margin-bottom: 24px;
  background: radial-gradient(1000px 260px at 12% -30%, rgba(76,154,255,.22), transparent),
              linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
}
.hero h1 { font-size: 27px; margin-bottom: 8px; }
.hero p { color: var(--text-dim); max-width: 720px; margin: 0; }

.entry {
  display: block; padding: 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); transition: .18s; height: 100%;
}
.entry:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: var(--brand); box-shadow: var(--shadow);
}
.entry .ico { font-size: 26px; display: block; margin-bottom: 10px; }
.entry h3 { margin-bottom: 6px; }
.entry p { color: var(--text-dim); font-size: 13px; margin: 0; }

/* ---------- 流程条 ---------- */
.steps { display: flex; gap: 0; flex-wrap: wrap; margin: 0 0 22px; }
.steps .step {
  flex: 1 1 150px; padding: 10px 14px 10px 22px; position: relative;
  background: var(--panel); border: 1px solid var(--line); border-left: none;
  font-size: 13px; color: var(--text-dim);
}
.steps .step:first-child { border-left: 1px solid var(--line); border-radius: var(--radius) 0 0 var(--radius); }
.steps .step:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.steps .step b { display: block; color: var(--text); font-size: 13.5px; }
.steps .step.done { background: rgba(63,185,80,.08); border-color: rgba(63,185,80,.3); }
.steps .step.done b { color: #7ee787; }
.steps .step.current { background: rgba(76,154,255,.12); border-color: rgba(76,154,255,.45); }
.steps .step.current b { color: #7cb8ff; }

/* ---------- 指纹门页 ---------- */
.gate-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-box { text-align: center; max-width: 420px; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 20px;
  border: 3px solid var(--line-2); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gate-box h1 { font-size: 19px; }
.gate-box p { color: var(--text-dim); font-size: 13.5px; }

/* ---------- 签名 ---------- */
.sign-pad {
  width: 100%; height: 220px; background: #f7f9fc;
  border: 2px dashed var(--line-2); border-radius: var(--radius-sm);
  touch-action: none; cursor: crosshair; display: block;
}
.sign-hint { font-size: 12.5px; color: var(--text-mute); margin-top: 6px; }

/* ---------- 结果横幅 ---------- */
.verdict {
  padding: 16px 20px; border-radius: var(--radius); font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 12px; border: 1px solid;
}
.verdict.yes { background: rgba(63,185,80,.10); border-color: rgba(63,185,80,.4); color: #7ee787; }
.verdict.no  { background: rgba(248,81,73,.10); border-color: rgba(248,81,73,.4); color: #ff9d97; }
.verdict .ic { font-size: 22px; }

.kv { display: grid; grid-template-columns: 118px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; }

/* ---------- 灯箱 ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 30px; cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: var(--shadow); }

/* ---------- 打印（签名确认单） ---------- */
@media print {
  .topbar, .no-print, .btn-row, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .board-block { break-inside: avoid; }
  .board-tag { background: none; border: 1px solid #999; color: #000; }
}

@media (max-width: 640px) {
  .wrap { padding: 16px 13px 60px; }
  .topbar-inner { padding: 8px 13px; gap: 10px; }
  .who { border-left: none; padding-left: 0; width: 100%; }
  .kv { grid-template-columns: 92px 1fr; }
  .hero { padding: 24px 18px; }
}
