/* Palette
   Deep Navy   #091540
   Cornflower  #7692ff
   Icy Blue    #abd2fa
   Dusk Blue   #3d518c
   Persian     #1b2cc1
*/

:root {
  --navy: #091540;
  --cornflower: #7692ff;
  --icy: #abd2fa;
  --dusk: #3d518c;
  --persian: #1b2cc1;

  --bg: #ffffff;
  --bg-soft: #f5f8fd;
  --text: var(--navy);
  --muted: #5c6784;
  --hairline: rgba(9, 21, 64, 0.10);
  --error: #d63649;

  --serif: "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius-card: 20px;
  --shadow-card: 0 2px 6px rgba(9, 21, 64, 0.04), 0 18px 44px rgba(9, 21, 64, 0.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  line-height: 1.5;
}

#app { max-width: 680px; margin: 0 auto; padding: 20px 22px 96px; }

.screen { display: none; }
.screen.active { display: block; animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.error { color: var(--error); margin-top: 12px; font-size: 0.9rem; text-align: center; }
.optional {
  color: var(--persian); font-weight: 400; font-size: 0.8rem;
  vertical-align: middle; margin-left: 6px;
}
.footnote { color: var(--muted); font-size: 0.8rem; line-height: 1.55; }
.eyebrow {
  color: var(--dusk); font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px;
}
.field-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--dusk); margin-bottom: 6px; }

/* ---------- hero ---------- */

.hero { text-align: center; padding: 72px 0 40px; }

svg.app-icon {
  width: 84px; height: 84px; display: block; margin: 0 auto 28px;
  border-radius: 50%;
  filter: drop-shadow(0 10px 24px rgba(27, 44, 193, 0.35));
}
.app-icon {
  margin: 0 auto 28px;
}
div.app-icon {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--cornflower) 0%, var(--persian) 78%);
  box-shadow: 0 10px 30px rgba(27, 44, 193, 0.35);
  display: flex; align-items: center; justify-content: center;
}
div.app-icon span { font-size: 2.2rem; color: #fff; }

.hero h1 {
  font-size: clamp(2.8rem, 8vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.hero h2 { font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 700; letter-spacing: -0.02em; }

.tagline {
  color: var(--muted);
  font-size: 1.2rem;
  margin-top: 16px;
  line-height: 1.55;
}

/* ---------- cards ---------- */

.card {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
  margin-top: 22px;
}
.card-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }

/* ---------- Spotify-look example viewer ---------- */

.examples { margin-top: 8px; }
.examples .eyebrow { margin-bottom: 14px; }

.example-note {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 14px;
}
.example-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.example-tab {
  border: 1px solid var(--hairline);
  background: var(--bg);
  color: var(--dusk);
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.example-tab:hover { background: var(--bg-soft); }
.example-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.sp-card {
  background: #121212;
  border-radius: 16px;
  overflow: hidden;
  max-height: 430px;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}
.sp-header {
  display: flex; align-items: flex-end; gap: 16px;
  padding: 22px 20px 16px;
}
.sp-cover {
  width: 84px; height: 84px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.9); font-size: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.sp-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sp-type { color: #b3b3b3; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.sp-title { color: #fff; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.sp-sub { color: #b3b3b3; font-size: 0.8rem; }

.sp-tracks { list-style: none; padding: 4px 8px 14px; }
.sp-tracks li {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 12px; border-radius: 6px;
}
.sp-tracks li:hover { background: #1d1d1d; }
.sp-num { color: #b3b3b3; font-size: 0.85rem; width: 16px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.sp-cell { min-width: 0; }
.sp-track { color: #fff; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-artist { color: #b3b3b3; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sp-card::-webkit-scrollbar { width: 10px; }
.sp-card::-webkit-scrollbar-thumb { background: #3e3e3e; border-radius: 99px; border: 2px solid #121212; }
.sp-card::-webkit-scrollbar-track { background: transparent; }

/* ---------- about ---------- */

.about { margin-top: 44px; padding: 0 6px 20px; }
.about h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 10px; }
.about p { color: var(--muted); font-size: 0.95rem; line-height: 1.65; margin-bottom: 10px; }
.about a { color: var(--persian); text-decoration: none; }
.about a:hover { text-decoration: underline; }

.connect-box { display: flex; flex-direction: column; gap: 12px; }

.dev-notice {
  background: rgba(171, 210, 250, 0.25);
  border: 1px solid rgba(118, 146, 255, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--dusk);
}
.dev-notice p + p { margin-top: 8px; }
.dev-notice b { color: var(--navy); }
.dev-notice a { color: var(--persian); font-weight: 600; text-decoration: none; }
.dev-notice a:hover { text-decoration: underline; }

.help { margin-top: 10px; }
.help summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.help summary:hover { color: var(--dusk); }
.help .field-label { margin-top: 16px; }
.help ol { margin: 14px 0 10px 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.help a { color: var(--persian); text-decoration: none; }
.help a:hover { text-decoration: underline; }
.help code {
  background: var(--bg-soft); border: 1px solid var(--hairline);
  padding: 2px 7px; border-radius: 6px; font-size: 0.82em; word-break: break-all; color: var(--navy);
}
.btn-copy {
  background: none; border: 1px solid var(--hairline); color: var(--dusk);
  border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 0.75rem; font-family: inherit;
}
.btn-copy:hover { border-color: var(--cornflower); color: var(--persian); }

/* ---------- inputs ---------- */

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233d518c' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  background: var(--bg);
  border-color: var(--cornflower);
  box-shadow: 0 0 0 4px rgba(118, 146, 255, 0.22);
}
textarea { resize: vertical; }
::placeholder { color: #9aa3b8; }

.input-hero { font-size: 1.15rem; padding: 16px 18px; }

/* ---------- buttons ---------- */

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, color 0.15s;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--persian);
  color: #fff;
  box-shadow: 0 8px 22px rgba(27, 44, 193, 0.28);
}
.btn-primary:hover { background: #2337e8; }
.btn-primary:disabled { background: var(--cornflower); box-shadow: none; cursor: wait; }

.btn-quiet { background: var(--bg-soft); color: var(--dusk); }
.btn-quiet:hover { background: #e9eef9; color: var(--navy); }

.btn-small { padding: 7px 16px; font-size: 0.85rem; }
.btn-big { width: 100%; padding: 16px; font-size: 1.05rem; }

/* ---------- loading ---------- */

.loading-wrap { text-align: center; padding-top: 140px; }
.loading-wrap h2 { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.progress-track {
  background: var(--bg-soft); border-radius: 999px; height: 8px;
  margin: 36px auto 12px; max-width: 380px; overflow: hidden;
}
.progress-bar {
  background: linear-gradient(90deg, var(--cornflower), var(--persian));
  height: 100%; width: 0%; border-radius: 999px; transition: width 0.3s ease;
}

/* ---------- topbar ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0 34px;
}
.brand { font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
button.brand {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--text);
}
button.brand:hover svg.brand-mark { filter: brightness(1.15); }
svg.brand-mark { width: 28px; height: 28px; border-radius: 50%; }

/* ---------- compose ---------- */

.compose-form { display: flex; flex-direction: column; gap: 10px; }
.big-label {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
  margin-top: 26px; margin-bottom: 2px;
}
.options-row { display: flex; gap: 14px; margin-top: 20px; }
.first-song-row { margin-top: 8px; }
.first-song-row + .footnote { margin-top: 8px; }
.option { flex: 1; }
#btn-compose { margin-top: 30px; }
#claude-key-row { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- preview / poem editor (Spotify-look, editable) ---------- */

.demo-hero { text-align: center; margin: 4px 0 22px; }
.demo-title {
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.demo-tagline { font-size: 1.05rem; margin-top: 8px; }
.made-by {
  margin-top: 64px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--serif); font-style: italic;
  color: var(--muted); font-size: 1rem;
}
.made-by a { display: inline-flex; }
.made-by img { width: 20px; height: 20px; border-radius: 50%; display: block; }
.made-by a:hover img { filter: brightness(1.1); }
.note-label { color: var(--navy); font-weight: 700; }
.demo-hint-card {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}
.hint-title {
  color: var(--navy); font-weight: 700; font-size: 1.05rem;
  text-align: center; margin-bottom: 10px;
}
.hint-list {
  list-style: none;
  width: fit-content;
  margin: 0 auto 12px;
  display: flex; flex-direction: column; gap: 7px;
  text-align: left;
}
.hint-list li { display: flex; align-items: center; gap: 10px; }
.hint-key {
  background: #fff;
  border: 1px solid rgba(118, 146, 255, 0.5);
  color: var(--navy);
  border-radius: 7px;
  min-width: 38px;
  padding: 1px 7px;
  text-align: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.hint-foot { text-align: center; color: var(--muted); font-size: 0.82rem; }

.sp-editor { max-height: none; }
.sp-editor .sp-tracks li { position: relative; padding-right: 8px; }

.line-controls { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; margin-left: auto; flex-shrink: 0; }
.sp-tracks li:hover .line-controls, .sp-tracks li:focus-within .line-controls { opacity: 1; }
.line-controls button {
  background: none; border: none; color: #b3b3b3; cursor: pointer;
  font-size: 0.95rem; padding: 5px 7px; border-radius: 8px; font-family: inherit;
}
.line-controls button:hover { color: #fff; background: #2a2a2a; }

.add-line { position: relative; margin: 4px 16px 18px; }
.add-line input {
  background: #1d1d1d; border: 1px dashed #3e3e3e; color: #fff;
  border-radius: 10px; font-size: 0.9rem; padding: 11px 14px;
}
.add-line input::placeholder { color: #7a7a7a; }
.add-line input:focus { border-style: solid; border-color: var(--cornflower); background: #242424; box-shadow: none; }
.search-results {
  position: absolute; z-index: 10; left: 0; right: 0; bottom: calc(100% + 6px);
  background: #1d1d1d; border: 1px solid #3e3e3e; border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  list-style: none; max-height: 280px; overflow-y: auto; padding: 6px;
}
.search-results li { padding: 10px 14px; cursor: pointer; border-radius: 9px; }
.search-results li:hover { background: #2a2a2a; }
.search-results .sr-title { color: #fff; font-size: 0.9rem; }
.search-results .sr-artist { color: #b3b3b3; font-size: 0.8rem; }

.preview-about { margin-top: 12px; }

.save-row { display: flex; flex-direction: column; gap: 16px; align-items: stretch; margin-top: 26px; }
.checkbox { color: var(--muted); display: flex; gap: 8px; align-items: center; font-size: 0.9rem; justify-content: center; }
.checkbox input { accent-color: var(--persian); }

/* ---------- done ---------- */

.done-title { margin-bottom: 8px; }
.done-poem {
  font-family: var(--serif); font-style: italic; font-size: 1.15rem; line-height: 1.75;
  color: var(--navy); margin: 26px auto 32px; max-width: 400px; text-align: center;
  white-space: pre-line;
}
.done-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 480px) {
  .hero { padding-top: 48px; }
  .options-row { flex-direction: column; }
  .card { padding: 22px; }
}
