/* =========================================================================
   NEXUS DYNAMICS V4 — POWER COMMISSIONING, POWER HUD, DRAWERS & QUALITY UI
   ========================================================================= */

.hidden { display: none !important; }

.action-label { white-space: nowrap; }

/* Top action triggers ----------------------------------------------------- */
.power-trigger-btn,
.quality-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 13px;
  border-radius: 13px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-hud);
  transition: all 0.2s ease;
}

.power-trigger-btn { border-color: rgba(245, 158, 11, 0.4); }
.power-trigger-btn:hover,
.quality-trigger-btn:hover { border-color: var(--accent-cyan); background: var(--glass-highlight); }
.power-trigger-btn.active { border-color: #f59e0b; background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.quality-trigger-btn.active { border-color: #38bdf8; background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }

.power-trigger-ico { color: #fbbf24; }

.power-trigger-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.power-trigger-dot.on { background: #10b981; box-shadow: 0 0 9px #10b981; }
.power-trigger-dot.starting { background: #f59e0b; box-shadow: 0 0 9px #f59e0b; animation: statusPulse 1.1s ease-in-out infinite; }
.power-trigger-dot.trip { background: #ef4444; box-shadow: 0 0 9px #ef4444; animation: statusPulse 0.8s ease-in-out infinite; }

/* Power HUD pill ---------------------------------------------------------- */
.power-hud-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(245, 158, 11, 0.32);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.power-hud-pill:hover { border-color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.power-hud-pill b { color: var(--text-main); }
.power-hud-dot { width: 7px; height: 7px; border-radius: 50%; background: #64748b; flex-shrink: 0; }
.power-hud-dot.on { background: #10b981; box-shadow: 0 0 8px #10b981; }
.power-hud-dot.starting { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; animation: statusPulse 1.1s ease-in-out infinite; }
.power-hud-dot.trip { background: #ef4444; box-shadow: 0 0 8px #ef4444; animation: statusPulse 0.8s ease-in-out infinite; }
.power-hud-open { color: #fbbf24; font-size: 0.78rem; }

/* Startup / commissioning overlay ---------------------------------------- */
.startup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  overflow-y: auto;
  background:
    radial-gradient(1100px 760px at 64% 42%, rgba(8, 24, 43, 0.94), rgba(3, 7, 14, 0.988) 72%),
    #03070e;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.startup-overlay.powered { opacity: 0; transform: scale(1.012); pointer-events: none; }

.startup-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 20%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 45%, #000 20%, transparent 78%);
  pointer-events: none;
}

.startup-shell {
  position: relative;
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 30px;
  align-items: center;
}

.startup-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  color: #38bdf8;
  text-transform: uppercase;
}
.startup-eyebrow span {
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #38bdf8);
}

.startup-hero h2 {
  margin-top: 12px;
  font-size: clamp(2rem, 4.4vw, 3.35rem);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
}
.startup-hero h2 span {
  background: linear-gradient(100deg, #38bdf8, #67e8f9 45%, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.startup-hero p {
  margin-top: 14px;
  max-width: 52ch;
  color: #94a3b8;
  font-size: 0.86rem;
  line-height: 1.65;
}

.startup-specs {
  list-style: none;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.startup-specs li {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.16);
}
.startup-specs b {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: #e0f2fe;
}
.startup-specs span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  color: #64748b;
}

.startup-foot {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  color: #475569;
}

.startup-panel {
  background: linear-gradient(160deg, rgba(12, 23, 39, 0.97), rgba(5, 11, 21, 0.99));
  border: 1px solid rgba(56, 189, 248, 0.34);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.startup-panel-head { display: flex; align-items: flex-start; gap: 11px; }
.startup-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
  background: #64748b;
}
.startup-led.starting { background: #f59e0b; box-shadow: 0 0 12px #f59e0b; animation: statusPulse 1s ease-in-out infinite; }
.startup-led.on { background: #10b981; box-shadow: 0 0 14px #10b981; }
.startup-led.trip { background: #ef4444; box-shadow: 0 0 14px #ef4444; animation: statusPulse 0.7s ease-in-out infinite; }

.startup-panel-title b {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  color: #e2e8f0;
}
.startup-panel-title small {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: #64748b;
}

.startup-source { margin-top: 17px; }
.startup-label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: #64748b;
}

.power-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 6px;
}
.power-source-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.6);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.16s ease;
}
.power-source-btn b { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.02em; }
.power-source-btn span { font-family: var(--font-mono); font-size: 0.53rem; letter-spacing: 0.06em; color: #64748b; }
.power-source-btn b,
.power-source-btn span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.power-source-btn:hover { border-color: #38bdf8; color: #e0f2fe; }
.power-source-btn.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.17);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.24), 0 0 16px rgba(56, 189, 248, 0.12);
}
.power-source-btn.active span { color: #7dd3fc; }
.power-source-btn.unavailable { opacity: 0.38; }

.startup-steps {
  list-style: none;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
}
.startup-steps li {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.12);
}
.startup-steps li:last-child { border-bottom: 0; }
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #475569;
  background: #0b1220;
  transition: all 0.25s ease;
}
.startup-steps li b {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: #64748b;
  transition: color 0.25s ease;
}
.startup-steps li small {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  color: #475569;
}
.startup-steps li.active .step-dot {
  border-color: #38bdf8;
  background: #38bdf8;
  box-shadow: 0 0 11px rgba(56, 189, 248, 0.8);
  animation: statusPulse 0.9s ease-in-out infinite;
}
.startup-steps li.active b { color: #7dd3fc; }
.startup-steps li.done .step-dot { border-color: #10b981; background: #10b981; box-shadow: 0 0 9px rgba(16, 185, 129, 0.65); }
.startup-steps li.done b { color: #6ee7b7; }
.startup-steps li.fault .step-dot { border-color: #ef4444; background: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.7); }
.startup-steps li.fault b { color: #fca5a5; }

.startup-progress {
  height: 6px;
  margin-top: 14px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.15);
}
#startup-progress-bar {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #0284c7, #38bdf8 55%, #10b981);
  transition: width 0.35s ease;
}
#startup-progress-bar.fault { background: linear-gradient(90deg, #7f1d1d, #ef4444); }

.startup-actions { display: flex; gap: 8px; margin-top: 16px; }
.startup-start {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 12px;
  border: 1px solid #38bdf8;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.36);
  animation: startGlow 2.6s ease-in-out infinite;
}
.startup-start:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(14, 165, 233, 0.5); }
.startup-start-ico { font-size: 1.05rem; }
@keyframes startGlow {
  0%, 100% { box-shadow: 0 10px 28px rgba(14, 165, 233, 0.32); }
  50% { box-shadow: 0 10px 38px rgba(56, 189, 248, 0.58); }
}

.startup-skip,
.startup-reset {
  padding: 12px 16px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.startup-skip:hover { border-color: #38bdf8; color: #e0f2fe; }
.startup-reset { border-color: #ef4444; background: rgba(239, 68, 68, 0.2); color: #fecaca; }
.startup-reset:hover { background: rgba(239, 68, 68, 0.32); }

.startup-note {
  margin-top: 10px;
  font-size: 0.64rem;
  line-height: 1.5;
  color: #64748b;
}

/* Power & quality drawers ------------------------------------------------- */
.power-drawer,
.quality-drawer {
  position: fixed;
  top: 76px;
  right: 14px;
  width: 378px;
  max-height: calc(100dvh - 156px);
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 14px;
  border-radius: 16px;
  background: var(--drawer-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-hud);
}
.quality-drawer { width: 326px; }

.power-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.drawer-eyebrow { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.14em; color: #38bdf8; }
.power-drawer-head h3 { margin-top: 2px; font-size: 1rem; font-weight: 600; color: #f1f5f9; }
.drawer-close-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.8rem;
}
.drawer-close-btn:hover { border-color: #38bdf8; color: #e0f2fe; }

.power-live-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.14), rgba(15, 23, 42, 0.42));
}
.power-state-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #94a3b8;
}
.power-state-label.starting { color: #fbbf24; text-shadow: 0 0 14px rgba(245, 158, 11, 0.4); }
.power-state-label.on { color: #34d399; text-shadow: 0 0 14px rgba(16, 185, 129, 0.5); }
.power-state-label.trip { color: #f87171; text-shadow: 0 0 14px rgba(239, 68, 68, 0.45); }
.power-live-copy small { display: block; margin-top: 4px; font-size: 0.62rem; line-height: 1.35; color: #64748b; }
.power-live-kw { text-align: right; flex-shrink: 0; }
.power-live-kw b { display: block; font-family: var(--font-mono); font-size: 1.55rem; line-height: 1; color: #f8fafc; }
.power-live-kw span { font-family: var(--font-mono); font-size: 0.58rem; color: #64748b; }

.power-meter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.power-meter-grid > div {
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
}
.power-meter-grid span { display: block; font-family: var(--font-mono); font-size: 0.52rem; letter-spacing: 0.08em; color: #64748b; }
.power-meter-grid b { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 0.7rem; color: #e2e8f0; }

.power-loadbar { height: 7px; border-radius: 99px; background: rgba(148, 163, 184, 0.14); overflow: hidden; }
#power-loadbar-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #0284c7, #38bdf8, #10b981); transition: width 0.3s ease, background 0.3s ease; }
#power-loadbar-fill.warn { background: linear-gradient(90deg, #b45309, #f59e0b); }
#power-loadbar-fill.danger { background: linear-gradient(90deg, #991b1b, #ef4444); }

.power-section { padding-top: 9px; border-top: 1px solid rgba(148, 163, 184, 0.12); }
.power-section-title { margin-bottom: 7px; font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.12em; color: #64748b; }

.genset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.genset-card {
  padding: 9px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.genset-card.running { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.06); }
.genset-card.online { border-color: rgba(16, 185, 129, 0.45); background: rgba(16, 185, 129, 0.07); }
.genset-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 6px; font-family: var(--font-mono); font-size: 0.6rem; }
.genset-head b { color: #cbd5e1; letter-spacing: 0.05em; }
.genset-head span { color: #64748b; font-size: 0.52rem; }
.genset-card.running .genset-head span { color: #fbbf24; }
.genset-card.online .genset-head span { color: #34d399; }
.genset-rows { display: flex; justify-content: space-between; gap: 3px; margin-bottom: 6px; font-family: var(--font-mono); font-size: 0.55rem; color: #64748b; }
.genset-rows b { color: #e2e8f0; }
.genset-fuel { height: 4px; border-radius: 99px; background: rgba(148, 163, 184, 0.15); overflow: hidden; }
#gen1-fuel-fill, #gen2-fuel-fill { width: 100%; height: 100%; background: linear-gradient(90deg, #0284c7, #38bdf8); transition: width 0.3s ease; }
#gen1-fuel-fill.low, #gen2-fuel-fill.low { background: linear-gradient(90deg, #991b1b, #ef4444); }
.genset-card small { display: flex; justify-content: space-between; margin-top: 4px; font-family: var(--font-mono); font-size: 0.5rem; color: #64748b; }
.genset-card small b { color: #94a3b8; }

.power-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.power-actions.secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pwr-btn {
  padding: 8px 6px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.16s ease;
}
.pwr-btn.small { font-size: 0.58rem; padding: 7px 4px; }
.pwr-btn:hover:not(:disabled) { border-color: #38bdf8; color: #e0f2fe; }
.pwr-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.pwr-start { border-color: #38bdf8; background: rgba(2, 132, 199, 0.28); color: #e0f2fe; }
.pwr-estop { border-color: #ef4444; background: rgba(239, 68, 68, 0.18); color: #fecaca; }
.pwr-estop.latched { animation: estopPulse 0.75s ease-in-out infinite; }
@keyframes estopPulse {
  0%, 100% { background: rgba(239, 68, 68, 0.18); }
  50% { background: rgba(239, 68, 68, 0.5); }
}
.pwr-reset { border-color: rgba(245, 158, 11, 0.5); color: #fcd34d; }
.pwr-auto.active { border-color: #10b981; color: #6ee7b7; background: rgba(16, 185, 129, 0.14); }

.protection-row { display: flex; gap: 6px; flex-wrap: wrap; }
.breaker-chip,
.protection-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.5);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: #94a3b8;
}
.breaker-chip::before,
.protection-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}
.breaker-chip.closed { border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
.breaker-chip.closed::before { background: #10b981; box-shadow: 0 0 7px #10b981; }
.protection-chip.warn { border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
.protection-chip.warn::before { background: #f59e0b; }
.protection-chip.danger { border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.protection-chip.danger::before { background: #ef4444; box-shadow: 0 0 7px #ef4444; }

.power-event-log {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 136px;
  overflow-y: auto;
  scrollbar-width: thin;
  font-family: var(--font-mono);
}
.power-log-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 6px;
  padding: 4px 6px;
  border-left: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.055);
  font-size: 0.55rem;
  line-height: 1.38;
  color: #94a3b8;
}
.power-log-msg { min-width: 0; overflow-wrap: anywhere; }
.power-log-row.success { border-left-color: #10b981; background: rgba(16, 185, 129, 0.06); color: #a7f3d0; }
.power-log-row.warn { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.06); color: #fde68a; }
.power-log-row.danger { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.07); color: #fecaca; }
.power-log-time { color: #475569; }

/* Quality drawer ---------------------------------------------------------- */
.quality-fps-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.14), rgba(15, 23, 42, 0.42));
  border: 1px solid rgba(56, 189, 248, 0.22);
}
.quality-fps-card b { font-family: var(--font-mono); font-size: 1.55rem; color: #34d399; }
.quality-fps-card span { font-family: var(--font-mono); font-size: 0.58rem; color: #64748b; }
.quality-fps-card small { font-family: var(--font-mono); font-size: 0.58rem; color: #94a3b8; }

.quality-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.quality-btn {
  flex: 1 1 auto;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.quality-btn:hover { border-color: #38bdf8; color: #e0f2fe; }
.quality-btn.active { border-color: #38bdf8; background: rgba(56, 189, 248, 0.2); color: #bae6fd; box-shadow: 0 0 14px rgba(56, 189, 248, 0.18); }

.quality-slider-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.08em; color: #94a3b8; }
.quality-slider-label b { color: #e2e8f0; }
.quality-slider { width: 100%; accent-color: #38bdf8; cursor: pointer; }
.quality-res-line { display: flex; justify-content: space-between; margin-top: 5px; font-family: var(--font-mono); font-size: 0.55rem; color: #64748b; }

.quality-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.quality-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.55);
  font-size: 0.65rem;
  color: #cbd5e1;
  cursor: pointer;
}
.quality-toggle input { accent-color: #38bdf8; cursor: pointer; }
.quality-note { font-size: 0.62rem; line-height: 1.55; color: #64748b; }
.quality-note b { color: #94a3b8; }

/* Trip banner + toast ---------------------------------------------------- */
.power-trip-banner {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(720px, calc(100vw - 28px));
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.65);
  background: rgba(38, 7, 12, 0.95);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
}
.trip-icon { font-size: 1.3rem; flex-shrink: 0; }
.trip-copy { flex: 1; min-width: 0; }
.trip-copy b { display: block; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; color: #fca5a5; }
.trip-copy span { display: block; margin-top: 2px; font-size: 0.68rem; color: #fecaca; opacity: 0.82; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-reset-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid #fca5a5;
  background: #ef4444;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.trip-reset-btn:hover { background: #dc2626; }

.power-toast {
  position: fixed;
  top: 142px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 125;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(680px, calc(100vw - 28px));
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(8, 15, 29, 0.95);
  backdrop-filter: blur(12px);
  color: #e2e8f0;
  font-size: 0.72rem;
  line-height: 1.35;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
}
.power-toast.success { border-color: rgba(16, 185, 129, 0.55); color: #a7f3d0; }
.power-toast.warn { border-color: rgba(245, 158, 11, 0.55); color: #fde68a; }
.power-toast.danger { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }

/* Mobile layout ----------------------------------------------------------- */
@media (max-width: 900px) {
  .action-label { display: none; }

  .power-trigger-btn,
  .quality-trigger-btn {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
  }

  .top-right-actions { flex-wrap: wrap; }

  .sub-hud { top: 100px; left: 8px; }
  .power-hud-pill { font-size: 0.62rem; padding: 4px 9px; gap: 5px; }

  .fly-hud { top: 164px; }
  .ai-subtitle-banner { top: 164px; }

  .power-drawer,
  .quality-drawer {
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 76dvh;
    z-index: 70;
    padding: 12px;
  }

  .power-trip-banner {
    top: 108px;
    width: calc(100vw - 16px);
    padding: 9px 11px;
  }
  .trip-copy b { font-size: 0.62rem; }
  .trip-copy span { font-size: 0.62rem; }
  .power-toast { top: 166px; font-size: 0.64rem; }

  .startup-overlay { align-items: flex-start; padding: 14px 10px 28px; }
  .startup-shell { grid-template-columns: 1fr; gap: 14px; width: min(560px, 100%); }
  .startup-hero h2 { font-size: 1.85rem; margin-top: 8px; }
  .startup-hero p { margin-top: 8px; font-size: 0.76rem; line-height: 1.55; }
  .startup-specs { margin-top: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .startup-specs li { padding: 7px 9px; }
  .startup-specs b { font-size: 0.78rem; }
  .startup-foot { display: none; }
  .startup-panel { padding: 15px; border-radius: 16px; }
  .power-source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .startup-steps li { grid-template-columns: 14px 1fr; padding: 6px 0; }
  .startup-steps li small { display: none; }
  .startup-actions { flex-wrap: wrap; }
  .startup-start { flex: 1 1 100%; padding: 12px 14px; }
  .startup-skip, .startup-reset { flex: 1; padding: 10px 12px; }

  .genset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .brand-text h1 { font-size: 0.72rem; }
  .brand-text p { display: none; }
  .quick-tour-btn, .qr-trigger-btn, .control-box-toggle, .power-trigger-btn, .quality-trigger-btn {
    padding: 7px 9px;
    font-size: 0.7rem;
    gap: 5px;
  }
  .power-meter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .power-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .power-actions.secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .genset-grid { grid-template-columns: 1fr; }
  .startup-hero p { display: none; }
  .startup-specs { display: none; }
  .startup-hero h2 { font-size: 1.55rem; }
  .startup-eyebrow { font-size: 0.56rem; }
  .startup-panel-title b { font-size: 0.74rem; }
  .startup-panel-title small { font-size: 0.62rem; }
  .power-drawer-head h3 { font-size: 0.9rem; }
  .power-live-kw b { font-size: 1.3rem; }
  .power-trip-banner { top: 104px; }
  .power-toast { top: 162px; white-space: normal; border-radius: 12px; }
}

/* Live FPS HUD pill */
.fps-hud-pill { border-color: rgba(52, 211, 153, 0.35); }
.fps-hud-pill:hover { border-color: rgba(56, 189, 248, 0.65); }
.fps-hud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.fps-hud-dot.good { background: #34d399; box-shadow: 0 0 8px #34d399; }
.fps-hud-dot.mid  { background: #fbbf24; box-shadow: 0 0 8px #fbbf24; }
.fps-hud-dot.low  { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
