:root {
  color-scheme: light;
  --ink: #15181d;
  --muted: #68717d;
  --line: rgba(20, 24, 29, 0.12);
  --panel: rgba(255, 255, 255, 0.88);
  --accent: #0f7b73;
  --accent-dark: #0a5954;
  --light-color: #ffd38a;
  --light-strength: 1;
  --model-scale: 1;
  --model-rotation: 0deg;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: #eef1ef;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  overflow: hidden;
}

.selection-screen {
  position: relative;
  display: flex;
  min-height: 100vh;
  padding: 28px;
  flex-direction: column;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.8), rgba(229, 235, 233, 0.64)),
    url("data:image/svg+xml,%3Csvg width='1200' height='900' viewBox='0 0 1200 900' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1200' height='900' fill='%23e5ebe8'/%3E%3Cpath d='M0 618h1200v282H0z' fill='%23d4ddd8'/%3E%3Cpath d='M60 140h460v350H60zM680 118h350v260H680z' fill='%23f8faf8'/%3E%3Cpath d='M96 178h388v276H96zM716 154h278v188H716z' fill='%23cbd8d6'/%3E%3Cpath d='M780 570h250v36H780zM820 606h170v180H820z' fill='%237f918d'/%3E%3Cpath d='M170 640h280v54H170zM140 694h340v110H140z' fill='%2397a7a2'/%3E%3Ccircle cx='885' cy='260' r='74' fill='%23f0c970' opacity='.65'/%3E%3C/svg%3E");
  background-position: center;
  background-size: cover;
}

.brand-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: #283033;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(15, 123, 115, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
}

.selection-layout {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(280px, 0.78fr) minmax(320px, 1fr);
  gap: 36px;
  align-items: center;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 34px 0 90px;
}

.intro-copy {
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.intro-copy p:last-child {
  max-width: 560px;
  margin: 22px 0 0;
  color: #384248;
  font-size: 1.05rem;
  line-height: 1.7;
}

.lighting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.lighting-card {
  display: flex;
  min-height: 300px;
  padding: 18px;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 60px rgba(20, 24, 29, 0.12);
  color: var(--ink);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.lighting-card:hover,
.lighting-card:focus-visible {
  transform: translateY(-4px);
}

.lighting-card.is-selected {
  border-color: rgba(15, 123, 115, 0.72);
  background: rgba(239, 255, 252, 0.88);
}

.lamp-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 170px;
  margin-bottom: 20px;
}

.lamp-preview::before,
.lamp-preview::after {
  position: absolute;
  left: 50%;
  content: "";
  transform: translateX(-50%);
}

.lamp-preview--pendant::before {
  top: 0;
  width: 2px;
  height: 68px;
  background: #263034;
}

.lamp-preview--pendant::after {
  top: 58px;
  width: 112px;
  height: 74px;
  border-radius: 70px 70px 24px 24px;
  background: linear-gradient(#2d3338 0 50%, var(--light-color) 51%);
  box-shadow: 0 28px 54px rgba(255, 193, 96, 0.45);
}

.lamp-preview--floor::before {
  bottom: 22px;
  width: 6px;
  height: 106px;
  border-radius: 99px;
  background: #293237;
}

.lamp-preview--floor::after {
  top: 18px;
  width: 88px;
  height: 60px;
  border-radius: 60px 60px 20px 20px;
  background: linear-gradient(#253038 0 48%, #fff1be 49%);
  box-shadow: 0 32px 64px rgba(255, 211, 138, 0.42);
}

.lamp-preview--table::before {
  bottom: 28px;
  width: 54px;
  height: 74px;
  border-radius: 12px;
  background: #384246;
}

.lamp-preview--table::after {
  top: 28px;
  width: 118px;
  height: 66px;
  border-radius: 24px 24px 18px 18px;
  background: linear-gradient(#2f393d 0 44%, #e5f2ff 45%);
  box-shadow: 0 34px 60px rgba(192, 222, 255, 0.48);
}

.card-title {
  font-size: 1rem;
  font-weight: 800;
}

.card-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.primary-action {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(15, 123, 115, 0.28);
}

.ar-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #101418;
}

.camera-feed,
.camera-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-fallback {
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(12, 16, 19, 0.22), rgba(12, 16, 19, 0.42)),
    radial-gradient(circle at 54% 28%, rgba(255, 213, 137, 0.34), transparent 28%),
    linear-gradient(115deg, #c5cfca, #eef0ed 42%, #9faea9);
}

.camera-fallback.is-hidden {
  display: none;
}

.fallback-room {
  position: relative;
  width: min(680px, 82vw);
  height: min(420px, 58vh);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(44, 52, 54, 0.42) 0 1px, transparent 1px 100%) 0 0 / 80px 80px,
    linear-gradient(rgba(44, 52, 54, 0.26) 0 1px, transparent 1px 100%) 0 0 / 80px 80px,
    rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 -110px 0 rgba(82, 93, 93, 0.18);
}

.fallback-room span {
  position: absolute;
  bottom: 70px;
  width: 18%;
  height: 28%;
  border-radius: 8px 8px 0 0;
  background: rgba(53, 66, 68, 0.32);
}

.fallback-room span:nth-child(1) {
  left: 12%;
}

.fallback-room span:nth-child(2) {
  right: 12%;
  width: 26%;
  height: 16%;
}

.fallback-room span:nth-child(3) {
  left: 44%;
  width: 12%;
  height: 46%;
}

.scan-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 42px 42px;
  mask-image: radial-gradient(circle at 50% 48%, #000 0 38%, transparent 68%);
  opacity: 0.42;
}

.scan-layer span {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 48%;
  height: 2px;
  background: rgba(111, 235, 217, 0.7);
  box-shadow: 0 0 24px rgba(111, 235, 217, 0.9);
  animation: scan 3.8s ease-in-out infinite;
}

@keyframes scan {
  0%,
  100% {
    transform: translateY(-120px);
  }
  50% {
    transform: translateY(120px);
  }
}

.ar-topbar {
  position: absolute;
  z-index: 8;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #fff;
  pointer-events: none;
}

.ar-topbar > * {
  pointer-events: auto;
}

.ar-topbar p,
.ar-topbar strong {
  display: block;
  margin: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.ar-topbar p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
}

.ar-topbar strong {
  font-size: 1.05rem;
}

.icon-button,
.outline-action {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(10, 14, 18, 0.42);
  color: #fff;
  backdrop-filter: blur(18px);
}

.icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  font-size: 2rem;
  line-height: 1;
}

.outline-action {
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.9rem;
  font-weight: 750;
}

.placement-area {
  position: absolute;
  inset: 0;
  z-index: 4;
  touch-action: none;
}

.placement-target {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(58vw, 420px);
  height: min(58vw, 420px);
  transform:
    translate(-50%, -50%)
    scale(var(--model-scale))
    rotate(var(--model-rotation));
  transform-origin: 50% 58%;
  touch-action: none;
}

.lighting-model {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  background: transparent;
  filter: drop-shadow(0 38px 32px rgba(0, 0, 0, 0.36));
}

.light-aura {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 78%;
  height: 78%;
  border-radius: 999px;
  background: radial-gradient(circle, var(--light-color) 0 12%, transparent 68%);
  filter: blur(12px);
  opacity: calc(0.34 * var(--light-strength));
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
}

.placement-target::after {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 58%;
  height: 18%;
  border-radius: 999px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.34), transparent 68%);
  content: "";
  transform: translateX(-50%);
}

.ar-launch {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #11171b;
  font-size: 0.9rem;
  font-weight: 850;
}

.control-dock {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 18px;
  display: grid;
  width: min(760px, calc(100vw - 36px));
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
  backdrop-filter: blur(22px);
}

.dock-handle {
  display: none;
}

.control-row--compact {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.control-title,
.control-field span,
.color-control > span {
  color: #20262b;
  font-size: 0.82rem;
  font-weight: 850;
}

.control-hint {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.control-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.color-control {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.color-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.swatch,
input[type="color"] {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(20, 24, 29, 0.16);
  border-radius: 999px;
  background: var(--swatch);
  padding: 0;
}

.swatch.is-active {
  outline: 3px solid rgba(15, 123, 115, 0.24);
  border-color: var(--accent);
}

input[type="color"] {
  overflow: hidden;
  background: transparent;
}

[hidden] {
  display: none !important;
}

@media (max-width: 920px) {
  .selection-screen {
    min-height: 100svh;
    padding: 20px;
  }

  .selection-layout {
    grid-template-columns: 1fr;
    gap: 26px;
    align-content: start;
    padding: 44px 0 94px;
  }

  h1 {
    font-size: clamp(2.05rem, 10vw, 3.2rem);
    line-height: 1.05;
  }

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

  .lighting-card {
    min-height: 150px;
    display: grid;
    grid-template-columns: 132px 1fr;
    column-gap: 16px;
    align-items: center;
    justify-content: start;
  }

  .lamp-preview {
    height: 118px;
    margin: 0;
    grid-row: 1 / span 2;
  }

  .primary-action {
    position: sticky;
    left: auto;
    right: auto;
    bottom: 20px;
    width: 100%;
    margin-top: 16px;
  }

  .control-dock {
    grid-template-columns: 1fr 1fr;
    bottom: 10px;
    width: calc(100vw - 20px);
    padding: 16px;
    gap: 13px;
  }

  .dock-handle {
    display: block;
    grid-column: 1 / -1;
    justify-self: center;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(31, 38, 42, 0.22);
  }

  .control-row--compact,
  .color-control {
    grid-column: 1 / -1;
  }

  .placement-target {
    top: 39%;
    width: min(74vw, 360px);
    height: min(74vw, 360px);
  }
}

@media (max-width: 520px) {
  .intro-copy p:last-child {
    font-size: 0.98rem;
  }

  .lighting-card {
    min-height: 132px;
    grid-template-columns: 106px 1fr;
    padding: 14px;
  }

  .lamp-preview {
    height: 100px;
  }

  .control-dock {
    grid-template-columns: 1fr;
    max-height: 47svh;
    overflow: auto;
  }

  .ar-topbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }
}
