/* Walk-through viewer. Same design DNA as the 2D app: paper, ink, clay, square 1 px buttons. */
/* Fraunces and Inter come from the site itself (fonts/), so opening a walk-through never calls Google.
   They are the files, language ranges and weights Google Fonts sent before: Fraunces 600, Inter 400 to 500.
   Browsers keep a font file for a year, so never change one in place: a new version gets a new file name. */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/fraunces-v38-vietnamese.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/fraunces-v38-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/fraunces-v38-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/inter-v20-cyrillic-ext.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/inter-v20-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/inter-v20-greek-ext.woff2) format('woff2'); unicode-range: U+1F00-1FFF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/inter-v20-greek.woff2) format('woff2'); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/inter-v20-vietnamese.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/inter-v20-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(fonts/inter-v20-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #FAF7F1; --panel: #F3EEE4; --ink: #2B2622; --ink2: #6B6259; --line: #DDD5C6;
  --clay: #B0825B; --claydark: #8F6743; --sky: #DCE3EA;
  --field: #FFFFFF; --bad: #8A2A1B; --stick: rgba(250, 247, 241, .35); --map: #FAF7F1; --ground: #D3CBBB;
  color-scheme: light;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pad: 14px; --bh: 32px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);   /* a notch or the rounded corners in landscape */
}
/* The dark theme (screen colours, set on <html> by the script in index.html; the same choice as the editor's). The family's dark set:
   ground #161413 to #211E1B, paper #F3EFE7 as the ink, copper #CA9B73; every text colour reads at 4.5 to 1 or better on its box.
   The boxes over the 3D view, the sky (--sky) and the open ground beyond the lot (--ground, fading into the sky far off) change
   (viewer.js themeScene reads them): the building, the lot, the lawn and the lights stay the same.
   The small map stays a plan on paper (--map), in both themes. */
:root[data-theme="dark"] {
  --paper: #211E1B; --panel: #2C2824; --ink: #F3EFE7; --ink2: #C9C2B6; --line: #4A443D;
  --clay: #CA9B73; --claydark: #CA9B73; --sky: #1E1B19; --ground: #2A2623;
  --field: #161413; --bad: #F08A80; --stick: rgba(22, 20, 19, .35);
  color-scheme: dark;
}
:root[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23F3EFE7' stroke-width='1.3'/%3E%3C/svg%3E"); }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); font: 16px/1.4 var(--sans); -webkit-tap-highlight-color: transparent; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#view:active { cursor: grabbing; }

/* floating labels over rooms and openings (dollhouse mode) */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.lbl { position: absolute; left: 0; top: 0; will-change: transform; background: var(--paper); border: 1px solid var(--ink); padding: 2px 8px; font: 500 16px/1.25 var(--sans); color: var(--ink); white-space: nowrap; }
.lbl.room { text-align: center; }
.lbl.room b { display: block; font: 600 16px/1.2 var(--serif); }
.lbl.room span { color: var(--ink2); font-size: 16px; }
.lbl.room.sel { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lbl.room.sel span { color: var(--paper); }
.lbl.op { background: var(--claydark); color: var(--paper); border-color: var(--claydark); font-size: 16px; padding: 1px 6px; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#hud > * { position: absolute; }
button, select { pointer-events: auto; font: 500 16px/1 var(--sans); color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 0; height: var(--bh); cursor: pointer; }
button { padding: 0 14px; }
button:hover, select:hover { background: var(--panel); }
button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
select { -webkit-appearance: none; appearance: none; padding: 0 30px 0 10px; max-width: 100%; text-overflow: ellipsis;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%232B2622' stroke-width='1.3'/%3E%3C/svg%3E") no-repeat right 10px center; }

/* top left: where am I, and where can I go */
.tl { left: calc(var(--pad) + var(--safe-l)); top: calc(var(--pad) + var(--safe-t)); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 40vw; }
.title { background: var(--paper); border: 1px solid var(--ink); padding: 8px 12px; max-width: 100%; box-sizing: border-box; }
.name { font: 600 17px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.style { font: 400 16px/1.3 var(--sans); color: var(--ink2); letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.style:empty { display: none; }
.photos { display: inline-block; margin-top: 4px; pointer-events: auto; font: 500 16px/1.3 var(--sans); color: var(--claydark); text-decoration: underline; text-underline-offset: 3px; }
.photos:hover { color: var(--ink); }
.nav { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.floors { display: flex; gap: 0; }
.floors button { white-space: nowrap; padding: 0 10px; }
.floors button + button { border-left: 0; }

.modes { right: calc(var(--pad) + var(--safe-r)); top: calc(var(--pad) + var(--safe-t)); display: flex; gap: 6px; }
.exit { margin-left: 8px; }

#room { left: 50%; top: calc(var(--pad) + var(--safe-t)); transform: translateX(-50%); font: 600 22px/1 var(--serif); background: var(--paper); border: 1px solid var(--ink); padding: 8px 18px; white-space: nowrap; }
#room:empty { display: none; }

#map { right: calc(var(--pad) + var(--safe-r)); bottom: calc(var(--pad) + var(--safe-b)); width: 160px; height: 160px; background: var(--map); border: 1px solid var(--ink); }

/* The hint and the owner's notice share ONE box, the notice on top, so neither can cover the other whatever height their words take
   on this screen (the notice used to sit a fixed number of px above the hint). Wide screens: centred, clear of the map at the right.
   The box is as wide as the longest line (width: max-content) up to 760px, and never wider than the room between the two side margins that
   keep clear of the map; words that do not fit that wrap, at every window width (the hint used to stay on one line and run over the map
   on windows 1001 to 1115px wide). */
.msgs { left: 50%; bottom: calc(var(--pad) + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: min(760px, calc(100vw - 2 * (var(--pad) + 170px + max(var(--safe-l), var(--safe-r))))); }
.hint { background: var(--paper); border: 1px solid var(--line); color: var(--ink2); padding: 6px 12px; font-size: 16px; box-sizing: border-box; }
.notice { background: var(--paper); border: 1px solid var(--ink); padding: 6px 12px; font-size: 16px; box-sizing: border-box; max-width: 100%; }

.stick { position: fixed; width: 120px; height: 120px; border: 1px solid var(--ink); border-radius: 50%; background: var(--stick); transform: translate(-50%, -50%); }
.knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; border-radius: 50%; background: var(--clay); border: 1px solid var(--paper); transform: translate(-50%, -50%); }

/* the "how to move" card: shown on first visit, and from the Help button. Its Screen colours row: three joined buttons, the chosen one filled */
.helpcard { position: fixed; z-index: 4; left: calc(50% + (var(--safe-l) - var(--safe-r)) / 2); top: calc(50% + (var(--safe-t) - var(--safe-b)) / 2); transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px - var(--safe-l) - var(--safe-r))); max-height: calc(100dvh - 32px - var(--safe-t) - var(--safe-b)); overflow: auto; box-sizing: border-box; background: var(--paper); border: 1px solid var(--ink); padding: 20px 22px; }
.helpcard h2 { margin: 0 0 10px; font: 600 20px/1.2 var(--serif); }
.helpcard ul { margin: 0; padding: 0 0 0 18px; }
.helpcard li { margin: 6px 0; line-height: 1.45; }
.helpcard h3 { margin: 14px 0 4px; font: 600 16px/1.3 var(--sans, inherit); }
.helpcard .fine { color: var(--ink2); font-size: 16px; border-top: 1px solid var(--line); padding-top: 10px; margin: 14px 0 14px; }
/* K206: a card longer than the screen opens at its title, and its Got it button stays in sight at the bottom, at every screen size. Behind it, a band of paper the
   lines scroll under (the card's last box, taking no room of its own: from 12 px above the button to the card's border, as wide as the lines). bottom: 0 is the card's
   padding edge, so the button rests where it sits at the end of the card and never covers the last line. */
.helpcard > button:last-child { position: sticky; bottom: 0; z-index: 2; }
.helpcard::after { content: ''; display: block; position: sticky; bottom: -20px; z-index: 1; height: calc(var(--bh) + 32px); margin: calc(-12px - var(--bh)) 0 -20px; background: var(--paper); pointer-events: none; }
.themepick .seg { display: flex; }
.themepick .seg button { flex: 1 1 0; min-width: 0; }
.themepick .seg button + button { border-left: 0; }
.helpcard .fine2 { color: var(--ink2); margin: 6px 0 0; }
.touch { display: none; }
@media (pointer: coarse) { .mouse { display: none; } li.touch { display: list-item; } span.touch { display: inline; } }

.load { position: fixed; inset: 0; z-index: 5; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px calc(24px + var(--safe-r)) 24px calc(24px + var(--safe-l)); text-align: center; }
.wordmark { font: 600 30px/1 var(--serif); }
.loadmsg { color: var(--ink2); max-width: 36ch; }
.bar { width: min(320px, 70vw); height: 1px; background: var(--line); }
#loadbar { height: 1px; width: 0; background: var(--ink); transition: width .3s; }

[hidden] { display: none !important; }

@media (pointer: coarse) {
  :root { --bh: 44px; }
  button { padding: 0 16px; }
}

/* narrower screens (tablets, phones held sideways): the room name moves under the buttons */
@media (max-width: 1000px) {
  #room { left: auto; right: calc(var(--pad) + var(--safe-r)); top: calc(var(--pad) + var(--safe-t) + var(--bh) + 8px); transform: none; font-size: 17px; padding: 7px 12px; }
  .msgs { left: calc(var(--pad) + var(--safe-l)); transform: none; align-items: flex-start; width: auto; max-width: calc(100vw - 2 * var(--pad) - 180px - var(--safe-l) - var(--safe-r)); }
}

@media (max-width: 760px) {
  :root { --pad: 10px; }
  .tl { max-width: 54vw; }
  .title { padding: 6px 10px; }
  .name { font-size: 16px; }
  #room { top: calc(var(--pad) + var(--safe-t)); font-size: 16px; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; }
  .modes { top: auto; bottom: calc(var(--pad) + var(--safe-b)); left: calc(var(--pad) + var(--safe-l)); right: calc(var(--pad) + var(--safe-r)); gap: 4px; }
  .modes button { flex: 1 1 auto; padding: 0 4px; min-width: 0; }   /* widths follow the words, so "Dollhouse" is not squeezed to the width of "Walk" */
  .exit { margin-left: 4px; }
  #map { width: 104px; height: 104px; bottom: calc(var(--pad) + var(--bh) + 10px + var(--safe-b)); }
  .msgs { right: calc(var(--pad) + var(--safe-r) + 114px); max-width: none; bottom: calc(var(--pad) + var(--bh) + 10px + var(--safe-b)); align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* the owner's product card: bottom left, clear of the joystick side on a phone */
.prodcard { position: fixed; z-index: 3; left: calc(16px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); width: min(340px, calc(100vw - 32px - var(--safe-l) - var(--safe-r))); box-sizing: border-box; background: var(--paper); border: 1px solid var(--ink); padding: 14px 16px; font-size: 16px; line-height: 1.45; }
.prodcard h2 { margin: 0 0 4px; font: 600 18px/1.25 var(--serif); }
.prodcard p { margin: 2px 0; }
.prodcard .fine { color: var(--ink2); }
.prodcard .price { font-weight: 600; margin-top: 6px; }
.prodcard button { margin-top: 10px; }
.prodcard[hidden] { display: none; }

/* pinned comments: numbered square pins standing in the rooms, a Comments button under the room list, a card with the list and the threads */
.cmtrow { display: block; }
.cmtrow[hidden] { display: none; }
#pins { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
#pins[hidden] { display: none; }
button.pin, div.pin { position: absolute; left: 0; top: 0; will-change: transform; box-sizing: border-box; min-width: 32px; height: 32px; padding: 0 6px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 0; background: var(--ink); color: var(--paper); font: 600 16px/1 var(--sans); }
button.pin { pointer-events: auto; cursor: pointer; }
button.pin::before { content: ''; position: absolute; inset: -6px; }   /* the tap target is 44 px, the tile is 32 */
.pin::after { content: ''; position: absolute; left: 50%; bottom: -11px; width: 12px; height: 9px; transform: translateX(-50%); background: var(--ink); clip-path: polygon(0 0, 100% 0, 50% 100%); }
button.pin:hover { background: var(--claydark); border-color: var(--claydark); }
button.pin.selected, button.pin.selected:hover { background: var(--paper); color: var(--ink); border-color: var(--ink); z-index: 2; }
button.pin.selected::after { background: var(--ink); }
button.pin.resolved, button.pin.resolved:hover { background: var(--panel); color: var(--ink2); border: 2px dashed var(--ink2); }
button.pin.resolved::after { background: var(--ink2); }
div.pin.draft { background: var(--paper); color: var(--ink); border: 2px dashed var(--claydark); }
div.pin.draft::after { background: var(--claydark); }

.cmtpanel { position: fixed; z-index: 3; right: calc(var(--pad) + var(--safe-r)); top: calc(var(--pad) + var(--safe-t) + var(--bh) + 54px); bottom: calc(var(--pad) + 172px + var(--safe-b));
  width: min(360px, calc(100vw - 2 * var(--pad) - var(--safe-l) - var(--safe-r))); box-sizing: border-box; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--ink); }
.cmtpanel[hidden] { display: none; }
.cmthead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cmthead h2 { margin: 0; font: 600 18px/1.2 var(--serif); }
.cmtbody { overflow: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.cmtbody p { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.cmtbody button { height: auto; min-height: var(--bh); padding: 6px 14px; align-self: flex-start; }
.cmtbody button.primary, .cmtpanel button.primary { background: var(--ink); color: var(--paper); }
.cmtbody button.primary:hover { background: var(--claydark); border-color: var(--claydark); }
.cmtbody button:disabled { opacity: .55; cursor: default; }
.cmtbody button.cmtlink { border: 0; background: none; padding: 6px 0; min-height: 44px; color: var(--claydark); text-decoration: underline; text-underline-offset: 3px; }
.cmtbody button.cmtlink:hover { color: var(--ink); background: none; }
.cmtbody > * { flex: none; }                       /* a tall card scrolls; it never squeezes a message to nothing */
.cmtstatus:empty { display: none; }
.cmtstatus.bad { color: var(--bad); border-left: 3px solid var(--bad); padding-left: 8px; }
.cmtbig { font: 600 18px/1.3 var(--serif); }
.cmtfine { color: var(--ink2); }
.cmtrowbtns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cmtcheck { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.cmtcheck input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); }
.cmtlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cmtbody button.cmtitem { display: flex; width: 100%; align-self: stretch; align-items: flex-start; gap: 10px; text-align: left; padding: 8px 10px; }
.cmtitem.resolved { background: var(--panel); border-style: dashed; color: var(--ink2); }
.cmtno { flex: none; min-width: 32px; height: 32px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper); font: 600 16px/1 var(--sans); }
.cmtitem.resolved .cmtno { background: var(--panel); color: var(--ink2); border: 2px dashed var(--ink2); }
.cmttext { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; font-weight: 400; }
.cmttext b { font-weight: 500; }
.cmtmsg { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.cmtmsg p { white-space: pre-wrap; }
.cmtmeta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--ink2); }
.cmtmeta b { color: var(--ink); font-weight: 500; }
.cmtform { display: flex; flex-direction: column; gap: 4px; }
.cmtform label { font-weight: 500; }
.cmtform input[type="text"], .cmtform textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--ink); border-radius: 0; background: var(--field); color: var(--ink); padding: 8px 10px; font: 400 16px/1.4 var(--sans); }
.cmtform textarea { resize: vertical; min-height: 84px; }
.cmtform input[type="text"] { min-height: var(--bh); }
.cmtleft { color: var(--ink2); }

@media (max-width: 760px) {
  .cmtpanel { left: calc(var(--pad) + var(--safe-l)); right: calc(var(--pad) + var(--safe-r)); top: auto; bottom: calc(var(--pad) + var(--bh) + 10px + var(--safe-b)); width: auto; max-height: min(50dvh, 420px); }
}
@media (max-width: 760px) {
  .cmtpanel.top { top: calc(var(--pad) + var(--safe-t)); bottom: auto; max-height: min(46dvh, 380px); }
  .cmtpanel.arming .cmtfine { display: none; }
}
