:root {
  --canvas: #0d0f12;
  --ink: #f6f8fb;
  --ink-strong: #ffffff;
  --body: #d6dce5;
  --body-mid: #9aa6b5;
  --mute: #748091;
  --hairline: #29313c;
  --accent-purple: #8b5cf6;
  --accent-pink: #f472b6;
  --accent-blue: #38bdf8;
  --accent-orange: #fb923c;
  --accent-green: #34d399;
  --accent-red: #ee1d36;
  --shadow-layered: 0 28px 80px rgba(0, 0, 0, 0.42), 0 8px 24px rgba(0, 0, 0, 0.32);
  --radius-sm: 4px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body {
  background: radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.1), transparent 32%), var(--canvas);
  height: 100%;
  margin: 0;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  gap: 14px;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  padding: 16px;
}

.intro-band {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0 auto;
  max-width: 1600px;
  width: 100%;
}

.eyebrow {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1.5px;
  line-height: 1.3;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.eyebrow.small {
  font-size: 12px;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

h1 {
  font-size: clamp(44px, 7vw, 80px);
  font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.04;
  margin: 0;
  max-width: 920px;
}

h2 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
}

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

.button {
  align-items: center;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-size: 16px;
  font-weight: 500;
  justify-content: center;
  line-height: 25.6px;
  min-height: 44px;
  padding: 12px 20px;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: #0d0f12;
}

.button-secondary {
  background: #151a21;
  border: 1px solid var(--hairline);
  color: var(--ink);
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1600px;
  min-height: 0;
  width: 100%;
}

.control-panel,
.preview-panel {
  background: #141820;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
}

.control-panel {
  align-self: stretch;
  display: grid;
  gap: 16px;
  max-height: 100%;
  overflow: auto;
  padding: 16px;
}

.drop-zone {
  background: #10141a;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius-md);
  min-height: 132px;
  overflow: hidden;
  padding: 18px;
  position: relative;
}

.drop-zone.dragging {
  box-shadow: var(--shadow-layered);
}

.drop-zone input {
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
}

.drop-accent {
  background: linear-gradient(
    90deg,
    var(--accent-purple),
    var(--accent-pink),
    var(--accent-blue),
    var(--accent-orange),
    var(--accent-green)
  );
  height: 8px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.drop-title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  margin: 22px 0 6px;
}

.drop-copy,
.status-message,
.preview-toolbar p,
.control-header span {
  color: var(--body-mid);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.control-group {
  display: grid;
  gap: 12px;
}

.control-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.segmented-control {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 2px;
}

.segment {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--body-mid);
  font-size: 14px;
  font-weight: 500;
  min-height: 40px;
}

.segment.active {
  background: var(--ink);
  color: #0d0f12;
}

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

.field,
.color-field,
.toggle-field {
  background: #10141a;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 8px;
  padding: 12px;
}

.field span,
.color-field span,
.toggle-field span {
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
}

.field output {
  color: var(--body-mid);
  font-size: 12px;
}

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

.background-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

input[type="color"] {
  background: transparent;
  border: 0;
  height: 36px;
  padding: 0;
  width: 100%;
}

.toggle-field {
  align-content: center;
  grid-template-columns: auto 1fr;
}

.toggle-field input {
  accent-color: var(--ink);
  height: 18px;
  width: 18px;
}

.image-list-wrap {
  min-height: 96px;
}

.image-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.image-item {
  background: #10141a;
  align-items: center;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 10px;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  min-height: 64px;
  padding: 8px;
}

.image-item img {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  object-fit: cover;
  width: 48px;
}

.image-meta {
  min-width: 0;
}

.image-meta strong,
.image-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-meta strong {
  font-size: 14px;
  font-weight: 500;
}

.image-meta span {
  color: var(--mute);
  font-size: 12px;
  margin-top: 2px;
}

.item-actions {
  display: flex;
  gap: 4px;
}

.icon-button {
  background: #10141a;
  border: 1px solid var(--hairline);
  border-radius: 9999px;
  color: var(--ink);
  height: 32px;
  line-height: 1;
  width: 32px;
}

.icon-button.remove {
  color: var(--accent-red);
}

.status-message {
  color: var(--body);
  min-height: 22px;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.preview-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
}

.preview-toolbar .eyebrow {
  margin: 0;
}

.canvas-stage {
  align-items: center;
  background-color: #10141a;
  background-image: linear-gradient(45deg, #151b23 25%, transparent 25%),
    linear-gradient(-45deg, #151b23 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #151b23 75%),
    linear-gradient(-45deg, transparent 75%, #151b23 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  position: relative;
}

canvas {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-layered);
  display: none;
  max-height: 100%;
  max-width: 100%;
}

canvas.visible {
  display: block;
}

.empty-state {
  align-items: center;
  background: #151a21;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  display: grid;
  gap: 16px;
  justify-items: center;
  max-width: 360px;
  padding: 32px;
  text-align: center;
}

.empty-state.hidden {
  display: none;
}

.empty-state p {
  color: var(--body);
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
}

.empty-mark {
  background: var(--accent-blue);
  border-radius: var(--radius-md);
  box-shadow: 28px 0 0 var(--accent-pink), 56px 0 0 var(--accent-orange);
  display: block;
  height: 56px;
  transform: translateX(-28px);
  width: 56px;
}

@media (max-width: 991px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    padding: 14px;
  }

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

  .intro-actions {
    justify-content: start;
  }
}

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

  h1 {
    font-size: 42px;
  }

  .control-panel {
    padding: 16px;
  }

  .intro-actions,
  .control-grid,
  .background-row {
    grid-template-columns: 1fr;
  }

  .intro-actions {
    display: grid;
  }

  .button {
    width: 100%;
  }

  .image-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .item-actions {
    grid-column: 1 / -1;
  }

  .preview-panel {
    grid-template-rows: auto minmax(360px, 1fr);
  }

  .canvas-stage {
    min-height: 360px;
    padding: 14px;
  }
}

.grid-field[hidden],
.grid-controls[hidden] {
  display: none;
}

.field input[type="number"] {
  background: #0d0f12;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--ink);
  min-height: 36px;
  padding: 6px 8px;
  width: 100%;
}

canvas.draggable {
  cursor: grab;
  touch-action: none;
}

canvas.dragging {
  cursor: grabbing;
}

.intro-band .eyebrow {
  margin: 0;
}
