:root {
  color-scheme: light;
  --bg: #fff7f8;
  --panel: #ffffff;
  --ink: #35292d;
  --muted: #7d6d73;
  --line: #eadde0;
  --brand: #c45f7a;
  --brand-dark: #87384f;
  --soft: #fff0f4;
  --cream: #fff9f1;
  --accent: #a66f52;
  --radius: 14px;
  --shadow: 0 22px 70px rgba(111, 65, 79, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(244, 185, 200, 0.34), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(255, 224, 185, 0.46), transparent 28%),
    linear-gradient(135deg, #fff8f9 0%, #fffdf8 48%, #f8eff2 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px 20px 56px;
  display: grid;
  gap: 18px;
}

.hero {
  min-height: 300px;
  border-radius: 26px;
  padding: 28px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(111, 45, 65, 0.9), rgba(196, 95, 122, 0.62)),
    url("https://images.unsplash.com/photo-1570172619644-dfd03ed5d881?auto=format&fit=crop&w=1600&q=82") center/cover;
  box-shadow: var(--shadow);
  display: grid;
  align-content: space-between;
  gap: 40px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  background: rgba(255, 244, 232, 0.24);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-dark);
  font-size: 23px;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(69, 25, 39, 0.16);
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ffe2e9;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 17px;
  font-weight: 750;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.notice,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.notice {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(255, 245, 237, 0.92));
}

.notice strong {
  flex: 0 0 auto;
  color: var(--brand-dark);
}

.notice span {
  color: var(--muted);
  font-weight: 700;
}

.generator {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 24px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.panel-head > span {
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.small-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 900;
}

.small-button.filled {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.grid {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(196, 95, 122, 0.13);
}

.upload-box {
  border: 1px dashed #d9a7b6;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 240, 244, 0.92), rgba(255, 249, 241, 0.92));
  min-height: 118px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-box strong {
  color: var(--brand-dark);
  font-size: 18px;
}

.upload-box span {
  max-width: 520px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.preview-grid,
.image-library {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.library-section {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title strong {
  font-size: 16px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.library-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdfc;
  padding: 14px;
}

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

.project-card.active {
  border-color: rgba(196, 95, 122, 0.6);
  box-shadow: 0 0 0 4px rgba(196, 95, 122, 0.1);
}

.project-card strong,
.image-meta strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.project-card p,
.image-meta p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

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

.card-actions button,
.text-danger {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.text-danger {
  color: #9f4057;
}

.empty-mini {
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 16px;
  font-size: 13px;
  font-weight: 800;
}

.upload-drafts {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.upload-draft {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdfc;
  padding: 12px;
}

.upload-draft img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
}

.upload-fields {
  display: grid;
  gap: 10px;
}

.save-images {
  margin-top: 12px;
}

.image-library {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.image-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  display: grid;
}

.image-card > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.image-select {
  position: absolute;
  left: 8px;
  top: 8px;
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-dark);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(50, 24, 34, 0.12);
}

.image-select input {
  width: auto;
}

.image-meta {
  padding: 12px 12px 6px;
}

.image-card .text-danger {
  justify-self: start;
  margin: 0 12px 12px;
}

.social-generator {
  margin-top: 20px;
  border: 1px solid rgba(196, 95, 122, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 240, 244, 0.9), rgba(255, 253, 251, 0.96)),
    #fff;
  padding: 18px;
  display: grid;
  gap: 14px;
}

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

.primary-button.compact {
  flex: 0 0 auto;
  min-width: 180px;
}

.social-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.social-result {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  align-items: end;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.social-result img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 16px 34px rgba(111, 65, 79, 0.14);
}

.social-result a,
.generated-card a {
  justify-self: start;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand-dark);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

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

.generated-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.generated-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.generated-card > div {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.generated-card strong {
  font-size: 14px;
}

.generated-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.action-bar {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button,
.copy-button {
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 900;
}

.primary-button {
  flex: 1;
  background: linear-gradient(135deg, #c45f7a, #a94863);
  color: #fff;
  box-shadow: 0 16px 34px rgba(196, 95, 122, 0.24);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.secondary-button,
.copy-button {
  background: #fff;
  border-color: var(--line);
  color: var(--brand-dark);
}

.output-panel {
  min-height: 260px;
}

.empty-output {
  border: 1px dashed var(--line);
  border-radius: 18px;
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.result {
  display: grid;
  gap: 16px;
}

.result h3 {
  margin: 0;
  font-size: 26px;
}

.result pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdfb;
  padding: 16px;
  color: #4b3d41;
  line-height: 1.8;
}

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

.tags span {
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  padding: 7px 10px;
  font-weight: 850;
  font-size: 13px;
}

.checklist {
  border-radius: 16px;
  background: #fff8ee;
  border: 1px solid #f6d4b7;
  padding: 14px;
}

.checklist strong {
  color: var(--accent);
}

.checklist ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: #7c2d12;
  font-weight: 750;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px 12px 34px;
  }

  .hero {
    min-height: 260px;
    padding: 20px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    padding: 16px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid.two,
  .preview-grid,
  .project-list,
  .image-library,
  .generated-gallery,
  .social-result {
    grid-template-columns: 1fr;
  }

  .panel-actions,
  .section-title {
    width: 100%;
    justify-content: space-between;
  }

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

  .action-bar {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
