:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --bg: #f5f7f8;
  --ink: #0b2545;
  --muted: #637083;
  --line: #d8e0e8;
  --panel: #ffffff;
  --accent: #1f7a5b;
  --accent-dark: #155b44;
  --steel: #6e7d8b;
  --shadow: 0 24px 80px rgba(11, 37, 69, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(235, 241, 245, 0.9), rgba(245, 247, 248, 0.96)),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.visualizer-shell {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 24px;
  width: min(1480px, calc(100vw - 40px));
  margin: 20px auto;
  min-height: calc(100vh - 40px);
}

.toolbar,
.stage-card {
  background: var(--panel);
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toolbar {
  padding: 22px;
  align-self: start;
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-lockup p,
.stage-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.brand-lockup h1,
.stage-header h2 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
}

#photoInput {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px dashed #9db0c0;
  border-radius: 8px;
  background: #f8fafb;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.upload-card:hover {
  border-color: var(--accent);
  background: #f2fbf7;
  transform: translateY(-1px);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e9f5ef;
  color: var(--accent-dark);
  grid-row: 1 / 3;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-card strong,
.upload-card small {
  display: block;
  grid-column: 2;
}

.upload-card strong {
  font-size: 15px;
  line-height: 1.25;
}

.upload-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field-group {
  margin-top: 18px;
}

.field-group > label,
.control-grid label {
  display: block;
  color: #26384d;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

output {
  float: right;
  color: var(--accent-dark);
  font-weight: 800;
}

.product-list {
  display: grid;
  gap: 8px;
  max-height: 255px;
  overflow: auto;
  padding-right: 3px;
  margin-top: 9px;
}

.product-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 84px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #31445a;
  text-align: left;
  cursor: pointer;
  padding: 8px;
}

.product-card.is-active {
  border-color: var(--accent);
  background: #e9f7f1;
  box-shadow: inset 0 0 0 1px rgba(31, 122, 91, 0.15);
}

.product-card img {
  width: 58px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e1e7ed;
  background: #fff;
}

.product-card strong,
.product-card span,
.product-card small {
  display: block;
}

.product-card strong {
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink);
}

.product-card small {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.product-card span {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  text-align: right;
}

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

select,
input[type="number"] {
  width: 100%;
  height: 42px;
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  padding: 0 11px;
  font-weight: 700;
}

.number-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  align-items: end;
}

.number-row span {
  display: grid;
  place-items: center;
  height: 42px;
  border-radius: 8px;
  background: #f3f6f8;
  color: var(--muted);
  font-weight: 800;
}

.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.swatches {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.swatch {
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.swatch.is-active {
  box-shadow: 0 0 0 3px rgba(31, 122, 91, 0.25), 0 0 0 1px var(--accent);
}

.control-grid {
  display: grid;
  gap: 14px;
  padding-top: 18px;
}

.price-card {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: #0b2545;
  color: #fff;
}

.price-card span,
.price-card small {
  display: block;
}

.price-card span {
  color: #cbd7e3;
  font-size: 12px;
  font-weight: 700;
}

.price-card strong {
  display: block;
  margin-top: 4px;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

.price-card small {
  margin-top: 7px;
  color: #b8c7d6;
  font-size: 11px;
  line-height: 1.35;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.secondary {
  background: #fff;
  border-color: var(--line);
  color: #26384d;
}

.stage-card {
  min-width: 0;
  padding: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

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

.stage-header h2 {
  font-size: 25px;
}

#statusText {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: #eef3f6;
  color: #42556b;
  font-size: 12px;
  font-weight: 800;
}

.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 520px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(11, 37, 69, 0.12), rgba(31, 122, 91, 0.08)),
    #dde6ec;
  border: 1px solid var(--line);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 160px);
  cursor: grab;
}

canvas.is-dragging {
  cursor: grabbing;
}

.hint-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.hint-row span {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f3f6f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .visualizer-shell {
    grid-template-columns: 1fr;
    width: min(760px, calc(100vw - 28px));
    margin: 14px auto;
  }

  .canvas-wrap {
    min-height: 360px;
  }

  .stage-header {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .toolbar,
  .stage-card {
    padding: 14px;
  }

  .brand-lockup h1,
  .stage-header h2 {
    font-size: 22px;
  }

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

  .product-list {
    max-height: 350px;
  }
}
