:root {
    --primary: #FFC502;
    --bg-dark: #1E2227;
    --card-bg: #2a2f36;
    --text-white: #ffffff;
    --text-muted: #b0b3b8;
    --kb-black: #121417;
    --line-thickness: 2px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: 'Segoe UI', sans-serif;
    margin: 0; padding: 20px 10px;
    display: flex; flex-direction: column; align-items: center;
}

/* HEADER */
.header { width: 100%; max-width: 420px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.back-btn { color: var(--primary); text-decoration: none; font-weight: bold; font-size: 14px; }

/* CARD PRINCIPAL COM BOTÃO DE AJUDA */
.module-card {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 18px;
    width: 100%;
    max-width: 420px;
    margin-bottom: 12px;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.05);
    position: relative; /* Necessário para o botão ? */
}

/* BOTÃO DE AJUDA ? */
.help-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 28px;
    height: 28px;
    background-color: rgba(255, 197, 2, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.help-btn:hover {
    background-color: var(--primary);
    color: #000;
}

.label { 
    font-size: 10px; 
    color: var(--primary); 
    font-weight: 800; 
    text-transform: uppercase; 
    margin-bottom: 10px; 
    display: block; 
    opacity: 0.8; 
}

/* SELETORES COM RESPIRO */
.selector-grid { 
    display: grid; 
    grid-template-columns: repeat(6, 1fr); 
    gap: 6px; 
    margin-top: 30px; /* Respiro para o botão de ajuda */
}

.btn-sel { 
    background: var(--kb-black); border: 1px solid #444; color: white; 
    padding: 10px 0; border-radius: 8px; cursor: pointer; font-size: 18px; font-weight: bold;
}
.btn-sel.active { background: var(--primary); color: #1e2227; border-color: var(--primary); }

.chord-select {
    width: 100%;
    background: var(--kb-black);
    color: white;
    border: 1px solid #444;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 10px;
    outline: none;
}

/* RESULTADOS */
.results-card {
    background-color: var(--card-bg);
    border-radius: 24px;
    padding: 25px 15px;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chord-display-name { font-size: 28px; font-weight: 800; margin-bottom: 10px; }
.chord-display-notes { margin-top: 20px; font-size: 15px; color: var(--primary); font-weight: 700; letter-spacing: 1px; }

/* PIANO */
.piano-container {
    position: relative; width: 100%; height: 80px;
    background-color: #000; padding: var(--line-thickness);
    border-radius: 6px; display: flex; gap: var(--line-thickness); box-sizing: border-box;
}
.key-w { flex: 1; background: white; height: 100%; border-radius: 0 0 2px 2px; z-index: 1; }
.key-b {
    position: absolute; background: var(--kb-black); width: 4.2%; height: 55%; z-index: 2; border-radius: 0 0 3px 3px;
    border-left: 0.5px solid #000; border-right: 0.5px solid #000;
}
.key-w.active { background-color: var(--primary) !important; box-shadow: inset 0 -5px 0 rgba(0,0,0,0.1); }
.key-b.active {
    background-color: var(--primary);
    outline: var(--line-thickness) solid var(--kb-black); 
    outline-offset: 0px; z-index: 10;
}

/* MODAL EMOLDURADO */
.modal-help {
    display: none; /* Alterado para flex via JS */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    
    /* ESTA PARTE É CRUCIAL PARA A MOLDURA */
    align-items: center;     /* Centraliza verticalmente */
    justify-content: center;    /* Centraliza horizontalmente */
    padding: 20px;           /* Garante que o modal nunca toque na borda da tela */
    box-sizing: border-box;
}

/* A "Caixa" de conteúdo (o encarte) */
.modal-content {
    background-color: var(--card-bg);
    padding: 40px 25px;
    border-radius: 25px;
    border: 1px solid var(--primary);
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    
    /* Define a moldura: ele ocupa a largura disponível até o limite do padding do pai */
    width: 100%; 
    max-width: 380px; /* No mobile ele fica contido, no desktop não espalha */
    
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.close-modal {
    position: absolute; top: 15px; right: 20px;
    color: var(--text-white); font-size: 30px; cursor: pointer; line-height: 1;
}

.modal-content h3 { color: var(--primary); margin: 0 0 20px 0; font-size: 24px; text-transform: uppercase; letter-spacing: 1px; text-align: center;}
.modal-content p { line-height: 1.8; color: var(--text-muted); font-size: 16px; margin: 0; }

.tip-card {
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 15px;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    border: 1px dashed rgba(255, 197, 2, 0.2);
    text-align: justify;
}
.tip-title { color: var(--primary); font-size: 10px; font-weight: 900; letter-spacing: 1.5px; margin-bottom: 5px; display: block; }
.tip-text { color: var(--text-muted); font-size: 13px; line-height: 1.4; margin: 0; }