:root {
  --bg: #f3efe8;
  --bg-glow: rgba(255, 255, 255, 0.72);
  --bg-gradient-start: #f7f1e7;
  --bg-gradient-end: #efe7dd;
  --paper: #fcfaf6;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --ink: #1f2326;
  --muted: #667178;
  --line: rgba(31, 35, 38, 0.12);
  --accent: #d98f5c;
  --accent-deep: #a75f36;
  --accent-soft: rgba(217, 143, 92, 0.14);
  --shadow: 0 24px 60px rgba(56, 39, 23, 0.12);
  --phone-frame-start: #171717;
  --phone-frame-end: #050505;
  --phone-body: #0f0f0f;
  --phone-ink: #ece8e1;
  --phone-muted: #9fa7ab;
  --phone-accent: #f0a46e;
  --phone-lyrics: #f4f1eb;
  --phone-empty-line: rgba(255, 255, 255, 0.18);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --mono:
    "SFMono-Regular", "Cascadia Code", "Roboto Mono", "Courier New", monospace;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #141313;
  --bg-glow: rgba(217, 143, 92, 0.12);
  --bg-gradient-start: #1b1817;
  --bg-gradient-end: #0e0d0d;
  --paper: #181716;
  --surface: rgba(30, 28, 27, 0.9);
  --surface-strong: rgba(38, 36, 35, 0.96);
  --ink: #f4efe7;
  --muted: #b9afa5;
  --line: rgba(255, 246, 238, 0.12);
  --accent: #e5a06b;
  --accent-deep: #f3c299;
  --accent-soft: rgba(229, 160, 107, 0.14);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  --phone-frame-start: #252322;
  --phone-frame-end: #111010;
  --phone-body: #141313;
  --phone-ink: #f4efe7;
  --phone-muted: #c5bab0;
  --phone-accent: #efab76;
  --phone-lyrics: #f7f2eb;
  --phone-empty-line: rgba(255, 246, 238, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--bg-glow), transparent 36%),
    linear-gradient(
      180deg,
      var(--bg-gradient-start) 0%,
      var(--bg-gradient-end) 100%
    );
}

body {
  padding: 32px 18px 40px;
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
}

.disclaimer-panel {
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.disclaimer-label {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

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

.workspace-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace-copy {
  max-width: 62ch;
}

.workspace-label {
  margin: 0 0 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.workspace-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.workspace-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 20px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-note,
.composer-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy,
.hero-note {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.hero h1,
.panel-header h2 {
  margin: 0;
}

.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.hero h1 {
  max-width: 30ch;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 0.98;
}

.hero-text,
.panel-header p,
.hero-note li {
  color: var(--muted);
}

.hero-text {
  max-width: 60ch;
  margin: 16px 0 0;
  font-size: 1rem;
  line-height: 1.65;
}

.hero-highlights {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.highlight-pill {
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.hero-note {
  display: flex;
}

.info-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.info-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.info-kicker {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.info-card h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-item p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

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

.format-card {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.format-card strong {
  display: block;
  margin-bottom: 10px;
}

.format-card code,
.hero-note code {
  display: block;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--mono);
  font-size: 0.92em;
}

.hero-note code + code {
  margin-top: 8px;
}

.hero-note ul {
  margin: 0;
  padding-left: 18px;
}

.hero-note li + li {
  margin-top: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 24px;
  align-items: start;
}

.composer-panel,
.preview-panel {
  padding: 24px;
  height: 100%;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.panel-header p {
  margin: 8px 0 0;
  max-width: 48ch;
  line-height: 1.5;
}

.action-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.action-label {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  color: inherit;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
  text-decoration: none;
}

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

.button-primary {
  background: var(--accent);
  color: white;
}

.button-secondary {
  background: var(--surface-strong);
  color: var(--ink);
  border-color: var(--line);
}

.icon-button {
  width: 16px;
  height: 16px;
}

.icon-title {
  width: 18px;
  height: 18px;
  color: var(--accent-deep);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 14px 16px;
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 143, 92, 0.12);
}

.field-large {
  margin-bottom: 0;
}

.field textarea {
  min-height: 420px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.97rem;
  line-height: 1.55;
  white-space: pre;
}

.composer-tools {
  margin-top: 14px;
}

.insert-row,
.status-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.insert-row {
  margin-bottom: 12px;
}

.token-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.token-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.icon-token {
  width: 15px;
  height: 15px;
  color: var(--accent-deep);
}

.status-chip {
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.meta-chip {
  min-width: 220px;
  flex: 1 1 220px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.meta-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.meta-label-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-label {
  width: 15px;
  height: 15px;
  color: var(--accent-deep);
}

.preview-header {
  margin-bottom: 18px;
}

.phone-frame {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 14px;
  border-radius: 38px;
  background: linear-gradient(
    180deg,
    var(--phone-frame-start) 0%,
    var(--phone-frame-end) 100%
  );
  box-shadow: 0 28px 60px rgba(10, 10, 10, 0.28);
}

.phone-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px 12px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.82);
}

.phone-body {
  height: 700px;
  border-radius: 28px;
  padding: 22px 18px 20px;
  background: var(--phone-body);
  color: var(--phone-ink);
  display: flex;
  flex-direction: column;
}

.song-header {
  margin-bottom: 22px;
  flex-shrink: 0;
}

.song-header h3 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.08;
  color: var(--phone-accent);
}

.song-header p {
  margin: 8px 0 0;
  font-size: 1rem;
  color: var(--phone-muted);
}

.song-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 6px;
}

.song-scroll-area {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--phone-accent) transparent;
}

.song-scroll-area::-webkit-scrollbar {
  width: 8px;
}

.song-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.song-scroll-area::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--phone-accent) 72%, transparent);
}

.song-line-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.song-section {
  color: var(--phone-muted);
  font-weight: 700;
}

.song-chords,
.song-lyrics {
  margin: 0;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.song-chords {
  color: var(--phone-accent);
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 700;
}

.song-lyrics {
  color: var(--phone-lyrics);
  font-size: 1rem;
  line-height: 1.45;
}

.empty-preview {
  padding: 20px 18px;
  border: 1px dashed var(--phone-empty-line);
  border-radius: 18px;
  color: var(--phone-muted);
  line-height: 1.6;
}

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

  .workspace-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-actions {
    justify-content: flex-start;
  }

  .phone-frame {
    width: 100%;
    max-width: 460px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 18px 12px 28px;
  }

  .hero-copy,
  .hero-note,
  .composer-panel,
  .preview-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .workspace-bar {
    padding: 16px;
    border-radius: 24px;
  }

  .disclaimer-panel {
    padding: 16px;
    border-radius: 24px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .action-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-highlights,
  .workspace-actions,
  .action-row,
  .meta-row,
  .insert-row,
  .status-row {
    width: 100%;
  }

  .highlight-pill,
  .status-chip,
  .meta-chip {
    width: 100%;
  }

  .button,
  .token-button {
    width: 100%;
  }

  .phone-body {
    height: 560px;
  }
}
