:root {
  --bg-deep: #0b0d11;
  --bg-surface: #13171e;
  --bg-card: rgba(255, 255, 255, 0.045);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border-hair: rgba(255, 255, 255, 0.09);
  --border-active: rgba(212, 232, 248, 0.42);
  --text-main: #eef2f6;
  --text-sub: #8d99a8;
  --text-dim: #5e6978;
  --accent-cyan: #58c8f5;
  --accent-amber: #e8a838;
  --accent-red: #e54d42;
  --accent-green: #38c985;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07080b;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Text", "Helvetica Neue", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

@media (min-width: 481px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
      radial-gradient(circle at 50% 24%, rgba(36, 46, 62, 0.32) 0%, rgba(10, 12, 16, 0.96) 62%),
      repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.012) 0px,
        rgba(255, 255, 255, 0.012) 1px,
        transparent 1px,
        transparent 10px
      ),
      #06070a;
  }
}

.hidden {
  display: none !important;
}

.ui-ico {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ui-ico-bat {
  width: 18px;
  height: 11px;
}

.app-root {
  position: relative;
  width: 100%;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg-deep);
  overflow: hidden;
}

@media (min-width: 481px) {
  .app-root {
    width: 404px;
    height: min(856px, 94dvh);
    border-radius: 38px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
      0 32px 90px rgba(0, 0, 0, 0.78),
      inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}

.app-root.shaking {
  animation: camShake 0.24s linear 1;
}

@keyframes camShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2.5px, 1.5px); }
  50% { transform: translate(2.5px, -1.5px); }
  75% { transform: translate(-1.5px, -1px); }
}

/* ==================== 1. LOCKSCREEN ==================== */
.lockscreen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080b10;
}

.lockscreen-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.76) saturate(0.85);
  pointer-events: none;
}

.lockscreen-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(6, 9, 14, 0.42) 0%,
    rgba(6, 9, 14, 0.24) 38%,
    rgba(5, 7, 11, 0.72) 100%
  );
  pointer-events: none;
}

.lock-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 96px 18px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.lock-hero {
  text-align: center;
  margin-top: 10px;
}

.lock-date {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(235, 241, 248, 0.76);
}

.lock-time {
  margin-top: 2px;
  font-size: 64px;
  font-weight: 200;
  line-height: 1.04;
  letter-spacing: 0.02em;
  color: rgba(248, 251, 255, 0.96);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.38);
}

.lock-alerts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: auto 0 24px;
}

.lock-card {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(22, 28, 36, 0.54);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.lock-card:active {
  transform: scale(0.985);
  background: rgba(34, 42, 54, 0.68);
}

.lock-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(214, 224, 236, 0.72);
  margin-bottom: 5px;
}

.lock-card-app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.lock-card-app .ui-ico {
  width: 14px;
  height: 14px;
  color: rgba(232, 242, 252, 0.88);
}

.lock-card-age {
  font-size: 11px;
  color: rgba(200, 212, 226, 0.6);
}

.lock-card-body {
  font-size: 14px;
  font-weight: 500;
  color: rgba(246, 250, 255, 0.96);
}

.lock-action-wrap {
  display: flex;
  justify-content: center;
  padding-bottom: 6px;
}

.btn-primary-enter {
  min-width: 164px;
  height: 42px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: rgba(248, 252, 255, 0.96);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

@media (max-height: 670px) {
  .lock-content {
    padding: 92px 16px 18px;
  }
  .lock-time {
    font-size: 52px;
  }
  .lock-alerts {
    margin: auto 0 14px;
    gap: 8px;
  }
  .lock-card {
    padding: 10px 12px;
  }
}

/* ==================== 2. APP SCREEN ==================== */
.app-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
}

.topbar {
  width: calc(100% - 114px);
  height: 40px;
  padding: 0 6px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-bottom: 1px solid var(--border-hair);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.top-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(88, 200, 245, 0.65);
  flex-shrink: 0;
}

.top-status-dot.is-live {
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(229, 77, 66, 0.78);
}

.top-device-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mode-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-hair);
  gap: 2px;
}

.mode-seg-btn {
  position: relative;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.mode-seg-btn.active {
  background: rgba(88, 200, 245, 0.2);
  color: #e6f7ff;
  font-weight: 600;
}

.mode-seg-btn.is-locked {
  opacity: 0.48;
}

.top-ev-pill {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(88, 200, 245, 0.14);
  border: 1px solid rgba(88, 200, 245, 0.32);
  color: #bde8fc;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.btn-mute {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-hair);
  background: var(--bg-card);
  color: var(--text-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-mute .ui-ico {
  width: 15px;
  height: 15px;
}

/* 监控视窗：全宽 38%–41% 屏高 */
.viewport-wrap {
  position: relative;
  width: 100%;
  height: 40.5%;
  min-height: 226px;
  max-height: 344px;
  background: #06080b;
  overflow: hidden;
  flex-shrink: 0;
  touch-action: pan-y;
}

#cam-canvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* 16x28px 视口内低不透明度 <video>：避开 2x2 降帧节流，同时低于安卓微信/国产浏览器原生劫持阈值 */
.cam-video {
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 28px;
  opacity: 0.02;
  pointer-events: none;
  z-index: 1;
}

.viewport-overlay-anchor {
  position: relative;
  width: 100%;
  height: 0;
  overflow: visible;
  z-index: 6;
  flex-shrink: 0;
}

/* 放在视窗左上中段，既避开底部 Toast 又避开右上 110x88px 安全区 */
.video-osd {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 74px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.video-osd-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f25249;
  box-shadow: 0 0 8px rgba(242, 82, 73, 0.9);
  flex-shrink: 0;
}

.video-osd-label {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(8, 12, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eef5fc;
  font-size: 10.5px;
  font-family: ui-monospace, Menlo, monospace;
}

.btn-skip-video {
  margin-left: auto;
  pointer-events: auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(12, 16, 22, 0.78);
  color: #dce9f5;
  font-size: 10.5px;
  cursor: pointer;
}

.viewport-toast {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 34px;
  z-index: 5;
  padding: 6px 11px;
  border-radius: 10px;
  background: rgba(10, 14, 20, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  color: #eef5fc;
  font-size: 11.5px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.viewport-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.viewport-toast[data-level="warn"] {
  border-color: rgba(232, 168, 56, 0.45);
  color: #ffe3aa;
}

.viewport-toast[data-level="danger"] {
  border-color: rgba(229, 77, 66, 0.56);
  background: rgba(34, 12, 14, 0.88);
  color: #ffb8b2;
}

/* 极简任务/态势条 */
.act-hud-strip {
  padding: 5px 10px;
  background: #0e1218;
  border-top: 1px solid var(--border-hair);
  border-bottom: 1px solid var(--border-hair);
  flex-shrink: 0;
}

.act1-task-capsule {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(88, 200, 245, 0.08);
  border: 1px solid rgba(88, 200, 245, 0.2);
  font-size: 11px;
  color: #ccecff;
}

.act1-task-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  flex-shrink: 0;
}

.act2-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.hud-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-hair);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.hud-k {
  color: var(--text-sub);
  font-size: 10.5px;
}

.hud-v {
  color: var(--text-main);
  font-weight: 600;
}

.hud-cell.is-warn {
  border-color: rgba(232, 168, 56, 0.5);
  background: rgba(232, 168, 56, 0.12);
}

.hud-cell.is-warn .hud-v {
  color: #ffd98e;
}

.hud-cell.is-danger {
  border-color: rgba(229, 77, 66, 0.65);
  background: rgba(229, 77, 66, 0.16);
}

.hud-cell.is-danger .hud-v {
  color: #ff9c94;
}

/* 镜头切换细条 */
.spatial-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px 10px 5px;
  background: #0c0f14;
  border-bottom: 1px solid var(--border-hair);
  flex-shrink: 0;
}

.cam-tab {
  position: relative;
  height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.cam-tab.active {
  border-color: rgba(88, 200, 245, 0.35);
  background: rgba(88, 200, 245, 0.12);
  color: #edf7ff;
  font-weight: 600;
}

.cam-tab.is-lit {
  border-color: rgba(255, 224, 152, 0.5);
}

.cam-tab.is-alert {
  border-color: rgba(229, 77, 66, 0.75);
  box-shadow: inset 0 0 12px rgba(229, 77, 66, 0.22);
  color: #ffc2bc;
}

.cam-tab.has-motion {
  border-color: rgba(232, 168, 56, 0.72);
  box-shadow: inset 0 0 10px rgba(232, 168, 56, 0.2);
  color: #ffe2a6;
}

.room-ev-dot {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
  opacity: 0;
}

.cam-tab.has-ev .room-ev-dot {
  opacity: 1;
}

.room-cut-tag {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 8.5px;
  color: #ff8e86;
  opacity: 0;
}

.cam-tab.is-cut .room-cut-tag,
.cam-tab.is-covered .room-cut-tag {
  opacity: 1;
}

.room-vac-bar {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-cyan);
  opacity: 0;
}

.cam-tab.has-vac .room-vac-bar {
  opacity: 0.9;
}

.cam-tab.has-vac-hit .room-vac-bar {
  background: var(--accent-red);
  opacity: 1;
}

/* 底部拇指区模式栏 */
.bottom-mode-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  background: #0c0f15;
  border-top: 1px solid var(--border-hair);
  flex-shrink: 0;
}

.bottom-mode-btn {
  position: relative;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.bottom-mode-btn .ui-ico {
  width: 16px;
  height: 16px;
}

.bottom-mode-btn.active {
  background: rgba(88, 200, 245, 0.16);
  border-color: rgba(88, 200, 245, 0.44);
  color: #ebf8ff;
  font-weight: 600;
}

.bottom-mode-btn.is-locked {
  opacity: 0.46;
}

.live-alert-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 7px rgba(229, 77, 66, 0.85);
}

.control-deck {
  flex: 1;
  min-height: 0;
  padding: 7px 10px 7px;
  display: flex;
  flex-direction: column;
}

/* ==================== 回放面板（紧凑三段式，4条事件全屏直览） ==================== */
.replay-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  min-height: 0;
}

.replay-scrubber-card {
  padding: 7px 10px 5px;
  border-radius: 12px;
  background: #11151d;
  border: 1px solid var(--border-hair);
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.replay-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-step {
  min-width: 56px;
  padding: 0 8px;
  height: 29px;
  border-radius: 8px;
  border: 1px solid var(--border-hair);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-step.is-video-ctrl {
  border-color: rgba(88, 200, 245, 0.45);
  background: rgba(88, 200, 245, 0.12);
  color: #d6f3ff;
}

.btn-step.is-paused {
  border-color: rgba(232, 168, 56, 0.65);
  background: rgba(232, 168, 56, 0.16);
  color: #ffe3aa;
}

.replay-clock-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.replay-time-readout {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, Menlo, monospace;
}

.replay-hint {
  font-size: 10.5px;
  color: var(--text-sub);
}

.ruler-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scrubber-track {
  position: relative;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-hair);
  background: #10141b;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
}

.scrubber-track.is-video-scrub {
  border-color: rgba(88, 200, 245, 0.48);
  background: #0d1520;
}

.scrubber-track.is-video-scrub .scrubber-markers,
.scrubber-track.is-video-scrub .archive-zone {
  opacity: 0;
}

.video-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(88, 200, 245, 0.16), rgba(88, 200, 245, 0.36));
  border-right: 1px solid rgba(88, 200, 245, 0.6);
  pointer-events: none;
}

.archive-zone {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(229, 77, 66, 0.16);
  border-right: 1px dashed rgba(229, 77, 66, 0.55);
}

.scrubber-ticks,
.scrubber-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ruler-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
}

.ruler-tick.is-major {
  height: 18px;
  background: rgba(255, 255, 255, 0.34);
}

.ev-marker-bar {
  position: absolute;
  top: 4px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: var(--accent-amber);
  box-shadow: 0 0 6px rgba(232, 168, 56, 0.72);
}

.ev-marker-bar.is-archive {
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(229, 77, 66, 0.85);
}

.ev-marker-bar.is-captured {
  background: var(--accent-cyan);
  box-shadow: 0 0 6px rgba(88, 200, 245, 0.8);
}

.scrubber-thumb {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.scrubber-needle {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: var(--accent-cyan);
}

.scrubber-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 18px;
  border-radius: 4px;
  transform: translate(-50%, -50%);
  background: #e9f6ff;
  border: 1px solid #0b0d11;
}

.scrubber-scale {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.btn-capture-ev {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-hair);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn-capture-ev:disabled {
  cursor: default;
}

.btn-capture-ev.is-ready {
  border-color: rgba(88, 200, 245, 0.72);
  background: linear-gradient(180deg, rgba(36, 138, 186, 0.42), rgba(20, 88, 128, 0.56));
  color: #edf9ff;
  box-shadow: 0 4px 16px rgba(48, 168, 224, 0.24);
}

.btn-capture-ev.is-ready:active {
  transform: scale(0.985);
}

.btn-capture-ev.is-done {
  border-color: rgba(56, 201, 133, 0.4);
  background: rgba(24, 58, 44, 0.45);
  color: #9be8c2;
}

.event-log-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.event-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  flex-shrink: 0;
}

.event-log-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.03em;
}

.evidence-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
}

.ev-chip {
  width: 100%;
  min-height: 29px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-hair);
  background: #12161e;
  color: var(--text-main);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.ev-row-time {
  font-family: ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-amber);
  flex-shrink: 0;
}

.ev-row-desc {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #dce4ee;
  font-size: 12px;
}

.ev-row-badge {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(232, 168, 56, 0.14);
  color: #f3c875;
  flex-shrink: 0;
}

.ev-chip.is-current {
  border-color: rgba(88, 200, 245, 0.56);
  background: rgba(88, 200, 245, 0.11);
}

.ev-chip.is-current .ev-row-time {
  color: #8ee0ff;
}

.ev-chip.is-current .ev-row-badge {
  background: rgba(88, 200, 245, 0.22);
  color: #d6f4ff;
}

.ev-chip.is-archive-chip {
  border-color: rgba(229, 77, 66, 0.55);
  background: rgba(229, 77, 66, 0.12);
}

.ev-chip.is-archive-chip .ev-row-time,
.ev-chip.is-archive-chip .ev-row-badge {
  color: #ffb2aa;
}

.ev-chip.is-archive-chip .ev-row-badge {
  background: rgba(229, 77, 66, 0.22);
}

.ev-chip.captured {
  border-color: rgba(56, 201, 133, 0.34);
  background: rgba(20, 42, 34, 0.52);
}

.ev-chip.captured .ev-row-time {
  color: #7ee3b2;
}

.ev-chip.captured .ev-row-badge {
  background: rgba(56, 201, 133, 0.18);
  color: #8fe8be;
}

.act1-early-wrap {
  display: flex;
  align-items: center;
}

.btn-early-alarm {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-sub);
  font-size: 10.5px;
  cursor: pointer;
}

/* ==================== 实时面板（2x2 一步直发 + 3 决策） ==================== */
.live-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.appliance-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.device-card {
  height: 68px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-hair);
  background: #141922;
  color: var(--text-main);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}

.device-card:active {
  transform: scale(0.98);
}

.device-card.is-lit-card {
  border-color: rgba(255, 224, 152, 0.58);
  background: linear-gradient(135deg, rgba(255, 224, 152, 0.18), rgba(20, 25, 34, 0.92));
}

.device-card.active {
  border-color: rgba(88, 200, 245, 0.56);
  background: rgba(88, 200, 245, 0.12);
}

.device-card.is-hit-card {
  border-color: rgba(229, 77, 66, 0.65);
  background: rgba(229, 77, 66, 0.15);
}

.device-card.is-voice-card {
  border-color: rgba(232, 168, 56, 0.34);
  background: rgba(36, 26, 14, 0.66);
}

.device-card.is-voice-card .device-ico {
  background: rgba(232, 168, 56, 0.16);
  color: #ffd98e;
}

.device-card.is-unavailable {
  opacity: 0.48;
  background: rgba(255, 255, 255, 0.025);
}

.device-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #dce9f5;
}

.device-ico .ui-ico {
  width: 17px;
  height: 17px;
}

.device-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.device-name {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-sub {
  font-size: 10.5px;
  color: var(--text-sub);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-feed-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-hair);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  color: var(--text-sub);
  flex-shrink: 0;
}

.live-ticker-time {
  font-family: ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.live-ticker-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cfdbe8;
}

.decision-row {
  display: grid;
  grid-template-columns: 1fr 1.18fr 1fr;
  gap: 6px;
}

.btn-decision {
  min-height: 54px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-hair);
  background: #151a22;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
  text-align: left;
  cursor: pointer;
}

.btn-decision .ui-ico {
  width: 15px;
  height: 15px;
  color: var(--text-sub);
}

.btn-lock-alarm {
  border-color: rgba(56, 201, 133, 0.34);
  background: rgba(18, 34, 28, 0.72);
}

.btn-lock-alarm .ui-ico {
  color: var(--accent-green);
}

.btn-brace-door {
  border-color: rgba(88, 200, 245, 0.25);
  background: rgba(18, 26, 36, 0.78);
  touch-action: none;
}

.btn-brace-door.is-prying {
  border-color: rgba(229, 77, 66, 0.72);
  background: rgba(54, 16, 18, 0.85);
}

.btn-brace-door.is-prying .ui-ico {
  color: #ff9c94;
}

.btn-brace-door.is-bracing {
  border-color: #7ee3ff;
  background: rgba(24, 62, 84, 0.92);
  transform: scale(0.98);
}

.btn-dash-out {
  border-color: rgba(232, 168, 56, 0.32);
  background: rgba(34, 28, 18, 0.7);
}

.btn-dash-out .ui-ico {
  color: var(--accent-amber);
}

.decision-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.decision-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.decision-sub {
  font-size: 9.5px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-height: 670px) {
  .topbar {
    height: 35px;
  }
  .viewport-wrap {
    height: 36.2%;
    min-height: 214px;
  }
  .act-hud-strip {
    padding: 3px 10px;
  }
  .spatial-strip {
    padding: 3px 10px 4px;
  }
  .cam-tab {
    height: 26px;
  }
  .control-deck {
    padding: 5px 10px 5px;
  }
  .replay-panel {
    gap: 5px;
  }
  .replay-scrubber-card {
    padding: 5px 8px 4px;
    gap: 4px;
  }
  .scrubber-track {
    height: 32px;
  }
  .btn-step {
    height: 26px;
  }
  .btn-capture-ev {
    height: 33px;
    font-size: 12px;
  }
  .ev-chip {
    min-height: 27px;
    padding: 4px 8px;
  }
  .device-card {
    height: 46px;
    padding: 5px 8px;
    gap: 7px;
  }
  .device-ico {
    width: 26px;
    height: 26px;
  }
  .live-feed-ticker {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 10px;
  }
  .btn-decision {
    min-height: 40px;
    padding: 4px 6px;
  }
  .bottom-mode-bar {
    padding: 4px 10px 5px;
  }
  .bottom-mode-btn {
    height: 31px;
    font-size: 12px;
  }
}

/* ==================== 3. ENDING SCREEN ==================== */
.ending-screen {
  width: 100%;
  height: 100%;
  padding: 94px 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  background: radial-gradient(circle at 50% 25%, #121c28 0%, #090c10 72%);
}

.ending-screen[data-type="fail"],
.ending-screen[data-type="twist"] {
  background: radial-gradient(circle at 50% 25%, #260d10 0%, #090507 72%);
}

.ending-screen[data-type="true"] {
  background: radial-gradient(circle at 50% 25%, #0d2230 0%, #070b10 72%);
}

.ending-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(20, 25, 33, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ending-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ending-brand {
  font-size: 11px;
  color: var(--text-sub);
}

.ending-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(88, 200, 245, 0.14);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 600;
}

.ending-screen[data-type="fail"] .ending-badge,
.ending-screen[data-type="twist"] .ending-badge {
  background: rgba(229, 77, 66, 0.2);
  color: #ff9c96;
}

.ending-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.ending-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
}

.ending-detail {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-sub);
}

.ending-stats {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hair);
  font-size: 11.5px;
  color: #d6e4f2;
}

.ending-log-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ending-log-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
}

.ending-log-list {
  margin: 0;
  padding-left: 16px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-sub);
}

.btn-replay-game {
  width: 100%;
  height: 44px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-height: 670px) {
  .ending-screen {
    padding: 92px 14px 14px;
    gap: 8px;
  }
  .ending-card {
    padding: 12px;
    gap: 7px;
  }
}
