/* ============================================================================
 * hive_gauges.css
 *
 * Cyberpunk-C4-Corvette glass-and-neon gauge cluster for HIVE.
 * Loaded with hive_gauges.js. Every element is position:fixed so the
 * hive_layout_edit.js TARGETS array can wrap each one in its own draggable
 * frame.
 *
 * Aesthetic anchors:
 *   - Chrome bezel       -> linear gradient gray->white->gray
 *   - Glass face         -> dark blue radial gradient with gloss highlight
 *   - Cyan neon          -> #00d6ff with text-shadow + box-shadow blooms
 *   - Heat zone palette  -> cyan (cool) -> amber (warm) -> red (danger)
 *   - Tabular numbers    -> Consolas + font-variant-numeric: tabular-nums
 *
 * 2026-05-15, gauges Phase B.
 * ==========================================================================*/

/* -----------------------------------------------------------------
 * Shared base for every gauge -- glass tile aesthetic.
 * ---------------------------------------------------------------*/
.hive-gauge {
  position: fixed;
  z-index: 50;
  font-family: 'Consolas', ui-monospace, monospace;
  color: #cfeaff;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.hive-gauge svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Subtle "scan-line" overlay -- gives every gauge a CRT vibe.        */
.hive-gauge::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 214, 255, 0.04) 0px,
      rgba(0, 214, 255, 0.04) 1px,
      transparent 1px,
      transparent 3px
    );
  opacity: 0.55;
  mix-blend-mode: screen;
  z-index: 3;
}

/* =================================================================
 * INITIAL PLACEMENT -- stacked top-left. Bud rearranges via layout
 * editor. These are defaults only; layout-editor's saved blob wins.
 * ===============================================================*/
#hive-g-knock { left: 20px;  top: 80px;  width: 130px; height: 150px; }
#hive-g-tps   { left: 20px;  top: 246px; width: 150px; height: 116px; }
#hive-g-ect   { left: 20px;  top: 372px; width: 150px; height: 116px; }
#hive-g-iat   { left: 20px;  top: 498px; width: 150px; height: 116px; }
#hive-g-afr   { left: 20px;  top: 624px; width: 150px; height: 116px; }
#hive-g-rpm   { left: 190px; top: 80px;  width: 290px; height: 290px; }
#hive-g-speed { left: 190px; top: 386px; width: 290px; height: 290px; }
#hive-g-stft  { left: 500px; top: 80px;  width: 280px; height: 200px; }
#hive-g-ltft  { left: 500px; top: 296px; width: 280px; height: 200px; }

/* =================================================================
 * SWEEP GAUGE -- 270 deg arc with heat-colored segments (RPM/SPEED)
 * ===============================================================*/
.hive-gauge-sweep {
  align-items: center;
  justify-content: center;
}
.hive-gauge-sweep .hg-svg-wrap {
  position: relative;
  width: 100%; height: 100%;
}

/* Center digital readout for RPM/Speed -- big mono with cyan glow. */
.hive-gauge-sweep .hg-digital {
  position: absolute;
  left: 50%; top: 56%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #e8faff;
  text-shadow:
    0 0 6px rgba(0, 214, 255, 0.95),
    0 0 14px rgba(0, 214, 255, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 4;
  line-height: 1;
}
.hive-gauge-sweep .hg-label {
  position: absolute;
  left: 50%; top: 70%;
  transform: translate(-50%, 0);
  font-size: 11px;
  letter-spacing: 0.42em;
  color: #00d6ff;
  text-shadow: 0 0 6px rgba(0, 214, 255, 0.85);
  font-weight: 700;
  pointer-events: none;
  z-index: 4;
}
.hive-gauge-sweep .hg-unit {
  position: absolute;
  left: 50%; top: 78%;
  transform: translate(-50%, 0);
  font-size: 9px;
  letter-spacing: 0.34em;
  color: rgba(160, 200, 230, 0.78);
  pointer-events: none;
  z-index: 4;
}

/* "PEAK" badge -- shows highest value seen this session. */
.hive-gauge-sweep .hg-peak {
  position: absolute;
  right: 8%; top: 18%;
  font-size: 9px;
  letter-spacing: 0.24em;
  color: rgba(120, 220, 255, 0.85);
  text-shadow: 0 0 4px rgba(0, 214, 255, 0.7);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 4;
  text-align: right;
  line-height: 1.25;
}
.hive-gauge-sweep .hg-peak .label { display: block; font-size: 7.5px; opacity: 0.55; letter-spacing: 0.36em; }

/* =================================================================
 * NUMERIC TILE -- glass card with 00.0 readout (TPS/ECT/IAT/AFR)
 * ===============================================================*/
.hive-tile {
  padding: 6px 10px;
  border-radius: 14px;
  background:
    radial-gradient(125% 110% at 50% 0%, rgba(0, 90, 160, 0.30) 0%, rgba(0, 24, 50, 0.65) 55%, rgba(0, 8, 22, 0.86) 100%);
  border: 1.2px solid rgba(0, 214, 255, 0.50);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 22px rgba(0, 214, 255, 0.05),
    0 0 18px rgba(0, 200, 255, 0.22),
    0 8px 22px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  overflow: hidden;
}
.hive-tile::before {
  /* Chrome bezel sheen at the top edge. */
  content: '';
  position: absolute;
  left: 6px; right: 6px; top: 0;
  height: 18px;
  background: linear-gradient(180deg, rgba(170, 215, 245, 0.55) 0%, rgba(170, 215, 245, 0) 100%);
  border-radius: 14px 14px 0 0;
  pointer-events: none;
  z-index: 2;
}
.hive-tile-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.36em;
  color: #00d6ff;
  text-shadow: 0 0 6px rgba(0, 214, 255, 0.85);
  text-transform: uppercase;
  margin-top: 6px;
  z-index: 5;
  position: relative;
}
.hive-tile-value {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #e8faff;
  text-shadow:
    0 0 6px rgba(0, 214, 255, 0.95),
    0 0 16px rgba(0, 214, 255, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.7);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 4px 0 2px 0;
  z-index: 5;
  position: relative;
}
.hive-tile-unit {
  font-size: 9px;
  letter-spacing: 0.30em;
  color: rgba(160, 200, 230, 0.78);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  z-index: 5;
  position: relative;
}

/* Warn coloring on out-of-spec values (set via data-warn attr). */
.hive-tile[data-warn="hot"] {
  border-color: rgba(255, 175, 80, 0.80);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 22px rgba(255, 140, 40, 0.10),
    0 0 22px rgba(255, 150, 40, 0.36),
    0 8px 22px rgba(0, 0, 0, 0.55);
}
.hive-tile[data-warn="hot"] .hive-tile-value {
  color: #ffd680;
  text-shadow:
    0 0 6px rgba(255, 175, 80, 0.95),
    0 0 16px rgba(255, 120, 40, 0.65),
    0 2px 3px rgba(0, 0, 0, 0.7);
}
.hive-tile[data-warn="hot"] .hive-tile-label { color: #ffb060; text-shadow: 0 0 6px rgba(255, 175, 80, 0.85); }

.hive-tile[data-warn="crit"] {
  border-color: rgba(255, 60, 60, 0.85);
  animation: hg-warn-pulse 1.4s ease-in-out infinite;
}
.hive-tile[data-warn="crit"] .hive-tile-value {
  color: #ff9090;
  text-shadow:
    0 0 8px rgba(255, 80, 80, 1),
    0 0 20px rgba(255, 60, 60, 0.75),
    0 2px 3px rgba(0, 0, 0, 0.7);
}
.hive-tile[data-warn="crit"] .hive-tile-label { color: #ff8080; text-shadow: 0 0 8px rgba(255, 60, 60, 0.95); }
@keyframes hg-warn-pulse {
  0%, 100% { box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      0 0 22px rgba(255, 80, 80, 0.55),
      0 8px 22px rgba(0, 0, 0, 0.60); }
  50%      { box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      0 0 36px rgba(255, 80, 80, 0.95),
      0 0 60px rgba(255, 80, 80, 0.50),
      0 8px 24px rgba(0, 0, 0, 0.60); }
}

/* =================================================================
 * KNOCK LED -- circular indicator that flashes faster as knock rises
 * ===============================================================*/
.hive-knock {
  padding: 6px 10px;
  border-radius: 14px;
  background:
    radial-gradient(125% 110% at 50% 0%, rgba(0, 90, 160, 0.30) 0%, rgba(0, 24, 50, 0.65) 55%, rgba(0, 8, 22, 0.86) 100%);
  border: 1.2px solid rgba(0, 214, 255, 0.50);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 0 18px rgba(0, 200, 255, 0.22),
    0 8px 22px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.hive-knock .hive-tile-label { margin-top: 8px; }
.hive-knock-ring {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
  z-index: 5;
}
.hive-knock-led {
  position: relative;
  width: 56%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%,
      rgba(160, 30, 30, 0.95) 0%,
      rgba(110, 18, 18, 0.95) 35%,
      rgba(40, 6, 6, 0.95) 75%,
      rgba(20, 4, 4, 1) 100%);
  border: 2.5px solid #2a0808;
  box-shadow:
    inset 0 1px 2px rgba(255, 200, 200, 0.10),
    inset 0 -8px 14px rgba(0, 0, 0, 0.65),
    0 0 0 1.5px rgba(170, 180, 200, 0.45),
    0 2px 5px rgba(0, 0, 0, 0.80);
  transition: background 280ms ease, box-shadow 280ms ease, border-color 280ms ease;
}
.hive-knock-led::before {
  /* Specular highlight (top-left) */
  content: '';
  position: absolute;
  left: 16%; top: 10%;
  width: 36%; height: 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 230, 230, 0.55) 0%, rgba(255, 230, 230, 0) 70%);
  pointer-events: none;
  filter: blur(0.5px);
}
.hive-knock-readout {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255, 130, 130, 0.85);
  text-shadow: 0 0 4px rgba(255, 80, 80, 0.45);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
  z-index: 5;
  position: relative;
}

/* Per-state LED visuals + strobe animations -------------------*/
.hive-knock[data-state="off"] .hive-knock-led {
  background: radial-gradient(circle at 50% 38%,
    rgba(80, 20, 20, 0.85) 0%, rgba(40, 8, 8, 0.95) 60%, rgba(15, 3, 3, 1) 100%);
}
.hive-knock[data-state="off"] .hive-knock-readout { color: rgba(160, 100, 100, 0.55); text-shadow: none; }

.hive-knock[data-state="low"] .hive-knock-led {
  background:
    radial-gradient(circle at 50% 38%,
      rgba(255, 100, 100, 0.98) 0%,
      rgba(200, 40, 40, 0.95) 35%,
      rgba(110, 18, 18, 0.95) 80%,
      rgba(50, 6, 6, 1) 100%);
  box-shadow:
    inset 0 1px 2px rgba(255, 220, 220, 0.25),
    inset 0 -8px 14px rgba(0, 0, 0, 0.55),
    0 0 0 1.5px rgba(170, 180, 200, 0.55),
    0 0 18px rgba(255, 60, 60, 0.65),
    0 2px 5px rgba(0, 0, 0, 0.80);
}
.hive-knock[data-state="low"] .hive-knock-readout { color: #ff8080; text-shadow: 0 0 4px rgba(255, 80, 80, 0.75); }

.hive-knock[data-state="mid"] .hive-knock-led {
  background:
    radial-gradient(circle at 50% 38%,
      #ffe0e0 0%, #ff5050 30%, #d62020 70%, #6a0e0e 100%);
  box-shadow:
    inset 0 1px 2px rgba(255, 240, 240, 0.45),
    inset 0 -8px 14px rgba(0, 0, 0, 0.45),
    0 0 0 1.5px rgba(170, 180, 200, 0.65),
    0 0 28px rgba(255, 50, 50, 0.95),
    0 0 60px rgba(255, 40, 40, 0.55),
    0 2px 5px rgba(0, 0, 0, 0.80);
  animation: hg-knock-mid 0.55s ease-in-out infinite;
}
@keyframes hg-knock-mid {
  0%, 100% { filter: brightness(1.00); }
  50%      { filter: brightness(1.35); }
}
.hive-knock[data-state="mid"] .hive-knock-readout { color: #ffb0b0; text-shadow: 0 0 5px rgba(255, 80, 80, 0.85); }

.hive-knock[data-state="high"] .hive-knock-led {
  background:
    radial-gradient(circle at 50% 38%,
      #ffffff 0%, #ff8080 25%, #ff2020 65%, #800808 100%);
  box-shadow:
    inset 0 1px 2px rgba(255, 240, 240, 0.65),
    inset 0 -8px 14px rgba(0, 0, 0, 0.30),
    0 0 0 1.5px rgba(255, 60, 60, 0.85),
    0 0 38px rgba(255, 30, 30, 1.0),
    0 0 80px rgba(255, 30, 30, 0.75),
    0 2px 5px rgba(0, 0, 0, 0.80);
  animation: hg-knock-high 0.18s steps(2, end) infinite;
}
@keyframes hg-knock-high {
  0%   { filter: brightness(0.55); transform: scale(0.96); }
  50%  { filter: brightness(1.85); transform: scale(1.02); }
  100% { filter: brightness(0.55); transform: scale(0.96); }
}
.hive-knock[data-state="high"] .hive-knock-readout {
  color: #ff5050;
  font-weight: 900;
  text-shadow: 0 0 8px rgba(255, 50, 50, 1.0), 0 0 16px rgba(255, 50, 50, 0.70);
}

/* =================================================================
 * STFT / LTFT 180 deg lean-rich dials (two needles each)
 * ===============================================================*/
.hive-trim {
  /* Holographic: no chrome card, just a soft cyan halo so the panel is
     detectable without breaking the "floating in space" feel. */
  align-items: center;
  justify-content: flex-start;
  padding: 8px 8px 6px 8px;
  border-radius: 16px;
  background:
    radial-gradient(70% 60% at 50% 55%, rgba(0, 160, 220, 0.28) 0%, rgba(0, 40, 80, 0.15) 55%, rgba(0, 0, 0, 0) 100%);
  border: 1px solid rgba(0, 214, 255, 0.70);
  box-shadow:
    0 0 24px rgba(0, 200, 255, 0.50),
    0 0 60px rgba(0, 160, 220, 0.25);
  overflow: visible;
}
.hive-trim .hg-svg-wrap {
  flex: 1;
  width: 100%;
  position: relative;
}
.hive-trim-readouts {
  display: flex;
  width: 100%;
  justify-content: space-around;
  padding: 4px 0 2px 0;
  border-top: 1px dashed rgba(0, 214, 255, 0.18);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  z-index: 5;
  position: relative;
}
.hive-trim-readouts .b1 { color: #00d6ff; text-shadow: 0 0 4px rgba(0, 214, 255, 0.85); }
.hive-trim-readouts .b2 { color: #ff2bd6; text-shadow: 0 0 4px rgba(255, 43, 214, 0.85); }
.hive-trim-readouts .lbl { color: rgba(120, 170, 200, 0.55); margin-right: 4px; font-size: 9px; letter-spacing: 0.28em; }

/* =================================================================
 * Layout-editor wrap interop -- when this gauge is wrapped, the
 * fixed-position rules above are overridden by the frame (which is
 * also fixed). Our internal layout still relies on the gauge being
 * its own block with relative-positioned children, so reset position
 * INSIDE the frame to absolute fill.
 * ===============================================================*/
.hive-frame > .hive-gauge {
  position: absolute !important;
  left: 0