.room-demo { padding-bottom: 35px; }
.room-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(250px, 1fr); gap: 16px; margin-top: 28px; }
.room-scene { position: relative; isolation: isolate; overflow: hidden; border-radius: 18px; align-self: start; background: #4b3022; }
.room-photo { display: block; width: 100%; height: auto; }
.room-screen, .room-window, .room-strip, .room-dim { position: absolute; pointer-events: none; }
.room-screen {
  inset: 0;
  clip-path: polygon(26.75% 19.1%, 54% 24.6%, 54% 49%, 26.75% 49.9%);
  background: radial-gradient(ellipse at 44% 36%, #ffd39a 0 1.5%, transparent 2%),
    linear-gradient(160deg, transparent 40%, #2a393e 40.2%, #40535a 55%, transparent 55.2%),
    linear-gradient(24deg, #14272e 43%, transparent 43.2%),
    linear-gradient(180deg, #403967 22%, #c66d64 36%, #f9b77e 46%, #2d545c 48%);
  opacity: 0;
  transition: opacity .45s ease;
}
[data-tv="on"] .room-screen { opacity: 1; }
.room-window { inset: 14.9% 0 45.1% 79.45%; clip-path: polygon(0 13%,100% 0,100% 100%,0 97%); }
.room-shade {
  height: 100%;
  transform: translateY(-95%);
  transition: transform .9s cubic-bezier(.22,.7,.25,1);
  border-bottom: 4px solid #856546;
  background: repeating-linear-gradient(0deg,#8b705024 0 1px,transparent 1px 4px),
    linear-gradient(110deg,#a88d70,#d4b89a 65%,#f1cc9f);
  box-shadow: 0 5px 12px #2c1a12a0;
}
[data-shades="closed"] .room-shade { transform: translateY(-8%); }
.room-strip {
  inset: 0;
  clip-path: polygon(18% 74.8%, 65% 62.9%, 65% 68.6%, 18.6% 81%);
  background: #27150c;
  opacity: 0;
  transition: opacity .4s, background-color .4s;
}
[data-led="rose"] .room-strip { background-color: #ec58b4; opacity: .7; mix-blend-mode: color; }
[data-led="off"] .room-strip { opacity: .54; }
.room-dim { inset: 0; background: #110d25; opacity: 0; transition: opacity .55s; }
[data-lights="off"] .room-dim { opacity: .61; }
[data-lights="off"][data-tv="on"] .room-screen { z-index: 1; }
.room-pin {
  z-index: 2; position: absolute; transform: translate(-50%, -50%);
  display: grid; place-items: center; padding: 0; border: 0; background: transparent; cursor: pointer;
  min-width: 46px; min-height: 46px; font: 750 clamp(.66rem, 1.5vw, .85rem)/1 system-ui, sans-serif;
}
.room-pin span { color: #2e241d; background: #fff2e1; border: 1px solid #d4926e; border-radius: 999px; padding: 8px 10px; box-shadow: 0 2px 8px #27160e70; white-space: nowrap; }
.room-pin:is(:hover,:focus-visible) span, .room-pin.is-selected span { background: #efb78d; }
.room-pin:focus-visible { outline: 2px solid white; border-radius: 12px; }
.pin-tv { left: 40%; top: 34%; width: 27%; height: 30%; }
.pin-shades { left: 88.5%; top: 35%; width: 20%; height: 34%; }
.pin-lights { left: 69%; top: 43%; }
.pin-lights span { margin-top: 18px; }
.pin-lights::before { content: ""; position: absolute; top: 0; width: 11px; height: 18px; background: linear-gradient(#fff7e7 45%,#b49d87 46% 55%,#f2dfca 56%); border: 1px solid #aa896f; border-radius: 2px; box-shadow: 1px 2px 4px #2c1a12a0; }
.pin-led { left: 34%; top: 72%; width: 32%; }
.room-info { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 22px; background: #f6e6d7; border: 1px solid var(--line); padding: clamp(20px,3vw,34px); border-radius: 18px; }
.room-info h3 { font: 400 clamp(1.75rem, 3vw, 2.45rem)/1.03 Georgia,serif; margin: 8px 0 12px; }
.room-status { color: #83482d; font-size: .77rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 850px) { .room-layout { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .room-screen, .room-shade, .room-strip, .room-dim { transition: none; } }
.speaker-left { left:22%; top:34%; }
.speaker-right { left:56.8%; top:36%; }
[data-speaker] span { padding:5px 9px; }
[data-speaker][aria-pressed=true] span { background:#ffc287; box-shadow:0 0 0 6px #ffdfaf75; }
@media(prefers-reduced-motion:no-preference){
  [data-speaker][aria-pressed=true] span {animation:speaker-pulse .5s ease-in-out infinite alternate}
  @keyframes speaker-pulse {to{transform:scale(1.14)}}
}
.tablet-pin{left:9.735%;top:29.486%;transform:translate(-50%,-50%)}.tablet-pin span{border:3px solid #31251e;background:#73543f;color:white;border-radius:5px;padding:6px 12px}
#smart-tablet{width:min(92vw,530px);border:8px solid #392d26;padding:22px;background:#fbefe2;border-radius:20px}
.tablet-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.tablet-grid button{background:#fffaf4;color:#513828;border:1px solid #cba991;border-radius:10px;min-height:65px;padding:7px;font-weight:700}
.tablet-grid button:disabled{opacity:.55}.tablet-grid small{display:block;font-weight:400;color:#744c35}
@media(max-width:450px){.tablet-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

#smart-tablet[open] {
  position:relative;
  inset:auto;
  margin:0;
  align-self:start;
  width:100%;
  max-width:none;
  max-height:none;
  padding:16px;
  background:rgba(250,236,218,.45);
  border:2px solid rgba(80,54,39,.55);
  box-shadow:0 8px 24px #39271c18;
}
#smart-tablet .tablet-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
#smart-tablet .tablet-grid button {background:rgba(255,250,244,.56)}
#smart-tablet[open] + .room-info {display:none}
body:has(#smart-tablet[open]):not(:has(dialog:modal)) {overflow:auto}
@media(max-width:850px) {
  #smart-tablet .tablet-grid {grid-template-columns:repeat(3,minmax(0,1fr))}
  #smart-tablet .tablet-grid button {min-height:48px}
}
.doorbell-trigger,.dismiss-ring{background:#53392b;color:#fff4e6;font:700 .94rem system-ui;border:0;border-radius:8px;padding:12px 16px;cursor:pointer}
.doorbell-trigger{margin-top:12px}
.doorbell-alert:not([hidden]){display:grid;gap:8px}
#smart-tablet .doorbell-alert img{width:100%;height:auto;max-height:280px;object-fit:cover;border-radius:9px}
.doorbell-alert:not([hidden]) + .tablet-grid{display:none}
.dismiss-ring{justify-self:start}
.home-rooms{display:flex;flex-wrap:wrap;gap:10px;margin:18px 0 24px}
.home-rooms a{padding:7px 13px;border:1px solid var(--line);border-radius:20px;color:#613e29;text-underline-offset:3px}
#entry-hall,#living-space{font-size:1.45rem;margin:16px 0 8px}
.hall-scene{position:relative;overflow:hidden;border-radius:18px;background:#33251d;isolation:isolate}
.hall-scene img{width:100%;height:auto;display:block}
.hall-scene button{position:absolute;transform:translate(-50%,-50%);border:1px solid #bb9572;background:#fff1dc;color:#38261d;border-radius:24px;padding:8px 12px;font:700 clamp(.65rem,1.6vw,.9rem) system-ui;cursor:pointer;min-height:36px;white-space:nowrap;margin:0}
.hall-scene button[aria-pressed=true]{background:#e3af7c}
.hall-stairs{left:25%;top:59%}.hall-lock{left:75%;top:46%}.hall-scene .doorbell-trigger{left:83%;top:61%}
.step-glow{position:absolute;inset:0;opacity:0;pointer-events:none;transition:opacity .4s}
.hall-scene[data-stairs=on] .step-glow{opacity:1}
@media(min-width:851px){.room-layout:not(:has(#smart-tablet[open])){grid-template-columns:1fr}.room-layout:not(:has(#smart-tablet[open])) .room-info{display:flex;flex-direction:row;align-items:center;justify-content:space-between}}
@media(prefers-reduced-motion:reduce){.step-glow{transition:none}}
.step-glow {
  background:
    radial-gradient(ellipse 1.18% 2.55% at 17.50% 38.37%, #fff4c2 0 13%, #ffd994e6 19%, #ffb65d66 44%, transparent 100%),
    radial-gradient(ellipse 1.533% 3.200% at 5.067% 60.000%, #fff4c2 0 13%, #ffd994e6 19%, #ffb65d66 44%, transparent 100%),
    radial-gradient(ellipse 1.267% 2.800% at 12.733% 45.700%, #fff4c2 0 13%, #ffd994e6 19%, #ffb65d66 44%, transparent 100%),
    radial-gradient(ellipse 1.067% 2.300% at 21.333% 30.900%, #fff4c2 0 13%, #ffd994e6 19%, #ffb65d66 44%, transparent 100%),
    radial-gradient(ellipse 0.867% 2.000% at 26.800% 21.700%, #fff4c2 0 13%, #ffd994e6 19%, #ffb65d66 44%, transparent 100%);
}
.home-preview{display:grid;grid-template-columns:minmax(0,1.18fr) minmax(0,1fr);gap:clamp(10px,2vw,24px);align-items:start}
.room-layout:has(.home-preview){grid-template-columns:minmax(0,1fr)}
.room-layout:has(.home-preview) #smart-tablet[open]{max-width:100%}
.home-preview #entry-hall,.home-preview #living-space{margin:0 0 8px}
@media(min-width:701px){#smart-tablet[open] .tablet-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:700px){.home-preview{grid-template-columns:minmax(0,1fr)}}
@media(prefers-reduced-motion:no-preference){
  [data-tv="on"] .room-screen{animation:tv-sunset 7s ease-in-out infinite alternate}
  @keyframes tv-sunset{from{filter:brightness(.88) saturate(.84)}to{filter:brightness(1.15) saturate(1.25)}}
}
.room-layout:has(.home-preview) #smart-tablet:modal{
  position:fixed;inset:0;margin:auto;width:min(92vw,480px);height:fit-content;
  max-height:90dvh;overflow:auto;background:#fff3e5;box-shadow:0 18px 80px #281c1980
}
#smart-tablet:modal::backdrop{background:#291d195c}

/* Keep the photo visible through each hotspot, including its active state. */
.room-scene .room-pin span,
.hall-scene button,
.hall-scene button[aria-pressed=true] {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #fff9ef;
  text-shadow: 0 1px 3px #24160e, 0 0 2px #24160e, 0 0 5px #24160e;
}
.room-scene .room-pin span { padding: 0; }

.room-scene .room-pin:is(:hover,:focus-visible,.is-selected) span,
.room-scene [data-speaker][aria-pressed=true] span,
.hall-scene button:is(:hover,:focus-visible) { color: #ffe0ac; }
.room-scene { container-type: inline-size; }
.room-scene [data-speaker] span {
  font-size: clamp(9px,1.65cqw,14px);
  line-height: 1;
}
.room-scene .speaker-left { left:21.8%; top:33.8%; }
.room-scene .speaker-right { left:56.8%; top:36.5%; }

.room-scene .room-pin span,
.hall-scene button {
  outline: 1px solid rgba(255, 247, 229, .58);
  outline-offset: 3px;
  border-radius: 4px;
}
.room-scene .room-pin:is(:hover,:focus-visible) span,
.hall-scene button:is(:hover,:focus-visible) {
  outline: 2px solid #fff4df;
}
.room-scene .tablet-pin{overflow:visible;display:grid;place-items:center;width:clamp(44px,9cqw,65px);min-height:44px}
.tablet-hardware{box-sizing:border-box;display:grid;width:100%;aspect-ratio:1.52;padding:3px;border:1px solid #99948d;border-radius:5px;background:linear-gradient(145deg,#393a39,#111211 45%,#262521);box-shadow:1px 2px 2px #000b,inset 0 0 1px #eee}
.tablet-display{display:grid;grid-template-columns:1fr 1fr;gap:2px;padding:9% 12%;border-radius:2px;background:linear-gradient(140deg,#718991,#263947 48%,#715a48)}
.tablet-display i{border-radius:1px;background:linear-gradient(135deg,#ead9b6ca,#ccc2b072)}
.tablet-display i:nth-child(even){background:linear-gradient(135deg,#a8d0cbcc,#8ab8b17d)}
.tablet-pin small{position:absolute;top:calc(50% + clamp(15px,3cqw,22px));color:#fff9ef;font:650 clamp(9px,1.55cqw,11px)/1.25 system-ui;white-space:nowrap;text-shadow:0 1px 3px #1d140d,0 0 2px #1d140d}
.tablet-pin:is(:hover,:focus-visible) .tablet-hardware{border-color:#ffe4bb}
.hall-scene .alarm-pad{left:56%;top:46%;width:46px;height:44px;padding:0;background:none;border:0;outline:none;display:grid;place-content:center;justify-items:center}
.alarm-pad i{display:grid;place-items:center;width:32px;height:23px;border-radius:3px;border:2px solid #252426;background:linear-gradient(135deg,#193c3a,#406661);box-shadow:1px 2px 3px #33281a;color:#daffe4;font-style:normal}
.alarm-pad small{font-size:9px;color:white;text-shadow:0 1px 3px black}
.entry-security{padding:10px 2px;display:flex;align-items:center;flex-wrap:wrap;gap:10px;font-size:.86rem}
.entry-security button{border:1px solid var(--line);border-radius:7px;padding:8px 12px;background:var(--panel);color:var(--light);cursor:pointer}
.entry-security button:disabled{opacity:.5}
#alarm-controls:not([hidden]){display:flex;align-items:center;gap:12px;flex-basis:100%}
.hall-scene .alarm-pad:focus-visible{outline:2px solid white}
.sliding-door{
  position:absolute;inset:0;pointer-events:none;
  clip-path:polygon(69.3% 33.1%,81.6% 32.7%,81.6% 70.6%,69.3% 70.2%);
}
.sliding-door::before{
  content:"";position:absolute;left:69%;top:32%;width:13%;height:39%;
  background:linear-gradient(90deg,#261d1740,transparent 18%),url(porch-empty.webp) 68% center/auto 100%;
}
.door-leaf{
  position:absolute;inset:0;background:url(entry-hall.webp) center/100% 100%;
  clip-path:polygon(69.3% 33.1%,81.6% 32.7%,81.6% 70.6%,69.3% 70.2%);
  transition:transform .85s cubic-bezier(.35,0,.2,1);
}
.hall-scene[data-door=open] .door-leaf{transform:translateX(-13%)}
@media(prefers-reduced-motion:reduce){.door-leaf{transition:none}}
.alarm-pad i{font:700 8px/1 system-ui;letter-spacing:0}
.hall-scene[data-door=open] .alarm-pad i{background:#643e28;color:#fff5d8}
.entry-security .entry-disarm:not(:disabled){background:#633b26;color:white;font-weight:700}

/* Sample the neighboring recessed fixture so the new puck matches the photo. */
.stair-puck-added {
  position:absolute;left:17.50%;top:38.37%;width:.69%;height:1.55%;
  transform:translate(-50%,-50%);border-radius:50%;pointer-events:none;
  background:url(entry-hall.webp) 21.14% 30.62% / 15000% 7142.86%;
}
.hall-scene{container-type:inline-size}
.hall-scene .hall-stairs,.hall-scene .doorbell-trigger{
  min-height:44px;min-width:44px;padding:27px 0 0;outline:none;background:none;border:none;
  font-size:clamp(9px,1.7cqw,11px);line-height:1.15;
}
.hall-scene .hall-stairs{left:10.3%;top:33%}
.hall-scene .hall-stairs::before,.hall-scene .doorbell-trigger::before{
  content:"";position:absolute;left:50%;top:3px;transform:translateX(-50%);
}
.hall-scene .hall-stairs::before{
  width:13px;height:21px;border:1px solid #ad9a83;border-radius:2px;
  background:linear-gradient(100deg,#f6ead8,#d9c9b4);
  box-shadow:1px 2px 3px #26190a80;
}
.hall-scene .hall-stairs::after{
  content:"";position:absolute;top:7px;left:50%;width:7px;height:13px;
  transform:translateX(-50%);border:1px solid #aa9780;border-radius:1px;
  background:linear-gradient(#fff4e3,#d2c2ad);box-shadow:0 1px 1px #75624f;
}
.hall-scene .hall-stairs[aria-pressed=true]::after{background:linear-gradient(#c7b7a0,#fff4e3)}
.hall-scene .alarm-pad{left:59.6%;top:45%;gap:2px}
.hall-scene .alarm-pad i{width:clamp(25px,5.4cqw,35px);height:clamp(18px,3.8cqw,25px);border:2px solid #28282a;border-radius:4px;box-shadow:0 0 0 1px #a49c91,1px 2px 3px #30231980}
.hall-scene .doorbell-trigger{left:90.4%;top:54%}
.hall-scene .doorbell-trigger::before{
  width:12px;height:23px;border:1px solid #aaa297;border-radius:5px;
  background:radial-gradient(circle at 50% 73%,#222 0 16%,#9edce4 17% 23%,transparent 25%),
    radial-gradient(circle at 50% 24%,#080b0e 0 14%,#737b83 15% 20%,transparent 22%),
    linear-gradient(100deg,#524e49,#242423);
  box-shadow:1px 2px 3px #31261b90;
}
.hall-scene :is(.hall-stairs,.alarm-pad,.doorbell-trigger):focus-visible{outline:2px solid white;outline-offset:2px}
.hall-scene button.hall-lock{
  left:75.45%;top:49%;width:12%;min-width:44px;min-height:44px;
  padding:0;display:grid;place-items:center;outline:0;border:0;background:transparent;
}
.door-label{
  display:grid;gap:1px;text-align:center;line-height:1.1;font-size:clamp(8px,1.7cqw,11px);
  padding:2px 3px;border:1px solid #fff7e57d;border-radius:4px;
}
.hall-scene .hall-lock:is(:hover,:focus-visible) .door-label{border-color:white}
.room-window{inset:0;clip-path:polygon(78.5% 17.5%,100% 12%,100% 55%,94% 54%,90% 52.6%,84% 54.2%,83% 53.6%,79% 52.8%)}
.room-window .room-shade{position:absolute;left:78.4%;top:11%;width:22%;height:46%;border:0;background:url(curtain-pleats.webp) left top/34% 100% repeat-x;transform:none;clip-path:inset(0 100% 0 0);transition:clip-path 420ms linear;box-shadow:none}
[data-shades=closed] .room-window .room-shade{transform:none;clip-path:inset(0)}
.porch-scene{position:relative;border-radius:18px;overflow:hidden}
.porch-scene img{display:block;width:100%;height:auto}
#outside-bell{position:absolute;left:76%;top:49%;transform:translate(-50%,-50%);background:transparent;border:0;color:white;text-shadow:0 1px 3px black;font-weight:700;cursor:pointer}
#outside-bell:before{content:"";display:block;margin:0 auto 3px;width:15px;height:29px;border:1px solid silver;border-radius:6px;background:radial-gradient(circle at 50% 73%,#333 0 15%,#b7e7ed 16% 23%,transparent 25%),radial-gradient(circle at 50% 23%,#121318 0 13%,transparent 15%),linear-gradient(110deg,#565450,#1c1d1d)}
.entry-security[hidden],.hall-scene[hidden],.porch-scene[hidden]{display:none}

.hall-scene .hall-stairs{font-size:clamp(8px,1.45cqw,9px)}
.hall-scene .alarm-pad small{font-size:8px;line-height:1.1}
.hall-scene .alarm-pad i{
  width:clamp(33px,6.4cqw,38px);font-size:clamp(6px,1.2cqw,7px);
  line-height:1;white-space:nowrap;text-shadow:none;place-content:center;
}
@media(prefers-reduced-motion:reduce){.room-window .room-shade{transition:none}}
