:root {
  --ink: #173136;
  --ink-soft: #476468;
  --paper: #efe4cf;
  --vellum: #f8f1df;
  --blueprint: #1c6470;
  --blueprint-dark: #103b43;
  --line: #151515;
  --terra: #b54e34;
  --olive: #697948;
  --gold: #c49b4a;
  --pool: #4aa0a6;
  --shadow: rgba(16, 35, 37, .22);
  --room-fill: rgba(248, 241, 223, .46);
  --room-hover: rgba(255, 220, 151, .9);
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 20%, rgba(196, 155, 74, .18), transparent 28rem),
    linear-gradient(140deg, #d8e6de 0%, #f1e3c6 42%, #cbd9d4 100%);
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(16px, 3vw, 34px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.kicker {
  margin: 0 0 4px;
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--terra);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: .96;
}

h1 {
  font-size: clamp(2rem, 5vw, 5.6rem);
}

h2 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
}

.status-strip {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
  color: var(--blueprint-dark);
}

.status-strip span {
  border: 1px solid rgba(23, 49, 54, .22);
  background: rgba(248, 241, 223, .64);
  padding: 9px 12px;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(23, 49, 54, .08);
}

.experience {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
  gap: 16px;
  position: relative;
}

.room-list {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(248, 241, 223, .56);
  border: 1px solid rgba(23, 49, 54, .14);
  box-shadow: 0 18px 40px rgba(23, 49, 54, .12);
  overflow: auto;
}

.room-tab,
.back-button,
.icon-button {
  border: 1px solid rgba(23, 49, 54, .24);
  background: rgba(255, 252, 241, .74);
  color: var(--ink);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.room-tab {
  min-height: 38px;
  padding: 8px 10px;
  text-align: left;
  border-radius: 6px;
}

.room-tab:hover,
.room-tab.is-active,
.back-button:hover,
.icon-button:hover {
  background: var(--room-hover);
  border-color: rgba(154, 111, 62, .72);
  transform: translateY(-1px);
}

.map-stage {
  min-width: 0;
  min-height: 0;
  position: relative;
}

.map-toolbar {
  position: absolute;
  z-index: 5;
  right: 16px;
  top: 16px;
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 1.3rem;
  font-weight: 700;
}

.blueprint-viewport {
  height: 100%;
  min-height: 640px;
  overflow: hidden;
  border: 1px solid rgba(23, 49, 54, .18);
  background:
    linear-gradient(180deg, rgba(251, 241, 216, .14), rgba(22, 57, 60, .3)),
    #173136;
  box-shadow: 0 28px 70px var(--shadow);
  cursor: grab;
  position: relative;
}

.blueprint-viewport.is-dragging {
  cursor: grabbing;
}

#villaMap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  opacity: .01;
  pointer-events: none;
}

.villa-scene {
  position: absolute;
  inset: 0;
}

.villa-scene canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.map-paper {
  fill: #eee9dd;
  filter: url("#paperLift");
}

.fine-grid {
  fill: url("#fineGrid");
}

.grid {
  fill: url("#grid");
}

.room-shape {
  fill: var(--room-fill);
  stroke: var(--line);
  stroke-width: 7;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill .2s ease, stroke .2s ease, filter .2s ease;
}

.room-shape:hover,
.room-shape.is-selected {
  fill: var(--room-hover);
  stroke: var(--terra);
  filter: drop-shadow(0 12px 10px rgba(86, 55, 28, .22));
}

.outer-wall {
  fill: none;
  stroke: #111;
  stroke-width: 10;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.atrium {
  fill: rgba(248, 241, 223, .32);
}

.peristylium {
  fill: rgba(105, 121, 72, .12);
}

.impluvium {
  pointer-events: none;
  fill: rgba(74, 160, 166, .46);
  stroke: #111;
  stroke-width: 6;
  vector-effect: non-scaling-stroke;
}

.column {
  pointer-events: none;
  fill: rgba(21, 21, 21, .48);
  stroke: rgba(21, 21, 21, .68);
  stroke-width: 2;
}

.room-label {
  pointer-events: none;
  fill: #2f6cad;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .03em;
}

.room-small-label {
  pointer-events: none;
  fill: rgba(47, 108, 173, .76);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.walk-path {
  fill: none;
  stroke: rgba(23, 49, 54, .2);
  stroke-width: 2;
  stroke-dasharray: 5 12;
}

.person {
  transform-box: fill-box;
  transform-origin: center;
}

.person .body {
  stroke: rgba(15, 30, 32, .42);
  stroke-width: 1;
}

.person .head {
  fill: #3b2a21;
}

.room-view {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
  gap: 16px;
  pointer-events: none;
}

.room-view[hidden] {
  display: none;
}

.interior-frame {
  grid-column: 2;
  position: relative;
  overflow: hidden;
  min-height: 640px;
  border: 1px solid rgba(23, 49, 54, .18);
  background: #111f20;
  box-shadow: 0 28px 70px var(--shadow);
  pointer-events: auto;
}

.back-button {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 4;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 6px;
}

.room-canvas {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
}

.room-canvas:active {
  cursor: grabbing;
}

.room-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.room-copy {
  position: absolute;
  left: clamp(18px, 4vw, 46px);
  right: auto;
  bottom: clamp(18px, 4vw, 44px);
  z-index: 3;
  width: min(520px, calc(100% - 36px));
  padding: 18px 20px;
  color: #f7edd8;
  background: linear-gradient(135deg, rgba(16, 35, 37, .82), rgba(79, 58, 39, .72));
  border: 1px solid rgba(248, 241, 223, .28);
  border-radius: 6px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .24);
  backdrop-filter: blur(10px);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}

.room-copy .kicker {
  color: #e2ba65;
}

.room-copy h2 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.room-copy p:last-child {
  max-width: 52ch;
  margin-bottom: 0;
  font-size: clamp(.95rem, 1.2vw, 1.1rem);
  line-height: 1.55;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: start;
  }

  .experience {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .room-list {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
  }

  .room-tab {
    min-width: max-content;
  }

  .blueprint-viewport,
  .interior-frame {
    min-height: 68vh;
  }

  .blueprint-viewport {
    aspect-ratio: 1200 / 760;
    height: auto;
    min-height: 0;
  }

  .room-view {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .interior-frame {
    grid-column: 1;
  }

  .room-copy {
    right: 24px;
  }
}
