:root {
  --bg: #f3ece1;
  --panel: rgba(255, 251, 244, 0.88);
  --panel-line: rgba(92, 61, 41, 0.12);
  --text: #2d211b;
  --muted: #77655b;
  --accent: #c66434;
  --accent-soft: #f3d2bf;
  --success: #3d8c62;
  --danger: #b64e43;
  --shadow: 0 24px 80px rgba(95, 63, 40, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(198, 100, 52, 0.14), transparent 24%),
    radial-gradient(circle at top right, rgba(239, 196, 143, 0.2), transparent 22%),
    linear-gradient(180deg, #f8f1e8 0%, #f0e7db 100%);
}

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

.panel {
  border: 1px solid var(--panel-line);
  border-radius: 32px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  padding: 34px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  max-width: 860px;
  font-size: clamp(2.8rem, 5vw, 5.4rem);
  line-height: 0.95;
}

.hero-copy {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
}

.app-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-top: 24px;
}

.main-panel,
.side-panel {
  padding: 28px;
}

.side-panel {
  display: grid;
  gap: 18px;
  align-content: start;
  position: sticky;
  top: 18px;
  height: fit-content;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.debug-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.debug-modal.is-hidden {
  display: none;
}

.debug-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 12, 10, 0.68);
  backdrop-filter: blur(10px);
}

.debug-panel {
  position: relative;
  width: min(1100px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background: rgba(24, 18, 15, 0.94);
  box-shadow: 0 28px 120px rgba(0, 0, 0, 0.38);
  color: #f3ebe4;
}

.debug-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.debug-header h2 {
  margin: 0;
  font-size: 1.8rem;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.debug-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}

.debug-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.debug-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.82rem/1.55 "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  color: #f4d6c3;
}

.screen-header h2,
.side-section h3 {
  margin: 0;
  font-size: 2rem;
}

.screen-header p,
.side-section p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.entry-grid,
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.entry-card,
.shared-player-card,
.pricing-card,
.checkout-card,
.result-lead-card,
.result-access-card,
.question-stage,
.draft-summary,
.side-section,
.library-item,
.song-card {
  border: 1px solid var(--panel-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.46);
}

.entry-card,
.pricing-card {
  padding: 22px;
}

.shared-landing {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 20px;
  margin-top: 24px;
}

.shared-landing-copy,
.shared-player-card {
  padding: 28px;
  border: 1px solid var(--panel-line);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(198, 100, 52, 0.14), transparent 28%),
    rgba(255, 255, 255, 0.56);
}

.shared-landing-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.shared-landing-copy p {
  color: var(--muted);
  line-height: 1.7;
}

.shared-landing-actions {
  display: flex;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.shared-player-card audio {
  width: 100%;
  margin-top: 18px;
}

body.shared-arrival .hero {
  background:
    radial-gradient(circle at top right, rgba(198, 100, 52, 0.18), transparent 28%),
    rgba(255, 251, 244, 0.92);
}

body.shared-arrival .app-grid {
  grid-template-columns: 1fr;
}

body.shared-arrival .side-panel {
  display: none;
}

body.shared-arrival .entry-grid {
  display: none;
}

.entry-kicker,
.pricing-qty,
.question-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.entry-card h3,
.pricing-card h3 {
  margin: 0;
  font-size: 1.5rem;
}

.entry-card p,
.pricing-copy {
  color: var(--muted);
  line-height: 1.6;
}

.entry-card audio {
  width: 100%;
  margin: 14px 0 18px;
}

.featured {
  background:
    radial-gradient(circle at top right, rgba(198, 100, 52, 0.12), transparent 28%),
    rgba(255, 255, 255, 0.58);
}

.pricing-actions,
.result-actions,
.return-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.return-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.return-form input {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid rgba(92, 61, 41, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
}

.return-message {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.is-hidden {
  display: none;
}

.result-access-card {
  margin-top: 24px;
  padding: 22px;
}

.result-lead-card {
  padding: 22px;
  margin-top: 24px;
}

.result-songs-grid {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.create-shell {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.checkout-shell {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 20px;
  margin-top: 24px;
}

.checkout-card,
.checkout-form {
  border: 1px solid var(--panel-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.48);
  padding: 22px;
}

.checkout-points {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.checkout-form {
  display: grid;
  gap: 14px;
}

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

.checkout-field span {
  font-size: 0.92rem;
  color: var(--muted);
}

.checkout-field input {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid rgba(92, 61, 41, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
}

.checkout-field input:focus {
  outline: 2px solid rgba(198, 100, 52, 0.22);
  border-color: rgba(198, 100, 52, 0.4);
}

.checkout-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.checkout-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.progress-section {
  display: grid;
  gap: 14px;
}

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

.progress-label {
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(45, 33, 27, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #e2a07c 100%);
  transition: width 240ms ease;
}

.progress-steps {
  display: grid;
  gap: 10px;
}

.progress-step {
  padding: 12px 14px;
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

.progress-step.is-active {
  color: var(--accent);
  border-color: rgba(198, 100, 52, 0.24);
  background: rgba(198, 100, 52, 0.08);
}

.progress-step.is-complete {
  color: var(--success);
  border-color: rgba(61, 140, 98, 0.2);
  background: rgba(61, 140, 98, 0.08);
}

.question-progress,
.question-stage,
.draft-summary-list,
.songs-empty {
  padding: 18px;
}

.question-progress,
.draft-summary {
  border: 1px solid var(--panel-line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.44);
}

.question-progress-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.question-progress-bar {
  height: 12px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(45, 33, 27, 0.08);
  overflow: hidden;
}

.question-progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #e2a07c 100%);
  transition: width 240ms ease;
}

.question-stage {
  display: block;
}

.question-text {
  display: block;
  margin-bottom: 14px;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.45;
}

textarea,
button {
  font: inherit;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 150px;
  padding: 16px 18px;
  border: 1px solid rgba(92, 61, 41, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

textarea:focus {
  outline: 2px solid rgba(198, 100, 52, 0.22);
  border-color: rgba(198, 100, 52, 0.4);
}

.create-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.draft-summary-header p {
  margin-bottom: 18px;
}

.draft-summary-list {
  display: grid;
  gap: 12px;
}

.draft-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.draft-item strong {
  display: block;
  margin-bottom: 8px;
}

.draft-item p,
.draft-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.side-section {
  padding: 18px;
}

.side-card-copy,
.songs-empty {
  margin: 12px 0 0;
  border: 1px solid var(--panel-line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.56);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  line-height: 1.65;
  padding: 18px;
}

.song-card,
.library-item {
  padding: 14px;
}

.song-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.song-card img {
  width: 112px;
  height: 112px;
  border-radius: 16px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.3);
}

.song-card h4 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.song-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mini-button {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(92, 61, 41, 0.16);
  color: var(--text);
  cursor: pointer;
}

.mini-button.is-favorite {
  background: rgba(61, 140, 98, 0.12);
  border-color: rgba(61, 140, 98, 0.26);
  color: var(--success);
}

.song-card p,
.library-item p,
.library-item small {
  color: var(--muted);
}

.song-card audio {
  width: 100%;
  margin-bottom: 10px;
}

.song-card a {
  color: var(--accent);
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(119, 101, 91, 0.12);
  color: var(--muted);
}

.status.working {
  background: rgba(198, 100, 52, 0.12);
  color: var(--accent);
}

.status.ready {
  background: rgba(61, 140, 98, 0.12);
  color: var(--success);
}

.status.error {
  background: rgba(182, 78, 67, 0.12);
  color: var(--danger);
}

button {
  border: 0;
  cursor: pointer;
  padding: 14px 20px;
  border-radius: 999px;
}

.primary {
  color: #fff7f0;
  background: linear-gradient(90deg, var(--accent) 0%, #a94d20 100%);
}

.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(92, 61, 41, 0.14);
}

.ghost {
  color: var(--muted);
  background: transparent;
  border: 1px dashed rgba(92, 61, 41, 0.22);
}

.ghost-link {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  text-decoration: underline;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

  .side-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .entry-grid,
  .pricing-grid,
  .debug-grid {
    grid-template-columns: 1fr;
  }

  .shared-landing {
    grid-template-columns: 1fr;
  }

  .checkout-shell {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100% - 18px, 1320px);
  }

  .create-actions,
  .checkout-actions,
  .pricing-actions,
  .result-actions {
    flex-direction: column;
  }
}
