:root {
  color-scheme: light;
  --bg: #eef1f3;
  --surface: #fbfcfd;
  --surface-strong: #ffffff;
  --ink: #161a1d;
  --muted: #68717a;
  --line: #ccd4db;
  --teal: #0f8f8a;
  --teal-dark: #096461;
  --amber: #d88a12;
  --rose: #c74461;
  --blue: #326fc0;
  --shadow: 0 20px 50px rgba(25, 36, 48, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover {
  border-color: #87939d;
}

button.is-active,
button:active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.app-shell {
  width: min(1780px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 2.4vw, 3rem);
  line-height: 1;
}

h2 {
  font-size: 0.9rem;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.visually-hidden {
  block-size: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  inline-size: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.workspace {
  display: grid;
  gap: 14px;
  grid-template-columns: 270px minmax(460px, 1fr) 380px;
}

.panel,
.canvas-area,
.preview-area {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  min-width: 0;
  padding: 14px;
}

.controls-panel {
  align-self: start;
}

.control-group {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 0 0 14px;
}

.control-group + .control-group {
  padding-top: 14px;
}

.control-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.segmented {
  background: #e5eaee;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
}

.segmented button {
  border: 0;
  min-height: 34px;
  padding: 0 8px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
}

input,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 38px;
  padding: 0 10px;
  width: 100%;
}

input[type="range"] {
  accent-color: var(--teal);
  padding: 0;
}

.build-time-panel {
  gap: 12px;
}

.build-time-total {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  padding: 11px;
}

.build-time-total span,
.build-time-split span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.build-time-total strong {
  color: var(--teal-dark);
  font-size: 1.55rem;
  line-height: 1.05;
}

.build-time-split {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.build-time-split div {
  background: #eef5f7;
  border: 1px solid #c8dce2;
  border-radius: 8px;
  display: grid;
  gap: 3px;
  padding: 9px;
}

.build-time-split strong {
  font-size: 0.95rem;
  line-height: 1.15;
}

.inline-input {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.inline-input span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.two-up {
  grid-template-columns: 1fr 1fr;
}

.canvas-area,
.preview-area {
  min-width: 0;
  overflow: hidden;
}

.canvas-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.canvas-header p,
.summary-hero p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 3px;
}

.scale-pill {
  background: #e5f4f2;
  border: 1px solid #b9dfdb;
  border-radius: 999px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 7px 10px;
  white-space: nowrap;
}

canvas {
  display: block;
  width: 100%;
}

#planCanvas {
  aspect-ratio: 49 / 36;
  cursor: crosshair;
  touch-action: none;
}

#previewCanvas,
#fpvCanvas {
  aspect-ratio: 35 / 13;
  cursor: grab;
  touch-action: none;
}

#previewCanvas:active,
#fpvCanvas:active {
  cursor: grabbing;
}

#fpvCanvas {
  outline: none;
}

#fpvCanvas:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(15, 143, 138, 0.45);
}

.fpv-header-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#fpvVrButton button {
  bottom: auto !important;
  left: auto !important;
  position: static !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
}

.summary-panel {
  align-self: start;
}

.summary-hero {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.summary-hero > div {
  background: #171b1f;
  border-radius: 8px;
  min-width: 0;
  padding: 14px;
}

.summary-hero p {
  color: #b6c1c9;
}

.summary-hero strong {
  color: #fff;
  display: block;
  font-size: clamp(1.45rem, 2.2vw, 2.15rem);
  line-height: 1;
  margin-top: 7px;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.breakdown {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.breakdown-list,
.wall-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.breakdown-row,
.wall-row {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  padding: 10px;
}

.wall-row {
  position: relative;
}

.wall-row:hover,
.wall-row.is-hovered {
  border-color: #f2b441;
  box-shadow: inset 0 0 0 1px #f2b441;
}

.wall-delete-button {
  align-items: center;
  background: #ffffff;
  border-color: #d6a23a;
  border-radius: 999px;
  color: #7a4c00;
  display: inline-flex;
  height: 26px;
  justify-content: center;
  min-height: 0;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 120ms ease;
  width: 26px;
}

.wall-row:hover .wall-delete-button,
.wall-row.is-hovered .wall-delete-button,
.wall-row:focus-within .wall-delete-button {
  opacity: 1;
  pointer-events: auto;
}

.wall-delete-button:hover {
  background: #fff7e0;
  border-color: #b97800;
}

.wall-delete-button svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 15px;
}

.swatch {
  border-radius: 5px;
  height: 18px;
  width: 18px;
}

.row-title {
  font-size: 0.86rem;
  font-weight: 850;
  min-width: 0;
}

.row-meta {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  margin-top: 2px;
}

.row-value {
  font-weight: 900;
}

.preview-area {
  margin-top: 14px;
}

.empty-state {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 12px 0;
}

@media (max-width: 1160px) {
  .workspace {
    grid-template-columns: 260px minmax(420px, 1fr);
  }

  .summary-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .canvas-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
