/* Missa Certa — interface leve, sem fontes ou bibliotecas externas. */

:root {
  --topbar-h: 58px;
  --cifra-size: 18px;
  --radius: 14px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

/* Fontes alternativas disponíveis — aplicadas no body para afetar toda a UI */
body.font-serif {
  font-family: Georgia, "Times New Roman", serif;
  --font-mono: Georgia, "Times New Roman", serif; /* Cifra usa mesma fonte */
}
body.font-rounded {
  font-family: "Trebuchet MS", "Comic Sans MS", cursive;
  --font-mono: "Trebuchet MS", "Comic Sans MS", cursive;
}
body.font-mono-app {
  font-family: "Courier New", Courier, monospace;
  --font-mono: "Courier New", Courier, monospace;
}

.app-font-select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  min-width: 100px;
}

.app-font-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

html {
  /* A largura disponível não muda quando a página começa ou deixa de rolar. */
  overflow-y: scroll;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-elev: #141a22;
  --surface: #171e27;
  --surface-2: #1d2632;
  --text: #e9eef6;
  --muted: #96a3b6;
  --faint: #6f7d91;
  --border: #273140;
  --accent: #e5b64e;
  --accent-soft: rgba(229, 182, 78, 0.14);
  --accent-ink: #1c1403;
  --danger: #ff7b7b;
  --danger-soft: rgba(255, 123, 123, 0.12);
  --cue-up: #6fdc8c;
  --cue-down: #82b8ff;
  --cue-hold: #f5c96b;
  --cue-fast: #ff9a7a;
  --cue-slow: #c0a8ff;
  --cue-breath: #9fb0c4;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #edf1f6;
  --text: #121a24;
  --muted: #5a6879;
  --faint: #8491a1;
  --border: #dbe2ea;
  --accent: #8a6200;
  --accent-soft: #fbf1d9;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --danger-soft: #fee9e7;
  --cue-up: #1f7a33;
  --cue-down: #1f5fa8;
  --cue-hold: #8a5a00;
  --cue-fast: #b42318;
  --cue-slow: #5b3fa8;
  --cue-breath: #5a6879;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  touch-action: manipulation;
}

button,
input,
select,
textarea {
  font: inherit;
  touch-action: manipulation;
}

button {
  color: inherit;
  touch-action: manipulation;
}


:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* ---------- Barra superior ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.01em;
  font-size: 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
  font-size: 17px;
  line-height: 1;
  padding-bottom: 1px;
}

/* Nome do app com a mesma cor de destaque do quadrado "M". */
.brand-name {
  color: var(--accent);
}

/* Abas de navegação dentro da barra de cima. */
.topbar-tabs {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-tabs[hidden] {
  display: none;
}

.topbar-tabs .home-tabs {
  padding: 3px;
}

.topbar-tabs .home-tabs a {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13.5px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Nome da música + tom, dentro da barra de cima (economiza altura). */
.topbar-song {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.topbar-song[hidden] {
  display: none;
}

.ts-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.ts-artist {
  color: var(--muted);
  font-weight: 500;
}

.ts-edit-btn {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.ts-edit-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border);
}

.ts-edit-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.ts-key {
  flex: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 15px;
  font-weight: 750;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ts-key[hidden] {
  display: none;
}

.topbar-back[hidden] {
  display: none;
}

#chordsBtn[hidden] {
  display: none;
}

@media (max-width: 520px) {
  .brand-name {
    display: none;
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* Botão YouTube na visualização da música (mesmo vermelho do montador) */
.icon-btn.ts-youtube-btn {
  background: #e62117;
  color: #fff;
}

.icon-btn.ts-youtube-btn:hover {
  background: #c91d14;
  color: #fff;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#menuBtn svg circle {
  fill: currentColor;
  stroke: none;
}

/* ---------- Estrutura ---------- */

.view {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-left)) calc(72px + env(safe-area-inset-bottom));
  outline: none;
}

.view.view-song,
.view:has(.song-view) {
  max-width: 100%;
  padding-top: 10px;
  padding-bottom: 0;
}

/* O editor ocupa toda a largura disponível da janela. */
.view.view-wide {
  max-width: none;
}

.view.view-wide .editor {
  padding: 0;
}

.view.loading {
  display: flex;
  justify-content: center;
  padding-top: 90px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .spinner {
    animation-duration: 2s;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 620;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  filter: brightness(1.05);
  background: var(--accent);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.btn.danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.danger-text {
  color: var(--danger) !important;
}

/* ---------- Biblioteca ---------- */

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.library-head h1 {
  margin: 0;
  font-size: clamp(25px, 3.5vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.library-head .count {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.library-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.library-tools {
  display: flex;
  gap: 10px;
  margin: 22px 0 16px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  min-width: 0;
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-box svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size: 15px;
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-mode-select {
  flex: none;
  min-width: 70px;
  height: 32px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 8px) 12px, calc(100% - 13px) 12px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  color: var(--text);
  font-size: 12px;
  appearance: none;
  cursor: pointer;
}

.select {
  height: 46px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--text);
  font-size: 16px;
  appearance: none;
  cursor: pointer;
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.liturgical-catalog-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 10px;
}

.liturgical-catalog-filters label {
  display: grid;
  gap: 6px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 650;
}

.liturgical-catalog-filters .select {
  width: 100%;
  min-width: 0;
}

.liturgical-catalog-count {
  min-height: 20px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.liturgical-catalog-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 10px;
}

.liturgical-catalog-song {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  align-items: center;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.liturgical-catalog-song:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.liturgical-catalog-song-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.liturgical-catalog-song-artist {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.liturgical-catalog-song .badge {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.library-more {
  display: flex;
  justify-content: center;
  margin: 18px 0 4px;
}

.library-more[hidden] {
  display: none;
}

.song-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 138px;
  padding: 15px 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  content-visibility: auto;
  contain-intrinsic-size: 140px;
  touch-action: manipulation;
  transition: border-color 0.14s ease, background 0.14s ease;
}


.song-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.song-card:active {
  transform: scale(0.995);
}

.song-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.song-title {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 680;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* Botão de excluir dentro da caixa da cifra. */
.song-delete {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -3px -4px 0 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.14s ease, color 0.14s ease,
    background 0.14s ease, border-color 0.14s ease;
}

.song-card:hover .song-delete,
.song-delete:focus-visible {
  opacity: 1;
}

.song-delete:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

@media (max-width: 760px) {
  .song-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.song-delete:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.song-card-top .song-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  min-width: 76px;
  height: 30px;
  padding: 0 8px;
  border-color: var(--danger);
  background: var(--danger-soft);
  font-size: 12px;
  font-weight: 650;
  opacity: 1;
}

.song-card-top .song-delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.key {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
}

.song-artist {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.5;
}

.song-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 5px;
  color: var(--faint);
  font-size: 11.5px;
}

.song-meta .tag {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 62px 24px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}

.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 27px;
  font-weight: 800;
}

.empty-state h2 {
  margin: 0 0 7px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 430px;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.error-box {
  padding: 28px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.error-box p {
  margin: 0 0 16px;
  color: var(--muted);
}

/* ---------- Tela da cifra ---------- */

.song-view {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-bottom: 8px;
}

.song-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 0 16px;
}

.song-head .back-btn {
  margin-top: 2px;
}

.song-head-text {
  flex: 1;
  min-width: 0;
}

.song-head h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.song-head .artist {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.song-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: none;
}

.song-toolbar {
  position: sticky;
  top: calc(var(--topbar-h) + 6px);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 7px;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-elev);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.tool-label {
  padding: 0 5px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.tool-btn {
  display: inline-grid;
  place-items: center;
  min-width: 33px;
  height: 33px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}

.tool-btn:hover {
  background: var(--surface-2);
}

.tool-btn:active {
  background: var(--accent-soft);
}

.tool-btn.font-btn {
  font-size: 14px;
  font-weight: 750;
}

.tool-btn.reset-btn {
  color: var(--muted);
  font-size: 15px;
}

.tool-value {
  min-width: 42px;
  text-align: center;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.tool-value.key-value {
  color: var(--accent);
}

.tool-value.capo-value,
.tool-value.transpose-value {
  min-width: 24px;
}

.acc-btn {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.song-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 3px 14px;
  color: var(--muted);
  /* Tom original, capo, ritmo e BPM. */
  font-size: 18px;
  line-height: 1.3;
}

.song-info[hidden] {
  display: none;
}

.song-info b {
  color: var(--text);
  font-weight: 650;
}

.song-info .warn {
  color: var(--accent);
}

.song-footer {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Transposição no topo ---------- */

.ts-transpose {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.ts-transpose[hidden] {
  display: none;
}

.ts-tr-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s;
}

.ts-tr-btn:hover {
  background: var(--surface-2);
}

.ts-tr-btn:active {
  background: var(--accent-soft);
}

/* ---------- Renderização da cifra ---------- */

.cifra {
  font-family: var(--font-mono);
  font-size: var(--cifra-size);
  line-height: 1.5;
  padding: 2px 1px 0;
  overflow-wrap: break-word;
  font-variant-ligatures: none;
  tab-size: 4;
}

#cifraBody {
  padding-bottom: 0;
}

.line {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  margin: 0;
  min-height: 1.1em;
}

@media (max-width: 480px) {
  .line {
    flex-wrap: wrap;
  }
}

/* Cada palavra (ou pedaço de palavra entre acordes) é um item só. Sem isso,
   uma linha longa podia quebrar no meio da palavra, entre dois acordes. */
.lyric-word {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  flex: 0 0 auto;
}

.seg {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
  min-width: 0;
}

/* Nota de preparação no fim da linha: fica na linha dos acordes, depois do
   último caractere da letra, sem disputar espaço com o texto. */
.seg.has-tail {
  position: relative;
}

.tail-chords {
  position: absolute;
  top: 0;
  right: 0;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.tail-chords .chord {
  display: inline;
  min-height: 0;
}

.chord {
  display: block;
  min-height: 1.18em;
  color: var(--accent);
  font-size: 0.92em;
  font-weight: 760;
  line-height: 1.25;
  letter-spacing: 0.005em;
  white-space: nowrap;
  user-select: none;
}

.chord.annotation {
  color: var(--muted);
  font-size: 0.82em;
  font-style: italic;
  font-weight: 600;
}

.lyric {
  display: block;
  max-width: 100%;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A letra é sempre exibida em maiúsculas; o texto salvo não é alterado. */
.cifra .lyric,
.cifra .lyric-line {
  text-transform: uppercase;
}

.plain {
  margin: 0;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* O texto entre as marcações de refrão fica em negrito */
.is-chorus .lyric,
.is-chorus.lyric-line,
.is-chorus.plain {
  font-weight: 750;
}

/* Marcações de expressão no meio da letra: {sobe}, {segura}, {acelera}... */
.cue {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  margin: 0 0.18em;
  padding: 0.04em 0.38em;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.64em;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-transform: none;
  vertical-align: 0.12em;
  white-space: nowrap;
  user-select: none;
}

.cue-sobe {
  color: var(--cue-up);
}

.cue-desce {
  color: var(--cue-down);
}

.cue-segura {
  color: var(--cue-hold);
}

.cue-acelera {
  color: var(--cue-fast);
}

.cue-devagar {
  color: var(--cue-slow);
}

.cue-respira {
  color: var(--cue-breath);
}

.cue-line {
  margin: 0.35em 0 0.1em;
}

.cue-line .cue {
  font-size: 0.78em;
}

/* As marcações são para o cantor: só aparecem no modo cantor. Com a cifra
   visível, ficam guardadas no texto mas não atrapalham quem está tocando. */
.cifra:not(.hide-chords) .cue,
.cifra:not(.hide-chords) .cue-line {
  display: none;
}

/* No editor as etiquetas ficam à vista: elas são a alça para arrastar até a
   palavra certa. Isso não muda a visualização da cifra para quem toca. */
#editorPreview .cifra .cue {
  display: inline-flex;
}

#editorPreview .cifra .cue-line {
  display: block;
}

#editorPreview .cifra .cue {
  cursor: grab;
  touch-action: none;
}

#editorPreview .cifra .cue:active {
  cursor: grabbing;
}

#editorPreview .cifra .lyric.cue-drop-target,
#editorPreview .cifra .plain.cue-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 5px;
}

.editor-toolbar [data-action="insert-cue"] {
  cursor: grab;
  touch-action: none;
}

.editor-toolbar [data-action="insert-cue"]:active {
  cursor: grabbing;
}

.cue-drag-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  padding: 5px 11px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0.96;
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 18px rgb(0 0 0 / 22%);
}

body.cue-dragging {
  user-select: none;
}

/* Arrastar acordes no editor */
#editorPreview .cifra .chord[data-chord] {
  cursor: grab;
  touch-action: none;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  position: relative;
  z-index: 2;
  transition: background-color 0.15s, outline 0.15s, transform 0.1s;
}

#editorPreview .cifra .chord[data-chord]:hover {
  background: var(--surface-2);
  outline: 1.5px dashed var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

#editorPreview .cifra .chord[data-chord]:active {
  cursor: grabbing;
}

.chord-dragging-source {
  opacity: 0.25 !important;
  transform: scale(0.9) !important;
}

.chord-drag-ghost {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  font-weight: 750;
  font-size: 16px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  padding: 5px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -125%);
  user-select: none;
  white-space: nowrap;
}

.chord-drop-caret {
  position: fixed;
  z-index: 9999;
  width: 3px;
  background: var(--accent);
  pointer-events: none;
  transform: translateX(-50%);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--accent);
}

.chord-drop-caret::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--accent);
}

.chord-trash-zone {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  transition: all 0.18s ease;
  user-select: none;
}

.chord-trash-zone.trash-active {
  background: #3f181c;
  border-color: #f85149;
  color: #ff7b72;
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(248, 81, 73, 0.25);
}

body.chord-dragging {
  user-select: none;
}

#editorPreview .cifra .lyric.chord-drop-target,
#editorPreview .cifra .plain.chord-drop-target,
#editorPreview .cifra .chord-row.chord-drop-target {
  background: var(--accent-soft);
  border-radius: 4px;
}

/* Modo cantor: esconde acordes e linhas instrumentais, mantendo a letra. */
#cifraBody.hide-chords .chord,
#cifraBody.hide-chords .tail-chords,
#cifraBody.hide-chords .chord-row:not(.has-cue) {
  display: none;
}

#cifraBody.hide-chords .chord-row.has-cue .chord {
  display: none;
}

#cifraBody.hide-chords .seg.has-tail {
  padding-right: 0 !important;
}

.line.empty {
  height: 0.85em;
}

.chord-row {
  display: block;
  min-height: 1.45em;
  margin: 0.05em 0;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
}

.chord-row .chord {
  display: inline;
  min-height: 0;
  font-size: 1em;
}

.section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1.15em 0 0.35em;
  color: var(--muted);
  font-size: 0.74em;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section.subtle {
  color: var(--faint);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

.section.subtle::after {
  display: none;
}

.section.section-chorus {
  color: var(--accent);
}

/* ---------- Editor ---------- */

.editor {
  max-width: none;
  padding: 0 20px;
  margin: 0 auto;
}

/* Salvar/Cancelar/status do editor: vivem na barra de cima, junto do
   título do app — a tela do editor ganha uma linha a mais de cifra. */
.topbar-editor {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-editor[hidden] {
  display: none;
}

.topbar-editor .save-status {
  min-width: 0;
  white-space: nowrap;
}

/* Linha compacta e flexível dos campos do editor:
   Título, Artista, Gênero, Uso na Missa, Tom, Transposição, Ritmo e Tempo (BPM).
   Em telas desktop e tablet horizontal, cabem em 1 única linha limpa (máxima altura para a edição da cifra).
   Em telas menores ou tablet vertical, quebram suavemente em 2 linhas organizadas. */
.editor-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 2px;
}

.editor-fields .field {
  gap: 3px;
  min-width: 0;
}

.editor-fields .field > span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.editor-fields input,
.editor-fields select {
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.editor-fields .field-title {
  flex: 2 1 200px;
  min-width: 170px;
}

.editor-fields .field-artist {
  flex: 1.5 1 170px;
  min-width: 150px;
}

.editor-fields .field-genre {
  flex: 0 0 145px;
  width: 145px;
}

.editor-fields .field-category {
  flex: 0 0 155px;
  width: 155px;
}

.editor-fields .field-category[hidden] {
  display: none !important;
}

.editor-fields .field-liturgical {
  flex: 0 0 170px;
  width: 170px;
}

.editor-fields .field-liturgical[hidden] {
  display: none !important;
}

.field-dropdown-wrap {
  position: relative;
  width: 100%;
}

.field-dropdown-btn {
  width: 100%;
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  user-select: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.field-dropdown-btn:hover,
.field-dropdown-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.field-dropdown-val {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  flex: 1 1 auto;
}

.field-dropdown-val .liturgical-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.field-dropdown-val .liturgical-dots-group {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}

.field-dropdown-val .placeholder-text {
  color: var(--muted);
  font-size: 14px;
}

.field-dropdown-chevron {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  pointer-events: none;
}

.field-dropdown-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 210px;
  max-width: 260px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-dropdown-popover[hidden] {
  display: none !important;
}

.field-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 12.5px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  user-select: none;
  font-family: inherit;
  transition: background-color 0.12s, border-color 0.12s;
}

.field-dropdown-item:hover {
  background: var(--surface-hover);
}

.field-dropdown-item.is-selected {
  background: var(--surface-2);
  font-weight: 600;
  border-color: var(--border);
}

.field-dropdown-item .liturgical-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.field-dropdown-item-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-dropdown-check {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  width: 16px;
  text-align: right;
  flex-shrink: 0;
}

.field-dropdown-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.field-dropdown-clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
}

.field-dropdown-clear-btn:hover {
  color: var(--text);
  text-decoration: underline;
}

.field-dropdown-empty {
  padding: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.editor-fields .field-key {
  flex: 0 0 78px;
  width: 78px;
}

.editor-fields .field-transpose {
  flex: 0 0 94px;
  width: 94px;
}

.editor-fields .field-rhythm {
  flex: 1 0 145px;
  min-width: 135px;
  max-width: 190px;
}

.editor-fields .field-tempo {
  flex: 0 0 80px;
  width: 80px;
}

.save-status {
  min-width: 90px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.save-status.saved {
  color: #45b87a;
}

.save-status.error {
  color: var(--danger);
}

.field-grid {
  display: grid;
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 86px 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.field > span {
  font-weight: 650;
  letter-spacing: 0.02em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
}

/* ---------- Entrar / criar conta ---------- */

.auth {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--topbar-h) - 48px);
  padding: 8px 0 24px;
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 26px 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.auth-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 24px;
  align-self: center;
}

.auth-card h1 {
  margin: 2px 0 0;
  font-size: 21px;
  text-align: center;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.auth-submit {
  height: 48px;
  margin-top: 4px;
  font-size: 15px;
}

.auth-hint {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--danger);
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.auth-error[hidden] {
  display: none;
}

/* ---------- Usuário no menu ---------- */

.menu-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.menu-user[hidden] {
  display: none;
}

.menu-user-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 17px;
}

.menu-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.menu-user-label {
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.menu-user-text b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

@media (pointer: coarse) {
  .auth-card {
    padding: 22px 18px 18px;
  }

  .auth-tab {
    min-height: 46px;
  }
}

/* Barra de ferramentas do editor:
   Linha superior para ferramentas e cifras rápidas;
   Linha inferior dedicada para marcações de expressão do cantor. */
.editor-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-row-cues {
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cue-btn {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
}

.toolbar-sep {
  width: 1px;
  align-self: stretch;
  min-height: 18px;
  background: var(--border);
}

.toolbar-label {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.chord-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.chord-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  font-size: 12.5px;
  font-weight: 750;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: grab;
  touch-action: none;
  transition: all 0.15s ease;
  user-select: none;
}

.chord-chip:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.chord-chip:active {
  cursor: grabbing;
}

.chord-chip.highlight {
  animation: pulseHighlight 1s ease-in-out infinite alternate;
}

.editor-toolbar .btn.small {
  padding: 3px 8px;
  font-size: 12px;
}

.editor-toolbar .btn.btn-chorus {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.editor-toolbar .btn.btn-chorus:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.source-hint {
  margin-top: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.editor-body-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 10px;
  align-items: start;
}

.editor-body {
  display: block;
  width: 100%;
  min-height: 54vh;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14.5px;
  line-height: 1.65;
  tab-size: 4;
  resize: vertical;
  white-space: pre-wrap;
}

.editor-body:focus {
  border-color: var(--accent);
}

.preview-box {
  margin: 0 !important;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  min-height: 54vh;
}

.preview-box .cifra {
  padding-bottom: 6px;
}

/* Toque numa linha da prévia para corrigir */
.preview-box .cifra [data-line] {
  cursor: pointer;
  border-radius: 6px;
}

.preview-box .cifra [data-line]:hover {
  background: var(--accent-soft);
}

/* ---------- Comparar com o arquivo original ---------- */

.editor.has-source {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  grid-template-areas:
    "fields fields"
    "toolbar toolbar"
    "body source";
  column-gap: 18px;
  align-items: start;
}

.editor.has-source > .editor-fields {
  grid-area: fields;
}

.editor.has-source > .editor-toolbar {
  grid-area: toolbar;
}

.editor.has-source > .editor-body-wrap {
  grid-area: body;
}

.editor-source {
  grid-area: source;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  overflow: hidden;
}

.source-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.source-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12.5px;
}

.source-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.source-nav b {
  font-weight: 600;
}

#sourceImage {
  display: block;
  width: 100%;
  max-height: 74vh;
  object-fit: contain;
  object-position: top center;
  background: var(--surface-2);
}

@media (max-width: 900px) {
  .editor.has-source {
    display: block;
  }

  .editor-body-wrap {
    grid-template-columns: 1fr;
  }

  #sourceImage {
    max-height: 60vh;
  }
}

.format-hint {
  display: flex;
  align-items: center;
  min-height: 41px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Importar arquivo com várias cifras ---------- */

.check-all {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

.import-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.import-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.import-row[data-removed="true"] {
  display: none;
}

.import-row-check {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -6px 0 0 -6px;
  cursor: pointer;
}

.import-row-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.import-row-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.import-row-title {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: 0;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 15px;
}

.import-row-title:focus {
  border-color: var(--accent);
}

.import-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.import-row-key,
.import-row-capo,
.import-row-rhythm,
.import-row-tempo {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: 0;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 14.5px;
}

.import-row-key {
  width: 110px;
}

.import-row-capo {
  width: 76px;
  text-align: center;
}

.import-row-rhythm {
  width: min(210px, 100%);
}

.import-row-tempo {
  width: 84px;
  text-align: center;
}

.import-row-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
}

.import-row-badge.is-empty {
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  color: var(--muted);
}

.import-row-remove {
  min-width: 44px;
  min-height: 44px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
}

.import-row-remove:hover,
.import-row-remove:focus-visible {
  border-color: var(--border);
  color: var(--danger, #ff6b6b);
}

.import-row-preview {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.import-row.is-duplicate {
  border-color: color-mix(in srgb, var(--cue-hold) 52%, var(--border));
  background: color-mix(in srgb, var(--cue-hold) 7%, var(--surface));
}

.import-row-duplicate {
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cue-hold) 20%, transparent);
  color: var(--cue-hold);
  font-size: 11.5px;
  font-weight: 750;
  white-space: nowrap;
}

.import-row-match {
  margin: 0;
  color: var(--cue-hold);
  font-size: 12px;
  line-height: 1.45;
}

.duplicate-import-hint {
  color: var(--cue-hold);
}

/* ---------- Diálogos ---------- */

.dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: 88vh;
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-elev);
  color: var(--text);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.015em;
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(88vh - 128px);
  max-height: calc(88dvh - 128px);
  padding: 16px 18px;
  overflow: auto;
  overscroll-behavior: contain;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

.menu-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
}

.online-users-dialog {
  width: min(560px, calc(100vw - 24px));
}

.online-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.online-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.online-user-indicator {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2da44e;
  box-shadow: 0 0 0 3px rgba(45, 164, 78, 0.14);
}

.online-user-details {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.online-user-details strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-user-details > span,
.online-user-row time,
.online-users-empty {
  color: var(--muted);
  font-size: 12px;
}

.online-user-row time {
  flex: none;
}

.menu-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 14px 14px;
  overflow-y: auto;
}

.menu-sections[hidden],
.menu-foot[hidden] {
  display: none;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-section-title {
  color: var(--faint);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-left: 2px;
}

.menu-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

@media (max-width: 440px) {
  .menu-btn-grid {
    grid-template-columns: 1fr;
  }
}

.menu-action-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  user-select: none;
  box-sizing: border-box;
}

.menu-action-btn:hover {
  background: var(--bg-hover, var(--border));
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.menu-action-btn:active {
  transform: translateY(0);
}

.menu-action-btn.danger-btn {
  color: var(--danger);
}

.menu-action-btn.danger-btn:hover {
  background: rgba(220, 53, 69, 0.12);
  border-color: var(--danger);
}

.menu-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  flex-shrink: 0;
}

.song-menu-dialog {
  width: min(440px, calc(100vw - 24px));
}

.song-menu-grid {
  padding: 12px;
}

.menu-foot {
  margin: 0;
  padding: 6px 18px 16px;
  color: var(--faint);
  font-size: 11.5px;
  text-align: center;
}

/* ---------- Gerenciar Gêneros ---------- */

.genres-dialog {
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
}

.genre-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.genre-add-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  outline: 0;
}

.genre-add-form input:focus {
  border-color: var(--accent);
}

.genres-list-wrap {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.genres-manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.genre-manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.genre-manage-item:last-child {
  border-bottom: 0;
}

.genre-manage-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.genre-manage-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.genre-manage-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  white-space: nowrap;
}

.genre-manage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.genre-btn-edit,
.genre-btn-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.genre-btn-edit:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
}

.genre-btn-del:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(220, 53, 69, 0.1);
}

.genre-btn-del[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.genre-pill-manage {
  border-style: dashed;
  color: var(--muted);
  font-size: 12px;
}

.genre-pill-manage:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.confirm-body {
  padding: 18px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.confirm-body strong {
  color: var(--text);
}

.duplicate-import-dialog {
  width: min(620px, calc(100vw - 24px));
}

.duplicate-import-dialog .dialog-actions {
  flex-wrap: wrap;
}

.duplicate-import-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 4px 0 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.duplicate-import-card strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.duplicate-import-artist {
  color: var(--muted);
  font-size: 13px;
}

.duplicate-import-preview {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

.duplicate-import-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  margin: 2px 0 10px;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.duplicate-import-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}

.duplicate-import-list li span {
  color: var(--muted);
}

.duplicate-import-more {
  justify-content: center;
  color: var(--muted);
}

/* ---------- Duplicadas ---------- */

.duplicates-dialog {
  width: min(1040px, calc(100vw - 24px));
}

.duplicate-group + .duplicate-group {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.duplicate-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.duplicate-compare {
  flex: none;
  margin-left: auto;
}

.duplicate-group-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.duplicate-group-head span {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.duplicate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.duplicate-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.duplicate-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.duplicate-title {
  flex: 1;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 680;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.duplicate-title:hover {
  color: var(--accent);
}

.duplicate-card .song-delete {
  width: 28px;
  height: 28px;
  margin: -2px -3px 0 0;
  opacity: 1;
}

.duplicate-artist,
.duplicate-preview,
.duplicate-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.duplicate-artist {
  color: var(--text-soft, var(--muted));
}

.duplicate-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--faint);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  min-height: 3.9em;
}

.duplicate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: auto;
  padding-top: 3px;
  font-size: 11px;
}

.duplicate-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
}

.duplicate-empty,
.duplicates-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.duplicate-empty strong {
  color: var(--text);
}

.duplicate-empty p,
.duplicates-loading p {
  margin: 0;
}

/* ---------- Comparação das cifras inteiras ---------- */

.compare-dialog {
  width: min(1400px, calc(100vw - 16px));
  max-height: 94vh;
  max-height: 94dvh;
}

.compare-dialog .dialog-body {
  max-height: calc(94vh - 129px);
  max-height: calc(94dvh - 129px);
  padding: 12px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(var(--compare-count, 2), minmax(280px, 1fr));
  align-items: start;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.compare-pane {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elev);
}

.compare-pane-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.compare-pane-title {
  flex: 1;
  min-width: 0;
}

.compare-title {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.compare-title:hover {
  color: var(--accent);
}

.compare-pane-artist {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.compare-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
  margin-top: 4px;
  color: var(--faint);
  font-size: 11.5px;
}

.compare-pane .song-delete {
  width: 30px;
  height: 30px;
  margin: -2px -3px 0 0;
  opacity: 1;
}

/* A fonte é menor que na cifra normal para caber a música inteira em duas
   colunas. O texto continua no tom e no tamanho configurados na música. */
.compare-cifra {
  --cifra-size: clamp(12px, calc(6px + 1.15vw), 18px);
  padding: 12px 14px 22px;
}

/* ---------- Progresso ---------- */

.busy-dialog {
  width: min(360px, calc(100vw - 32px));
}

.busy-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 24px 28px;
  text-align: center;
}

.busy-body h2 {
  margin: 0;
  font-size: 18px;
}

.busy-body .hint {
  margin: 0;
  max-width: 28ch;
}

.busy-spinner {
  width: 38px;
  height: 38px;
  border-width: 3px;
}

/* ---------- Ajuda ---------- */

.help h3 {
  margin: 6px 0 -4px;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.help p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.help code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shortcut-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13.5px;
}

.shortcut-list li span {
  margin-left: auto;
  text-align: right;
}

kbd {
  display: inline-block;
  min-width: 24px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.help-code {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 120;
  max-width: calc(100vw - 32px);
  padding: 10px 17px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

/* ---------- Responsivo ---------- */

/* ---------- Abas da home ---------- */

.home-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.home-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.home-tabs a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}

.home-tabs .tab-count {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Pílulas de Gênero ---------- */

.genre-bar-wrap {
  position: relative;
  margin: 10px 0 14px;
  width: 100%;
}

.genre-pills-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.genre-pills-bar::-webkit-scrollbar {
  height: 4px;
}

.genre-pills-bar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.genre-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  flex: none;
}

.genre-pill:hover {
  border-color: var(--muted);
  color: var(--text);
  background: var(--surface-2);
}

.genre-pill.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.genre-pill-count {
  font-size: 11.5px;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 999px;
}

.genre-pill.active .genre-pill-count {
  background: rgba(0, 0, 0, 0.2);
  color: var(--accent-ink);
}

html[data-theme="dark"] .genre-pill-count {
  background: rgba(255, 255, 255, 0.1);
}

.genre-pill-add {
  border-style: dashed;
  color: var(--faint);
  background: transparent;
}

.genre-pill-add:hover {
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.genre-badge {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

html[data-theme="dark"] .genre-badge {
  color: #38bdf8;
}

.lib-cat-wrap {
  display: contents;
}

.lib-cat-wrap[hidden] {
  display: none !important;
}

.library-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.library-top .playlist-chip {
  margin: 0;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Playlists ---------- */

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.playlist-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.playlist-card:hover {
  border-color: var(--accent);
}

.playlist-card h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.playlist-card .pl-count {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.playlist-card .pl-note {
  color: var(--muted);
  font-size: 13px;
}

.playlist-card .pl-first {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.4;
}

.playlist-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.playlist-head .pl-head-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.playlist-head .pl-head-top .icon-btn {
  margin-top: 2px;
}

.playlist-head .pl-head-text {
  flex: 1;
  min-width: 0;
}

.playlist-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.playlist-head .pl-note {
  margin: 4px 0 0;
  color: var(--muted);
}

.playlist-head .pl-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.pl-song {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  content-visibility: auto;
  contain-intrinsic-size: 54px;
  touch-action: manipulation;
}


.pl-song:last-child {
  border-bottom: 0;
}

.pl-index {
  width: 30px;
  flex: none;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.pl-youtube-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: #e62117;
  color: #fff;
  text-decoration: none;
}

.pl-youtube-link:hover {
  background: #c91d14;
  color: #fff;
}

.pl-main {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 7px 2px;
  color: var(--text);
  text-decoration: none;
}

.pl-main .pl-title {
  display: block;
  font-weight: 650;
}

.pl-main .pl-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.pl-tools {
  display: flex;
  flex: none;
  gap: 3px;
}

.pl-tools .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 9px;
}

.pl-tools .icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Pegador de arrasto da playlist */
.pl-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  padding: 8px;
  margin: -8px;
  border-radius: 8px;
  touch-action: none;
  color: var(--text);
  transition: color 0.15s;
  width: 32px;
  height: 32px;
  font-size: 20px;
}

.pl-drag:hover {
  color: var(--text);
}

.pl-drag:active {
  cursor: grabbing;
}

/* Linha sendo arrastada (original fica opaca) */
.pl-drag-source {
  opacity: 0.25;
  transform: scale(0.98);
}

/* Elemento fantasma que segue o cursor */
.pl-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  background: var(--bg-elev);
}

/* Body durante o arrasto (evita seleção de texto) */
body.pl-dragging {
  user-select: none;
  cursor: grabbing;
}

/* ---------- Ritmos ---------- */

.rhythm-add {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 18px;
}

.rhythm-add .field {
  flex: 1;
  min-width: 220px;
}

.rhythm-add .btn {
  height: 46px;
}

.rhythm-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.rhythm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
}

.rhythm-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.rhythm-copy strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.rhythm-copy span {
  color: var(--muted);
  font-size: 12.5px;
}

.rhythm-actions {
  display: flex;
  flex: none;
  gap: 6px;
}

.rhythm-actions .btn {
  min-height: 40px;
}

.rhythm-empty {
  padding: 42px 20px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.rhythm-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 17px;
}

.rhythm-empty p {
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.55;
}

@media (max-width: 700px) {
  .rhythm-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .rhythm-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .rhythm-actions .btn {
    min-height: 44px;
  }
}

/* ---------- Navegação da playlist (barra inferior) ---------- */

.playlist-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px max(12px, env(safe-area-inset-left))
    calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.12);
}

.playlist-nav .nav-btn {
  flex: 1;
  min-height: 48px;
  font-size: 15px;
}

.playlist-nav .nav-btn:disabled {
  opacity: 0.35;
}

.playlist-nav .nav-pos {
  min-width: 72px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.song-view.has-playlist-nav {
  padding-bottom: 72px; /* Altura da barra de navegação (48px botões + padding + safe-area) */
}

.playlist-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 10px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
}

.playlist-chip b {
  color: var(--text);
}

/* ---------- Gaveta de ferramentas (escondida à esquerda) ---------- */

.tool-handle {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  top: calc(var(--topbar-h) + 12px);
  z-index: 46;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  touch-action: manipulation;
}

.tool-handle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}



.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(4, 7, 10, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.drawer-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.tool-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 66;
  width: min(330px, 86vw);
  padding: calc(16px + env(safe-area-inset-top)) 16px
    calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: 12px 0 34px rgba(0, 0, 0, 0.34);
  transform: translateX(-104%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0.2s;
}

.tool-drawer.open {
  transform: none;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .tool-drawer,
  .drawer-scrim {
    transition: none;
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-group {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.drawer-group .tool-label {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-size: 10.5px;
}

.drawer-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-row + .drawer-row {
  margin-top: 8px;
}

.drawer-row .tool-btn {
  min-width: 50px;
  height: 50px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 18px;
}

.drawer-row .tool-value {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
}

.drawer-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.drawer-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.drawer-switch-copy b {
  font-size: 13.5px;
  font-weight: 700;
}

.drawer-switch-copy small {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.35;
}

.drawer-switch-track {
  flex: none;
  width: 48px;
  height: 28px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.drawer-switch-thumb {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--faint);
  transition: transform 0.16s ease, background 0.16s ease;
}

.drawer-switch[aria-checked="true"] {
  border-color: var(--accent);
}

.drawer-switch[aria-checked="true"] .drawer-switch-track {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drawer-switch[aria-checked="true"] .drawer-switch-thumb {
  transform: translateX(20px);
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .drawer-switch-track,
  .drawer-switch-thumb {
    transition: none;
  }
}

.drawer-fit {
  width: 100%;
  margin-top: 12px;
}

.drawer-fit[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.drawer-fit svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}


/* ---- Gaveta compacta (agrupa comandos no topo) ---- */
.tool-drawer-compact .drawer-head { margin-bottom: 2px; }
.tool-drawer-compact .drawer-head h2 { font-size: 16px; }
.tool-drawer-compact .drawer-group-compact { padding: 10px 0; }
.tool-drawer-compact .tool-label { margin-bottom: 4px; font-size: 10px; }
.tone-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: start; }
.tone-cell { min-width: 0; }
.stepper.stepper-compact { display: flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.tool-drawer-compact .stepper-compact .tool-btn { min-width: 34px; width: 34px; height: 38px; padding: 0; border: 0; background: transparent; font-size: 17px; }
.tool-drawer-compact .stepper-compact .tool-value { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
.drawer-switch-compact { margin-bottom: 8px; padding: 8px 10px; }
.drawer-switch-compact .drawer-switch-copy b { font-size: 13px; }
.drawer-row-tight { flex-wrap: wrap; gap: 4px; }
.drawer-row-tight + .drawer-row-tight { margin-top: 6px; }
.tool-drawer-compact .drawer-row-tight .tool-btn { min-width: 40px; height: 40px; font-size: 15px; }
.tool-drawer-compact .drawer-row-tight .tool-value { min-width: 28px; font-size: 15px; }
.drawer-fit-inline { flex: 1 1 auto; min-width: 0; white-space: nowrap; padding: 8px 10px; }
.drawer-fit-inline[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.drawer-fit-inline svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drawer-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.drawer-actions-grid .btn { min-height: 40px; padding: 8px 10px; font-size: 13px; justify-content: center; }
.drawer-actions-grid .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 360px) { .tone-grid { grid-template-columns: 1fr; } }

.drawer-note {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 430px) {
  .tool-handle {
    padding: 0 13px;
  }

  .tool-handle-label {
    display: none;
  }
}

/* ---------- Busca rápida / seletor de cifras ---------- */

.palette {
  width: min(680px, calc(100vw - 20px));
  max-width: none;
  max-height: min(78vh, 620px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
}

.palette::backdrop {
  background: rgba(5, 8, 12, 0.6);
}

.palette-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.palette-form svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.palette-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  outline: 0;
}

.palette-results {
  max-height: min(58vh, 480px);
  overflow-y: auto;
  padding: 6px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.palette-item[aria-selected="true"] {
  background: var(--accent-soft);
}

.palette-item .p-main {
  flex: 1;
  min-width: 0;
}

.palette-item .p-title {
  display: block;
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-item .p-sub {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 13px;
}

.palette-item .p-badge {
  flex: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.palette-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: transparent;
  font-size: 13px;
  font-weight: 800;
}

.palette-item[aria-pressed="true"] .palette-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.palette-empty {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
}

.palette-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 12px;
}

/* ---------- Ajustes de toque ---------- */

@media (pointer: coarse) {
  .btn {
    min-height: 46px;
  }

  .btn.small {
    min-height: 42px;
  }

  .icon-btn {
    width: 46px;
    height: 46px;
  }

  .tool-btn {
    min-width: 44px;
    height: 44px;
  }

  .tool-value {
    min-width: 44px;
  }

  .home-tabs a {
    min-height: 44px;
  }

  /* Mais espaço para a cifra: menos moldura em volta. */
  .view {
    padding-top: 12px;
  }

  .song-head {
    padding-bottom: 10px;
  }

  .song-head h1 {
    font-size: clamp(22px, 5vw, 30px);
  }

  .song-info {
    margin-bottom: 8px;
  }

  .cifra {
    padding-bottom: 10px;
  }

  .song-footer {
    margin-top: 16px;
    padding-top: 10px;
  }
}

@media (max-width: 700px) {
  .view {
    padding-top: 18px;
  }

  .song-toolbar {
    top: calc(var(--topbar-h) + 2px);
    gap: 5px;
    padding: 6px;
    border-radius: 11px;
  }

  .tool-group {
    gap: 1px;
  }

  .tool-label {
    padding: 0 3px;
    font-size: 9px;
  }

  .tool-btn {
    min-width: 38px;
    height: 40px;
  }

  .tool-value {
    min-width: 36px;
    font-size: 14px;
  }

  .song-head {
    flex-wrap: wrap;
  }

  .song-head-actions {
    margin-left: 0;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .row-title {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) 88px;
  }

  .row-meta {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  }

  .library-tools {
    flex-direction: column;
  }

  .select {
    width: 100%;
  }

  .dialog.sheet {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }

  .dialog.sheet .dialog-body {
    max-height: calc(92vh - 128px);
    max-height: calc(92dvh - 128px);
  }

  .compare-dialog {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .compare-dialog .dialog-body {
    max-height: calc(100vh - 129px);
    max-height: calc(100dvh - 129px);
    padding: 8px;
  }

  .compare-grid {
    gap: 8px;
  }

  .compare-pane-head {
    padding: 10px 12px;
  }

  .compare-cifra {
    padding: 10px 12px 20px;
  }

  .toast {
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .liturgical-catalog-filters,
  .liturgical-catalog-results {
    grid-template-columns: 1fr;
  }

  .library-head {
    align-items: flex-start;
  }

  .library-actions {
    width: 100%;
  }

  .library-actions .btn {
    flex: 1 1 auto;
  }

  .song-grid {
    grid-template-columns: 1fr;
  }

  .song-card {
    min-height: 120px;
  }

  .brand-name {
    display: none;
  }
}

/* ---------- Notificações de Novidades ---------- */

.news-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 12px 18px;
  border-radius: var(--radius-md, 12px);
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.16), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.news-banner span {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-banner[hidden] {
  display: none !important;
}

/* ---------- Badges de Papel e Permissões ---------- */

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-musico {
  background: rgba(59, 130, 246, 0.14);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.28);
}

.badge-cantor {
  background: rgba(168, 85, 247, 0.14);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.28);
}

.badge-admin {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-projection {
  background: rgba(14, 165, 233, 0.14);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

html[data-theme="dark"] .badge-projection {
  color: #38bdf8;
}

.badge-warning {
  background: rgba(249, 115, 22, 0.14);
  color: #ea580c;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

html[data-theme="dark"] .badge-warning {
  color: #fb923c;
}

.badge-public {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-private {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.pl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.pl-owner {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Gerenciamento de Usuários ---------- */

.admin-users-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 0 40px;
}

.admin-user-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
}

.admin-demo-settings {
  margin-top: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
}

.admin-demo-settings h2 {
  margin: 0;
  font-size: 16px;
}

.admin-demo-settings .hint {
  margin: 6px 0 16px;
}

.admin-demo-settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-demo-settings-actions .auth-error {
  margin: 0;
}

.admin-user-table th,
.admin-user-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.admin-user-table th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-user-table tr:last-child td {
  border-bottom: none;
}

.admin-user-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.admin-user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Switches de formulário ---------- */

.form-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 6px 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
  box-sizing: border-box;
}

.form-switch:hover {
  border-color: var(--muted);
}

.form-switch:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-switch:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.form-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  margin: 0;
}

.form-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.form-switch-copy b {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.3;
}

.form-switch-copy small {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.35;
}

.form-switch-track {
  flex: none;
  display: inline-block;
  position: relative;
  width: 44px;
  height: 26px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  transition: background 0.16s ease, border-color 0.16s ease;
  box-sizing: border-box;
}

.form-switch-thumb {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--faint);
  transition: transform 0.16s ease, background 0.16s ease;
}

.form-switch input:checked ~ .form-switch-track {
  border-color: var(--accent);
  background: var(--accent);
}

.form-switch input:checked ~ .form-switch-track .form-switch-thumb {
  transform: translateX(18px);
  background: var(--accent-ink);
}

@media (prefers-reduced-motion: reduce) {
  .form-switch-track,
  .form-switch-thumb {
    transition: none;
  }
}

/* ---------- Assinatura do Desenvolvedor ---------- */

.site-signature {
  margin: 48px auto 28px;
  padding: 18px 20px 8px;
  max-width: 680px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.site-signature .sig-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.site-signature strong {
  color: var(--text);
  font-weight: 600;
}

.site-signature .sig-badge {
  color: var(--accent);
  font-size: 11px;
}

.site-signature .sig-rights {
  opacity: 0.85;
  font-size: 12px;
}

.menu-foot {
  margin: 12px 14px 14px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.menu-foot .sig-text {
  margin: 0;
  font-size: 12px;
}

.menu-foot .sig-text strong {
  color: var(--text);
}

.menu-foot .sig-sub {
  margin: 3px 0 0;
  font-size: 10.5px;
  opacity: 0.75;
}

.help-signature {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.help-signature strong {
  color: var(--text);
}

/* ---------- Impressão ---------- */

@media print {
  :root {
    --cifra-size: 11pt;
  }

  .cifra {
    font-size: 11pt !important;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .topbar,
  .song-toolbar,
  .song-head .icon-btn,
  .song-head-actions,
  .song-footer,
  .editor-toolbar,
  .editor-source,
  .toast,
  .home-tabs,
  .playlist-chip,
  .playlist-nav,
  .tool-handle,
  .tool-drawer,
  .drawer-scrim,
  .dialog {
    display: none !important;
  }

  .view {
    max-width: none;
    padding: 0;
  }

  .song-view {
    max-width: none;
  }

  .song-head {
    padding-bottom: 8px;
  }

  .song-info:not([hidden]) {
    display: flex !important;
    margin: 0 0 8px;
    color: #333 !important;
    font-size: 10pt;
  }

  .song-info b {
    color: #000 !important;
  }

  .chord {
    color: #000 !important;
  }

  .cue {
    border-color: #666 !important;
    background: transparent !important;
    color: #000 !important;
  }

  .section {
    color: #333 !important;
  }

  .section::after {
    background: #ccc !important;
  }

  .cifra,
  #cifraBody {
    padding: 0;
  }

  .line,
  .seg {
    break-inside: avoid;
  }
}

/* ---------- Cores & Tempos Litúrgicos ---------- */

.liturgical-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  line-height: 1.2;
}

.liturgical-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.liturgical-dot-sm {
  width: 7px;
  height: 7px;
}

.liturgical-dot-lg {
  width: 14px;
  height: 14px;
}

.liturgical-color-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.liturgical-color-dots .liturgical-dot {
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.pl-liturgical-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.liturgical-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.liturgical-color-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.liturgical-color-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.liturgical-color-option:hover {
  background: var(--surface-2);
}

.liturgical-color-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.liturgical-fixed-colors {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.liturgical-color-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background-color: var(--c);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.liturgical-color-btn:hover {
  transform: scale(1.15);
}

.liturgical-color-btn.active {
  border-color: var(--surface);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.liturgical-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.liturgical-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background-color 0.15s;
  user-select: none;
}

.liturgical-chip-label:hover {
  background: var(--surface-hover);
}

.liturgical-chip-label.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.liturgical-chip-label input[type="checkbox"] {
  cursor: pointer;
  width: auto;
  height: auto;
  margin: 0;
}

.demo-pill {
  background: #eab308;
  color: #0f172a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
}

.color-picker-wrap input[type="color"] {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.genre-manage-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: none;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.pl-card-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pl-creator-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}



/* ================================================================== */
/* Montador de Missa                                                   */
/* ================================================================== */

/* --- Layout geral --- */

.missa-view {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-h));
  padding-bottom: 24px;
}

/* Montador de Missas: reduz o respiro do topo para ganhar tela */
.view:has(.missa-view) {
  padding-top: 8px;
}

/* --- Cabeçalho do Montador --- */

.missa-header {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 6px 16px 4px;
}

.missa-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding-bottom: 4px;
}

.missa-filter-row {
  display: flex;
  justify-content: center;
  padding: 6px 0 2px;
}

.missa-filter-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.missa-filter-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  padding: 7px 14px;
  min-height: 34px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.missa-filter-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}

/* Cabeçalho compacto: abas, data e filtros numa única faixa no topo */
.missa-header .missa-cel-name {
  min-width: 0;
}

.missa-header .missa-cel-meta {
  flex: none;
}

@media (min-width: 640px) {
  .missa-header .home-tabs {
    padding: 3px;
  }

  .missa-header .home-tabs a {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13.5px;
  }

  .missa-header .missa-date-nav .btn {
    min-height: 34px;
  }

  .missa-header .missa-filter-tabs {
    padding: 3px;
  }

  .missa-header .missa-filter-btn {
    min-height: 32px;
    padding: 6px 12px;
  }
}

.missa-date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.missa-date-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.missa-date-icon,
.missa-date-full,
.missa-filter-compact {
  display: none;
}

.missa-date-nav .btn {
  min-height: 36px;
  font-size: 13px;
  padding: 0 11px;
  border-radius: 20px;
}

.missa-date-picker-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
}

.missa-date-native-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.missa-date-highlight {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
}

.missa-celebration-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 2px 0 6px;
  min-width: 0;
}

.missa-cel-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

.missa-cycle-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.missa-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.missa-top-actions .btn {
  white-space: nowrap;
}

/* Os botões nasceram para a barra inferior; aqui ficam compactos no topo. */
.missa-top-actions .missa-save-btn,
.missa-top-actions .missa-add-moment-btn {
  width: auto;
  flex: 0 1 auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 999px;
}

.missa-top-actions .missa-add-moment-btn {
  border-width: 1px;
}

.missa-add-short {
  display: none;
}

.missa-cel-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

/* Cor litúrgica aplicada ao nome da celebração */
.missa-cel-name--lit-roxo    { color: #9333ea; }
.missa-cel-name--lit-vermelho{ color: #dc2626; }
.missa-cel-name--lit-branco  { color: var(--text); }
.missa-cel-name--lit-verde   { color: #22c55e; }
html[data-theme="light"] .missa-cel-name--lit-verde { color: #15803d; }

.missa-lit-dot {
  margin: 0 7px;
  font-size: 10px;
  opacity: 0.75;
  flex-shrink: 0;
}

.missa-lit-season {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
}

.missa-cel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

/* Badge de cor litúrgica */
.missa-lit-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lit-verde   { background: #22c55e22; color: #15803d; border: 1px solid #22c55e55; }
.lit-roxo    { background: #a855f722; color: #7c3aed; border: 1px solid #a855f755; }
.lit-vermelho{ background: #ef444422; color: #b91c1c; border: 1px solid #ef444455; }
.lit-branco  { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

html[data-theme="light"] .lit-verde   { color: #166534; }
html[data-theme="light"] .lit-roxo    { color: #6d28d9; }
html[data-theme="light"] .lit-vermelho{ color: #991b1b; }

/* Badge genérico inline */
.badge-soft {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

/* --- Cards dos momentos --- */

.missa-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 10px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.missa-moment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 10px;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: grab;
}

.missa-moment-card:active { cursor: grabbing; }

.missa-moment-card.omitted {
  opacity: 0.55;
  cursor: default;
}

.missa-moment-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Cabeçalho do card */
.missa-moment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.missa-moment-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.missa-moment-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.missa-moment-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.missa-moment-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.missa-moment-actions:empty {
  display: none;
}

/* Botões de Ação do Momento (Ver cifra / Trocar música) */
.missa-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
  white-space: nowrap;
}

.missa-btn-action:active {
  transform: scale(0.97);
}

.missa-btn-icon-symbol {
  font-size: 13px;
  line-height: 1;
}

/* Botão Ver Cifra (olho) */
.missa-btn-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.missa-btn-preview:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

/* Busca a música selecionada no YouTube */
.missa-btn-youtube {
  background: #e62117;
  border: 1px solid #e62117;
  color: #fff;
  text-decoration: none;
}

.missa-btn-youtube:hover {
  background: #c91d14;
  border-color: #c91d14;
  color: #fff;
}

/* Botão Trocar Música (lupa) */
.missa-btn-swap {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
}

.missa-btn-swap:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Botão Limpar / Remover (X) */
.missa-btn-clear {
  color: var(--faint);
  width: 30px;
  height: 30px;
}

.missa-btn-clear:hover {
  color: #ef4444;
}

.missa-omit-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 999px;
}

.missa-omit-reason {
  font-size: 12px;
  color: var(--faint);
  margin: 0;
  font-style: italic;
}

/* Info da música selecionada */
.missa-song-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 28px;
  margin-bottom: 8px;
}

.missa-song-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.missa-song-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  padding: 1px 8px;
  border-radius: 8px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.missa-song-key-edit {
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.missa-song-key-edit:hover,
.missa-song-key-edit:focus-visible {
  color: var(--text);
  background: var(--accent);
}

.missa-key-dialog {
  width: min(460px, calc(100vw - 24px));
}

.missa-key-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
}

.missa-key-option {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.missa-key-option:hover,
.missa-key-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.missa-key-option:disabled {
  cursor: wait;
  opacity: 0.6;
}

.missa-song-artist {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.missa-no-song {
  font-size: 13px;
  color: var(--faint);
  font-style: italic;
}

/* --- Box de Versões / Melodias --- */

.missa-versions-box {
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px 7px;
  margin: 6px 0 8px;
}

html[data-theme="light"] .missa-versions-box {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.missa-versions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.missa-versions-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.missa-versions-icon {
  font-size: 12px;
}

.missa-versions-hint {
  font-size: 11px;
  color: var(--faint);
  font-style: italic;
}

.missa-versions-box .missa-melody-pills {
  margin-bottom: 0;
  gap: 6px;
}

.missa-versions-content {
  display: contents;
}

.missa-versions-toggle {
  display: none;
}

.missa-pill-check {
  font-weight: 800;
  margin-right: 3px;
  color: var(--accent);
}

/* --- Pílulas de melodia --- */

.missa-melody-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.missa-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  min-height: 32px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.missa-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.missa-pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Botões de ícone --- */

.missa-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.missa-btn-icon:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.missa-btn-icon:disabled {
  opacity: 0.3;
  cursor: default;
}

/* --- Botões ▲▼ e grip --- */

.missa-move-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.missa-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  touch-action: manipulation;
}

.missa-btn-sm:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.missa-btn-sm:disabled {
  opacity: 0.3;
  cursor: default;
}

.missa-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--faint);
  cursor: grab;
  border-radius: 8px;
  transition: background 0.1s;
}

.missa-drag-handle:hover {
  background: var(--surface-2);
  color: var(--muted);
}

.missa-drag-handle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* --- Botão adicionar momento/música extra (na barra inferior) --- */

.missa-add-moment-btn {
  width: auto;
  flex: 0 1 auto;
  min-height: 48px;
  padding: 0 16px;
  border: 2px dashed var(--border);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  white-space: nowrap;
  transition: all 0.15s;
}

.missa-add-moment-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* --- Barra flutuante de ações --- */

.missa-footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.missa-save-btn {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  min-height: 48px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 999px;
}

.missa-save-btn--pending {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .missa-footer-bar {
    flex-wrap: wrap;
  }

  .missa-save-btn,
  .missa-add-moment-btn {
    flex: 1 1 100%;
    width: 100%;
    white-space: normal;
  }
}

/* --- Painel de busca deslizante --- */

.missa-search-panel[hidden] {
  display: none !important;
}

.missa-search-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 70;
  width: min(560px, calc(100vw - 24px));
  max-height: min(72vh, 560px);
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  gap: 12px;
  animation: missaModalIn 0.18s ease;
}

@keyframes missaModalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes slideUp {
  from { transform: translateY(60%); opacity: 0.3; }
  to   { transform: translateY(0);   opacity: 1; }
}

.missa-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.missa-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0 14px;
  min-height: 44px;
  transition: border-color 0.12s;
}

.missa-search-box:focus-within {
  border-color: var(--accent);
}

.missa-search-box svg {
  width: 18px;
  height: 18px;
  stroke: var(--faint);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

.missa-search-box input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.missa-search-results {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.missa-unused-moments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 2px;
}

.missa-search-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
  touch-action: manipulation;
  min-height: 48px;
}

.missa-search-result-item:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.missa-search-result-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.msr-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msr-artist {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.msr-current {
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.missa-no-results {
  font-size: 13px;
  color: var(--faint);
  text-align: center;
  padding: 20px 0;
  margin: 0;
}

/* --- Loading skeleton no Montador --- */

.loading-missa .missa-skeleton {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 72px;
}

.sk-line {
  height: 14px;
  border-radius: 7px;
  background: var(--surface-2);
  animation: pulse 1.4s ease-in-out infinite;
}

.sk-wide  { width: 70%; margin-bottom: 8px; }
.sk-mid   { width: 42%; margin-bottom: 16px; height: 10px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* --- Responsive: tablet / desktop --- */

/* --- Modal de visualização da cifra no Montador --- */

.missa-preview-panel[hidden] {
  display: none !important;
}

.missa-preview-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 65;
  background: var(--bg-elev);
  border-top: 1.5px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 36px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  height: 85vh;
  max-height: 800px;
  padding: 16px 20px 24px;
  gap: 14px;
  animation: slideUp 0.22s ease;
}

.missa-preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  flex-shrink: 0;
}

.missa-preview-youtube[hidden] {
  display: none;
}

.missa-preview-titles {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.missa-preview-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.missa-preview-artist {
  font-size: 13px;
  color: var(--muted);
}

.missa-preview-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 4px;
  font-family: var(--font-mono);
  font-size: var(--cifra-size);
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (min-width: 640px) {
  .missa-cards {
    padding: 18px 24px 14px;
  }

  .missa-moment-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto;
    column-gap: 12px;
  }

  .missa-moment-header {
    grid-column: 1 / -1;
  }

  .missa-song-info {
    grid-column: 1 / -1;
  }

  .missa-melody-pills {
    grid-column: 1 / -1;
  }

  .missa-versions-box {
    grid-column: 1 / -1;
  }

  .missa-move-btns {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .missa-footer-bar {
    max-width: 820px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border);
  }

  .missa-preview-panel {
    max-width: 720px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    border-radius: var(--radius) var(--radius) 0 0;
    border-left: 1.5px solid var(--border);
    border-right: 1.5px solid var(--border);
  }
}

@media (max-width: 639px) {
  .liturgical-catalog .home-tabs {
    display: flex;
    width: 100%;
  }

  .liturgical-catalog .home-tabs a {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    gap: 3px;
    padding: 0 5px;
    font-size: 12px;
  }

  .missa-header {
    padding: 8px 12px 0;
  }

  /* Abas na topbar: cabem em uma linha mesmo em telas estreitas. */
  .topbar.has-tabs {
    gap: 6px;
  }

  .topbar.has-tabs .brand {
    gap: 0;
  }

  .topbar.has-tabs .brand-name {
    display: none;
  }

  .topbar.has-tabs .topbar-tabs .home-tabs {
    gap: 1px;
    padding: 2px;
  }

  .topbar.has-tabs .topbar-tabs .home-tabs a {
    min-height: 32px;
    padding: 0 6px;
    font-size: 11.5px;
    gap: 3px;
  }

  .topbar.has-tabs .topbar-tabs .tab-count {
    display: none;
  }

  .topbar.has-tabs .topbar-actions {
    gap: 0;
  }

  .missa-controls-row {
    gap: 5px;
    padding-bottom: 3px;
  }

  .missa-date-nav {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 3px;
  }

  .missa-date-nav .btn {
    min-width: 0;
    min-height: 38px;
    padding: 0 7px;
    font-size: 12px;
  }

  .missa-date-nav .missa-date-step {
    width: 26px;
    min-width: 26px;
    padding: 0;
    font-size: 21px;
    line-height: 1;
  }

  .missa-date-step-label {
    display: none;
  }

  .missa-date-short {
    display: inline !important;
  }

  .missa-date-icon {
    display: none;
  }

  .missa-date-nav .missa-date-picker-btn {
    padding: 0 4px;
    font-size: 13px;
  }

  .missa-date-full {
    display: none !important;
  }

  .missa-filter-full {
    display: none;
  }

  .missa-filter-compact {
    display: inline;
  }

  .missa-filter-tabs {
    flex: 1 1 auto;
    min-width: 0;
    gap: 1px;
    padding: 2px;
  }

  .missa-filter-btn {
    flex: 1;
    min-width: 0;
    min-height: 36px;
    padding: 5px 3px;
    font-size: 13px;
  }

  .missa-celebration-info {
    gap: 4px;
    padding: 4px 0 6px;
  }

  .missa-top-actions {
    width: 100%;
  }

  .missa-top-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .missa-add-long {
    display: none;
  }

  .missa-add-short {
    display: inline;
  }

  .missa-cel-name {
    font-size: 17px;
    line-height: 1.18;
  }

  .missa-cel-meta {
    gap: 5px;
  }

  .missa-date-highlight,
  .missa-cel-meta .badge {
    min-height: 26px;
    padding: 3px 8px;
    font-size: 11px;
  }

  .missa-cards {
    gap: 10px;
    padding: 10px 12px 14px;
  }

  .missa-moment-card {
    padding: 9px;
    border-radius: 13px;
    cursor: default;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  }

  .missa-moment-header {
    display: contents;
  }

  .missa-moment-num {
    grid-column: 1;
    grid-row: 1;
  }

  .missa-moment-title-wrap {
    grid-column: 2 / -1;
    grid-row: 1;
  }

  .missa-moment-card {
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) auto;
  }

  .missa-song-info {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .missa-versions-content {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .missa-moment-actions {
    grid-column: 1 / 3;
    grid-row: 4;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    gap: 4px;
  }

  .missa-move-btns {
    grid-column: 3 / -1;
    grid-row: 4;
    justify-content: flex-end;
  }

  .missa-moment-card:not(:has(.missa-versions-content)) .missa-moment-actions {
    grid-row: 3;
  }

  .missa-moment-card:not(:has(.missa-versions-content)) .missa-move-btns {
    grid-row: 3;
  }

  .missa-moment-header {
    gap: 7px;
    margin-bottom: 7px;
  }

  .missa-moment-num {
    width: 25px;
    height: 25px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
  }

  .missa-moment-title {
    align-self: center;
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
    letter-spacing: 0.025em;
  }

  .missa-btn-action {
    justify-content: center;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 34px;
    padding: 0 4px;
    border-radius: 8px;
    font-size: 18px;
  }

  .missa-btn-action .missa-btn-label {
    display: none;
  }

  .missa-btn-action .missa-btn-icon-symbol {
    font-size: 19px;
  }

  .missa-moment-actions .missa-btn-clear {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 32px;
    height: 32px;
    background: var(--surface-2);
  }

  .missa-moment-card {
    position: relative;
  }

  .missa-moment-card:has(.missa-moment-actions .missa-btn-clear) {
    padding-right: 9px;
  }

  .missa-song-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 5px 7px;
    align-items: center;
    min-height: 0;
    margin: 0 0 6px;
    padding: 7px 8px;
    border: 1px solid var(--accent);
    border-left-width: 3px;
    border-radius: 9px;
    background: var(--accent-soft);
  }

  .missa-song-title {
    min-width: 0;
    font-size: 16px;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .missa-song-key {
    grid-column: 2;
    grid-row: 1;
    min-height: 32px;
    padding: 2px 8px;
    font-size: 15px;
  }

  .missa-song-artist {
    grid-column: 1 / 3;
    font-size: 13px;
    white-space: normal;
  }

  .missa-versions-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    grid-column: 3;
    grid-row: 1;
    min-width: 42px;
    min-height: 38px;
    padding: 3px 6px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    touch-action: manipulation;
  }

  .missa-versions-toggle-chevron {
    display: inline-block;
    font-size: 18px;
    line-height: 1;
    transition: transform 0.15s ease;
  }

  .missa-versions-toggle.expanded .missa-versions-toggle-chevron {
    transform: rotate(180deg);
  }

  .missa-versions-content:not(.expanded) {
    display: none;
  }

  .missa-versions-content.expanded {
    display: block;
  }

  .missa-versions-box {
    padding: 8px;
    margin: 4px 0 6px;
    border-style: solid;
    border-radius: 9px;
    background: var(--surface-2);
  }

  .missa-versions-header {
    margin-bottom: 6px;
  }

  .missa-versions-label {
    font-size: 12px;
    color: var(--text);
  }

  .missa-versions-hint {
    font-size: 12px;
  }

  .missa-pill {
    min-height: 38px;
    padding: 5px 10px;
    font-size: 13px;
  }

  .missa-pill.active {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
    font-weight: 750;
  }

  .missa-pill.active .missa-pill-check {
    color: inherit;
  }

  .missa-move-btns {
    gap: 3px;
    margin-top: 0;
  }

  .missa-btn-sm {
    min-width: 34px;
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 8px;
  }

  .missa-drag-handle {
    width: 34px;
    height: 34px;
  }

  .missa-footer-bar {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }

  .missa-save-btn {
    flex: 1 1 58%;
    min-height: 52px;
    padding: 0 10px;
    font-size: 15px;
  }

  .missa-add-moment-btn {
    flex: 1 1 42%;
    width: auto;
    min-height: 52px;
    padding: 0 8px;
    font-size: 13px;
    white-space: normal;
  }

  .missa-view {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .missa-preview-panel {
    height: min(85vh, 800px);
    padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
  }

  .missa-preview-header {
    flex-wrap: wrap;
  }

  .missa-preview-titles {
    flex-basis: calc(100% - 46px);
    gap: 6px 8px;
  }

  .missa-preview-title {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 16px;
  }

  .missa-preview-youtube {
    order: 1;
    flex: 1 1 auto;
    min-height: 42px;
  }
}

/* ------------------------------------------------------------------ */
/* Oração Eucarística: caixa de respostas depois do Santo              */
/* ------------------------------------------------------------------ */

.euc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: default;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.missa-cards > .euc-card {
  margin: 0;
}

#playlistSongs .euc-card {
  margin: 10px 0;
}

.euc-card.euc-loading,
.euc-card.euc-empty {
  opacity: 0.9;
}

.euc-playlist-card {
  margin: 14px auto;
  max-width: 820px;
}

.euc-playlist-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--faint);
}

.euc-modal-dialog {
  width: min(900px, calc(100vw - 24px));
  max-height: 90vh;
  max-height: 90dvh;
}

.euc-modal-dialog .dialog-head > div {
  flex: 1 1 auto;
  min-width: 0;
}

.euc-modal-dialog .dialog-head h2 {
  overflow-wrap: anywhere;
}

.euc-modal-body {
  max-height: calc(90vh - 78px);
  max-height: calc(90dvh - 78px);
}

.euc-sequence-view {
  max-width: 1040px;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.euc-sequence-head {
  margin-bottom: 12px;
}

.euc-sequence-head h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.euc-sequence-prayer-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 14px;
}

.euc-sequence-prayer-tabs .euc-prayer-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 6px 10px;
}

.euc-sequence-head h1 small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.62em;
  font-weight: 600;
}

.euc-sequence-content {
  max-width: 900px;
}

.euc-after-santo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.euc-after-santo::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.euc-full-prayer {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.4;
  white-space: normal;
}

.euc-prayer-line + .euc-prayer-line {
  margin-top: 2px;
}

.euc-assembly-response {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 800;
}

.euc-prayer-response {
  display: block;
  max-width: 100%;
}

.euc-inline-response-tools {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  margin: 2px 0 5px 7px;
}

.euc-text-unavailable {
  margin: 0;
  padding: 11px 13px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.euc-dialog-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.euc-dialog-section h3 {
  margin: 0;
  font-size: 14px;
}

.euc-dialog-responses,
.euc-accordions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.euc-dialog-response {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.euc-dialog-response p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.euc-dialog-response strong {
  display: block;
  font-size: 14px;
  line-height: 1.5;
}

.euc-accordion {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  overflow: hidden;
}

.euc-accordion.selected {
  border-color: var(--accent);
}

.euc-accordion summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.euc-accordion summary::-webkit-details-marker {
  display: none;
}

.euc-accordion summary::after {
  content: '+';
  margin-left: auto;
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.euc-accordion[open] summary::after {
  content: '−';
}

.euc-accordion summary strong {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
}

.euc-accordion-num {
  display: inline-flex;
  flex: 0 0 23px;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.euc-accordion-body {
  padding: 0 12px 12px 45px;
}

.euc-chord-button {
  text-decoration: none;
}

.euc-chord-control {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.euc-chord-preview {
  width: 100%;
  max-height: 38vh;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: auto;
}

.euc-inline-chord-preview {
  flex: 1 1 100%;
  width: min(100%, 560px);
  max-height: none;
  overflow: visible;
}

.euc-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.euc-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
}

.euc-head-text {
  display: flex;
  flex: 1 1 160px;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.euc-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.euc-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  overflow-wrap: anywhere;
}

.euc-title small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.euc-head-song,
.euc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.euc-head-song:hover,
.euc-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.euc-prayer-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 11px;
}

.euc-prayer-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.euc-prayer-tab b,
.euc-prayer-tab span {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.euc-prayer-tab b {
  font-size: 14px;
  line-height: 1.1;
}

.euc-prayer-tab span {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
}

.euc-prayer-tab:hover {
  border-color: var(--accent);
}

.euc-prayer-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.euc-prayer-tab.active span {
  color: var(--accent-ink);
  opacity: 0.85;
}

.euc-body {
  margin-top: 13px;
}

.euc-prayer-name {
  margin-bottom: 9px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.euc-prayer-name span {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--faint);
}

.euc-responses {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.euc-response {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.euc-context {
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.euc-response-text {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: var(--text);
}

.euc-mystery {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.euc-mystery-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.euc-mystery-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.euc-mystery-hint {
  font-size: 10.5px;
  color: var(--faint);
}

.euc-mystery-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.euc-mystery-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.euc-mystery-option {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.euc-mystery-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.euc-mystery-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 800;
}

.euc-mystery-option.active .euc-mystery-num {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.euc-mystery-text {
  min-width: 0;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.euc-mystery-song {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 16px;
  text-decoration: none;
}

.euc-mystery-song:hover {
  border-color: var(--accent);
}

.euc-edition {
  margin: 10px 0 0;
  font-size: 10px;
  line-height: 1.4;
  color: var(--faint);
}

/* Cifra pessoal de cada resposta */

.euc-response-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.euc-response-song {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.euc-response-song--empty {
  color: var(--faint);
  font-weight: 600;
}

.euc-response-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.euc-response-edit:hover,
.euc-response-edit:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.euc-response-edit--inline {
  flex: 0 0 auto;
}

.euc-mystery-tools {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}

.euc-mystery-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.euc-mystery-edit:hover,
.euc-mystery-edit:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.euc-response-editor {
  width: min(720px, calc(100vw - 24px));
  max-height: 90vh;
  max-height: 90dvh;
}

.euc-response-editor .dialog-head h2 {
  margin: 2px 0 0;
  font-size: 16px;
  line-height: 1.35;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.euc-response-editor-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(90vh - 78px);
  max-height: calc(90dvh - 78px);
  overflow: auto;
}

.euc-response-current {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}

.euc-response-current strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.euc-response-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.euc-response-search label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.euc-response-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.euc-response-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 38vh;
  overflow: auto;
}

.euc-response-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.euc-response-result:hover,
.euc-response-result:focus-visible {
  border-color: var(--accent);
}

.euc-response-result.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.euc-response-result-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.euc-response-result-meta {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 11px;
}

.euc-response-result-check {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 800;
}

.euc-response-empty {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.euc-response-new {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.euc-response-new-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.euc-response-new-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.euc-response-new-form input,
.euc-response-new-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.euc-response-new-form textarea {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}

.euc-response-new-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}

.euc-response-new-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.euc-response-stanza-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.euc-response-stanza {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.euc-response-stanza:hover,
.euc-response-stanza:focus-visible {
  border-color: var(--accent);
}

.euc-response-stanza-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.euc-response-stanza-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .euc-response-new-row {
    grid-template-columns: 1fr;
  }
}

.euc-skeleton {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.euc-skeleton span {
  display: block;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-2);
  animation: euc-pulse 1.2s ease-in-out infinite;
}

@keyframes euc-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.euc-play-wrap {
  width: 100%;
  max-width: 820px;
  margin: 16px auto 0;
  padding: 0 16px;
}

@media (max-width: 639px) {
  .euc-card {
    padding: 10px 11px;
    border-radius: 13px;
  }

  .euc-prayer-tabs {
    overflow-x: auto;
    gap: 5px;
    padding-bottom: 2px;
  }

  .euc-prayer-tab {
    flex: 0 0 auto;
    min-width: 54px;
    min-height: 44px;
    padding: 5px 6px;
  }

  .euc-prayer-tab span {
    font-size: 8.5px;
  }

  .euc-response-text {
    font-size: 13px;
  }

  .euc-mystery-text {
    font-size: 12px;
  }

  .euc-head-song,
  .euc-toggle {
    min-height: 34px;
    padding: 0 9px;
  }

  .euc-play-wrap {
    padding: 0 12px;
  }
}

/* -------------------------------------------------------------------------- */
/* Módulo de Projeção Datashow (Holyrics) & Painel do Operador                */
/* -------------------------------------------------------------------------- */

body.view-projetor {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden !important;
  background-color: #000000;
  user-select: none;
}

body.view-projetor .topbar,
body.view-projetor .app-navigation,
body.view-projetor #toast,
body.view-projetor .tool-drawer,
body.view-projetor .drawer-scrim {
  display: none !important;
}

.projetor-root {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #001030;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 3vmin;
  box-sizing: border-box;
}

.projetor-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.projetor-logo {
  position: absolute;
  width: 14vmin;
  height: 14vmin;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.3s ease;
}

.projetor-logo.top-right { top: 4vmin; right: 4vmin; }
.projetor-logo.top-left { top: 4vmin; left: 4vmin; }
.projetor-logo.bottom-right { bottom: 4vmin; right: 4vmin; }
.projetor-logo.bottom-left { bottom: 4vmin; left: 4vmin; }

.projetor-card {
  position: relative;
  z-index: 2;
  width: 96vw;
  max-width: 96vw;
  max-height: 94vh;
  background: transparent;
  padding: 1.5vmin 3vmin;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.projetor-card.is-empty {
  opacity: 0;
  pointer-events: none;
}

.projetor-card.is-cleared {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  transition: none;
}

.projetor-card.is-blank {
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.projetor-head {
  display: none;
}

.projetor-foot {
  display: none;
}

.projetor-lines {
  display: flex;
  flex-direction: column;
  gap: 2vmin;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  background: rgba(var(--proj-text-box-rgb, 0, 0, 0), var(--proj-text-box, 0));
  border: 1px solid rgba(255, 255, 255, calc(var(--proj-text-box, 0) * 0.30));
  border-radius: 1.2vmin;
  padding: 1.6vmin 3.2vmin;
  box-sizing: border-box;
}

.proj-line {
  font-size: calc(clamp(1.9rem, 4.8vmin, 4.2rem) * var(--proj-font-scale, 1.0));
  line-height: 1.3;
  font-weight: 800;
  color: #ffffff;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, var(--proj-text-outline, 0.95)),
    0 4px 14px rgba(0, 0, 0, var(--proj-text-outline, 0.95)),
    0 0 2px rgba(0, 0, 0, var(--proj-text-outline, 0.95));
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  text-transform: uppercase;
}

.proj-line.is-chorus {
  color: #fde047;
  font-weight: 900;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, var(--proj-text-outline, 0.95)),
    0 4px 16px rgba(0, 0, 0, var(--proj-text-outline, 0.95)),
    0 0 2px rgba(0, 0, 0, var(--proj-text-outline, 0.95));
}

.projetor-blackout {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.projetor-blackout.active {
  opacity: 1;
  pointer-events: all;
}

.projetor-waiting {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  transition: opacity 0.3s ease;
}

.projetor-waiting.hidden {
  opacity: 0;
  pointer-events: none;
}

.projetor-waiting-box {
  text-align: center;
  padding: 5vmin;
  color: #f3f4f6;
}

.projetor-waiting-icon {
  font-size: 8vmin;
  margin-bottom: 2vmin;
}

.projetor-waiting-box h2 {
  font-size: 4vmin;
  margin: 0 0 1.5vmin 0;
  color: #ffffff;
}

.projetor-waiting-box p {
  font-size: 2.5vmin;
  color: #9ca3af;
  margin: 0 0 1.5vmin 0;
}

.projetor-waiting-box small {
  display: block;
  font-size: 1.8vmin;
  color: #6b7280;
}

.projetor-waiting-hint {
  margin-top: 3vmin;
  font-size: 1.8vmin;
  padding: 1vmin 2vmin;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: inline-block;
  color: #d1d5db;
}

/* -------------------------------------------------------------------------- */
/* Painel do Operador (Tela de Controle Datashow)                             */
/* -------------------------------------------------------------------------- */

.projection-drawer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.projection-drawer.open {
  opacity: 1;
  pointer-events: all;
}

.op-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
}

.op-panel {
  position: relative;
  z-index: 2;
  width: 92vw;
  max-width: 1080px;
  height: 100%;
  background: var(--bg-surface, #161b22);
  color: var(--text-main, #f0f6fc);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.7);
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.op-head {
  padding: 12px 18px;
  background: var(--bg-card, #0d1117);
  border-bottom: 1px solid var(--border-color, #30363d);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.op-head-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.op-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #eab308;
}

.op-status-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.op-status-dot.waiting {
  background: #eab308;
  box-shadow: 0 0 8px #eab308;
}

.op-status-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #8b949e);
}

.op-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.op-control-bar {
  padding: 10px 18px;
  background: var(--bg-soft, #1f242c);
  border-bottom: 1px solid var(--border-color, #30363d);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.op-nav-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.op-btn-nav {
  min-width: 110px;
  font-weight: 700;
}

.op-index-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  background: var(--bg-card, #0d1117);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 6px;
  color: var(--accent, #3b82f6);
}

.op-action-toggles {
  display: flex;
  gap: 10px;
}

.op-btn-toggle.active {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
}

.op-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.op-preview-col {
  width: 340px;
  background: var(--bg-card, #0d1117);
  border-right: 1px solid var(--border-color, #30363d);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.op-preview-frame {
  width: 100%;
  background: #000;
  border: 1px solid var(--border-color, #30363d);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.op-preview-aspect {
  position: relative;
  width: 100%;
  padding-bottom: 75%;
  background: radial-gradient(circle at center, #111827 0%, #030712 100%);
}

.op-preview-card {
  position: absolute;
  inset: 12px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: opacity 0.2s ease;
}

.op-preview-card.is-cleared {
  opacity: 0.15;
}

.op-preview-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  margin-bottom: 4px;
}

.op-preview-badge.is-chorus {
  background: rgba(234, 179, 8, 0.3);
  color: #fef08a;
}

.op-preview-title {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

.op-preview-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.op-line {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  text-transform: uppercase;
}

.op-line.is-chorus {
  color: #fef08a;
}

.op-preview-counter {
  font-size: 9px;
  color: #6b7280;
  margin-top: 6px;
}

.op-blackout-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.op-blackout-overlay.active {
  opacity: 0.96;
}

.op-keyboard-shortcuts-hint {
  font-size: 11.5px;
  color: var(--text-muted, #8b949e);
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 6px;
}

.op-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.op-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color, #30363d);
  background: var(--bg-card, #0d1117);
}

.op-tab {
  flex: 1;
  padding: 12px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted, #8b949e);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.op-tab.active {
  color: var(--accent, #3b82f6);
  border-bottom-color: var(--accent, #3b82f6);
  background: var(--bg-surface, #161b22);
}

.op-tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
}

.op-tab-content.active {
  display: flex;
}

.op-song-selector-row,
.op-readings-toolbar,
.op-prayers-toolbar {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.op-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--bg-card, #0d1117);
  border: 1px solid var(--border-color, #30363d);
  color: var(--text-main, #f0f6fc);
  font-size: 14px;
  font-weight: 600;
}

.op-slides-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  padding-right: 4px;
}

.op-slide-card {
  background: var(--bg-card, #0d1117);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.op-slide-card:hover {
  border-color: var(--accent, #3b82f6);
  transform: translateY(-2px);
}

.op-slide-card.active {
  border-color: var(--accent, #3b82f6);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 0 1px var(--accent, #3b82f6);
}

.op-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.op-card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #8b949e);
}

.op-card-badge.is-chorus {
  background: rgba(234, 179, 8, 0.2);
  color: #fef08a;
}

.op-card-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #8b949e);
}

.op-card-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.op-card-line {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text-main, #f0f6fc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-empty-hint {
  padding: 30px;
  text-align: center;
  color: var(--text-muted, #8b949e);
  font-size: 14px;
  grid-column: 1 / -1;
}

.op-quick-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 650px;
}

.op-quick-box textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-card, #0d1117);
  border: 1px solid var(--border-color, #30363d);
  color: var(--text-main, #f0f6fc);
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
}

.op-quick-actions {
  display: flex;
  gap: 10px;
}

.op-quick-presets {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.op-presets-title {
  width: 100%;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted, #8b949e);
  margin-bottom: 4px;
}

.proj-settings-dialog {
  max-width: 580px;
}

.proj-setting-group {
  padding: 12px;
  background: var(--bg-card, #0d1117);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 8px;
}

@media (max-width: 800px) {
  .op-body {
    flex-direction: column;
  }
  .op-preview-col {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color, #30363d);
  }
}

/* -------------------------------------------------------------------------- */
/* Tela do Operador Datashow (3 Colunas Holyrics)                             */
/* -------------------------------------------------------------------------- */

body.view-operador {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden !important;
  background-color: #0b0f14;
}

body.view-operador .topbar,
body.view-operador .app-navigation,
body.view-operador #toast,
body.view-operador .tool-drawer,
body.view-operador .drawer-scrim {
  display: none !important;
}

body.view-operador #view,
body.view-projetor #view {
  max-width: 100% !important;
  width: 100% !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.operador-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  background: #0b0f14;
  color: #f0f6fc;
  overflow: hidden;
  box-sizing: border-box;
}

.operador-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #111720;
  border-bottom: 1px solid #1f2733;
  gap: 10px;
  flex-wrap: nowrap;
  z-index: 10;
  min-height: 48px;
  box-sizing: border-box;
}

.op-h-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.op-h-brand {
  font-size: 15px;
  color: #9ca3af;
  letter-spacing: -0.02em;
}

.op-h-brand b {
  color: #38bdf8;
  font-weight: 700;
}

.op-h-pl-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: #19222d;
  border: 1px solid #283545;
  border-radius: 6px;
}

.op-h-pl-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #f3f4f6;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-h-btn-switch {
  padding: 2px 8px;
  font-size: 11.5px;
  height: 24px;
}

.op-h-date-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #9ca3af;
}

.op-h-date-input {
  background: #19222d;
  border: 1px solid #283545;
  color: #f3f4f6;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.op-h-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.op-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #141b24;
  border: 1px solid #232d3b;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
}

/* Área de Trabalho 3 Colunas Proporcionais */
.operador-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 1.05fr) minmax(340px, 1.55fr) minmax(270px, 1fr);
  overflow: hidden;
  background: #0b0f14;
  height: calc(100vh - 48px);
  min-height: 0;
  box-sizing: border-box;
}

/* Coluna 1: Roteiro e Itens da Missa */
.operador-items-col {
  background: #0d1219;
  border-right: 1px solid #1f2733;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.op-section-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.op-section-header {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #38bdf8;
  padding: 1px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.op-section-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.op-item-btn {
  width: 100%;
  text-align: left;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid #1e2632;
  background: #141b24;
  color: #f0f6fc;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  box-sizing: border-box;
  min-height: 27px;
}

.op-item-btn[draggable="true"] {
  cursor: grab;
  user-select: none;
}

.op-item-btn.op-item-dragging {
  opacity: 0.45;
}

.op-item-btn.op-item-drop-target {
  border-color: #38bdf8;
  box-shadow: inset 0 2px 0 #38bdf8;
}

.op-item-grip {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 13px;
  letter-spacing: -3px;
  cursor: grab;
}

.op-item-btn:hover {
  border-color: #38bdf8;
  background: #192330;
}

.op-item-btn.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  box-shadow: 0 0 0 1px #38bdf8;
}

.op-item-btn.op-item-reading {
  border-left: 3px solid #38bdf8;
}

.op-item-btn.op-item-prayer {
  border-left: 3px solid #a855f7;
}

.op-item-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.op-item-badge {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  background: #1e293b;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.op-avulsa-options,
.op-avulsa-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 38vh;
  overflow-y: auto;
}

.op-avulsa-song-btn {
  width: 100%;
  text-align: left;
}

.op-item-empty {
  font-size: 12px;
  color: #64748b;
  padding: 8px;
}

/* Coluna 2: Painel de Estrofes ao Centro */
.operador-slides-col {
  background: #111720;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.op-slides-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1f2733;
  padding-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.op-head-left-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.op-slides-head h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: #f8fafc;
}

/* Botão "🖼️ Fundo" do item: destaque quando o item tem imagem própria */
#btnItemBgPicker.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #7dd3fc;
}

/* Modal CRUD de fundos litúrgicos */
.liturgical-bg-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.liturgical-bg-season h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: #f8fafc;
}

.liturgical-bg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.liturgical-bg-card {
  background: #1a1f2e;
  border: 1px solid #2d3748;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}

.liturgical-bg-card:hover {
  border-color: #38bdf8;
}

.liturgical-bg-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.liturgical-bg-info {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.liturgical-bg-title {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
}

.liturgical-bg-item {
  font-size: 11px;
  color: #94a3b8;
}

.liturgical-bg-actions {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #2d3748;
}

.liturgical-bg-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: #64748b;
  font-size: 13px;
}

.liturgical-bg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #1a1f2e;
  border-radius: 8px;
  border: 1px solid #2d3748;
}

.liturgical-bg-form h3 {
  margin: 0;
  font-size: 16px;
  color: #f8fafc;
}

.liturgical-bg-preview {
  margin: 8px 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #2d3748;
}

.liturgical-bg-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.op-btn-jump-chorus {
  background: #eab308 !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: none !important;
  padding: 6px 14px !important;
  border-radius: 6px !important;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.op-btn-jump-chorus:hover {
  background: #facc15 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.35);
}

.op-btn-nav-chorus {
  background: #eab308 !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: none !important;
  padding: 6px 12px !important;
  border-radius: 6px !important;
  cursor: pointer;
}

.op-btn-nav-chorus:hover {
  background: #facc15 !important;
}

.op-active-count {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  background: #1e293b;
  border-radius: 9999px;
  color: #94a3b8;
}

.op-slides-grid-center {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.op-stanza-card {
  background: #141c26;
  border: 1px solid #222d3b;
  border-left: 4px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: auto;
}

.op-stanza-card:hover {
  border-color: #38bdf8;
  background: #182230;
}

.op-stanza-card.active {
  border-color: #38bdf8;
  border-left: 4px solid #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  box-shadow: 0 0 0 1px #38bdf8;
}

.op-stanza-card.is-chorus-card {
  border-left: 4px solid #eab308;
  background: rgba(234, 179, 8, 0.06);
}

.op-stanza-card.is-chorus-card.active {
  border-color: #eab308;
  border-left: 4px solid #eab308;
  background: rgba(234, 179, 8, 0.2);
  box-shadow: 0 0 0 1px #eab308;
}

.op-st-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.op-st-chorus-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}

.op-st-chorus-check:hover {
  background: #334155;
  color: #f8fafc;
}

.op-st-chorus-check input[type="checkbox"] {
  accent-color: #eab308;
  cursor: pointer;
  width: 13px;
  height: 13px;
}

.op-stanza-card.is-chorus-card .op-st-chorus-check {
  background: rgba(234, 179, 8, 0.25);
  color: #fef08a;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.op-st-chorus-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(234, 179, 8, 0.25);
  color: #fef08a;
  border: 1px solid rgba(234, 179, 8, 0.4);
  text-transform: uppercase;
}

.op-st-num {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.op-st-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.op-st-line {
  font-size: 13.5px;
  line-height: 1.35;
  color: #f1f5f9;
  font-weight: 600;
  white-space: normal;
  word-break: normal;
}

.op-stanza-card.is-chorus-card .op-st-line {
  color: #fef08a;
  font-weight: 700;
}

.op-st-line.op-st-blank {
  color: var(--muted);
  font-style: italic;
  font-weight: 500;
}

/* Coluna 3: Monitor Datashow e Controles */
.operador-monitor-col {
  background: #0d1219;
  border-left: 1px solid #1f2733;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.op-monitor-box {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  background: #000;
  border: 1px solid #1f2733;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.op-monitor-header {
  padding: 5px 8px;
  background: #141b24;
  border-bottom: 1px solid #1f2733;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.op-monitor-aspect {
  position: relative;
  width: 100%;
  padding-bottom: 58%; /* Aspecto compacto para caber o monitor e as preces na mesma tela */
  background: radial-gradient(circle at center, #111827 0%, #030712 100%);
  overflow: hidden;
}

.op-monitor-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
  pointer-events: none;
  display: none;
  transition: opacity 0.25s ease;
}

.op-monitor-aspect .op-preview-card {
  z-index: 2;
  position: absolute;
  inset: 0;
}

.op-monitor-aspect .op-blackout-overlay {
  z-index: 3;
}

.op-theme-quick-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.op-btn-online-bg {
  width: 100%;
  padding: 6px 10px;
  background: #141c28;
  border: 1px dashed #38bdf8;
  color: #38bdf8;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.op-btn-online-bg:hover {
  background: rgba(56, 189, 248, 0.15);
  border-style: solid;
  transform: translateY(-1px);
}

.op-nav-control-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.op-nav-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.op-nav-btn {
  flex: 1;
  font-weight: 700;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.op-btn-nav-chorus {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
}

.op-nav-counter-pill {
  padding: 4px 8px;
  background: #141b24;
  border: 1px solid #1f2733;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
}

.op-shortcuts-tag {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.3;
  text-align: center;
}

/* Caixa do Imprevisto / Preces no Microfone (Abre junto com as Preces da Assembleia) */
.op-imprevisto-card {
  background: #141c26;
  border: 1px solid #38bdf8;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.12);
  box-sizing: border-box;
}

.op-imp-title {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
}

.op-imp-sub {
  font-size: 11.5px;
  color: #94a3b8;
}

.op-imp-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.op-imp-input {
  flex: 1;
  padding: 6px 10px;
  background: #0d1219;
  border: 1px solid #243040;
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  box-sizing: border-box;
}

.op-imp-input:focus {
  border-color: #38bdf8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.op-imp-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-top: 2px;
}

.op-imp-pills-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  margin-right: 4px;
}

.op-imp-pill {
  font-size: 11px !important;
  padding: 3px 7px !important;
  border-radius: 4px !important;
  background: #1e293b !important;
  color: #f1f5f9 !important;
  border: 1px solid #334155 !important;
  cursor: pointer;
}

.op-imp-pill:hover {
  border-color: #38bdf8 !important;
  background: #283548 !important;
}

.op-imp-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Telas de texto livre (Missa do Dia / Recados) */
.op-custom-text-card {
  background: #141c26;
  border: 1px solid #a78bfa;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(167, 139, 250, 0.12);
  box-sizing: border-box;
}

.op-custom-text-head {
  display: flex;
  align-items: center;
}

.op-custom-text-label {
  font-size: 13px;
  font-weight: 700;
  color: #a78bfa;
}

.op-custom-textarea {
  width: 100%;
  padding: 8px 10px;
  background: #0d1219;
  border: 1px solid #243040;
  border-radius: 6px;
  color: #ffffff;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.op-custom-textarea:focus {
  border-color: #a78bfa;
  outline: none;
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.25);
}

.op-custom-hint {
  font-size: 11px;
  color: #64748b;
}

/* Tela de Seleção de Playlists (Picker) */
.op-picker-screen {
  padding: 28px 36px;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.op-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid #1f2733;
  padding-bottom: 18px;
}

.op-picker-title h1 {
  font-size: 24px;
  margin: 0 0 6px 0;
  color: #f8fafc;
}

.op-picker-title p {
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
}

.op-picker-actions {
  display: flex;
  gap: 10px;
}

.op-picker-search-bar input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  background: #111720;
  border: 1px solid #1f2733;
  color: #f8fafc;
  font-size: 15px;
  box-sizing: border-box;
}

.op-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.op-playlist-card {
  background: #111720;
  border: 1px solid #1f2733;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.op-playlist-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.op-pl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.op-pl-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  background: #1e293b;
  border-radius: 4px;
  color: #38bdf8;
}

.op-pl-count {
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
}

.op-pl-name {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #f8fafc;
}

.op-pl-note {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

@media (max-width: 900px) {
  .operador-workspace {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

/* Modal de Busca de Fundos Online / Temas Litúrgicos */
.bg-picker-dialog {
  width: 92vw;
  max-width: 980px;
  max-height: 88vh;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(0,0,0,0.7);
}

.bg-picker-head {
  padding: 16px 20px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bg-picker-title h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bg-picker-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.bg-picker-body {
  padding: 16px 20px;
  overflow-y: auto;
  max-height: calc(88vh - 120px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bg-picker-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bg-picker-paste-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(56, 189, 248, 0.06);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
}

.bg-picker-paste-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 12px;
  color: #f8fafc;
  outline: none;
}

.bg-picker-paste-input::placeholder {
  color: #64748b;
}

.bg-picker-search-input {
  flex: 1;
  background: #090d16;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: #f8fafc;
}

.bg-picker-search-input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.bg-picker-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.bg-picker-pills-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 2px;
}

.bg-picker-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.bg-picker-pill-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.bg-picker-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  border-radius: 9999px 0 0 9999px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.bg-picker-pill-wrap .bg-picker-pill:last-child {
  border-radius: 9999px;
}

.bg-picker-pill:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.bg-picker-pill-x {
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
  background: #1e293b;
  border: 1px solid #334155;
  border-left: none;
  color: #64748b;
  border-radius: 0 9999px 9999px 0;
  cursor: pointer;
  transition: all 0.12s ease;
}

.bg-picker-pill-x:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border-color: #f87171;
}

.bg-picker-tabs {
  display: flex;
  border-bottom: 1px solid #334155;
  gap: 8px;
}

.bg-picker-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.bg-picker-tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.bg-picker-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.bg-picker-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 4px 8px;
}

.bg-picker-history-search {
  flex: 1;
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  padding: 6px 4px;
}

.bg-picker-history-search:hover {
  color: #38bdf8;
}

.bg-picker-history-remove {
  background: none;
  border: none;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.bg-picker-history-remove:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

.bg-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.bg-card {
  background: #162032;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.bg-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.bg-card.active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px #38bdf8;
}

.bg-card-thumb-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #0b0f17;
  overflow: hidden;
}

.bg-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.bg-card:hover .bg-card-img {
  transform: scale(1.05);
}

.bg-card-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bg-card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-card-action-btn {
  margin-top: 4px;
  width: 100%;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.bg-card-badge-current {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #0284c7;
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  z-index: 2;
}
