/* Raum- und Lampenseite: Regler, Szenen, Listen, Verbindungskarte. */

/* Jede Ziehfläche braucht touch-action:none — sonst deutet der Browser die
   Wischbewegung als Seiten-Scroll und der Regler bekommt sie nie zu sehen. */
.slider, .wheel { touch-action: none; }

/* ===== Einheitlicher Schieberegler: immer waagerecht über die Breite ===== */
.slider {
  position: relative; height: 26px; margin: var(--s3) 0 var(--s1);
  cursor: grab; display: flex; align-items: center;
}
.slider:active { cursor: grabbing; }
.slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: var(--r-pill); }

.slider-track {
  position: absolute; left: 0; right: 0; height: 10px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .12);
}
/* Farbverlauf der Lampe statt nur einer Prozentzahl */
.slider-fill {
  position: absolute; left: 0; height: 10px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, rgba(var(--glow), .25), rgb(var(--glow)));
  transition: width 120ms ease-out;
}
.slider.is-dragging .slider-fill { transition: none; }
.slider-knob {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  transform: translateX(-50%); background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .55); pointer-events: none;
  transition: left 120ms ease-out;
}
.slider.is-dragging .slider-knob { transition: none; }
.slider-value {
  position: absolute; right: 0; top: -22px;
  font-family: var(--f-data); font-size: .76rem; font-weight: 700; color: var(--text-soft);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
/* Weißton: der Verlauf selbst ist die Spur */
.slider.is-temp .slider-track { background: linear-gradient(90deg, #FF9E4A, #FFD9A6, #FFF6EA, #DCEBFF, #A9CBFF); }

/* ---- gemeinsame Detail-Kopfzeile ---- */
.detail-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 2px 2px var(--s2); }
.back-btn {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--glass); border: 1px solid var(--glass-line); color: var(--text-soft);
  cursor: pointer; transition: transform 140ms cubic-bezier(.23, 1, .32, 1);
}
.back-btn:active { transform: scale(.92); }
.back-btn svg { width: 18px; height: 18px; }
.detail-title { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; flex: 1; }
.detail-title b { font-size: 1.42rem; font-weight: 300; line-height: 1.15; overflow-wrap: anywhere; letter-spacing: -.01em; }
.detail-title span { font-family: var(--f-data); font-size: .68rem; color: var(--text-faint); letter-spacing: .04em; margin-top: 2px; }

/* ---- Toggle-Schalter ---- */
.toggle {
  width: 46px; height: 26px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .16);
  position: relative; flex: none; border: 0; padding: 0; cursor: pointer;
  transition: background 180ms ease;
}
.toggle i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-faint);
  transition: transform 180ms cubic-bezier(.23, 1, .32, 1), background 180ms ease; }
.toggle.is-on { background: rgba(var(--glow, 154, 51, 255), .38); }
.toggle.is-on i { transform: translateX(20px); background: rgb(var(--glow, 154, 51, 255)); }
.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.toggle.sm { width: 40px; height: 23px; }
.toggle.sm i { width: 17px; height: 17px; }
.toggle.sm.is-on i { transform: translateX(17px); }

/* ---- Master-Karte (Raum) ---- */
.master {
  --glow: 146, 139, 166;
  margin-top: var(--s1); position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--r3); padding: var(--s3);
  border: 1px solid rgba(var(--glow), .4);
  background: linear-gradient(155deg, rgba(255, 255, 255, .06), transparent 40%), var(--surface);
}
.master::before {
  content: ''; position: absolute; z-index: -1; inset: -30% -20% auto auto; width: 80%; padding-bottom: 80%;
  border-radius: 50%; background: radial-gradient(circle, rgba(var(--glow), .5), transparent 70%); filter: blur(30px);
}
.master-top { display: flex; align-items: center; gap: var(--s2); }
.master-icon { width: 42px; height: 42px; border-radius: var(--r1); display: grid; place-items: center; flex: none;
  background: rgba(var(--glow), .22); color: rgb(var(--glow)); }
.master-icon svg { width: 22px; height: 22px; }
.master-head { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.master-head b { font-size: 1.2rem; font-weight: 300; color: var(--text); }
.master-head span { font-family: var(--f-data); font-size: .7rem; color: var(--text-faint); }

.master .slider { margin-bottom: 0; }

/* ---- Szenen-Karussell ---- */
.scene-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.scene-head .section-label { margin-bottom: var(--s2); }
.scene-now { font-size: .78rem; color: var(--text-faint); }
.scene-now b { font-weight: 400; color: var(--brand-3); }

.scene-row {
  display: flex; gap: var(--s2); overflow-x: auto; padding: 4px 2px var(--s2);
  scrollbar-width: none; scroll-snap-type: x mandatory;
}
.scene-row::-webkit-scrollbar { display: none; }

.scene-chip {
  flex: none; width: 116px; scroll-snap-align: center;
  display: flex; flex-direction: column; gap: 9px; align-items: stretch;
  padding: 0; background: none; border: 0;
  font: inherit; color: var(--text); cursor: pointer; text-align: left;
  transition: transform 200ms cubic-bezier(.23, 1, .32, 1);
}
.scene-chip:active { transform: scale(.95); }
.scene-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--r2); }

/* Die Farbfläche ist die Szene — sie zeigt die Stimmung, nicht nur den Namen */
.scene-art {
  position: relative; height: 84px; border-radius: 18px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 8px 20px -12px rgba(0, 0, 0, .8);
  transition: box-shadow 240ms ease, transform 240ms cubic-bezier(.23, 1, .32, 1);
}
.scene-chip.is-active .scene-art {
  box-shadow: inset 0 0 0 2px var(--brand-3), 0 10px 26px -10px rgba(0, 229, 255, .5);
  transform: translateY(-3px);
}
/* Laufende Szene: pulsierender Punkt statt nur eines Rahmens */
.scene-live {
  position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3), 0 1px 4px rgba(0, 0, 0, .5);
}
@media (prefers-reduced-motion: no-preference) {
  .scene-live { animation: breathe-soft 2s ease-in-out infinite; }
}

.scene-name { font-size: .92rem; font-weight: 300; line-height: 1.25; overflow-wrap: anywhere; padding: 0 2px; }
.scene-chip.is-active .scene-name { color: var(--brand-3); }
.scene-chip.is-busy { opacity: .5; }

/* ---- Zeilen-Listen ---- */
.light-list { display: flex; flex-direction: column; gap: var(--s1); }
.light-row, .switch-row {
  display: flex; align-items: center; gap: var(--s2); padding: 11px 14px; border-radius: var(--r2);
  background: var(--glass); border: 1px solid var(--glass-line);
}
.light-row.is-on { border-color: rgba(255, 190, 120, .35); background: rgba(255, 170, 90, .07); }
.li-icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .1); color: var(--text-soft); flex: none;
}
.li-icon svg { width: 17px; height: 17px; }
.light-row.is-on .li-icon { color: #FFC08A; background: rgba(255, 150, 80, .24); }
.li-body {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left;
  background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0;
}
.li-body b { font-size: 1.14rem; font-weight: 300; line-height: 1.25; overflow-wrap: anywhere; }
.li-body span { font-family: var(--f-data); font-size: .7rem; color: var(--text-faint); }
.switch-row { cursor: default; }
.chev { width: 18px; height: 18px; color: var(--text-faint); flex: none; }

/* ---- Lampen-Kopf: große Bauform + Ein/Aus ---- */
.light-hero {
  --glow: 255, 200, 140;
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  padding: var(--s4) var(--s3) var(--s3); margin-top: var(--s1);
  border-radius: var(--r3); border: 1px solid var(--glass-line);
  background: linear-gradient(160deg, rgba(255, 255, 255, .05), transparent 45%), var(--surface);
}
.light-hero.is-on { border-color: rgba(var(--glow), .4); }
.light-hero::before {
  content: ''; position: absolute; z-index: -1; inset: -40% -20% auto auto;
  width: 90%; padding-bottom: 90%; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgba(var(--glow), .5), transparent 70%);
  filter: blur(40px); transition: opacity 500ms ease;
}
.light-hero.is-on::before { opacity: 1; }
.light-shape { width: 128px; height: 128px; color: var(--text-faint); }
.light-shape svg { width: 100%; height: 100%; display: block; }
.light-hero.is-on .light-shape { filter: drop-shadow(0 0 22px rgba(var(--glow), .45)); }

.power-btn {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-pill);
  background: var(--glass); border: 1px solid var(--glass-line); color: var(--text-soft);
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: transform 140ms cubic-bezier(.23, 1, .32, 1);
}
.power-btn:active { transform: scale(.96); }
.power-btn.is-on { color: rgb(var(--glow)); border-color: rgba(var(--glow), .5); background: rgba(var(--glow), .14); }
.power-btn svg { width: 18px; height: 18px; }
.hint { margin: 0; font-size: .78rem; color: var(--text-faint); }
.hint.centered { text-align: center; }

/* ---- Segmented Control ---- */
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--glass-line); margin-top: var(--s3); }
.segmented button {
  flex: 1; border: 0; background: none; color: var(--text-soft); font: inherit; font-size: .82rem; font-weight: 600;
  padding: 9px 0; border-radius: var(--r-pill); cursor: pointer;
}
.segmented button.is-active { background: var(--brand-gradient-diag); color: #fff; }

/* ---- Farbrad ---- */
.wheel-wrap { position: relative; width: 240px; max-width: 78%; margin: var(--s3) auto var(--s1); aspect-ratio: 1; }
.wheel { width: 100%; height: 100%; display: block; border-radius: 50%; cursor: crosshair; }
.wheel-thumb {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none;
  border: 3px solid #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .55);
}

.temp-labels { display: flex; justify-content: space-between; font-family: var(--f-data); font-size: .66rem; color: var(--text-faint); padding: 0 2px; }

/* ---- Effekte ---- */
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--s1); padding: var(--s3) 0 var(--s1); }
.fx-chip {
  padding: 12px 10px; border-radius: var(--r1); background: var(--glass); border: 1px solid var(--glass-line);
  font: inherit; font-size: .82rem; color: var(--text-soft); cursor: pointer;
  transition: transform 140ms cubic-bezier(.23, 1, .32, 1);
}
.fx-chip:active { transform: scale(.96); }
.fx-chip.is-active { background: var(--brand-gradient-diag); color: #fff; border-color: transparent; }

/* ---- Einstellungen ---- */
.settings-list { display: flex; flex-direction: column; gap: 6px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 13px 14px; border-radius: var(--r1); background: var(--glass); border: 1px solid var(--glass-line); }
.settings-row b { font-size: .84rem; font-weight: 400; color: var(--text-soft); }
.settings-row span { font-family: var(--f-data); font-size: .8rem; color: var(--text); text-align: right; }
.settings-row.is-action { width: 100%; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.settings-row.is-action span { color: var(--brand-3); font-family: var(--f-ui); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.settings-row.is-action svg { width: 16px; height: 16px; flex: none; }
.settings-row.is-action:active { transform: scale(.98); }

/* ---- Verbindungskarte ---- */
.connect-card { margin-top: var(--s4); padding: var(--s3); border-radius: var(--r3); background: var(--surface); border: 1px solid var(--glass-line); text-align: center; }
.connect-card h2 { font-size: 1.1rem; font-weight: 400; margin: 0 0 6px; }
.connect-card p { margin: 0 0 var(--s3); color: var(--text-soft); font-size: .88rem; }
.connect-card input {
  width: 100%; height: var(--tap); background: var(--bg); color: var(--text); text-align: center;
  border: 1px solid var(--glass-line); border-radius: var(--r1); font-size: 1.1rem; letter-spacing: .3em;
  font-family: var(--f-data); margin-bottom: var(--s2);
}
.connect-card button {
  width: 100%; min-height: var(--tap); border: 0; border-radius: var(--r-pill);
  background: var(--brand-gradient-diag); color: #fff; font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer;
}

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(6px);
  background: rgba(24, 21, 32, .95); color: var(--text); border: 1px solid var(--glass-line);
  padding: 11px 18px; border-radius: var(--r-pill); font-size: .84rem; max-width: 84vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 200ms ease, transform 200ms ease; z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
