/* Pinnacle Systems Mobile App Stylesheet */
:root {
  --bg-primary: #0b0d11;
  --bg-card: #14171f;
  --bg-card-subtle: #1a1e27;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(234, 194, 93, 0.4);
  --gold-primary: #EAC25D;
  --gold-glow: rgba(234, 194, 93, 0.25);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Spectrum Specific Colors */
  --ch-main: #fef08a;       /* Warm Daylight White */
  --ch-main-glow: rgba(254, 240, 138, 0.35);
  --ch-red: #ef4444;        /* 660nm Deep Red */
  --ch-red-glow: rgba(239, 68, 68, 0.35);
  --ch-farred: #881337;     /* 730nm Dark Dark Red */
  --ch-farred-glow: rgba(136, 19, 55, 0.45);
  --ch-uv: #a855f7;         /* 395nm UVA */
  --ch-uv-glow: rgba(168, 85, 247, 0.35);

  --accent-green: #10b981;
  --accent-blue: #3b82f6;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 68px);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 17, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-emblem {
  width: 32px;
  height: 32px;
  background: var(--gold-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 17px;
  color: #0b0d11;
  box-shadow: 0 0 12px var(--gold-glow);
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 9px;
  font-weight: 600;
  color: var(--gold-primary);
  letter-spacing: 0.06em;
  margin-top: 1px;
}

.ble-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ble-status-pill:active {
  transform: scale(0.96);
}

.ble-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
}

.ble-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.ble-dot.connecting {
  background: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-glow);
  animation: pulse-dot 1s infinite alternate;
}

@keyframes pulse-dot {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Main Container */
.main-content {
  padding: 14px 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Port Selector: 2x4 PCB Physical Layout Grid (Ports 1-4 over 5-8) */
.port-pcb-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.port-pcb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.port-card-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  min-height: 56px;
  justify-content: center;
}

.port-card-compact:active {
  transform: scale(0.95);
}

.port-card-compact.active {
  background: linear-gradient(180deg, rgba(234, 194, 93, 0.18) 0%, rgba(20, 23, 31, 0.98) 100%);
  border: 1px solid var(--gold-primary);
  box-shadow: 0 0 12px rgba(234, 194, 93, 0.25);
}

.port-card-compact.disabled {
  opacity: 0.38;
  filter: grayscale(0.7);
  border-style: dashed;
  cursor: pointer;
  background: rgba(11, 13, 17, 0.6);
}

.port-card-compact.disabled .port-pct-pill {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.port-num-badge {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 3px;
}

.port-card-compact.active .port-num-badge {
  color: var(--gold-primary);
}

.port-model-label {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.port-pct-pill {
  font-size: 8.5px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.45);
  color: #d1d5db;
}

.port-card-compact.active .port-pct-pill {
  color: var(--gold-primary);
  border: 1px solid rgba(234, 194, 93, 0.35);
}

.slider-ch3::-webkit-slider-thumb {
  border-color: var(--ch-farred);
  background: #fecdd3;
  box-shadow: 0 0 12px var(--ch-farred-glow);
}

/* Card General */
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Port Banner / Metadata */
.port-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.port-hero-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.port-hero-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.port-hero-tag {
  font-size: 10px;
  color: var(--gold-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fixture-badge {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Live Total Output Gauge */
.power-summary-bar {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.power-summary-val {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  font-family: 'JetBrains Mono', monospace, monospace;
}

.power-summary-sub {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Spectrum Sliders Section */
.spectrum-control-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-tag-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-color-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.channel-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.channel-spec {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: monospace;
}

.channel-pct-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
}

/* Slider Controls */
.slider-container {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.touch-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 28px;
  border-radius: 14px;
  background: #0f1218;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  position: relative;
}

/* Custom WebKit Track & Thumb */
.touch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #14171f;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.touch-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #14171f;
  cursor: pointer;
}

/* Channel-Specific Slider Visual Styles */
.slider-ch1::-webkit-slider-thumb {
  border-color: var(--ch-main);
  background: #fff;
  box-shadow: 0 0 12px var(--ch-main-glow);
}
.slider-ch2::-webkit-slider-thumb {
  border-color: var(--ch-red);
  background: #fee2e2;
  box-shadow: 0 0 12px var(--ch-red-glow);
}
.slider-ch3::-webkit-slider-thumb {
  border-color: var(--ch-farred);
  background: #ffedd5;
  box-shadow: 0 0 12px var(--ch-farred-glow);
}
.slider-ch4::-webkit-slider-thumb {
  border-color: var(--ch-uv);
  background: #f3e8ff;
  box-shadow: 0 0 12px var(--ch-uv-glow);
}

/* Fine-Tune Nudge Buttons */
.nudge-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.nudge-btn:active {
  background: rgba(234, 194, 93, 0.2);
  transform: scale(0.92);
}

/* Segmented Strength Meter */
.strength-meter-bar {
  display: flex;
  gap: 3px;
  height: 6px;
  width: 100%;
  margin-top: 2px;
}

.meter-segment {
  flex: 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  transition: all 0.15s ease;
}

.meter-segment.lit-main {
  background: var(--ch-main);
  box-shadow: 0 0 4px var(--ch-main-glow);
}
.meter-segment.lit-red {
  background: var(--ch-red);
  box-shadow: 0 0 4px var(--ch-red-glow);
}
.meter-segment.lit-farred {
  background: var(--ch-farred);
  box-shadow: 0 0 4px var(--ch-farred-glow);
}
.meter-segment.lit-uv {
  background: var(--ch-uv);
  box-shadow: 0 0 4px var(--ch-uv-glow);
}

/* Presets Grid */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.preset-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:active {
  transform: scale(0.95);
  background: rgba(234, 194, 93, 0.15);
  border-color: var(--gold-primary);
}

.preset-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
}

.preset-sub {
  font-size: 8px;
  color: var(--text-dim);
}

/* Quick Action Row */
.quick-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-secondary {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.97);
}

.btn-primary {
  flex: 1;
  background: var(--gold-primary);
  color: #0b0d11;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--gold-glow);
  transition: all 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(14, 17, 23, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  padding: 8px 12px calc(8px + var(--safe-bottom)) 12px;
  z-index: 100;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.nav-tab.active {
  color: var(--gold-primary);
}

.nav-icon {
  font-size: 18px;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 10px 0;
}

.pin-digit-box {
  width: 38px;
  height: 48px;
  border-radius: 8px;
  background: #0f1218;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  font-family: monospace;
  color: var(--gold-primary);
}

.pin-digit-box.filled {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-glow);
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.num-key {
  height: 48px;
  border-radius: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.num-key:active {
  background: var(--gold-primary);
  color: #000;
}

/* Modbus Hex Terminal */
.hex-terminal {
  background: #080a0d;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 10px;
  color: #10b981;
  max-height: 180px;
  overflow-y: auto;
  line-height: 1.5;
}

.hex-line {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 3px 0;
}

.hex-bytes {
  color: #EAC25D;
}

/* Form Controls */
.form-input, .form-select {
  width: 100%;
  background: #0f1218;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-glow);
}

.form-select option {
  background: #14171f;
  color: #fff;
  padding: 6px;
}

.channel-card.inactive-channel {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(0.8);
}

/* Controller Architecture Selection Cards */
.controller-select-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
}

.controller-type-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

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

.controller-type-card.selected {
  background: linear-gradient(180deg, rgba(234, 194, 93, 0.16) 0%, rgba(20, 23, 31, 0.98) 100%);
  border: 1px solid var(--gold-primary);
  box-shadow: 0 0 16px rgba(234, 194, 93, 0.22);
}

/* Distinct Blue Theme when Analog PWM is Selected */
#optPwm.selected {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18) 0%, rgba(20, 23, 31, 0.98) 100%);
  border: 1px solid #3b82f6;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.28);
}

#optPwm.selected .controller-type-title {
  color: #60a5fa;
}

#optPwm.selected .radio-dot {
  border-color: #3b82f6;
}

#optPwm.selected .radio-dot-inner {
  background: #3b82f6;
  display: block;
}

.controller-type-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.controller-type-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.controller-type-card.selected .controller-type-title {
  color: var(--gold-primary);
}

.controller-type-desc {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.controller-type-card.selected .radio-dot {
  border-color: var(--gold-primary);
}

.radio-dot-inner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-primary);
  display: none;
}

.controller-type-card.selected .radio-dot-inner {
  display: block;
}

/* Polarity Switcher in PWM Mode */
.polarity-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 8px;
}

/* Gateway / Onboarding Fullscreen Flow */
.gateway-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background-color: #0b0d11;
  background: radial-gradient(circle at 50% 20%, #171b24 0%, #0b0d11 80%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 24px) 16px env(safe-area-inset-bottom, 24px) 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.gateway-screen.dismissed {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
  display: none !important;
}

/* Lock down body completely while gateway is active: zero background bleed, zero scrolling */
body.gateway-active {
  overflow: hidden !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  width: 100dvw !important;
  height: 100% !important;
  height: 100dvh !important;
  touch-action: none !important;
  overscroll-behavior: none !important;
}

body.gateway-active .app-header,
body.gateway-active .main-content,
body.gateway-active .app-shell,
body.gateway-active .bottom-nav {
  display: none !important;
}

.gateway-card {
  max-width: 380px;
  width: 100%;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.gateway-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

.gateway-emblem {
  width: 68px;
  height: 68px;
  background: var(--gold-primary);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 36px;
  color: #0b0d11;
  box-shadow: 0 0 28px var(--gold-glow);
  margin-bottom: 12px;
}

.gateway-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fff;
  line-height: 1;
}

.gateway-sub {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.gateway-ver {
  font-size: 8.5px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-top: 3px;
  font-family: monospace;
}

.gw-step {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gw-desc {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 20px 0;
}

.gw-btn-large {
  width: 100%;
  padding: 14px;
  font-size: 13px;
  letter-spacing: 0.05em;
}

/* Radar Animation */
.radar-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.radar-ring {
  position: absolute;
  border: 2px solid var(--gold-primary);
  border-radius: 50%;
  opacity: 0;
  animation: radar-pulse 2s infinite ease-out;
}

.radar-ring.r1 {
  width: 36px;
  height: 36px;
  animation-delay: 0s;
}
.radar-ring.r2 {
  width: 72px;
  height: 72px;
  animation-delay: 0.6s;
}
.radar-ring.r3 {
  width: 110px;
  height: 110px;
  animation-delay: 1.2s;
}

.radar-center {
  font-size: 26px;
  z-index: 2;
}

@keyframes radar-pulse {
  0% {
    transform: scale(0.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.found-device-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
}

.found-device-card:hover, .found-device-card:active {
  border-color: var(--gold-primary);
  transform: scale(0.98);
}

/* ================= AUTONOMOUS SCHEDULING & BURST ENGINE ================= */
.sched-copy-btn {
  background: transparent;
  border: 1px solid var(--border-gold);
  color: var(--gold-primary);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sched-copy-btn:active {
  background: rgba(234, 194, 93, 0.2);
}

.sched-channel-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.sched-ch-pill {
  flex: 1 0 auto;
  min-width: 76px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sched-ch-pill.active {
  border-color: var(--gold-primary);
  background: rgba(234, 194, 93, 0.12);
  box-shadow: 0 0 10px var(--gold-glow);
}

.sched-timeline-card {
  background: #090b0e;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.timeline-bar-wrap {
  position: relative;
  height: 24px;
  background: #141720;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
  margin: 8px 0 6px 0;
}

.timeline-track {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  overflow: hidden;
}

.timeline-block {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  opacity: 0.95;
  box-shadow: 0 0 8px currentColor;
  transition: all 0.2s ease;
}

.timeline-now-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: #ffffff;
  z-index: 10;
  pointer-events: none;
}

.timeline-now-marker .now-pin {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px #ffffff;
}

.timeline-hours-row {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: var(--text-dim);
  font-family: monospace;
}

.sched-mode-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-card-subtle);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.sched-mode-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.sched-mode-btn.active {
  background: var(--bg-card);
  border-color: var(--border-gold);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.sched-mode-btn .mode-icon {
  font-size: 18px;
}

.sched-mode-btn .mode-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
}

.sched-mode-btn .mode-sub {
  font-size: 8.5px;
  color: var(--gold-primary);
  margin-top: 1px;
}

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

.time-input-card {
  background: var(--bg-card-subtle);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.time-picker {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  width: 100%;
  outline: none;
  font-family: monospace;
}

.slider-box {
  background: var(--bg-card-subtle);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.burst-info-box {
  background: rgba(234, 194, 93, 0.08);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.burst-preset-row {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.burst-preset-row:active {
  border-color: var(--gold-primary);
  transform: scale(0.99);
}

.burst-event-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.burst-event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.burst-del-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

.burst-del-btn:active {
  background: rgba(239, 68, 68, 0.3);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  transition: .2s;
  border-radius: 22px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent-green);
}

input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

/* Utility */
.hidden {
  display: none !important;
}
