﻿/* ============================================================
   SCAN STATION 鈥?娣辫壊宸ヤ笟 HUD 涓婚
   ============================================================ */
:root {
  --bg-0: #07090d;
  --bg-1: #0c1016;
  --bg-2: #121823;
  --panel: rgba(18, 24, 35, 0.86);
  --line: rgba(120, 200, 170, 0.16);
  --line-strong: rgba(120, 220, 185, 0.42);
  --accent: #38f2b0;          /* 鑽у厜闈掔豢 */
  --accent-dim: rgba(56, 242, 176, 0.14);
  --accent-glow: rgba(56, 242, 176, 0.45);
  --amber: #ffb54a;
  --amber-dim: rgba(255, 181, 74, 0.14);
  --danger: #ff5d6c;
  --text: #e8f3ee;
  --text-dim: #8ba39a;
  --text-faint: #5a6f68;
  --mono: 'Cascadia Mono', 'Consolas', 'JetBrains Mono', monospace;
  --sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(56, 242, 176, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255, 181, 74, 0.05), transparent 55%),
    var(--bg-0);
  min-height: 100vh;
  overflow-x: hidden;
}

/* 缃戞牸搴曠汗 */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(120, 200, 170, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 200, 170, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
  z-index: 0;
}

/* ============ 椤舵爮 ============ */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12,16,22,0.92), rgba(12,16,22,0.55));
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  font-size: 30px; color: var(--accent);
  text-shadow: 0 0 18px var(--accent-glow);
  animation: pulse-mark 3s ease-in-out infinite;
}
@keyframes pulse-mark {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.brand-text h1 { font-size: 20px; font-weight: 700; letter-spacing: 3px; }
.brand-text p {
  font-family: var(--mono); font-size: 10px; color: var(--text-faint);
  letter-spacing: 4px; margin-top: 2px;
}

.status-cluster { display: flex; gap: 10px; }

.status-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--line); color: var(--text-dim);
  background: var(--bg-1);
  transition: all .25s;
}
.status-chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3a4a44; transition: all .25s;
}
.status-chip[data-state="on"] { border-color: var(--line-strong); color: var(--text); }
.status-chip[data-state="on"] .dot {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
.status-chip[data-state="err"] { border-color: rgba(255, 93, 108, 0.5); color: var(--danger); }
.status-chip[data-state="err"] .dot { background: var(--danger); box-shadow: 0 0 10px rgba(255,93,108,.5); }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ============ 甯冨眬 ============ */
.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  padding: 18px 26px 26px;
  max-width: 1600px;
  margin: 0 auto;
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}

/* ============ 鍗＄墖閫氱敤 ============ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
  animation: card-in .55s ease both;
}
.card:nth-child(2) { animation-delay: .08s; }
.card:nth-child(3) { animation-delay: .16s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 13px;
}
.card-head h2 { font-size: 14px; font-weight: 600; letter-spacing: 2px; color: var(--text); }
.card-head h2::before {
  content: '鈻?; color: var(--accent); margin-right: 8px;
  text-shadow: 0 0 10px var(--accent-glow);
}
.head-tools { display: flex; gap: 8px; }

/* ============ 鎸夐挳 ============ */
.icon-btn {
  background: var(--bg-2); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 8px;
  width: 32px; height: 32px; font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--line-strong); background: var(--accent-dim); }
.icon-btn:active { transform: scale(0.92); }
/* 寮€鍏冲紑鍚€侊紙濡傞棯鍏夌伅浜捣锛?*/
.icon-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse-dot 1.6s ease-in-out infinite;
}
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn:disabled:hover { color: var(--text-dim); border-color: var(--line); background: var(--bg-2); }

.btn-primary {
  background: var(--accent); color: #04120c;
  border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 14px; font-weight: 700; letter-spacing: 1px;
  cursor: pointer; transition: all .2s;
  box-shadow: 0 0 20px rgba(56, 242, 176, 0.25);
}
.btn-primary:hover { box-shadow: 0 0 30px var(--accent-glow); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; font-size: 12px; letter-spacing: 1px; cursor: pointer;
  text-decoration: none; transition: all .2s;
}
.btn-ghost:hover:not(:disabled) { color: var(--accent); border-color: var(--line-strong); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ 鎵爜鍖?============ */
.viewport {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line-strong);
}
.viewport video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform-origin: center center;
  transition: transform .08s linear;
}

/* 鍙栨櫙妗?*/
.finder {
  position: absolute; inset: 0;
  pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.finder::before {
  content: '';
  width: 68%; height: 52%;
  border: 2px solid rgba(56, 242, 176, 0.55);
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(56, 242, 176, 0.22), inset 0 0 24px rgba(56, 242, 176, 0.12);
}
.corner {
  position: absolute; width: 26px; height: 26px;
  border: 3px solid var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.corner.tl { top: 10%; left: 12%; border-right: none; border-bottom: none; border-radius: 6px 0 0 0; }
.corner.tr { top: 10%; right: 12%; border-left: none; border-bottom: none; border-radius: 0 6px 0 0; }
.corner.bl { bottom: 10%; left: 12%; border-right: none; border-top: none; border-radius: 0 0 0 6px; }
.corner.br { bottom: 10%; right: 12%; border-left: none; border-top: none; border-radius: 0 0 6px 0; }

/* 鎵弿绾?*/
.scanline {
  position: absolute; left: 13%; right: 13%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 16px var(--accent-glow);
  animation: scan 2.4s ease-in-out infinite;
  opacity: 0;
}
.viewport.scanning .scanline { opacity: 1; }
@keyframes scan {
  0%   { top: 12%; }
  50%  { top: 88%; }
  100% { top: 12%; }
}

.finder-label {
  position: absolute; bottom: 8%;
  font-family: var(--mono); font-size: 10px; letter-spacing: 3px;
  color: var(--text-dim);
  background: rgba(7, 9, 13, 0.6);
  padding: 4px 12px; border-radius: 999px;
}

/* 閬僵 */
.viewport-overlay {
  position: absolute; inset: 0;
  background: rgba(7, 9, 13, 0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  transition: opacity .3s;
}
.viewport-overlay.hidden { opacity: 0; pointer-events: none; }
.overlay-inner { text-align: center; animation: card-in .5s ease both; }
.overlay-icon { font-size: 44px; color: var(--accent); display: block; margin-bottom: 12px; text-shadow: 0 0 30px var(--accent-glow); }
.overlay-inner p { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; letter-spacing: 1px; }

/* 鍙樼劍鏉?*/
.zoom-bar {
  position: relative; /* 不再悬浮于取景框内，放在下方流式布局 */
  display: flex; align-items: center; gap: 10px;
  background: rgba(7, 9, 13, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  margin-top: 12px;
  backdrop-filter: blur(4px);
  transition: opacity .3s;
}
.zoom-bar.hidden { opacity: 0; pointer-events: none; }
.zoom-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-2); color: var(--accent);
  border: 1px solid var(--line-strong); font-size: 16px; line-height: 1;
  cursor: pointer; transition: all .2s;
}
.zoom-btn:hover { background: var(--accent-dim); }
.zoom-btn:active { transform: scale(0.9); }
.zoom-track { flex: 1; height: 5px; border-radius: 999px; background: var(--bg-2); overflow: hidden; cursor: pointer; }
.zoom-fill {
  height: 100%; width: 20%;
  background: linear-gradient(90deg, var(--accent), #7dffd0);
  box-shadow: 0 0 10px var(--accent-glow);
  border-radius: 999px;
}
.zoom-pct { font-family: var(--mono); font-size: 11px; color: var(--accent); min-width: 42px; text-align: right; }

/* 鎵爜鍏冧俊鎭?*/
.scan-meta {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: 13px; padding: 10px 14px;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px;
}
.meta-item { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.meta-item i { font-style: normal; color: var(--accent); }
.meta-item b { font-family: var(--mono); color: var(--text); font-weight: 600; }

/* ============ 涓垪 ============ */
.mid-col { display: flex; flex-direction: column; gap: 16px; }

.input-row { display: flex; gap: 10px; }
.input-row input {
  flex: 1;
  background: var(--bg-1); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 14px; font-size: 14px; font-family: var(--mono);
  outline: none; transition: all .2s;
}
.input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.input-hint { margin-top: 9px; font-size: 11px; color: var(--text-faint); line-height: 1.6; }

/* GPS */
.gps-live {
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  color: var(--amber); border: 1px solid rgba(255, 181, 74, 0.4);
  padding: 2px 9px; border-radius: 999px; margin-left: 8px;
  letter-spacing: 1px;
}
.gps-live.locked { color: var(--accent); border-color: var(--line-strong); }

.gps-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.gps-cell {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.gps-k { display: block; font-size: 10px; color: var(--text-faint); letter-spacing: 2px; margin-bottom: 5px; }
.gps-v {
  display: block; font-family: var(--mono); font-size: 16px; color: var(--accent);
  text-shadow: 0 0 12px rgba(56, 242, 176, 0.25);
}
.gps-actions { display: flex; gap: 10px; margin-top: 12px; }
.gps-actions .btn-ghost { flex: 1; }
.gps-err { margin-top: 10px; font-size: 12px; color: var(--danger); min-height: 16px; }

/* ============ 缁撴灉鍒楄〃 ============ */
.results-card { display: flex; flex-direction: column; min-height: 420px; max-height: calc(100vh - 140px); }
.res-count {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  background: var(--accent-dim); border-radius: 999px;
  padding: 2px 10px; margin-left: 8px;
}
.results-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }

.results-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-faint); min-height: 300px;
}
.empty-mark { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-sub { font-size: 11px; margin-top: 6px; letter-spacing: 1px; }

/* 缁撴灉鍗＄墖 */
.result-item {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  animation: item-in .4s ease both;
}
@keyframes item-in {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}
.result-item.fresh { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-dim); }
.result-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.result-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 1px;
  padding: 2px 8px; border-radius: 4px;
  background: var(--accent-dim); color: var(--accent);
}
.result-tag.manual { background: var(--amber-dim); color: var(--amber); }
.result-time { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-left: auto; }
.result-code {
  font-family: var(--mono); font-size: 15px; color: var(--text);
  word-break: break-all; line-height: 1.45;
  padding: 6px 10px; background: #0a0e14; border-radius: 6px;
}
.result-geo { margin-top: 8px; font-family: var(--mono); font-size: 10px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.result-geo .geo-chip { color: var(--amber); }

/* 闂厜灞?*/
.flash {
  position: fixed; inset: 0; z-index: 99;
  background: radial-gradient(circle, rgba(56,242,176,0.5), transparent 70%);
  opacity: 0; pointer-events: none;
}
.flash.go { animation: flash-go .5s ease; }
@keyframes flash-go {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============ 搴曟爮 ============ */
.footbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 26px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 2px;
  color: var(--text-faint);
  border-top: 1px solid var(--line);
}
.foot-sep { color: var(--line-strong); }

/* 婊氬姩鏉?*/
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: #24313a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============ 璇婃柇闈㈡澘 ============ */
.diag-toggle {
  position: fixed; right: 14px; bottom: 14px; z-index: 98;
  background: rgba(7,9,13,0.85); color: var(--accent);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 8px 14px; font-size: 12px; letter-spacing: 1px; cursor: pointer;
  backdrop-filter: blur(4px);
}
.diag-toggle:hover { box-shadow: 0 0 12px var(--accent-glow); }
.diag-panel {
  position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 97;
  background: rgba(7,9,13,0.94); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 10px 12px;
  backdrop-filter: blur(6px);
  max-height: 62vh; overflow-y: auto;
}
.diag-head {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: 2px;
  margin-bottom: 8px;
}
.diag-head button {
  background: transparent; color: var(--text-dim); border: none;
  font-size: 14px; cursor: pointer;
}
.diag-content {
  font-family: var(--mono); font-size: 11px; color: #9fe8cf;
  white-space: pre-wrap; word-break: break-all; line-height: 1.5;
}

/* ============ 鐗堟湰鍙峰窘绔?============ */
.ver-badge {
  color: var(--amber);
  background: var(--amber-dim);
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 1px;
}

/* ============ 鍥剧墖瀵煎叆娴嬭瘯 ============ */
.imgtest-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imgtest-hint { font-size: 11px; color: var(--text-faint); }
.img-preview-wrap {
  margin-top: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 8px;
  background: var(--bg-1);
}
.img-preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin: 0 auto;
  border-radius: 6px;
}
.img-result {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
  font-family: var(--mono);
}
.img-result.ok { color: var(--accent); }
.img-result.fail { color: var(--danger); }

/* ============ 鎷嶇収蹇収 ============ */
.capture-wrap {
  margin-top: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-1);
}
.capture-head {
  font-size: 12px; color: var(--text); letter-spacing: 1px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.capture-hint { font-size: 10px; color: var(--text-faint); }
.capture-preview {
  display: block; max-width: 100%;
  max-height: 260px; margin: 0 auto;
  border-radius: 6px;
  background: #000;
}
.capture-status {
  margin-top: 8px; font-family: var(--mono); font-size: 12px;
  word-break: break-all; line-height: 1.5;
}
.capture-status.ok { color: var(--accent); }
.capture-status.fail { color: var(--danger); }
