:root {
  color-scheme: light;
  --ink: #16171a;
  --muted: #6f7480;
  --line: #d9dde5;
  --paper: #f6f3ed;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0d554f;
  --danger: #ca3f2b;
  --shadow: 0 24px 70px rgba(32, 29, 25, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(202, 63, 43, 0.1), transparent 30%),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1420px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  min-height: calc(100vh - 56px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--line);
}

.brand-block {
  display: grid;
  gap: 8px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.form-panel {
  display: grid;
  gap: 16px;
}

.auth-panel {
  display: grid;
  gap: 8px;
  padding-bottom: 4px;
}

.auth-panel[hidden] {
  display: none;
}

.auth-fields,
.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-fields {
  grid-template-columns: 1fr;
}

.auth-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-status.is-error {
  color: var(--danger);
}

.auth-status.is-success {
  color: var(--accent-dark);
}

label,
fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  color: #343840;
  font-size: 0.92rem;
  font-weight: 750;
}

fieldset {
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: #343840;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
  font-weight: 600;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input[type="range"] {
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent);
}

input[type="range"]:focus {
  box-shadow: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #d8a657);
}

input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(13, 85, 79, 0.3);
  appearance: none;
}

textarea {
  resize: vertical;
  min-height: 104px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

.upload-box {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  min-height: 86px;
  padding: 14px;
  border: 1px dashed #aeb6c3;
  border-radius: 8px;
  background: #fbfcfd;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.upload-box:hover,
.upload-box:focus-visible,
.upload-box.is-dragover {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
  outline: none;
}

.upload-box.is-loaded {
  border-style: solid;
  border-color: var(--accent);
}

.upload-box.is-error {
  border-color: var(--danger);
  background: rgba(202, 63, 43, 0.08);
}

.upload-box input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
}

.upload-box strong,
.upload-box small {
  display: block;
}

.upload-box small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
}

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

.range-field {
  gap: 6px;
}

.range-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.range-head output {
  color: var(--accent-dark);
  font-weight: 900;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.style-option,
.format-option {
  position: relative;
  display: grid;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  font-size: 0.86rem;
  cursor: pointer;
}

.style-option {
  grid-template-columns: 22px 1fr;
}

.format-option {
  place-items: center;
  text-align: center;
}

.style-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.style-option:has(input:checked),
.format-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.1);
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.68);
}

.swatch.premium {
  background: linear-gradient(135deg, #111827 0 46%, #d8a657 46% 100%);
}

.swatch.fresh {
  background: linear-gradient(135deg, #0f766e 0 46%, #f4f0e6 46% 100%);
}

.swatch.impact {
  background: linear-gradient(135deg, #ca3f2b 0 46%, #151515 46% 100%);
}

.swatch.black {
  background: linear-gradient(135deg, #020305 0 46%, #d9a84a 46% 100%);
}

.swatch.copa {
  background: linear-gradient(135deg, #0b7a38 0 34%, #f5ca36 34% 68%, #1054b1 68% 100%);
}

.swatch.hero {
  background: linear-gradient(135deg, #a31022 0 48%, #f0c74f 48% 100%);
}

.swatch.gotham {
  background: linear-gradient(135deg, #05070c 0 52%, #f3c846 52% 100%);
}

.swatch.racing {
  background:
    linear-gradient(135deg, transparent 0 50%, #e33b2f 50% 100%),
    repeating-conic-gradient(#111 0 25%, #fff 0 50%) 0 / 10px 10px;
}

.swatch.luxury {
  background: linear-gradient(135deg, #120b04 0 45%, #d8a657 45% 100%);
}

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

.download-status {
  min-height: 18px;
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.download-status.is-error {
  color: var(--danger);
}

.download-status.is-success {
  color: var(--accent-dark);
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease;
}

button.compact {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.84rem;
}

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

button.secondary {
  background: #eceff3;
  color: #333842;
}

button.secondary:hover {
  background: #dfe4ea;
}

.preview-area {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(22, 23, 26, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(22, 23, 26, 0.035) 1px, transparent 1px);
  background-size: 26px 26px;
}

.canvas-frame {
  width: min(100%, 560px);
  aspect-ratio: var(--preview-ratio, 1 / 1);
  display: grid;
  place-items: center;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--preview-ratio, 1 / 1);
  background: #fff;
  box-shadow: 0 26px 80px rgba(18, 20, 24, 0.28);
}

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

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

  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  h1 {
    max-width: 100%;
  }

  .preview-area {
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .controls,
  .preview-area {
    padding: 18px;
  }

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