:root {
  --paper: #f4f2ed;
  --surface: #fffefb;
  --ink: #1c1c1a;
  --muted: #706e68;
  --line: #d8d5ce;
  --soft-line: #e7e4de;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select { font: inherit; }
button { color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.shell {
  width: min(calc(100% - 40px), 1380px);
  margin: 0 auto;
  padding-bottom: 48px;
}
.topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.mode-switch, .set-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.mode-button, .set-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
}
.mode-button.is-active, .set-button.is-active {
  background: var(--ink);
  color: white;
}
.intro {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
  padding: 32px 0 24px;
}
.intro h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 4vw, 3.7rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}
.intro p {
  max-width: 510px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.set-name { color: var(--muted); font-size: 12px; }
.set-switch { padding: 2px; }
.set-button { min-height: 30px; padding: 0 12px; }

.room-stage, .compare-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #e7e3da;
}
.room-base, .room-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.room-base { z-index: 0; }
.room-scene { z-index: 1; }

.hotspot {
  position: absolute;
  z-index: 5;
  border: 0;
  background: transparent;
  opacity: 0;
}
.hotspot:hover, .hotspot:focus-visible, .hotspot.is-open {
  outline: 1px dashed rgb(255 255 255 / 82%);
  outline-offset: -7px;
  background: rgb(255 255 255 / 6%);
  opacity: 1;
}
.hotspot-sofa {
  top: 25%; right: 0; width: 49%; height: 48%;
  clip-path: polygon(26% 4%, 100% 0, 100% 100%, 0 100%, 0 40%);
}
.hotspot-table {
  z-index: 7;
  top: 45%; left: 30%; width: 48%; height: 35%;
  clip-path: polygon(11% 8%, 94% 0, 100% 86%, 0 100%);
}
.hotspot-chair {
  z-index: 6;
  top: 39%; left: 0; width: 49%; height: 59%;
  clip-path: polygon(0 0, 77% 10%, 100% 100%, 0 100%);
}

.popover {
  position: absolute;
  z-index: 20;
  width: min(250px, calc(100% - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 254 251 / 97%);
  box-shadow: 0 18px 50px rgb(25 23 20 / 18%);
  backdrop-filter: blur(10px);
}
.popover[data-category="sofa"] { top: 28%; right: 3%; }
.popover[data-category="table"] { top: 46%; left: 43%; }
.popover[data-category="chair"] { bottom: 4%; left: 3%; }
.popover-head {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--soft-line);
  padding: 0 9px 0 13px;
}
.popover-head strong { font-size: 12px; }
#popoverClose {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
#popoverClose:hover { background: var(--paper); }
.popover-options { padding: 5px; }
.popover-option {
  display: grid;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 8px;
  text-align: left;
}
.popover-option:hover { background: var(--paper); }
.popover-option.is-selected { background: #ece9e2; }
.popover-option strong { font-size: 12px; }
.popover-option span { margin-top: 2px; color: var(--muted); font-size: 11px; }

.selectors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.selector { display: grid; gap: 6px; }
.selector > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.selector select {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 34px 0 11px;
  color: var(--ink);
  font-size: 12px;
}
.selection-meta {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.compare-card { min-width: 0; }
.compare-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.compare-head h2 { margin: 0; font-size: 13px; font-weight: 650; }
.compare-head span { color: var(--muted); font-size: 11px; }
.compare-stage { border-radius: 9px; }
.compare-selectors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.selector-compact select { min-height: 39px; font-size: 11px; }

button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid #3f68b0;
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .shell { width: min(calc(100% - 24px), 1380px); }
  .topbar { min-height: 56px; }
  .intro { display: block; padding: 24px 0 20px; }
  .intro p { margin-top: 10px; }
  .selectors, .compare-selectors { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; gap: 30px; }
  .selection-meta { display: grid; gap: 5px; }
  .popover[data-category="table"] { top: auto; bottom: 4%; left: 50%; transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
