:root {
  color-scheme: dark;
  --bg: #101113;
  --panel: #1a1d20;
  --panel-2: #202428;
  --line: #363c42;
  --text: #f2f0ea;
  --muted: #a7abb1;
  --soft: #cdd2d6;
  --accent: #ecbb5f;
  --accent-2: #7bd4c4;
  --danger: #ff7f70;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  min-height: 100vh;
}

.control-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  background: #151719;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(236, 187, 95, 0.95), rgba(123, 212, 196, 0.9)),
    conic-gradient(from 30deg, #f3d487, #a4dccf, #d37f6f, #f3d487);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101214;
  color: var(--text);
  outline: none;
}

input,
select {
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 10px;
  min-height: 110px;
  line-height: 1.45;
  text-transform: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.drop-zone:focus-visible {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(123, 212, 196, 0.18);
  outline: none;
}

.secret-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.icon-button,
.small-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111417;
  color: var(--text);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  text-transform: none;
  color: var(--muted);
  font-weight: 600;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

.two-cols {
  display: grid;
  grid-template-columns: minmax(96px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: end;
}

input[type="range"] {
  padding: 0;
}

.hidden {
  display: none;
}

.action-stack {
  display: grid;
  gap: 10px;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

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

.ghost-button {
  color: var(--text);
  background: transparent;
  border-color: var(--line);
}

.status {
  min-height: 42px;
  padding: 11px 12px;
  color: var(--muted);
  background: #101214;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.4;
  font-size: 13px;
}

.status.error {
  color: #ffd1cc;
  border-color: rgba(255, 127, 112, 0.55);
}

.workspace {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 18px;
  padding: 22px;
  min-width: 0;
}

.drop-zone {
  position: relative;
  min-height: 112px;
  display: grid;
  place-items: center;
  border: 1px dashed #566069;
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
    #15181a;
  background-size: 18px 18px;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background-color: #1c211f;
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-copy {
  display: grid;
  gap: 4px;
  justify-items: center;
  pointer-events: none;
}

.drop-kicker,
.drop-copy small,
.pane-head,
.analysis-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.drop-copy strong {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

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

.preview-pane {
  min-width: 0;
  display: grid;
  grid-template-rows: 42px minmax(260px, 58vh);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.mini-actions {
  display: flex;
  gap: 8px;
}

.small-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(45deg, #171a1d 25%, transparent 25%),
    linear-gradient(-45deg, #171a1d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #171a1d 75%),
    linear-gradient(-45deg, transparent 75%, #171a1d 75%),
    #111315;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.analysis-band {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 42%);
  gap: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.analysis-copy p {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.55;
}

.recipe-chips {
  display: flex;
  align-content: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 9px;
  border-radius: 7px;
  background: #111417;
  color: var(--soft);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  align-content: start;
}

.variant-card {
  display: grid;
  grid-template-rows: 180px auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.variant-card.active {
  border-color: var(--accent);
}

.variant-card canvas {
  height: 180px;
}

.variant-body {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.variant-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.variant-title-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.variant-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.select-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111417;
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-rail {
    position: static;
    height: auto;
  }

  .viewer-grid,
  .analysis-band {
    grid-template-columns: 1fr;
  }

  .recipe-chips {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .control-rail,
  .workspace {
    padding: 14px;
  }

  .drop-copy strong {
    font-size: 22px;
  }

  .preview-pane {
    grid-template-rows: 42px minmax(220px, 45vh);
  }
}
