/* /casa/: the house at night, for whoever walks past the kitchen tablet. The 3D house fills the
   screen; the rest are a few matte pieces on the board (a clock, the cameras, the areas, and, for
   the area in view, a name pinned to each light). One accent only: each light's own colour. */

:root {
  --night: #0f151e;
  --dusk: #1a2331;
  --piece: #283446;
  --piece-2: #212c3b;
  --edge: #0c1219;
  --chalk: #f2eee6;
  --chalk-2: rgb(242 238 230 / 0.74);
  --muted: #8d9aac;
  --warm: #ffbe76;
  --live: #ff5560;
  --display:
    "Barlow Condensed", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --text: "Barlow", "Avenir Next", system-ui, sans-serif;
  /* for shared.css (the camera card, the chooser, the label at the finger, the toast) */
  --carbon: #1b2430;
  --carbon-edge: #0a0f15;
  --red: #c7323b;
  --lift: 0 18px 34px -14px rgb(0 0 0 / 0.75);
  --piece-shadow:
    0 3px 0 var(--edge), var(--lift), inset 0 1px 0 rgb(255 255 255 / 0.06);
}
* {
  box-sizing: border-box;
}
html {
  background: var(--dusk);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  height: var(--app-h, 100dvh);
  overflow: hidden;
  color: var(--chalk);
  font: 400 15px/1.4 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--warm);
  outline-offset: 3px;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #33465c, #1a2331 62%, #121923);
}
.house {
  position: absolute;
  inset: 0;
}
.house .loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font: 500 17px var(--text);
  color: var(--muted);
}

/* --- now: the clock, the day, the state of the house ------------------------------------------- */
.now {
  position: absolute;
  top: calc(22px + env(safe-area-inset-top));
  left: calc(30px + env(safe-area-inset-left));
  max-width: 420px; /* a long date line wraps rather than run under the windows */
  pointer-events: none;
  transition: opacity 0.8s ease;
}
.clock {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: 300 88px/0.84 var(--display);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--chalk);
  pointer-events: auto;
  text-shadow: 0 2px 18px rgb(0 0 0 / 0.35);
}
/* holding the clock opens the editor: a line fills under it */
.clock::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -8px;
  height: 3px;
  border-radius: 2px;
  background: var(--warm);
  transform: scaleX(0);
  transform-origin: left;
}
.clock.holding::after {
  transform: scaleX(1);
  transition: transform 1.2s linear;
}
.day {
  margin: 14px 0 0;
  font: 500 16px/1.2 var(--text);
  color: var(--chalk-2);
  letter-spacing: 0.01em;
}
.day .sep::before {
  content: "·";
  margin: 0 8px;
  color: var(--muted);
}
.day .sep:last-child,
.day .sep:has(+ :empty) {
  display: none;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  font: 600 23px/1 var(--display);
  letter-spacing: 0.015em;
}
.status i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
  transition:
    background 0.4s,
    box-shadow 0.4s;
}
.status.lit i {
  background: var(--warm);
  box-shadow: 0 0 12px 2px rgb(255 190 118 / 0.55);
}
.status.lost {
  color: #ffc2bd;
}
.status.lost i {
  background: var(--live);
}
.status small {
  font: 500 14px/1 var(--text);
  color: var(--muted);
  letter-spacing: 0;
}



/* the card: in the middle, the house dimmed behind it (as a camera's) */
.tv-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  width: min(760px, 78vw);
  max-height: calc(100% - 40px);
  overflow: auto;
  translate: -50% -50%;
  padding: 20px 22px 22px;
  border-radius: 24px;
  background: var(--carbon);
  color: #fff;
  box-shadow: 0 5px 0 var(--carbon-edge), var(--lift);
  animation: rise 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.tv-card[hidden] {
  display: none;
}
.tv-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tv-head {
  flex: 1;
  min-width: 0;
}
.tv-head h2 {
  margin: 0;
  font: 600 30px/1 var(--display);
  letter-spacing: 0.01em;
}
.tv-status {
  margin: 7px 0 0;
  font: 500 16px/1.25 var(--text);
  color: var(--muted);
}
.tv-card.busy .tv-status {
  color: var(--warm);
}
.tv-status.bad {
  color: #ffb3ad;
}
/* the screen's power: warm and inviting when it is off, quiet when it is on */
.tv-power {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(#ffd29a, var(--warm));
  color: #2a1b0b;
  font: 600 20px/1 var(--display);
  letter-spacing: 0.02em;
  box-shadow: 0 3px 0 #b97a35;
}
.tv-card[data-on="true"] .tv-power {
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  box-shadow: none;
}
.tv-power svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.tv-power:disabled {
  opacity: 0.55;
}
.tv-power:active,
.tv-show:active,
.tv-vol button:active {
  scale: 0.97;
}
.tv-watch h3 {
  margin: 22px 0 10px;
  font: 600 15px/1 var(--display);
  letter-spacing: 0.06em;
  color: var(--muted);
}
.tv-watch[hidden] {
  display: none;
}
.tv-shows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.tv-show {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(150deg, #3a1316, #12090a);
  text-align: left;
  box-shadow: 0 3px 0 var(--carbon-edge);
}
.tv-show img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tv-show::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(transparent, rgb(6 8 12 / 0.88));
}
.tv-show .t,
.tv-show .s {
  position: absolute;
  left: 13px;
  right: 13px;
  z-index: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tv-show .t {
  bottom: 30px;
  font: 600 21px/1.1 var(--display);
  letter-spacing: 0.01em;
}
.tv-show .s {
  bottom: 11px;
  font: 500 14px/1.2 var(--text);
  color: rgb(255 255 255 / 0.72);
}
.tv-show:has(.s:empty) .t {
  bottom: 13px;
}
.tv-show.going {
  box-shadow:
    0 0 0 3px var(--warm),
    0 3px 0 var(--carbon-edge);
  animation: going 1.4s ease-in-out infinite;
}
@keyframes going {
  50% {
    box-shadow:
      0 0 0 3px rgb(255 190 118 / 0.35),
      0 3px 0 var(--carbon-edge);
  }
}
/* the volume */
.tv-vol {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgb(255 255 255 / 0.08);
}
.tv-vol-label {
  flex: 1;
  font: 600 15px/1 var(--display);
  letter-spacing: 0.06em;
  color: var(--muted);
}
.tv-vol button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  font: 500 28px/1 var(--display);
}
.tv-vol button:disabled {
  opacity: 0.35;
}
.tv-level {
  min-width: 48px;
  text-align: center;
  font: 300 34px/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.tv-mute svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tv-mute svg path:first-child {
  fill: currentColor;
}
.tv-mute .x,
.tv-mute.muted .w {
  display: none;
}
.tv-mute.muted .x {
  display: inline;
}
.tv-mute.muted {
  background: rgb(255 85 96 / 0.22);
}

/* --- now-lines: what is on right now, under the status line; a tap opens its card (the TV here,
   Eva and the music from features/) ------------------------------------------------------ */
.now-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin: 2px 0 0 -8px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--chalk-2);
  font: 500 19px/1 var(--display);
  letter-spacing: 0.015em;
  pointer-events: auto;
  transition: background 0.2s ease;
}
.now-line[hidden] {
  display: none;
}
.now-line:active {
  background: rgb(255 255 255 / 0.08);
}
.now-line svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}
.now-line.busy {
  color: var(--chalk);
}
.now-line.busy svg {
  color: var(--warm);
  opacity: 1;
}
.now-line.bad svg {
  color: var(--live);
  opacity: 1;
}
body.daylight .now-line {
  color: rgb(24 34 46 / 0.78);
}
body.daylight .now-line:active {
  background: rgb(24 34 46 / 0.08);
}
body.daylight .now-line.busy {
  color: #18222e;
}
#tv-line {
  margin-top: 8px;
}

/* --- the dock: the areas of the house, and the chosen area's switch --------------------------- */
.dock {
  position: absolute;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 12px;
  transition: opacity 0.8s ease;
}
.areas {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 22px;
  background: linear-gradient(var(--piece), var(--piece-2));
  box-shadow: var(--piece-shadow);
}
.area {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--chalk-2);
  font: 600 20px/1 var(--display);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition:
    background 0.25s ease,
    color 0.25s ease;
}
.area b {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: rgb(255 190 118 / 0.16);
  color: var(--warm);
  font: 700 14px/24px var(--display);
  text-align: center;
  transition:
    background 0.25s ease,
    color 0.25s ease;
}
.area b:empty {
  display: none;
}
.area.dark b {
  background: rgb(255 255 255 / 0.07);
  color: var(--muted);
}
.area[aria-selected="true"] {
  background: var(--chalk);
  color: #18202b;
  box-shadow: 0 2px 0 #aaa395;
}
.area[aria-selected="true"] b {
  background: #18202b;
  color: var(--warm);
}
.area-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(var(--piece), var(--piece-2));
  box-shadow: var(--piece-shadow);
  color: var(--chalk);
  font: 600 19px/1 var(--display);
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: rise-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.area-switch[hidden] {
  display: none;
}
.area-switch::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0.8;
}
.area-switch.prender {
  background: linear-gradient(#ffd6a3, #ffb968);
  color: #2b1a07;
  box-shadow:
    0 3px 0 #b5763a,
    var(--lift);
}
.area-switch.prender::before {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 10px 2px rgb(255 255 255 / 0.8);
}
.area:active,
.area-switch:active {
  transform: translateY(2px);
}
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

/* --- day or night: one matte key in the free corner, level with the dock; it shows the look the
   board has now (it follows the sun; a tap overrides it until the sun next rises or sets) ------- */
.sky {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(var(--piece), var(--piece-2));
  box-shadow: var(--piece-shadow);
  color: var(--chalk);
  transition:
    opacity 0.8s ease,
    color 0.4s ease;
}
.sky svg {
  grid-area: 1 / 1;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    opacity 0.35s ease,
    rotate 0.5s cubic-bezier(0.3, 0.7, 0.3, 1),
    scale 0.35s ease;
}
.sky .sun circle,
.sky .moon path {
  fill: currentColor;
}
.sky[data-look="day"] {
  color: var(--warm);
}
.sky[data-look="day"] .moon,
.sky[data-look="night"] .sun {
  opacity: 0;
  rotate: -60deg;
  scale: 0.6;
}
.sky:active {
  scale: 0.95;
}

/* --- the floors: 1 | 2, beside the sky key; the chosen one lit like the chosen area ------------- */
.floors {
  position: absolute;
  left: calc(24px + 64px + 12px + env(safe-area-inset-left));
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex;
  gap: 4px;
  height: 64px;
  padding: 6px;
  border-radius: 22px;
  background: linear-gradient(var(--piece), var(--piece-2));
  box-shadow: var(--piece-shadow);
  transition: opacity 0.8s ease;
}
.floors button {
  width: 46px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--chalk-2);
  font: 600 22px/1 var(--display);
  font-variant-numeric: tabular-nums;
  transition:
    background 0.25s ease,
    color 0.25s ease;
}
.floors [aria-checked="true"] {
  background: var(--chalk);
  color: #18202b;
  box-shadow: 0 2px 0 #aaa395;
}
.floors button:active {
  scale: 0.95;
}

/* --- pins: in an area, each light's name on the house itself; a tap switches it --------------- */
.pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.leads {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.leads path {
  stroke: var(--lead, rgb(242 238 230 / 0.7));
  stroke-width: 1.5;
  fill: none;
}
.leads circle {
  fill: var(--lead-dot, var(--chalk));
  stroke: var(--edge);
  stroke-width: 1;
}
.pin {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(#303d51, #263243);
  box-shadow:
    0 2px 0 var(--edge),
    0 12px 22px -10px rgb(0 0 0 / 0.75);
  color: var(--chalk);
  font: 600 16px/1 var(--display);
  letter-spacing: 0.025em;
  white-space: nowrap;
  pointer-events: auto;
  /* placed with translate (dashboard.js), so the press and the entrance scale it about its own middle */
  will-change: translate;
  transition:
    background 0.3s ease,
    color 0.3s ease,
    opacity 0.2s ease;
}
/* while the house flies to an area its pins wait, hidden; once it lands they fade in where they stay */
.pins .pin {
  transition:
    background 0.3s ease,
    color 0.3s ease,
    opacity 0.24s ease calc(var(--i, 0) * 30ms),
    scale 0.24s ease calc(var(--i, 0) * 30ms);
}
/* after a turn by hand left two names over each other: laid out again once, gliding there */
.pins.gliding .pin {
  transition:
    background 0.3s ease,
    color 0.3s ease,
    translate 0.32s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.pins.flying .pin {
  opacity: 0;
  scale: 0.94;
  pointer-events: none;
  transition: none;
}
.leads {
  transition: opacity 0.3s ease 0.1s;
}
.pins.flying .leads {
  opacity: 0;
  transition: none;
}
.pin::after {
  /* the tail, on the side that touches the light (dashboard.js picks the side) */
  content: "";
  position: absolute;
  border: 7px solid transparent;
  transition: border-color 0.3s ease;
}
.pin.above::after {
  left: 50%;
  top: 100%;
  margin-left: -7px;
  border-bottom: 0;
  border-top-color: var(--tail, #263243);
}
.pin.below::after {
  left: 50%;
  bottom: 100%;
  margin-left: -7px;
  border-top: 0;
  border-bottom-color: var(--tail-top, #303d51);
}
.pin.right::after {
  right: 100%;
  top: 50%;
  margin-top: -7px;
  border-left: 0;
  border-right-color: var(--tail-mid, #2b374a);
}
.pin.left::after {
  left: 100%;
  top: 50%;
  margin-top: -7px;
  border-right: 0;
  border-left-color: var(--tail-mid, #2b374a);
}
.pin i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #566275;
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease;
}
.pin.on {
  background: linear-gradient(color-mix(in srgb, var(--c) 70%, #fff), var(--c));
  color: #2a1b0b;
}
.pin.on {
  --tail: var(--c);
  --tail-top: color-mix(in srgb, var(--c) 70%, #fff);
  --tail-mid: color-mix(in srgb, var(--c) 85%, #fff);
}
.pin.on i {
  background: #fff;
  box-shadow: 0 0 10px 2px rgb(255 255 255 / 0.85);
}
.pin.unknown {
  opacity: 0.55;
}
.pin.unknown i {
  background: transparent;
  border: 2px dashed var(--muted);
}
.pin:active {
  scale: 0.96;
}

/* --- a camera, live (shared.css): in the middle, the house dimmed behind it -------------------- */
.dash .live-card {
  /* in the middle (the clock, the status lines and the dock step away while it is open), as big
     as the screen's height lets a 16:9 picture and its bar be */
  left: 50%;
  top: 50%;
  bottom: auto;
  width: min(880px, 76vw, calc((var(--app-h, 100dvh) - 110px) * 16 / 9 + 20px));
  translate: -50% -50%;
  z-index: 20;
}
.dash .live-card.full {
  translate: none;
  width: auto;
}
.house,
.pins {
  transition: filter 0.35s ease;
}
body.watching .house,
body.watching .pins {
  filter: brightness(0.45) saturate(0.8);
}
/* a card open: a layer under it over everything else; a tap there closes the card, and nothing
   behind it (the house, its lights) is touched through it (Mario, 2026-10-05) */
.scrim {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 19;
}
/* not under the Wi-Fi's card: that one is a view, the house stays to be turned and tapped */
body:is(.watching, .feat-open) .scrim {
  display: block;
}
/* a card open (a camera, the TV, a feature's): only the house behind it, not the clock, the status
   lines, the floors or the rooms (Mario, 2026-10-05); they step away quickly and come back slowly */
body:is(.watching, .feat-open, .feat-side) :is(.now, .dock, .sky, .floors, .edit, .list) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.dash .toast {
  bottom: calc(108px + env(safe-area-inset-bottom));
  background: #0c1219;
}

/* --- the way to the editor: only on devices that have been there ------------------------------ */
.edit {
  position: absolute;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(30px + env(safe-area-inset-bottom));
  padding: 8px 10px;
  font: 600 14px/1 var(--display);
  letter-spacing: 0.05em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.8s ease;
}
.edit[hidden] {
  display: none;
}

/* --- at rest (nobody has touched it for a while, at night): only the clock, dim; the first tap
       only wakes it ------------------------------------------------------------------------------ */
body.rest :is(.dock, .sky, .floors, .pins, .status, .day, .edit, .list, .now-line) {
  opacity: 0;
  pointer-events: none;
}
body.rest .now {
  opacity: 0.5;
}
body.rest .house {
  filter: brightness(0.7);
  transition: filter 1.2s ease;
}

/* --- the list: on phones only (and if the 3D house cannot be drawn) ----------------------------- */
.list {
  display: none;
}
.row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--chalk);
  text-align: left;
}
.row svg {
  width: 32px;
  height: 32px;
}
.row:not(.on) svg {
  filter: grayscale(1) brightness(1.3);
  opacity: 0.5;
}
.row .name {
  display: block;
  font: 600 18px/1.15 var(--display);
  letter-spacing: 0.015em;
}
.row .meta {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.row .sw {
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 15px;
  background: #3a4658;
  transition: background 0.25s ease;
}
.row .sw i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c9c3b8;
  transition:
    transform 0.25s cubic-bezier(0.3, 1.4, 0.5, 1),
    background 0.25s ease;
}
.row.on {
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.row.on .sw {
  background: color-mix(in srgb, var(--c) 55%, #1b2430);
}
.row.on .sw i {
  transform: translateX(20px);
  background: var(--c);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--c) 70%, transparent);
}
.list h3 {
  margin: 18px 4px 6px;
  font: 600 14px/1 var(--display);
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* narrower tablets (an iPad upright): the dock starts after the sky key, not under it; the floors
   stand over the sky key */
@media (min-width: 721px) and (max-width: 1060px) {
  .dock {
    left: calc(24px + 64px + 12px + env(safe-area-inset-left));
    transform: none;
  }
  .floors {
    left: calc(24px + env(safe-area-inset-left));
    bottom: calc(24px + 64px + 12px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 720px) {
  .stage {
    display: flex;
    flex-direction: column;
  }
  .house {
    position: relative;
    flex: 0 0 52%;
  }
  .pins {
    display: none;
  }
  .now {
    top: calc(12px + env(safe-area-inset-top));
    left: 18px;
  }
  .clock {
    font-size: 54px;
  }
  .day {
    margin-top: 8px;
    font-size: 14px;
  }
  .now-line {
    min-height: 34px;
    font-size: 16px;
  }
  .sky {
    /* over the house, top right */
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
    left: auto;
    bottom: auto;
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }
  .sky svg {
    width: 22px;
    height: 22px;
  }
  .floors {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + 48px + 8px + env(safe-area-inset-right));
    left: auto;
    bottom: auto;
    height: 48px;
    padding: 4px;
    border-radius: 16px;
  }
  .floors button {
    width: 36px;
    border-radius: 12px;
    font-size: 19px;
  }
  .status {
    margin-top: 10px;
    font-size: 19px;
  }
  .dock {
    position: static;
    order: 2;
    transform: none;
    margin: 14px 12px 12px;
    flex-wrap: wrap;
  }
  .areas {
    flex: 1;
    overflow-x: auto;
  }
  .areas {
    gap: 2px;
    padding: 5px;
  }
  .area {
    flex: 1;
    justify-content: center;
    gap: 6px;
    padding: 0 6px;
    min-height: 46px;
    font-size: 17px;
  }
  .area b {
    min-width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 20px;
  }
  .area-switch {
    flex: 1 0 100%;
    justify-content: center;
    min-height: 48px;
  }
  .list {
    display: block;
    order: 4;
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 12px;
    -webkit-user-select: none;
  }
  .edit {
    top: calc(68px + env(safe-area-inset-top));
    right: calc(16px + env(safe-area-inset-right));
    bottom: auto;
  }
  .dash .live-card,
  .tv-card {
    width: calc(100vw - 20px);
  }
  .tv-shows {
    grid-template-columns: 1fr 1fr;
  }
  .tv-show .t {
    font-size: 17px;
  }
}

/* no 3D (WebGL unavailable): the list is the dashboard */
body.no3d .house,
body.no3d .pins {
  display: none;
}
body.no3d .list {
  display: block;
  position: absolute;
  inset: 200px 0 110px;
  overflow-y: auto;
  padding: 0 24px;
  max-width: 560px;
}

@media (prefers-reduced-motion: reduce) {
  .area-switch {
    animation: none;
  }
  .pins .pin {
    transition-delay: 0s;
  }
}

/* --- day: the board in daylight (the sun is up, or the switch says so). The pale sage table needs
   ink for the words written straight on it; the matte pieces stay as they are. ------------------ */
html:has(body.daylight) {
  background: #a2bab5;
}
body.no3d .sky,
body.no3d .floors {
  display: none;
}
@media (min-width: 721px) {
  body.daylight:not(.no3d) .stage {
    background: linear-gradient(180deg, #c3d3cf, #a2bab5);
  }
}
body.daylight :is(.clock, .status) {
  color: #18222e;
  text-shadow: 0 1px 14px rgb(255 255 255 / 0.3);
}
body.daylight .day {
  color: rgb(24 34 46 / 0.78);
}
body.daylight .day .sep::before,
body.daylight .status small {
  color: rgb(24 34 46 / 0.55);
}
body.daylight .leads {
  --lead: rgb(24 34 46 / 0.6);
  --lead-dot: #fff;
}
body.daylight .status i {
  background: rgb(24 34 46 / 0.4);
}
body.daylight .status.lit i {
  background: #f0a04b;
  box-shadow: 0 0 10px 2px rgb(240 160 75 / 0.5);
}
body.daylight .status.lost {
  color: #9a1f27;
}
