:root {
  --bg-obsidian: #05070f;
  --bg-elevated: #0b0f1d;
  --glass-bg: rgba(18, 24, 42, 0.62);
  --glass-bg-hover: rgba(26, 34, 58, 0.75);
  --glass-bg-strong: rgba(15, 20, 36, 0.84);
  --glass-border: rgba(255, 255, 255, 0.085);
  --glass-border-highlight: rgba(255, 255, 255, 0.18);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --aurora-1: #278371;
  --aurora-2: #6366f1;
  --aurora-3: #10b981;
  --lens-color: #3b82f6;

  --accent-cyan: #38bdf8;
  --accent-indigo: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #f43f5e;

  --radius-2xl: 24px;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow-glass: 0 16px 40px -10px rgba(0, 0, 0, 0.65), inset 0 1px 0 0 rgba(255, 255, 255, 0.11);
  --shadow-subtle: 0 6px 20px -4px rgba(0, 0, 0, 0.45), inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
  --transition-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:
    max(10px, calc(env(safe-area-inset-top, 0px) + 6px))
    max(12px, env(safe-area-inset-right, 12px))
    calc(86px + env(safe-area-inset-bottom, 12px))
    max(12px, env(safe-area-inset-left, 12px));
  position: relative;
}

/* =========================================================
   LIVING AMBIENT AURORA BACKDROP
========================================================== */
.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, #0c1226 0%, #05070f 75%);
}

.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.26;
  transition: background-color 1.2s ease, transform 1.2s ease;
  will-change: transform, background-color;
}

.blob-main {
  width: 360px;
  height: 360px;
  background: var(--aurora-1);
  top: -90px;
  left: -60px;
  animation: floatAmbient 14s ease-in-out infinite alternate;
}

.blob-lens {
  width: 280px;
  height: 280px;
  background: var(--lens-color);
  top: 60px;
  right: -80px;
  opacity: 0.18;
  animation: floatAmbient 18s ease-in-out infinite alternate-reverse;
}

.blob-accent {
  width: 320px;
  height: 320px;
  background: var(--aurora-2);
  bottom: 5%;
  left: 20%;
  opacity: 0.12;
}

@keyframes floatAmbient {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(28px, 22px, 0) scale(1.12); }
}

/* =========================================================
   APP SHELL &UNIFIED MINIMALIST TOP BAR
========================================================== */
.app-shell {
  width: 100%;
  max-width: 470px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.top-bar {
  position: relative;
  z-index: 80;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-subtle);
}

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

.brand-emblem {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.brand-emblem svg {
  width: 20px;
  height: 20px;
}

.brand-titles {
  min-width: 0;
}

.brand-titles h1 {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-titles p {
  font-size: 0.65rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Integrated BLE Connection Pill */
.conn-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius-pill);
  padding: 4px 5px 4px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s var(--transition-smooth);
}

.conn-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(56, 189, 248, 0.35);
}

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

.conn-pill.is-connected {
  background: rgba(16, 185, 129, 0.11);
  border-color: rgba(16, 185, 129, 0.32);
}

.conn-pill.is-reconnecting {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.connecting,
.status-dot.reconnecting {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: pulseDot 1.1s infinite ease-in-out;
}

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

.conn-pill-cta {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.9), rgba(99, 102, 241, 0.9));
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.conn-pill-cta.connected {
  background: rgba(16, 185, 129, 0.16);
  color: #d1fae5;
}

.conn-pill.is-reconnecting .conn-pill-cta {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
}

/* Custom Glassmorphic Language Dropdown */
.lang-dropdown {
  position: relative;
  display: inline-flex;
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius-pill);
  padding: 5px 9px;
  color: var(--text-primary);
  font-size: 0.69rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--transition-smooth);
}

.lang-trigger:hover,
.lang-dropdown.open .lang-trigger {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.16);
}

.lang-trigger:active {
  transform: scale(0.96);
}

.lang-icon {
  width: 13px;
  height: 13px;
  color: #7dd3fc;
  flex-shrink: 0;
}

.lang-current {
  line-height: 1;
  white-space: nowrap;
}

.lang-chevron {
  width: 11px;
  height: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.22s var(--transition-smooth), color 0.2s ease;
}

.lang-dropdown.open .lang-chevron {
  transform: rotate(180deg);
  color: #7dd3fc;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 168px;
  padding: 5px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 23, 44, 0.99) 0%, rgba(10, 15, 29, 0.995) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(56, 189, 248, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top right;
  transition:
    opacity 0.18s ease,
    transform 0.22s var(--transition-smooth),
    visibility 0.18s ease;
  z-index: 120;
}

.lang-dropdown.open .lang-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}

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

.lang-option.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(99, 102, 241, 0.14));
  border-color: rgba(56, 189, 248, 0.34);
  color: #ffffff;
}

.lang-opt-tag {
  min-width: 24px;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
  flex-shrink: 0;
}

.lang-option.active .lang-opt-tag {
  background: rgba(56, 189, 248, 0.24);
  color: #bae6fd;
}

.lang-opt-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-opt-check {
  width: 13px;
  height: 13px;
  color: #38bdf8;
  opacity: 0;
  transform: scale(0.75);
  transition: all 0.16s ease;
  flex-shrink: 0;
}

.lang-option.active .lang-opt-check {
  opacity: 1;
  transform: scale(1);
}

/* =========================================================
   WORKSPACE GRID & MASTER STAGE CARD
========================================================== */
.workspace-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.stage-column,
.content-column {
  min-width: 0;
}

.aurora-stage {
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--shadow-glass);
  transition: all 0.35s var(--transition-smooth);
}

.stage-glow-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 40%, color-mix(in srgb, var(--aurora-1) 30%, transparent), transparent 62%),
    radial-gradient(circle at 75% 25%, color-mix(in srgb, var(--lens-color) 18%, transparent), transparent 55%);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
}

.aurora-stage.lamp-off .stage-glow-mesh {
  opacity: 0.08;
}

.stage-hero-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 3D Fluid Aurora Sphere & Lens Satellite */
.orb-assembly {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s var(--transition-smooth);
}

.orb-assembly:active {
  transform: scale(0.92);
}

.orb-halo {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: var(--aurora-1);
  filter: blur(16px);
  opacity: 0.48;
  transition: background-color 0.5s ease, opacity 0.5s ease;
}

.orb-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, var(--aurora-1) 48%, #050814 96%);
  box-shadow:
    0 0 24px color-mix(in srgb, var(--aurora-1) 65%, transparent),
    inset 0 2px 6px rgba(255, 255, 255, 0.55),
    inset 0 -6px 12px rgba(0, 0, 0, 0.55);
  position: relative;
  transition: background 0.45s ease, box-shadow 0.45s ease, opacity 0.4s ease, filter 0.4s ease;
}

.orb-inner-sheen {
  position: absolute;
  top: 7px;
  left: 10px;
  width: 20px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0));
  transform: rotate(-25deg);
  pointer-events: none;
}

.orb-main.orb-rgb-mix {
  background:
    radial-gradient(circle at 38% 35%, #ffffff 0%, rgba(255, 255, 255, 0.9) 26%, transparent 68%),
    conic-gradient(from 0deg, #ef4444, #eab308, #10b981, #06b6d4, #3b82f6, #ec4899, #ef4444);
  box-shadow:
    -8px -6px 22px rgba(239, 68, 68, 0.55),
    8px -6px 22px rgba(16, 185, 129, 0.55),
    0 10px 24px rgba(59, 130, 246, 0.65),
    inset 0 2px 6px rgba(255, 255, 255, 0.7);
}

.aurora-stage.lamp-off .orb-main,
.aurora-stage.lamp-off .orb-lens,
.aurora-stage.lamp-off .orb-halo {
  filter: grayscale(85%) brightness(0.32);
  opacity: 0.45;
  box-shadow: none;
}

.orb-main.mode-fade {
  animation: orbFade calc(8s * var(--mode-speed-mul, 1)) infinite linear;
}
.orb-main.mode-strobe {
  animation: orbStrobe calc(1.3s * var(--mode-speed-mul, 1)) infinite steps(2, start);
}
.orb-main.mode-flash {
  animation: orbFlash calc(0.75s * var(--mode-speed-mul, 1)) infinite alternate ease-in-out;
}

/* Soft sequencer transition: orb dips while the color switches in the dark */
.aurora-stage.seq-soft-dip .orb-main {
  filter: brightness(0.35) saturate(0.7);
}

/* Preview of hardware FADE: continuous journey through the whole spectrum */
@keyframes orbFade {
  0% { transform: scale(1); filter: brightness(1) hue-rotate(0deg); }
  25% { transform: scale(0.97); filter: brightness(0.85) hue-rotate(90deg); }
  50% { transform: scale(0.94); filter: brightness(0.7) hue-rotate(180deg); }
  75% { transform: scale(0.97); filter: brightness(0.85) hue-rotate(270deg); }
  100% { transform: scale(1); filter: brightness(1) hue-rotate(360deg); }
}
@keyframes orbStrobe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes orbFlash {
  0% { transform: scale(0.95); filter: brightness(0.8); }
  100% { transform: scale(1.06); filter: brightness(1.3) hue-rotate(-20deg); }
}

/* Stage Meta & Power Pills */
.stage-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-secondary);
}

.status-badge.is-on {
  color: #d1fae5;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.28);
}

.status-badge.is-off {
  color: var(--text-muted);
}

.badge-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-badge.is-off .badge-indicator {
  background: var(--text-muted);
  box-shadow: none;
}

.badge-svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.badge-amber {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-cyan {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.3);
}

/* Explicit ON / OFF Glassmorphic Sync Pills */
.power-sync-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.power-pill-btn {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
}

.power-pill-btn svg {
  width: 14px;
  height: 14px;
}

.power-pill-btn:active {
  transform: scale(0.96);
}

.power-on-btn.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(16, 185, 129, 0.18));
  border-color: rgba(56, 189, 248, 0.45);
  color: #ffffff;
  box-shadow: 0 4px 14px -2px rgba(56, 189, 248, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.power-off-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--text-primary);
}

/* Unified Apple Home Brightness Dock */
.brightness-dock {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 9, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-lg);
  padding: 5px;
}

.bright-step-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.bright-step-btn svg {
  width: 13px;
  height: 13px;
}

.bright-step-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  color: var(--text-primary);
}

.bright-step-btn:active {
  transform: scale(0.93);
}

.bright-track {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.bright-seg {
  min-width: 0;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bright-seg.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(56, 189, 248, 0.14));
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.85);
}

.bright-seg.current {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(56, 189, 248, 0.28));
  border-color: rgba(255, 255, 255, 0.38);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.22);
}

.bright-seg:active {
  transform: scale(0.94);
}

/* Mobile Compact Stage Mode on Audio & Device Tabs */
@media (max-width: 859px) {
  .aurora-stage.stage-compact-mobile {
    padding: 9px 12px;
    gap: 7px;
  }
  .aurora-stage.stage-compact-mobile .orb-assembly {
    width: 44px;
    height: 44px;
  }
  .aurora-stage.stage-compact-mobile .orb-main {
    width: 38px;
    height: 38px;
  }
  .aurora-stage.stage-compact-mobile .orb-lens {
    width: 15px;
    height: 15px;
  }
  .aurora-stage.stage-compact-mobile .brightness-dock {
    display: none;
  }
}

/* =========================================================
   TAB PANELS & GLASS CARDS
========================================================== */
.tab-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  animation: panelEnter 0.26s var(--transition-smooth);
}

.tab-panel.active {
  display: flex;
}

@keyframes panelEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  box-shadow: var(--shadow-subtle);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.section-head.compact {
  margin-bottom: -2px;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  min-width: 0;
}

.section-sub {
  font-size: 0.67rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 2px;
}

/* =========================================================
   TAB 1: CURATED AURORA SCENES & SEQUENCER
========================================================== */
.scenes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scene-tile {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: rgba(15, 20, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 11px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.22s var(--transition-smooth);
}

.scene-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, var(--sc-tint, rgba(56, 189, 248, 0.22)), transparent 70%);
  opacity: 0.75;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.scene-tile:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.scene-tile:active {
  transform: scale(0.97);
}

.scene-tile.active-scene {
  border-color: var(--sc-border, #38bdf8);
  box-shadow: 0 0 0 1px var(--sc-border, #38bdf8), 0 8px 20px -6px rgba(0, 0, 0, 0.6);
}

.scene-tile.active-scene::before {
  opacity: 1;
}

.sc-aurora { --sc-tint: rgba(16, 185, 129, 0.28); --sc-border: #34d399; --sc-icon: #6ee7b7; }
.sc-sleep  { --sc-tint: rgba(59, 130, 246, 0.25); --sc-border: #60a5fa; --sc-icon: #93c5fd; }
.sc-sunset { --sc-tint: rgba(239, 68, 68, 0.28);  --sc-border: #f87171; --sc-icon: #fca5a5; }
.sc-party  { --sc-tint: rgba(168, 85, 247, 0.28); --sc-border: #c084fc; --sc-icon: #d8b4fe; }
.sc-zen    { --sc-tint: rgba(20, 184, 166, 0.26); --sc-border: #2dd4bf; --sc-icon: #5eead4; }
.sc-read   { --sc-tint: rgba(234, 179, 8, 0.25);  --sc-border: #facc15; --sc-icon: #fde047; }

.scene-icon-box {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--sc-icon, #38bdf8);
}

.scene-icon-box svg {
  width: 19px;
  height: 19px;
}

.scene-info {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scene-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scene-sub {
  font-size: 0.63rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Custom Flow Sequencer Rings (All 13 Hardware Colors) */
.seq-ring-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 2px 0;
}

.seq-ring {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.12);
  padding: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--transition-smooth);
}

.seq-ring.seq-ring-rgb .seq-ring-core {
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0%, rgba(255, 255, 255, 0.8) 28%, transparent 70%),
    conic-gradient(from 0deg, #ef4444, #10b981, #3b82f6, #ef4444);
}

.seq-ring-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ring-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
}

.seq-ring-core svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s var(--transition-smooth);
}

.seq-ring.selected {
  border-color: #ffffff;
  box-shadow: 0 0 12px color-mix(in srgb, var(--ring-color) 80%, transparent);
  transform: scale(1.05);
}

.seq-ring.selected .seq-ring-core {
  color: #ffffff;
}

.seq-ring.selected .seq-ring-core svg {
  opacity: 1;
  transform: scale(1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.seq-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.seq-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.glass-select {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
    no-repeat right 7px center,
    rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 5px 21px 5px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 0;
  outline: none;
  cursor: pointer;
}

.glass-select option {
  background: #0f1526;
  color: var(--text-primary);
}

.btn-primary-pill {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(99, 102, 241, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #ffffff;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 0.73rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.18);
}

.btn-primary-pill:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(99, 102, 241, 0.35));
}

.btn-primary-pill:active {
  transform: scale(0.96);
}

.btn-primary-pill.running {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.28), rgba(245, 158, 11, 0.28));
  border-color: rgba(244, 63, 94, 0.55);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.25);
}

.btn-svg {
  width: 13px;
  height: 13px;
}

/* =========================================================
   TAB 2: MODERN LIGHT & COLOR PALETTE
========================================================== */
.mode-segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  background: rgba(6, 9, 18, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-lg);
  padding: 4px;
}

.mode-seg-btn {
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 4px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
}

.mode-seg-btn span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-seg-btn svg {
  width: 16px;
  height: 16px;
}

.mode-seg-btn:hover {
  color: var(--text-primary);
}

.mode-seg-btn.active-mode {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* Lens 4-Color Capsules */
.lens-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.lens-capsule {
  min-width: 0;
  background: rgba(15, 20, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 9px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s var(--transition-smooth);
}

.lens-capsule:active {
  transform: scale(0.95);
}

.lens-r { --lc: #ef4444; }
.lens-g { --lc: #10b981; }
.lens-b { --lc: #3b82f6; }
.lens-w { --lc: #f8fafc; }

.lens-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, var(--lc) 65%);
  box-shadow: 0 0 10px var(--lc);
  flex-shrink: 0;
}

.lens-w .lens-dot {
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0%, rgba(255, 255, 255, 0.85) 30%, transparent 70%),
    conic-gradient(from 0deg, #ef4444, #10b981, #3b82f6, #ef4444);
  box-shadow:
    -2px -2px 7px rgba(239, 68, 68, 0.6),
    2px -2px 7px rgba(16, 185, 129, 0.6),
    0 3px 8px rgba(59, 130, 246, 0.7);
}

.lens-w.selected-swatch {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(16, 185, 129, 0.14), rgba(59, 130, 246, 0.18));
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.45),
    -4px 4px 14px -4px rgba(239, 68, 68, 0.45),
    4px 4px 14px -4px rgba(59, 130, 246, 0.45);
}

.lens-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.lens-text strong {
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.1;
}

.lens-text span {
  font-size: 0.62rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lens-capsule.selected-swatch {
  background: color-mix(in srgb, var(--lc) 18%, rgba(15, 20, 36, 0.85));
  border-color: var(--lc);
  box-shadow: 0 0 0 1px var(--lc), 0 6px 16px -4px color-mix(in srgb, var(--lc) 45%, transparent);
}

/* Main Lamp 9-Color Jewel Palette (3x3) */
.jewel-palette-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.jewel-swatch {
  min-width: 0;
  background: rgba(15, 20, 36, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s var(--transition-smooth);
}

.jewel-swatch:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
}

.jewel-swatch:active {
  transform: scale(0.95);
}

.jewel-orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.75) 0%, var(--swatch-color) 52%, rgba(0, 0, 0, 0.5) 100%);
  box-shadow: 0 0 12px color-mix(in srgb, var(--swatch-color) 70%, transparent);
  flex-shrink: 0;
}

.jewel-name {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jewel-swatch.selected-swatch {
  background: color-mix(in srgb, var(--swatch-color) 22%, rgba(15, 20, 36, 0.85));
  border-color: var(--swatch-color);
  box-shadow: 0 0 0 1px var(--swatch-color), 0 6px 16px -4px color-mix(in srgb, var(--swatch-color) 50%, transparent);
}

.eco-footnote {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.64rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.footnote-icon {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
  flex-shrink: 0;
  margin-top: 1px;
}

/* =========================================================
   TAB 3: AUDIO, AMBIENT SYNTH & SLEEP ROUTINES
========================================================== */
.media-transport-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 7px;
}

.transport-btn {
  min-width: 0;
  background: rgba(15, 20, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 9px 5px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--transition-smooth);
}

.transport-btn span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transport-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.transport-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.transport-btn:active {
  transform: scale(0.95);
}

.transport-play {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(99, 102, 241, 0.18));
  border-color: rgba(56, 189, 248, 0.35);
}

.transport-noise {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.25);
}

.volume-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 7px;
}

.vol-pill {
  min-width: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 7px 6px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.vol-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.vol-pill svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.vol-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

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

.vol-mute {
  color: #fda4af;
}

/* Ambient Soundscape Mixer */
.synth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.synth-tile {
  min-width: 0;
  background: rgba(15, 20, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.22s ease;
}

.synth-tile.playing {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.14), rgba(16, 185, 129, 0.12));
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 16px -4px rgba(56, 189, 248, 0.25);
}

.synth-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.synth-label-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.synth-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.synth-icon svg {
  width: 15px;
  height: 15px;
}

.synth-name {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.synth-play-indicator {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.synth-tile.playing .synth-play-indicator {
  background: var(--accent-cyan);
  color: #05070f;
}

.synth-play-indicator svg {
  width: 11px;
  height: 11px;
}

.synth-slider {
  width: 100%;
  min-width: 0;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  outline: none;
}

.synth-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

/* Sleep Timer & Sunset Routine */
.timer-pill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.timer-pill {
  min-width: 0;
  background: rgba(15, 20, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 9px 4px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.timer-pill strong {
  font-size: 0.76rem;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-pill span {
  font-size: 0.61rem;
  color: var(--text-secondary);
}

.timer-pill.active-timer-pill {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.timer-pill.timer-cancel {
  border-color: rgba(244, 63, 94, 0.22);
  color: #fda4af;
}

.sunset-routine-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sunset-info {
  flex: 1;
  min-width: 0;
}

.sunset-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sunset-svg {
  width: 15px;
  height: 15px;
  color: #fb923c;
  flex-shrink: 0;
}

.sunset-info p {
  font-size: 0.64rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

/* =========================================================
   TAB 4: SETTINGS, GUIDE & COLLAPSIBLE GEEK DRAWER
========================================================== */
.settings-list {
  display: flex;
  flex-direction: column;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.setting-row:first-child { padding-top: 2px; }
.setting-row:last-child { border-bottom: none; padding-bottom: 2px; }

.setting-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-sub {
  font-size: 0.64rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* iOS Style Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 25px;
  flex-shrink: 0;
}

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

.ios-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.14);
  transition: 0.25s var(--transition-smooth);
  border-radius: 30px;
}

.ios-slider::before {
  position: absolute;
  content: "";
  height: 19px;
  width: 19px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s var(--transition-smooth);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.ios-switch input:checked + .ios-slider {
  background: linear-gradient(135deg, var(--accent-cyan), var(--success));
}

.ios-switch input:checked + .ios-slider::before {
  transform: translateX(19px);
}

/* Numbered Quick Guide */
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.step-num {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Collapsible Geek Drawer */
.geek-drawer {
  padding: 0;
  overflow: hidden;
}

.geek-summary {
  list-style: none;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.geek-summary::-webkit-details-marker {
  display: none;
}

.geek-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
}

.geek-title-wrap span:first-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geek-title-wrap svg {
  width: 16px;
  height: 16px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.pkt-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent-cyan);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  flex-shrink: 0;
}

.drawer-chevron {
  color: var(--text-secondary);
  transition: transform 0.25s ease;
  display: flex;
  flex-shrink: 0;
}

.drawer-chevron svg {
  width: 16px;
  height: 16px;
}

.geek-drawer[open] .drawer-chevron {
  transform: rotate(180deg);
}

.geek-body {
  padding: 0 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.geek-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}

.geek-proto-tag {
  font-size: 0.63rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-clear-log {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.log-box {
  background: rgba(4, 6, 12, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  height: 120px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-item { color: var(--text-secondary); line-height: 1.35; }
.log-tx { color: #34d399; }
.log-rx { color: #38bdf8; }
.log-warn { color: #fbbf24; }
.log-err { color: #fb7185; }

/* =========================================================
   FLOATING APPLE-STYLE BOTTOM NAVIGATION BAR
========================================================== */
.bottom-nav {
  position: fixed;
  bottom: max(10px, env(safe-area-inset-bottom, 10px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 446px;
  background: rgba(14, 19, 34, 0.84);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  z-index: 100;
}

.nav-item {
  min-width: 0;
  background: transparent;
  border: none;
  border-radius: 17px;
  padding: 7px 3px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.64rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s var(--transition-smooth);
}

.nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  transition: transform 0.2s ease;
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.14));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nav-item.active svg {
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* Toast Notification */
.toast {
  position: fixed;
  top: max(16px, calc(env(safe-area-inset-top, 0px) + 10px));
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #ffffff;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  max-width: calc(100vw - 24px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 0;
  transition: all 0.32s var(--transition-smooth);
  pointer-events: none;
  white-space: normal;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* =========================================================
   DESKTOP & TABLET 2-COLUMN STUDIO WORKSPACE (>= 860px)
========================================================== */
@media (min-width: 860px) {
  body {
    padding: 24px 28px 100px;
  }

  .app-shell {
    max-width: 940px;
    gap: 16px;
  }

  .top-bar {
    padding: 12px 18px;
  }

  .brand-titles h1 {
    font-size: 1.05rem;
  }

  .conn-pill-text {
    max-width: 180px;
  }

  .workspace-grid {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }

  .stage-column {
    position: sticky;
    top: 20px;
  }

  .aurora-stage {
    padding: 20px 18px;
    gap: 18px;
  }

  .stage-hero-row {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .orb-assembly {
    width: 112px;
    height: 112px;
  }

  .orb-main {
    width: 96px;
    height: 96px;
  }

  .orb-lens {
    width: 34px;
    height: 34px;
  }

  .stage-badges {
    justify-content: center;
  }

  .bottom-nav {
    max-width: 520px;
  }
}

/* =========================================================
   COLOR ENHANCEMENTS: Mini pills, Sequencer options,
   Dynamic speed panel, Shade strip & Saved combos
========================================================== */
.mini-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--transition-smooth);
}
.mini-pill:hover { background: rgba(255, 255, 255, 0.12); }
.mini-pill:active { transform: scale(0.95); }
.mini-pill.accent {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(99, 102, 241, 0.22));
  border-color: rgba(56, 189, 248, 0.45);
}
.mini-pill.ghost { background: transparent; color: var(--text-secondary); }

/* Sequencer */
.seq-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seq-ring { position: relative; }
.seq-order-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: #ffffff;
  color: #05070f;
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.seq-ring.playing {
  animation: seqPlaying 1.2s infinite ease-in-out;
}
@keyframes seqPlaying {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ring-color) 70%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ring-color) 0%, transparent); }
}
.seq-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.seq-summary {
  font-size: 0.66rem;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dynamic speed toolbar (shown only when FADE / STROBE / FLASH active) */
.fade-panel {
  margin-top: 2px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(6, 9, 18, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.fade-speed-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.fade-speed-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.speed-step-btn {
  padding: 3px 9px;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
}
.fade-speed-val {
  min-width: 24px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Shade strip & saved combos */
.shade-section {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.shade-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.shade-chip {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  background: rgba(15, 20, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
}
.shade-chip:active { transform: scale(0.95); }
.shade-swatch {
  width: 100%;
  height: 14px;
  border-radius: 5px;
  background: var(--shade);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.25);
}
.shade-pct { font-size: 0.62rem; font-weight: 700; }
.shade-chip.active {
  border-color: var(--shade);
  color: #ffffff;
  box-shadow: 0 0 0 1px var(--shade), 0 4px 12px -4px var(--shade);
}
.fav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fav-chip {
  max-width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 5px;
  border-radius: var(--radius-pill);
  background: rgba(15, 20, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
}
.fav-chip .fav-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-chip:hover { border-color: var(--shade); }
.fav-chip:active { transform: scale(0.96); }
.fav-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--shade);
  box-shadow: 0 0 6px var(--shade);
}
.fav-rgb .fav-swatch {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, transparent 70%),
    conic-gradient(#ef4444, #10b981, #3b82f6, #ef4444);
}
.fav-pct { color: var(--text-secondary); }
.fav-del {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1;
}
.fav-del:hover { background: rgba(244, 63, 94, 0.25); color: #ffffff; }

/* =========================================================
   STUDIO AMBIENT SOUNDSCAPE MIXER v2
========================================================== */
.status-badge.badge-emerald {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
}

.transport-noise.active-hw-noise {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(56, 189, 248, 0.2));
  border-color: rgba(16, 185, 129, 0.55);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.22);
}

.mini-pill.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(16, 185, 129, 0.22));
  border-color: rgba(56, 189, 248, 0.55);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.2);
}

.mini-pill.danger {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.42);
  color: #fecdd3;
}
.mini-pill.danger:hover {
  background: rgba(244, 63, 94, 0.26);
  color: #ffffff;
}

.synth-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.synth-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.synth-spectrum {
  width: 68px;
  height: 22px;
  display: block;
}

.synth-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.saved-mix-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.saved-mix-chip {
  border-color: rgba(56, 189, 248, 0.28);
  padding-left: 8px;
}
.saved-mix-chip:hover {
  border-color: rgba(56, 189, 248, 0.6);
}
.mix-dot {
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 800;
}

.synth-tile-featured {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(17, 24, 39, 0.75));
  border-color: rgba(56, 189, 248, 0.16);
}

.synth-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.synth-sub {
  font-size: 0.6rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.synth-featured-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.noise-color-switch {
  display: inline-flex;
  background: rgba(6, 9, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  padding: 2px;
  gap: 2px;
}

.noise-pill {
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  padding: 3px 8px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.noise-pill:hover {
  color: var(--text-primary);
}

.noise-pill.active {
  background: rgba(56, 189, 248, 0.22);
  color: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.synth-icon.synth-icon-warm { color: #fb923c; }
.synth-icon.synth-icon-green { color: #34d399; }
.synth-icon.synth-icon-violet { color: #a78bfa; }

.synth-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.synth-slider {
  flex: 1;
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.72) 0%,
    rgba(16, 185, 129, 0.72) var(--vol-pct, 50%),
    rgba(255, 255, 255, 0.12) var(--vol-pct, 50%),
    rgba(255, 255, 255, 0.12) 100%
  );
  cursor: pointer;
}

.synth-tile:not(.playing) .synth-slider:not(.master-slider) {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.42) 0%,
    rgba(148, 163, 184, 0.42) var(--vol-pct, 50%),
    rgba(255, 255, 255, 0.1) var(--vol-pct, 50%),
    rgba(255, 255, 255, 0.1) 100%
  );
}

.synth-vol-pct {
  min-width: 30px;
  text-align: right;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.synth-tile.playing .synth-vol-pct {
  color: #e2e8f0;
}

.synth-master-bar {
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(6, 9, 18, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.synth-master-vol-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.master-mute-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.master-mute-btn svg {
  width: 14px;
  height: 14px;
}
.master-mute-btn.is-muted {
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.12);
}

.synth-sleep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.synth-sleep-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-sleep-status {
  font-size: 0.66rem;
  font-weight: 700;
  color: #fbbf24;
  font-variant-numeric: tabular-nums;
}

.synth-sleep-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* =========================================================
   MOBILE VIEWPORT POLISH (<= 520px, incl. 360px / 375px / 430px)
========================================================== */
@media (max-width: 520px) {
  .synth-tile-featured .synth-top {
    flex-wrap: wrap;
  }
  .synth-featured-right {
    width: 100%;
    justify-content: space-between;
    padding-top: 2px;
  }
  body {
    padding:
      max(8px, calc(env(safe-area-inset-top, 0px) + 6px))
      max(10px, env(safe-area-inset-right, 10px))
      calc(82px + env(safe-area-inset-bottom, 10px))
      max(10px, env(safe-area-inset-left, 10px));
  }

  .top-bar {
    padding: 8px 10px;
    gap: 6px;
  }

  .brand-cluster {
    gap: 7px;
  }

  .brand-emblem {
    width: 28px;
    height: 28px;
    border-radius: 9px;
  }

  .brand-titles h1 {
    font-size: 0.86rem;
  }

  .aurora-stage,
  .glass-card {
    padding: 11px 12px;
  }

  .stage-hero-row {
    gap: 11px;
  }

  .orb-assembly {
    width: 56px;
    height: 56px;
  }

  .orb-main {
    width: 48px;
    height: 48px;
  }

  .bright-step-btn {
    padding: 0 7px;
  }

  .bright-seg {
    font-size: 0.62rem;
  }

  .scenes-grid {
    gap: 7px;
  }

  .scene-tile {
    padding: 9px 9px;
    gap: 8px;
  }

  .scene-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .scene-icon-box svg {
    width: 16px;
    height: 16px;
  }

  .scene-name {
    font-size: 0.74rem;
  }

  .scene-sub {
    font-size: 0.61rem;
  }

  /* Stack 4 primary capsules vertically so full color names fit in all languages */
  .lens-grid {
    gap: 6px;
  }

  .lens-capsule {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 8px 4px;
    gap: 5px;
  }

  .lens-text {
    align-items: center;
    width: 100%;
  }

  .lens-text strong {
    display: none;
  }

  .lens-text span {
    max-width: 100%;
    font-size: 0.64rem;
    font-weight: 600;
    color: var(--text-primary);
  }

  .jewel-palette-grid {
    gap: 6px;
  }

  .jewel-swatch {
    padding: 8px 7px;
    gap: 6px;
  }

  .jewel-orb {
    width: 18px;
    height: 18px;
  }

  .jewel-name {
    font-size: 0.68rem;
  }

  .synth-grid {
    gap: 7px;
  }

  .synth-tile {
    padding: 9px 9px;
    gap: 7px;
  }

  .synth-icon {
    width: 24px;
    height: 24px;
  }

  .synth-name {
    font-size: 0.7rem;
  }

  .synth-slider-row {
    gap: 6px;
  }

  .synth-vol-pct {
    min-width: 26px;
    font-size: 0.6rem;
  }

  .btn-primary-pill {
    padding: 6px 12px;
    font-size: 0.7rem;
    flex-shrink: 0;
  }
}

/* =========================================================
   DEVICE TAB CONNECTION BANNER & BLUETOOTH PAIRING SHEET
========================================================== */
.device-conn-banner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.device-conn-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.device-conn-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.device-conn-text strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-conn-text span {
  font-size: 0.67rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal Backdrop & Sheet */
.ble-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(4, 7, 16, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.ble-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ble-modal-sheet {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(16, 23, 44, 0.97) 0%, rgba(10, 15, 29, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: 18px 18px 16px;
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.78),
    0 0 0 1px rgba(56, 189, 248, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.28s var(--transition-smooth);
}

.ble-modal-backdrop.open .ble-modal-sheet {
  transform: translateY(0) scale(1);
}

.ble-sheet-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  margin: -4px auto -2px;
}

.ble-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ble-modal-title {
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.ble-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.ble-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.ble-close-btn svg {
  width: 14px;
  height: 14px;
}

/* Radar Hero Card */
.ble-radar-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  background: radial-gradient(circle at 20% 50%, rgba(56, 189, 248, 0.12), rgba(7, 11, 22, 0.65) 75%);
  border: 1px solid rgba(56, 189, 248, 0.2);
  transition: all 0.3s ease;
}

.ble-radar-hero.state-connected {
  background: radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.18), rgba(7, 11, 22, 0.65) 75%);
  border-color: rgba(16, 185, 129, 0.36);
}

.ble-radar-hero.state-reconnecting,
.ble-radar-hero.state-unsupported {
  background: radial-gradient(circle at 20% 50%, rgba(245, 158, 11, 0.15), rgba(7, 11, 22, 0.65) 75%);
  border-color: rgba(245, 158, 11, 0.32);
}

.ble-radar-orb {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ble-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  opacity: 0;
  pointer-events: none;
}

.ble-radar-hero.state-disconnected .ring-1,
.ble-radar-hero.state-connecting .ring-1 {
  animation: bleRadarWave 2.4s infinite ease-out;
}

.ble-radar-hero.state-connecting .ring-1 {
  animation-duration: 1.3s;
}

.ble-radar-hero.state-connecting .ring-2 {
  animation: bleRadarWave 1.3s 0.65s infinite ease-out;
}

.ble-radar-hero.state-reconnecting .ring-1 {
  border-color: rgba(245, 158, 11, 0.5);
  animation: bleRadarWave 2s infinite ease-out;
}

@keyframes bleRadarWave {
  0% { transform: scale(0.76); opacity: 0.75; }
  100% { transform: scale(1.38); opacity: 0; }
}

.ble-radar-core {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(99, 102, 241, 0.28));
  border: 1px solid rgba(125, 211, 252, 0.42);
  color: #e0f2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.26);
  z-index: 1;
}

.ble-radar-hero.state-connected .ble-radar-core {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(52, 211, 153, 0.22));
  border-color: rgba(110, 231, 183, 0.55);
  color: #ecfdf5;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.34);
}

.ble-radar-hero.state-reconnecting .ble-radar-core,
.ble-radar-hero.state-unsupported .ble-radar-core {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(217, 119, 6, 0.22));
  border-color: rgba(252, 211, 77, 0.5);
  color: #fef3c7;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.24);
}

.ble-core-svg {
  width: 20px;
  height: 20px;
}

.ble-orb-check {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #10b981;
  color: #052e16;
  font-size: 0.62rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.22s var(--transition-smooth);
  z-index: 2;
}

.ble-radar-hero.state-connected .ble-orb-check {
  opacity: 1;
  transform: scale(1);
}

.ble-status-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ble-device-pill-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ble-device-tag {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #ffffff;
}

.ble-status-chip {
  font-size: 0.63rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ble-radar-hero.state-connected .ble-status-chip {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
}

.ble-radar-hero.state-connecting .ble-status-chip {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.42);
  color: #bae6fd;
}

.ble-radar-hero.state-reconnecting .ble-status-chip,
.ble-radar-hero.state-unsupported .ble-status-chip {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.ble-status-sub {
  font-size: 0.7rem;
  line-height: 1.38;
  color: var(--text-secondary);
}

/* Dual-Channel Cards */
.ble-dual-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ble-chan-card {
  padding: 10px 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ble-chan-card.is-primary {
  background: rgba(56, 189, 248, 0.07);
  border-color: rgba(56, 189, 248, 0.26);
}

.ble-chan-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.ble-chan-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ble-chan-icon.audio {
  background: rgba(129, 140, 248, 0.16);
  color: #c7d2fe;
}

.ble-chan-icon svg {
  width: 14px;
  height: 14px;
}

.ble-chan-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ble-chan-title strong {
  font-size: 0.73rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.ble-chan-title span {
  font-size: 0.62rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ble-chan-hint {
  font-size: 0.64rem;
  line-height: 1.32;
  color: var(--text-secondary);
}

/* Unsupported Browser Notice */
.ble-unsupported-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ble-unsupported-box p {
  font-size: 0.71rem;
  color: #fde68a;
  line-height: 1.35;
}

/* Actions Area */
.ble-actions-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ble-btn-primary,
.ble-btn-secondary,
.ble-btn-danger {
  width: 100%;
  border-radius: 13px;
  padding: 11px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s var(--transition-smooth);
}

.ble-btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  border: 1px solid rgba(125, 211, 252, 0.45);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.3);
}

.ble-btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 10px 26px rgba(14, 165, 233, 0.4);
}

.ble-btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.ble-btn-primary.is-done {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(56, 189, 248, 0.24));
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.22);
}

.ble-btn-secondary {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
}

.ble-btn-secondary:hover {
  background: rgba(56, 189, 248, 0.2);
}

.ble-btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.28);
  color: #fda4af;
  padding: 9px 14px;
  font-size: 0.75rem;
}

.ble-btn-danger:hover {
  background: rgba(244, 63, 94, 0.18);
  color: #ffe4e6;
}

.ble-btn-primary svg,
.ble-btn-secondary svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Troubleshooting Filter Checkbox */
.ble-filter-toggle {
  margin-top: 2px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.67rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.ble-filter-toggle input {
  display: none;
}

.ble-check-ui {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.ble-filter-toggle input:checked + .ble-check-ui {
  background: #38bdf8;
  border-color: #38bdf8;
}

.ble-filter-toggle input:checked + .ble-check-ui::after {
  content: "";
  width: 4px;
  height: 7px;
  border: solid #04111f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
}

@media (max-width: 520px) {
  .lang-trigger {
    padding: 4px 7px;
    gap: 4px;
    font-size: 0.66rem;
  }

  .lang-menu {
    width: 158px;
  }

  .ble-modal-backdrop {
    align-items: flex-end;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .ble-modal-sheet {
    max-width: 100%;
    border-radius: 22px;
    padding: 14px 14px 15px;
    gap: 12px;
    transform: translateY(28px);
  }

  .ble-sheet-handle {
    display: block;
  }

  .ble-dual-cards {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .ble-chan-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    gap: 8px;
  }

  .ble-chan-hint {
    text-align: right;
    font-size: 0.62rem;
  }
}

/* =========================================================
   CROSS-PLATFORM PWA (ANDROID + IPHONE / IPAD)
========================================================== */
.pwa-top-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: #7dd3fc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s var(--transition-smooth);
}

.pwa-top-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.28);
}

.pwa-top-btn:active {
  transform: scale(0.93);
}

.pwa-top-btn svg {
  width: 14px;
  height: 14px;
}

.pwa-mini-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

.pwa-installed-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.38);
  color: #a7f3d0;
  font-size: 0.69rem;
  font-weight: 700;
  flex-shrink: 0;
}

.pwa-installed-pill svg {
  width: 12px;
  height: 12px;
}

.ble-unsupported-box {
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
}

.ble-unsup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

/* iPhone / iPad Add-to-Home-Screen Guide Sheet */
.pwa-ios-head-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pwa-ios-appicon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.pwa-ios-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pwa-ios-step {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pwa-step-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-step-icon.emerald {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.34);
  color: #6ee7b7;
}

.pwa-step-icon svg {
  width: 17px;
  height: 17px;
}

.pwa-step-body {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.pwa-step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 0.64rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-step-body p {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
