:root {
  --bg: #07090d;
  --surface: #11151c;
  --elevated: #171d26;
  --line: #2b3744;
  --text: #f2f7f5;
  --muted: #91a4aa;
  --cyan: #00e5ff;
  --magenta: #ff3ca6;
  --acid: #c7ff4a;
  --amber: #ffc857;
  --danger: #ff5f56;
  color-scheme: dark;
  font-family: Consolas, "Microsoft YaHei UI", "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: var(--bg); }
body.scan-guide-open { overflow: hidden; }
body::before {
  position: fixed; inset: 0; z-index: 0; content: ""; pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(0,229,255,.045) 32px),
    repeating-linear-gradient(90deg, transparent 0, transparent 31px, rgba(255,60,166,.035) 32px);
  opacity: .65;
}

button, input { font: inherit; min-height: 46px; border-radius: 2px; }
button { padding: 0 16px; font-weight: 800; color: #001014; cursor: pointer; background: var(--cyan); border: 1px solid var(--cyan); }
button:hover:not(:disabled) { color: #101500; background: var(--acid); border-color: var(--acid); }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
input { width: 100%; padding: 0 14px; color: var(--text); background: #090d13; border: 1px solid #334354; outline: none; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(0,229,255,.18); }

.app-shell { position: relative; z-index: 1; width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 44px; }
.cyber-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 10px 0 18px; margin-bottom: 24px; border-bottom: 1px solid var(--cyan); }
.cyber-header::after { position: absolute; right: 0; bottom: -2px; width: 34%; height: 3px; content: ""; background: var(--magenta); }
.cyber-kicker { margin: 0 0 8px; color: var(--cyan); font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-size: 32px; line-height: 1.2; overflow-wrap: anywhere; }
.system-state { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 9px; padding: 8px 10px; color: var(--amber); font-size: 12px; font-weight: 700; background: rgba(255,200,87,.06); border: 1px solid rgba(255,200,87,.55); }
.system-state::before { width: 8px; height: 8px; content: ""; background: currentColor; box-shadow: 0 0 12px currentColor; }
.system-state.online { color: var(--acid); background: rgba(199,255,74,.06); border-color: rgba(199,255,74,.55); }
.system-state.offline { color: var(--magenta); background: rgba(255,60,166,.06); border-color: rgba(255,60,166,.55); }

.lookup-bar { padding: 14px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--cyan); }
.lookup-bar label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.lookup-controls { display: grid; grid-template-columns: minmax(0,1fr) 210px; gap: 12px; }

.workspace-grid, .device-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.workspace-grid { grid-template-columns: minmax(0,3fr) minmax(320px,2fr); }
.device-grid { grid-template-columns: minmax(0,1fr); }
.panel { min-width: 0; padding: 16px; background: rgba(17,21,28,.96); border: 1px solid var(--line); border-radius: 4px; }
.panel-status { box-shadow: inset 3px 0 0 var(--acid); }
.panel-qr { box-shadow: inset 3px 0 0 var(--magenta); }
.panel-device { box-shadow: inset 3px 0 0 var(--cyan); }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 9px; margin-bottom: 12px; border-bottom: 1px solid #26313c; }
.panel-heading h2 { margin: 0; font-size: 16px; line-height: 1.3; }
.panel-heading span { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.status-badge { padding: 3px 8px; border: 1px solid currentColor; }
.status-badge.waiting { color: var(--muted); }
.status-badge.valid { color: var(--acid); }
.status-badge.expired { color: var(--amber); }
.status-badge.scanned { color: var(--cyan); }
.status-badge.requested { color: var(--magenta); }

.status-output { min-height: 330px; padding: 16px; margin: 0; color: var(--text); font: inherit; font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; background: #090d13; border: 1px solid #26313c; }
.status-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px,1fr)); gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.status-meta span { display: flex; flex-direction: column; gap: 4px; }
.status-meta b { color: var(--text); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }

.image-stage { position: relative; display: grid; place-items: center; width: 100%; min-height: 330px; padding: 0; overflow: hidden; font: inherit; color: inherit; background: #090d13; border: 1px solid #26313c; border-radius: 2px; cursor: zoom-in; }
.image-stage:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.image-stage img { display: block; width: 100%; height: 100%; max-height: 430px; object-fit: contain; }
.empty-state { display: block; color: #4c5a68; font-size: 12px; font-weight: 700; }
.secondary-button { width: 100%; margin-top: 10px; color: var(--text); background: var(--elevated); border-color: var(--line); }
.secondary-button:hover:not(:disabled) { color: #101500; background: var(--acid); border-color: var(--acid); }

.device-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.device-stats div { padding: 10px; background: #090d13; border: 1px solid #26313c; }
.device-stats span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.device-stats b { font-size: 13px; overflow-wrap: anywhere; }
.device-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

.scan-guide { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: rgba(3,5,8,.92); }
.scan-guide-panel { width: min(860px,100%); padding: 22px; background: var(--surface); border: 1px solid var(--cyan); border-top: 4px solid var(--cyan); border-radius: 4px; box-shadow: 10px 10px 0 rgba(255,60,166,.2); }
.scan-guide-heading { padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.scan-guide-heading p { margin: 0 0 6px; color: var(--cyan); font-size: 12px; font-weight: 700; }
.scan-guide-heading h2 { margin: 0; font-size: 22px; line-height: 1.35; }
.scan-guide-methods { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.scan-guide-method { min-width: 0; padding: 10px; margin: 0; background: #090d13; border: 1px solid var(--line); border-radius: 4px; }
.scan-guide-method figcaption { min-height: 52px; padding: 10px 4px 2px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.scan-guide-method strong { display: block; color: var(--text); font-size: 14px; }
.scan-guide-notice { padding: 11px 14px; margin: 16px 0 12px; color: var(--amber); font-size: 15px; font-weight: 800; text-align: center; background: rgba(255,200,87,.08); border: 1px solid rgba(255,200,87,.55); }
.scan-guide-confirm { display: block; width: min(260px,100%); margin: 0 auto; }

.guide-art { position: relative; display: grid; place-items: center; height: 170px; overflow: hidden; background: linear-gradient(135deg,#0d1420,#111a24); border: 1px solid #23313d; }
.guide-phone, .guide-monitor { position: relative; border: 2px solid var(--cyan); background: #061016; box-shadow: 0 0 18px rgba(0,229,255,.18); }
.guide-phone { width: 58px; height: 112px; border-radius: 8px; }
.guide-phone.big { width: 68px; height: 128px; }
.guide-phone.small { width: 50px; height: 96px; }
.guide-phone span { position: absolute; left: 10px; right: 10px; height: 7px; background: var(--magenta); opacity: .8; }
.guide-phone span:nth-child(1) { top: 18px; } .guide-phone span:nth-child(2) { top: 34px; background: var(--acid); } .guide-phone span:nth-child(3) { top: 50px; }
.guide-monitor { width: 110px; height: 78px; display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; padding: 10px; }
.guide-monitor i { display: block; background: repeating-linear-gradient(90deg,var(--cyan) 0 5px,transparent 5px 9px); opacity: .7; }
.guide-wave { position: absolute; width: 72px; height: 72px; border: 2px solid var(--amber); border-radius: 50%; opacity: .75; animation: wave 2.2s ease-out infinite; }
@keyframes wave { from { transform: scale(.35); opacity: .9; } to { transform: scale(1.4); opacity: .12; } }
.guide-art-screen { grid-template-columns: 1fr auto 1.4fr; gap: 18px; }
.guide-art-phone { grid-template-columns: 1fr auto 1fr; gap: 18px; }

.qr-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(2,4,7,.94); cursor: zoom-out; }
.qr-modal img { display: block; width: min(92vw,900px); max-height: 88vh; object-fit: contain; background: #fff; border: 2px solid var(--cyan); }
.qr-modal p { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.qr-modal-close { position: fixed; top: 18px; right: 18px; width: 44px; min-height: 44px; padding: 0; font-size: 26px; color: var(--text); background: var(--elevated); border-color: var(--line); }

@media (max-width: 760px) {
  .scan-guide { display: block; padding: 12px; }
  .scan-guide-panel { padding: 14px; box-shadow: 5px 5px 0 rgba(255,60,166,.2); }
  .scan-guide-heading h2 { font-size: 18px; }
  .scan-guide-methods { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .scan-guide-method { display: grid; grid-template-columns: minmax(120px,42%) minmax(0,1fr); align-items: center; }
  .scan-guide-method figcaption { min-height: 0; padding: 8px 10px; }
  .scan-guide-notice { margin: 12px 0 10px; font-size: 14px; }
  .app-shell { width: min(100% - 24px,1120px); padding: 16px 0 28px; }
  .cyber-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  h1 { font-size: 25px; }
  .lookup-controls, .workspace-grid, .device-stats, .status-meta { grid-template-columns: minmax(0,1fr); }
  .panel { padding: 13px; }
  .status-output, .image-stage { min-height: 220px; }
  .guide-art { height: 120px; }
}

/* 尊重系统的"减少动态效果"偏好:关闭循环动画与过渡,保留静态观感。 */
@media (prefers-reduced-motion: reduce) {
  .guide-wave,
  .guide-wave::before,
  .guide-wave::after { animation: none; opacity: .45; transform: scale(1); }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
