/* =================== site: páginas, cartões, ferramentas =================== */
a { color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--text); text-decoration: none;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.big { padding: 10px 18px; border-radius: 10px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.card h2 { margin-top: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); }
.badge b { color: var(--text); }
.note-box { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; }
.small-print { font-size: 0.8rem; margin-top: 24px; }
code { background: var(--line-bg); padding: 1px 5px; border-radius: 4px; }

.site-header {
  display: flex; align-items: center; gap: 22px;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand img { border-radius: 7px; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a, .account-link { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 0.92rem; }
.main-nav a:hover, .account-link:hover { color: var(--text); background: var(--line-bg); }
.main-nav a.on, .account-link.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.account-link { margin-left: auto; }
.bottom-nav { display: none; }

.page { max-width: 1100px; margin: 0 auto; padding: 20px 20px 60px; }
.page.narrow { max-width: 760px; }
#view-page > section { max-width: 1100px; margin: 0 auto 30px; padding: 0 20px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sec-head a { font-weight: 600; text-decoration: none; }

/* ---------- início ---------- */
#view-page > .hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; align-items: center;
  margin-bottom: 26px; padding-top: 40px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.05; margin: 0 0 14px; letter-spacing: -0.02em; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 520px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-art { position: relative; background: linear-gradient(160deg, #1d2a2a, #10181a); border-radius: 20px; padding: 22px; min-height: 230px; overflow: hidden; box-shadow: 0 20px 50px rgb(0 0 0 / 0.25); }
.ha-lane { display: flex; gap: 8px; }
.ha-lane .lane-chip { color: #cbd5d1; border-color: #3a4446; }
.ha-lane .lane-chip.playing { color: #fff; }
.ha-hit { position: absolute; right: 22px; top: 18px; background: #16a34a; color: #fff; font-weight: 800; border-radius: 999px; padding: 4px 14px; animation: haPulse 2.4s ease-in-out infinite; }
@keyframes haPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.ha-neck { position: absolute; left: 22px; right: 0; bottom: 24px; height: 110px; border-radius: 6px 0 0 6px; background: linear-gradient(#3f2717, #4b2f1c 50%, #3f2717); border-left: 7px solid #efe6d6; }
.ha-neck i { position: absolute; left: 0; right: 0; height: 2px; background: #d9cfbd; }
.ha-neck b { position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 0.8rem; box-shadow: 0 2px 4px rgb(0 0 0 / 0.5); }

#view-page > .stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stats strong { display: block; font-size: 1.4rem; }
.stats span { color: var(--muted); font-size: 0.8rem; }

.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.song-card {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); text-decoration: none; transition: transform 120ms, border-color 120ms;
}
.song-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.sc-icon { font-size: 1.6rem; }
.sc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sc-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.tag { font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; background: var(--line-bg); color: var(--muted); border: 1px solid var(--border); }
.tag.lvl1 { color: #16a34a; }
.tag.lvl2 { color: #d97706; }
.tag.lvl3 { color: #dc2626; }
.tag.tabtag { color: var(--chord); }
.tag.mine { color: var(--accent); }
.tag.ok { color: #16a34a; font-weight: 700; }
.fav { border: none; background: none; font-size: 1.3rem; color: var(--muted); padding: 4px; }
.fav.on, .fav-big.on { color: #f59e0b; }
.fav-big { font-size: 1.3rem; padding: 4px 12px; }

.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.genre-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 14px; text-decoration: none; color: #fff; min-height: 104px; justify-content: flex-end; position: relative; overflow: hidden; }
.genre-card span { position: absolute; right: 10px; top: 6px; font-size: 2.4rem; opacity: 0.9; }
.genre-card small { opacity: 0.85; }
.g-rock { background: linear-gradient(135deg, #7f1d1d, #dc2626); }
.g-pop { background: linear-gradient(135deg, #831843, #ec4899); }
.g-mpb { background: linear-gradient(135deg, #065f46, #10b981); }
.g-sertanejo { background: linear-gradient(135deg, #78350f, #d97706); }
.g-folk { background: linear-gradient(135deg, #3f6212, #84cc16); }
.g-infantil { background: linear-gradient(135deg, #1e3a8a, #3b82f6); }
.g-gospel { background: linear-gradient(135deg, #4c1d95, #8b5cf6); }
.g-exercicios { background: linear-gradient(135deg, #134e4a, #14b8a6); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tool-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; text-decoration: none; color: var(--text); }
.tool-card span { font-size: 1.8rem; }
.tool-card small { color: var(--muted); }

/* ---------- catálogo ---------- */
.search { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 1rem; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chips button { border-radius: 999px; padding: 6px 14px; }
.chips.small button { padding: 3px 11px; font-size: 0.85rem; }
.chips button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chips .sep { width: 1px; background: var(--border); margin: 0 4px; }

/* ---------- página da música ---------- */
.back { display: inline-block; margin: 6px 0 0; text-decoration: none; font-weight: 600; }
.song-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.song-head h1 { margin-bottom: 2px; }
.song-head .artist { margin-bottom: 8px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.song-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.strum-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.strum-pattern { display: flex; gap: 4px; }
.beat { display: flex; flex-direction: column; align-items: center; width: 34px; padding: 4px 0; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 1.2rem; font-weight: 800; color: var(--chord); }
.beat small { font-size: 0.6rem; color: var(--muted); font-weight: 600; }
.beat.off { opacity: 0.8; }
.beat.now { background: var(--accent); color: var(--accent-text); transform: scale(1.08); }

/* ---------- tablatura ---------- */
pre.tab { margin: 6px 0; font-size: 0.9em; line-height: 1.3; overflow-x: auto; }
.tab-line { white-space: pre; }
.tab-labels { white-space: pre; color: var(--muted); font-weight: 700; font-style: italic; }
.tn { color: var(--chord); font-weight: 800; cursor: pointer; border-radius: 3px; }
.tn.done { opacity: 0.4; }
.tn.current { background: var(--chord); color: var(--surface); }
.tn.waiting { outline: 2px dashed var(--accent); }
.tn.next { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.lane-chip.note { min-width: 44px; }
.lane-chip.note small { display: block; font-size: 0.55rem; margin: 0; }
.lane-chip.s0 { border-color: #ef4444; }
.lane-chip.s1 { border-color: #f59e0b; }
.lane-chip.s2 { border-color: #eab308; }
.lane-chip.s3 { border-color: #22c55e; }
.lane-chip.s4 { border-color: #3b82f6; }
.lane-chip.s5 { border-color: #a855f7; }
.gv-target { animation: beckonDot 0.8s ease-in-out infinite alternate; }
@keyframes beckonDot { to { fill: #f97316; } }
.gv-ghost { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; opacity: 0.7; }
.gv-ghost + text { display: none; }
.gv-ripple { fill: none; stroke: #fff; stroke-width: 3; animation: ripple 0.5s ease-out forwards; pointer-events: none; }
@keyframes ripple { from { r: 8; opacity: 1; } to { r: 26; opacity: 0; } }
.dock.has-tab .guitar::after { content: "toque nas cordas para tocar notas"; display: block; text-align: center; font-size: 0.72rem; color: var(--muted); }

/* ---------- afinador ---------- */
.tuner { text-align: center; }
.tuner-note { font-size: 5rem; font-weight: 800; line-height: 1; margin: 10px 0; color: var(--chord); transition: color 200ms; }
.tuner-note.ok { color: #16a34a; }
.tuner-meter { max-width: 420px; margin: 0 auto 12px; }
.tuner-scale { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }
.tuner-track { position: relative; height: 34px; background: linear-gradient(90deg, #dc2626, #f59e0b 35%, #16a34a 47%, #16a34a 53%, #f59e0b 65%, #dc2626); border-radius: 8px; opacity: 0.85; }
.tuner-center { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.tuner-needle { position: absolute; left: 50%; top: -8px; bottom: -8px; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--text); box-shadow: 0 0 8px rgb(0 0 0 / 0.4); transition: left 120ms; }
.tuner-info { min-height: 1.5em; margin-bottom: 14px; }
.ok { color: #16a34a; }
.tuner-strings { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.string-btn { display: flex; flex-direction: column; align-items: center; padding: 12px 4px; border-radius: 12px; }
.string-btn b { font-size: 1.4rem; }
.string-btn small { color: var(--muted); font-size: 0.7rem; }

/* ---------- treino ---------- */
.drill-setup { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; justify-content: center; }
.drill-setup label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 0.85rem; }
.drill-setup select { width: auto; }
.drill-swap { font-size: 1.5rem; padding-bottom: 6px; }
.drill-stage { display: flex; align-items: center; justify-content: center; gap: 30px; flex-wrap: wrap; margin: 20px 0; }
.drill-target { text-align: center; min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.chord-name.big { font-size: 2.6rem; }
.drill-stats { display: flex; gap: 20px; }
.drill-stats div { display: flex; flex-direction: column; align-items: center; }
.drill-stats strong { font-size: 2.2rem; font-variant-numeric: tabular-nums; }
.drill-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.drill-pads { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.drill-pads .dock-chord { min-width: 120px; padding: 22px; font-size: 1.6rem; }
.drill-result { font-size: 1.3rem; }
.drill-result b { font-size: 3rem; color: var(--accent); }
.records { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- importar / conta ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 10px; }
.form-grid label, .form-stack label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 0.85rem; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.page input:not([type=range]):not([type=file]):not([type=search]), .page select, .page textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px; color: var(--text); width: 100%;
}
.page textarea { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.progress { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; margin: 12px 0; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width 150ms; }
#auPlayer { width: 100%; margin: 12px 0; }
.au-now { display: flex; align-items: center; justify-content: space-around; gap: 12px; margin-bottom: 12px; text-align: center; }
.au-timeline { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; margin-bottom: 12px; }
.au-chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; padding: 6px 10px; border-radius: 10px; }
.au-chip b { color: var(--chord); }
.au-chip small { color: var(--muted); font-size: 0.7rem; }
.au-chip.now { background: var(--accent); border-color: var(--accent); }
.au-chip.now b, .au-chip.now small { color: var(--accent-text); }

dialog .form-grid select, dialog .form-grid input { width: 100%; }
dialog select { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px; color: var(--text); }

/* ---------- página da música: barra lateral de ajustes ---------- */
.player-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; max-width: 1240px; margin: 0 auto; padding: 0 16px; align-items: start; }
.player-layout .song { max-width: none; margin: 0; padding: 16px 0; }
.song-side { position: sticky; top: 76px; margin-top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 92px); overflow-y: auto; padding-bottom: 8px; scrollbar-width: thin; }
.side-top { display: none; }
.side-actions { display: flex; justify-content: space-between; gap: 6px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: 1.05rem; padding: 0; }
.icon-btn:hover { border-color: var(--accent); }
.side-group { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.side-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); min-height: 52px; }
.side-group > :last-child { border-bottom: none; }
.side-row .si { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--line-bg); font-size: 0.9rem; }
.side-row .sl { flex: 1; font-weight: 600; font-size: 0.92rem; display: flex; flex-direction: column; line-height: 1.2; }
.side-row .sl small { color: var(--muted); font-weight: 400; font-size: 0.76rem; }
.side-sub { display: flex; align-items: center; gap: 8px; padding: 0 14px 12px; border-bottom: 1px solid var(--border); margin-top: -4px; }
.side-sub input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.side-sub .label { font-size: 0.68rem; }
.sv-btn { padding: 5px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.sv-btn.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); outline: none; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 32px; height: 32px; padding: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.stepper span { min-width: 42px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
#capoSelect { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 5px 6px; color: var(--text); font-size: 0.85rem; max-width: 130px; }
.side-row .segmented.small button { padding: 4px 8px; font-size: 0.78rem; }
#sideModeRow { flex-wrap: wrap; }

/* interruptor liga/desliga */
.switch-row { cursor: pointer; }
.switch { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--border); position: relative; cursor: pointer; transition: background 150ms; flex: 0 0 auto; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 150ms; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

/* o que o usuário escondeu */
body.hide-diagrams #chordsSection { display: none; }
body.hide-tabs #sheet .row.tab { display: none; }
body.hide-strum #strumBox { display: none !important; }
@media (min-width: 1001px) { #modeBox { display: none !important; } } /* no computador fica na barra lateral */

/* afinador por cima da música */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.55); display: grid; place-items: center; padding: 16px; }
.overlay[hidden] { display: none; }
.overlay-card { position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 18px; }
.overlay-card .page { padding: 18px 18px 22px; }
.overlay-close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.side-backdrop { display: none; }

@media (max-width: 1000px) {
  /* no celular/tablet a barra vira uma gaveta que abre pelo ⚙ */
  .player-layout { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .player-layout .song { padding: 8px 12px; }
  .song-side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 25; width: min(340px, 88vw);
    margin: 0; max-height: none; padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    background: var(--bg); border-right: 1px solid var(--border); box-shadow: 10px 0 30px rgb(0 0 0 / 0.35);
    transform: translateX(-105%); transition: transform 220ms ease;
  }
  body.side-open .song-side { transform: none; }
  body.side-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 24; background: rgb(0 0 0 / 0.45); }
  .side-top { display: flex; justify-content: space-between; align-items: center; font-size: 1.05rem; }
  .modes .settings-toggle { display: inline-block; }
}
@media (min-width: 1001px) { .modes .settings-toggle { display: none !important; } }

/* imprimir: só a música */
@media print {
  .site-header, .toolbar, .status, .song-side, .dock, .bottom-nav, .back, .song-actions, .parts-box, .mode-box, .end-spacer, .chord-tip, .variation, .note-box { display: none !important; }
  body, .song { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .player-layout { display: block; padding: 0; }
  .ch, .tn, .chord-name { color: #b45309 !important; }
  .row.skip { opacity: 1; }
  .chord-card { border-color: #ccc; break-inside: avoid; }
}

/* ---------- tocar com acordes / tablatura ---------- */
.mode-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: none; background: none; border-radius: 8px; padding: 6px 14px; font-weight: 600; color: var(--muted); }
.segmented button.on { background: var(--accent); color: var(--accent-text); }
.segmented.small button { padding: 4px 10px; }
.mode-hint { font-size: 0.8rem; }
.row.skip { opacity: 0.32; }
.row.skip .ch, .row.skip .tn { cursor: pointer; }
.row.skip:hover { opacity: 0.6; }
#partsBar button.off { opacity: 0.5; border-style: dashed; }

/* ---------- partes da música ---------- */
.parts-box { margin: 0 0 18px; }
.parts-box .chips { margin-top: 6px; }
.row.section.playable { cursor: pointer; }
.row.section.playable:hover { color: var(--accent); }
.row.section.playable::after { content: " ▶"; font-size: 0.8em; opacity: 0.5; }
.dock-parts { display: flex; gap: 8px; align-items: center; max-width: 760px; margin: 4px auto 0; }
.dock-parts:has(select[hidden]) { display: none; }
.dock-parts select { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; color: var(--text); }
#btnLoop { padding: 5px 12px; white-space: nowrap; }
#btnLoop.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.invite-link { width: 100%; margin-top: 12px; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.invite-list { padding-left: 18px; }
.invite-list li { margin: 4px 0; }

/* =================== layout das páginas (início, músicas, repertório) =================== */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0 0 2px; font-size: 1.9rem; letter-spacing: -0.01em; }
.page-head p { margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.block { margin-bottom: 30px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.block-head h2 { margin: 0; font-size: 1.2rem; }
.block-head a { font-size: 0.88rem; font-weight: 600; text-decoration: none; }
.link-btn { border: none; background: none; color: var(--accent); padding: 4px 0; font-weight: 600; }

/* lista de músicas */
.song-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.song-row {
  display: grid; grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 0.9fr) minmax(0, 1.6fr) 64px 36px;
  align-items: center; gap: 14px; padding: 10px 14px; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border); transition: background 120ms;
}
.song-row:last-child { border-bottom: none; }
.song-row:hover { background: var(--line-bg); }
.sr-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.35rem; }
.sr-main { display: flex; flex-direction: column; min-width: 0; }
.sr-main b, .sr-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-main small { color: var(--muted); }
.sr-genre { color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.sr-score { text-align: right; }
.score-pill { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, #16a34a 15%, transparent); color: #16a34a; white-space: nowrap; }
.score-pill.top { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #d97706; }

/* estado vazio */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: 14px; }
.empty > span { font-size: 2.4rem; }
.empty p { color: var(--muted); margin: 0 0 8px; max-width: 420px; }

/* início */
.page.home { max-width: 1180px; }
.home-hero {
  border-radius: 20px; padding: 34px 34px 28px; margin-bottom: 28px; color: #fff;
  background: radial-gradient(circle at 85% 20%, rgb(255 255 255 / 0.12), transparent 40%), linear-gradient(135deg, #0f766e, #134e4a 55%, #1e293b);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.18);
}
.hh-hello { margin: 0 0 4px; opacity: 0.9; }
.home-hero h1 { margin: 0 0 6px; font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -0.02em; }
.hh-sub { margin: 0 0 18px; opacity: 0.85; max-width: 560px; }
.hh-search { display: flex; gap: 8px; max-width: 620px; }
.hh-search input { flex: 1; min-width: 0; padding: 13px 16px; border-radius: 12px; border: none; font-size: 1rem; background: #fff; color: #111; }
.hh-search button { padding: 0 20px; border-radius: 12px; border: none; background: #fbbf24; color: #1f1d1a; font-weight: 700; }
.hh-genres { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pill-link { color: #fff; text-decoration: none; font-size: 0.85rem; padding: 4px 11px; border-radius: 999px; background: rgb(255 255 255 / 0.12); border: 1px solid rgb(255 255 255 / 0.18); }
.pill-link:hover { background: rgb(255 255 255 / 0.22); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.home-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; }
.panel h3 { margin: 0 0 12px; font-size: 1rem; }
.streak { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.streak-n { font-size: 1.9rem; font-weight: 800; }
.streak span:last-child { display: flex; flex-direction: column; font-weight: 600; }
.streak small { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 74px; margin-bottom: 14px; }
.wk { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.wk i { width: 100%; max-width: 22px; border-radius: 5px 5px 2px 2px; background: var(--border); }
.wk i.on { background: var(--accent); }
.wk small { font-size: 0.65rem; color: var(--muted); }
.wk.today small { color: var(--accent); font-weight: 800; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; border-top: 1px solid var(--border); padding-top: 12px; }
.mini-stats b { display: block; font-size: 1.1rem; }
.mini-stats small { color: var(--muted); font-size: 0.7rem; }
.tool-list { display: flex; flex-direction: column; }
.tool-list a { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 9px 6px; border-radius: 10px; text-decoration: none; color: var(--text); }
.tool-list a:hover { background: var(--line-bg); }
.tool-list span { grid-row: span 2; font-size: 1.4rem; align-self: center; }
.tool-list small { color: var(--muted); font-size: 0.8rem; }
.panel.tip p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.song-tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--text); transition: transform 120ms, border-color 120ms; }
.song-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.st-cover { height: 78px; display: grid; place-items: center; font-size: 2.2rem; }
.st-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; min-width: 0; }
.st-body b, .st-body small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-body small { color: var(--muted); }
.st-progress { height: 5px; background: var(--border); border-radius: 3px; margin: 8px 0 6px; overflow: hidden; }
.st-progress i { display: block; height: 100%; background: var(--accent); }
.st-foot { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--muted); }
.st-play { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-size: 0.7rem; }
.genre-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.genre-card { min-height: 92px; }

/* catálogo */
.cat-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.cat-filters { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; }
.cat-filters .search { margin-bottom: 14px; }
.f-group { margin-bottom: 14px; }
.f-group h4 { margin: 0 0 6px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.f-list { display: flex; flex-direction: column; gap: 1px; }
.f-list button { display: flex; justify-content: space-between; align-items: center; border: none; background: none; padding: 6px 8px; border-radius: 8px; text-align: left; color: var(--text); }
.f-list button:hover { background: var(--line-bg); }
.f-list button.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 700; }
.f-list small { color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.sort { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.85rem; }
.sort select { width: auto !important; }

/* repertório */
.segmented.tabs { margin-bottom: 16px; }
.segmented.tabs button { padding: 8px 16px; }
.segmented.tabs small { opacity: 0.75; margin-left: 4px; }

/* artistas */
.az { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.az a { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-weight: 700; font-size: 0.85rem; }
.artist-card { flex-direction: row !important; align-items: center; gap: 12px; }
.artist-card span:last-child { display: flex; flex-direction: column; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: color-mix(in srgb, var(--accent) 20%, var(--surface)); color: var(--accent); flex: 0 0 auto; }
.artist-group { scroll-margin-top: 16px; }

@media (max-width: 1000px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .panel.tip { grid-column: span 2; }
  .song-row { grid-template-columns: 44px minmax(0, 1.6fr) minmax(0, 1fr) 50px 30px; gap: 10px; }
  .sr-genre { display: none; }
  .cat-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 16px; }
}
.f-list button.on, .segmented button.on, .chips button.on, #partsBar button.on { outline: none; }

/* ---------- busca no topo ---------- */
.header-search { flex: 1 1 200px; min-width: 170px; max-width: 380px; margin-left: auto; }
.site-header { flex-wrap: wrap; row-gap: 8px; }
.header-search input { width: 100%; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.95rem; }
.header-search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
.header-search + .search-toggle + .account-link { margin-left: 0; }
.search-toggle { display: none; border: none; background: none; font-size: 1.2rem; padding: 4px 8px; margin-left: auto; }
body.locked .header-search, body.locked .search-toggle { display: none !important; }
.artist-hits { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.badge.artist { text-decoration: none; color: var(--text); }
.badge.artist:hover { border-color: var(--accent); }
.artist-group h2 { font-size: 1.1rem; margin: 18px 0 8px; color: var(--accent); }
.artist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.artist-card { display: flex; flex-direction: column; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); }
.artist-card:hover { border-color: var(--accent); }
.artist-card small { color: var(--muted); }

/* ---------- editor de cifra ---------- */
.page.editor { max-width: 1300px; padding-bottom: 110px; }
.ed-meta { padding: 14px 16px; }
.ed-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px 12px; }
.ed-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.ed-grid label.wide { grid-column: span 3; }
.ed-grid input, .ed-grid select { font-size: 1rem; padding: 9px 10px !important; }
.strum-view { color: var(--chord); font-weight: 800; letter-spacing: 2px; min-height: 1.2em; }
.ed-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
.ed-tools select { width: auto !important; }
.ed-sep { width: 1px; height: 24px; background: var(--border); }
.ed-help { position: relative; }
.ed-help summary { cursor: pointer; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); list-style: none; }
.ed-help[open] div { position: absolute; z-index: 5; top: 110%; left: 0; width: min(420px, 85vw); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.3); font-size: 0.9rem; }
.ed-help pre { background: var(--bg); padding: 8px; border-radius: 8px; }
.ed-switch { display: none; }
.ed-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ed-pane { min-width: 0; }
.ed-write textarea {
  width: 100%; height: 65vh; min-height: 360px; resize: vertical;
  font: 15px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace !important;
  padding: 14px !important; border-radius: 12px !important; white-space: pre; overflow: auto; tab-size: 4;
}
.ed-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; height: 65vh; min-height: 360px; overflow: auto; padding: 12px 14px; }
.ed-preview-head { font-size: 0.78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.ed-preview .sheet { font-size: 15px; }
.ed-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; gap: 10px; align-items: center; justify-content: flex-end;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--border);
}
.ed-footer .muted { margin-right: auto; }

/* ---------- login ---------- */
body.locked .main-nav, body.locked .bottom-nav, body.locked .account-link { display: none !important; }
body.locked { padding-bottom: 0 !important; }
.login-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 20px 16px; }
.login-card { width: min(380px, 100%); text-align: center; padding: 28px 24px; }
.login-card img { border-radius: 16px; }
.login-card h1 { margin: 10px 0 2px; }
.login-card .form-stack { text-align: left; margin-top: 18px; }
.login-card input { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; color: var(--text); font-size: 1rem; }
.login-card button { width: 100%; justify-content: center; }
.bad { color: #dc2626; }

/* =================== celular =================== */
@media (max-width: 700px) {
  .site-header { padding: 8px 12px; }
  .main-nav { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 0.68rem; color: var(--muted); text-decoration: none; padding: 4px 0; font-weight: 600; }
  .bottom-nav a span { font-size: 1.25rem; }
  .bottom-nav a.on { color: var(--accent); }
  body { padding-bottom: 64px; }
  body.has-dock .bottom-nav { display: none; }
  body.has-dock { padding-bottom: 0; }

  .page { padding: 14px 12px 40px; }
  #view-page > section { padding: 0 12px; }
  #view-page > .hero { grid-template-columns: 1fr; padding-top: 22px; gap: 16px; }
  .hero-art { min-height: 190px; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  #view-page > .stats { grid-template-columns: repeat(3, 1fr); }
  .stats > div:nth-child(n+4) { display: none; }
  .stats strong { font-size: 1.15rem; }
  .song-grid { grid-template-columns: 1fr; }
  .genre-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .chips button { flex: 0 0 auto; }
  .song-actions { margin-top: 0; }
  .tuner-strings { grid-template-columns: repeat(3, 1fr); }
  .tuner-note { font-size: 4rem; }
  .drill-stats strong { font-size: 1.7rem; }
  .modes #btnMetro { flex: 0 0 auto; padding: 9px 10px; }

  /* páginas no celular */
  .page-head h1 { font-size: 1.5rem; }
  .head-actions .btn { padding: 6px 10px; font-size: 0.85rem; }
  .home-hero { padding: 22px 18px 18px; border-radius: 16px; }
  .hh-sub { font-size: 0.9rem; }
  .hh-genres { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .pill-link { flex: 0 0 auto; }
  .home-side { grid-template-columns: 1fr; }
  .panel.tip { grid-column: auto; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .song-row { grid-template-columns: 40px minmax(0, 1fr) auto 30px; gap: 10px; padding: 9px 10px; }
  .sr-icon { width: 40px; height: 40px; }
  .sr-tags { display: none; }
  .cat-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .cat-filters { position: static; padding: 10px; min-width: 0; }
  .cat-results { min-width: 0; }
  .f-group { margin-bottom: 8px; }
  .f-group h4 { display: none; }
  .f-list { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .f-list button { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; gap: 6px; }
  .segmented.tabs { display: flex; }
  .segmented.tabs button { flex: 1; padding: 8px 6px; font-size: 0.85rem; }

  /* busca: ícone que abre o campo embaixo do cabeçalho */
  .site-header { flex-wrap: wrap; gap: 8px; }
  .search-toggle { display: block; }
  .header-search { display: none; order: 10; flex: 1 1 100%; max-width: none; margin: 0; }
  body.search-open .header-search { display: block; }
  .account-link { margin-left: 0; }

  /* editor: campos em 2 colunas e abas Escrever / Ver como fica */
  .ed-grid { grid-template-columns: 1fr 1fr; }
  .ed-grid label.wide { grid-column: span 2; }
  .ed-switch { display: flex; gap: 6px; margin-bottom: 8px; }
  .ed-switch button { flex: 1; }
  .ed-switch button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
  .ed-split { grid-template-columns: 1fr; }
  .ed-split .ed-preview { display: none; }
  .ed-split[data-show="preview"] .ed-preview { display: block; }
  .ed-split[data-show="preview"] .ed-write { display: none; }
  .ed-write textarea, .ed-preview { height: 58vh; }
  .ed-write textarea { font-size: 14px !important; }
  .ed-footer { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  body:has(.page.editor) .bottom-nav { display: none; }
}
