:root {
  --bg: #101113;
  --bg-soft: #17191d;
  --panel: rgba(31, 33, 38, 0.78);
  --panel-strong: rgba(43, 45, 52, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f7f7f4;
  --muted: #b7b9be;
  --dim: #7d818a;
  --gold: #d6bd82;
  --gold-dark: #8b7442;
  --accent: #ece2cc;
  --danger: #e38b8b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --speed: 180ms;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 10%, rgba(214, 189, 130, 0.14), transparent 28rem),
    radial-gradient(circle at 85% 18%, rgba(255, 255, 255, 0.06), transparent 24rem),
    linear-gradient(140deg, #0d0e10 0%, #17191d 48%, #111214 100%);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.hero-panel,
.glass-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(43, 45, 52, 0.82), rgba(22, 23, 27, 0.7));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.hero-panel {
  display: flex;
  min-height: 178px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: clamp(24px, 5vw, 48px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.08), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 92px);
  pointer-events: none;
}

.hero-panel > * {
  position: relative;
}

.eyebrow,
.control-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 900px;
  font-size: clamp(2.2rem, 8vw, 5.8rem);
  line-height: 0.92;
}

h2 {
  font-size: 1.08rem;
}

.subtitle {
  max-width: 660px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.22rem);
  line-height: 1.55;
}

.header-badge,
.prompt-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9fe2ae;
  box-shadow: 0 0 18px rgba(159, 226, 174, 0.75);
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.control-panel,
.preview-panel {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.preview-panel {
  position: sticky;
  top: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.upload-zone {
  display: grid;
  min-height: 260px;
  place-items: center;
  border: 1px dashed rgba(236, 226, 204, 0.32);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.03);
  transition: border-color var(--speed), transform var(--speed), background var(--speed);
  overflow: hidden;
  outline: none;
}

.upload-zone:hover,
.upload-zone.dragover,
.upload-zone:focus-visible {
  border-color: rgba(214, 189, 130, 0.78);
  background: rgba(214, 189, 130, 0.08);
  transform: translateY(-1px);
}

.upload-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.upload-empty strong {
  color: var(--text);
  font-size: 1.04rem;
}

.upload-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
  font-size: 2rem;
  font-weight: 400;
}

.upload-preview {
  width: 100%;
  height: 100%;
  min-height: 260px;
  padding: 12px;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
}

.upload-actions,
.copy-actions,
.randomizer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.section-block {
  margin-top: 22px;
}

.content-type-section {
  margin-top: 0;
  margin-bottom: 22px;
}

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

.content-type-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 78px;
  align-content: center;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.045);
  text-align: left;
  transition: transform var(--speed), border-color var(--speed), background var(--speed), color var(--speed), box-shadow var(--speed);
}

.content-type-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(244, 231, 197, 0.18), rgba(214, 189, 130, 0.06));
  opacity: 0;
  transition: opacity var(--speed);
}

.content-type-card span,
.content-type-card small {
  position: relative;
}

.content-type-card span {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
}

.content-type-card small {
  color: var(--dim);
  font-size: 0.72rem;
  line-height: 1.3;
}

.content-type-card:hover,
.content-type-card.active {
  border-color: rgba(214, 189, 130, 0.58);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.content-type-card:hover::before,
.content-type-card.active::before {
  opacity: 1;
}

.content-type-card.active {
  background:
    linear-gradient(145deg, rgba(244, 231, 197, 0.15), rgba(214, 189, 130, 0.08)),
    rgba(255, 255, 255, 0.06);
}

.content-type-card.active::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(214, 189, 130, 0.8);
}

.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.mode-button {
  position: relative;
  z-index: 2;
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: color var(--speed);
}

.mode-button.active {
  color: #171717;
}

.mode-indicator {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 5px;
  width: calc(50% - 5px);
  height: calc(100% - 10px);
  border-radius: 999px;
  background: linear-gradient(135deg, #f4e7c5, #b99d5e);
  box-shadow: 0 12px 30px rgba(214, 189, 130, 0.2);
  transition: transform 220ms ease;
}

.mode-switch.advanced .mode-indicator {
  transform: translateX(100%);
}

.preset-grid,
.control-grid {
  display: grid;
  gap: 12px;
}

.preset-category-stack {
  display: grid;
  gap: 14px;
}

.preset-category {
  display: grid;
  gap: 9px;
  animation: fadeIn 240ms ease;
}

.preset-category > span {
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.preset-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.preset-button,
.secondary-button,
.ghost-button,
.primary-button {
  min-height: 44px;
  border-radius: 999px;
  padding: 11px 16px;
  transition: transform var(--speed), border-color var(--speed), background var(--speed), color var(--speed), box-shadow var(--speed);
}

.preset-button,
.secondary-button,
.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.preset-button {
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.primary-button {
  color: #151515;
  background: linear-gradient(135deg, #f3e8cf, #c7a95e);
  box-shadow: 0 15px 36px rgba(214, 189, 130, 0.2);
  font-weight: 800;
}

.ghost-button {
  color: var(--danger);
}

.preset-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  border-color: rgba(214, 189, 130, 0.48);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

.controls-form {
  margin-top: 22px;
}

.object-mode-section {
  margin-top: 0;
  margin-bottom: 22px;
}

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

.object-mode-button {
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.82rem;
  font-weight: 800;
  transition: transform var(--speed), border-color var(--speed), background var(--speed), color var(--speed), box-shadow var(--speed);
}

.object-mode-button:hover,
.object-mode-button.active {
  border-color: rgba(214, 189, 130, 0.5);
  color: var(--text);
  background: rgba(214, 189, 130, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.object-mode-button.active {
  color: #171717;
  background: linear-gradient(135deg, #f4e7c5, #b99d5e);
}

.mode-section {
  animation: fadeIn 240ms ease;
}

.control-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(18, 19, 22, 0.84);
  padding: 0 12px;
  outline: none;
  transition: border-color var(--speed), box-shadow var(--speed);
}

select:focus {
  border-color: rgba(214, 189, 130, 0.78);
  box-shadow: 0 0 0 4px rgba(214, 189, 130, 0.12);
}

.slider-stack {
  display: grid;
  gap: 18px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
}

.slider-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.slider-field span {
  color: var(--gold);
}

input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--gold);
}

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

.checkbox-grid label,
.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.82rem;
  font-weight: 700;
  transition: border-color var(--speed), background var(--speed), color var(--speed);
}

.checkbox-grid label:hover,
.checkbox-card:hover {
  border-color: rgba(214, 189, 130, 0.44);
  color: var(--text);
  background: rgba(214, 189, 130, 0.075);
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--gold);
}

.background-cleaner {
  color: var(--accent);
}

.randomizer-row {
  margin-top: 22px;
}

.generate-button {
  width: 100%;
  margin-top: 14px;
}

.copy-actions {
  margin-top: 0;
  margin-bottom: 16px;
}

.prompt-output {
  min-height: 560px;
  max-height: 68vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: #f8f4ea;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.18)),
    rgba(10, 11, 13, 0.54);
  white-space: pre-wrap;
  line-height: 1.62;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.prompt-output.typing::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.14em;
  background: var(--gold);
  animation: blink 760ms steps(2, start) infinite;
}

.short-prompt-box {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
}

.short-prompt-box p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(24, 25, 29, 0.92);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--speed), transform var(--speed);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.hidden-copy-area {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

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

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 1080px) {
  .builder-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .prompt-output {
    min-height: 420px;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .hero-panel {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 24px;
  }

  .control-panel,
  .preview-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .content-type-grid,
  .control-grid,
  .checkbox-grid,
  .preset-grid,
  .object-mode-grid {
    grid-template-columns: 1fr;
  }

  .mode-button {
    padding: 13px 8px;
    font-size: 0.76rem;
  }

  .upload-zone,
  .upload-preview {
    min-height: 220px;
  }

  .randomizer-row,
  .upload-actions,
  .copy-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .generate-button {
    position: sticky;
    bottom: 10px;
    z-index: 5;
    min-height: 54px;
  }

  .prompt-output {
    min-height: 360px;
    padding: 16px;
    font-size: 0.95rem;
  }
}
