:root {
  --ink: #f3f3f3;
  --brand-red: #cf1520;
  --surface: #111111;
  --surface-2: #1a1a1a;
  --line: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 14% -4%, #1f1f1f 0%, #0c0c0c 48%, #000 100%);
  /* min-height: 100vh removed — it caused the iframe to always report
     a height equal to the iframe's own height, creating an infinite
     grey gap below the real content. Height is now driven by content. */
  height: fit-content;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 28px;
}

.hero {
  margin-bottom: 18px;
}

.brand-lockup {
  width: min(560px, 92%);
  margin: 0 auto 14px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand-logo {
  width: 100%;
  display: block;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: #d5d5d5;
}

h1 {
  margin: 6px 0 8px;
  font-family: "Playfair Display", serif;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.subtitle {
  margin: 0;
  max-width: 680px;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}

.controls,
.visualizer {
  background: linear-gradient(180deg, var(--surface-2) 0%, #0f0f0f 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 16px;
}

.control-block + .control-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wall-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wall-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #181818;
  color: #f0f0f0;
  border-radius: 8px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
}

.wall-btn.active {
  background: var(--brand-red);
  color: #fff;
  border-color: var(--brand-red);
}

.feature-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #181818;
  color: #f0f0f0;
  border-radius: 8px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
}

.feature-btn.active {
  background: var(--brand-red);
  color: #fff;
  border-color: var(--brand-red);
}

.threshold-btn,
.floor-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #181818;
  color: #f0f0f0;
  border-radius: 8px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
}

.threshold-btn.active,
.floor-btn.active {
  background: var(--brand-red);
  color: #fff;
  border-color: var(--brand-red);
}

.palette {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.swatch {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  background: #191919;
  color: #f0f0f0;
  cursor: pointer;
}

.swatch.active {
  border-color: var(--brand-red);
  box-shadow: inset 0 0 0 1px var(--brand-red);
}

.chip {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(40, 34, 29, 0.35);
}

.swatch-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.visualizer {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.scene {
  position: relative;
  min-height: 600px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, #e6e7ea 0%, #cbced4 100%);
  border: 1px solid rgba(99, 81, 60, 0.22);
}

.ceiling-light {
  position: absolute;
  left: 50%;
  top: 8%;
  width: 44%;
  height: 40%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 252, 242, 0.85) 0%, rgba(255, 250, 236, 0.2) 42%, transparent 76%);
  pointer-events: none;
}

.wall,
.floor {
  position: absolute;
  transition: background 0.35s ease;
  box-shadow: inset 0 0 0 1px rgba(47, 39, 31, 0.2);
}

.wall-back {
  left: 22%;
  top: 9%;
  width: 56%;
  height: 66%;
  border-radius: 2px;
}

.wall-left {
  left: 8%;
  top: 9%;
  width: 14%;
  height: 66%;
  transform: perspective(900px) rotateY(62deg);
  transform-origin: right center;
}

.wall-right {
  right: 8%;
  top: 9%;
  width: 14%;
  height: 66%;
  transform: perspective(900px) rotateY(-62deg);
  transform-origin: left center;
}

.niche {
  position: absolute;
  left: 42%;
  top: 27%;
  width: 16%;
  height: 20%;
  border: 1px solid rgba(66, 54, 43, 0.5);
  box-shadow: inset 0 0 18px rgba(28, 23, 18, 0.2);
  background: rgba(255, 255, 255, 0.1);
  z-index: 2;
  display: none;
}

.glass {
  position: absolute;
  top: 10%;
  bottom: 8%;
  width: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(167, 196, 217, 0.45) 100%);
  box-shadow: 0 0 0 1px rgba(184, 209, 224, 0.45);
  opacity: 0.75;
  z-index: 5;
}

.glass-left {
  left: 23%;
}

.glass-right {
  right: 23%;
}

.floor {
  left: 16%;
  right: 16%;
  bottom: 7%;
  height: 19%;
  transform: perspective(450px) rotateX(67deg);
  transform-origin: center bottom;
  background: linear-gradient(145deg, #d8ccbc 0%, #c1b29d 100%);
  border: 1px solid rgba(52, 45, 38, 0.25);
}

.scene.floor-acrylic .floor {
  border-radius: 10px;
  border: 2px solid #f7f7f7;
  box-shadow: 0 8px 16px rgba(18, 14, 10, 0.2), inset 0 0 0 1px #d5d5d5;
}

.drain {
  position: absolute;
  left: 50%;
  bottom: 13%;
  width: 120px;
  height: 6px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #8d8d8d 0%, #d4d4d4 50%, #8d8d8d 100%);
  border-radius: 99px;
  z-index: 7;
  box-shadow: 0 0 0 1px rgba(70, 70, 70, 0.35);
}

.scene.floor-acrylic .drain {
  background: radial-gradient(circle, #8d8d8d 0%, #6f6f6f 65%, #5a5a5a 100%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  bottom: 14%;
}

.curb {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 6%;
  height: 3.5%;
  border-radius: 3px;
  display: none;
  z-index: 8;
  box-shadow: 0 6px 10px rgba(24, 18, 12, 0.2), inset 0 0 0 1px rgba(47, 39, 31, 0.24);
}

.curb-surface {
  background: linear-gradient(145deg, #d2c5b3 0%, #bdad97 100%);
  background-size: cover;
  background-position: center;
}

.wall {
  background-color: #ebe4d8;
  background-image: none;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.bookmatch-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: none;
}

.panel-a {
  left: 0;
}

.panel-b {
  right: 0;
  transform: scaleX(-1);
}

.wall-back.bookmatch-active .bookmatch-panel {
  display: block;
}

.wall-back.bookmatch-active::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(80, 72, 62, 0.16);
}

.scene.niche-active .niche {
  display: block;
}

.scene.threshold-curb .curb {
  display: block;
}

.legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: 0.84rem;
}

.legend span {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 8px;
}

footer {
  margin-top: 12px;
  font-size: 0.8rem;
  color: #d0d0d0;
}

footer a {
  color: #ff3944;
  font-weight: 600;
}

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

  .scene {
    min-height: 430px;
  }

  .wall-back {
    left: 19%;
    width: 62%;
  }

  .wall-left,
  .wall-right {
    display: none;
  }

  .glass-left {
    left: 19%;
  }

  .glass-right {
    right: 19%;
  }

  .niche {
    left: 40%;
    width: 20%;
  }

  .curb {
    left: 14%;
    right: 14%;
  }
}
