/* style.css */
:root {
  --bg: #12110f;
  --bg-elev: #1c1a16;
  --ink: #f3ead7;
  --muted: #b7ab93;
  --gold: #e0b45a;
  --coral: #e07a5f;
  --teal: #7eb8a6;
  --line: #3a342c;
  --weed: #f0a39a;
  --ok: #8fcead;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font-ui: Outfit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Fraunces, Georgia, "Times New Roman", serif;
  --radius: 18px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4eee2;
    --bg-elev: #fffaf1;
    --ink: #1c1812;
    --muted: #6b6254;
    --gold: #9a6b12;
    --coral: #c45c3e;
    --teal: #2f6f62;
    --line: #ddd2bc;
    --weed: #a33b32;
    --ok: #1f6d45;
    --shadow: 0 10px 28px rgba(60, 40, 10, 0.08);
  }
}

:root[data-theme="light"] {
  --bg: #f4eee2;
  --bg-elev: #fffaf1;
  --ink: #1c1812;
  --muted: #6b6254;
  --gold: #9a6b12;
  --coral: #c45c3e;
  --teal: #2f6f62;
  --line: #ddd2bc;
  --weed: #a33b32;
  --ok: #1f6d45;
  --shadow: 0 10px 28px rgba(60, 40, 10, 0.08);
}

:root[data-theme="dark"] {
  --bg: #12110f;
  --bg-elev: #1c1a16;
  --ink: #f3ead7;
  --muted: #b7ab93;
  --gold: #e0b45a;
  --coral: #e07a5f;
  --teal: #7eb8a6;
  --line: #3a342c;
  --weed: #f0a39a;
  --ok: #8fcead;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(224, 180, 90, 0.08), transparent 50%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
}
.skip:focus {
  left: 8px;
  z-index: 20;
  background: var(--gold);
  color: #111;
  padding: 8px 12px;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.mark {
  font-family: var(--font-display);
  font-size: 1.65rem;
  margin: 0;
  letter-spacing: -0.03em;
}
.tag { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.92rem;
}
.nav a[aria-current="page"] {
  background: var(--gold);
  color: #1a1408;
  border-color: transparent;
}

main { padding: 20px; max-width: 1180px; margin: 0 auto; }

.paper {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.paper.tight { padding: 18px; }
.hero h1, .paper h1, .paper h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 10px;
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 8px;
}
.lede { font-size: 1.12rem; color: var(--muted); margin: 0 0 8px; }
.lede.short { font-size: 1rem; }
.subhead { margin-top: 22px; font-size: 1.2rem; }

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

.prompt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  background: color-mix(in srgb, var(--bg) 70%, var(--bg-elev));
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  list-style: none;
}
.tags li, .pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.weeds { color: var(--coral); font-size: 0.95rem; }
.forms { padding-left: 1.1rem; }
.forms li { margin-bottom: 8px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip, .btn {
  min-height: 44px;
  min-width: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 0 16px;
  cursor: pointer;
}
.chip.on, .btn.primary {
  background: var(--gold);
  color: #1a1408;
  border-color: transparent;
}
.btn.ghost { font-weight: 500; color: var(--muted); }
.btn.tiny { min-height: 44px; padding: 0 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:hover:not(:disabled), .chip:hover { border-color: var(--gold); }

.search-wrap input, label input, label textarea, label select, #rhyme-word {
  width: 100%;
  margin-top: 6px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}
label textarea, #lyrics {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}
#lyrics {
  min-height: 52vh;
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.6;
}
label { display: block; margin: 12px 0; font-weight: 600; font-size: 0.88rem; color: var(--muted); }
label.full { margin: 0; }

.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .cards { grid-template-columns: 1fr 1fr; }
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card.odd { border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.card.straight { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }
.card h2 { font-size: 1.35rem; margin: 0; }
.card p { margin: 0; color: var(--muted); flex: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.bpm { color: var(--gold); font-size: 0.8rem; font-weight: 700; }
.card-actions, .desk-actions, .mix-actions, .insert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.empty-card, .hint { color: var(--muted); }

.mix-out {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  border: 1px dashed var(--line);
}
.mix-out.empty { color: var(--muted); }
.knob-legend { color: var(--muted); }

.workshop {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 980px) {
  .workshop {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(220px, 300px);
    align-items: start;
  }
}
.desk-side .desk-actions { margin: 8px 0 16px; }
.draft-list h2 { font-size: 1rem; margin: 8px 0; }
.draft {
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 8px 0;
}
.draft.on strong { color: var(--gold); }
.draft-open {
  flex: 1;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
}
.draft-open span { display: block; color: var(--muted); font-size: 0.8rem; }

.meter { max-height: 220px; overflow: auto; font-size: 0.8rem; }
.mrow { display: grid; grid-template-columns: 28px 28px 1fr; gap: 6px; padding: 2px 0; }
.mrow .n, .mrow .s { color: var(--muted); font-variant-numeric: tabular-nums; }
.mrow.tag .l { color: var(--teal); }
.radar { font-size: 0.9rem; }
.radar.ok { color: var(--ok); }
.radar.bad { color: var(--weed); }
.rhyme-form { display: flex; gap: 8px; }
.rhyme-form input { flex: 1; margin-top: 0; }
.words { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.word {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 10px;
  min-height: 40px;
  font: inherit;
  cursor: pointer;
}
.tools h2 { font-size: 1rem; margin: 14px 0 8px; font-family: var(--font-ui); }
.status { min-height: 1.2em; color: var(--teal); font-size: 0.85rem; }

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 30;
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
