:root {
  --sand-50: #fdf8f3;
  --sand-100: #f7efe6;
  --clay-200: #efd8c4;
  --peach-300: #e6b899;
  --ink-900: #1f1b16;
  --ink-700: #3b332b;
  --teal-500: #2b7a78;
  --sun-400: #f2a35f;
  --white: #ffffff;
  --shadow: 0 30px 60px rgba(31, 27, 22, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink-900);
  background: linear-gradient(120deg, var(--sand-50), var(--sand-100));
  min-height: 100vh;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 20%, rgba(242, 163, 95, 0.35), transparent 45%),
    radial-gradient(circle at 90% 15%, rgba(43, 122, 120, 0.3), transparent 40%),
    radial-gradient(circle at 40% 85%, rgba(239, 216, 196, 0.8), transparent 55%);
  filter: blur(0.5px);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  display: grid;
  gap: 32px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(31, 27, 22, 0.08);
  display: grid;
  gap: 12px;
  animation: rise 0.8s ease-out both;
}

.login-card h1 {
  margin: 0;
  font-family: "Fraunces", serif;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 8px;
}

.error {
  margin: 0;
  color: #b9432f;
  font-weight: 600;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--ink-700);
}

.topbar .user {
  font-weight: 600;
}

.hero {
  display: grid;
  gap: 12px;
  animation: rise 0.8s ease-out both;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--teal-500);
  margin: 0;
}

.hero h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2.4rem, 4vw, 3.6rem);
}

.subtitle {
  margin: 0;
  font-size: 1.05rem;
  max-width: 600px;
  color: var(--ink-700);
}

.panel {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(31, 27, 22, 0.08);
  animation: rise 0.8s ease-out 0.1s both;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field.full {
  grid-column: span 2;
}

label {
  font-weight: 600;
}

textarea,
select,
input {
  border-radius: 16px;
  border: 1px solid rgba(31, 27, 22, 0.15);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.98rem;
  background: var(--white);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input[type="file"] {
  padding: 10px;
}

textarea:focus,
select:focus,
input:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(43, 122, 120, 0.18);
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-700);
}

.actions {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 16px;
}

.inline-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: linear-gradient(120deg, var(--teal-500), #3ea39a);
  color: var(--white);
  box-shadow: 0 12px 24px rgba(43, 122, 120, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(43, 122, 120, 0.3);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.ghost {
  background: transparent;
  color: var(--ink-900);
  border: 1px solid rgba(31, 27, 22, 0.2);
  box-shadow: none;
}

.status {
  font-size: 0.9rem;
  color: var(--ink-700);
}

.results {
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(31, 27, 22, 0.08);
  animation: rise 0.8s ease-out 0.2s both;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.results h2 {
  margin: 0;
  font-family: "Fraunces", serif;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.image-card {
  border-radius: 20px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid rgba(31, 27, 22, 0.08);
  box-shadow: 0 14px 30px rgba(31, 27, 22, 0.12);
  transform: translateY(6px);
  opacity: 0;
  animation: lift 0.5s ease-out forwards;
  display: grid;
}

.image-card img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.image-meta {
  padding: 12px 14px 0;
  display: grid;
  gap: 8px;
}

.image-meta .prompt {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-700);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.badge {
  justify-self: start;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(43, 122, 120, 0.12);
  color: var(--teal-500);
}

.image-actions {
  padding: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(255, 255, 255, 0.9);
}

button.small {
  padding: 8px 18px;
  font-size: 0.85rem;
}

.link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.link-button.ghost {
  padding: 8px 18px;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 999px;
}

.link-button:visited {
  color: inherit;
}

.preview {
  display: grid;
  gap: 10px;
}

.preview img {
  width: min(180px, 100%);
  height: 180px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(31, 27, 22, 0.12);
  box-shadow: 0 10px 20px rgba(31, 27, 22, 0.12);
}

.empty-state {
  color: var(--ink-700);
  font-size: 0.95rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .field.full,
  .actions {
    grid-column: span 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
