:root {
  --ink: #1f1c19;
  --muted: #6f675e;
  --paper: rgba(250, 247, 242, 0.86);
  --paper-solid: #f6f2ec;
  --line: rgba(31, 28, 25, 0.12);
  --accent: #8c6a43;
  --accent-ink: #ffffff;
  --shadow: 0 18px 40px -24px rgba(40, 30, 20, 0.45);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

body[data-tone="dark"] {
  --ink: #f1ece4;
  --muted: #a8a096;
  --paper: rgba(20, 22, 30, 0.78);
  --paper-solid: #151821;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #c9a26e;
  --accent-ink: #15130f;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #efe9e1;
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}

#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand {
  position: fixed;
  top: 24px;
  left: 28px;
  pointer-events: none;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.35);
}

body[data-tone="dark"] .brand { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); }

.brand h1 {
  margin: 2px 0 0;
  font: 500 42px/1.02 var(--serif);
  letter-spacing: -0.01em;
}

.brand .meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.card {
  position: fixed;
  background: var(--paper);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.plan { top: 24px; right: 24px; width: 220px; padding: 14px 16px 12px; }
.plan svg { display: block; width: 100%; height: auto; margin-top: 8px; }

.plan .room {
  fill: var(--paper-solid);
  stroke: var(--line);
  stroke-width: 0.04;
  cursor: pointer;
  transition: fill 0.2s;
}

.plan .room:hover, .plan .room.active { fill: color-mix(in srgb, var(--accent) 28%, var(--paper-solid)); }
.plan .room.outdoor { stroke-dasharray: 0.12 0.08; }
.plan .outline { fill: none; stroke: var(--ink); stroke-width: 0.12; pointer-events: none; }
.plan text { font: 600 0.38px var(--sans); fill: var(--ink); text-anchor: middle; pointer-events: none; }
.plan .marker { fill: var(--accent); stroke: var(--paper-solid); stroke-width: 0.06; }

.info { top: 50%; right: 24px; width: 300px; padding: 22px 22px 20px; transform: translateY(-50%); }
.info h2 { margin: 4px 0 0; font: 500 32px/1.05 var(--serif); }
.info .area { margin: 6px 0 14px; color: var(--muted); }
.info ul { margin: 0 0 18px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.info li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.info .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.info .close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

button {
  font: 500 13px/1 var(--sans);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  min-height: 36px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

button:hover { border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.active, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.toolbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 8px;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  background: var(--paper);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  scrollbar-width: none;
}

.segmented { display: flex; gap: 2px; flex: none; }
.segmented + .segmented { padding-left: 10px; border-left: 1px solid var(--line); }
.segmented button { border-color: transparent; white-space: nowrap; }
.segmented button.active { border-color: var(--accent); }

#hint {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  margin: 0;
  max-width: calc(100vw - 32px);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

#caption {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px));
  margin: 0;
  text-align: center;
  font: italic 500 30px/1.2 var(--serif);
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.room-label {
  display: grid;
  gap: 1px;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  min-height: 0;
  line-height: 1.2;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.room-label strong { font: 600 18px/1.1 var(--serif); }
.room-label span { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }

#tooltip {
  position: fixed;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  transform: translate(14px, 14px);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body[data-mode="walk"] #tooltip { transform: translate(-50%, 22px); }

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

#fade {
  position: fixed;
  inset: 0;
  background: #0b0a09;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#fade.on { opacity: 1; }

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #f3eee7;
  color: #1f1c19;
  transition: opacity 0.8s ease;
}

#loading.done { opacity: 0; pointer-events: none; }
.loading-inner { text-align: center; }
.loading-inner h1 { margin: 6px 0 18px; font: 500 48px/1 var(--serif); }
.bar { width: 220px; height: 2px; margin: 0 auto; background: rgba(31, 28, 25, 0.12); overflow: hidden; }
.bar span { display: block; width: 0; height: 100%; background: #8c6a43; transition: width 0.2s; }
#loading-text { margin: 14px 0 0; font-size: 12px; color: #6f675e; }

body[data-mode="tour"] .brand,
body[data-mode="tour"] .plan,
body[data-mode="tour"] #hint { opacity: 0.0; transition: opacity 0.6s; }

@media (max-width: 760px) {
  .brand { top: 16px; left: 16px; }
  .brand h1 { font-size: 30px; }
  .plan { display: none; }
  .info {
    top: auto;
    bottom: 84px;
    left: 16px;
    right: 16px;
    width: auto;
    transform: none;
    max-height: 46vh;
    overflow-y: auto;
  }
  .toolbar { left: 16px; right: 16px; transform: none; border-radius: 18px; }
  #hint { bottom: 76px; }
  body:has(#info:not([hidden])) #hint { display: none; }
  #caption { font-size: 22px; bottom: 96px; }
}

[hidden] { display: none !important; }
