:root {
  --bg: #0e0e0e;
  --bg2: #141414;
  --card: #161616;
  --line: #262626;
  --ink: #f5f5f5;
  --dim: #cfcfcf;
  --faint: #8a8a8a;
  --wine: #ff5a6e;       /* coral, lighter (hover/border/focus) */
  --wine-lo: #f24257;    /* brand coral (buttons, lyric badge) */
  --gold: #f24257;       /* brand coral accent (labels, links, pips) */
  --es: #f5f5f5;
  --en: #cfcfcf;
}

* { box-sizing: border-box; }
/* Dark gutters so a side panel dragged wide doesn't show bright edges around the column. */
html { margin: 0; height: 100%; background: var(--bg); }
body {
  margin: 0 auto;            /* center the column */
  max-width: 620px;          /* never sprawl edge-to-edge when the side panel is wide */
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, var(--bg2), var(--bg));
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
}
.brand .mark { flex: none; }
.brand .el { color: var(--gold); }
.brand .eje { color: var(--ink); }

#q {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  outline: none;
}
#q:focus { border-color: var(--wine); }
#q::placeholder { color: var(--faint); }

/* Detect-tango control */
.detect-bar { display: flex; gap: 7px; margin-top: 8px; }
.detect-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; background: var(--wine-lo); color: #fff;
  border: 1px solid var(--wine); border-radius: 9px; padding: 8px 12px;
  font-size: 13px; font-weight: 600;
}
.detect-btn:hover { background: var(--wine); }
.detect-btn:disabled { opacity: 0.6; cursor: default; }
.mic-btn {
  cursor: pointer; background: transparent; color: var(--gold);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  font-size: 12px; font-weight: 600;
}
.mic-btn:hover { background: var(--bg2); }
.mic-btn:disabled { opacity: 0.5; cursor: default; }

/* Detect feedback panel (transient: listening / identifying / result) */
.detect-panel {
  margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--bg2); color: var(--dim); font-size: 13px;
}
.detect-panel .dh { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 600; }
.detect-panel .sub { color: var(--faint); font-size: 12px; margin-top: 4px; }
.detect-panel .dt-detail {
  margin-top: 6px; padding: 5px 8px; border-radius: 5px; background: var(--bg);
  border: 1px solid var(--line); color: var(--faint);
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-word;
}
.detect-panel .row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.detect-panel .cand {
  list-style: none; margin: 8px 0 0; padding: 0;
}
.detect-panel .cand li {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); cursor: pointer; margin-bottom: 6px;
}
.detect-panel .cand li:hover { border-color: var(--wine); }
.detect-panel .cand .r-sub { color: var(--dim); font-size: 12px; }
.detect-panel .x {
  margin-left: auto; background: none; border: none; color: var(--faint);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px;
}
.detect-panel .x:hover { color: var(--ink); }

/* listening pulse */
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--wine-lo); flex: none;
  animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(0.7); opacity: 0.5; } 50% { transform: scale(1.15); opacity: 1; } }
.spin {
  width: 13px; height: 13px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--gold); animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.detect-panel.bad .dh { color: var(--ink); }

/* "identified by sound" banner inside the detail view */
.sound-banner {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  padding: 7px 10px; border-radius: 8px;
  background: rgba(242, 66, 87, 0.12); border: 1px solid var(--wine);
  color: var(--ink); font-size: 12.5px;
}
.sound-banner b { color: var(--gold); font-weight: 700; }

#main { flex: 1; overflow-y: auto; }

.status, .empty-hint { color: var(--dim); padding: 18px 16px; }
.empty-hint b { color: var(--ink); }
.empty-hint .counts { color: var(--gold); }

/* Results list */
.results { list-style: none; margin: 0; padding: 6px 0; }
.results li {
  padding: 9px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.results li:hover { background: var(--bg2); }
.results .r-title { font-weight: 600; }
.results .r-sub { color: var(--dim); font-size: 12.5px; }
.badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: 1px;
  background: var(--line);
  color: var(--dim);
}
.badge.lyr { background: var(--wine-lo); color: #ffffff; }

/* Detail */
.detail { padding: 14px 16px 40px; }
.back {
  background: none; border: none; color: var(--gold);
  cursor: pointer; padding: 0 0 10px; font-size: 13px;
}
.d-title { font-size: 19px; font-weight: 700; margin: 2px 0 2px; }
.d-by { color: var(--dim); margin-bottom: 10px; }
.d-by .sep { color: var(--faint); margin: 0 5px; }

.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fact {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 7px; padding: 3px 9px; font-size: 12px;
}
.fact b { color: var(--gold); font-weight: 600; }

/* mood pips */
.dims { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 4px 0 14px; }
.dim { font-size: 11px; color: var(--dim); display: flex; align-items: center; gap: 5px; }
.pips { display: inline-flex; gap: 2px; }
.pip { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.pip.on { background: var(--gold); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; cursor: pointer;
  background: var(--wine-lo); color: #fbe9ec;
  border: 1px solid var(--wine); border-radius: 8px;
  padding: 7px 12px; font-size: 13px; font-weight: 600;
}
.btn:hover { background: var(--wine); }
.btn.ghost { background: transparent; color: var(--gold); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg2); }

.section-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--faint); margin: 18px 0 8px; border-top: 1px solid var(--line); padding-top: 14px;
}

/* lyrics */
.lyrics { display: flex; gap: 18px; }
.lyr-col { flex: 1 1 240px; min-width: 0; }
.lyr-col h4 { margin: 0 0 6px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.lyr-col pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font: inherit; font-size: 13.5px;
}
.lyr-col.es pre { color: var(--es); }
.lyr-col.en pre { color: var(--en); }
@media (max-width: 460px) { .lyrics { flex-direction: column; } }
/* interleaved: each Spanish line with its English translation right below it */
.lyrics-flow .lg { padding: 4px 0; }
.lyrics-flow .lg + .lg { border-top: 1px solid rgba(255,255,255,.04); }
.lyrics-flow .lg .es { font-size: 14px; color: var(--es); }
.lyrics-flow .lg .en { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.contrib { color: var(--faint); font-size: 11.5px; white-space: pre-wrap; margin-top: 12px; }
.no-lyrics { color: var(--dim); font-style: italic; }

/* sharing consent footer (always visible) */
#share-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 8px 14px;
  border-top: 1px solid var(--line); background: var(--bg2); font-size: 12px;
}
#share-row { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
#share-row input { cursor: pointer; }
#share-bar .share-note { color: var(--faint); flex: 1 1 100%; font-size: 11px; line-height: 1.35; }
#share-privacy { color: var(--coral, #f24257); text-decoration: none; font-size: 11.5px; margin-left: auto; }
#share-privacy:hover { text-decoration: underline; }

/* timing-contributions footer */
#contrib-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-top: 1px solid var(--line); background: var(--bg2); font-size: 12px;
}
#contrib-count { color: var(--faint); flex: 1; }
#contrib-bar .btn { padding: 5px 10px; font-size: 12px; }
.contrib-clear {
  background: none; border: none; color: var(--faint); cursor: pointer;
  font-size: 11.5px; text-decoration: underline; padding: 0;
}
.contrib-clear:hover { color: var(--wine-lo); }

/* page→track confirmations footer (mirrors the timings footer) */
#confirm-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-top: 1px solid var(--line); background: var(--bg2); font-size: 12px;
}
#confirm-count { color: var(--faint); flex: 1; }
#confirm-bar .btn { padding: 5px 10px; font-size: 12px; }

/* "this is what's playing here" control on a song detail */
#confirm-slot { margin: 2px 0 8px; }
.confirm-set { font-size: 12.5px; }
.confirm-row.done {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--gold);
  background: rgba(242, 66, 87, 0.10); border: 1px solid var(--wine);
  border-radius: 8px; padding: 6px 10px;
}
.confirm-row.done b { color: var(--ink); }
.confirm-note { color: var(--faint); font-size: 11px; margin-top: 4px; }
.sound-banner .link, .confirm-row .link {
  background: none; border: none; color: var(--gold); cursor: pointer;
  font: inherit; text-decoration: underline; padding: 0; margin-left: auto;
}
.sound-banner .link:hover, .confirm-row .link:hover { color: var(--wine); }

/* "Add timing" button in a section header */
.section-h .time-btn {
  float: right; text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 600;
  background: var(--card); color: var(--gold); border: 1px solid var(--gold);
  border-radius: 6px; padding: 3px 9px; cursor: pointer; margin-top: -3px;
}
.section-h .time-btn:hover { background: var(--bg2); }

/* panel click-to-stamp timing tool */
.ptiming { margin-top: 4px; }
.pt-bar, .pt-anchors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pt-play { background: var(--gold); color: #fff; border: 0; border-radius: 7px; padding: 7px 14px; font-weight: 700; cursor: pointer; }
.pt-play:hover { background: var(--wine); }
.pt-clock { font: 600 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); min-width: 64px; }
.pt-mini { background: var(--card); color: var(--dim); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12px; cursor: pointer; }
.pt-mini:hover { color: var(--ink); border-color: #555; }
.pt-prog { margin-left: auto; color: var(--faint); font-size: 12px; }
.pt-chip { color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 34px; }
.pt-tip { color: var(--faint); font-size: 12px; margin-bottom: 10px; }
.pt-tip b { color: var(--gold); }
.pt-lines { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; }
.pt-ln { display: flex; gap: 10px; align-items: baseline; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.pt-ln:hover { background: var(--bg2); }
.pt-ln.cur { box-shadow: inset 3px 0 0 var(--gold); background: rgba(242, 66, 87, .08); }
.pt-ln .pt-t { min-width: 46px; font: 11px ui-monospace, Menlo, monospace; color: var(--faint); flex: none; }
.pt-ln.done .pt-t { color: var(--gold); }
.pt-ln .pt-x .es { display: block; color: var(--es); font-size: 14px; }
.pt-ln .pt-x .en { display: block; color: var(--faint); font-size: 12.5px; }
.pt-foot { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.pt-tap { flex: 1; background: var(--gold); color: #fff; border: 0; border-radius: 8px; padding: 11px; font-weight: 700; font-size: 14px; cursor: pointer; }
.pt-tap:hover { background: var(--wine); }
.pt-saved { color: #4ec77f; font-size: 12px; margin-top: 8px; }

/* lyrics editor (add/edit/reorder paired es/en lines) */
.section-h .lyr-acts { float: right; display: inline-flex; gap: 6px; }
.section-h .lyr-acts .time-btn { float: none; }
.edited-tag { font-size: 10px; text-transform: none; letter-spacing: 0; color: var(--gold);
  border: 1px solid var(--gold); border-radius: 5px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.le-tip { color: var(--faint); font-size: 12px; margin-bottom: 10px; }
.le-tip b { color: var(--gold); }
.le-rows { display: flex; flex-direction: column; gap: 6px; max-height: 56vh; overflow-y: auto; }
.le-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: start; }
.le-row textarea {
  width: 100%; resize: none; overflow: hidden; min-height: 30px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; font: inherit; font-size: 13px; line-height: 1.35;
}
.le-row .le-en { color: var(--dim); }
.le-row textarea:focus { border-color: var(--wine); outline: none; }
.le-ctl { display: flex; flex-direction: column; gap: 3px; }
.le-ctl button {
  background: var(--card); border: 1px solid var(--line); border-radius: 5px; color: var(--faint);
  cursor: pointer; width: 26px; height: 26px; font-size: 13px; line-height: 1;
}
.le-ctl button:hover:not(:disabled) { color: var(--ink); border-color: #555; }
.le-ctl button:disabled { opacity: 0.35; cursor: default; }
.le-foot { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* "Añadir grabación" — the base credits are read-only; the user can only append */
.le-by-view { color: var(--dim); font-size: 12.5px; line-height: 1.45; white-space: pre-wrap;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
.le-by-empty { color: var(--faint); font-style: italic; }
.le-grab-h { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 8px 0 4px; }
.le-grab { margin: 8px 0 2px; }
.le-grab-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.le-grab-o, .le-grab-s {
  flex: 1 1 130px; min-width: 0; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12.5px;
}
.le-grab-o:focus, .le-grab-s:focus { border-color: var(--wine); outline: none; }
.le-grab-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.le-grab-item {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px 4px 9px;
}
.le-grab-item span { flex: 1 1 auto; min-width: 0; }
.le-grab-del { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 15px; line-height: 1; }
.le-grab-del:hover { color: var(--wine); }

/* other recordings */
.recs { list-style: none; margin: 0; padding: 0; }
.recs li { padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.recs li:hover { color: var(--gold); }
.recs .r-sub { color: var(--dim); font-size: 12px; }
/* display-only under the currently-playing track (no misclicks) */
.recs.static li { cursor: default; }
.recs.static li:hover { color: inherit; }

/* tandas */
#tanda-slot { margin: 4px 0 2px; }
.tanda { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-top: 10px; }
.tanda-h { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--gold); margin-bottom: 6px; }
.reshuffle { margin-left: auto; background: none; border: 1px solid var(--line); color: var(--gold); border-radius: 6px; cursor: pointer; padding: 0 8px; font-size: 14px; line-height: 1.6; }
.reshuffle:hover { background: var(--bg2); }
ol.tanda-tracks { margin: 0; padding-left: 20px; }
ol.tanda-tracks li { padding: 4px 0; color: var(--ink); }
ol.tanda-tracks li.here { color: var(--gold); }
ol.tanda-tracks li[data-id] { cursor: pointer; }
ol.tanda-tracks li[data-id]:hover { color: var(--gold); }
ol.tanda-tracks .r-sub { color: var(--dim); font-size: 12px; margin-left: 6px; }

/* learning */
.learn { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 12px; }
.learn .l-name { font-weight: 700; }
.learn .l-sub { color: var(--dim); font-size: 12px; margin-bottom: 6px; }
.learn .l-fields { color: var(--dim); font-size: 12px; margin: 6px 0; }
.learn .l-fields b { color: var(--ink); font-weight: 600; }
.learn .l-bio { font-size: 13px; }
details > summary { cursor: pointer; color: var(--gold); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
