/* 차량 계기판 — visual-overhaul-plan.md P5.7 (2026-07-06)
   재질 언어: 올리브드랍 섀시 + 음각 계기 웰 + 앰버 발광 (무전기/조종기 목업과 동일) */

.hud-bottom.vehicle-dashboard-active {
  display: grid;
  left: auto;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: none;
  justify-items: end;
}

.hud-bottom.vehicle-dashboard-active .weapon-panel {
  display: none;
}

/* ===== 섀시 ===== */
.vehicle-dashboard {
  position: relative;
  box-sizing: border-box;
  width: min(calc(100vw - 28px), 480px);
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 60px 48px 52px;
  align-items: stretch;
  gap: 5px;
  padding: 8px 8px 9px;
  border: 2px solid rgba(14, 18, 10, 0.98);
  border-radius: 11px;
  background:
    /* 모서리 나사 4개 */
    radial-gradient(circle 4px at 11px 11px, #4b574b 0 2px, #151b17 2.6px, transparent 4.6px),
    radial-gradient(circle 4px at calc(100% - 11px) 11px, #4b574b 0 2px, #151b17 2.6px, transparent 4.6px),
    radial-gradient(circle 4px at 11px calc(100% - 11px), #4b574b 0 2px, #151b17 2.6px, transparent 4.6px),
    radial-gradient(circle 4px at calc(100% - 11px) calc(100% - 11px), #4b574b 0 2px, #151b17 2.6px, transparent 4.6px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%),
    linear-gradient(150deg, #3d4834 0%, #262f1e 50%, #171d12 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -8px 12px rgba(0, 0, 0, 0.35),
    0 10px 24px rgba(0, 0, 0, 0.48);
  pointer-events: none;
}

/* 브러시드 상판 스트립 */
.vehicle-dashboard::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 3px;
  height: 3px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 2px, transparent 2px 4px),
    rgba(0, 0, 0, 0.3);
}

/* 하단 러버 트림 */
.vehicle-dashboard::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 3px;
  height: 4px;
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0 6px, rgba(255, 255, 255, 0.03) 6px 12px),
    #11150c;
}

.vehicle-dashboard.hidden {
  display: none;
}

/* ===== 계기 웰 (음각) ===== */
.vehicle-dashboard-meter,
.vehicle-dashboard-cluster {
  min-width: 0;
  min-height: 64px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #0d110b, #12170e);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

.vehicle-dashboard-meter {
  display: grid;
  grid-template-rows: 9px 1fr 11px;
  justify-items: center;
  align-items: center;
  padding: 4px 3px 3px;
}

.vehicle-dashboard-meter canvas {
  width: 42px;
  height: 42px;
}

.vehicle-dashboard-meter span,
.vehicle-dashboard-label,
.vehicle-dashboard-cluster small {
  color: rgba(237, 244, 239, 0.35);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.22em;
  line-height: 1.1;
  text-transform: uppercase;
}

.vehicle-dashboard-meter strong {
  font-family: Consolas, "D2Coding", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 800;
  color: #ffe8a8;
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.3);
}

.vehicle-dashboard-cluster {
  display: grid;
  gap: 3px;
  padding: 5px 6px;
}

/* ===== 주포 클러스터 ===== */
.vehicle-dashboard-main {
  grid-template-rows: 9px auto auto 11px;
  justify-items: stretch;
}

.vd-chip-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

/* 탄종 칩: 램프 + 라벨 + 플립 카운터 */
.vd-chip {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 5px;
  border: 1px solid rgba(237, 244, 239, 0.09);
  background: #0a0e08;
}

.vd-chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(237, 244, 239, 0.12);
}

.vd-chip.active {
  border-color: rgba(255, 209, 102, 0.5);
}

.vd-chip.active i {
  background: #ffd166;
  box-shadow: 0 0 7px rgba(255, 209, 102, 0.8);
}

.vd-chip b {
  color: rgba(237, 244, 239, 0.45);
  font-size: 8.5px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.vd-chip.active b {
  color: #ffe8a8;
}

/* 기계식 플립 카운터 */
.vd-chip strong {
  position: relative;
  justify-self: end;
  min-width: 24px;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.8);
  background: linear-gradient(180deg, #171713 49%, #0c0c09 51%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -2px 3px rgba(0, 0, 0, 0.6);
  color: #e8e4d8;
  font-family: Consolas, "D2Coding", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
}

.vd-chip strong::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.7);
}

/* 장전 게이지 + 준비 램프 */
.vehicle-dashboard-reload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}

.vehicle-dashboard-reload i {
  height: 5px;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.7);
  background: #060906;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}

.vehicle-dashboard-reload em {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 209, 102, 0.5), #ffd166);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.5);
}

.vd-ready {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(237, 244, 239, 0.38);
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.vd-ready u {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.6);
  background: rgba(237, 244, 239, 0.1);
  text-decoration: none;
}

.vehicle-dashboard.gun-ready .vd-ready {
  color: #9fff8a;
}

.vehicle-dashboard.gun-ready .vd-ready u {
  background: #9fff8a;
  box-shadow: 0 0 8px rgba(159, 255, 138, 0.7);
}

.vd-main-state {
  overflow: hidden;
  color: rgba(237, 244, 239, 0.5);
  font-size: 9px;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== MG 7세그 ===== */
.vehicle-dashboard-mg,
.vehicle-dashboard-smoke {
  grid-template-rows: 9px 1fr 11px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.vehicle-dashboard-mg > strong {
  align-self: center;
  min-width: 46px;
  padding: 3px 5px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.85);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%),
    #0a0b06;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
  font-family: Consolas, "D2Coding", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffd166;
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.55);
}

/* ===== 연막 경고등 돔 ===== */
.vehicle-dashboard-smoke > strong {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.75);
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.35), transparent 36%),
    radial-gradient(circle at 50% 55%, #565e4c 0%, #2c3324 65%, #171c12 100%);
  box-shadow: inset 0 -4px 7px rgba(0, 0, 0, 0.5);
  color: #e6ecd6;
  font-size: 11px;
  font-weight: 950;
}

/* 렌즈 리지 */
.vehicle-dashboard-smoke > strong::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 3px, rgba(0, 0, 0, 0.14) 3px 4px);
}

.vehicle-dashboard.smoke-ready .vehicle-dashboard-smoke > strong {
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.5), transparent 34%),
    radial-gradient(circle at 50% 55%, #22c55e 0%, #14532d 70%, #052e16 100%);
  color: #eafff0;
  box-shadow: inset 0 -4px 7px rgba(0, 0, 0, 0.5), 0 0 15px rgba(34, 197, 94, 0.45);
}

.vehicle-dashboard.smoke-cooling .vehicle-dashboard-smoke > strong {
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.35), transparent 36%),
    radial-gradient(circle at 50% 55%, #b45348 0%, #6b2620 70%, #2e0f0c 100%);
  color: #ffd9d3;
  box-shadow: inset 0 -4px 7px rgba(0, 0, 0, 0.5), 0 0 12px rgba(224, 85, 69, 0.35);
}

.vehicle-dashboard.mg-active .vehicle-dashboard-mg {
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 209, 102, 0.35);
}

/* ===== 험비 ===== */
.vehicle-dashboard.humvee {
  grid-template-columns: 52px 76px 52px;
  width: min(calc(100vw - 28px), 210px);
}

.vehicle-dashboard.humvee .vehicle-dashboard-main,
.vehicle-dashboard.humvee .vehicle-dashboard-smoke {
  display: none;
}

/* ===== 반응형 ===== */
@media (max-width: 720px) {
  .hud-bottom.vehicle-dashboard-active {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .vehicle-dashboard {
    width: min(calc(100vw - 24px), 440px);
    grid-template-columns: 48px minmax(0, 1fr) 56px 44px 48px;
    gap: 4px;
    padding: 7px 6px 8px;
  }

  .vehicle-dashboard-meter,
  .vehicle-dashboard-cluster {
    min-height: 60px;
  }

  .vehicle-dashboard.humvee {
    width: min(calc(100vw - 24px), 196px);
    grid-template-columns: 48px 72px 48px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .vehicle-dashboard {
    width: min(calc(100vw - 24px), 430px);
    grid-template-columns: 46px minmax(0, 1fr) 54px 42px 46px;
    gap: 4px;
    padding: 6px 6px 7px;
  }

  .vehicle-dashboard-meter,
  .vehicle-dashboard-cluster {
    min-height: 56px;
    padding: 3px 4px;
  }

  .vehicle-dashboard-meter canvas {
    width: 36px;
    height: 36px;
  }

  .vehicle-dashboard.humvee {
    width: min(calc(100vw - 24px), 190px);
    grid-template-columns: 46px 70px 46px;
  }
}
