:root {
  color-scheme: dark;
  --black: #050506;
  --obsidian: #0a0a0c;
  --charcoal: #111115;
  --gold: #d4af37;
  --champagne: #ffdf73;
  --muted: rgba(244, 244, 245, 0.68);
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--obsidian);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--obsidian);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    'SF Pro Display',
    'Segoe UI',
    sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
}

.app-shell {
  position: relative;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 32%),
    linear-gradient(180deg, #0a0a0c 0%, #050506 100%);
}

.luxury-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(212, 175, 55, 0.12), transparent 24%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.06), transparent 34%),
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.62));
  pointer-events: none;
}

.noise-layer {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 96%);
  pointer-events: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 88px;
  margin-bottom: 20px;
  padding: 18px 0 22px;
  border-bottom: 1px solid var(--line);
}

.header-kicker,
.section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--champagne);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 223, 115, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(255, 255, 255, 0.07));
  box-shadow: 0 0 28px rgba(212, 175, 55, 0.23);
  color: #fff8d6;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.header-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(244, 244, 245, 0.76);
  font-size: 0.82rem;
  font-weight: 700;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.25fr);
  gap: 22px;
  align-items: stretch;
}

.control-surface,
.output-surface {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.115), rgba(255, 255, 255, 0.035)),
    rgba(10, 10, 12, 0.78);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.control-surface {
  padding: 22px;
}

.output-surface {
  display: flex;
  min-height: 690px;
  flex-direction: column;
  padding: 22px;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
}

.mode-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  border-radius: 6px;
  color: rgba(244, 244, 245, 0.65);
  font-size: 0.86rem;
  font-weight: 800;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.mode-option:hover {
  transform: scale(1.02);
  color: #ffffff;
}

.mode-option.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(255, 223, 115, 0.13));
  box-shadow: inset 0 0 0 1px rgba(255, 223, 115, 0.22), 0 12px 34px rgba(0, 0, 0, 0.28);
  color: #fff4ca;
}

.upload-zone {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  min-height: 150px;
  padding: 18px;
  border: 1px dashed rgba(255, 223, 115, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: rgba(255, 223, 115, 0.8);
  background: rgba(212, 175, 55, 0.085);
  box-shadow: 0 0 38px rgba(212, 175, 55, 0.18);
  transform: translateY(-1px);
}

.upload-zone.drag-over {
  animation: uploadPulse 1100ms ease-in-out infinite;
}

.upload-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255, 223, 115, 0.28);
  border-radius: 8px;
  background: rgba(255, 223, 115, 0.08);
  color: var(--champagne);
  font-size: 1.45rem;
}

.upload-copy p {
  margin: 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.upload-copy span {
  display: block;
  margin-top: 6px;
  color: rgba(244, 244, 245, 0.58);
  font-size: 0.88rem;
  line-height: 1.55;
}

.image-preview {
  width: 96px;
  height: 96px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
}

.field-group,
.select-wrap {
  display: block;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: rgba(244, 244, 245, 0.78);
  font-size: 0.82rem;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  outline: none;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

textarea {
  min-height: 190px;
  resize: vertical;
  padding: 18px;
  line-height: 1.72;
}

textarea::placeholder {
  color: rgba(244, 244, 245, 0.38);
}

textarea:focus,
select:focus {
  border-color: rgba(255, 223, 115, 0.62);
  background: rgba(0, 0, 0, 0.48);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12);
}

.select-wrap {
  position: relative;
}

select {
  min-height: 54px;
  appearance: none;
  padding: 0 44px 0 15px;
}

select option {
  background: #111115;
  color: #fff;
}

.select-wrap i {
  position: absolute;
  right: 16px;
  bottom: 18px;
  color: var(--champagne);
  font-size: 0.8rem;
  pointer-events: none;
}

.generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 62px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), var(--champagne) 54%, #fff1ad);
  box-shadow: 0 20px 70px rgba(212, 175, 55, 0.27);
  color: #070707;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    opacity 180ms ease;
}

.generate-button:hover:enabled {
  transform: scale(1.025);
  box-shadow: 0 24px 90px rgba(255, 223, 115, 0.32);
  filter: saturate(1.08);
}

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

.button-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.28);
  border-top-color: #050506;
  border-radius: 50%;
  animation: spin 780ms linear infinite;
}

.output-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.output-header h2 {
  max-width: 680px;
  margin: 10px 0 0;
  color: #fff;
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.ghost-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff2bc;
  font-size: 0.8rem;
  font-weight: 800;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.ghost-button:hover:enabled,
.download-button:hover:enabled {
  transform: scale(1.04);
  border-color: rgba(255, 223, 115, 0.46);
  background: rgba(212, 175, 55, 0.12);
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.error-box {
  margin-top: 18px;
  border: 1px solid rgba(248, 113, 113, 0.34);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.11);
  padding: 14px 16px;
  color: #fecaca;
  font-size: 0.92rem;
}

.empty-state {
  display: grid;
  flex: 1;
  min-height: 460px;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  place-items: center;
  border: 1px solid rgba(255, 223, 115, 0.25);
  border-radius: 8px;
  background: rgba(255, 223, 115, 0.08);
  color: var(--champagne);
  font-size: 1.7rem;
  box-shadow: 0 16px 46px rgba(212, 175, 55, 0.1);
}

.empty-state p {
  margin: 0;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
}

.empty-state span {
  display: block;
  max-width: 420px;
  margin-top: 10px;
  color: rgba(244, 244, 245, 0.58);
  line-height: 1.65;
}

.result-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.result-card {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  padding: 18px;
  opacity: 0;
  transform: translateY(16px);
}

.result-card.is-visible {
  animation: slideFadeIn 460ms ease forwards;
}

.result-label {
  margin: 0 0 9px;
  color: var(--champagne);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.result-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.98rem;
  line-height: 1.72;
  white-space: pre-wrap;
}

.slide-card {
  display: grid;
  gap: 10px;
}

.slide-title {
  margin: 0;
  color: #fff;
  font-size: 1.08rem;
  font-weight: 900;
}

.carousel-studio {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.carousel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.slide-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.slide-tab {
  min-width: 40px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 900;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.slide-tab:hover {
  transform: scale(1.05);
  color: #fff;
}

.slide-tab.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(255, 223, 115, 0.12));
  color: #fff7d7;
}

.canvas-stage {
  display: grid;
  justify-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    rgba(0, 0, 0, 0.3);
  padding: 18px;
}

#carouselCanvas {
  width: min(100%, 430px);
  height: auto;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52);
}

.raw-json {
  margin-top: 18px;
  overflow: auto;
  max-height: 360px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.36);
  padding: 16px;
  color: rgba(244, 244, 245, 0.78);
  font-size: 0.78rem;
  line-height: 1.65;
}

.download-frame {
  position: fixed;
  left: -200vw;
  top: 0;
  width: 1080px;
  height: 1350px;
  overflow: hidden;
  background: #09090b;
}

.download-card {
  position: relative;
  width: 1080px;
  height: 1350px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(212, 175, 55, 0.18), transparent 42%),
    linear-gradient(180deg, #171717, #050506);
  color: white;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    'SF Pro Display',
    sans-serif;
}

.download-card .download-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
}

.download-card .download-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.42) 45%, rgba(0, 0, 0, 0.92)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.62), transparent 58%);
}

.download-card .download-content {
  position: absolute;
  left: 78px;
  right: 78px;
  bottom: 92px;
}

.download-card .download-brand {
  margin-bottom: 34px;
  color: #ffdf73;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.download-card .download-headline {
  margin: 0;
  max-width: 860px;
  color: #fff;
  font-size: 78px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.98;
}

.download-card .download-body {
  margin: 34px 0 0;
  max-width: 840px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.3;
}

.download-card .download-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 54px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffdf73;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

@keyframes uploadPulse {
  0%,
  100% {
    box-shadow: 0 0 22px rgba(212, 175, 55, 0.12);
  }
  50% {
    box-shadow: 0 0 48px rgba(255, 223, 115, 0.3);
  }
}

@keyframes slideFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

  .output-surface {
    min-height: 560px;
  }
}

@media (max-width: 720px) {
  .app-header,
  .output-header,
  .carousel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-meta {
    justify-content: flex-start;
  }

  .control-surface,
  .output-surface {
    padding: 16px;
  }

  .mode-toggle {
    grid-template-columns: 1fr;
  }

  .upload-zone {
    grid-template-columns: 1fr;
  }

  .image-preview {
    width: 100%;
    height: 170px;
  }

  .ghost-button,
  .download-button {
    width: 100%;
  }
}
