:root {
  color-scheme: dark;
  --bg: #141112;
  --panel: #211c1f;
  --text: #fff7ed;
  --muted: #b8aaae;
  --line: rgba(255, 235, 225, .10);
  --accent: #ffd399;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--text);
  background: #100e0f;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  min-width: 280px;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button, a, input[type=range] { touch-action: manipulation; }
button { cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #ffd399; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.app {
  width: min(100%, 460px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: radial-gradient(ellipse 110% 25rem at 50% 1rem, #2c211d 0%, #171314 78%);
}
.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 17px; }
.identity { display: inline-flex; align-items: center; min-height: 44px; gap: 10px; color: #f3e5d8; font-size: 15px; font-weight: 700; letter-spacing: -.035em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 11px;
  background: radial-gradient(circle, #ffe4a9 0 12%, #ffb76f 16%, #ad603e 40%, #4e2e25 72%);
  box-shadow: inset 0 0 0 1px #ffe4bb36;
}
.preview-label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 99px; color: #d2c1b6; white-space: nowrap; font-size: 12px; }
.preview-label span:first-child { width: 5px; height: 5px; border-radius: 50%; background: #e3ad7a; }
.top-actions { display: flex; gap: 5px; align-items: center; }
#logout { min-height: 40px; padding: 4px 8px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
body[data-live]:not([data-authorized]) .app, body[data-live]:not([data-authorized]) .dock { display: none; }
.access-screen {
  width: min(100%, 460px); min-height: 100dvh; margin: auto; padding: 40px 26px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 16px;
  background: linear-gradient(180deg, #18111355 0, #140f10 57%), url("kitchen.jpg") top center / auto 64% no-repeat #140f10;
}
.access-screen .brand-mark { display: block; width: 42px; height: 42px; border-radius: 15px; }
.access-screen h1 { font-size: 41px; letter-spacing: -.075em; }
.access-screen p { color: #e1d0c7; line-height: 1.55; min-height: 2.8em; }
.access-screen button { min-height: 49px; width: 100%; border: 1px solid #ffe3bf; border-radius: 15px; color: #2f2015; background: #ffe2b5; font-weight: 760; }
.access-screen button:disabled { opacity: .62; }
.connection-message { margin: 0 1px 10px; min-height: 20px; color: #ffd7a7; font-size: 13px; line-height: 1.4; }
.hero {
  position: relative; height: clamp(178px, 48vw, 219px); isolation: isolate; overflow: hidden;
  border: 1px solid #f4c39b30; border-radius: 25px;
  background: #34241e;
  box-shadow: 0 10px 24px #09050640;
  scroll-margin-top: 16px;
}
.room-image, .room-glow, .room-shade { position: absolute; inset: 0; z-index: -1; }
.room-image {
  background: url("kitchen.jpg") center 25% / cover no-repeat;
  filter: grayscale(.79) brightness(var(--photo-level, .82));
  transition: filter .24s ease;
}
.room-glow { mix-blend-mode: screen; }
.room-glow i {
  position: absolute; width: 29%; height: 75%; top: 9%;
  left: calc(var(--position, 27%) - 14.5%);
  background: radial-gradient(ellipse at 50% 24%, var(--glow, #ffc078) 0%, transparent 69%);
  opacity: var(--glow-level, .35);
  transition: background .20s linear, opacity .20s linear;
}
.room-shade { background: linear-gradient(180deg, #120b0c0a 18%, #140d0d0c 41%, #140d0dcf 100%); }
.room-content { position: absolute; display: flex; justify-content: space-between; align-items: end; gap: 12px; inset: auto 15px 15px 17px; }
.room-content h1 { font-size: clamp(36px, 10vw, 45px); line-height: 1.04; font-weight: 830; letter-spacing: -.085em; }
.room-content p { margin-top: 7px; color: #f2decb; font-size: 13px; font-weight: 550; letter-spacing: -.02em; }
.room-power, .mini-power {
  display: grid; place-items: center; flex: none;
  color: #efdccb; border: 1px solid #ffffff32; background: #332830b5;
}
.room-power { width: 53px; height: 53px; border-radius: 18px; backdrop-filter: blur(12px); }
.room-power[aria-pressed=true],
.mini-power[aria-pressed=true] { color: #2f2015; background: #ffe2b5; border-color: #fff1d9; }
.power-icon { position: relative; width: 18px; height: 18px; margin-top: 3px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; }
.power-icon::before { content: ""; position: absolute; width: 2px; height: 9px; border-radius: 2px; left: 6px; top: -4px; background: currentColor; }
.targets { display: grid; grid-template-columns: 1.12fr repeat(4, minmax(0, 1fr)); gap: 6px; margin: 13px 0 12px; }
.targets button {
  min-height: 43px; padding: 4px 3px;
  background: #211b1e; border: 1px solid var(--line); border-radius: 13px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  color: #cdbfc1; font-size: 12px; font-weight: 650; white-space: nowrap;
}
.targets button[aria-pressed=true] { color: var(--text); border-color: #e4a87065; background: #3d2c26; }
.target-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--light-color, #ffda9a); box-shadow: 0 0 8px var(--light-color, #ffd399); }
.target-dot[data-off=true] { background: #685c61; box-shadow: none; }
.control-panel, .music-panel, .effect-control { border: 1px solid var(--line); border-radius: 21px; background: var(--panel); padding: 15px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; min-height: 22px; }
.panel-header h2 { font-size: 18px; font-weight: 790; letter-spacing: -.055em; }
.mini-power { width: 38px; height: 38px; border-radius: 12px; }
.mini-power .power-icon { scale: .78; }
.field {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; column-gap: 8px;
}
.field label, .field output { font-size: 14px; font-weight: 650; }
.field label { color: #eee1d9; }
.field output { color: var(--accent); font-variant-numeric: tabular-nums; text-align: right; }
.field input[type=range] {
  grid-column: 1 / -1; width: 100%; min-width: 0; height: 33px; margin: 1px 0 0; appearance: none;
  color: var(--accent); background: transparent; cursor: pointer;
}
.field input[type=range]::-webkit-slider-runnable-track {
  height: 9px; border-radius: 30px; background: var(--track, linear-gradient(to right, #ffe0a8 var(--progress, 65%), #49353a var(--progress, 65%)));
}
.field input[type=range]::-moz-range-track {
  height: 9px; border-radius: 30px; background: var(--track, linear-gradient(to right, #ffe0a8 var(--progress, 65%), #49353a var(--progress, 65%)));
}
.field input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 21px; height: 21px; margin-top: -6px; border-radius: 50%;
  background: #fff5e9; border: 2px solid #fff; box-shadow: 0 2px 7px #150e0ed0;
}
.field input[type=range]::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%; background: #fff5e9; border: 2px solid #fff; box-shadow: 0 2px 7px #150e0ed0;
}
.brightness-field { margin-bottom: 8px; }
.white-field { --track: linear-gradient(90deg, #de894e, #ffe4ad 46%, #e8f1ff 74%, #a4caff); }
.hue-field { --track: linear-gradient(90deg, #ff5964, #ffdd5a, #75d873, #63ebeb, #638dff, #e67cff, #ff5964); }
.saturation-field { margin-top: 6px; --track: linear-gradient(90deg, #e8e4e3, var(--saturated, #ffaa48)); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 12px; padding: 3px; background: #171316; margin-bottom: 12px; }
.segmented button { border: 0; min-height: 38px; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 670; }
.segmented button[aria-pressed=true] { color: #fff2e3; background: #3c3034; box-shadow: 0 1px 4px #0005; }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 3px; }
.chips button, .music-sources button {
  min-height: 41px; padding: 4px; background: #2f272c; border: 1px solid var(--line); border-radius: 11px;
  color: #e0d2d4; font-size: 13px; font-weight: 650;
}
.chips button[aria-pressed=true], .music-sources button[aria-pressed=true] { border-color: #ffcb9690; background: #4a352e; color: #ffe4bf; }
.colors { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; margin: 0 -1px 12px; }
.colors button { min-width: 0; height: 40px; padding: 5px 0; border: 1px solid transparent; background: transparent; border-radius: 11px; }
.colors button span { display: block; width: min(95%, 28px); aspect-ratio: 1; margin: auto; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px #ffffff3e; }
.colors button[aria-pressed=true] { border-color: #ffdaab; }
.section { margin-top: 25px; scroll-margin-top: 14px; }
.section-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 2px 11px; }
.section-header h2 { font-size: 23px; letter-spacing: -.065em; }
.section-header span { color: var(--muted); font-size: 12px; }
.scenes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.scene-card {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 66px; text-align: left; padding: 11px 10px; border: 1px solid #fff2;
  border-radius: 16px; background: linear-gradient(115deg, var(--scene-bg), #211b23 87%);
  display: flex; align-items: center; gap: 9px;
}
.scene-card[aria-pressed=true] { border-color: #ffd299b5; box-shadow: inset 0 0 0 1px #ffc78d45; }
.scene-mark { flex: none; display: block; width: 34px; aspect-ratio: 1; border-radius: 50%; background: var(--scene-art); box-shadow: inset 0 0 0 1px #fff3, 0 3px 14px #08070b66; }
.scene-card strong { display: block; white-space: nowrap; font-size: 15px; line-height: 1; letter-spacing: -.03em; }
.scene-card small { display: block; color: #ede0e2; margin-top: 6px; white-space: nowrap; font-size: 11px; }
.effect-control { margin-top: 10px; }
.speed-chips { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.music-panel { background: radial-gradient(ellipse at 0% 0%, #3c283d, #251c28 60%); }
.music-display { display: flex; align-items: center; gap: 11px; }
.visualizer { flex: 0 0 61px; height: 57px; border-radius: 16px; background: #261b32; padding: 12px 9px; display: flex; gap: 3px; align-items: center; justify-content: center; border: 1px solid #d8a6ff35; }
.visualizer i { flex: 1; max-width: 4px; background: linear-gradient(#ffc987, #d98ceb 64%, #896cd1); height: var(--bar, 28%); min-height: 4px; border-radius: 5px; transition: height .10s ease-out; }
.music-copy { min-width: 0; overflow-wrap: anywhere; }
.music-copy strong { font-size: 15px; }
.music-copy p { margin-top: 5px; color: #d0bdd2; font-size: 13px; line-height: 1.4; }
.music-readout { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; font-size: 12px; color: #f0c5f8; font-variant-numeric: tabular-nums; }
.music-sources { margin: 13px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.music-field { --track: linear-gradient(to right, #d8a5ff var(--progress, 65%), #49374d var(--progress, 65%)); }
.music-field output { color: #e3b6ff; }
.music-field input[type=range] { height: 44px; touch-action: pan-y; }
.sensitivity-caption { display: flex; grid-column: 1 / -1; justify-content: space-between; color: #d0bdd2; font-size: 12px; }
.stop-music { display: block; width: 100%; min-height: 43px; margin-top: 7px; background: #503650; border: 1px solid #c48ac168; border-radius: 11px; font-size: 14px; font-weight: 680; }
.footnote { margin-top: 16px; color: #ac9fa2; font-size: 12px; text-align: center; line-height: 1.5; }
.dock {
  position: fixed; z-index: 3; bottom: max(9px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  width: min(calc(100% - 34px), 424px); padding: 5px;
  border-radius: 23px; border: 1px solid #ecd1bf2b; background: #251e23ed;
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); box-shadow: 0 6px 28px #0008;
}
.dock a { display: grid; justify-items: center; align-content: center; gap: 5px; min-height: 47px; border-radius: 17px; color: #d0bbc6; font-size: 12px; font-weight: 690; }
.dock a[aria-current] { background: #4b3430; color: #ffe0b7; }
.dock-light { display: block; width: 13px; height: 13px; border: 2px solid; border-radius: 50%; box-shadow: 0 0 0 2px #f0b27640; }
.dock-scenes { display: block; width: 13px; height: 13px; border: 2px dashed; border-radius: 4px; rotate: 45deg; }
.dock-music { display: block; width: 13px; height: 14px; border-left: 2px solid; border-right: 2px solid; border-radius: 1px; background: linear-gradient(currentColor, currentColor) 50% 50% / 2px 100% no-repeat; }
@media (max-width: 350px) {
  .app { padding-inline: 12px; }
  .targets { gap: 4px; }
  .control-panel { padding-inline: 12px; }
  .scene-card { padding-inline: 8px; gap: 7px; }
  .scene-mark { width: 28px; }
  .scene-card small { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
