* { box-sizing: border-box; }
:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #211a35;
  background: #f7f6fb;
  --muted: #6e667d;
  --purple: #6038ba;
  --line: #eae5f2;
}
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled, input:disabled, select:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #9468ff; outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.top, main { max-width: 1056px; margin: auto; }
.top {
  padding: max(20px, env(safe-area-inset-top)) 26px 17px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand, .top-actions { display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 750; font-size: 19px; letter-spacing: -.45px; white-space: nowrap; }
.mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: white; background: #633cc8; box-shadow: 0 4px 12px #6843ce38; }
.mark svg { width: 19px; }
.icon-button { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid var(--line); border-radius: 14px; background: white; flex: 0 0 auto; }
.icon-button:hover { background: #f2ebff; }
.connection { font-size: 12px; font-weight: 650; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.connection::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9991a6; }
.connection[data-status="online"]::before { background: #1caa77; }
.connection[data-status="demo"]::before { background: #9964ee; }
.connection[data-status="error"]::before { background: #c44654; }
main { padding: 0 26px calc(110px + env(safe-area-inset-bottom)); }
.hero {
  overflow: hidden; position: relative; isolation: isolate;
  border-radius: 30px; min-height: 242px; padding: 29px 34px;
  background: radial-gradient(ellipse at 80% 55%, #5e3897, transparent 49%), linear-gradient(118deg, #261342, #361e66 58%, #2d1953);
  color: #fff; display: flex; align-items: center;
  box-shadow: 0 15px 32px -22px #462874a8;
}
.hero-copy { position: relative; z-index: 2; }
.hero-label { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; color: #e6d7ff; font-size: 10px; font-weight: 700; letter-spacing: .19em; }
.hero-label span { width: 7px; height: 7px; border-radius: 50%; background: #d1a9ff; box-shadow: 0 0 11px #e5bcff; }
h1 { margin: 0; font-size: clamp(36px, 6vw, 61px); line-height: .97; font-weight: 760; letter-spacing: -.067em; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.hero-stats span { padding: 6px 10px; border-radius: 30px; font-size: 11px; font-weight: 650; border: 1px solid #eacbff39; color: #f2e8ff; background: #ead8ff17; }
.art { pointer-events: none; position: absolute; right: 4%; top: 0; width: 45%; height: 100%; }
.orbit { position: absolute; width: 82%; height: 76%; top: 12%; right: 12%; border: 1px solid #e1bdff33; border-radius: 50%; transform: rotate(-27deg); box-shadow: 0 0 0 19px #ddacff0f, 0 0 0 39px #ddacff09; }
.beam { position: absolute; left: 20%; top: 10%; height: 94%; width: 67%; background: radial-gradient(ellipse at 54% 54%, #ffb1d392, #ae77fd55 42%, transparent 70%); filter: blur(12px); }
.lamp { position: absolute; width: 42%; height: 69%; top: 13%; left: 34%; transform: rotate(-14deg); border-radius: 49% 49% 42% 42%; border: 2px solid #eee0ff9e; background: radial-gradient(ellipse at 39% 68%, #fff0d8 0%, #ffd0e4 19%, #e694f1 39%, #9a64e8 62%, #54318c 92%); box-shadow: inset -12px -9px 24px #532d997c, inset 7px 6px 18px #fff2, 0 0 24px #efb0ff9e, 0 0 65px #a46cff80; }
.lamp::after { content: ""; position: absolute; top: 17%; left: 16%; width: 32%; height: 46%; border-radius: 50%; background: linear-gradient(115deg, #fff7, #fff0 72%); filter: blur(2px); }
.base { position: absolute; top: 75%; left: 44%; width: 28%; height: 10%; border-radius: 28% 28% 48% 48%; transform: rotate(-14deg); background: repeating-linear-gradient(#b28ade, #744ca7 30%, #4c2c7a 53%); box-shadow: inset 0 2px 2px #edc8f9ab, 0 6px 17px #1f093d7a; }
.art i, .art b { display: block; width: 8px; height: 8px; position: absolute; background: #f4d7ff; box-shadow: 0 0 15px #f4d7ff; border-radius: 100%; top: 23%; right: 11%; }
.art b { width: 5px; height: 5px; top: 75%; left: 13%; }
.chips { display: flex; overflow: auto; gap: 8px; padding: 21px 1px 19px; scrollbar-width: thin; }
.chip { flex: 0 0 auto; min-height: 39px; padding: 6px 14px; border-radius: 24px; white-space: nowrap; background: white; border: 1px solid var(--line); font-size: 12px; font-weight: 650; }
.chip[aria-pressed="true"] { background: #2d1b4b; color: white; border-color: #2d1b4b; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px; }
h2 { margin: 0; font-size: 25px; letter-spacing: -.05em; overflow-wrap: anywhere; }
.section-heading p, dialog header p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.section-heading p:empty { display: none; }
.search { display: flex; gap: 10px; align-items: center; color: var(--purple); background: white; padding: 0 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.search input { min-width: 0; width: 100%; border: 0; padding: 8px 3px; background: transparent; color: #211a35; }
.notice, .empty { color: var(--muted); font-size: 14px; padding: 12px; background: white; border-radius: 13px; }
.notice { border: 1px solid #f0c8d0; color: #8a354b; }
.empty { grid-column: 1 / -1; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card {
  --device-color: #9a78ec;
  position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 145px;
  border: 1px solid #eae4f3; border-radius: 19px; padding: 12px;
  background: radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--device-color) 13%, white), white 73%);
  box-shadow: 0 4px 12px #39205106; min-width: 0;
}
.card[data-category="power"] { --device-color: #6bc8a5; }
.card[data-category="computer"], .card[data-category="media"] { --device-color: #6eacfb; }
.card[data-category="clock"] { --device-color: #edb979; }
.card[data-category="sensor"], .card[data-category="climate"] { --device-color: #61b4eb; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.device-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 12px; background: color-mix(in srgb, var(--device-color) 27%, white); color: color-mix(in srgb, var(--device-color) 46%, #201438); }
.next { color: #7e6c94; font-size: 24px; padding: 0 7px; }
.card-open { text-align: left; background: none; border: 0; padding: 0; display: grid; gap: 2px; width: 100%; }
.card-open::after { content: ""; position: absolute; inset: 0; border-radius: 19px; }
.card-open strong { font-weight: 720; font-size: 14px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.card-open small, .card-state { color: var(--muted); font-size: 11px; }
.card-state { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #a399b1; flex: 0 0 auto; }
.dot.is-on { background: #21a578; }
.toggle { position: relative; z-index: 1; border: 0; background: #e3ddeb; border-radius: 25px; width: 43px; height: 26px; margin: 0; flex: 0 0 auto; }
.toggle::after { content: ""; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 4px #32204732; transition: transform .16s; }
.toggle[data-on="true"] { background: #7249d7; }
.toggle[data-on="true"]::after { transform: translateX(17px); }
.mini-range { position: relative; z-index: 1; display: block; height: 23px; margin-top: -4px; }
input[type="range"] { appearance: none; display: block; width: 100%; background: transparent; margin: 0; height: 25px; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 7px; border-radius: 10px; background: linear-gradient(to right, #9467eb var(--fill), #eee8f5 var(--fill)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: white; border: 3px solid #8156d9; margin-top: -4.5px; }
input[type="range"]::-moz-range-track { height: 7px; border-radius: 10px; background: #eee8f5; }
input[type="range"]::-moz-range-progress { height: 7px; border-radius: 10px; background: #9467eb; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: white; border: 3px solid #8156d9; }
.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 3; background: #ffffffef; backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 6px 4px max(6px, env(safe-area-inset-bottom)); }
.tab { display: grid; place-items: center; align-content: center; gap: 4px; border: 0; background: none; border-radius: 12px; height: 52px; flex: 0 1 100px; min-width: 0; color: var(--muted); font-size: 10px; font-weight: 650; }
.tab[aria-pressed="true"] { background: #eee6ff; color: #5630b1; }
.tab svg { width: 19px; height: 19px; }
dialog { position: fixed; inset: auto 0 0; margin: 0 auto; width: min(100%, 540px); max-width: 100%; max-height: 88dvh; overflow: auto; border: 1px solid var(--line); border-radius: 26px 26px 0 0; padding: 11px 18px max(20px, env(safe-area-inset-bottom)); background: #fcfaff; color: inherit; }
dialog::backdrop { background: #23123981; }
.sheet-handle { width: 35px; height: 4px; border-radius: 5px; background: #dbd1e9; margin: 0 auto 15px; }
dialog header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding-bottom: 12px; }
#controls { display: grid; gap: 8px; }
.field { display: grid; gap: 10px; background: white; border: 1px solid var(--line); border-radius: 13px; padding: 11px; }
.field-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; }
.field-title output { color: var(--purple); }
.field select, .field input[type="time"] { min-height: 39px; width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fcfaff; color: inherit; }
.palette { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.swatch { width: 34px; height: 34px; border: 1px solid #2f1d4633; border-radius: 50%; background: var(--swatch); padding: 0; }
.swatch[aria-pressed="true"] { border: 2px solid #281742; box-shadow: inset 0 0 0 2px white; }
input[type="color"] { width: 37px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
.soft-button, .action { min-height: 36px; border: 0; border-radius: 10px; padding: 6px 12px; background: #eee6ff; color: #5630b1; font-size: 13px; font-weight: 700; }
.action { background: #643ac7; color: white; }
#toast { position: fixed; z-index: 5; inset: auto 12px calc(67px + env(safe-area-inset-bottom)); width: fit-content; max-width: calc(100% - 24px); margin: auto; padding: 9px 14px; border-radius: 12px; background: #2d1b4b; color: white; font-size: 13px; pointer-events: none; }
@media (max-width: 650px) {
  .top { padding-inline: 14px; }
  main { padding-inline: 14px; }
  .hero { min-height: 199px; padding: 21px 17px; border-radius: 22px; }
  .art { width: 51%; right: 2%; }
  .lamp { width: 60%; left: 25%; height: 60%; top: 20%; }
  .base { left: 38%; width: 35%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
