:root {
  --bg: #f4efe6;
  --panel: rgba(255, 251, 245, 0.72);
  --panel-strong: rgba(255, 249, 240, 0.94);
  --text: #1f1b18;
  --muted: #62574c;
  --accent: #cd5c36;
  --accent-dark: #9d4122;
  --line: rgba(52, 38, 27, 0.12);
  --shadow: 0 18px 50px rgba(78, 51, 29, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(205, 92, 54, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(87, 138, 114, 0.17), transparent 26%),
    linear-gradient(145deg, #f7f0e4 0%, #efe6da 48%, #efe1d1 100%);
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) 340px;
  gap: 22px;
  align-items: end;
  margin-bottom: 24px;
}

.hero-copy {
  min-width: 0;
}

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

.hero h1 {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(1.85rem, 4.3vw, 3.8rem);
  line-height: 0.98;
}

.lede {
  max-width: 54ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.controls {
  padding: 20px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  border: 2px dashed rgba(157, 65, 34, 0.35);
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18)),
    linear-gradient(135deg, rgba(205, 92, 54, 0.14), rgba(87, 138, 114, 0.1));
  text-align: center;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.hero-dropzone {
  align-self: end;
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  overflow: hidden;
}

.dropzone.dragover {
  transform: translateY(-2px);
  border-color: rgba(157, 65, 34, 0.72);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.28)),
    linear-gradient(135deg, rgba(205, 92, 54, 0.2), rgba(87, 138, 114, 0.16));
}

.dropzone input {
  display: none;
}

.dropzone-preview {
  display: none;
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  margin: -24px;
  object-fit: cover;
}

.dropzone.has-image {
  padding: 0;
  border-style: solid;
}

.dropzone.has-image .dropzone-preview {
  display: block;
}

.dropzone-copy {
  display: block;
}

.dropzone.has-image .dropzone-copy {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: block;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 248, 241, 0.88);
  backdrop-filter: blur(10px);
}

.dropzone-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.dropzone-subtitle {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
}

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

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.parameter-stack {
  display: grid;
  gap: 12px;
}

.cube-legend {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(52, 38, 27, 0.08);
}

.cube-legend img {
  display: block;
  width: 100%;
  max-width: 240px;
  margin: 0 auto 10px;
  height: auto;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.cube-legend figcaption {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.range-block {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(52, 38, 27, 0.08);
}

.range-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.range-label-row label {
  margin-bottom: 0;
}

.multi-slider {
  display: grid;
  gap: 12px;
}

.multi-slider-track {
  position: relative;
  height: 30px;
  border-radius: 999px;
  background: rgba(52, 38, 27, 0.08);
  overflow: hidden;
}

.segment {
  position: absolute;
  top: 0;
  bottom: 0;
}

.segment-alpha {
  background: rgba(206, 60, 47, 0.62);
}

.segment-beta {
  background: rgba(73, 155, 84, 0.62);
}

.segment-gamma {
  background: rgba(49, 113, 212, 0.62);
}

.multi-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  appearance: none;
  background: none;
}

.multi-thumb::-webkit-slider-runnable-track {
  height: 30px;
  background: transparent;
}

.multi-thumb::-moz-range-track {
  height: 30px;
  background: transparent;
}

.multi-thumb::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 30px;
  border-radius: 999px;
  border: 3px solid #fffaf5;
  box-shadow: 0 4px 12px rgba(31, 27, 24, 0.18);
  cursor: pointer;
  pointer-events: auto;
}

.multi-thumb::-moz-range-thumb {
  width: 18px;
  height: 30px;
  border-radius: 999px;
  border: 3px solid #fffaf5;
  box-shadow: 0 4px 12px rgba(31, 27, 24, 0.18);
  cursor: pointer;
  pointer-events: auto;
}

.alpha-thumb {
  pointer-events: none;
}

.beta-thumb {
  pointer-events: none;
}

.alpha-thumb::-webkit-slider-thumb,
.alpha-thumb::-moz-range-thumb {
  background: #c9312d;
}

.beta-thumb::-webkit-slider-thumb,
.beta-thumb::-moz-range-thumb {
  background: #2d9b45;
}

.triple-values {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.value-alpha strong {
  color: #a82927;
}

.value-beta strong {
  color: #247939;
}

.value-gamma strong {
  color: #23589f;
}

.constraint-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

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

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  background: var(--accent);
  color: #fff8f1;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

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

button.ghost {
  background: rgba(31, 27, 24, 0.08);
  color: var(--text);
}

.note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.preview-panel {
  padding: 18px;
  background: var(--panel-strong);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.preview-card {
  margin: 0;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(52, 38, 27, 0.08);
}

.preview-card figcaption {
  margin-bottom: 10px;
  font-weight: 700;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  background:
    linear-gradient(45deg, rgba(98, 87, 76, 0.08) 25%, transparent 25%, transparent 75%, rgba(98, 87, 76, 0.08) 75%),
    linear-gradient(45deg, rgba(98, 87, 76, 0.08) 25%, transparent 25%, transparent 75%, rgba(98, 87, 76, 0.08) 75%);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

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

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 20px;
  }

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

  .hero h1 {
    max-width: 10ch;
  }
}
