:root {
  --bg: #f4efe6;
  --bg-accent: #efe4d5;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-strong: #fffaf3;
  --ink: #1e1f1b;
  --muted: #67675f;
  --line: rgba(33, 30, 26, 0.12);
  --primary: #bf5a36;
  --primary-dark: #8a391d;
  --secondary: #1e4f5f;
  --success: #1f6b46;
  --shadow: 0 24px 50px rgba(75, 49, 28, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(191, 90, 54, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(30, 79, 95, 0.14), transparent 24%),
    linear-gradient(180deg, var(--bg), #f8f5ef 50%, #f2ece4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent 90%);
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 36px;
}

.eyebrow,
.section-kicker,
.hero-card-label,
.mini-label {
  margin: 0 0 12px;
  color: var(--secondary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  line-height: 0.96;
  max-width: 11ch;
}

.hero-text {
  margin: 0;
  max-width: 58ch;
  font-size: 1.03rem;
  line-height: 1.6;
  color: var(--muted);
}

.hero-card {
  padding: 28px;
  align-self: stretch;
  background:
    linear-gradient(135deg, rgba(255, 250, 243, 0.98), rgba(245, 232, 215, 0.9));
}

.hero-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 28px;
}

.section-heading,
.mini-header,
.toggle-row,
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-inline {
  gap: 10px;
}

.field label {
  font-weight: 700;
  font-size: 0.98rem;
}

.toggle-label {
  font-weight: 700;
  font-size: 0.98rem;
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  border-radius: 14px;
  padding: 14px 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(191, 90, 54, 0.68);
  box-shadow: 0 0 0 4px rgba(191, 90, 54, 0.12);
}

textarea {
  resize: vertical;
  min-height: 150px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.field-toggle {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.switch {
  position: relative;
  width: 58px;
  height: 32px;
  display: inline-flex;
}

.switch input {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: rgba(30, 79, 95, 0.18);
  border-radius: 999px;
  transition: background 180ms ease;
}

.slider::before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transition: transform 180ms ease;
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(26px);
}

.button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 14px 30px rgba(138, 57, 29, 0.22);
}

.button.secondary {
  background: rgba(30, 79, 95, 0.1);
  color: var(--secondary);
}

.button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.actions {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}

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

.status-bar {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(31, 107, 70, 0.08);
  color: var(--success);
  font-weight: 600;
}

.output-stack {
  display: grid;
  gap: 16px;
}

.mini-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.beat-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  color: var(--ink);
  line-height: 1.45;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(191, 90, 54, 0.1);
  color: var(--primary-dark);
  font-size: 0.84rem;
  font-weight: 700;
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button-compact {
  padding: 9px 14px;
  font-size: 0.9rem;
}

.prompt-output {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
  color: #172125;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 20, 15, 0.55);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(580px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  padding: 24px;
  border-radius: 26px;
  background: #fff9f2;
  box-shadow: 0 30px 80px rgba(28, 15, 8, 0.32);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.35rem;
}

.icon-button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.modal-form {
  display: grid;
  gap: 16px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.preview-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.preview-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
}

.preview-card span {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-word;
}

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

  .panel-output {
    position: static;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel,
  .modal-dialog {
    border-radius: 20px;
  }

  .hero-copy,
  .panel,
  .modal-dialog {
    padding: 20px;
  }

  .hero-copy h1 {
    max-width: none;
  }

  .section-heading,
  .input-with-action,
  .toggle-row,
  .mini-header,
  .prompt-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .input-with-action {
    grid-template-columns: 1fr;
  }

  .actions,
  .button,
  .section-heading .button {
    width: 100%;
  }
}
