:root {
    --primary-color: #6366f1;
    --secondary-color: #2855f7;
    --sustenido-bemos-color: black;
    --bg-dark: #0f172a;
    --card-bg: rgba(200, 141, 159, 0.7);
    --text-primary: black;
    --text-secondary: #20B2AA;
    --accent-glow: rgba(99, 102, 241, 0.2);

    /* Fluid Spacing */
    --space-s: clamp(0.15rem, 0.2rem + 0.5vw, 1rem);
    --space-m: clamp(1rem, 0.8rem + 1vw, 2rem);
    --space-l: clamp(1.5rem, 1rem + 2.5vw, 4rem);

    /* Fluid Typography */
    --fs-base: clamp(0.875rem, 0.85rem + 0.125vw, 1rem);
    --fs-h1: clamp(1.75rem, 1rem + 3.75vw, 3rem);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    /*background-color: var(--bg-dark);*/
    /*    background-image:
            radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
            radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);*/
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-s);
    font-size: var(--fs-base);
}

.contador-visitas{
    position: fixed;
    top: 40px;
    left: 20px;
    text-align: end;
    padding: 15px;
    margin-top: 30px;
    font-family: sans-serif;
    border-top: 1px solid #ddd;
    color: #555;
}

.titulo_visitas{
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.total_visitas{
    font-size: 1.5rem;
    font-weight: bold;
    color: #222;
}


.ip_visitas{
    font-size: 0.7rem;
    color: #999;
    margin-top: 5px;
}

.container {
    width: 100%;
    max-width: 1200px;
    z-index: 10;
}

/* .card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: clamp(1rem, 5vw, 2rem);
    padding: var(--space-m);
    box-shadow: 0 25px 50px -1px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6), 0 0 20px var(--accent-glow);
} */

/* @media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    .lyrics {
        font-family: 'Fira Code', monospace;
        color: var(--text-primary);
        font-size: clamp(0.5rem, 0.4rem + 0.3vw, 1rem);
        margin-bottom: 0;
        line-height: 1.1;
    }
} */

h1 {
    font-size: var(--fs-h1);
    font-weight: 800;
    margin-bottom: var(--space-s);
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.04em;
    text-align: center;
}

/* @media (min-width: 768px) {
    h1 {
        text-align: left;
    }
} */

p {
    color: var(--text-secondary);
    font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
    line-height: 1.6;
    margin-bottom: var(--space-m);
    text-wrap: balance;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: var(--space-m);
    justify-content: center;
}

/* @media (min-width: 768px) {
    .controls {
        justify-content: flex-start;
    }
} */


.btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: scale(0.98);
}

/* Key Selector Styles */
.key-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: var(--space-m);
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}


.key-btn {
    background: rgba(230, 230, 250, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 0.9rem;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key-btn:hover {
    background: rgba(144, 238, 144, 0.75);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

u {
    text-decoration: none;
    border-bottom: 2.5px solid var(--secondary-color);
    background: rgba(168, 85, 247, 0.1);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.key-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(1.05);
}

sup {
    font-size: 0.65em;
    /*color: var(--sustenido-bemos-color);*/
    margin-left: 1px;
    vertical-align: super;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.chord-chart {
    column-count: 2;
    column-gap: 0.7rem;
    font-family: "Courier New", Courier, monospace;
    overflow-x: auto;
    color: #b91c1c;
    margin: 0 0 0.35rem 0;

    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.4rem;
    letter-spacing: 0.05em;

    margin-inline: auto;
    padding: var(--space-m);
    border-radius: 16px;
    max-width: 100%;
    /* Keep it responsive */
}

.chord-line {
    white-space: pre;
    font-family: 'Fira Code', monospace;
    font-size: clamp(0.8rem, 0.7rem + 0.5vw, 1rem);
    color: var(--text-primary);
    letter-spacing: normal;
    line-height: 1.1;
    margin: 0;
}

@media (max-width: 900px) {
    .chord-chart {
        column-count: 1;
        column-gap: 0.9rem;
    }
}

.chord {
    font-weight: 900;
    color: var(--secondary-color);
    filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.4));
}

.lyrics {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    display: inline-block;
    width: 100%;
    font-family: 'Fira Code', monospace;
    color: var(--text-primary);
    font-size: clamp(0.8rem, 0.7rem + 0.5vw, 1rem);
    /*margin-bottom: 0;*/
    letter-spacing: normal;
    line-height: 1.2;
    white-space: pre;
    /* Preserva espaços do JSON */
}

.lyrics:empty {
    min-height: 1rem;
}

.strophe {
    display: inline-block;
    width: 100%;
    /* Espaço padrão entre as linhas */
    margin-top: 1.0rem;
    margin-bottom: 0.65rem;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.lyrics.chord-only {
    margin-top: -0.3rem; /* Traz a linha de acorde para mais perto */
}

.lyrics.chord-only + .lyrics.chord-only {
    margin-top: -0.8rem; /* Gruda linhas de acordes consecutivas */
}

.chord-anchor {
    position: relative;
    display: inline;
}

.chord-relative {
    position: absolute;
    bottom: 100%; /* Posiciona acima da letra */
    left: 0;
    font-weight: 900;
    color: var(--secondary-color);
    white-space: nowrap;
    filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.4));
    line-height: 1;
    pointer-events: none;
}

.output-container {
    margin-top: var(--space-m);
    padding: var(--space-m);
    /*background: rgba(15, 23, 42, 0.5);*/
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.output-header {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.output-header::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 8px;
}

pre {
    font-family: 'Fira Code', monospace;
    font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.9rem);
    color: #e2e8f0;
    overflow-x: auto;
}

.footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Novas Classes de Estilo --- */

/* Seção de Busca */
.search-section {
    position: fixed;
    top: 1px;
    margin-bottom: 0.5rem;
    z-index: 1;
}

.search-input {
    width: 100%;
    background: rgba(180, 210, 200, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.8);
    color: #000000;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1.5rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    background: rgba(176, 224, 230, 0.9);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

#song-list {
    margin-top: 0.5rem;
    background: #DCEFF5;
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 300px;
    overflow-y: auto;
    position: absolute;
    width: 100%;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.song-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.song-item:last-child {
    border-bottom: none;
}

.song-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.song-item .title {
    font-weight: 400;
    display: block;
}
.song-item .autor {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Header da Música */
.song-section{
    position: relative;
    top: 100px;
}

.song-display-header {
    margin-bottom: 2rem;
    text-align: center;
}

.song-display-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.song-autor {
    font-weight: 900;
    font-size: 1.1rem;
    font-style: italic;
    color: green;
}

.song-key-info {
    color: var(--text-primary);
    font-size: 1em;
}

.song-intro {
    margin-top: 1.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
}

.song-intro-label {
    color: var(--primary-color);
}

.song-intro .chord-line {
    margin-top: 0.5rem;
    white-space: pre-wrap; /* Permite quebrar em múltiplas linhas */
    line-height: 1.2;      /* Maior espaçamento vertical para leitura no celular */
    word-break: break-all; /* Garante que quebre se necessário */
}

#key-selector-container {
    display: none;
}

.controls-header {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Utilitários */
.text-center {
    text-align: center;
}
.flex-center-gap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* --- Modal Acordes --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-overlay.hidden {
    display: none;
}
.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    width: 600px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}
.close-modal:hover {
    color: #000;
}
.chord-diagrams-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-around;
    margin-top: 15px;
}
.diagram-section {
    text-align: center;
}
.diagram-section h4 {
    margin-bottom: 10px;
    color: #333;
}
.chord-variations {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.var-btn {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #f9f9f9;
    border-radius: 4px;
    cursor: pointer;
}
.var-btn.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}
span.chord-clickable {
    cursor: pointer;
    transition: color 0.2s;
    pointer-events: auto;
}
span.chord-clickable:hover {
    color: #e74c3c;
}

