/* GiveMeSong — festive but grown-up: deep indigo ink, party magenta, a touch of confetti yellow. */
:root {
  --ink: #1f1a3d;
  --ink-soft: #4a4470;
  --muted: #6b6590;
  --paper: #fbf8ff;
  --surface: #ffffff;
  --line: #e4dcf2;
  --accent: #d6246f;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3ee;
  --sun: #ffc83d;
  --ok: #1e8a5a;
  --warn-bg: #fff6dc;
  --warn-line: #f2d27a;
  --err-bg: #fdecec;
  --err-line: #f0b4b4;
  --radius-lg: 22px;
  --radius: 12px;
  --display: "Secular One", "Assistant", system-ui, sans-serif;
  --body: "Assistant", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
[dir="ltr"] body { font-size: 17px; }

a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 760px; margin: 0 auto; padding: 18px 16px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo span { font-family: var(--display); font-size: 24px; letter-spacing: 0.2px; }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a, .nav button {
  font: inherit; font-size: 16px; color: var(--ink-soft); background: none; border: 0; padding: 6px 10px;
  border-radius: 999px; text-decoration: none; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: var(--accent-soft); color: var(--ink); }

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; padding-bottom: 6px; }
  .nav { width: 100%; gap: 2px; margin-inline-start: -10px; }
}
main { max-width: 760px; margin: 0 auto; padding: 8px 16px 64px; }

/* ---------- headings ---------- */
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0 0 12px; }
h1 { font-size: clamp(34px, 6vw, 52px); }
h2 { font-size: 26px; }
.lead { font-size: 20px; color: var(--ink-soft); margin: 0 0 28px; max-width: 34em; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.eyebrow { color: var(--accent); font-weight: 700; margin: 0 0 6px; }

/* ---------- cards & form ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.stack > * + * { margin-top: 20px; }

.field label, .field .label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 15px; }
input[type="text"], input[type="email"], input[type="password"], input[inputmode="numeric"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
textarea.lyrics-input { min-height: 380px; }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; direction: ltr; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* segmented choice */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label {
  display: inline-block; margin: 0; font-weight: 600; cursor: pointer; user-select: none;
  padding: 9px 16px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
}
.choices input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; }
.choices input:focus-visible + label { outline: 3px solid var(--sun); outline-offset: 2px; }

/* the "describe the occasion" box is the heart of the page */
.occasion textarea {
  min-height: 150px; font-size: 20px; border-width: 2px; border-color: var(--ink);
  border-radius: var(--radius-lg); padding: 16px 18px;
}

details.own-lyrics summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); padding: 4px 0; }
details.own-lyrics[open] summary { margin-bottom: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  padding: 11px 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink);
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #bd1c60; border-color: #bd1c60; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn.big { font-size: 20px; padding: 14px 28px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .price-tag { font-weight: 400; opacity: 0.9; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- notices ---------- */
.notice { border-radius: var(--radius); padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice.error { background: var(--err-bg); border-color: var(--err-line); }
.notice.ok { background: #e6f6ee; border-color: #a9dcc2; }
.free-badge {
  display: inline-block; background: var(--sun); color: var(--ink); font-weight: 700;
  padding: 4px 12px; border-radius: 999px; font-size: 15px; margin-bottom: 14px;
}
.demo-banner { background: var(--warn-bg); border: 1px dashed var(--warn-line); padding: 8px 12px; border-radius: var(--radius); font-size: 15px; }

/* ---------- lyrics editor ---------- */
.counter { font-size: 15px; color: var(--muted); }
.counter.over { color: #b3261e; font-weight: 700; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 15px; }
.meta-row span { background: var(--accent-soft); color: var(--ink); padding: 2px 10px; border-radius: 999px; }

/* ---------- composing: the one animated moment ---------- */
.composing { text-align: center; padding: 48px 24px; }
.eq { display: flex; justify-content: center; align-items: flex-end; gap: 7px; height: 90px; margin: 8px 0 26px; }
.eq i { width: 12px; border-radius: 6px; background: var(--accent); animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2n) { background: var(--ink); }
.eq i:nth-child(3n) { background: var(--sun); }
.eq i:nth-child(1) { animation-delay: -0.9s; } .eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; } .eq i:nth-child(4) { animation-delay: -0.1s; }
.eq i:nth-child(5) { animation-delay: -0.75s; } .eq i:nth-child(6) { animation-delay: -0.45s; }
.eq i:nth-child(7) { animation-delay: -0.2s; }
@keyframes eq { 0%, 100% { height: 18%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 60%; } }

/* ---------- result ---------- */
audio { width: 100%; margin: 6px 0 4px; }
.lyrics { white-space: pre-line; line-height: 1.8; font-size: 18px; color: var(--ink-soft); }
.lyrics .sec { display: inline-block; font-size: 14px; font-weight: 700; color: var(--accent); margin-top: 10px; }
.lyrics .sec:first-child { margin-top: 0; }
.lyrics-box { border-top: 1px solid var(--line); padding-top: 16px; }
.feedback button { font-size: 22px; padding: 6px 14px; }
.feedback button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.download-box { background: var(--accent-soft); border-radius: var(--radius-lg); padding: 20px; }

/* ---------- my songs ---------- */
.song-list { list-style: none; margin: 0; padding: 0; }
.song-list li { border-bottom: 1px solid var(--line); }
.song-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px; text-decoration: none; color: var(--ink); }
.song-list a:hover { background: var(--surface); }
.song-list .t { font-weight: 700; }
.status { font-size: 14px; padding: 2px 10px; border-radius: 999px; background: var(--line); color: var(--ink); white-space: nowrap; }
.status.READY { background: #e6f6ee; } .status.FAILED { background: var(--err-bg); } .status.COMPOSING { background: var(--warn-bg); }

/* ---------- share & pay pages ---------- */
.share-card, .pay-card { max-width: 640px; margin: 8px auto 48px; text-align: center; }
.share-card .lyrics { text-align: start; margin: 20px 0 28px; }
.price { font-family: var(--display); font-size: 48px; margin: 8px 0 20px; }
.pay-card form { margin: 0 0 10px; }

.toast {
  position: fixed; inset-inline: 16px; bottom: 20px; max-width: 520px; margin: 0 auto;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius); z-index: 10;
}
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- feedback comment ---------- */
.fb-comment textarea { min-height: 84px; }

/* ---------- admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-family: var(--display); font-size: 32px; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 14px; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.admin-list .card { padding: 16px 18px; }
.admin-list .handled { opacity: 0.6; }
.admin-list .who { margin: 6px 0; overflow-wrap: anywhere; }
.admin-list .msg { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- previous lyric versions ---------- */
details.versions summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); padding: 4px 0; }
details.versions[open] summary { margin-bottom: 10px; }
.version-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.version-list .card { padding: 16px 18px; background: var(--paper); }
.version-list .lyrics { font-size: 16px; margin: 0 0 12px; max-height: 260px; overflow: auto; }

/* ---------- admin: pronunciation comparison ---------- */
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.cmp-col { min-width: 0; }
.cmp-col .lyrics { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.cmp-col p { margin: 0 0 6px; }

/* ---------- niqqud preview ---------- */
.niqqud-box { border-top: 1px solid var(--line); padding-top: 16px; }
.nq-panel { margin-top: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.nq-panel > * + * { margin-top: 12px; }
.nq-text { font-size: 21px; line-height: 2.1; color: var(--ink); white-space: pre-line; }
.nq-w { cursor: pointer; border-radius: 6px; padding: 0 2px; }
.nq-w:hover { background: var(--accent-soft); }
.nq-w.flagged { background: #fde2e2; box-shadow: inset 0 -2px 0 #b3261e; }
.nq-w.fixed { box-shadow: inset 0 -2px 0 var(--ok); }
