:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101312;
  color: #f3f7f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: auto;
  background:
    linear-gradient(135deg, rgba(39, 66, 54, 0.9), rgba(16, 19, 18, 0.95)),
    radial-gradient(circle at 85% 15%, rgba(226, 198, 92, 0.22), transparent 32%);
}

canvas {
  display: block;
}

#app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  pointer-events: none;
}

.panel {
  width: min(760px, 100%);
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(243, 247, 244, 0.18);
  border-radius: 8px;
  background: rgba(10, 13, 12, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 8px;
  color: #e8c75e;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.1rem);
  line-height: 1;
}

#status {
  min-height: 3.2em;
  margin: 16px 0 20px;
  color: #cdd8d0;
  line-height: 1.45;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.primary-action {
  width: min(170px, 38vw);
  flex: 0 0 auto;
  background: #e8c75e;
  color: #16150f;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.model-card {
  min-width: 0;
  min-height: 132px;
  display: grid;
  gap: 10px;
  align-content: center;
  justify-items: center;
  padding: 12px;
  border: 1px solid rgba(243, 247, 244, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f3f7f4;
}

.model-card.selected {
  border-color: #e8c75e;
  background: rgba(232, 199, 94, 0.16);
}

.model-card span:last-child {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.model-preview {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: linear-gradient(145deg, #2f80ed, #80c7ff);
  box-shadow: inset -10px -10px 18px rgba(0, 0, 0, 0.26), 0 10px 28px rgba(0, 0, 0, 0.28);
}

.cube-preview {
  transform: rotateX(56deg) rotateZ(42deg);
  border-radius: 4px;
}

.bath-preview {
  background: linear-gradient(145deg, #f6f0dc, #5db2aa 58%, #273b36);
}

.cozy-preview {
  background: linear-gradient(145deg, #ecd28b, #98aa68 48%, #31483d);
}

.sdb-preview {
  background: linear-gradient(145deg, #b8d4e8, #d4d7d4 48%, #3d4d57);
}

.scale-control {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  color: #dfe8e1;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  margin-top: 10px;
  accent-color: #e8c75e;
}

.ar-active .panel {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  width: auto;
  max-width: 520px;
  padding: 12px;
}

.ar-active .header {
  display: none;
}

.ar-active #status {
  min-height: 0;
  margin: 0 0 10px;
  font-size: 0.86rem;
}

.ar-active .model-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ar-active .model-card {
  min-height: 66px;
  gap: 5px;
  padding: 7px 5px;
}

.ar-active .model-preview {
  width: 28px;
  height: 28px;
  border-radius: 5px;
}

.ar-active .model-card span:last-child {
  font-size: 0.72rem;
}

.ar-active .scale-control {
  margin-top: 10px;
  font-size: 0.82rem;
}

.ar-active input[type="range"] {
  margin-top: 4px;
}

@media (max-width: 620px) {
  .header {
    display: grid;
  }

  .primary-action {
    width: 100%;
  }

  .model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
