:root {
  /* Simplified Modern Studio Palette - Clean, Elegant, Uncluttered */
  --bg-dark: #0d1117;
  --bg-body: #0b0e14;
  --bg-card: #151b26;
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-card-inner: #0f131d;

  --accent-primary: #f97316;        /* Warm Studio Amber/Ember */
  --accent-primary-hover: #ea580c;
  --accent-highlight: #fbbf24;      /* Soft Honey Gold */
  --accent-soft: rgba(249, 115, 22, 0.12);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --transition: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  line-height: 1.4;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
}

/* Subtle, single ambient glow (clean, not busy) */
.ambient-glow {
  position: fixed;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 400px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.08) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* Mobile Wrapper - Compact & Focused */
.mobile-wrapper {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  padding: env(safe-area-inset-top, 6px) 12px env(safe-area-inset-bottom, 12px);
  gap: 10px;
}

/* Header - Clean, Professional & Friendly */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 2px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--accent-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.brand-logo svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1;
}

.header-vibe-pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-block;
  cursor: pointer;
  margin-top: 3px;
  transition: all var(--transition);
}

.header-vibe-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.header-actions {
  display: flex;
  gap: 6px;
}

.header-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.header-icon-btn:active {
  transform: scale(0.94);
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Base Card - Clean Slate Surface */
.compact-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Prompt Card */
.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.input-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.link-clear-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition);
}

.link-clear-btn:hover {
  color: var(--text-muted);
}

.input-container {
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  background: var(--bg-card-inner);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  color: #fff;
  resize: none;
  outline: none;
  line-height: 1.4;
  transition: border-color var(--transition);
}

textarea:focus {
  border-color: var(--accent-primary);
}

/* Quick Stories Strip - Unified, Clean Pills */
.quick-stories-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-stories-strip::-webkit-scrollbar {
  display: none;
}

.story-tag {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  transition: all var(--transition);
}

.story-tag:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.story-tag.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.35);
}

/* Action Buttons Row */
.generate-btn-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

/* Primary Create Song Button - Solid, Confident Ember */
.compact-generate-btn {
  flex: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.3);
  transition: all var(--transition);
}

.compact-generate-btn:hover {
  background: var(--accent-primary-hover);
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.45);
}

.compact-generate-btn:active {
  transform: scale(0.98);
}

/* Create Another / Skip Button - Clean Slate */
.compact-next-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.compact-next-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.2);
}

.compact-next-btn:active {
  transform: scale(0.98);
}

.btn-sparkle {
  font-size: 1rem;
}

/* Studio Player Card */
.studio-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Play Button - Clean, Confident Accent */
.compact-play-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(249, 115, 22, 0.35);
  transition: all var(--transition);
}

.compact-play-btn:hover {
  background: var(--accent-primary-hover);
  transform: scale(1.04);
}

.compact-play-btn:active {
  transform: scale(0.95);
}

.compact-play-btn svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.compact-play-btn.playing svg#playIcon {
  display: none;
}
.compact-play-btn.playing svg#pauseIcon {
  display: block;
  margin-left: 0;
}

.compact-skip-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.compact-skip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.compact-skip-btn:active {
  transform: scale(0.94);
}

.track-details {
  flex-grow: 1;
  min-width: 0;
}

.track-details h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.track-sub-details {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.badge-section {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.time-text {
  font-family: monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.lead-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

/* Scrubber - Clean Ember Line */
.compact-scrubber-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.scrubber-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.1s linear;
}

/* Visualizer - Clean Container */
.compact-visualizer {
  width: 100%;
  height: 28px;
  background: var(--bg-card-inner);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

#visualizerCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Player Action Row */
.player-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr 1.2fr;
  gap: 6px;
}

.pill-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.pill-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.pill-action-btn:active {
  transform: scale(0.96);
}

.gold-glow {
  background: rgba(249, 115, 22, 0.14) !important;
  border-color: rgba(249, 115, 22, 0.4) !important;
  color: var(--accent-primary) !important;
}

.gold-glow:hover {
  background: rgba(249, 115, 22, 0.22) !important;
  border-color: var(--accent-primary) !important;
}

/* Lyrics Section */
.compact-lyrics-section {
  background: var(--bg-card-inner);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.lyrics-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lyrics-dedication {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: none;
  font-weight: 500;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lyrics-scroll-box {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.lyrics-scroll-box::-webkit-scrollbar {
  width: 4px;
}
.lyrics-scroll-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.lyric-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  transition: all var(--transition);
}

.lyric-item.highlight {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.lyric-tag-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.lyric-tag {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-highlight);
}

.lyric-tag.chorus {
  color: var(--accent-primary);
}

.lyric-chords {
  font-family: monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
}

.lyric-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #e2e8f0;
  white-space: pre-line;
}

/* Sliding Options Drawer */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  transition: opacity 0.2s ease;
}

.options-drawer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  background: #151b26;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px 16px 0 0;
  padding: 18px 16px env(safe-area-inset-bottom, 20px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
  z-index: 101;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #fff;
  font-weight: 800;
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.drawer-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-section label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.drawer-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drawer-pill {
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.drawer-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.drawer-pill.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  font-weight: 800;
}

.cloudflare-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.cf-badge {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.cf-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Studio Master Modal */
.studio-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 102;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #151b26;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gold-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: #1a0800;
  background: var(--accent-highlight);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.modal-title-group h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #fff;
  font-weight: 800;
  line-height: 1.2;
}

.modal-title-group p {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.master-option-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 13px;
}

.option-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.option-icon {
  font-size: 1.2rem;
}

.option-header strong {
  display: block;
  font-size: 0.86rem;
  color: #fff;
  font-weight: 800;
}

.option-header span {
  font-size: 0.7rem;
  color: var(--accent-primary);
  font-weight: 700;
}

.option-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.btn-gold-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
  transition: all var(--transition);
}

.btn-gold-action:hover {
  background: var(--accent-primary-hover);
}

.btn-gold-action:active {
  transform: scale(0.98);
}

.api-key-input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.api-key-input-row input {
  flex: 1;
  background: var(--bg-card-inner);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: #fff;
  font-size: 0.78rem;
  outline: none;
}

.btn-save-key {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-generate-api {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-generate-api:hover {
  background: rgba(255, 255, 255, 0.1);
}

.master-player-card {
  background: var(--bg-card-inner);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 11px;
}

.master-track-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#masterTrackTitle {
  font-size: 0.86rem;
  font-weight: 800;
  color: #fff;
}

.master-tag {
  font-size: 0.68rem;
  color: var(--accent-primary);
  font-weight: 700;
}

/* Toast - Clean, Uncluttered Alert */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a2230;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 9999;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}
