:root {
  --bg: #0d0d12;
  --panel: #13131a;
  --panel-2: #181823;
  --text: #f5f5f7;
  --muted: #9b9ba6;
  --accent: #ff6b35;
  --border: #262634;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 50;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.35s ease;
  box-shadow: 0 0 12px rgba(255, 107, 53, 0.6);
}

#view {
  min-height: 100vh;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(120px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#view.is-ready {
  opacity: 1;
  transform: translateY(0);
}

h1, h2 {
  margin: 0;
}

h2 {
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--muted);
}

.home {
  min-height: calc(100vh - 4px);
  display: grid;
  gap: 28px;
  align-content: center;
  padding: 24px;
  background: radial-gradient(140% 140% at 20% 0%, #1b1b28 0%, #0d0d12 55%, #0a0a10 100%);
  border-radius: 24px;
}

.home-content h1 {
  font-size: 2.8rem;
  line-height: 1.05;
  margin-top: 12px;
  margin-bottom: 12px;
}

.home-content p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.home-media {
  display: grid;
}

.poster-frame {
  position: relative;
  border-radius: 22px;
  background: radial-gradient(circle at top, #1a1a24, #0b0b12);
  border: 1px solid var(--border);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.poster-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-placeholder {
  display: grid;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.poster-icon {
  font-size: 2rem;
}

.home-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-primary,
.btn-ghost {
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #120b08;
  box-shadow: 0 10px 24px rgba(255, 107, 53, 0.28);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-primary.full {
  width: 100%;
}

.card {
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 107, 53, 0.6), 0 12px 28px rgba(0, 0, 0, 0.4);
}

.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 107, 53, 0.8), 0 12px 28px rgba(0, 0, 0, 0.4);
}

.screen {
  min-height: calc(100vh - 4px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.species-screen {
  justify-content: center;
}

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

.species-card {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(160deg, #15151f, #0f0f15);
}

.species-emoji {
  font-size: 3.4rem;
}

.species-label {
  margin-top: 8px;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-input,
.field input,
.field select {
  width: 100%;
  background: #101019;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.95rem;
}

.search-row {
  margin-top: 6px;
}

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

.breed-card {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breed-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: #0f0f16;
}

.breed-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.breed-name {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.upload-card {
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: transparent;
  min-height: 120px;
  display: grid;
  place-items: center;
  gap: 8px;
}

.upload-icon {
  font-size: 1.8rem;
}

.upload-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.upload-status {
  font-size: 0.8rem;
  color: var(--muted);
}

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

.style-card {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.style-thumb {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #0f0f16;
  aspect-ratio: 4 / 3;
}

.style-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.style-thumb.placeholder {
  display: grid;
  place-items: center;
  background: #101018;
  color: var(--muted);
}

.style-placeholder {
  text-align: center;
  padding: 0 10px;
}

.style-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 10px;
  font-size: 0.85rem;
}

.style-desc {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.field span {
  color: var(--text);
  font-weight: 500;
}

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

.vibe-scale {
  display: grid;
  grid-template-columns: 1fr 3fr 1fr;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--muted);
}

.vibe-scale input[type="range"] {
  width: 100%;
}

.vibe-label {
  text-align: center;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-wrap {
  display: grid;
  gap: 16px;
}

.poster-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: #0f0f16;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.poster-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-preview.loading {
  animation: pulse 1.6s ease-in-out infinite;
}

.preview-placeholder {
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.generate-actions {
  display: grid;
  gap: 12px;
}

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

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(18, 11, 8, 0.2);
  border-top-color: #120b08;
  display: inline-block;
  margin-right: 8px;
  animation: spin 0.9s linear infinite;
  vertical-align: middle;
}

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

.status.error {
  color: #ffb199;
}

.cart-item {
  display: grid;
  gap: 16px;
}

.cart-preview {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #0f0f16;
  overflow: hidden;
  min-height: 200px;
  display: grid;
  place-items: center;
}

.cart-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(13, 13, 18, 0) 0%, rgba(13, 13, 18, 0.85) 30%, rgba(13, 13, 18, 1) 100%);
  z-index: 40;
}

.bottom-btn {
  width: 100%;
}

.hidden-input {
  display: none;
}

.hidden {
  display: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 rgba(255, 107, 53, 0.1); }
  50% { box-shadow: 0 0 30px rgba(255, 107, 53, 0.2); }
  100% { box-shadow: 0 0 0 rgba(255, 107, 53, 0.1); }
}

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

@media (min-width: 720px) {
  #view {
    padding-left: 60px;
    padding-right: 60px;
  }
  .home {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }
  .home-foot {
    grid-column: 1 / -1;
  }
  .breed-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .style-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .poster-preview {
    max-width: 520px;
    justify-self: center;
  }
}
