/* ============================= */
/* SCW Player v3.2.4 beta - scw.css  */
/* ============================= */

:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --accent: #111111;
  --accent-soft: #dddddd;
  --text: #111111;
  --muted: #888888;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

#pieceTitle {
  font-weight: bold;
  font-size: 16px;
  color: #333;
  text-transform: capitalize;
}

input[type="range"]::-webkit-slider-thumb {
    margin-top: -1px; /* ajusta aquest valor fins que quedi perfectament centrat */
}

input[type="range"]::-moz-range-thumb {
    margin-top: -6px;
}

.beta-tag {
  font-size: 10px;
  background: #efefef;
  color: #555;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 1px;
  font-weight: 600;
}


/* ========================= */
/*   L Y R I C   B A R       */
/* ========================= */

#lyric-bar {
  padding: 6px 12px 10px;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  color: #999;
  margin-top: 24px;
  overflow: hidden;
  white-space: normal !important;
}

#lyric-bar .lyric-line.original {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  display: block;
}

#lyric-bar .lyric-line.original::-webkit-scrollbar {
  display: none;                      /* Chrome / Safari */
}

#lyric-bar .lyric-line.translation {
  display: block;
  text-align: left !important;
  margin-top: 2px;
  font-style: italic;
  opacity: 0.8;

  /* mateix comportament que l’original */
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;        /* Firefox: amaga la barra */
}

/* Chrome / Safari: amaga la barra del scroll de la traducció */
#lyric-bar .lyric-line.translation::-webkit-scrollbar {
  display: none;
}


/* L’etiqueta "english translation:" sense cursiva */
.lyric-line.translation .lyric-label-inline {
  font-style: normal !important;
}

/* Paraules / síl·labes */
#lyric-bar .word {
  display: inline-block;
  margin: 0;        /* res de marge lateral per no obrir forats entre síl·labes */
  white-space: nowrap;
  cursor: pointer;
}

/* Síl·laba activa: color depèn de la veu via --lyric-active-bg */
#lyric-bar .word.active {
  background: color-mix(in srgb, var(--lyric-active-bg) 70%, transparent);
  border-radius: 4px;
  padding: 0 2px;
  font-weight: bold;
  color: #E57373;
  font-size: 14px;
}

#lyric-bar.mode-tutti .word.active {
  background: none;
  color: #E57373;
}

#score-container svg .lyric-active {
  font-weight: bold;
  fill: #E57373;
  font-size: 26px;
}

/* Cada línia (original + traducció) */
.lyric-full-line {
  font-size: 12px;
  line-height: 1.45;
  margin: 2px 0;
  text-align: left;
  padding-left: 6px;
  color: #555;
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
}

/* Etiqueta "original text:" "english translation:" */
.lyric-label-inline {
  display: inline-block;
  font-size: 9px;
  font-weight: bold;
  font-variant-caps: small-caps; /* versaletes */
  color: #888;
  letter-spacing: 0.4px;
  margin-right: 4px;
}

/* Text després de l’etiqueta */
.lyric-content-inline {
  font-size: 12px;
  color: #555;
}

/* Notes vinculades al lyric actiu (OSMD) */
.note-lyric-active,
.note-lyric-active * {
  fill: currentColor !important;
  stroke: currentColor !important;
}

/* Layout del botó + barra de lyrics en una sola fila */
.lyrics-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  min-height: 56px;
}


/* Columna del botó ℒ + etiqueta "Lyrics" (mateix estil que metronom/colored) */
.lyrics-toggle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--muted);
}

#btnLyrics.icon-btn.active {
  background: #111;
  border-color: #111;
  color: #fff;
}

#btnLyrics.icon-btn.active span,
#btnLyrics.icon-btn.active .icon {
  color: #fff;
}

.lyrics-row #lyric-bar {
  margin-top: 0;
  flex: 1;
  text-align: left;
  display: none;
}

/* ========================= */

.player-shell {
  width: 100%;
  max-width: 1400px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 16px 20px 16px;
  box-shadow: var(--shadow-soft);
}

.player-shell {
  position: relative;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.meta-row span { opacity: 0.9; }

.meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-btn {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--accent-soft);
  background: #f3f3f3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.help-btn:hover {
  background: #eaeaea;
  border-color: #bbbbbb;
  transform: translateY(-0.5px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.player-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.play-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.play-main-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.play-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--panel);
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}
.play-btn:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}
.play-btn svg {
  width: 18px;
  height: 18px;
  fill: var(--accent);
}

.seek-step-row {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.progress-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-outer {
  position: relative;
  width: 100%;
  height: 6px;
  display: flex;
  align-items: center;
}

/* Carril superior per a les marques A–E */
#markTrack {
  position: absolute;
  left: 0;
  top: -20px;
  width: 100%;
  height: 20px;
  pointer-events: none; /* només els quadrats interiors són clicables */
}

/* Contenidor de la marca (només posicionament) */
.rehearsal-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Quadradet real amb la lletra (clicable) */
.rehearsal-marker-inner {
  width: 16px;
  height: 16px;
  border-radius: 0;
  border: 1px solid #aaa;
  background: #fff;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 9.5px;
  font-weight: 600;
  color: #555;
  line-height: 1;

  pointer-events: auto;
  cursor: pointer;
}

/* Símbols 𝄆 / 𝄇 del loop per sota de la barra */
.loop-marker {
  position: absolute;
  bottom: -20px;
  transform: translateX(-50%);
  font-size: 20px;
  color: #111;
  opacity: 0.85;

  /* perquè rebin clics i no se'ls mengi el slider */
  pointer-events: auto;
  cursor: pointer;
  z-index: 4;
}


#loopRangeVis {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 999px;
  background: #111111;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
}

.progress-bar {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
  margin-top: -4px;
}
.progress-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.right-block {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.solo-toggle-wrap,
.metronome-wrap  {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--muted);
}

.notes-toggle-wrap,
.lyrics-toggle-wrap {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--muted);
}

.toggle {
  position: relative;
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: #dadada;
  cursor: pointer;
  transition: background 0.18s;
  display: flex;
  align-items: center;
  padding: 3px;
  box-sizing: border-box;
}
.toggle-thumb {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  transform: translateX(0);
  transition: transform 0.18s;
}
.toggle.on { background: #111111; }
.toggle.on .toggle-thumb { transform: translateX(20px); }

.icon-btn {
  width: 30px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #f3f3f3;
  color: inherit;   /* << IMPORTANT */
  transition: background 0.12s, border-color 0.12s, transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
  padding: 0;
}

.icon-btn:hover {
  background: #eaeaea;
  transform: translateY(-1px);
}
.icon-btn.active {
  background: #111111;
  border-color: #111111;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.icon-btn svg {
  width: 14px;
  height: 14px;
  fill: #111111;
}
.icon-btn.active svg {
  fill: #ffffff;
}

#btnNoteColor .note-icon {
  font-size: 14px;
  line-height: 1;
}

#btnNoteColor.icon-btn.active .note-icon {
  color: #ffffff;
}

.tools-row {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}

.markers-controls,
.zoom-controls,
.loop-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Clear marks (text-style button) */
.clear-marks-text {
  font-size: 10px;
  color: #777;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}

.clear-marks-text:hover {
  background: #eaeaea;
  color: #111;
}

/* contenidor per tenir loop + zoom junts a la dreta */
.right-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mini-btn {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--accent-soft);
  background: #f5f5f5;
  font-size: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.mini-btn:hover {
  background: #ebebeb;
  transform: translateY(-0.5px);
}
.mini-btn.active {
  background: #555555;
  border-color: #555555;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
}

/* Botons A–E tipus rehearsal mark: quadrats de veritat */
.mark-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--accent-soft);
  background: #fdfdfd;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tools-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.voice-buttons {
  margin-top: 10px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.voice-btn {
  min-width: 50px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  transition: background 0.12s, transform 0.1s, box-shadow 0.1s;
}
.voice-btn:hover {
  background: #e6e6e6;
  transform: translateY(-1px);
}
.voice-btn.active {
  background: #111111;
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

#score-container {
  width: 100%;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  overflow-x: auto;
  overflow-y: auto;      /* abans: hidden */
  white-space: nowrap;
  margin: 0;
  max-height: 70vh;      /* nou: límit d'alçada perquè aparegui scroll vertical */
}

#score {
  min-width: 900px;
  white-space: nowrap;
}

/* Help / manual overlay */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
}

.help-dialog {
  position: relative;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 18px;
  padding: 16px 18px 20px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.18);
  z-index: 1;
  font-size: 13px;
  color: var(--text);
}
.help-dialog h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 18px;
}
.help-dialog h3 {
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 14px;
}
.help-dialog p {
  margin: 0 0 6px 0;
  line-height: 1.4;
}

#score {
    min-width: 640px;
  }

/* mobile landscape */
@media (max-width: 812px) and (orientation: landscape) {
  body {
    padding: 16px;
    align-items: stretch;
  }
  .player-shell {
    padding: 12px 16px 12px;
    max-width: 100%;
  }
  .player-header {
    gap: 12px;
    flex-wrap: nowrap;
  }
  .right-block {
    margin-left: 6px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .solo-toggle-wrap span,
  .metronome-wrap span {
    font-size: 9px;
  }
  .toggle {
    width: 42px;
    height: 22px;
  }
  .toggle-thumb {
    width: 16px;
    height: 16px;
  }
  .icon-btn {
    width: 28px;
    height: 22px;
  }
}

/* tablets */
@media (min-width: 641px) and (max-width: 1366px) {
  body {
    padding: 16px;
    align-items: stretch;
  }
  .player-shell {
    max-width: 100%;
    margin: 0 auto;
  }
}

/* large desktop screens */
@media (min-width: 1367px) {
  body {
    align-items: center;
    padding: 24px;
  }
  .player-shell {
    max-width: 1400px;
  }
}


/* Fix OSMD: sempre mostrar lyrics SVG en bloc vertical */
#score-container svg .lyric-line.original,
#score-container svg .lyric-line.translation {
  display: block !important;
  white-space: normal !important;
}


/* ========================= */
/*  SCW – Welcome / Tour     */
/* ========================= */

.scw-tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85); /* fons fosc */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.scw-tour-backdrop.scw-hidden {
  display: none;
}

.scw-tour-modal {
  background: #ffffff;
  max-width: 520px;
  width: calc(100% - 32px);
  padding: 20px 24px;
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
  font-size: 14px;
  line-height: 1.4;
  max-height: 90vh;
  overflow-y: auto;
}

.scw-tour-modal h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.scw-tour-modal p {
  margin: 0 0 8px;
}

.scw-tour-modal ol {
  margin: 8px 0 12px;
  padding-left: 20px;
}

.scw-tour-modal li {
  margin-bottom: 4px;
}

.scw-tour-note {
  font-size: 12px;
  opacity: 0.8;
}

/* Botons del welcome */
.scw-tour-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.scw-tour-buttons button {
  border-radius: 999px;
  border: 1px solid #ccc;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  background: #f5f5f5;
}

.scw-tour-buttons button.primary {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}
.scw-tour-buttons button:hover {
  filter: brightness(0.96);
}

/* ============================
   SCW – Welcome modal mòbil
   ============================ */

@media (max-width: 640px) {

  .scw-tour-modal {
    max-width: 420px;
    width: calc(100% - 24px);   /* menys marge lateral */
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.35;
    max-height: 88vh;           /* una mica més petit encara */
  }

  .scw-tour-modal h2 {
    font-size: 18px;
    margin-bottom: 6px;
  }

  .scw-tour-modal p {
    margin-bottom: 6px;
  }

  .scw-tour-modal ol {
    margin: 6px 0 10px;
    padding-left: 18px;
  }

  .scw-tour-modal li {
    margin-bottom: 3px;
  }

  .scw-tour-note {
    font-size: 12px;
  }

  .scw-tour-buttons button {
    padding: 6px 10px;
    font-size: 13px;
  }
}
