/**
 * 《末日房车：尸海行商》(Doomsday RV: Dead Sea Peddler)
 * 全局样式表 — 美式末日废土 × 车载琥珀战术终端 (High-Craft Dark UI)
 */
:root {
  --bg-asphalt: #0b0e12;
  --bg-cabin: #12171e;
  --bg-panel: #181f29;
  --bg-panel-elevated: #202936;
  --bg-glass: rgba(20, 26, 35, 0.88);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-metal: #2d3848;
  --border-amber: rgba(245, 158, 11, 0.55);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --amber-primary: #f59e0b;
  --amber-glow: #fbbf24;
  --emerald-radar: #10b981;
  --lime-radiation: #84cc16;
  --crimson-danger: #ef4444;
  --sky-civic: #38bdf8;
  --purple-mutant: #c084fc;
  --rose-syndicate: #f43f5e;

  --font-sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'Consolas', 'JetBrains Mono', 'Courier New', monospace;
}

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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-asphalt);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 14, 18, 0.6);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--amber-primary);
}

.mono-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==================== 顶层应用框架 ==================== */
#app-shell {
  display: grid;
  grid-template-rows: 58px 1fr 44px;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(245, 158, 11, 0.06), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.05), transparent 45%),
    var(--bg-asphalt);
}

/* ==================== 顶部车载遥测状态栏 ==================== */
.top-telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(180deg, #1a222d 0%, #11161d 100%);
  border-bottom: 1px solid var(--border-metal);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
  gap: 10px;
  z-index: 20;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 245px;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  color: #0b0e12;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.brand-titles h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--amber-glow);
}

.brand-titles .act-pill {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.act-tag {
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--amber-glow);
  font-weight: 600;
  font-size: 10.5px;
}

/* 遥测仪表组 */
.telemetry-gauges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.gauge-chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 10px;
  background: rgba(11, 14, 18, 0.72);
  border: 1px solid var(--border-metal);
  border-radius: 5px;
  min-width: 88px;
}

.gauge-chip .gauge-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gauge-chip .gauge-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1px;
}

.gauge-bar-mini {
  width: 100%;
  height: 3px;
  background: #1e293b;
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.gauge-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

/* 顶部快捷控制按钮 */
.top-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-tactical {
  padding: 6px 11px;
  background: #1e2736;
  color: var(--text-primary);
  border: 1px solid var(--border-metal);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.16s ease;
}

.btn-tactical:hover:not(:disabled) {
  background: #283548;
  border-color: var(--amber-primary);
  color: var(--amber-glow);
}

.btn-tactical:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-amber {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #0b0e12;
  border-color: #fbbf24;
  font-weight: 700;
}
.btn-amber:hover:not(:disabled) {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.btn-emerald {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.5);
}
.btn-emerald:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.btn-crimson {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.5);
}
.btn-crimson:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ==================== 中央主工作区 ==================== */
.main-workspace {
  display: grid;
  grid-template-columns: 58% 42%;
  height: 100%;
  overflow: hidden;
}

/* 左侧多模态主视窗 */
.left-viewport {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-metal);
  background: var(--bg-cabin);
  overflow: hidden;
  position: relative;
}

.viewport-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #141a23;
  border-bottom: 1px solid var(--border-metal);
  gap: 8px;
}

.mode-tabs {
  display: flex;
  gap: 5px;
}

.mode-tab {
  padding: 6px 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.mode-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
}

.mode-tab.active {
  background: rgba(245, 158, 11, 0.16);
  border-color: var(--amber-primary);
  color: var(--amber-glow);
  box-shadow: inset 0 0 8px rgba(245, 158, 11, 0.15);
}

.location-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.viewport-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stage-pane {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  position: relative;
}

.stage-pane.active {
  display: flex;
  flex-direction: column;
}

/* 地图画布容器与浮层 */
.map-canvas-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  background: #090d12;
  overflow: hidden;
}

#tactical-map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.map-hud-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 5;
}

.map-hud-overlay > * {
  pointer-events: auto;
}

.map-mode-switch {
  display: flex;
  gap: 6px;
  background: rgba(11, 14, 18, 0.88);
  padding: 5px;
  border-radius: 6px;
  border: 1px solid var(--border-metal);
  backdrop-filter: blur(8px);
}

.map-legend-box {
  background: rgba(11, 14, 18, 0.88);
  padding: 7px 11px;
  border-radius: 6px;
  border: 1px solid var(--border-metal);
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  align-items: center;
  backdrop-filter: blur(8px);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

/* 底部行程/节点检视面板 */
.map-inspector-drawer {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  background: rgba(16, 21, 28, 0.94);
  border: 1px solid var(--border-metal);
  border-left: 3px solid var(--amber-primary);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  z-index: 6;
}

.inspector-info {
  flex: 1;
}

.inspector-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.inspector-title-row h3 {
  font-size: 14.5px;
  color: var(--text-primary);
}

.badge-pill {
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ==================== 车窗当铺与街景交互视窗 ==================== */
.window-stage-header {
  position: relative;
  height: 175px;
  min-height: 175px;
  width: 100%;
  border-bottom: 2px solid var(--border-metal);
  background: #0a0d12;
  overflow: hidden;
}

#street-window-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.window-awning-overlay {
  position: absolute;
  bottom: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.window-awning-overlay > * {
  pointer-events: auto;
}

.window-body-content {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==================== 房车改装车库视窗 ==================== */
.garage-canvas-box {
  height: 215px;
  min-height: 215px;
  width: 100%;
  background: #090d14;
  border-bottom: 1px solid var(--border-metal);
  position: relative;
}

#rv-blueprint-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.garage-grid-container {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

/* ==================== 右侧多功能战术终端 ==================== */
.right-terminal {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  height: 100%;
  overflow: hidden;
}

.terminal-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: #11161d;
  border-bottom: 1px solid var(--border-metal);
}

.term-tab {
  padding: 8px 4px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.term-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.term-tab.active {
  color: var(--amber-glow);
  border-bottom-color: var(--amber-primary);
  background: rgba(245, 158, 11, 0.08);
}

.terminal-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==================== 通用卡片与表格组件 ==================== */
.card-box {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-metal);
  border-radius: 6px;
  padding: 11px 13px;
  transition: border-color 0.15s;
}

.card-box:hover {
  border-color: rgba(245, 158, 11, 0.4);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(15, 20, 28, 0.78);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  gap: 10px;
  transition: all 0.14s;
}

.item-row:hover {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(24, 32, 44, 0.9);
}

.item-main {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.item-icon {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  background: #141b24;
  border: 1px solid var(--border-metal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.item-meta h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-meta p {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.price-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--amber-glow);
}

.price-up {
  color: #34d399;
}
.price-down {
  color: #f87171;
}

/* 当铺顾客博弈卡片 */
.pawn-customer-card {
  background: linear-gradient(145deg, #1b2432 0%, #131922 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 7px;
  padding: 13px;
}

.speech-bubble {
  background: rgba(11, 14, 18, 0.85);
  border-left: 3px solid var(--amber-primary);
  padding: 9px 12px;
  border-radius: 0 5px 5px 0;
  font-style: italic;
  color: #e2e8f0;
  margin: 8px 0;
  font-size: 12.5px;
}

.trait-revealed {
  background: rgba(16, 185, 129, 0.14);
  border: 1px dashed #10b981;
  color: #6ee7b7;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  margin: 6px 0;
}

/* ==================== 底部车载电台滚动栏 ==================== */
.bottom-radio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #0e1319;
  border-top: 1px solid var(--border-metal);
  gap: 12px;
  z-index: 20;
}

.radio-freq-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  color: var(--emerald-radar);
  font-size: 12px;
  font-weight: 700;
  min-width: 195px;
}

.radio-wave-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-radar);
  box-shadow: 0 0 8px var(--emerald-radar);
  animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.radio-ticker-stream {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #cbd5e1;
  font-size: 12.5px;
}

/* ==================== 模态框与开局车卡选择 ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.86);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  width: 100%;
  max-width: 980px;
  max-height: 90vh;
  background: linear-gradient(180deg, #1a222e 0%, #10151d 100%);
  border: 1px solid var(--amber-primary);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 20px;
  background: #131922;
  border-bottom: 1px solid var(--border-metal);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  color: var(--amber-glow);
}

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  background: #11161e;
  border-top: 1px solid var(--border-metal);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 车卡网格 */
.vehicle-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 12px;
}

.vehicle-card-item {
  background: #161d27;
  border: 2px solid var(--border-metal);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.vehicle-card-item:hover:not(.locked) {
  border-color: var(--amber-primary);
  transform: translateY(-2px);
}

.vehicle-card-item.selected {
  border-color: var(--amber-glow);
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.vehicle-card-item.locked {
  opacity: 0.65;
  border-style: dashed;
}

.vehicle-art-banner {
  width: 100%;
  height: 115px;
  border-radius: 5px;
  background-size: cover;
  background-position: center;
  background-color: #0d1218;
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

/* 浮动通知 Toast */
#toast-container {
  position: fixed;
  top: 68px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast-msg {
  background: rgba(18, 24, 34, 0.95);
  border-left: 4px solid var(--amber-primary);
  border-top: 1px solid var(--border-metal);
  border-right: 1px solid var(--border-metal);
  border-bottom: 1px solid var(--border-metal);
  padding: 9px 14px;
  border-radius: 5px;
  color: var(--text-primary);
  font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  animation: toastSlideIn 0.22s ease;
  max-width: 360px;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(25px); }
  to { opacity: 1; transform: translateX(0); }
}
