/* SalmodiApp
   Visual de app limpo: cartões brancos com sombra suave sobre um fundo levemente esverdeado,
   cantos arredondados, Inter em toda a interface e uma escala de verdes (trocável pela cor
   do ministério) com o claro do verde marcando o que está selecionado.
   Claro é o padrão; o modo palco escurece o fundo para pouca luz. */

:root {
  --brand: #0b7a43;        /* verde principal: ações e seleção; cada ministério troca */
  --on-brand: #ffffff;
  --brand-deep: color-mix(in oklab, var(--brand) 60%, #000);   /* verde escuro dos destaques grandes */
  --brand-soft: color-mix(in oklab, var(--brand) 10%, #fff);   /* verde claro: selecionado, chips */
  --brand-line: color-mix(in oklab, var(--brand) 28%, #fff);
  --on-brand-soft: color-mix(in oklab, var(--on-brand) 78%, var(--brand));
  --accent: #f2a900;       /* amarelo de destaque: a parte que está tocando */
  --brass: var(--accent);
  --paper: #f3f7f4;        /* fundo */
  --paper-raised: #ffffff; /* cartões, barras, diálogos */
  --ink: #0d1f16;
  --ink-soft: #5b6b62;
  --rule: #e3e9e5;
  --rule-strong: #b7c3bb;
  --pencil: var(--accent);
  --on-ink: #ffffff;
  --danger: #c62828;
  --shadow-sm: 0 1px 3px rgb(6 40 22 / 0.08), 0 1px 2px rgb(6 40 22 / 0.04);
  --shadow-card: 0 2px 12px rgb(0 0 0 / 0.06), 0 0 0 1px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 12px 40px rgb(6 40 22 / 0.14), 0 4px 12px rgb(6 40 22 / 0.06);
  --shadow-brand: 0 8px 24px color-mix(in oklab, var(--brand) 35%, transparent);

  --body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --hand: var(--body);
  --num: var(--body);

  --dw: 64px;              /* largura do desenho do acorde */
  --lyric: 1.2rem;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --measure: 980px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --dock: 150px;           /* altura do que fica fixo embaixo; o JS mede */
  color-scheme: light;
}
/* modo palco: fundo escuro para pouca luz */
:root[data-theme="dark"] {
  --paper: #0b1410;
  --paper-raised: #142019;
  --ink: #e8f0eb;
  --ink-soft: #a3b4aa;
  --rule: #24332b;
  --rule-strong: #46584e;
  --brand-soft: color-mix(in oklab, var(--brand) 30%, var(--paper-raised));
  --brand-line: color-mix(in oklab, var(--brand) 50%, var(--paper-raised));
  --shadow-card: 0 0 0 1px var(--rule);
  --on-ink: #0b1410;
  --danger: #ff8a80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--dock) + 24px);
}
::selection { background: var(--brand); color: var(--on-brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
* { scrollbar-color: var(--rule-strong) transparent; }
input, textarea { caret-color: var(--brand); }
/* `hidden` sempre esconde, mesmo em elementos com display próprio (.full, .ctl…) */
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- controles ---------- */
button, select, input, textarea { font: inherit; color: inherit; }
button, select, .button {
  min-height: 40px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}
button:hover, select:hover, .button:hover { border-color: var(--rule-strong); }
button:active, .button:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: right 16px center, right 11px center; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--paper-raised); color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=datetime-local], input[type=date], input[type=time], textarea {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 44px;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 700; box-shadow: var(--shadow-brand); }
.primary:hover { border-color: var(--brand-deep); background: color-mix(in oklab, var(--brand) 88%, #000); }
/* botões secundários: verde claro com texto verde */
.on-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.on-brand:hover { border-color: var(--brand-line); }
:root[data-theme="dark"] .on-brand { color: var(--ink); }
input[type=range] { appearance: none; background: transparent; width: 120px; height: 40px; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--rule); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; margin-top: -8px; background: var(--brand); border: 2px solid var(--paper-raised); border-radius: 50%; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--rule); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; background: var(--brand); border: 2px solid var(--paper-raised); border-radius: 50%; }
input[type=range]:disabled { opacity: 0.4; cursor: default; }
.link { background: none; border: 0; min-height: 0; padding: 4px 0; color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--brand-line); align-self: flex-start; }
.link:hover { text-decoration-color: var(--brand); }
:root[data-theme="dark"] .link { color: color-mix(in oklab, var(--brand) 45%, #fff); }

/* ---------- barra do app (feltro verde) ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  padding-top: env(safe-area-inset-top, 0px);
}
.appbar-in {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.bar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.bar-title.shown { opacity: 1; transform: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand .logo { width: 34px; height: 34px; flex: none; }
.appbar-actions { display: flex; gap: 8px; align-items: center; }
.account { font-weight: 700; }
.account.syncing { border-style: dashed; }
/* foto da conta Google ou do ministério */
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; background: var(--brand-soft); }
.account:has(.avatar) { padding: 4px 12px 4px 4px; border-radius: 999px; }

/* ---------- cabeçalho da música: um cartão com título, artista e os números da música ---------- */
.song-head { padding-top: 16px; }
.head-card { background: var(--paper-raised); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: 18px 18px 16px; }
/* o título é o seletor de músicas: tocar nele abre a lista do aparelho */
.title-picker { position: relative; display: flex; align-items: center; gap: 6px; max-width: max-content; }
.title-picker .chev { flex: none; color: var(--brand); margin-top: 4px; }
.title-picker select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; min-height: 0; padding: 0; }
.title-picker:has(select:focus-visible) { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 6px; }
.song-head h1 {
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
  text-wrap: balance;
}
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 4px; color: var(--ink-soft); font-size: 0.92rem; }
.meta .artist { color: var(--ink); font-weight: 600; }

/* os números da música: tom, capo, BPM e compasso em caixinhas verde-claras */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.tile {
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 10px 4px 8px;
  border: 0;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
}
.tile b { font: 800 1.6rem/1.1 var(--num); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile small { font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); }
:root[data-theme="dark"] .tile { color: var(--ink); }
.tile[data-off] b { opacity: 0.55; }
/* o número troca no lugar quando o valor muda */
.tile.flip b { animation: flip 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes flip {
  0% { transform: translateY(40%); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* ---------- instrumentos ---------- */
.inst { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 520px; margin-top: 16px; border-radius: 14px; background: var(--paper-raised); box-shadow: var(--shadow-card); padding: 4px; gap: 4px; }
.inst button { border: 0; border-radius: 10px; background: transparent; font-weight: 600; color: var(--ink-soft); padding-inline: 4px; }
.inst button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
:root[data-theme="dark"] .inst button[aria-pressed="true"] { color: var(--ink); }

.note { border: 0; background: var(--brand-soft); border-radius: 14px; padding: 12px 14px; margin-block: 14px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.note button { min-height: 32px; padding: 4px 12px; }
.paste-tip { color: var(--ink-soft); font-size: 0.88rem; margin: 0 0 24px; max-width: 60ch; }

/* ---------- acordes da música ---------- */
.chords { margin-top: 16px; background: var(--paper-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 6px 16px; }
.label { margin: 0; font: 700 0.95rem var(--body); letter-spacing: -0.01em; color: var(--ink); }
summary.label { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; }
summary.label::-webkit-details-marker { display: none; }
summary.label::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s ease; }
.chords[open] summary.label::before { transform: rotate(45deg); }
.chords:not([open]) { padding-bottom: 6px; }
.strip { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 22px; padding-block: 12px 10px; }
.strip .chord { --dw: 80px; }
.legend { margin: 0; padding-bottom: 12px; font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- folha ---------- */
.sheet { padding-block: 4px 30vh; }
.part { position: relative; padding-block: 18px 6px; }
.part + .part { border-top: 1px solid var(--rule); }
.final-bar { height: 6px; margin-top: 12px; border-top: 1px solid var(--rule-strong); border-bottom: 3px solid var(--rule-strong); }
/* o fio de latão marca a parte atual */
.part::after {
  content: "";
  position: absolute;
  left: calc(-1 * min(12px, var(--gutter) - 4px));
  top: 18px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--pencil);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.part.now::after { transform: scaleY(1); }
.sec { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
/* marca da parte: uma plaquinha verde com a letra */
.rmark {
  flex: none;
  min-width: 30px;
  height: 30px;
  padding-inline: 6px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font: 800 1rem/1 var(--num);
}
:root[data-theme="dark"] .rmark { color: var(--ink); }
.part.now .rmark { background: var(--brand); color: var(--on-brand); }
.sec-name { font-size: 0.95rem; font-weight: 700; color: var(--ink); }
.sec-time { margin-left: auto; font: 600 0.88rem var(--num); color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.row { display: flex; flex-wrap: wrap; align-items: flex-end; row-gap: 8px; margin-bottom: 16px; }
.row.tight { margin-bottom: 0; }
.row.tight + .blank-line { margin-bottom: 10px; }
.seg { display: flex; flex-direction: column; align-items: flex-start; }
.seg .txt { font-size: var(--lyric); line-height: 1.35; white-space: pre; min-height: 1.35em; }
.seg.has-chord .chord { margin-right: 10px; }
.chords-only { display: flex; flex-wrap: wrap; align-items: flex-end; row-gap: 8px; margin-bottom: 16px; }
/* acordes sem letra viram compassos: uma barra fina entre eles */
.chords-only .chord { padding-inline: 10px; box-sizing: content-box; }
.chords-only .chord:first-child { padding-left: 0; }
.chords-only .chord + .chord { border-left: 1px solid var(--rule); }
.blank-line { border-bottom: 2px dotted var(--rule-strong); height: 1.4em; margin-bottom: 16px; }
.lyric-only { font-size: var(--lyric); white-space: pre-wrap; margin-bottom: 16px; }
.spacer { height: 8px; }

/* ---------- desenhos ---------- */
.chord { width: var(--dw); display: block; color: var(--ink); }
[data-inst="bass"] .chord { width: calc(var(--dw) * 0.8); }
[data-inst="piano"] .chord { width: calc(var(--dw) * 1.75); }
[data-inst="staff"] .chord { width: calc(var(--dw) * 1.05); }
.chord svg { width: 100%; height: auto; display: block; overflow: visible; }
.chord .name { fill: var(--brand); font-family: var(--hand); font-weight: 800; }
:root[data-theme="dark"] .chord .name { fill: color-mix(in oklab, var(--brand) 40%, #fff); }
.chord .grid, .chord .nut, .chord .staff { stroke: currentColor; }
.chord .head, .chord .key-b, .chord .clef, .chord .acc { fill: currentColor; }
.chord .dot { fill: var(--brand); }
:root[data-theme="dark"] .chord .dot { fill: color-mix(in oklab, var(--brand) 55%, #fff); }
.chord .num { fill: #fff; font-family: var(--body); font-weight: 700; }
:root[data-theme="dark"] .chord .num { fill: #0e1511; }
.chord .mark { fill: none; stroke: currentColor; }
.chord .x, .chord .base { fill: var(--ink-soft); font-family: var(--body); }
.chord .key-w { fill: var(--paper-raised); stroke: currentColor; }
.chord .key-on { fill: var(--brand); }
.chord .finger { fill: #fff; font-family: var(--body); font-weight: 700; }
.chord .clef { font-family: "Noto Music", serif; }
.chord .acc { font-family: "Noto Music", var(--body); }

/* ---------- embaixo: próxima música, transporte e abas ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.next-up {
  align-self: center;
  width: min(calc(100% - 24px), 560px);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  background: var(--paper-raised);
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  text-decoration: none;
}
.next-pos { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font: 800 1.1rem/1 var(--num); }
:root[data-theme="dark"] .next-pos { color: var(--ink); }
.next-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.next-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-main small { color: var(--ink-soft); font-size: 0.82rem; }

.transport {
  position: relative;
  background: var(--paper-raised);
  box-shadow: 0 -1px 0 var(--rule);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px var(--gutter);
}
.transport .in { max-width: calc(var(--measure) - 32px); margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.play { flex: none; width: 52px; height: 52px; border-radius: 50%; padding: 0; background: var(--brand); color: var(--on-brand); border-color: var(--brand); box-shadow: var(--shadow-brand); }
.play:hover { border-color: var(--brand-deep); background: color-mix(in oklab, var(--brand) 88%, #000); }
.clock { font: 700 1.05rem/1.2 var(--num); font-variant-numeric: tabular-nums; min-width: 92px; white-space: nowrap; }
.clock small { display: block; font: 0.74rem var(--body); color: var(--ink-soft); white-space: nowrap; }
.progress { flex: 1 1 120px; min-width: 40px; height: 4px; border-radius: 2px; background: var(--rule); position: relative; }
.progress i { position: absolute; left: 0; top: 0; height: 4px; border-radius: 2px; width: 0; background: var(--brand); }
/* com o VS a barra vira busca: a área de toque é bem maior que o trilho */
.progress.seekable { cursor: pointer; }
.progress.seekable::before { content: ""; position: absolute; inset: -20px 0; }
.transport .in > button:not(.play) { flex: none; padding-inline: 10px; }
.ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ctl-label { font-size: 0.85rem; font-weight: 700; color: var(--ink); min-width: 92px; }
.ctl button { min-width: 40px; padding: 5px 10px; }
.ctl output, .ctl input, .ctl select { font-family: var(--num); font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ctl output { min-width: 4ch; text-align: center; }
.ctl input[type=text] { width: 4.8em; text-align: center; padding: 7px 6px; }
/* Ajustes: uma folha que sobe acima do transporte */
.extra {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  max-height: min(64vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) 18px var(--gutter);
  background: var(--paper-raised);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
}
.extra > * { width: 100%; max-width: var(--measure); margin-inline: auto; }
.extra > button { justify-content: flex-start; width: auto; margin-inline: 0; }
.transport.open .extra { display: flex; }
#moreBtn[aria-expanded="true"], .transport button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--paper-raised);
  box-shadow: 0 -1px 0 var(--rule);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar a, .tabbar button {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 0;
}
.tabbar [aria-current="page"] { color: var(--brand); }
:root[data-theme="dark"] .tabbar [aria-current="page"] { color: color-mix(in oklab, var(--brand) 45%, #fff); }
.tabbar [aria-current="page"] svg { background: var(--brand-soft); border-radius: 999px; padding: 2px 12px; box-sizing: content-box; }

/* ---------- metrônomo ---------- */
.beats { display: inline-flex; align-items: center; gap: 5px; }
.beats i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--ink-soft); }
.beats i.downbeat { width: 9px; height: 9px; border-color: currentColor; }
.beats i.now { background: var(--brass); border-color: var(--brass); }
.metro-btn { gap: 8px; }
.metro-btn .bpm, #vsCount { font: 600 1rem var(--num); font-variant-numeric: tabular-nums; }
.metro-btn[aria-pressed="true"] .beats i:not(.now) { border-color: var(--on-brand); }
.ctl #bpm { width: 3.6em; }
.vs-btn { font-weight: 700; letter-spacing: 0.04em; }

/* ---------- VS (faixas) ---------- */
.vs-dlg .dlg-body { max-height: calc(100dvh - 34px); }
.vs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vs-dlg .status:empty { display: none; }
.vs-tracks { list-style: none; margin: 0; padding: 0; min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--rule); }
.vs-tracks:empty { display: none; }
.vs-track { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.vs-name { width: 100%; font-weight: 700; }
.vs-ctl { display: flex; align-items: center; gap: 8px; }
.vs-toggle { min-width: 44px; padding: 5px 10px; font: 700 1rem var(--num); }
.vs-toggle[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.vs-volume { flex: 1 1 auto; min-width: 60px; width: auto; }
.vs-msg { font-size: 0.85rem; color: var(--ink-soft); }
.vs-msg:empty { display: none; }
.vs-msg.bad { color: var(--danger); }
.vs-track[data-state="failed"] .vs-name { color: var(--ink-soft); }
.vs-cloud { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--paper); }
.vs-cloud:empty { display: none; }
.vs-cloud-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vs-cloud-title { margin: 0; font-size: 0.95rem; font-weight: 700; }
.vs-cloud-row { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.vs-cloud-row + .vs-cloud-row { border-top: 1px solid var(--rule); padding-top: 10px; }
.vs-cloud .toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.vs-cloud .toggles button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); font-weight: 700; }

/* ---------- diálogos: folha que sobe no celular, janela no computador ---------- */
dialog {
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--paper-raised);
  color: var(--ink);
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgb(6 20 13 / 0.5); }
dialog[open] { animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog form, .dlg-body { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
dialog h2 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
dialog p { margin: 0; }
.sheet-dlg { width: min(480px, calc(100vw - 32px)); }
.vs-dlg { width: min(560px, calc(100vw - 32px)); }
.fields { display: grid; grid-template-columns: 1fr 1fr 110px; gap: 12px; }
.fields > div, .full { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fields label, .full label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
textarea { font: 0.9rem/1.45 ui-monospace, "SF Mono", Menlo, monospace; min-height: 42vh; resize: vertical; white-space: pre; overflow: auto; }
.status { font-weight: 700; font-size: 0.92rem; }
.status.bad { color: var(--danger); }
.status:empty { display: none; }
.help { font-size: 0.9rem; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; border-top: 1px solid var(--rule); padding-top: 14px; }
.actions .r { display: flex; gap: 8px; }
.danger { color: var(--danger); }
.danger.armed { background: var(--danger); color: #fff; border-color: var(--danger); }
.backup-row { display: flex; flex-wrap: wrap; gap: 8px; }

.provider { width: 100%; padding: 11px 14px; font-weight: 700; margin-top: 4px; min-height: 48px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 0.82rem; margin: 6px 0 2px !important; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); border-radius: 14px; padding: 4px; gap: 4px; }
.auth-tabs button { border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft); font-weight: 600; }
.auth-tabs button[aria-pressed="true"] { background: var(--paper-raised); color: var(--brand); font-weight: 700; box-shadow: var(--shadow-sm); }
.auth-form { gap: 12px; padding: 0 !important; }
.auth-form input { width: 100%; }
.auth-form .primary { padding: 11px 14px; min-height: 48px; }
.auth-form .status:empty, .auth-form .help:empty { display: none; }
#signedOut { display: flex; flex-direction: column; gap: 12px; }
#signedOut[hidden] { display: none; }

/* ---------- rodapé ---------- */
.site-footer { max-width: var(--measure); margin: 24px auto 0; padding: 16px var(--gutter) 8px; text-align: center; font-size: 0.82rem; color: var(--ink-soft); }
.site-footer p { margin: 0; }
.site-footer a { color: inherit; font-weight: 600; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--brand); }

/* ---------- tamanhos ---------- */
@media (min-width: 900px) {
  :root { --dw: 76px; --lyric: 1.4rem; }
  .tabbar { grid-template-columns: repeat(4, 140px); justify-content: center; }
}
@media (max-width: 560px) {
  .song-head h1 { font-size: 1.75rem; }
  /* quatro desenhos por linha cabem numa tela de 390 px */
  :root { --dw: 52px; }
  .seg.has-chord .chord { margin-right: 6px; }
  .chords-only .chord { padding-inline: 7px; }
  .board { margin-top: 14px; gap: 6px; }
  .tile b { font-size: 1.4rem; }
  .fields { grid-template-columns: 1fr; }
  .appbar-actions .lbl, #moreBtn .lbl { display: none; }
  .appbar-actions { gap: 6px; }
  .appbar-actions button { padding-inline: 10px; min-width: 44px; }
  .clock { flex: none; min-width: 0; font-size: 1.1rem; }
  .metro-btn .bpm { display: none; }
  .vs-btn { display: none; }
  :root { --lyric: 1.1rem; }
  .ctl-label { min-width: 100%; }
  /* no celular os diálogos sobem de baixo, como folhas */
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92dvh; }
  dialog form, .dlg-body { padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 420px) {
  .brand span { display: none; }
}
@media (pointer: coarse) {
  button, select, .button, .ctl input[type=text], .vs-name { min-height: 44px; }
  input[type=range] { height: 44px; }
  .ctl button { min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
