/* HOME MAP — one 3D home shared by LIVE, TRACE and FIT */
#mapView.home-map-ready {
  --hm-gold: #d8bd86;
  --hm-ink: #090a0a;
  --hm-glass: rgba(9,10,10,.78);
  --hm-line: rgba(255,255,255,.10);
}

#mapView.home-map-ready .map-heading {
  width: min(360px,29vw) !important;
  padding: 13px 17px !important;
  display: block !important;
}

#mapView.home-map-ready .map-heading h1 {
  font-family: Arial,Helvetica,sans-serif !important;
  font-size: 25px !important;
  font-weight: 520 !important;
  letter-spacing: .055em !important;
}

#mapView.home-map-ready .map-heading p { max-width: 310px; }

#mapView.home-map-ready .map-summary {
  display: grid !important;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 6px !important;
  margin-top: 12px;
}

#mapView.home-map-ready .summary-chip {
  min-width: 0 !important;
  padding: 9px 10px !important;
  border-color: rgba(255,255,255,.075) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.025) !important;
}

#mapView.home-map-ready .summary-chip small { color:#77736c !important; font-size:7px !important; }
#mapView.home-map-ready .summary-chip b { margin-top:4px !important; color:#d4cec3; font-size:10px !important; font-weight:580 !important; white-space:nowrap; }
#mapView.home-map-ready #mapAirSummary { color:#d8b77a !important; }

#mapView.home-map-ready .rx-map-launchers.hm-mode-tabs {
  top: 18px !important;
  right: 22px !important;
  display: grid !important;
  grid-template-columns: repeat(3,minmax(138px,1fr)) !important;
  width: min(520px,43vw) !important;
  gap: 4px !important;
  padding: 5px !important;
  border: 1px solid var(--hm-line) !important;
  background: rgba(8,9,9,.76) !important;
  backdrop-filter: blur(18px) saturate(.9);
}

#mapView.home-map-ready .rx-map-launchers.hm-mode-tabs button {
  height: 50px !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 15px !important;
  border: 1px solid transparent !important;
  border-radius: 11px !important;
  background: transparent !important;
  color: #87837c !important;
}

#mapView.home-map-ready .rx-map-launchers.hm-mode-tabs button > i { display: none !important; }
#mapView.home-map-ready .rx-map-launchers.hm-mode-tabs button span { display: grid; gap: 4px; text-align: center; }
#mapView.home-map-ready .rx-map-launchers.hm-mode-tabs button b { color: inherit !important; font-size: 12px !important; font-weight: 650 !important; letter-spacing: .12em; }
#mapView.home-map-ready .rx-map-launchers.hm-mode-tabs button small { color: inherit !important; font-size: 8px !important; letter-spacing: 0; }
#mapView.home-map-ready .rx-map-launchers.hm-mode-tabs button.active {
  border-color: rgba(216,189,134,.34) !important;
  background: linear-gradient(145deg,rgba(216,189,134,.15),rgba(216,189,134,.055)) !important;
  color: #ead8b4 !important;
  box-shadow: inset 0 0 24px rgba(216,189,134,.04) !important;
}

#mapView.home-map-ready .map-room {
  transform: translateZ(0) scale(1);
  transform-origin: center;
  transition: transform .3s cubic-bezier(.2,.8,.2,1),opacity .25s ease,filter .25s ease,border-color .2s ease !important;
}

#mapView.home-map-ready.hm-mode-live .floor-plan.has-selection .map-room:not(.selected) { opacity: .58 !important; filter: saturate(.72) brightness(.86) !important; }
#mapView.home-map-ready.hm-mode-live .map-room.selected {
  transform: translateY(-5px) scale(1.018);
  border-color: rgba(230,207,164,.52) !important;
  background: linear-gradient(145deg,rgba(229,200,143,.085),rgba(229,200,143,.02)) !important;
  box-shadow: inset 0 0 54px rgba(225,190,121,.08),0 24px 60px rgba(0,0,0,.28) !important;
}

#mapView.home-map-ready.hm-mode-live .map-room.rd-light-on::before {
  opacity: .95 !important;
  background: radial-gradient(ellipse at 50% 56%,rgba(235,196,126,.16),rgba(222,177,99,.045) 46%,transparent 72%) !important;
  mix-blend-mode: screen;
}

/* Organic state fields keep the rendered home visible while making ON/OFF unmistakable. */
#mapView.home-map-ready .hm-light-field {
  position:absolute;
  z-index:1;
  inset:-5%;
  overflow:hidden;
  border-radius:28% 34% 31% 26% / 24% 28% 34% 30%;
  pointer-events:none;
}

#mapView.home-map-ready .hm-light-field::before,
#mapView.home-map-ready .hm-light-field::after {
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  transition:opacity .55s cubic-bezier(.22,.8,.22,1),transform .55s cubic-bezier(.22,.8,.22,1),filter .55s ease;
}

#mapView.home-map-ready .hm-light-field::before {
  background:radial-gradient(ellipse at 50% 52%,rgba(0,0,0,.88) 0%,rgba(0,0,0,.80) 47%,rgba(0,0,0,.58) 69%,transparent 91%);
  opacity:.94;
  filter:blur(2px);
  transform:scale(1.03);
}

#mapView.home-map-ready .hm-light-field::after {
  background:radial-gradient(ellipse at 50% 54%,rgba(255,220,150,.30) 0%,rgba(228,182,98,.16) 46%,rgba(207,151,66,.045) 70%,transparent 91%);
  mix-blend-mode:screen;
  opacity:0;
  filter:blur(1px);
  transform:scale(.94);
}

#mapView.home-map-ready .map-room.rd-light-on .hm-light-field::before { opacity:.06; transform:scale(.96); }
#mapView.home-map-ready .map-room.rd-light-on .hm-light-field::after { opacity:.88; transform:scale(1.04); }
#mapView.home-map-ready .map-room:not(.rd-light-on) .room-label { border-color:rgba(255,255,255,.065) !important; background:linear-gradient(145deg,rgba(7,8,8,.94),rgba(7,8,8,.78)) !important; }
#mapView.home-map-ready .map-room:not(.rd-light-on) .room-label em { color:#77736c !important; }
#mapView.home-map-ready .map-room.hm-light-transition .hm-light-field { animation:hm-light-response 1s ease-in-out infinite; }
#mapView.home-map-ready .map-room.hm-light-transition[data-hm-light-target="on"] .hm-light-field::after { opacity:.48; }
#mapView.home-map-ready .map-room.hm-light-transition[data-hm-light-target="off"] .hm-light-field::before { opacity:.52; }

@keyframes hm-light-response { 50% { filter:brightness(1.18); } }

#mapView.home-map-ready .hm-room-alert {
  position: absolute;
  z-index: 5;
  top: 13px;
  right: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(210,163,93,.30);
  border-radius: 9px;
  background: rgba(29,23,16,.78);
  color: #d9bd88;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .04em;
  box-shadow: 0 12px 26px rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
}

#mapView.home-map-ready .hm-room-alert i { width: 5px; height: 5px; border-radius: 50%; background: #d4a35f; box-shadow: 0 0 12px rgba(212,163,95,.75); }
#mapView.home-map-ready.hm-mode-trace .hm-room-alert { display: none; }

#mapView.home-map-ready .hm-live-readout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}

#mapView.home-map-ready .hm-heat-control { grid-template-columns:minmax(88px,.6fr) minmax(180px,1.4fr) !important; }
#mapView.home-map-ready .hm-hvac-stack { display:grid; grid-template-columns:minmax(96px,.72fr) minmax(150px,1.28fr); gap:6px; min-width:0; }
#mapView.home-map-ready .rd-stepper[data-hm-remote-temperature] { position:relative; border:1px solid transparent; border-radius:12px; outline:0; transition:border-color .16s ease,background .16s ease,box-shadow .16s ease; }
#mapView.home-map-ready .rd-stepper[data-hm-remote-temperature]:focus,
#mapView.home-map-ready .rd-stepper[data-hm-remote-temperature].remote-focus { border-color:rgba(226,194,128,.72); background:rgba(216,183,119,.08); box-shadow:0 0 0 4px rgba(216,183,119,.12),0 0 24px rgba(216,183,119,.16); }
#mapView.home-map-ready .rd-stepper[data-hm-remote-temperature]:focus::after { content:"←  −0.5℃     +0.5℃  →"; position:absolute; right:0; bottom:-20px; left:0; color:#cdb783; font-size:7px; letter-spacing:.04em; text-align:center; white-space:nowrap; }
#mapView.home-map-ready .rd-stepper.hm-remote-pulse strong { animation:hm-remote-temperature-pulse .28s ease; }
@keyframes hm-remote-temperature-pulse { 50% { color:#f0d79f; transform:scale(1.13); text-shadow:0 0 16px rgba(224,188,113,.42); } }

#mapView.home-map-ready .hm-remote-guide { grid-column:1 / -1; min-height:42px; display:flex; align-items:center; gap:10px; margin-top:9px; padding:7px 10px; border:1px solid rgba(255,255,255,.075); border-radius:11px; background:rgba(255,255,255,.02); color:#77736c; }
#mapView.home-map-ready .hm-remote-guide > span { display:flex; align-items:center; gap:7px; margin-right:auto; }
#mapView.home-map-ready .hm-remote-guide > span i { padding:4px 6px; border:1px solid rgba(216,189,134,.23); border-radius:6px; color:#b9a374; font-size:6px; font-style:normal; letter-spacing:.12em; }
#mapView.home-map-ready .hm-remote-guide > span b { color:#a8a198; font-size:8px; font-weight:560; white-space:nowrap; }
#mapView.home-map-ready .hm-remote-guide em { display:flex; align-items:center; gap:3px; font-size:7px; font-style:normal; white-space:nowrap; }
#mapView.home-map-ready .hm-remote-guide kbd { min-width:20px; height:20px; display:inline-grid; place-items:center; padding:0 4px; border:1px solid rgba(255,255,255,.12); border-radius:5px; background:rgba(0,0,0,.24); color:#c7bda9; font:600 8px/1 Arial,sans-serif; box-shadow:inset 0 -1px rgba(255,255,255,.05); }
#mapView.home-map-ready .hm-remote-guide[data-active="temperature"] { border-color:rgba(216,189,134,.20); background:rgba(216,189,134,.045); }
#mapView.home-map-ready .hm-space-response { position:absolute; z-index:-1; inset:0; overflow:hidden; border-radius:inherit; pointer-events:none; }
#mapView.home-map-ready .hm-space-response::before,#mapView.home-map-ready .hm-space-response::after { content:""; position:absolute; opacity:0; transition:opacity .45s ease,transform .55s ease; }
#mapView.home-map-ready .map-room.hm-heat-active .hm-space-response::before { right:10%; bottom:5%; left:10%; height:38%; border-radius:50%; background:radial-gradient(ellipse,rgba(206,151,83,.13),rgba(177,113,55,.035) 48%,transparent 72%); filter:blur(5px); opacity:.75; transform:scale(1.03); }
#mapView.home-map-ready .map-room.hm-cool-active:not(.hm-heat-active) .hm-space-response::before { right:12%; bottom:8%; left:12%; height:35%; border-radius:50%; background:radial-gradient(ellipse,rgba(101,143,164,.11),transparent 72%); filter:blur(6px); opacity:.6; }
#mapView.home-map-ready .map-room.hm-vent-active .hm-space-response::after { top:18%; right:12%; width:42%; height:34%; background:repeating-linear-gradient(155deg,transparent 0 8px,rgba(160,193,187,.11) 9px 10px,transparent 11px 18px); filter:blur(.2px); opacity:.5; transform:skewX(-10deg); }
#mapView.home-map-ready.hm-mode-trace .hm-space-response { display:none; }

#mapView.home-map-ready .hm-live-readout > span {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 12px;
  background: rgba(255,255,255,.022);
}

#mapView.home-map-ready .hm-live-readout small { grid-column: 1 / -1; color: #77736c; font-size: 7px; letter-spacing: .12em; }
#mapView.home-map-ready .hm-live-readout b { color: #d9d3c9; font-size: 11px; font-weight: 600; }
#mapView.home-map-ready .hm-live-readout b.warning { color: #dfbc7e; }
#mapView.home-map-ready .hm-live-readout em { color: #858078; font-size: 8px; font-style: normal; text-align: right; }

#mapView.home-map-ready .hm-trace-layer {
  position: absolute;
  z-index: 23;
  inset: 0;
  display: none;
  pointer-events: none;
}

#mapView.home-map-ready.hm-mode-trace .hm-trace-layer { display: block; }
#mapView.home-map-ready.hm-mode-trace .map-room-control-popover,
#mapView.home-map-ready.hm-mode-trace .rd-map-connector,
#mapView.home-map-ready.hm-mode-trace .rd-twin-live-status { display: none !important; }
#mapView.home-map-ready.hm-mode-trace .map-room { pointer-events: auto; }
#mapView.home-map-ready.hm-mode-trace .room-label { opacity: .82; }
#mapView.home-map-ready.hm-mode-trace .map-room:not(.hm-trace-focus):not(.hm-trace-cold):not(.hm-trace-air):not(.hm-trace-light):not(.hm-trace-delay):not(.hm-trace-recovered) { opacity: .48 !important; filter: saturate(.58) brightness(.72) !important; }

#mapView.home-map-ready.hm-mode-trace .map-room.hm-trace-focus {
  transform: translateY(-4px) scale(1.018);
  opacity: 1 !important;
  filter: none !important;
  border-color: rgba(220,198,157,.48) !important;
  box-shadow: inset 0 0 48px rgba(214,183,119,.07),0 18px 50px rgba(0,0,0,.25) !important;
}

#mapView.home-map-ready.hm-mode-trace .map-room.hm-trace-cold { opacity: 1 !important; border-color: rgba(119,157,188,.56) !important; background: radial-gradient(ellipse,rgba(88,139,176,.13),transparent 70%) !important; }
#mapView.home-map-ready.hm-mode-trace .map-room.hm-trace-air { opacity: 1 !important; border-color: rgba(209,158,86,.52) !important; background: radial-gradient(ellipse,rgba(196,143,70,.12),transparent 70%) !important; }
#mapView.home-map-ready.hm-mode-trace .map-room.hm-trace-light { opacity: 1 !important; border-color: rgba(223,190,127,.55) !important; background: radial-gradient(ellipse,rgba(235,194,117,.18),transparent 70%) !important; }
#mapView.home-map-ready.hm-mode-trace .map-room.hm-trace-delay { opacity: 1 !important; border-color: rgba(193,127,94,.58) !important; background: radial-gradient(ellipse,rgba(174,102,70,.13),transparent 70%) !important; }
#mapView.home-map-ready.hm-mode-trace .map-room.hm-trace-recovered { opacity: 1 !important; border-color: rgba(126,174,145,.52) !important; background: radial-gradient(ellipse,rgba(100,160,126,.11),transparent 70%) !important; }

.hm-trace-insight {
  position: absolute;
  top: 92px;
  right: 24px;
  width: min(340px,28vw);
  padding: 16px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: linear-gradient(145deg,rgba(10,11,11,.92),rgba(10,11,11,.70));
  box-shadow: 0 24px 60px rgba(0,0,0,.38);
  backdrop-filter: blur(18px) saturate(.9);
  pointer-events: auto;
}

.hm-trace-insight::before { content:""; position:absolute; top:-1px; right:22px; left:22px; height:1px; background:linear-gradient(90deg,transparent,rgba(214,183,119,.7),transparent); }
.hm-trace-insight[data-tone="cold"]::before { background:linear-gradient(90deg,transparent,rgba(107,159,200,.85),transparent); }
.hm-trace-insight[data-tone="air"]::before,.hm-trace-insight[data-tone="delay"]::before { background:linear-gradient(90deg,transparent,rgba(212,149,77,.85),transparent); }
.hm-trace-insight[data-tone="ok"]::before { background:linear-gradient(90deg,transparent,rgba(112,173,137,.85),transparent); }
.hm-trace-insight-head { display:flex; align-items:center; justify-content:space-between; }
.hm-trace-insight-head span { display:grid; grid-template-columns:auto auto; align-items:baseline; gap:7px; }
.hm-trace-insight-head small { color:#77736c; font-size:7px; letter-spacing:.14em; }
.hm-trace-insight-head b { color:#e5d7bb; font-size:15px; font-weight:520; }
.hm-trace-insight-head em { padding:6px 8px; border:1px solid rgba(255,255,255,.09); border-radius:8px; color:#aaa49a; font-size:8px; font-style:normal; }
.hm-trace-insight h2 { margin:12px 0 13px; color:#ece6db; font-size:16px; font-weight:560; line-height:1.35; }
.hm-trace-insight dl { display:grid; gap:7px; margin:0; }
.hm-trace-insight dl div { display:grid; grid-template-columns:58px 1fr; gap:10px; padding-top:7px; border-top:1px solid rgba(255,255,255,.065); }
.hm-trace-insight dt { color:#77736c; font-size:8px; }
.hm-trace-insight dd { margin:0; color:#a9a39a; font-size:9px; line-height:1.45; }

.hm-trace-summary {
  position: absolute;
  top: 94px;
  left: 24px;
  width: min(300px,25vw);
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.085);
  border-radius: 15px;
  background: rgba(9,10,10,.74);
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
  backdrop-filter: blur(16px);
  pointer-events: auto;
}
.hm-trace-summary header { display:flex; align-items:center; justify-content:space-between; margin-bottom:2px; }
.hm-trace-summary header span { display:grid; gap:3px; }
.hm-trace-summary header small { color:#77736c; font-size:7px; letter-spacing:.14em; }
.hm-trace-summary header b { color:#ddd6ca; font-size:11px; font-weight:590; }
.hm-trace-summary header em { color:#716d66; font-size:7px; font-style:normal; }
.hm-trace-summary button { min-height:44px; display:grid; grid-template-columns:6px 1fr; align-items:center; gap:9px; padding:8px 9px; border:1px solid transparent; border-radius:10px; background:rgba(255,255,255,.025); color:#9e9990; font-size:8px; line-height:1.45; text-align:left; cursor:pointer; }
.hm-trace-summary button:hover,.hm-trace-summary button.active { border-color:rgba(216,189,134,.22); background:rgba(216,189,134,.055); color:#cec3af; }
.hm-trace-summary button i { width:5px; height:5px; border-radius:50%; background:#b9955c; box-shadow:0 0 10px rgba(185,149,92,.35); }
.hm-trace-summary button b { color:#dfc892; font-weight:600; }

.hm-trace-timeline {
  position: absolute;
  right: 22px;
  bottom: 18px;
  left: 22px;
  display: grid;
  grid-template-columns: 210px minmax(0,1fr);
  align-items: center;
  gap: 20px;
  min-height: 105px;
  padding: 13px 18px;
  border: 1px solid rgba(255,255,255,.105);
  border-radius: 17px;
  background: rgba(7,8,8,.88);
  box-shadow: 0 24px 65px rgba(0,0,0,.44);
  backdrop-filter: blur(20px) saturate(.85);
  pointer-events: auto;
}
.hm-trace-controls { display:grid; grid-template-columns:72px 1fr; align-items:center; gap:8px 12px; }
#hmTracePlay { grid-row:1 / 3; min-height:60px; display:grid; place-items:center; gap:3px; border:1px solid rgba(216,189,134,.26); border-radius:12px; background:rgba(216,189,134,.07); color:#ddc58f; cursor:pointer; }
#hmTracePlay span { font-size:15px; }
#hmTracePlay b { font-size:8px; font-weight:550; }
#hmTracePlay.playing { border-color:rgba(130,187,153,.32); color:#a8ccb4; }
.hm-trace-current { display:grid; grid-template-columns:auto 1fr; align-items:baseline; gap:3px 8px; }
.hm-trace-current small { color:#77736c; font-size:7px; }
.hm-trace-current b { color:#ede4d4; font-size:23px; font-weight:400; letter-spacing:-.03em; }
.hm-trace-current em { grid-column:1 / -1; color:#9b958b; font-size:8px; font-style:normal; }
#hmTraceNow { min-height:28px; border:1px solid rgba(255,255,255,.09); border-radius:8px; background:rgba(255,255,255,.025); color:#979188; font-size:8px; cursor:pointer; }
.hm-trace-track-wrap { position:relative; min-width:0; padding:21px 0 3px; }
.hm-trace-markers { position:absolute; z-index:4; top:9px; right:8px; left:8px; height:36px; pointer-events:none; }
.hm-trace-markers button { position:absolute; left:var(--trace-left); top:0; width:18px; height:34px; padding:0; border:0; background:transparent; transform:translateX(-50%); cursor:pointer; pointer-events:auto; }
.hm-trace-markers button > i { position:absolute; left:8px; bottom:0; width:2px; height:13px; background:#c6a468; box-shadow:0 0 8px rgba(198,164,104,.55); }
.hm-trace-markers button[data-tone="cold"] > i { background:#739fbe; }
.hm-trace-markers button[data-tone="ok"] > i { background:#76a88a; }
.hm-trace-markers button > span { position:absolute; bottom:23px; left:50%; display:none; min-width:180px; padding:7px 8px; border:1px solid rgba(255,255,255,.1); border-radius:8px; background:rgba(8,9,9,.95); color:#d8c294; font-size:7px; text-align:left; transform:translateX(-50%); }
.hm-trace-markers button > span b { display:block; margin-top:3px; color:#aaa39a; font-size:7px; font-weight:500; }
.hm-trace-markers button:hover > span,.hm-trace-markers button:focus-visible > span,.hm-trace-markers button.active > span { display:block; }
#hmTraceRange { position:relative; z-index:3; width:100%; height:34px; margin:0; appearance:none; background:transparent; cursor:ew-resize; }
#hmTraceRange::-webkit-slider-runnable-track { height:3px; border-radius:3px; background:linear-gradient(90deg,rgba(214,183,119,.52),rgba(255,255,255,.13)); }
#hmTraceRange::-webkit-slider-thumb { width:18px; height:18px; margin-top:-7px; appearance:none; border:2px solid #d9bf8a; border-radius:50%; background:#111212; box-shadow:0 0 0 5px rgba(217,191,138,.10),0 0 18px rgba(217,191,138,.30); }
#hmTraceRange::-moz-range-track { height:3px; border-radius:3px; background:rgba(255,255,255,.13); }
#hmTraceRange::-moz-range-thumb { width:16px; height:16px; border:2px solid #d9bf8a; border-radius:50%; background:#111212; }
.hm-trace-hours { display:flex; justify-content:space-between; padding:0 3px; color:#69655f; font-size:7px; }

@media (max-width:1200px),(max-height:700px) {
  #mapView.home-map-ready .rx-map-launchers.hm-mode-tabs { width:min(440px,45vw) !important; grid-template-columns:repeat(3,minmax(112px,1fr)) !important; }
  .hm-trace-summary { width:250px; }
  .hm-trace-insight { width:285px; }
  .hm-trace-timeline { grid-template-columns:180px minmax(0,1fr); min-height:94px; }
}

@media (prefers-reduced-motion:reduce) {
  #mapView.home-map-ready .map-room { transition-duration:.01ms !important; }
}
