:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f3;
  color: #17211d;
  --line: #d9ddd1;
  --panel: #ffffff;
  --muted: #647067;
  --ink: #17211d;
  --teal: #0d766d;
  --teal-dark: #075e57;
  --amber: #b7791f;
  --blue: #2563eb;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-height: 40px;
  padding: 0 14px;
}

button:hover,
button:focus-visible {
  border-color: var(--teal);
  outline: none;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 76px;
  padding: 16px 24px;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-strip span,
.room-type {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  padding: 8px 10px;
}

.workspace {
  display: grid;
  flex: 1;
  gap: 0;
  grid-template-columns: minmax(220px, 280px) minmax(360px, 1fr) minmax(280px, 360px);
  min-height: 0;
}

.room-rail,
.floorplan-panel {
  background: #fbfcf8;
  border-color: var(--line);
  border-style: solid;
  min-height: 0;
  padding: 16px;
}

.room-rail {
  border-width: 0 1px 0 0;
}

.floorplan-panel {
  border-width: 0 0 0 1px;
}

.rail-header,
.floorplan-header {
  align-items: center;
  display: flex;
  height: 36px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.room-list {
  display: grid;
  gap: 8px;
}

.room-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  min-height: 62px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.room-button strong {
  display: block;
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.room-button.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(13, 118, 109, 0.1);
}

.room-button[data-type="splat"] .room-type {
  color: var(--blue);
}

.room-button[data-type="pano"] .room-type {
  color: var(--amber);
}

.viewer-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  min-height: 0;
}

.viewport {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.14), transparent 42%),
    linear-gradient(0deg, rgba(13, 118, 109, 0.16), transparent 38%),
    #202926;
  min-height: 420px;
  overflow: hidden;
  position: relative;
}

.viewport-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  inset: 0;
  opacity: 0.6;
  position: absolute;
  transform: perspective(700px) rotateX(58deg) scale(1.5);
  transform-origin: center bottom;
}

.room-stage {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
}

.camera-mark {
  aspect-ratio: 1;
  background: radial-gradient(circle at 38% 32%, #ffffff, #89d5cd 36%, #0d766d 70%);
  border: 8px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  width: min(34vw, 220px);
}

.view-title {
  color: #fff;
  display: grid;
  gap: 6px;
  text-align: center;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.view-title span {
  font-size: 28px;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.view-title strong {
  color: #cfe7e3;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.viewer-actions {
  align-items: center;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  min-height: 64px;
  padding: 12px 16px;
}

#vrMode {
  background: var(--teal);
  border-color: var(--teal-dark);
  color: #fff;
}

#floorplan {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  height: min(58vh, 420px);
  min-height: 260px;
  width: 100%;
}

.room-poly {
  cursor: pointer;
  fill: #e7eee7;
  stroke: #8b958a;
  stroke-width: 2;
}

.room-poly.active {
  fill: rgba(13, 118, 109, 0.18);
  stroke: var(--teal);
  stroke-width: 3;
}

.room-label {
  fill: #17211d;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 220px 1fr;
  }

  .floorplan-panel {
    border-width: 1px 0 0;
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .room-rail,
  .floorplan-panel {
    border-width: 0 0 1px;
  }

  .viewport {
    min-height: 360px;
  }

  .viewer-actions {
    justify-content: stretch;
  }

  .viewer-actions button {
    flex: 1;
  }
}
