:root {
    --bg:      #060612;
    --bg2:     #0d0d1e;
    --panel:   #0f0f1e;
    --panel-2: #141428;
    --text:    #f0f0ff;
    --muted:   #7878a0;
    --primary: #00d4c8;
    --primary-soft: rgba(0,212,200,0.12);
    --purple:  #9b6dff;
    --success: #00d4c8;
    --danger:  #fb7185;
    --warning: #facc15;
    --border:  rgba(255,255,255,0.08);
    --border-hover: rgba(0,212,200,0.35);
    --code:    #05050f;
    --radius:  16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    padding-top: 62px; /* nav height */
}

/* ── App Nav ──────────────────────────────────────────────────── */
.app-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    height: 62px;
    padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(6,6,18,0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.app-nav-logo {
    display: flex; align-items: center; gap: 6px;
    text-decoration: none;
}
.app-nav-logo img { height: 30px; }
.app-nav-logo img.flip { transform: scaleX(-1); }
.app-nav-logo-text {
    font-size: 18px; font-weight: 900; letter-spacing: -0.5px;
    color: var(--text); line-height: 1;
}
.app-nav-logo-text em { font-style: normal; color: var(--primary); }
.app-nav-right { display: flex; align-items: center; gap: 12px; }

/* ── Botões de contribuição na nav ───────────────────────────────── */
.app-nav-contrib { display: flex; align-items: center; gap: 6px; }
.contrib-nav-btn {
    padding: 5px 11px; border-radius: 7px; font-size: 0.74rem; font-weight: 700;
    text-decoration: none; border: 1px solid var(--border);
    transition: all 0.18s; white-space: nowrap;
}
.contrib-nav-btn.new      { color: var(--purple); border-color: rgba(155,109,255,0.3); background: rgba(155,109,255,0.07); }
.contrib-nav-btn.new:hover{ background: rgba(155,109,255,0.18); }
.contrib-nav-btn.edit     { color: var(--primary); border-color: rgba(0,212,200,0.3); background: rgba(0,212,200,0.07); }
.contrib-nav-btn.edit:hover{ background: rgba(0,212,200,0.18); }
.contrib-nav-btn.validate { color: #facc15; border-color: rgba(250,204,21,0.3); background: rgba(250,204,21,0.07); }
.contrib-nav-btn.validate:hover{ background: rgba(250,204,21,0.15); }
@media (max-width: 900px) { .app-nav-contrib { display: none; } }

/* ── App shell ────────────────────────────────────────────────── */
.app { width: min(1320px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 3.5vw, 44px); letter-spacing: -1px; font-weight: 900; }
.hero-accent { color: var(--primary); }
.hero p { margin: 0; color: var(--muted); max-width: 820px; line-height: 1.6; font-size: 15px; }

/* ── API Status ───────────────────────────────────────────────── */
.api-status {
    white-space: nowrap;
    border: 1px solid var(--border);
    background: rgba(15,15,30,0.85);
    border-radius: 999px; padding: 7px 14px;
    color: var(--muted); font-size: 13px; font-weight: 700;
}
.api-status.ok { color: var(--success); border-color: rgba(0,212,200,0.25); }
.api-status.fail { color: var(--danger); border-color: rgba(251,113,133,0.25); }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    padding: 10px 18px; border-radius: 999px;
    cursor: pointer; font-weight: 800; font-size: 14px;
    transition: all 0.2s;
}
.tab:hover { border-color: var(--border-hover); color: var(--primary); }
.tab.active {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff; border-color: transparent;
    box-shadow: 0 0 18px rgba(0,212,200,0.25);
}

/* ── Buttons ──────────────────────────────────────────────────── */
button {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    padding: 10px 14px; border-radius: 12px;
    cursor: pointer; font-weight: 800; font-size: 14px;
    transition: all 0.18s;
}
button:hover { filter: brightness(1.1); border-color: var(--border-hover); }
button.primary {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff; border-color: transparent;
    box-shadow: 0 0 18px rgba(0,212,200,0.2);
}
button.primary:hover { box-shadow: 0 0 28px rgba(0,212,200,0.4); filter: none; transform: translateY(-1px); }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.compact { padding: 8px 10px; font-size: 13px; }
button.tiny { padding: 6px 8px; font-size: 11px; border-radius: 999px; }
button.full { width: 100%; }

/* ── Layout ───────────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: minmax(280px, 390px) minmax(0, 1fr); gap: 16px; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
    background: var(--panel);
    border-radius: 20px; padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    position: relative; overflow: hidden;
}
.card::before {
    content: '';
    position: absolute; inset: 0; border-radius: 20px; padding: 1px;
    background: linear-gradient(135deg, rgba(0,212,200,0.18), rgba(155,109,255,0.08), transparent 65%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none;
}
.card h2 { margin: 0 0 14px; font-size: 18px; font-weight: 900; }

/* ── Forms ────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
label { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.3px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--code);
    color: var(--text);
    border-radius: 12px; padding: 11px 14px;
    font-size: 14px; outline: none;
    transition: border-color 0.2s;
}
textarea { min-height: 190px; resize: vertical; font-family: Consolas, monospace; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,212,200,0.08); }

/* ── Status ───────────────────────────────────────────────────── */
.status { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.status.success { color: var(--success); }
.status.error   { color: var(--danger); }
.status.warning { color: var(--warning); }

/* ── Results ──────────────────────────────────────────────────── */
.results { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 520px; overflow: auto; }
.result-item {
    display: flex; justify-content: space-between; gap: 12px; align-items: center;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.025);
    border-radius: 14px; padding: 12px; cursor: pointer;
    transition: all 0.18s;
}
.result-item:hover { border-color: var(--border-hover); background: rgba(0,212,200,0.04); transform: translateX(2px); }
.result-title { font-weight: 800; font-size: 14px; }
.result-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.4; }

/* ── Feedback / Bulk ──────────────────────────────────────────── */
.feedback-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.feedback-actions button:first-child { color: var(--success); border-color: rgba(0,212,200,0.3); }
.feedback-actions button:last-child  { color: var(--danger);  border-color: rgba(251,113,133,0.35); }
.bulk-box { margin-top: 12px; display: grid; gap: 8px; border: 1px solid var(--border); background: rgba(255,255,255,0.025); border-radius: 14px; padding: 12px; }
.bulk-title { font-weight: 900; color: var(--primary); }
.bulk-summary { border: 1px solid rgba(0,212,200,0.3); color: var(--success); background: rgba(0,212,200,0.07); border-radius: 14px; padding: 10px; font-size: 13px; font-weight: 900; }

/* ── Viewer ───────────────────────────────────────────────────── */
.viewer-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.viewer-title h2 { margin: 0 0 4px; font-size: 24px; font-weight: 900; }
.viewer-title p { margin: 0; color: var(--muted); font-size: 13px; }
.study-controls { display: grid; grid-template-columns: 150px 170px; gap: 8px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 14px; }

/* ── Patterns / Badges ────────────────────────────────────────── */
.signature { margin: 10px 0; color: var(--primary); font-weight: 800; word-break: break-word; line-height: 1.5; }
.patterns-title { margin: 8px 0; text-align: center; color: var(--primary); font-weight: 900; }
.pattern-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 12px; }
.pattern-chip {
    border: 1px solid rgba(0,212,200,0.28);
    background: rgba(0,212,200,0.07);
    color: var(--primary);
    border-radius: 999px; padding: 7px 12px;
    font-size: 13px; font-weight: 900;
    transition: all 0.18s;
}
.pattern-chip:hover { background: rgba(0,212,200,0.14); border-color: rgba(0,212,200,0.45); }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.badge {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--muted); border-radius: 999px;
    padding: 5px 10px; font-size: 12px; font-weight: 800;
}
.diagnostics-area.hidden { display: none; }
.diagnostic-panel { border: 1px solid rgba(157, 181, 255, 0.22); background: rgba(13, 13, 22, 0.78); border-radius: 16px; padding: 16px; margin: 12px 0 14px; }
.diagnostic-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.diagnostic-header h3 { margin: 0 0 4px; color: var(--success); }
.diagnostic-header p { margin: 0; color: var(--muted); font-size: 13px; }
.diagnostic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.diagnostic-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.diagnostic-card, .diagnostic-section { border: 1px solid var(--border); background: rgba(255, 255, 255, 0.035); border-radius: 14px; padding: 12px; min-width: 0; }
.diagnostic-card h4, .diagnostic-section h4 { margin: 0 0 10px; color: var(--primary); }
.diagnostic-card label { display: block; margin: 8px 0 4px; color: var(--success); }
.diagnostic-card pre { margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; background: var(--code); border: 1px solid var(--border); border-radius: 10px; padding: 10px; color: var(--text); font-size: 12px; }
.diagnostic-kv { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.06); padding: 6px 0; font-size: 13px; }
.diagnostic-kv span { color: var(--muted); }
.diagnostic-kv strong { text-align: right; }
.diagnostic-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.diagnostic-chip-list span { border: 1px solid var(--border); background: rgba(157, 181, 255, 0.08); border-radius: 999px; padding: 5px 8px; font-size: 12px; font-weight: 800; color: var(--text); }
.diagnostic-empty { color: var(--muted); font-size: 13px; }
.diagnostic-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.diagnostic-table th, .diagnostic-table td { border-bottom: 1px solid rgba(255,255,255,0.07); padding: 7px 4px; text-align: left; vertical-align: top; }
.diagnostic-table th { color: var(--success); }
.chordpro-view { background: var(--code); border: 1px solid var(--border); border-radius: 16px; padding: 18px; min-height: 360px; overflow-x: auto; text-align: left; }
.song-document { font-family: Consolas, 'Courier New', monospace; font-size: 15px; line-height: 1.45; }
.song-line { margin: 0 0 8px; min-height: 30px; }
.chord-line { display: flex; align-items: flex-end; flex-wrap: wrap; column-gap: 0; row-gap: 4px; }
.song-segment { display: inline-flex; flex-direction: column; align-items: flex-start; min-width: 8px; margin-right: 0; }
.song-chord { color: var(--primary); font-weight: 900; min-height: 18px; padding-right: 6px; white-space: pre; }
/* GRAU (níveis de estudo: [I], [VIm], [?]) fica VERMELHO — acorde real fica teal */
.song-chord.degree, .intro-line .ctok.degree { color: var(--danger); }
/* Dentro do grau: SÓ o numeral-raiz (I/1 + acidente) FORTE em vermelho; o resto —
   qualidade (m7,7,7+,sus…), barra '/' e baixo — em cor secundária. Vale romano e número. */
.song-chord.degree .deg-num, .intro-line .ctok.degree .deg-num { color: var(--danger); }
.song-chord.degree .deg-q, .intro-line .ctok.degree .deg-q { color: var(--accent); font-weight: 700; }
.intro-line .ctok { white-space: pre; }
.song-lyric { color: var(--text); white-space: pre; min-height: 18px; }
.plain-line { color: var(--text); white-space: pre-wrap; margin-bottom: 6px; }
.section-line { color: var(--purple); font-weight: 900; margin: 16px 0 8px; white-space: pre-wrap; }
.intro-line { color: var(--primary); font-weight: 900; white-space: pre-wrap; margin: 4px 0 10px; }
.tab-line { color: #c6cbef; white-space: pre; line-height: 1.3; }
.tab-block { background: rgba(255, 255, 255, 0.035); border: 1px dashed rgba(157, 181, 255, 0.25); border-radius: 12px; padding: 10px 12px; margin: 8px 0 14px; overflow-x: auto; }
.hidden-tabs .tab-block, .hidden-tabs .tab-line { display: none; }
.empty-state { min-height: 420px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.video-box {
    margin-top: 14px;
    background: #03030b;
    border-radius: 16px; overflow: hidden;
    border: 1px solid rgba(0,212,200,0.12);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.video-box iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.video-link { display: block; padding: 12px 14px; color: var(--primary); text-decoration: none; font-weight: 800; border-top: 1px solid var(--border); font-size: 13px; }
.video-link:hover { color: #fff; }

/* Experiência de leitura */
.compact-header .app { width: min(1600px, calc(100% - 20px)); padding-top: 10px; padding-bottom: 20px; }
.compact-header .hero { margin-bottom: 10px; align-items: center; }
.compact-header .hero h1 { font-size: clamp(24px, 2.4vw, 34px); margin-bottom: 0; }
.compact-header .hero p { display: none; }
.compact-header .tabs { margin-bottom: 10px; }
.compact-header .tab, .compact-header button { padding: 8px 11px; border-radius: 10px; }
.compact-header .api-status { padding: 6px 10px; font-size: 12px; }
.sidebar-hidden .layout { grid-template-columns: 1fr; }
.sidebar-hidden .sidebar-card { display: none; }
.sidebar-hidden .viewer-card { padding: 14px; }
.sidebar-hidden .chordpro-view { width: min(100%, 1120px); margin: 0 auto; }
.reader-focus .app { width: min(1760px, calc(100% - 12px)); padding: 8px 0 14px; }
.reader-focus .hero { margin-bottom: 6px; }
.reader-focus .hero h1 { font-size: 24px; }
.reader-focus .tabs { display: none; }
.reader-focus .viewer-card { padding: 10px; border-radius: 14px; }
.reader-focus .viewer-header { margin-bottom: 6px; align-items: center; }
.reader-focus .viewer-title h2 { font-size: 22px; }
.reader-focus .viewer-title p { font-size: 13px; }
.reader-focus .meta-row, .reader-focus .patterns-title, .reader-focus .pattern-grid { display: none; }
.reader-focus .action-bar { justify-content: center; margin: 6px 0 8px; }
.reader-focus .action-bar button:not(#readerFocusButton):not(#sidebarToggleButton):not(#headerToggleButton) { display: none; }
.reader-focus .study-controls { grid-template-columns: 130px 150px; }
.reader-focus .study-controls select { padding: 8px 10px; }
.reader-focus .chordpro-view { padding: 14px 18px; min-height: calc(100vh - 190px); width: min(100%, 1180px); margin: 0 auto; }
.reader-focus .song-document { font-size: clamp(14px, 1.1vw, 17px); line-height: 1.34; }
.reader-focus .song-line { margin-bottom: 5px; min-height: 24px; }
.reader-focus .song-chord { min-height: 15px; }
.reader-focus .song-lyric { min-height: 15px; }
.reader-focus .video-box, .reader-focus .diagnostics-area { display: none; }

/* ── Song-open layout ─────────────────────────────────────────── */

/* Reader = app-shell flex de altura fixa (vale p/ desktop E mobile): a nav fixa
   reserva 62px via padding-top do body; a toolbar (#readerToolbar) ocupa a altura
   natural; e o .app pega o RESTANTE via flex:1. Antes o desktop usava
   height:calc(100vh - 50px), que NÃO descontava a toolbar (~47px) e cortava o
   footer do painel direito ("▶ Tocar Música"). Flex é robusto a toolbar que quebra. */
body.song-open {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

body.song-open .reader-toolbar { flex: 0 0 auto; }

body.song-open .app {
    width: 100%;
    max-width: 100%;
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

body.song-open .hero,
body.song-open .tabs,
body.song-open .sidebar-card,
body.song-open #patternArea,
body.song-open .viewer-header {
    display: none !important;
}

body.song-open .layout {
    display: block;
    height: 100%;
}

body.song-open .viewer-card {
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
}

/* viewer-content is the direct child of viewer-card; must be constrained too */
body.song-open .viewer-content {
    height: 100%;
    overflow: hidden;
}

/* hide inline video area — session dock handles the player */
body.song-open #videoArea {
    display: none !important;
}

body.song-open .viewer-header,
body.song-open .action-bar {
    display: none !important;
}

body.song-open .chordpro-view {
    min-height: 0;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 13px;
}

/* Compact line spacing in song-open so more of the cifra fits on screen */
body.song-open .song-document {
    font-size: 13px;
    line-height: 1.35;
    /* 3-column layout: divide the wide horizontal space so more cifra fits per screen */
    column-count: 3;
    column-gap: 20px;
    column-fill: balance;
}

body.song-open .song-line {
    margin-bottom: 3px;
    min-height: 0;
    /* keep chord row and lyric row together across column breaks */
    break-inside: avoid;
}

body.song-open .song-chord {
    font-size: 12px;
    min-height: 0;
    line-height: 1.3;
}

body.song-open .song-lyric {
    font-size: 13px;
    min-height: 0;
    line-height: 1.35;
}

body.song-open .plain-line {
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 1px;
    break-inside: avoid;
}

/* Cursor de compasso — linha em destaque conforme o áudio avança */
.playing-now {
    background: rgba(0, 212, 200, 0.12);
    border-radius: 4px;
    outline: 1px solid rgba(0, 212, 200, 0.3);
    transition: background 0.2s;
}

body.song-open .patterns-title,
body.song-open .pattern-grid {
    display: none;
}

.song-reader-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    height: 100%;
    overflow: hidden;
}

.song-reader-cifra {
    overflow-y: auto;
    padding: 14px 22px 80px;
}

/* Right panel */
.song-reader-panel {
    border-left: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.similar-panel-header {
    padding: 11px 12px 9px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.similar-panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.similar-panel-title {
    font-size: 11px;
    font-weight: 900;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.similar-panel-status {
    font-size: 11px;
    color: var(--muted);
}

/* Level chips inside the panel */
.similar-panel-level {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.level-chip {
    font-size: 10px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.12s;
}

.level-chip.active { opacity: 1; }
.level-chip:hover { opacity: 0.8; filter: none; }

.level-chip-iniciante     { color: var(--success);  border-color: rgba(110,231,183,0.4); background: rgba(110,231,183,0.07); }
.level-chip-intermediario { color: #60d9d5;          border-color: rgba(96,217,213,0.4);  background: rgba(96,217,213,0.07);  }
.level-chip-avancado      { color: var(--warning);  border-color: rgba(250,204,21,0.4);  background: rgba(250,204,21,0.07);  }
.level-chip-expert        { color: var(--danger);   border-color: rgba(251,113,133,0.4); background: rgba(251,113,133,0.07); }
.level-chip-lenda         { color: var(--purple);   border-color: rgba(155,109,255,0.45); background: rgba(155,109,255,0.09); }

/* Tema claro: os chips ficavam lavados (cor viva some no fundo claro). Mantém a
   MESMA identidade de cor, mas escurece o texto e reforça o preenchimento pra ler bem. */
[data-theme="light"] .level-chip { opacity: 0.72; }
[data-theme="light"] .level-chip.active { opacity: 1; box-shadow: inset 0 0 0 1.5px currentColor; }
[data-theme="light"] .level-chip-iniciante     { color:#067a72; border-color:rgba(0,150,140,0.55); background:rgba(0,212,200,0.16); }
[data-theme="light"] .level-chip-intermediario { color:#0c807c; border-color:rgba(18,140,136,0.55); background:rgba(96,217,213,0.18); }
[data-theme="light"] .level-chip-avancado      { color:#8a6a00; border-color:rgba(180,130,5,0.60);  background:rgba(250,204,21,0.24); }
[data-theme="light"] .level-chip-expert        { color:#cc2f4d; border-color:rgba(210,55,82,0.55);  background:rgba(251,113,133,0.16); }
[data-theme="light"] .level-chip-lenda         { color:#6d39e8; border-color:rgba(110,57,232,0.55); background:rgba(155,109,255,0.16); }

/* Indicação do que os chips fazem: trocam acordes por graus conforme o nível sobe. */
.study-level-wrap { display:flex; flex-direction:column; align-items:flex-start; gap:3px; }
.study-level-hint { font-size:10px; font-weight:800; letter-spacing:.01em; color:var(--muted); white-space:nowrap; }
.study-level-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

/* Toggle do estilo de grau: Romano (I·IV·V) ↔ Número (1·4·5, Sistema de Nashville) */
.notation-toggle { display:inline-flex; gap:2px; padding:2px; border-radius:999px; border:1px solid var(--border); background:var(--bg2, rgba(255,255,255,.04)); }
.notation-chip { font-size:10px; font-weight:900; letter-spacing:.02em; padding:3px 9px; border-radius:999px; border:none; background:transparent; color:var(--muted); font-family:inherit; cursor:pointer; transition:background .12s, color .12s; }
.notation-chip:hover:not(.active) { color:var(--text); }
.notation-chip.active { background:var(--primary); color:var(--primary-ink); }

/* Véu de boot do Peixokê: clicou numa música em /peixoke → vai DIRETO pro palco,
   sem o flash da cifra. Some quando o palco abre (ou no timeout / "ver a cifra"). */
#peixokeBoot { position:fixed; inset:0; z-index:9000; display:flex; align-items:center; justify-content:center;
    background:radial-gradient(circle at 50% 38%, #0b2230, #060d16); }
[data-theme="light"] #peixokeBoot { background:radial-gradient(circle at 50% 38%, #dff3f6, #eef4f8); }
.pkb-card { display:flex; flex-direction:column; align-items:center; gap:16px; color:var(--text); }
.pkb-spin { width:46px; height:46px; border-radius:50%; border:4px solid rgba(0,212,200,.25); border-top-color:#00d4c8; animation:pkbspin .8s linear infinite; }
@keyframes pkbspin { to { transform:rotate(360deg); } }
.pkb-txt { font-size:16px; font-weight:900; }
.pkb-skip { background:none; border:1px solid var(--border); color:var(--muted); border-radius:999px; padding:7px 16px; font-family:inherit; font-weight:800; font-size:12px; cursor:pointer; }
.pkb-skip:hover { border-color:var(--primary); color:var(--text); }

/* ── Colinha: escala do tom + campo harmônico (toggle 🎼) ────────────────────
   GRID de 8 colunas: rótulo + 7 graus — a nota da escala fica EXATAMENTE
   acima do acorde do mesmo grau (colunas alinhadas). */
.colinha {
    margin: 0 0 14px;
    padding: 10px 14px;
    border: 1px solid rgba(0, 212, 200, 0.18);
    background: linear-gradient(135deg, rgba(0, 212, 200, 0.05), rgba(155, 109, 255, 0.04));
    border-radius: 14px;
    display: grid;
    grid-template-columns: auto repeat(7, minmax(44px, 1fr));
    gap: 7px 8px;
    align-items: center;
    max-width: 720px;
}

.col-cap {
    font-size: 10.5px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    white-space: nowrap;
}

.col-note {
    font-size: 12.5px;
    font-weight: 900;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 4px 6px;
    text-align: center;
}

.col-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    padding: 3px 6px;
    line-height: 1.25;
}

.col-cell .col-deg { font-size: 10px; font-weight: 900; color: var(--danger); }   /* grau = vermelho */
.col-cell .col-chord { font-size: 12.5px; font-weight: 900; color: var(--primary); } /* acorde = teal */

/* Grau que APARECE na cifra atual: célula acesa (tooltip mostra os acordes usados) */
.col-cell.used {
    border-color: rgba(0, 212, 200, 0.55);
    background: rgba(0, 212, 200, 0.10);
    box-shadow: 0 0 10px rgba(0, 212, 200, 0.18);
}

.col-cell:not(.used) { opacity: 0.55; }

/* Botão tríades ↔ 7ª dentro do rótulo do campo */
.col-mode {
    font-size: 9px;
    font-weight: 900;
    padding: 2px 7px;
    margin-left: 5px;
    border-radius: 999px;
    border: 1px solid rgba(155, 109, 255, 0.45);
    background: rgba(155, 109, 255, 0.10);
    color: var(--purple);
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    vertical-align: middle;
}

.col-mode:hover { background: rgba(155, 109, 255, 0.22); filter: none; }

.colinha.compact { padding: 7px 10px; gap: 5px 6px; margin: 0; grid-template-columns: auto repeat(7, minmax(36px, 1fr)); }
.colinha.compact .col-cap { font-size: 9px; }
.colinha.compact .col-note { font-size: 11px; padding: 2px 5px; }
.colinha.compact .col-cell { padding: 2px 5px; }
.colinha.compact .col-cell .col-chord { font-size: 11px; }

@media (max-width: 640px) {
    .colinha { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px 4px; padding: 9px 10px; }
    .colinha .col-cap { grid-column: 1 / -1; }   /* rótulo vira linha própria no mobile */
    .colinha .col-note { padding: 3px 2px; font-size: 11.5px; }
    .colinha .col-cell { padding: 3px 2px; min-width: 0; }
    .colinha .col-cell .col-chord { font-size: 10.5px; line-height: 1.15; word-break: break-word; }
}

/* #13: cabeçalho "Aprenda essa cifra em Graus!" acima da lista de parecidas */
.study-graus-header {
    padding: 11px 12px 9px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.similar-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.similar-empty {
    padding: 18px 12px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.similar-item {
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.025);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    display: block;
}

.similar-item:hover {
    border-color: var(--primary);
    background: rgba(157,181,255,0.06);
    filter: none;
}

.similar-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.similar-item-title {
    font-weight: 800;
    font-size: 12px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.similar-score {
    font-size: 10px;
    font-weight: 900;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(110,231,183,0.1);
    color: var(--success);
    border: 1px solid rgba(110,231,183,0.2);
    flex-shrink: 0;
}

.similar-item-meta {
    font-size: 10px;
    color: var(--muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.similar-panel-footer {
    padding: 10px 10px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* reader-focus on top of song-open hides right panel */
body.song-open.reader-focus .song-reader-panel { display: none; }
body.song-open.reader-focus .song-reader-content { grid-template-columns: 1fr; }
body.song-open.reader-focus .song-reader-cifra { padding: 12px 18px 80px; }

/* ── Fallback de áudio (yt-dlp) ───────────────────────────────── */
.session-audio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 10px;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
}

.session-audio-player audio {
    width: 100%;
    border-radius: 8px;
    accent-color: var(--primary);
}

.session-audio-label {
    font-size: 11px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-audio-label a {
    color: var(--primary);
    text-decoration: none;
    font-size: 11px;
}

.session-audio-label a:hover { text-decoration: underline; }

/* Botões de ação (Tocar/Peixokê) que só aparecem no mobile, onde o painel lateral fica empilhado abaixo da cifra. */
.reader-mobile-only { display: none; }

/* Reduce columns to 2 on narrower viewports */
@media (max-width: 1100px) {
    body.song-open .song-document { column-count: 2; }
}

/* Mobile: cifra em coluna ÚNICA, QUEBRANDO a linha pra caber na tela (acorde fica
   acima de onde é tocado, estilo cifra clássica). Rolagem só VERTICAL — a lateral
   fica travada; só os blocos de TABLATURA mantêm o scroll horizontal próprio (tab
   não pode quebrar). A fisgada/peixokê NÃO é afetada: mapeia por linha lógica
   (data-cp-line), não pelas linhas visuais. */
@media (max-width: 640px) {
    body.song-open .song-document { column-count: 1 !important; column-gap: 0 !important; font-size: 16px; }
    body.song-open .chordpro-view,
    body.song-open .song-reader-cifra { overflow-x: hidden !important; }  /* trava lateral (vence a regra do tablet) */
    body.song-open .tab-block { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body.song-open .chord-line { flex-wrap: wrap; width: auto; max-width: 100%; align-items: flex-end; row-gap: 6px; }
    body.song-open .song-lyric { white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; }
    body.song-open .song-chord { white-space: pre; }
    body.song-open .song-segment { flex: 0 1 auto; min-width: 0; max-width: 100%; }
}

@media (max-width: 900px) {
    .hero, .viewer-header { flex-direction: column; }
    .layout { grid-template-columns: 1fr; }
    .study-controls { grid-template-columns: 1fr; width: 100%; }
    .app-nav .api-status { display: none; }
    .diagnostic-grid, .diagnostic-grid.three { grid-template-columns: 1fr; }
    .reader-focus .study-controls { grid-template-columns: 1fr; }
    /* Mobile: reader = "app shell" FLEX de altura fixa — header (toolbar) + área que rola.
       O body vira coluna flex de 100dvh (a nav fixa já reserva 62px via padding-top do body):
       a toolbar ocupa a altura natural e o RESTANTE é o ÚNICO container que rola
       (.song-reader-content). Sem scroll de página, sem scroll aninhado e sem a toolbar
       cobrir o topo → a cifra começa do início e rola numa área só.
       (body.song-open { overflow:hidden } continua valendo da regra base.) */
    body.song-open { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
    body.song-open .reader-toolbar { flex: 0 0 auto; }
    body.song-open .app { flex: 1 1 auto; min-height: 0; height: auto; }
    .reader-mobile-only { display: inline-flex; }
    .song-reader-content { display: block; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    body.song-open .song-reader-cifra { overflow-x: auto; overflow-y: visible; height: auto; }
    .song-reader-panel { display: flex; border-left: none; border-top: 1px solid var(--border); }
}

/* ── Busca: CTAs do empty-state (criar / pedir cifra) ───────────────────────── */
.cif-cta-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px;}
.cif-cta{display:inline-block;font-size:12.5px;font-weight:800;text-decoration:none;
    color:#00d4c8;background:rgba(0,212,200,.10);border:1px solid rgba(0,212,200,.32);
    border-radius:999px;padding:6px 13px;cursor:pointer;font-family:inherit;}
.cif-cta:hover{background:rgba(0,212,200,.20);}
.cif-cta-alt{color:#9b6dff;background:rgba(155,109,255,.10);border-color:rgba(155,109,255,.34);}
.cif-cta-alt:hover{background:rgba(155,109,255,.20);}
.cif-sub{font-size:11.5px;color:var(--muted,#8b93a7);margin-top:7px;font-weight:700;}

/* ── Modal "Solicitar cifra ao LMNew" ──────────────────────────────────────── */
.pedir-overlay{position:fixed;inset:0;z-index:3000;display:flex;align-items:center;
    justify-content:center;padding:18px;background:rgba(4,4,14,.78);backdrop-filter:blur(7px);
    opacity:0;pointer-events:none;transition:opacity .2s;}
.pedir-overlay.open{opacity:1;pointer-events:all;}
.pedir-modal{width:100%;max-width:440px;background:#10102a;border:1px solid rgba(255,255,255,.12);
    border-radius:18px;padding:22px 22px 20px;box-shadow:0 24px 70px rgba(0,0,0,.6);
    transform:translateY(12px);transition:transform .2s;}
.pedir-overlay.open .pedir-modal{transform:translateY(0);}
.pedir-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px;}
.pedir-head h3{font-size:1.05rem;font-weight:800;color:var(--text,#f0f0ff);}
.pedir-x{background:none;border:none;color:var(--muted,#8b93a7);font-size:1rem;cursor:pointer;padding:4px 7px;border-radius:8px;}
.pedir-x:hover{color:var(--text,#f0f0ff);background:rgba(255,255,255,.06);}
.pedir-lead{font-size:13px;color:var(--muted,#9a9ac2);line-height:1.5;margin-bottom:14px;}
.pedir-l{display:block;font-size:12px;font-weight:800;color:var(--text,#e8e8ff);margin-bottom:12px;}
.pedir-l span{color:#ff6b6b;font-weight:900;}
.pedir-l span.opt{color:var(--muted,#7878a0);font-weight:700;}
.pedir-l input{width:100%;margin-top:6px;background:rgba(255,255,255,.05);
    border:1px solid rgba(255,255,255,.12);border-radius:10px;padding:10px 12px;
    color:var(--text,#f2f2ff);font-size:14px;font-family:inherit;font-weight:600;outline:none;}
.pedir-l input:focus{border-color:rgba(0,212,200,.5);}
.pedir-msg{font-size:12.5px;font-weight:700;border-radius:9px;padding:8px 11px;margin-bottom:10px;}
.pedir-msg.err{color:#ff8585;background:rgba(255,80,80,.10);border:1px solid rgba(255,80,80,.25);}
.pedir-actions{display:flex;gap:9px;justify-content:flex-end;margin-top:4px;}
.pedir-cancel{background:none;border:1px solid rgba(255,255,255,.14);color:var(--muted,#9a9ac2);
    border-radius:10px;padding:9px 16px;font-size:13px;font-weight:700;cursor:pointer;font-family:inherit;}
.pedir-cancel:hover{color:var(--text,#f2f2ff);}
.pedir-send{background:linear-gradient(135deg,#00d4c8,#9b6dff);border:none;color:#08081a;
    border-radius:10px;padding:9px 18px;font-size:13px;font-weight:900;cursor:pointer;font-family:inherit;}
.pedir-send:hover{filter:brightness(1.08);}
.pedir-send:disabled{opacity:.6;cursor:default;}
.pedir-ok{text-align:center;padding:10px 6px 4px;}
.pedir-ok-emoji{font-size:2.6rem;margin-bottom:8px;}
.pedir-ok h3{font-size:1.1rem;font-weight:800;color:var(--text,#f0f0ff);margin-bottom:8px;}
.pedir-ok p{font-size:13.5px;color:var(--muted,#9a9ac2);line-height:1.55;margin-bottom:16px;}
.pedir-ok .pedir-send{display:inline-block;}

/* ── Índice A-Z de todos os artistas ─────────────────────────────────────────── */
.az-bar{display:flex;flex-wrap:wrap;gap:5px;margin:4px 0 22px;}
.az-jump{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:30px;padding:0 7px;
    border-radius:9px;font-size:13px;font-weight:900;cursor:pointer;color:#00d4c8;
    background:rgba(0,212,200,.08);border:1px solid rgba(0,212,200,.22);}
.az-jump:hover{background:rgba(0,212,200,.2);}
.az-group{margin-bottom:22px;scroll-margin-top:80px;}
.az-letter{font-size:20px;font-weight:900;color:#9b6dff;margin:0 0 12px;padding-bottom:6px;
    border-bottom:1px solid rgba(255,255,255,.08);}

/* ── Filtros da lista de cifras parecidas (painel direito do reader) ────────── */
.similar-filters{display:flex;flex-direction:column;gap:6px;margin-top:9px;}
.similar-filter-sel,.similar-filter-input{width:100%;background:rgba(255,255,255,.05);
    border:1px solid rgba(255,255,255,.12);border-radius:9px;padding:7px 10px;
    color:var(--text,#f0f0ff);font-size:12.5px;font-family:inherit;font-weight:700;outline:none;}
.similar-filter-sel:focus,.similar-filter-input:focus{border-color:rgba(0,212,200,.5);}
.similar-filter-sel{cursor:pointer;}
.similar-filter-sel option{background:#10102a;color:var(--text,#f0f0ff);}
.similar-filter-input::placeholder{color:var(--muted,#8b93a7);font-weight:600;}

/* === Mobile: widgets flutuantes não cobrem conteúdo (auditoria 375px) ===
   Chip de online e botão de som são injetados via JS inline → !important. */
@media (max-width: 640px) {
    .btn-sound { width: 38px !important; height: 38px !important; right: 12px !important; bottom: 16px !important; font-size: 15px !important; }
    #site-stats[style*="fixed"] { left: 10px !important; bottom: 14px !important; padding: 4px 10px !important; font-size: 11px !important; opacity: 0.85 !important; pointer-events: none !important; }
    .pt-wrap { padding-bottom: 130px !important; }
}
