/* MDA 117A showroom: page shell over a full-screen 3D stage. Light theme only (the scene is a sky render). */
:root {
  --mda-red: #d9443a;      /* model name, active dots, Contact button */
  --mda-ink: #2b2b2b;
  --mda-muted: #6b6b6b;
  --mda-line: #dddddd;
  --mda-paper: #ffffff;
  --mda-panel: rgba(255, 255, 255, 0.94);
  --mda-sky: #bfd4e4;      /* same as the scene background */
  --mda-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  --mda-radius: 8px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter-l: max(12px, env(safe-area-inset-left, 0px));
  --gutter-r: max(12px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--mda-sky); color: var(--mda-ink); font-family: var(--font-sans);
  overflow: hidden; touch-action: none; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--mda-ink); outline-offset: 2px; }

/* 3D stage and the layer for labels pinned to it (filled by the overlay) */
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; outline: none; }
#overlay-root { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* Top bar: brand left, language and Contact right */
#topbar {
  position: fixed; z-index: 6; top: calc(var(--safe-t) + 12px); left: var(--gutter-l); right: var(--gutter-r);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none;
}
#topbar > * { pointer-events: auto; }
#brand {
  background: var(--mda-panel); box-shadow: var(--mda-shadow); border-radius: var(--mda-radius);
  padding: 6px 12px; font-size: 17px; line-height: 1.25; letter-spacing: 0.03em; white-space: nowrap;
}
#brand b { color: var(--mda-red); font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#contactBtn {
  background: var(--mda-red); color: #fff; border: 0; border-radius: var(--mda-radius); box-shadow: var(--mda-shadow);
  padding: 8px 14px; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
/* the top bar's controls and the dock stay out of sight until they have content */
#langSwitch:empty, #contactBtn:empty, #dock:empty { display: none; }

/* Dock (bottom centre) and cards layer */
#dockWrap {
  position: fixed; z-index: 5; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 14px);
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
#dockWrap > * { pointer-events: auto; }
#dock {
  width: fit-content; max-width: 100%; box-sizing: border-box; display: flex; flex-wrap: wrap; justify-content: center;
  align-items: center; gap: 6px 8px; padding: 6px; background: var(--mda-paper); border-radius: var(--mda-radius); box-shadow: var(--mda-shadow);
}
/* Top bar language switch */
#langSwitch { display: flex; background: var(--mda-panel); box-shadow: var(--mda-shadow); border-radius: var(--mda-radius); padding: 2px; }
#langSwitch button { background: none; border: 0; border-radius: 6px; padding: 6px 10px; font-weight: 600; font-size: 13px; color: var(--mda-muted); }
#langSwitch button[aria-pressed="true"] { background: var(--mda-ink); color: #fff; }

/* Dock: segmented controls, façade swatches, price */
.seg { display: flex; gap: 2px; background: #f0f0f0; border-radius: 6px; padding: 2px; }
.seg-btn { background: none; border: 0; border-radius: 5px; padding: 7px 12px; font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--mda-muted); }
.seg-btn[aria-pressed="true"] { background: var(--mda-ink); color: #fff; }
.swatches { display: flex; gap: 6px; padding: 0 4px; }
.swatches:empty { display: none; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--mda-line); padding: 0;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--mda-ink); }
/* each façade's look, shared by the dock's swatches and the colour chips in the wall card */
[data-facade] { --fac-color: #ddd; --fac-image: none; --fac-size: cover; }
[data-facade="wood"] { --fac-color: #a9794a; --fac-image: repeating-linear-gradient(90deg, rgba(0,0,0,0.18) 0 1.5px, transparent 1.5px 7px); }
[data-facade="metal"] { --fac-color: #7d8791; --fac-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.32) 0 2px, rgba(0,0,0,0.18) 2px 4px); }
[data-facade="render"] { --fac-color: #e7e1d3; }
[data-facade="brick"] {
  --fac-color: #a94f3a;
  --fac-image: linear-gradient(rgba(255,255,255,0.55) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(255,255,255,0.55) 1.5px, transparent 1.5px);
  --fac-size: 100% 7px, 11px 100%;
}
.swatch, .card .swatch::before { background-color: var(--fac-color); background-image: var(--fac-image); background-size: var(--fac-size); }
#priceBtn {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; white-space: nowrap;
  background: none; border: 0; border-left: 1px solid var(--mda-line); border-radius: 0; padding: 2px 6px 2px 12px; margin-left: 2px;
}
.price-label { font-size: 11px; color: var(--mda-muted); text-transform: uppercase; letter-spacing: 0.06em; }
#priceBtn b { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
#priceBtn[aria-pressed="true"] b { text-decoration: underline; text-underline-offset: 3px; }
#shellNote {
  margin: 0; max-width: 100%; box-sizing: border-box; width: max-content; text-align: center; font-size: 12.5px; line-height: 1.35;
  background: var(--mda-panel); color: var(--mda-ink); box-shadow: var(--mda-shadow); border-radius: 12px; padding: 5px 12px;
}
#cards { position: fixed; inset: 0; z-index: 7; pointer-events: none; }
#cards > * { pointer-events: auto; }

/* Labels pinned to the 3D scene (CSS2D): the layer lets taps through to the canvas, its children take them */
.overlay-layer { position: absolute; inset: 0; pointer-events: none; }
.overlay-layer > * { pointer-events: auto; }

/* Hotspot dots: red, pulsing; ringed and still while their card is open; faded when their surface faces away */
.dot {
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: none;
  display: grid; place-items: center; transition: opacity 0.2s;
}
.dot::before, .dot::after { content: ""; grid-area: 1 / 1; width: 14px; height: 14px; border-radius: 50%; background: var(--mda-red); }
.dot::before { z-index: 1; box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); transition: transform 0.15s; }
.dot::after { opacity: 0; animation: mda-pulse 1.8s ease-out infinite; }
@keyframes mda-pulse { from { transform: scale(1); opacity: 0.6; } to { transform: scale(2.7); opacity: 0; } }
.dot:hover::before { transform: scale(1.15); }
.dot.on::before { transform: scale(1.15); box-shadow: 0 0 0 3px var(--mda-red), 0 1px 6px rgba(0, 0, 0, 0.45); }
.dot.on::after, .dot.back::after { animation: none; }
.dot.back { opacity: 0.45; }
.dot:focus-visible { outline-offset: -2px; }

/* Inside view (js/inside.js): a label per room, tap for its card. Labels and the interior-doors dot fade in and take taps
   once the roof is mostly off (body.roof-off), so they never float over the lifting roof. */
.overlay-layer > .room-label {
  pointer-events: none; opacity: 0; transition: opacity 0.2s;
  padding: 5px 11px; border: 0; border-radius: 999px; background: var(--mda-panel); color: var(--mda-ink);
  box-shadow: var(--mda-shadow); font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.overlay-layer > .dot[data-hotspot="idoors"] { pointer-events: none; opacity: 0; }
.roof-off .overlay-layer > .room-label, .roof-off .overlay-layer > .dot[data-hotspot="idoors"] { pointer-events: auto; opacity: 1; }
.room-label:hover { background: var(--mda-paper); }
.room-label.on { background: var(--mda-ink); color: #fff; }

/* Wall fan labels (js/fan.js): stacked beside the fan, outermost layer on top, each on a leader line down to the top of
   its slab. The text runs inward, to the left of the line (.to-right when the camera is round the other side).
   Taps and orbit drags pass straight through to the canvas. */
.overlay-layer > .fan-label { pointer-events: none; }
.fan-label {
  display: flex; flex-direction: column; align-items: flex-end;
  opacity: 0; transition: opacity 0.18s;
}
.fan-label.to-right { align-items: flex-start; }
.fan-label.in { opacity: 1; }
.fan-text {
  white-space: nowrap; font-size: 12px; line-height: 16px; padding: 1px 7px; border-radius: 4px;
  background: var(--mda-panel); color: var(--mda-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.fan-mm { color: var(--mda-muted); font-variant-numeric: tabular-nums; }
.fan-line { position: relative; display: block; width: 1px; background: rgba(43, 43, 43, 0.6); }
.fan-line::after {   /* the foot of the line, on the slab */
  content: ""; position: absolute; left: -2px; bottom: -2.5px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--mda-ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.fan-label.total .fan-text { background: var(--mda-ink); color: #fff; font-weight: 600; }
.fan-label.total .fan-mm { color: rgba(255, 255, 255, 0.75); }
.fan-label.total .fan-line { visibility: hidden; }   /* keeps its length: the total stacks above the outermost label */

/* The card: beside its dot (placed by js/cards.js), price above the dock on the right, contact under Contact */
.card {
  position: absolute; right: var(--gutter-r); bottom: calc(var(--dock-top, 70px) + 8px);
  box-sizing: border-box; width: min(300px, calc(100vw - 24px));
  max-height: calc(100vh - var(--bar-bottom, 60px) - var(--dock-top, 70px) - 24px);
  display: flex; flex-direction: column;
  background: var(--mda-paper); color: var(--mda-ink); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  font-size: 14px; line-height: 1.4; animation: mda-card-in 0.14s ease-out;
}
.card[data-type="price"] { width: min(380px, calc(100vw - 24px)); }
.card[data-type="contact"] { top: calc(var(--bar-bottom, 60px) + 8px); bottom: auto; }
/* desktop, with the price panel open: Contact's card sits to the panel's left (js/cards.js sets .with-price) */
#cards.with-price .card[data-type="contact"] { right: calc(var(--gutter-r) + min(380px, 100vw - 24px) + 12px); }
.card.anchored { left: 0; top: 0; right: auto; bottom: auto; }
@keyframes mda-card-in { from { opacity: 0; } }
@keyframes mda-sheet-in { from { opacity: 0; translate: 0 32px; } }
.card-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 6px 6px 16px; }
.card-head h3 { flex: 1; padding-top: 5px; font-size: 18px; line-height: 1.25; letter-spacing: 0.02em; }
.card-close {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--mda-muted);
}
.card-close svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.card-close:hover { background: #f0f0f0; color: var(--mda-ink); }
.card-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
.card-body p { margin: 0 0 8px; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }
p.card-sub { font-size: 13px; color: var(--mda-muted); }
h4.card-sub {
  margin: 14px 0 4px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mda-muted);
}
.layer-list, .extras-list { list-style: none; margin: 0; padding: 0; }
.layer-list li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid #eee; }
.layer-list li:last-child, .extras-list li:last-child { border-bottom: 0; }
.mm { flex: none; color: var(--mda-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.inc-list { margin: 0; padding-left: 18px; }
.inc-list li { padding: 2px 0; }
.extras-list li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 5px 0; border-bottom: 1px solid #eee; }
.extra-price { font-weight: 600; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.extra-note { grid-column: 1 / -1; font-size: 12.5px; color: var(--mda-muted); }
.price-big { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.1; }
.card-body .price-big { margin-bottom: 2px; }
.price-sub { color: var(--mda-muted); }
.note { font-size: 12.5px; color: var(--mda-muted); background: #f5f5f3; border-radius: 6px; padding: 7px 10px; }
.card-body > * + .note { margin-top: 10px; }
.walk-in {
  width: 100%; margin-top: 14px; padding: 10px 14px; border: 0; border-radius: var(--mda-radius);
  background: var(--mda-ink); color: #fff; font-weight: 600;
}
.contact-links { display: flex; flex-direction: column; gap: 6px; }
.contact-links a {
  display: block; padding: 9px 12px; border-radius: var(--mda-radius); background: #f3f3f3;
  color: var(--mda-ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere;
}
.contact-links a:hover { background: #e8e8e8; }
/* façade chips in the wall card: the dock's colour as a dot, then the name */
.card .swatches { flex-wrap: wrap; gap: 6px; padding: 0; }
.card .swatch {
  width: auto; height: auto; display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px;
  border: 0; border-radius: 999px; background: #f0f0f0; box-shadow: none; font-size: 13px; font-weight: 600;
}
.card .swatch::before { content: ""; flex: none; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14); }
.card .swatch.active { background: var(--mda-ink); color: #fff; }
.card .swatch.active::before { box-shadow: 0 0 0 2px #fff; }

/* Small floating notices */
#hint, #texPill {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%);
  background: var(--mda-panel); box-shadow: var(--mda-shadow); border-radius: 999px;
  font-size: 12.5px; color: var(--mda-muted); padding: 6px 13px; box-sizing: border-box;
  white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
/* the Macedonian hints are long: let them wrap on narrow screens instead of cutting them off. Above the dock at whatever
   height it wraps to (--dock-top, set by js/cards.js, is the dock column's top edge from the bottom, grey-phase note
   and safe area included) */
#hint {
  bottom: calc(var(--dock-top, 64px) + 14px); width: max-content; white-space: normal; text-align: center;
  border-radius: 16px; line-height: 1.35;
}
#texPill { top: calc(var(--safe-t) + 64px); font-variant-numeric: tabular-nums; }
#walkBack {
  position: fixed; z-index: 6; top: calc(var(--safe-t) + 64px); left: var(--gutter-l);
  background: var(--mda-ink); color: #fff; border: 0; border-radius: var(--mda-radius); box-shadow: var(--mda-shadow);
  padding: 8px 14px; font-weight: 600; font-size: 14px;
}

/* Walk joystick (touch only) */
#joy {
  position: fixed; z-index: 5; width: 112px; height: 112px; border-radius: 50%;
  left: max(20px, calc(env(safe-area-inset-left, 0px) + 12px)); bottom: calc(var(--dock-top, 64px) + 32px);
  border: 1.5px solid var(--mda-line); background: var(--mda-panel); touch-action: none;
}
#joy i {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; background: var(--mda-ink); opacity: 0.8;
}

/* Loader: red model name over the charcoal mark, progress bar, status line */
#loader {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: var(--mda-paper); transition: opacity 0.4s ease;
}
#loader.is-done { opacity: 0; pointer-events: none; }
.loader-box { width: min(320px, calc(100vw - 48px)); display: flex; flex-direction: column; gap: 14px; }
.loader-model {
  margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(44px, 12vw, 64px);
  line-height: 1; letter-spacing: 0.02em; color: var(--mda-red);
}
.loader-mark {
  display: flex; align-items: center; gap: 10px; color: var(--mda-ink);
  font-family: var(--font-display); font-weight: 500; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
}
.loader-mark svg { flex: none; }
.loader-track { height: 3px; background: var(--mda-line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.loader-track i { display: block; height: 100%; width: 0; background: var(--mda-ink); transition: width 0.2s; }
#loader.is-indeterminate .loader-track i { width: 30%; animation: mda-slide 1.2s ease-in-out infinite; }
@keyframes mda-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
#loadText { margin: 0; font-size: 13px; color: var(--mda-muted); line-height: 1.45; }
#loader.is-error .loader-track { display: none; }
#loader.is-error #loadText { color: var(--mda-ink); font-weight: 600; }

/* Portrait phones: turn-your-phone prompt over the loader and the house (js/turn.js) */
/* "Powered by Nebbula Solutions": the bottom-left corner, level with the dock's bottom edge, on wide screens; below
   1200 px (the Macedonian dock reaches the corner) and on short screens, centred under the dock, which moves up for it */
#credit {
  position: fixed; z-index: 4; left: var(--gutter-l); bottom: calc(var(--safe-b) + 14px);
  font-size: 11px; line-height: 14px; color: var(--mda-muted); text-decoration: none; white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 8px rgba(255, 255, 255, 0.8);   /* readable over grass and sky */
}
#credit b { font-weight: 600; color: var(--mda-ink); }
#credit:hover b { text-decoration: underline; }
@media (max-width: 1199px), (max-height: 480px) {
  #credit { left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 4px); }
  #dockWrap { bottom: calc(var(--safe-b) + 24px); }
}

#turnPrompt {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px;
  background: var(--mda-panel); transition: opacity 0.3s ease;
}
#turnPrompt:focus { outline: none; }
#turnPrompt.is-done, #turnPrompt.is-turned { opacity: 0; pointer-events: none; }
#turnPrompt.is-turned { transition: opacity 0.8s cubic-bezier(0.33, 1, 0.68, 1); }   /* ease-out cubic */
.turn-box { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 300px; text-align: center; }
.turn-icon { width: 96px; height: 96px; margin-bottom: 6px; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.turn-phone { stroke: var(--mda-ink); transform-box: view-box; transform-origin: 50% 50%; animation: mda-turn 2.6s ease-in-out infinite; }
.turn-arrow { stroke: var(--mda-red); }
@keyframes mda-turn { 0%, 20% { transform: rotate(0); } 45%, 75% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .turn-phone { animation: none; transform: rotate(-90deg); } }
#turnTitle { font-size: 28px; line-height: 1.15; letter-spacing: 0.02em; }
.turn-text { margin: 0; font-size: 15px; line-height: 1.45; color: var(--mda-muted); }
.turn-go {
  margin-top: 14px; min-height: 44px; padding: 0 22px; border: 1px solid var(--mda-ink); border-radius: 999px;
  background: none; font-size: 15px;
}
.turn-go:active { background: var(--mda-ink); color: #fff; }

@media (max-width: 640px) {
  /* Phones: the top bar, the dock and the card sheet keep 16 px from the sides */
  :root {
    --gutter-l: max(16px, env(safe-area-inset-left, 0px));
    --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  }

  /* Compact top bar: the model name alone (still red), a tighter language switch and Contact */
  #topbar, .topbar-actions { gap: 6px; }
  #brand { font-size: 15px; padding: 6px 10px; }
  .brand-model { display: none; }
  #langSwitch button { padding: 6px 9px; }
  #contactBtn { padding: 7px 11px; }

  /* The dock spans the gutters in two rows at every phone width: the view and the façade swatches, then the systems
     (right under their swatches) and the price they set. View + systems in one row would not fit 360 px in Macedonian.
     Tap targets stay >= 32 px. */
  #dockWrap { left: var(--gutter-l); right: var(--gutter-r); }
  #dock { width: 100%; padding: 4px; gap: 0 4px; }
  #dock::before { content: ""; order: 2; flex-basis: 100%; height: 6px; }   /* the row break */
  #dock > .seg { flex: 1 1 auto; }
  .seg-btn { flex: 1 1 auto; padding: 7px 4px; font-size: 12.5px; min-height: 32px; box-sizing: border-box; }
  .swatches { order: 1; gap: 4px; padding: 0 2px; }
  #dock > .seg + .seg, #priceBtn { order: 3; }
  #priceBtn { align-self: stretch; justify-content: center; min-height: 32px; padding: 2px 2px 2px 8px; margin-left: 0; }
  /* the label stays in the accessible name; the figure alone is shown */
  .price-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #priceBtn b { font-size: 16px; }

  /* Hint and walk stick above the dock; while walking the hint goes above the stick */
  #hint { bottom: calc(var(--dock-top, 110px) + 10px); }
  #joy { left: var(--gutter-l); bottom: calc(var(--dock-top, 110px) + 12px); }
  #joy:not([hidden]) ~ #hint { bottom: calc(var(--dock-top, 110px) + 134px); }

  /* The card is a sheet just above the dock, so the price stays in sight. Small cards keep to the bottom 40 % and the
     house shows above them (js/cards.js moves the picture up so the card's dot or the wall fan sits in that space);
     the price sheet takes up to 70 %. Both scroll inside. */
  .card, .card.anchored, .card[data-type] {
    left: var(--gutter-l); right: var(--gutter-r); top: auto; bottom: calc(var(--dock-top, 110px) + 8px); width: auto;
    max-height: min(40vh, calc(100vh - var(--bar-bottom, 60px) - var(--dock-top, 110px) - 16px));
    max-height: min(40dvh, calc(100dvh - var(--bar-bottom, 60px) - var(--dock-top, 110px) - 16px));
    border-radius: 14px; box-shadow: 0 6px 28px rgba(0, 0, 0, 0.24);
    animation-name: mda-sheet-in;
  }
  .card[data-type="price"] {
    max-height: min(70vh, calc(100vh - var(--bar-bottom, 60px) - var(--dock-top, 110px) - 16px));
    max-height: min(70dvh, calc(100dvh - var(--bar-bottom, 60px) - var(--dock-top, 110px) - 16px));
  }
  /* the wall sheet leaves ~290 px above it for the fan and its labels (up to 12 rows, js/fan.js), so on short phones
     it gets shorter rather than pushing the top labels under the top bar */
  .card[data-type="wall"] {
    max-height: min(40vh, max(150px, calc(100vh - var(--bar-bottom, 60px) - var(--dock-top, 110px) - 298px)));
    max-height: min(40dvh, max(150px, calc(100dvh - var(--bar-bottom, 60px) - var(--dock-top, 110px) - 298px)));
  }
  .card-head { align-items: center; padding: 4px 4px 0 16px; }
  .card-head h3 { padding-top: 0; }
  .card-close { width: 44px; height: 44px; }
  .card-close svg { width: 14px; height: 14px; }
  /* a room's "Walk in" stays in sight at the foot of its sheet while the lists above it scroll */
  .walk-in { position: sticky; bottom: 0; box-shadow: 0 0 0 6px var(--mda-paper), 0 6px 0 6px var(--mda-paper); }

  /* 3D labels: larger dots to tap; smaller room labels (the fan's labels just below) */
  .dot { width: 40px; height: 40px; }
  .overlay-layer > .room-label { padding: 4px 8px; font-size: 11px; }
}
/* Phones and short screens (a landscape phone keeps the desktop layout): smaller fan labels, which js/fan.js stacks
   17 px apart (closer under a low top bar), with the layer names only, the total keeping its figure */
@media (max-width: 640px), (max-height: 480px) {
  .fan-text { font-size: 11px; line-height: 14px; padding: 1px 6px; }
  .fan-label:not(.total) .fan-mm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
