:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --bg-2: #11131a;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: #f6f1e8;
  --muted: #a8a4a0;
  --soft: #d7d0c5;
  --accent: #d9b56d;
  --accent-2: #80d7c9;
  --danger: #ff8c7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at 15% 0%, rgba(217, 181, 109, 0.18), transparent 28rem),
    radial-gradient(circle at 85% 10%, rgba(128, 215, 201, 0.12), transparent 24rem),
    linear-gradient(145deg, #090a0d 0%, #13141a 48%, #0c0d12 100%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 112px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: #17120a;
  background: linear-gradient(135deg, #f2d894, #b98735);
  box-shadow: 0 12px 40px rgba(217, 181, 109, 0.22);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.95rem;
  letter-spacing: 0;
}

.brand small,
.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: inline-flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--panel-strong);
  outline: none;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.hero-panel,
.accordion,
.prompt-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.055));
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.hero-panel {
  display: grid;
  gap: 22px;
  padding: 22px;
  overflow: hidden;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.02;
}

h1 {
  max-width: 760px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 10vw, 5.2rem);
  font-weight: 500;
}

h2 {
  font-size: 1.05rem;
  font-weight: 800;
}

.intro {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--soft);
  font-size: 1rem;
  line-height: 1.7;
}

.upload-card {
  display: grid;
  gap: 12px;
}

.upload-zone {
  position: relative;
  display: grid;
  min-height: 360px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(217, 181, 109, 0.54);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(217, 181, 109, 0.12), rgba(128, 215, 201, 0.07)),
    rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.upload-zone:hover,
.upload-zone:focus-visible,
.upload-zone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--accent);
  background:
    linear-gradient(135deg, rgba(217, 181, 109, 0.18), rgba(128, 215, 201, 0.12)),
    rgba(0, 0, 0, 0.18);
  outline: none;
}

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

.upload-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.upload-empty.is-hidden {
  display: none;
}

.upload-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 1.8rem;
}

.upload-empty strong {
  font-size: 1.1rem;
}

.upload-empty small,
.upload-meta {
  color: var(--muted);
}

#coverPreview {
  display: none;
  width: min(100%, 320px);
  max-height: 520px;
  object-fit: contain;
  filter: drop-shadow(0 30px 35px rgba(0, 0, 0, 0.55));
}

#coverPreview.is-visible {
  display: block;
}

.upload-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  font-size: 0.86rem;
}

.text-button {
  border: 0;
  color: var(--accent);
  background: transparent;
  font-weight: 800;
}

.controls-column,
.preview-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

#promptForm {
  display: grid;
  gap: 14px;
}

.accordion {
  overflow: hidden;
}

.accordion-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  border: 0;
  color: var(--text);
  background: transparent;
  font-weight: 850;
  text-align: left;
}

.chevron {
  transition: transform 220ms ease;
}

.accordion.is-open .chevron {
  transform: rotate(180deg);
}

.accordion-panel {
  display: grid;
  max-height: 0;
  gap: 16px;
  overflow: hidden;
  padding: 0 18px;
  transition: max-height 260ms ease, padding 260ms ease;
}

.accordion.is-open .accordion-panel {
  max-height: 900px;
  padding: 0 18px 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 760;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(10, 11, 15, 0.72);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

select {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 142px;
  padding: 14px;
  line-height: 1.55;
}

select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 181, 109, 0.12);
  background: rgba(10, 11, 15, 0.92);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.chip span {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 11px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.82rem;
  font-weight: 780;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.chip input:checked + span {
  border-color: rgba(217, 181, 109, 0.7);
  color: #17120a;
  background: linear-gradient(135deg, #f0d58d, #c99a49);
}

.chip:hover span,
.chip input:focus-visible + span {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.prompt-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.copy-button,
.primary-action,
.secondary-action {
  min-height: 44px;
  border-radius: var(--radius);
  font-weight: 900;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.copy-button {
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
}

.copy-button:hover,
.copy-button:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  outline: none;
}

#promptOutput,
#negativeOutput {
  min-height: 310px;
  color: #f8f1e5;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(0, 0, 0, 0.28);
}

#negativeOutput {
  min-height: 150px;
}

.negative-card {
  border-color: rgba(128, 215, 201, 0.22);
}

.sticky-generate {
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 12, 16, 0.78);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
}

.primary-action,
.secondary-action {
  border: 1px solid transparent;
  padding: 0 12px;
}

.primary-action {
  color: #15110a;
  background: linear-gradient(135deg, #f3d991, #b9802e);
  box-shadow: 0 12px 36px rgba(217, 181, 109, 0.25);
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.secondary-action {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 40;
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  background: rgba(20, 21, 27, 0.92);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 22px 24px 120px;
  }

  .hero-panel {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    align-items: stretch;
    padding: 28px;
  }

  .upload-zone {
    min-height: 430px;
  }

  .sticky-generate {
    left: auto;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    width: min(560px, calc(100% - 48px));
  }
}

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1.03fr) minmax(340px, 0.72fr);
    align-items: start;
  }

  .hero-panel {
    grid-column: 1 / -1;
  }

  .preview-column {
    position: sticky;
    top: 78px;
  }
}

@media (min-width: 1280px) {
  .layout {
    grid-template-columns: minmax(360px, 0.84fr) minmax(370px, 0.74fr) minmax(420px, 0.92fr);
  }

  .hero-panel {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(3.2rem, 5vw, 5.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
