:root {
  --ink: #15120f;
  --paper: #fff8ec;
  --mint: #b8f36b;
  --pink: #ff5ea8;
  --blue: #49b7ff;
  --violet: #6f4dff;
  --orange: #ff9b3d;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(184, 243, 107, 0.32), transparent 34%),
    linear-gradient(225deg, rgba(255, 94, 168, 0.25), transparent 38%),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.brand-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.badge {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  background: var(--mint);
  box-shadow: 5px 5px 0 var(--ink);
  font-weight: 900;
}

.generator {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(300px, 1.05fr);
  gap: 18px;
  align-items: stretch;
}

.upload-zone,
.controls {
  border: 2px solid var(--ink);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 7px 7px 0 var(--ink);
}

.upload-zone {
  position: relative;
  min-height: 430px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.empty-upload {
  width: 100%;
  min-height: 430px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 18, 15, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(21, 18, 15, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, rgba(73, 183, 255, 0.22), rgba(255, 155, 61, 0.25));
  background-size: 32px 32px, 32px 32px, auto;
  border: 0;
  cursor: pointer;
  font-weight: 900;
  font-size: 1.18rem;
}

.upload-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  background: #fff;
  font-size: 2rem;
  line-height: 1;
}

.preview {
  width: 100%;
  height: 100%;
  max-height: 560px;
  object-fit: cover;
  display: block;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 10px;
}

.icon-button,
.download-button {
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  font-weight: 950;
}

.icon-button:hover,
.download-button:hover {
  background: var(--mint);
}

.controls {
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 20px;
}

.control-block {
  display: grid;
  gap: 10px;
}

.control-label {
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--ink);
}

.segmented button {
  min-height: 50px;
  border: 0;
  border-right: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--blue);
}

.intensity-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.intensity-row span {
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 2px solid var(--ink);
  background: #fff;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 900;
}

.intensity-row span:nth-child(2) {
  background: var(--orange);
}

.intensity-row span:nth-child(3) {
  color: #fff;
  background: var(--violet);
}

.consent {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 0.96rem;
  line-height: 1.38;
}

.consent input {
  width: 20px;
  height: 20px;
  accent-color: var(--pink);
}

.honeypot {
  display: none;
}

.generate-button {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid var(--ink);
  background: var(--pink);
  color: #fff;
  box-shadow: 5px 5px 0 var(--ink);
  font-weight: 950;
  cursor: pointer;
}

.generate-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.spin {
  display: inline-block;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  margin: 0;
  border: 2px solid #b00020;
  background: #fff;
  padding: 12px;
  color: #8a0019;
  font-weight: 750;
}

.results-zone {
  min-height: 210px;
}

.results-grid,
.loading-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.result-card {
  border: 2px solid var(--ink);
  background: #fff;
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
}

.result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f2f2f2;
}

.result-meta {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-top: 2px solid var(--ink);
}

.result-meta p,
.result-meta span {
  margin: 0;
}

.result-meta p {
  font-weight: 950;
}

.result-meta span {
  display: block;
  margin-top: 3px;
  font-size: 0.88rem;
  color: rgba(21, 18, 15, 0.72);
}

.loading-grid div {
  min-height: 270px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.1) 30%, rgba(255, 255, 255, 0.75) 44%, rgba(255, 255, 255, 0.1) 60%),
    linear-gradient(135deg, rgba(73, 183, 255, 0.35), rgba(255, 94, 168, 0.32), rgba(184, 243, 107, 0.34));
  background-size: 240% 100%, auto;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  to {
    background-position: -160% 0, 0 0;
  }
}

footer {
  padding: 10px 0 0;
  font-size: 0.86rem;
  color: rgba(21, 18, 15, 0.72);
}

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

  .brand-strip,
  .generator {
    grid-template-columns: 1fr;
  }

  .brand-strip {
    display: grid;
    align-items: start;
  }

  .badge {
    width: max-content;
  }

  .upload-zone,
  .empty-upload {
    min-height: 330px;
  }

  .results-grid,
  .loading-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 2.35rem;
  }

  .controls {
    padding: 16px;
  }

  .intensity-row {
    grid-template-columns: 1fr;
  }

  .segmented button,
  .generate-button {
    min-height: 54px;
  }
}
