/* ============================================================
   找不同 · 多人在线对战  全局样式
   ============================================================ */
:root {
  --bg: #070b16;
  --bg2: #0d1424;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-solid: #111a2c;
  --border: rgba(255, 255, 255, 0.12);
  --text: #eaf1ff;
  --muted: #93a2be;
  --accent: #38bdf8;
  --green: #22c55e;
  --red: #f43f5e;
  --amber: #fbbf24;
  --radius: 16px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #16294a 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #12233d 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.3; font-weight: 700; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; color: var(--muted); }

.wrap { width: min(1120px, 94vw); margin: 0 auto; padding: 24px 0 60px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- 通用组件 ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.035));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(14px);
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #38bdf8, #2563eb); border-color: transparent; }
.btn-primary:hover { background: linear-gradient(135deg, #4cc9ff, #2f6ff5); }
.btn-green { background: linear-gradient(135deg, #34d399, #16a34a); border-color: transparent; }
.btn-green:hover { background: linear-gradient(135deg, #3ee3a6, #18b355); }
.btn-danger { background: rgba(244, 63, 94, 0.16); border-color: rgba(244, 63, 94, 0.45); color: #ffc2cd; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 15px 34px; font-size: 18px; border-radius: 14px; width: 100%; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"] {
  width: 100%;
  background: rgba(8, 14, 26, 0.72);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 15px;
  outline: none;
}
input:focus { border-color: rgba(56, 189, 248, 0.65); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15); }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.1); border: 1px solid var(--border); color: var(--muted);
}
.badge.green { background: rgba(34,197,94,.16); color: #86efac; border-color: rgba(34,197,94,.4); }
.badge.amber { background: rgba(251,191,36,.16); color: #fcd34d; border-color: rgba(251,191,36,.4); }
.badge.red { background: rgba(244,63,94,.16); color: #fda4af; border-color: rgba(244,63,94,.4); }
.badge.blue { background: rgba(56,189,248,.16); color: #7dd3fc; border-color: rgba(56,189,248,.4); }

.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ---------- 首页 ---------- */
.hero { padding: 48px 0 20px; text-align: center; }
.hero .logo { font-size: 44px; margin-bottom: 6px; }
.hero h1 { font-size: 32px; letter-spacing: 1px; }
.hero p { max-width: 560px; margin: 0 auto 26px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.home-card { display: block; padding: 26px; border-radius: var(--radius); text-decoration: none; color: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid var(--border); transition: transform .15s, border-color .15s; }
.home-card:hover { transform: translateY(-3px); border-color: rgba(56,189,248,.5); }
.home-card .ico { font-size: 30px; }
.home-card h3 { margin-top: 10px; }
.code-form { display: flex; gap: 10px; margin-top: 14px; }
.code-form input { text-transform: uppercase; letter-spacing: 2px; text-align: center; font-weight: 700; }

/* ---------- 管理端 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .5px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-title h3 { margin: 0; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,.08); }
table.data th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
table.data tr:last-child td { border-bottom: none; }
.table-scroll { max-height: 320px; overflow: auto; }

.qr-box { text-align: center; padding: 12px; background: #fff; border-radius: 14px; }
.qr-box img { width: 100%; max-width: 190px; display: block; margin: 0 auto; }
.join-url { word-break: break-all; font-size: 12.5px; color: var(--accent); }

/* 标注编辑器 */
.editor {
  position: relative;
  width: 100%;
  background: #0a1222 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16'><path d='M0 0h8v8H0z' fill='%23131c2e'/><path d='M8 8h8v8H8z' fill='%23131c2e'/></svg>") repeat;
  border-radius: 12px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
  border: 1px dashed var(--border);
  touch-action: manipulation;
}
.editor img { max-width: 100%; max-height: 62vh; display: block; user-select: none; -webkit-user-drag: none; cursor: crosshair; }
.editor .mk-layer { position: absolute; }
.editor .mk-layer .mk {
  position: absolute; transform: translate(-50%, -50%);
  border: 2px solid rgba(56, 189, 248, .95);
  border-radius: 50%;
  background: rgba(56, 189, 248, .16);
  box-shadow: 0 0 0 2px rgba(0,0,0,.35);
  cursor: grab;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 800;
}
.editor .mk-layer .mk.active { border-color: var(--amber); background: rgba(251,191,36,.25); }
.editor .mk-layer .mk.pending { border-color: rgba(244,63,94,.7); }

/* 管理端：参照图 + 对比图并排对照 */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-grid .editor { min-height: 160px; }
.compare-grid .editor img { max-height: 44vh; }
.compare-grid #refView img { cursor: default; }
.editor .ed-label {
  position: absolute; top: 6px; left: 8px; z-index: 3;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(6, 12, 24, .75); color: var(--muted);
  border: 1px solid var(--border); backdrop-filter: blur(6px);
}
@media (max-width: 1100px) { .compare-grid { grid-template-columns: 1fr; } }

/* ---------- 选手端 ---------- */
.player-page { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
.p-shell { height: 100dvh; display: flex; flex-direction: column; padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); gap: 8px; }

.p-head { display: flex; gap: 8px; }
.p-stat {
  flex: 1; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px 8px; text-align: center;
}
.p-stat span { display: block; font-size: 11px; color: var(--muted); line-height: 1.2; }
.p-stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.p-stat.warn b { color: var(--amber); }

.imgbox {
  position: relative; flex: 1; min-height: 0; touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.imgbox .label {
  position: absolute; top: 6px; left: 8px; z-index: 3;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(6, 12, 24, .7); color: var(--muted);
  border: 1px solid var(--border); backdrop-filter: blur(6px);
}
.imgbox img { position: absolute; display: block; user-select: none; -webkit-user-drag: none; }
.mk-layer { position: absolute; pointer-events: none; }
.mk-layer .hit, .mk-layer .miss {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.mk-layer .hit { border: 2.5px solid var(--green); background: rgba(34,197,94,.18);
  box-shadow: 0 0 14px rgba(34,197,94,.55); animation: pop .35s ease; pointer-events: auto; }
.mk-layer .miss { border: 2.5px solid var(--red); background: rgba(244,63,94,.18);
  color: #fff; animation: missFade 1.3s ease forwards; pointer-events: none; }
@keyframes pop { 0% { transform: translate(-50%,-50%) scale(.4); opacity: 0 } 100% { transform: translate(-50%,-50%) scale(1); opacity: 1 } }
@keyframes missFade {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.5) }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.1) }
  70% { opacity: 1; transform: translate(-50%,-50%) scale(1) }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.25) }
}

.lock-mask {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(6, 11, 22, .72);
  backdrop-filter: blur(10px);
  text-align: center; padding: 20px;
}
.lock-mask .ico { font-size: 34px; }
.lock-mask .t { font-size: 15px; color: var(--text); font-weight: 600; }
.lock-mask .s { font-size: 12.5px; color: var(--muted); max-width: 240px; }

.startbar { padding: 2px 0; }

/* 覆盖式状态页 */
.screen {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 22px;
  background: radial-gradient(800px 500px at 50% 0%, #14264a, transparent 70%), rgba(5, 9, 18, .92);
  backdrop-filter: blur(8px);
}
.screen .card { width: min(440px, 94vw); text-align: center; }
.screen.hidden, .hidden { display: none !important; }

.pulse { width: 54px; height: 54px; border-radius: 50%; margin: 6px auto 16px;
  border: 2px solid rgba(56,189,248,.4); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid var(--accent); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.9); opacity: .9 } 100% { transform: scale(1.5); opacity: 0 } }

.result-big { font-size: 42px; font-weight: 800; letter-spacing: 1px; }
.result-big span { font-size: 16px; color: var(--muted); font-weight: 500; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.kv div { background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px; }
.kv span { display: block; font-size: 11px; color: var(--muted); }
.kv b { font-size: 20px; font-variant-numeric: tabular-nums; }

.mini-board { margin-top: 16px; text-align: left; max-height: 220px; overflow: auto; }
.mini-board .item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; }
.mini-board .item:nth-child(odd) { background: rgba(255,255,255,.05); }
.mini-board .rk { width: 22px; color: var(--amber); font-weight: 800; }
.mini-board .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-board .tm { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 大屏榜 ---------- */
.board-page { background: #04070f; overflow: hidden; }
.board-wrap {
  width: min(1560px, 96vw); height: 100dvh; margin: 0 auto;
  padding: 16px 0 20px; display: flex; flex-direction: column;
}
.board-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px; margin-bottom: 8px; flex: 0 0 auto; }
.board-head h1 { font-size: clamp(20px, 2.4vw, 38px); margin-bottom: 2px; }
.board-ref { display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 0 1 auto; min-height: 0; margin: 4px 0 10px; }
.board-ref img { max-height: 24vh; max-width: 100%; object-fit: contain;
  border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.ref-label { font-size: 12px; letter-spacing: 2px; color: var(--muted); }

.board-list { flex: 1; min-height: 0; display: grid; gap: 7px; align-content: start; overflow: auto; }
.board-list.two-col { grid-auto-flow: column; grid-template-columns: 1fr 1fr; }
.board-row { display: grid; grid-template-columns: 54px 1fr 112px 104px 96px; align-items: center;
  gap: 10px; padding: 8px 16px; border-radius: 11px;
  background: linear-gradient(90deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  border: 1px solid var(--border); font-size: clamp(12px, 1.1vw, 16px); }
.board-list.two-col .board-row { grid-template-columns: 42px 1fr 84px 76px 72px;
  font-size: clamp(12px, .92vw, 14px); padding: 7px 12px; }
.board-row.top1 { background: linear-gradient(90deg, rgba(251,191,36,.28), rgba(251,191,36,.06)); border-color: rgba(251,191,36,.55); }
.board-row .rk { font-size: 1.25em; font-weight: 800; }
.board-row .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.board-row .num em { font-style: normal; font-size: .66em; color: var(--muted); margin-left: 4px; }
.award-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: rgba(251,191,36,.18); border: 1px solid rgba(251,191,36,.5); color: #fcd34d;
  font-size: .7em; font-weight: 700; vertical-align: middle; }
.mini-board .award-tag { font-size: .66em; margin-left: 4px; padding: 0 5px; }

/* 管理端奖项编辑行 */
.award-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 0; border-bottom: 1px dashed var(--border); }
.award-row input { background: rgba(255,255,255,.06); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 6px 9px; font-size: 13px; width: 150px; }
.award-row input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 720px) {
  .board-wrap { padding: 10px 0 14px; }
  .board-ref img { max-height: 26vh; }
  .board-list.two-col { grid-template-columns: 1fr; grid-auto-flow: row; grid-template-rows: none !important; }
  .board-row, .board-list.two-col .board-row { grid-template-columns: 34px 1fr 78px 64px; font-size: 13px; padding: 8px 10px; }
  .board-row .hide-sm { display: none; }
}
