/* Companion theme — mirrors the cabin's lyrics view so musicians get the
   same visual language on their phones. Sections in blue, chords in gold,
   lyrics in soft white. Toggle hides chords for a "lyrics-only" view. */

:root {
  --bg: #0a0a14;
  --bg-elev: #14141f;
  --fg: #ececf1;
  --fg-dim: #9aa0b4;
  --accent: #FBAE00;
  --section: #60a5fa;
  --chord:   #FBAE00;
  --lyric:   #e2e8f0;
  --border: rgba(255,255,255,0.08);
  --ok: #28c840;
  --warn: #febc2e;
  --err: #ff5f57;
  --lyric-scale: 1;
  /* Derivados (el tema de LivePads los sobrescribe desde companion.js). */
  --on-accent: #0a0a14;
  --top-bg: rgba(10,10,20,0.92);
  --bar-bg: rgba(10,10,20,0.96);
  --bg-sheet: #12141c;
  --soft: rgba(255,255,255,0.06);
  --soft-2: rgba(255,255,255,0.12);
  --line: rgba(255,255,255,0.16);
  --fg-soft: rgba(255,255,255,0.65);
  --scrim: rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.top {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--top-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  gap: 10px;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
}
.brand-accent { color: var(--accent); }

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chord-toggle {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chord-toggle:hover { border-color: var(--accent); color: var(--accent); }
.chord-toggle[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.conn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg-dim);
}
.conn[data-state="connecting"] { color: var(--warn); }
.conn[data-state="open"]       { color: var(--ok); }
.conn[data-state="closed"]     { color: var(--err); }

.stage {
  padding: 20px 16px 60px;
  max-width: 720px;
  margin: 0 auto;
}

.empty {
  margin-top: 30vh;
  text-align: center;
  color: var(--fg-dim);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 18px; color: var(--fg); margin-bottom: 6px; }
.empty-sub { font-size: 14px; }

/* ── Section TOC (sticky pills) ──────────────────────────────────── */
.song-toc {
  position: sticky;
  top: 56px;
  z-index: 5;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 8px 2px;
  margin-bottom: 12px;
  background: var(--top-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.song-toc::-webkit-scrollbar { display: none; }

.toc-pill {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.toc-pill:active { transform: scale(0.96); }
.toc-pill.is-current {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.song-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "key title"
    "key artist"
    "bpm bpm";
  gap: 4px 14px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 20px;
}

.song-key {
  grid-area: key;
  align-self: center;
  font-size: calc(28px * var(--lyric-scale));
  font-weight: 700;
  color: var(--accent);
  padding: 0 12px;
  border-right: 1px solid var(--border);
  min-width: 56px;
  text-align: center;
  position: relative;
}

.live-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(40, 200, 64, 0.6);
}
.live-dot.is-pulsing {
  animation: livePulse 1.4s ease-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(40, 200, 64, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(40, 200, 64, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 200, 64, 0); }
}
.song-title { grid-area: title; font-size: calc(18px * var(--lyric-scale)); font-weight: 600; }
.song-artist { grid-area: artist; font-size: calc(13px * var(--lyric-scale)); color: var(--fg-dim); }
.song-bpm { grid-area: bpm; font-size: calc(12px * var(--lyric-scale)); color: var(--fg-dim); margin-top: 4px; }

/* ── Lyrics rendering — class names match src/css/modules/_modals.css
   so future polish can be ported back. ─────────────────────────────── */

.song-lyrics {
  padding: 4px 2px 40px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.section-header-line {
  color: var(--section);
  font-size: calc(11px * var(--lyric-scale));
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin: 18px 0 6px;
}
.section-header-line:first-child { margin-top: 0; }

.chord-line {
  color: var(--chord);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: calc(13.5px * var(--lyric-scale));
  line-height: 1.25;
  margin-bottom: 2px;
  white-space: pre-wrap;
}

.lyric-line {
  color: var(--lyric);
  font-size: calc(15px * var(--lyric-scale));
  line-height: 1.55;
  margin-bottom: 6px;
  position: relative;
}
.lyric-line.has-inline-chords { margin-top: calc(22px * var(--lyric-scale)); }

.inline-chord {
  position: absolute;
  transform: translateY(-1.35em);
  color: var(--chord);
  font-weight: 800;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: calc(12.5px * var(--lyric-scale));
  letter-spacing: 0.2px;
}

.lyrics-spacer {
  height: 10px;
}

.lyrics-empty {
  color: var(--fg-dim);
  font-style: italic;
  font-size: 13px;
}

/* Toggle handler: body.hide-chords erases both chord-only lines and the
   floating inline-chord spans, leaving a clean lyrics-only flow. */
body.hide-chords .chord-line,
body.hide-chords .inline-chord {
  display: none !important;
}
body.hide-chords .lyric-line.has-inline-chords { margin-top: 0; }

/* ── Song-change fade ────────────────────────────────────────────── */
.song-fade-in {
  animation: songFadeIn 0.35s ease-out;
}
@keyframes songFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Floating settings button (FAB) ──────────────────────────────── */
.fab {
  position: fixed;
  right: 16px;
  bottom: 18px;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: 0 6px 20px rgba(0,0,0,0.45), 0 0 0 3px rgba(10,10,20,0.6);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: transform 0.15s, border-color 0.15s, color 0.15s;
}
.fab:hover { color: var(--accent); border-color: var(--accent); }
.fab:active { transform: scale(0.94); }

/* ── Bottom-sheet settings panel ─────────────────────────────────── */
.sheet {
  position: fixed; inset: 0;
  z-index: 100;
}
.sheet-backdrop {
  position: absolute; inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s;
}
.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 8px 18px 22px;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -20px 60px var(--scrim);
  max-height: 80vh;
  overflow-y: auto;
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: translateY(0); }

.sheet-grip {
  width: 38px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 4px auto 12px;
}
.sheet-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  gap: 12px;
}
.sheet-row:first-of-type { border-top: none; }
.sheet-row--speed { flex-direction: column; align-items: stretch; gap: 8px; }
.sheet-row[data-disabled="true"] { opacity: 0.45; pointer-events: none; }
.sheet-row[data-disabled="true"] .range { pointer-events: none; }

.sheet-label {
  font-size: 14px;
  color: var(--fg);
}
.sheet-controls {
  display: flex; align-items: center; gap: 8px;
}
.size-btn {
  width: 38px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}
.size-btn:hover { border-color: var(--accent); color: var(--accent); }
.size-value {
  min-width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--fg-dim);
}

/* iOS-style switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px; height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--soft-2);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: var(--fg);
  border-radius: 50%;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Range input — themed */
.range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--soft-2);
  border-radius: 2px;
  outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg-elev);
  box-shadow: 0 0 12px var(--accent);
}
.range::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg-elev);
}

.sheet-done {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.sheet-done:active { filter: brightness(0.95); }

/* ── Instrumento, modo líder e indicaciones ── */
.sheet-select { height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--fg); padding: 0 10px; font: inherit; font-size: 14px; max-width: 60%; }
.sheet-select--narrow { width: 80px; }
.sheet-label small { display: block; font-size: 12px; opacity: .6; font-weight: 400; margin-top: 2px; }
.pin-input { width: 84px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--fg); text-align: center; font: 800 18px/1 ui-monospace, monospace; letter-spacing: .2em; }
.leader-on { margin: 6px 0 12px; font-size: 14px; color: #7dffb0; display: flex; align-items: center; gap: 10px; }
.link-btn { background: none; border: 0; color: var(--fg); text-decoration: underline; font: inherit; cursor: pointer; }
body.lyrics-only .inline-chord, body.lyrics-only .chord-line { display: none !important; }

.leader-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bar-bg); border-top: 1px solid var(--soft-2); }
.leader-bar button { flex: 1; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--soft); color: var(--fg); font: 800 18px/1 inherit; }
.leader-bar .leader-play { flex: 1.4; background: var(--fg); color: var(--on-accent); }
.leader-bar .leader-stop { color: #ff6b6b; }
.leader-bar .leader-cues { flex: 2; font-size: 15px; }
body.has-leader-bar .stage { padding-bottom: 96px; }
body.has-leader-bar .fab { bottom: 96px; }
.cues-sheet { position: fixed; inset: auto 0 0 0; z-index: 60; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); background: var(--bg-sheet); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; }
.cues-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.cues-grid button { height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); color: var(--fg); font: 800 15px/1.1 inherit; }
.cue-overlay { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--scrim); opacity: 0; transition: opacity .2s; }
.cue-overlay.show { opacity: 1; }
.cue-text { font-size: clamp(44px, 14vw, 96px); font-weight: 900; color: var(--fg); text-align: center; padding: 0 16px; line-height: 1; }
.cue-from { margin-top: 12px; font-size: 16px; color: var(--fg-soft); }
/* display:flex anulaba [hidden]: la barra salía sin PIN y el aviso invisible tapaba la letra */
.leader-bar[hidden], .cues-sheet[hidden], .cue-overlay[hidden], .leader-on[hidden], .sheet-row[hidden] { display: none !important; }

/* ── Monitor de escenario (?escenario) ── */
body.stage-mode .stage, body.stage-mode #btn-toggle-chords { display: none !important; }
.stage-view { position: fixed; inset: 56px 0 0 0; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.stage-view[hidden] { display: none !important; }
.sv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sv-song b { display: block; font-size: clamp(22px, 4.5vw, 44px); font-weight: 900; color: var(--fg); }
.sv-song span { font-size: clamp(14px, 2.2vw, 22px); color: var(--fg-soft); }
.sv-time { font: 800 clamp(22px, 4vw, 44px)/1 ui-monospace, monospace; color: var(--fg); }
.sv-k { display: block; font-size: clamp(11px, 1.6vw, 16px); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-soft); }
.sv-section b { display: block; font-size: clamp(48px, 12vw, 140px); line-height: 1; font-weight: 900; color: var(--fg); }
.sv-next { display: block; margin-top: 6px; font-size: clamp(16px, 3vw, 30px); color: var(--fg-soft); }
.sv-chords { display: flex; gap: 28px; align-items: flex-end; }
.sv-chords b { display: block; font-size: clamp(56px, 14vw, 170px); line-height: 1; font-weight: 900; color: var(--chord); }
.sv-chord-next b { font-size: clamp(32px, 7vw, 90px); color: var(--chord); }
.sv-bar { height: 10px; border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.sv-bar i { display: block; height: 100%; width: 0; background: var(--fg); transition: width .35s linear; }
.sv-after { font-size: clamp(16px, 2.8vw, 28px); color: var(--fg-soft); }
.stage-link { display: block; margin: 8px 0 12px; color: var(--section); font-size: 14px; }

/* Tema claro (p. ej. «Clean Worship»): verde legible sobre blanco. */
:root[data-light="1"] .leader-on { color: #15803d; }
.sv-chord-next b { opacity: .55; }
:root[data-light="1"] .fab { box-shadow: 0 4px 14px rgba(15,23,42,.14), 0 0 0 3px var(--top-bg); }
