:root {
  --bg: #efefef;
  --panel: #ffffff;
  --text: #202124;
  --muted: #68707f;
  --shadow: 0 12px 35px rgba(0, 0, 0, 0.1);
  --sofa-color: #8a6a56;
  --curtain-color: #d4cec5;
  --rug-color: #a79480;
  --wall-color: #e8e0d4;
  --curtain-open: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e6e7ea;
  padding: 1rem 1.4rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.3rem;
}

.topbar p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  padding: 1rem;
}

.panel {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.panel h2,
.panel h3 {
  margin: 0.2rem 0;
}

label {
  color: #394150;
  font-size: 0.9rem;
}

input,
button {
  width: 100%;
}

input[type="color"] {
  height: 44px;
  border: 1px solid #d8dbe2;
  border-radius: 10px;
  padding: 0.25rem;
}

button {
  margin-top: 0.4rem;
  border: none;
  border-radius: 10px;
  padding: 0.7rem;
  background: #1f62ff;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.check-row input {
  width: auto;
}

.viewer {
  position: relative;
  min-height: 650px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  perspective: 1200px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--wall-color), #ffffff 8%) 0%,
    var(--wall-color) 62%,
    #c89f73 62%,
    #ae845f 100%
  );
}

.wall-zone {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 62%;
  z-index: 1;
}

.colorable {
  cursor: pointer;
}

.window {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 240px;
  border: 10px solid #f5f7fb;
  border-radius: 8px;
  background: linear-gradient(180deg, #b9d3f2, #ecf4ff 65%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.window::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 8px;
  height: 100%;
  transform: translateX(-50%);
  background: #f5f7fb;
}

.baseboard {
  position: absolute;
  left: 0;
  right: 0;
  top: 60%;
  height: 14px;
  background: #f1e8db;
  box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.35), 0 2px 5px rgba(0, 0, 0, 0.12);
}

.wall-light {
  position: absolute;
  left: 50%;
  top: 45px;
  width: 320px;
  height: 170px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0));
}

.wall-art {
  position: absolute;
  top: 130px;
  width: 90px;
  height: 90px;
  border: 8px solid #f8f8f8;
  border-radius: 5px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.14);
}

.art-1 {
  left: 130px;
  background: linear-gradient(140deg, #cbc1b5, #8f7f71);
}

.art-2 {
  right: 130px;
  background: linear-gradient(140deg, #ded5cc, #9f907f);
}

.tv {
  position: absolute;
  right: 78px;
  top: 246px;
  width: 170px;
  height: 98px;
  border-radius: 8px;
  border: 7px solid #1d2025;
  background: linear-gradient(155deg, #1f2530, #0f1319 58%, #2f3742);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
  z-index: 6;
  cursor: grab;
  touch-action: none;
}

.tv::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.02) 45%, rgba(0, 0, 0, 0.15));
}

.tv::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 66px;
  height: 6px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #2a2f36;
}

.tv-console {
  position: absolute;
  right: 64px;
  top: 338px;
  width: 196px;
  height: 22px;
  border-radius: 8px;
  background: linear-gradient(180deg, #6a513f, #533f30);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.24);
  z-index: 5;
}

.tv.dragging {
  cursor: grabbing;
}

.tv-console::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 20px;
  width: 12px;
  height: 52px;
  border-radius: 8px;
  background: #5a4536;
  box-shadow: 148px 0 0 #5a4536;
}

.curtain {
  position: absolute;
  top: 0;
  width: calc(50.5% - (var(--curtain-open) * 196px));
  height: 350px;
  background:
    repeating-linear-gradient(
      90deg,
      color-mix(in srgb, var(--curtain-color), #ffffff 17%) 0 11px,
      color-mix(in srgb, var(--curtain-color), #000000 5%) 11px 22px
    );
  box-shadow: inset -12px 0 14px rgba(0, 0, 0, 0.12);
  z-index: 4;
  transition: transform 260ms ease, width 260ms ease, opacity 260ms ease;
  touch-action: none;
}

.curtain.left {
  left: 0;
  transform: translateX(calc(var(--curtain-open) * -10px));
}

.curtain.right {
  right: 0;
  transform: translateX(calc(var(--curtain-open) * 10px)) scaleX(-1);
}

.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 235px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(130, 88, 54, 0.3) 0 28px,
      rgba(160, 114, 74, 0.24) 28px 56px
    );
}

.table {
  position: absolute;
  left: 50%;
  bottom: 156px;
  width: 190px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 20px;
  background: linear-gradient(180deg, #6f5642, #5b4535);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
  z-index: 12;
  cursor: grab;
  touch-action: none;
}

.table.dragging {
  cursor: grabbing;
}

.table::before {
  content: "";
  position: absolute;
  left: 30px;
  top: 24px;
  width: 16px;
  height: 52px;
  background: #5f4938;
  border-radius: 8px;
  box-shadow: 112px 0 0 #5f4938;
}

.rose-vase {
  position: absolute;
  left: 50%;
  bottom: 184px;
  transform: translateX(-50%);
  width: 34px;
  height: 56px;
  border-radius: 8px 8px 10px 10px;
  background: linear-gradient(180deg, #dfe5eb, #b8c2cc);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
  z-index: 24;
}

.rose-vase::before {
  content: "";
  position: absolute;
  left: -34px;
  top: -52px;
  width: 108px;
  height: 66px;
  background:
    radial-gradient(circle at 12% 68%, #c9214f 0 12px, transparent 13px),
    radial-gradient(circle at 28% 36%, #d92f62 0 14px, transparent 15px),
    radial-gradient(circle at 45% 72%, #b81d48 0 12px, transparent 13px),
    radial-gradient(circle at 60% 34%, #d03267 0 13px, transparent 14px),
    radial-gradient(circle at 78% 64%, #a91e4a 0 12px, transparent 13px),
    radial-gradient(circle at 92% 36%, #d63a6d 0 11px, transparent 12px),
    radial-gradient(circle at 52% 90%, #9f2346 0 10px, transparent 11px);
}

.rose-vase::after {
  content: "";
  position: absolute;
  left: 6px;
  top: -34px;
  width: 24px;
  height: 40px;
  background:
    linear-gradient(70deg, transparent 45%, #56783f 45% 55%, transparent 55%),
    linear-gradient(110deg, transparent 45%, #648a47 45% 55%, transparent 55%),
    linear-gradient(90deg, transparent 45%, #4e7239 45% 55%, transparent 55%);
}

.plant {
  position: absolute;
  right: 70px;
  bottom: 190px;
  width: 32px;
  height: 90px;
  background: linear-gradient(180deg, #c8b59f, #9a826c);
  border-radius: 8px 8px 4px 4px;
  z-index: 14;
  cursor: grab;
  touch-action: none;
}

.plant.dragging {
  cursor: grabbing;
}

.plant::before {
  content: "";
  position: absolute;
  left: -30px;
  top: -70px;
  width: 92px;
  height: 82px;
  background: radial-gradient(circle at center, #88a967 0%, #5f8740 70%);
  border-radius: 50%;
}

.glass-cabinet {
  position: absolute;
  left: 24px;
  bottom: 232px;
  width: 132px;
  height: 212px;
  border-radius: 10px;
  background: linear-gradient(180deg, #7a5f49, #634b38);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
  z-index: 9;
  cursor: grab;
  touch-action: none;
}

.glass-cabinet.dragging {
  cursor: grabbing;
}

.glass-cabinet::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 14px;
  bottom: 14px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.06) 35%, rgba(0, 0, 0, 0.08)),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.1) 0 3px,
      transparent 3px 50px,
      rgba(255, 255, 255, 0.22) 50px 53px
    );
  border: 2px solid rgba(232, 240, 247, 0.5);
}

.glass-cabinet::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 148px;
  transform: translate(-50%, -50%);
  border-radius: 6px;
  background: rgba(210, 225, 236, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.rug {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: 90%;
  height: 245px;
  border-radius: 210px;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--rug-color), #fff 15%), color-mix(in srgb, var(--rug-color), #000 14%));
  box-shadow: 0 24px 30px rgba(0, 0, 0, 0.2);
  z-index: 8;
}

.sofa {
  position: absolute;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--sofa-color), #fff 14%),
    color-mix(in srgb, var(--sofa-color), #000 12%)
  );
  border: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 16px rgba(0, 0, 0, 0.2);
  z-index: 18;
  cursor: grab;
  touch-action: none;
}

.sofa.dragging {
  cursor: grabbing;
}

.scene-color-picker {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.sofa::before,
.sofa::after {
  content: "";
  position: absolute;
  background: inherit;
  border: inherit;
}

.sofa-three {
  left: 50%;
  bottom: 178px;
  transform: translateX(-50%);
  width: 390px;
  height: 128px;
  border-radius: 24px;
}

.sofa-three::before {
  left: 10px;
  top: -42px;
  width: 370px;
  height: 56px;
  border-radius: 24px;
}

.sofa-three::after {
  left: -38px;
  top: 14px;
  width: 36px;
  height: 92px;
  border-radius: 16px;
  box-shadow: 430px 0 0 color-mix(in srgb, var(--sofa-color), #000 8%);
}

.sofa-two {
  left: 110px;
  bottom: 145px;
  width: 220px;
  height: 92px;
  border-radius: 22px;
  transform: rotate(-90deg);
  transform-origin: center center;
}

.sofa-two::before {
  left: 10px;
  top: -36px;
  width: 202px;
  height: 42px;
  border-radius: 22px;
}

.sofa-two::after {
  left: -30px;
  top: 12px;
  width: 28px;
  height: 66px;
  border-radius: 14px;
  box-shadow: 252px 0 0 color-mix(in srgb, var(--sofa-color), #000 8%);
}

.sofa-single {
  right: 120px;
  bottom: 110px;
  width: 136px;
  height: 104px;
  border-radius: 20px;
  transform: rotate(90deg);
  transform-origin: center center;
}

.sofa-single::before {
  left: 8px;
  top: -34px;
  width: 120px;
  height: 48px;
  border-radius: 18px;
}

.sofa-single::after {
  left: -20px;
  top: 12px;
  width: 20px;
  height: 74px;
  border-radius: 12px;
  box-shadow: 156px 0 0 color-mix(in srgb, var(--sofa-color), #000 8%);
}

.sofa-l {
  left: 380px;
  bottom: 40px;
  width: 285px;
  height: 112px;
  border-radius: 20px;
}

.sofa-l::before {
  left: 154px;
  top: -46px;
  width: 120px;
  height: 46px;
  border-radius: 18px;
}

.sofa-l::after {
  left: 220px;
  top: -6px;
  width: 128px;
  height: 118px;
  border-radius: 22px;
}

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

  .viewer {
    min-height: 540px;
  }

  .sofa-l {
    left: 58%;
    transform: translateX(-30%);
  }
}

@media (max-width: 768px) {
  .viewer {
    min-height: 560px;
  }

  .window {
    width: 210px;
    height: 160px;
    top: 30px;
  }

  .wall-art {
    width: 60px;
    height: 60px;
    top: 128px;
    border-width: 5px;
  }

  .art-1 {
    left: 74px;
  }

  .art-2 {
    right: 74px;
  }

  .tv {
    width: 106px;
    height: 62px;
    top: 206px;
    right: 16px;
  }

  .tv-console {
    width: 122px;
    top: 268px;
    right: 10px;
  }

  .tv-console::before {
    left: 12px;
    width: 10px;
    height: 42px;
    box-shadow: 102px 0 0 #5a4536;
  }

  .glass-cabinet {
    width: 84px;
    height: 136px;
    left: 10px;
    bottom: 242px;
  }

  .sofa-three {
    width: 268px;
    height: 92px;
    bottom: 204px;
  }

  .sofa-three::before {
    width: 252px;
    height: 40px;
    top: -30px;
  }

  .sofa-three::after {
    width: 30px;
    height: 66px;
    box-shadow: 296px 0 0 color-mix(in srgb, var(--sofa-color), #000 8%);
  }

  .sofa-two {
    left: 46px;
    bottom: 120px;
    width: 150px;
    height: 64px;
  }

  .sofa-two::before {
    width: 136px;
    height: 28px;
    top: -24px;
  }

  .sofa-two::after {
    width: 20px;
    height: 48px;
    box-shadow: 170px 0 0 color-mix(in srgb, var(--sofa-color), #000 8%);
  }

  .sofa-single {
    right: 52px;
    bottom: 122px;
    width: 96px;
    height: 72px;
  }

  .sofa-single::before {
    width: 84px;
    height: 31px;
    top: -22px;
  }

  .sofa-single::after {
    width: 16px;
    height: 50px;
    box-shadow: 108px 0 0 color-mix(in srgb, var(--sofa-color), #000 8%);
  }

  .sofa-l {
    left: 54%;
    bottom: 40px;
    width: 188px;
    height: 74px;
    transform: translateX(-50%);
  }

  .sofa-l::before {
    left: 102px;
    top: -30px;
    width: 80px;
    height: 30px;
  }

  .sofa-l::after {
    left: 138px;
    width: 82px;
    height: 80px;
  }

  .table {
    width: 130px;
    height: 22px;
    bottom: 164px;
  }

  .table::before {
    left: 20px;
    width: 12px;
    height: 42px;
    box-shadow: 94px 0 0 #5f4938;
  }

  .rose-vase {
    width: 28px;
    height: 46px;
    bottom: 186px;
  }

  .rug {
    width: 93%;
    height: 190px;
    bottom: 16px;
  }
}
