/* FloRo Controller — Material 3 Minimal (2026-07-09) */

:root {
  --md-primary: #4DB6AC;
  --md-on-primary: #003731;
  --md-surface: #101414;
  --md-on-surface: #E0E3E2;
  --md-on-surface-variant: #BEC9C6;
  --md-outline-variant: #3F4947;
  --md-surface-container: #1B211F;
  --md-surface-container-high: #252B29;
  --md-surface-container-highest: #303634;
  --md-error: #FFB4AB;

  --bg-deep: var(--md-surface);
  --bg-panel: #0A1412;
  --bg-surface: var(--md-surface-container);
  --bg-elevated: var(--md-surface-container-high);
  --bg-primary: var(--md-surface);
  --bg-grouped: var(--md-surface-container);
  --bg-secondary: var(--md-surface-container-high);
  --bg-tertiary: var(--md-surface-container-highest);

  --separator: rgba(190, 201, 198, 0.12);
  --separator-opaque: rgba(190, 201, 198, 0.18);
  --text-primary: var(--md-on-surface);
  --text-secondary: rgba(224, 227, 226, 0.62);
  --text-muted: rgba(224, 227, 226, 0.38);
  --label-primary: var(--md-on-surface);
  --label-secondary: var(--md-on-surface-variant);
  --label-tertiary: var(--text-muted);
  --fill-primary: rgba(224, 227, 226, 0.14);
  --fill-tertiary: rgba(224, 227, 226, 0.08);

  --accent: var(--md-primary);
  --accent-on: var(--md-on-primary);
  --accent-dim: rgba(77, 182, 172, 0.18);
  --accent-glow: rgba(77, 182, 172, 0.35);
  --accent-rgba: rgba(77, 182, 172, 0.35);
  --accent-muted: rgba(77, 182, 172, 0.15);
  --neon-glow: var(--md-primary);

  --system-green: var(--md-primary);
  --system-green-muted: var(--accent-dim);
  --system-red: #FFB4AB;
  --system-red-muted: rgba(255, 180, 171, 0.18);
  --system-blue: #5B9BD5;
  --system-orange: #FFB020;
  --danger: var(--system-red);
  --success: var(--system-green);
  --warning: var(--system-orange);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-card: 16px;
  --radius-pill: 999px;
  --radius-control: 12px;

  --font-display: 'Roboto Flex', system-ui, sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, monospace;

  --header-height: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --space-section: 8px;
  --space-card: 12px;
  --row-height: 48px;

  --spring: 0.2s cubic-bezier(0.2, 0, 0, 1);
  --sheet-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.swatch-btn:focus-visible,
.swatch-btn-custom:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--accent-rgba);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg-primary);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg-primary);
  color: var(--label-primary);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.sheet-open { overflow: hidden; }

.hidden { display: none !important; }

.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Shell layout ── */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  background: var(--bg-deep);
}

.app-shell.install-banner-visible {
  padding-bottom: calc(88px + var(--safe-bottom));
}

/* ── Material Symbols (self-hosted for offline PWA) ── */

@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  overflow: hidden;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  -webkit-font-smoothing: antialiased;
  color: var(--md-on-surface-variant);
  flex-shrink: 0;
}

/* ── Header ── */

.app-header {
  position: relative;
  z-index: 60;
  flex-shrink: 0;
  padding-top: var(--safe-top);
  background: var(--md-surface);
  border-bottom: 0.5px solid var(--separator);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 16px;
  min-height: var(--header-height);
}

.header-title,
.top-app-bar__title {
  font-size: 1.375rem;
  font-weight: 400;
  letter-spacing: 0;
}

.icon-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--label-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:active { background: var(--fill-tertiary); }
.icon-btn--sm { width: 40px; height: 40px; }
.icon-btn .material-symbols-outlined { color: inherit; }

.header-menu-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--label-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.status-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--label-tertiary);
}

.chip-offline .status-chip-dot { background: var(--system-red); }
.chip-connecting .status-chip-dot {
  background: var(--system-orange);
  animation: chip-pulse 1s ease-out infinite;
}
.chip-connected .status-chip-dot { background: var(--system-green); }

@keyframes chip-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ── Main ── */

.app-main {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  padding: var(--space-section) 16px;
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
}

.compat-banner {
  position: relative;
  z-index: 2;
  display: flex;
  padding: 12px 14px;
  background: var(--system-red-muted);
  border: 0.5px solid rgba(255, 180, 171, 0.35);
  border-radius: var(--radius-lg);
}

.compat-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.compat-banner-text span {
  color: var(--label-secondary);
  font-size: 13px;
}

/* Mode tabs (horizontal pill) */

.mode-rail.seg-control {
  display: flex;
  flex-direction: row;
  padding: 4px;
  gap: 0;
  background: var(--md-surface-container-highest);
  border-radius: var(--radius-pill);
}

.mode-rail-btn,
.seg-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--label-primary);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.seg-btn__icon { font-size: 20px; }

.mode-rail-btn.active,
.seg-btn.active {
  background: var(--md-surface-container-high);
  color: var(--label-primary);
  box-shadow: none;
}

/* Connect banner */

.connect-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--md-surface-container-high);
  border-radius: var(--radius-md);
}

.connect-banner__text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--label-secondary);
  min-width: 0;
}

.connect-banner__text strong {
  color: var(--label-primary);
  font-weight: 500;
}

.connect-banner__icon { font-size: 20px; }

.connect-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-compact {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.875rem;
}

/* Color strip */

.color-strip-card {
  background: var(--md-surface-container);
  border-radius: var(--radius-lg);
  padding: var(--space-card);
  -webkit-tap-highlight-color: transparent;
}

.color-strip-card:active {
  background: var(--md-surface-container-high);
}

.color-hero-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.color-hero-copy { flex: 1; min-width: 0; }

.color-hero-name {
  font-size: 0.9375rem;
  font-weight: 500;
}

.color-hero-type {
  font-size: 0.6875rem;
  color: var(--label-secondary);
}

.color-hero-icon {
  font-size: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.recents-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.recents-strip::-webkit-scrollbar { display: none; }

.recent-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.recent-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--label-secondary);
  max-width: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.swatch-squircle,
.swatch-btn {
  aspect-ratio: 1;
  border-radius: 28%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.swatch-squircle--hero,
.color-strip-card .swatch-squircle:first-child {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
}

.recent-col .swatch-squircle,
.recent-col .swatch-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
}

.swatch-squircle.is-selected,
.swatch-btn.selected {
  border-color: var(--md-on-surface);
  box-shadow: 0 0 0 2px var(--md-surface-container);
}

.swatch--neon { border-color: transparent; }

.swatch--saved {
  border: 1.5px solid var(--md-outline-variant);
}

.swatch--custom {
  border: 1.5px dashed var(--md-outline-variant);
  position: relative;
}

.swatch--custom::after {
  content: 'tune';
  font-family: 'Material Symbols Outlined';
  font-size: 12px;
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-surface-container-highest);
  color: var(--md-on-surface-variant);
  display: grid;
  place-items: center;
  line-height: 1;
}

.swatch-more {
  width: 40px;
  height: 40px;
  border-radius: 28%;
  border: 1px dashed var(--md-outline-variant);
  background: transparent;
  color: var(--label-secondary);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  cursor: pointer;
}

.view-panel[hidden] { display: none !important; }

/* Legacy connect-prompt alias */
.connect-prompt { display: none; }

/* ── Connect prompt (legacy hidden) ── */
  flex-shrink: 0;
  width: 100%;
  padding: 0 16px 8px;
  border: 1px solid rgba(65, 233, 189, 0.35);
  border-radius: var(--radius-card);
  margin: 0 16px 8px;
  width: calc(100% - 32px);
  padding: 12px 14px;
  background: var(--bg-panel);
  box-shadow: 0 0 12px var(--system-green-muted);
}

.connect-prompt.hidden { display: none; }

.connect-prompt-text {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--label-secondary);
  text-align: center;
}

.connect-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connect-prompt .btn-connect {
  min-height: 48px;
  background: var(--system-green);
  color: var(--accent-on);
  box-shadow: 0 2px 16px var(--system-green-muted);
}

/* ── Remote dock ── */

.remote-dock {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
  overflow: hidden;
  z-index: 50;
  width: 100%;
  padding: var(--space-section) 16px 12px;
  background: var(--md-surface);
  border-top: 0.5px solid var(--separator);
}

.remote-panel {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
  -webkit-overflow-scrolling: touch;
}

.control-card {
  background: var(--md-surface-container);
  border-radius: var(--radius-lg);
  padding: 4px 0;
}

.control-list {
  display: flex;
  flex-direction: column;
}

.control-row {
  display: flex;
  align-items: center;
  min-height: var(--row-height);
  gap: 12px;
  padding: 0 var(--space-card);
  border: none;
  width: 100%;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}

.control-row--button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.control-row--button:active {
  background: var(--fill-tertiary);
}

.control-row--active {
  background: var(--md-surface-container-high);
  border-radius: var(--radius-md);
  margin: 0 4px;
  width: calc(100% - 8px);
}

.control-row__label {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.control-row__sub {
  display: block;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--label-secondary);
}

.control-row__value {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--label-secondary);
}

.control-row__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  min-width: 84px;
  justify-content: flex-end;
}

.control-row__chevron {
  font-size: 20px;
  color: var(--label-secondary);
}

.step-btn,
.icon-step {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--md-outline-variant);
  border-radius: 50%;
  background: transparent;
  color: var(--label-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.step-btn .material-symbols-outlined,
.icon-step .material-symbols-outlined {
  font-size: 20px;
  width: 20px;
  height: 20px;
  color: inherit;
}

.adjust-context {
  display: flex;
  padding: 4px;
  background: var(--md-surface-container-low, var(--bg-panel));
  border-radius: var(--radius-pill);
  margin-bottom: 4px;
}

.adjust-context-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.adjust-context-btn.active {
  background: var(--md-surface-container-highest);
  color: var(--label-primary);
}

.favorites-card .favorites-header {
  min-height: 40px;
}

.favorites-card .preset-grid {
  padding: 0 var(--space-card) var(--space-card);
}

.sheet-section { margin-bottom: 16px; }

.sheet-section-title {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-secondary);
}

.sheet-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sheet-section-header .sheet-section-title { margin: 0; }

.color-swatches-sheet {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preset-row-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
}

/* ── Remote dock (legacy overrides) ── */

.remote-dock:has(#solid-controls:not(.hidden)) {
  gap: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.remote-dock:has(#solid-controls:not(.hidden)) #solid-controls {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 8px;
}

/* color-preset-section is now inside solid-controls/solid-layout */


/* ── Bottom Action Dock (Fixed Power Bar) ── */

.bottom-action-dock {
  flex: 0 0 auto;
  width: 100%;
  padding: 10px 16px calc(14px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
  background: var(--md-surface);
  border-top: 0.5px solid var(--separator, rgba(255, 255, 255, 0.08));
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.bottom-action-dock .power-cta {
  margin: 0;
  width: 100%;
  flex-shrink: 0;
}

.remote-dock:has(#anim-controls:not(.hidden)) #anim-controls {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

.remote-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-padding-bottom: 12px;
}

.remote-panel.hidden { display: none !important; }

#solid-controls.remote-panel {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  gap: 0;
  padding-bottom: 8px;
}

/* Static: horizontal M3 brightness + full-width color */

.solid-layout {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}

.brightness-card--horizontal,
.solid-layout .brightness-card {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
}

.color-card {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

/* Horizontal Brightness Card (Static tab) */

.brightness-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brightness-card__title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brightness-card__track-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.brightness-slider-track-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  position: relative;
  height: 36px;
  min-width: 0;
}

.brightness-slider.horizontal-slider {
  width: 100% !important;
  height: 36px !important;
  margin: 0 !important;
  transform: none !important;
}

.brightness-slider.horizontal-slider::-webkit-slider-runnable-track {
  height: 100%;
  border-radius: 18px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) calc(var(--brightness-level, 8) * 12.5% - 6.25%),
    rgba(219, 230, 228, 0.12) calc(var(--brightness-level, 8) * 12.5% - 6.25%),
    rgba(219, 230, 228, 0.12) 100%
  );
}

.brightness-slider.horizontal-slider::-webkit-slider-thumb {
  width: 36px;
  height: 36px;
  margin-top: 0;
}

.brightness-slider-icon {
  font-size: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.brightness-slider-value {
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--label-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  flex-shrink: 0;
}

.brightness-card[data-powered-off="true"] .brightness-slider-value {
  font-size: clamp(13px, 4vw, 16px);
  letter-spacing: 0.04em;
}

.brightness-card[data-powered-off="true"] .brightness-slider-icon {
  opacity: 0.45;
}

/* Legacy stepper (unused on Static; kept for reference) */

.brightness-stepper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  width: 100%;
}

.brightness-stepper-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
}

.brightness-stepper-sun {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px var(--accent-glow);
}

.brightness-stepper-value {
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--label-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.brightness-card[data-powered-off="true"] .brightness-stepper-value {
  font-size: clamp(14px, 4vw, 17px);
  letter-spacing: 0.04em;
}

.brightness-card[data-powered-off="true"] .brightness-stepper-sun {
  opacity: 0.45;
  box-shadow: none;
}

.brightness-stepper-btn {
  width: 100%;
  max-width: 52px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--label-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--spring), background var(--spring), color var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.brightness-stepper-btn:active {
  transform: scale(0.96);
  background: var(--fill-primary);
  color: var(--accent);
}

/* ── Control cards ── */

.control-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--separator-opaque);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  transition: border-color var(--spring), box-shadow var(--spring), opacity var(--spring);
}

.control-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.control-card__header.slider-header {
  flex-wrap: nowrap;
}

.control-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.control-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--label-primary);
}

.slider-val {
  margin-left: auto;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.disabled-control {
  opacity: 0.45;
  pointer-events: none;
}

.disabled-control .btn-step,
.disabled-control .step-btn,
.disabled-control .icon-step,
.disabled-control .adjust-context-btn,
.disabled-control .mode-rail-btn,
.disabled-control .ios-slider,
.disabled-control .swatch-btn,
.disabled-control .swatch-btn-preset,
.disabled-control .btn,
.disabled-control .anim-mode-picker-btn,
.disabled-control .control-row--button,
.disabled-control .preset-tile,
.disabled-control .fav-chip,
.disabled-control .brightness-stepper-btn {
  pointer-events: auto;
}

/* ── Color swatches ── */

.color-swatches-remote {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.swatch-btn {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform var(--spring), box-shadow var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.swatch-btn:active { transform: scale(0.94); }

.swatch-btn.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent-rgba), 0 0 12px var(--accent-glow);
}

.swatch-btn-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 2px solid var(--separator-opaque);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.swatch-btn-custom:active { transform: scale(0.94); }

.swatch-custom-ring {
  width: 62%;
  height: 62%;
  border-radius: 50%;
  background: conic-gradient(
    #ff0000,
    #ffff00,
    #00ff00,
    #00ffff,
    #0000ff,
    #ff00ff,
    #ff0000
  );
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.color-swatches-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.color-swatches-footer .swatch-btn-custom {
  grid-column: span 1;
}

.btn-save-preset {
  grid-column: span 3;
  min-height: 44px;
  height: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-control);
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-save-preset .material-symbols-outlined {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

/* ── Presets ── */

.preset-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.preset-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.preset-section-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.preset-section-search {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--label-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.preset-section-search:active { transform: scale(0.94); }

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

.preset-row--solid {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  gap: 6px;
  align-items: stretch;
}

.solid-presets-dock {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  margin-top: 0;
  padding: 10px 12px;
  --preset-indent: 0px;
}

.solid-presets-dock:not(.hidden) {
  min-height: 88px;
}

.solid-presets-header {
  margin-bottom: 0;
  flex-shrink: 0;
}

.solid-presets-dock .preset-row--solid {
  margin-left: 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-inline: 0;
}

.preset-row--solid.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  max-height: none;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--bg-elevated);
  border: 1px dashed rgba(219, 230, 228, 0.16);
}

.color-presets-empty-hint {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 10px;
}

.preset-row--solid:not(.is-empty) .swatch-btn-preset {
  flex: 0 0 calc((100% - 24px) / 5);
  width: calc((100% - 24px) / 5);
  max-width: 62px;
}

.swatch-btn-preset {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 0;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.swatch-preset-label {
  display: block;
  max-width: 100%;
  padding: 0 4px 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  color: #fff;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

.swatch-btn-preset.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent-rgba), 0 0 12px var(--accent-glow);
}

.swatch-preset-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.swatch-btn-preset.selected .swatch-preset-remove {
  background: rgba(0, 0, 0, 0.35);
}

.preset-row--anim {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  grid-template-columns: unset;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.preset-row--anim .preset-tile {
  flex: 0 0 auto;
  min-width: 108px;
  scroll-snap-align: start;
}

.preset-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px 10px 8px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--label-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: background var(--spring), color var(--spring), box-shadow var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.preset-tile:active { transform: scale(0.98); }

.preset-tile-label {
  display: block;
  max-width: 6ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-tile.active,
.preset-row--anim .preset-tile.selected {
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: 0 0 12px var(--accent-glow);
}

.preset-tile-remove {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.preset-tile.active .preset-tile-remove,
.preset-tile.selected .preset-tile-remove {
  background: rgba(2, 13, 10, 0.2);
}

/* ── Sliders ── */

.slider-stepper-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-stepper-row .ios-slider {
  flex: 1;
  min-width: 0;
}

.ios-slider,
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}

.ios-slider::-webkit-slider-runnable-track,
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--fill-primary);
}

.ios-slider::-webkit-slider-thumb,
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  margin-top: -10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.mint-slider { accent-color: var(--accent); }

.mint-slider::-webkit-slider-runnable-track {
  background: rgba(219, 230, 228, 0.12);
}

.mint-slider::-webkit-slider-thumb {
  background: var(--accent);
  box-shadow: 0 0 0 2px #fff, 0 0 10px var(--accent-glow);
}

/* ── Animation mode card ── */

.anim-mode-picker-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--label-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.anim-mode-picker-btn:active { transform: scale(0.99); }

.anim-mode-picker-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.anim-mode-picker-chevron {
  flex-shrink: 0;
  color: var(--label-tertiary);
}

.anim-mode-picker-btn .anim-mode-hero-num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.anim-mode-hero-name {
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anim-mode-hero-meta {
  font-size: 12px;
  color: var(--label-secondary);
}

.animation-select-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.anim-stepper-readout {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Power CTA ── */

.power-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-on);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 20px var(--accent-glow);
  flex-shrink: 0;
  transition: transform var(--spring), opacity var(--spring), background var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.power-cta:active:not(:disabled) { transform: scale(0.98); }

.power-cta.is-on {
  background: var(--accent);
  color: var(--accent-on);
  border: 1px solid var(--accent-rgba);
  box-shadow: 0 0 20px var(--accent-glow);
}

.power-cta.is-unavailable {
  opacity: 0.55;
  background: var(--bg-surface);
  color: var(--text-secondary);
  box-shadow: none;
}

.power-cta .material-symbols-outlined,
.power-cta .power-icon {
  color: inherit;
  font-size: 22px;
}

/* ── Buttons ── */

.btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  transition: transform var(--spring), opacity var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
  opacity: 0.88;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
  box-shadow: 0 2px 12px var(--accent-rgba);
}

.btn-connect {
  background: var(--system-green);
  color: var(--accent-on);
  box-shadow: 0 2px 16px var(--system-green-muted);
}

.btn-secondary {
  background: var(--fill-tertiary);
  color: var(--label-primary);
}

.btn-destructive {
  background: var(--system-red-muted);
  color: var(--system-red);
}

.btn-text {
  background: transparent;
  color: var(--accent);
  min-height: 36px;
  padding: 6px 10px;
  font-size: 15px;
}

.btn-step {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  flex-shrink: 0;
  background: var(--fill-tertiary);
  color: var(--label-primary);
  font-size: 22px;
}

/* ── Favorites (legacy chip class for disabled-control) ── */

.fav-chip {
  background: var(--fill-tertiary);
  border-radius: 100px;
  padding: 8px 12px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.fav-chip-num {
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.fav-chip-label { font-weight: 600; }

.fav-chip.active {
  background: var(--accent-muted);
  box-shadow: 0 0 0 1px var(--accent-rgba);
}

.fav-chip-remove {
  color: var(--label-tertiary);
  font-size: 14px;
}

/* ── Sheets ── */

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 92dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 8px 20px calc(20px + var(--safe-bottom));
  border: 0.5px solid var(--separator-opaque);
  animation: sheet-up 0.28s var(--sheet-ease);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
    opacity: 0.92;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-primary);
  margin: 4px auto 12px;
}

.sheet-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.sheet-desc {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--label-secondary);
  line-height: 1.45;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-actions-row {
  flex-direction: row;
}

.sheet-actions-row .btn { flex: 1; }

.search-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--label-tertiary);
  pointer-events: none;
}

.ios-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--fill-tertiary);
  color: var(--label-primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 12px 10px 36px;
  font-family: inherit;
  font-size: 17px;
  outline: none;
  min-height: 44px;
}

.ios-search::placeholder { color: var(--label-tertiary); }

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(50dvh, 360px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
}

.mode-list-sheet { max-height: min(50dvh, 360px); }

.mode-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid transparent;
  border-radius: var(--radius-md);
  background: var(--fill-tertiary);
  color: var(--label-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--spring), border-color var(--spring);
  -webkit-tap-highlight-color: transparent;
}

.mode-list-item:active { transform: scale(0.99); }

.mode-list-item.is-active {
  background: var(--accent-muted);
  border-color: rgba(65, 233, 189, 0.35);
}

.mode-list-num {
  flex-shrink: 0;
  width: 42px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.mode-list-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mode-list-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.mode-list-sub {
  font-size: 12px;
  color: var(--label-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-list-empty {
  margin: 0;
  padding: 20px 12px;
  text-align: center;
  font-size: 14px;
  color: var(--label-tertiary);
}

/* ── Settings ── */

.settings-section { margin-bottom: 20px; }

.settings-section-title {
  margin: 0 0 8px;
  padding: 0 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--label-secondary);
}

.settings-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--separator);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--separator);
}

.settings-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-label {
  font-size: 13px;
  color: var(--label-secondary);
}

.settings-value {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--fill-tertiary);
  color: var(--label-secondary);
}

.status-pill.connected {
  background: var(--system-green-muted);
  color: var(--system-green);
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 16px;
}

.settings-console-card { padding: 0; }

.console-body {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
}

.console-entry {
  padding: 6px 0 6px 10px;
  border-left: 3px solid var(--label-tertiary);
  margin-bottom: 4px;
}

.console-entry.info { border-left-color: var(--system-blue); }
.console-entry.success { border-left-color: var(--system-green); }
.console-entry.error { border-left-color: var(--system-red); }
.console-entry.write { border-left-color: var(--accent); }

.settings-list-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: transparent;
  color: var(--label-primary);
  font-family: inherit;
  font-size: 17px;
  cursor: pointer;
  min-height: 44px;
}

.settings-list-btn:active { background: var(--fill-tertiary); }

.settings-about {
  text-align: center;
  margin-bottom: 16px;
}

.about-line {
  margin: 0;
  font-size: 14px;
  color: var(--label-secondary);
}

.about-version {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--label-tertiary);
}

.ios-input,
.modal-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--fill-tertiary);
  color: var(--label-primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 17px;
  outline: none;
  margin-bottom: 20px;
  min-height: 44px;
  scroll-margin-bottom: 24px;
}

/* Input modals: stay above the on-screen keyboard */
#color-preset-modal.keyboard-aware {
  align-items: flex-end;
  padding-bottom: calc(var(--vv-lift, 0px) + var(--safe-bottom));
}

#color-preset-modal.keyboard-aware .modal-sheet {
  margin-bottom: 0;
  max-height: min(92dvh, calc(100dvh - var(--vv-lift, 0px) - 24px));
}

.install-modal-steps {
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--label-secondary);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Color picker (color-picker.js) ── */

.custom-color-picker {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.palette-sheet .custom-color-picker { margin-bottom: 12px; }

.color-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.color-picker-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-secondary);
  text-transform: uppercase;
}

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

.color-preview-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--separator);
}

.color-preview-hex {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.color-pick-2d {
  position: relative;
  width: 100%;
  height: 150px;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  border: 0.5px solid var(--separator);
}

.color-pick-2d-bg {
  position: absolute;
  inset: 0;
  background-color: hsl(0, 100%, 50%);
  background-image:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, transparent);
}

.color-pick-2d-cursor {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hue-strip-row { display: flex; align-items: center; gap: 10px; }

.hue-strip-track {
  flex: 1;
  height: 28px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 0.5px solid var(--separator);
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.hue-range {
  -webkit-appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
}

.hue-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.hsl-sliders { display: flex; flex-direction: column; gap: 4px; }

.hsl-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-mini-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
  width: 16px;
}

.hsl-range { flex: 1; }

.hsl-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  width: 40px;
  text-align: right;
}

.hex-row { display: flex; align-items: center; gap: 10px; }

.hex-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
}

.hex-input {
  flex: 1;
  background: var(--fill-tertiary);
  color: var(--label-primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  outline: none;
  min-height: 44px;
}

.hex-input.hex-invalid {
  outline: 2px solid var(--system-red);
}

.recent-colors-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 0.5px solid var(--separator);
}

.recent-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
  text-transform: uppercase;
}

.recent-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--separator);
  cursor: pointer;
  padding: 0;
}

.recent-empty {
  font-size: 13px;
  color: var(--label-tertiary);
  font-style: italic;
}

/* ── Install banner (fixed overlay, outside shell) ── */

.install-prompt {
  position: fixed;
  inset-inline: 0;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 70;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 16px;
  pointer-events: none;
}

.install-banner-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(29, 31, 33, 0.96);
  border: 0.5px solid rgba(65, 233, 189, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35), 0 0 16px var(--accent-dim);
  pointer-events: auto;
}

.install-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.install-banner-content { min-width: 0; flex: 1; }

.install-banner-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
}

.install-banner-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--label-secondary);
}

.install-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.install-banner-action {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 15px;
  width: auto;
}

/* ── Responsive ── */

@media (max-width: 500px), (max-height: 915px) {
  :root { --gauge-size: min(44vw, 168px); }

  .app-shell:has(#connect-prompt:not(.hidden)) .hero-zone {
    max-height: min(20dvh, 148px);
  }

  .connect-prompt {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    padding: 8px 12px;
  }

  .connect-prompt-text {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
  }

  .connect-prompt-actions {
    flex: 0 0 auto;
    min-width: 0;
  }

  .connect-prompt .btn-connect {
    min-height: 40px;
    padding: 0 14px;
    font-size: 14px;
    white-space: nowrap;
  }

  .hero-zone {
    max-height: min(24dvh, 168px);
    grid-template-columns: 44px 1fr;
    gap: 8px;
  }

  .mode-rail-btn {
    min-height: 64px;
    font-size: 12px;
  }

  .quick-actions {
    margin-top: 6px;
    gap: 6px;
  }

  .quick-action-btn { min-height: 48px; }

  .color-swatches-remote .swatch-btn,
  .color-swatches-footer .swatch-btn,
  .preset-row--solid .swatch-btn { min-height: 40px; }

  .color-swatches-footer .btn-save-preset { min-height: 40px; }

  .brightness-card { min-width: 62px; }

  .brightness-stepper-btn {
    max-width: 48px;
    height: 44px;
  }

  .solid-presets-dock {
    margin-top: 0;
    padding: 8px 10px;
    --preset-indent: 0px;
  }

  .bottom-action-dock .power-cta {
    min-height: 48px;
  }
}

@media (max-height: 740px) {
  :root { --gauge-size: min(36vw, 120px); }

  .hero-zone { max-height: min(22dvh, 140px); }

  .mode-rail-btn { min-height: 56px; }

  .connect-prompt-text {
    margin-bottom: 8px;
    font-size: 13px;
  }

  .app-main { padding-bottom: 2px; }

  .solid-layout { gap: 8px; }

  .control-card { padding: 10px 12px; }
}

@media (min-width: 600px) {
  .sheet-overlay {
    align-items: center;
    padding: 16px;
  }

  .modal-sheet {
    border-radius: var(--radius-xl);
    border-bottom: 0.5px solid var(--separator-opaque);
    max-width: 420px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .scene-gauge__arc {
    transition: stroke-dasharray 280ms var(--sheet-ease);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
