:root {
  --bg: #f7f7f2;
  --surface: #ffffff;
  --surface-soft: #eef5f1;
  --ink: #17231f;
  --muted: #5d6a65;
  --line: #d9e2dd;
  --brand: #2f6f63;
  --brand-dark: #1f4d45;
  --accent: #c36b3f;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(31, 77, 69, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(247, 247, 242, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.nav,
.shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
}

.nav {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  font-weight: 800;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.demo-badge,
.mode-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
}

.demo-badge {
  border: 1px solid #f0c7ad;
  background: #fff3ec;
  color: #7a3518;
}

.mode-badge {
  border: 1px solid #cbd8d3;
  background: #e4eee9;
  color: var(--brand-dark);
}

.mode-badge[data-mode="ai"] {
  border-color: #9bc6ba;
  background: #dff5ed;
  color: #125244;
}

.shell {
  padding: 24px 0 48px;
}

.hero,
.panel,
.output-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(22px, 4vw, 42px);
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.15;
}

h3 {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.2;
}

.subtitle {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 700;
}

.intro-note {
  max-width: 860px;
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #fff7f1;
}

.workspace {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
  margin-top: 20px;
}

.panel {
  padding: 20px;
}

.input-panel {
  position: sticky;
  top: 88px;
}

.panel-heading {
  margin-bottom: 16px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span,
.photo-section h3 {
  display: block;
  margin-bottom: 7px;
  color: var(--brand-dark);
  font-weight: 850;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
  color: var(--ink);
  padding: 12px;
  outline: 0;
}

textarea {
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 99, 0.16);
}

.photo-section {
  margin: 16px 0;
  padding: 14px;
  border: 1px dashed #acc6bd;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.file-picker {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 900;
}

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

.field-hint {
  margin: 9px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.photo-item {
  position: relative;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.photo-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.photo-item figcaption {
  padding: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 35, 31, 0.76);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
}

.primary-btn,
.secondary-btn,
.copy-btn {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
}

.secondary-btn,
.copy-btn {
  background: #e4eee9;
  color: var(--brand-dark);
  padding: 10px 13px;
}

.small-btn {
  min-height: 38px;
  padding: 8px 11px;
}

.primary-btn:hover,
.secondary-btn:hover,
.copy-btn:hover {
  filter: brightness(0.97);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.copy-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.form-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.inline-option {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand-dark);
  font-weight: 850;
}

.select-field {
  min-height: 44px;
  display: grid;
  gap: 4px;
  min-width: min(100%, 260px);
  color: var(--brand-dark);
  font-weight: 850;
}

.select-field span {
  font-size: 0.78rem;
}

.select-field select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  font: inherit;
}

.inline-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.form-actions .primary-btn,
.form-actions .secondary-btn {
  flex: 1 1 160px;
}

.results {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.result-actions {
  justify-content: flex-end;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.status[data-kind="ok"] {
  color: var(--brand);
}

.status[data-kind="error"],
.error-message,
.warning-message {
  color: var(--danger);
}

.status[data-kind="loading"] {
  color: #8a5a00;
}

.error-message {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #f1b4ad;
  border-radius: var(--radius);
  background: #fff0ee;
  font-weight: 800;
}

.warning-message {
  margin: 8px 0;
  font-weight: 800;
}

.video-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.output-grid {
  display: grid;
  gap: 12px;
}

.output-card {
  padding: 16px;
}

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

.output-card-head h3 {
  color: var(--brand-dark);
}

.output-card-head .copy-btn {
  flex: 0 0 auto;
}

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

.generated-image-preview {
  display: block;
  width: min(100%, 520px);
  aspect-ratio: 1;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  object-fit: contain;
}

.output-text {
  padding: 13px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #fffaf6;
  color: var(--ink);
  white-space: normal;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

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

  .input-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
  }

  .brand span:last-child {
    white-space: normal;
  }

  .header-badges,
  .demo-badge,
  .mode-badge {
    width: 100%;
  }

  .header-badges {
    justify-content: stretch;
  }

  .demo-badge,
  .mode-badge {
    text-align: center;
  }

  .shell {
    width: min(100% - 20px, 1160px);
    padding-top: 14px;
  }

  .hero,
  .panel,
  .output-card {
    padding: 16px;
  }

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

  .section-heading,
  .output-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions,
  .result-actions .secondary-btn,
  .select-field,
  .inline-option,
  .output-card-head .copy-btn,
  .generated-image-actions {
    width: 100%;
  }

  .primary-btn,
  .secondary-btn,
  .copy-btn {
    width: 100%;
    min-height: 48px;
  }
}
