:root {
    --fretboard-bg: #4a2e15;
    --fret-wire: #c0c0c0;
    --string-color: #e0e0e0;
    --inlay-color: rgba(255, 255, 255, 0.35);
    
    --color-out-of-key: #2a2a2a; 
    --color-scale-dim: #444444;  
    --color-scale: #888888;      
    --color-root: #e74c3c;       
    --color-third: #3498db;      
    --color-fifth: #2ecc71;      
    --color-ext: #9b59b6;        
    --color-active-btn: #3498db;
}

* { box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #1e1e1e; color: #fff; 
    display: flex; flex-direction: column; align-items: center; 
    min-height: 100vh; margin: 0; padding: 20px; 
    overflow-x: auto; 
}

/* --- NAVBAR --- */
.top-nav {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1050px;
    margin: 0 auto 20px auto;
    padding: 10px 0;
    border-bottom: 1px solid #333;
}

.nav-left, .nav-right { flex: 1; display: flex; align-items: center; }
.nav-left { justify-content: flex-start; }
.nav-right { justify-content: flex-end; }
.nav-center { flex: 2; display: flex; justify-content: center; text-align: center; }

.nav-center h1 { margin: 0; font-weight: 300; letter-spacing: 2px; font-size: 26px; color: #fff; }

.nav-link {
    background-color: #3d3d3d; color: #fff; border: 1px solid #555; padding: 8px 16px;
    border-radius: 4px; font-size: 14px; text-decoration: none; transition: all 0.2s;
}
.nav-link:hover { background-color: #4d4d4d; }

.btn-support {
    background-color: #FFDD00; color: #000000; text-decoration: none; padding: 8px 18px;
    border-radius: 20px; font-weight: bold; font-size: 14px; transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
.btn-support:hover {
    transform: translateY(-2px); box-shadow: 0 6px 12px rgba(255, 221, 0, 0.3); background-color: #ffea4d;
}

/* --- MASTER WRAPPER --- */
.app-wrapper { display: flex; flex-direction: column; width: 100%; min-width: 950px; max-width: 1050px; margin: 0 auto; padding-bottom: 30px; gap: 15px; }

.controls-container { display: flex; flex-direction: column; align-items: center; gap: 15px; background-color: #2a2a2a; padding: 15px 25px; border-radius: 8px; border: 1px solid #333; width: 100%; }
.controls-row { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; width: 100%; align-items: center;}

button, select { background-color: #3d3d3d; color: #fff; border: 1px solid #555; padding: 8px 12px; border-radius: 4px; font-size: 15px; cursor: pointer; outline: none; transition: all 0.2s; }
button:hover, select:hover { background-color: #4d4d4d; }
button.active-toggle { background-color: var(--color-scale); }
#btn-clear { background-color: #c0392b; border-color: #e74c3c; margin-left: auto; }
#btn-clear:hover { background-color: #e74c3c; }

.split-panel { flex-direction: row; justify-content: space-between; align-items: stretch; }
.tool-section { display: flex; flex-direction: column; flex: 1; align-items: center; gap: 10px; }
.tool-section h3 { margin: 0; font-size: 14px; color: #888; text-transform: uppercase; letter-spacing: 1px;}
.tool-row { display: flex; align-items: center; gap: 15px; height: 100%; }
.tool-divider { width: 1px; background-color: #444; margin: 0 15px; }
.digital-display { background: #111; padding: 6px 12px; border-radius: 4px; border: 1px inset #333; font-family: monospace; font-size: 16px; min-width: 70px; text-align: center; color: #2ecc71; }
#metro-slider { cursor: pointer; }

.volume-sliders { display: flex; gap: 15px; align-items: center; justify-content: center; height: 100%; }
.vol-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 60px;}
.vol-col label { font-size: 10px; color: #aaa; text-transform: uppercase; font-weight: bold; }
.vert-slider { -webkit-appearance: slider-vertical; appearance: slider-vertical; width: 12px; height: 50px; cursor: pointer; }

.tuner-display { display: flex; align-items: center; gap: 15px; }
.tuner-meter { width: 120px; height: 12px; background: #111; border-radius: 6px; position: relative; border: 1px solid #444; overflow: hidden; }
.tuner-center-mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.2); transform: translateX(-50%); }
#tuner-needle { position: absolute; top: 0; bottom: 0; width: 4px; background: #e74c3c; left: 50%; transform: translateX(-50%); transition: left 0.1s ease-out; border-radius: 2px; }
#tuner-needle.in-tune { background: #2ecc71; box-shadow: 0 0 8px #2ecc71; }
.reference-tones { display: flex; gap: 8px; margin-top: 5px; }
.tone-btn { padding: 4px 8px; font-size: 13px; font-weight: bold; min-width: 35px; border-radius: 4px; }
.tone-btn.active-tone { background-color: #2ecc71; color: #111; border-color: #27ae60; box-shadow: 0 0 8px rgba(46, 204, 113, 0.5); }

#chord-controls { display: none; flex-direction: column; border-top: 1px dashed #555; padding-top: 15px; width: 100%; }
.chord-buttons-container { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.chord-card { flex: 1 1 calc(14.28% - 10px); min-width: 130px; display: flex; flex-direction: column; align-items: center; background-color: #3d3d3d; padding: 8px 6px; border-radius: 6px; border: 2px solid transparent; transition: all 0.2s; gap: 6px; }
.chord-card.active-chord { border-color: var(--color-active-btn); background-color: rgba(52, 152, 219, 0.2); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

.chord-card-header { display: flex; flex-direction: column; align-items: center; cursor: pointer; width: 100%; padding: 4px; border-radius: 4px; }
.chord-card-header:hover { background-color: #555; }
.chord-card-header .name { font-weight: bold; font-size: 14px; margin-bottom: 2px; }
.chord-card-header .rn { font-size: 12px; color: #ccc; }
.chord-card.active-chord .name, .chord-card.active-chord .rn { color: #fff; }

.card-select { width: 100%; font-size: 11px; padding: 4px; background-color: #1e1e1e; color: #ddd; border: 1px solid #555; border-radius: 3px; }

.add-row { display: flex; justify-content: center; margin-top: 15px; width: 100%; }
.action-btn { background-color: #27ae60; border-color: #2ecc71; margin-left: 15px; }
.action-btn:hover { background-color: #2ecc71; }
.action-btn-red { background-color: #c0392b; border-color: #e74c3c; font-size: 13px; padding: 6px 12px;}
.action-btn-red:hover { background-color: #e74c3c; }
.action-btn-blue { background-color: #2980b9; border-color: #3498db; font-size: 13px; padding: 6px 12px;}
.action-btn-blue:hover { background-color: #3498db; }
.highlight-select { border-color: #3498db; color: #3498db; font-weight: bold;}

.fretboard-container { display: flex; flex-direction: column; width: 100%; }
.fret-markers { display: flex; height: 20px; padding-left: 10px; margin-bottom: 5px; width: 100%; }
.marker { flex: 1 1 60px; display: flex; justify-content: center; align-items: center; color: #888; font-size: 12px; font-weight: bold; }
.marker.nut-marker { flex: 0 0 50px; }
.fretboard { display: flex; flex-direction: column; background-color: var(--fretboard-bg); border: 2px solid #2a1a0c; border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); padding: 10px 0 10px 10px; position: relative; width: 100%; }
.inlays-track { position: absolute; top: 10px; bottom: 10px; left: 10px; right: 0; display: flex; pointer-events: none; z-index: 0; }
.fret-inlay { flex: 1 1 60px; border-right: 3px solid transparent; display: flex; justify-content: center; align-items: center; }
.fret-inlay.nut { flex: 0 0 50px; border-right: 8px solid transparent; }
.dot { width: 16px; height: 16px; background-color: var(--inlay-color); border-radius: 50%; box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); }
.double-dot { display: flex; flex-direction: column; justify-content: space-between; height: 45%; align-items: center; }

.string { display: flex; position: relative; height: 40px; z-index: 1; width: 100%; }
.string::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); background-color: var(--string-color); box-shadow: 0 1px 2px rgba(0,0,0,0.8); z-index: 1; }
.string:nth-of-type(1)::before { height: 1.5px; }
.string:nth-of-type(2)::before { height: 1.5px; }
.string:nth-of-type(3)::before { height: 2px; }
.string:nth-of-type(4)::before { height: 2.5px; }
.string:nth-of-type(5)::before { height: 3px; }
.string:nth-of-type(6)::before { height: 4px; }
.string:nth-of-type(7)::before { height: 4.5px; }

.fret { flex: 1 1 60px; height: 100%; border-right: 3px solid var(--fret-wire); display: flex; justify-content: center; align-items: center; position: relative; }
.fret.nut { flex: 0 0 50px; border-right: 8px solid #ddd; background-color: rgba(0, 0, 0, 0.3); }

.note-circle { width: 28px; height: 28px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.1); z-index: 2; cursor: pointer; display: flex; justify-content: center; align-items: center; color: transparent; font-weight: bold; font-size: 13px; user-select: none; transition: all 0.1s ease; }
.note-circle.active { transform: scale(1.15); z-index: 3; color: #fff; }
.note-circle.active:not(.visible) { background-color: #4caf50; box-shadow: 0 0 10px #4caf50; }
.note-circle.visible { background-color: var(--color-out-of-key); color: #555; }
.note-circle.visible.active { background-color: #4caf50; color: #fff; }
.note-circle.scale-dim.visible { background-color: var(--color-scale-dim); color: #aaa; box-shadow: none; }
.note-circle.scale-dim.visible.active { background-color: var(--color-scale-dim); color: #fff; }
.note-circle.scale-note.visible { background-color: var(--color-scale); color: #fff; box-shadow: none; }
.note-circle.root.visible { background-color: var(--color-root); color: #fff; box-shadow: 0 0 6px var(--color-root); }
.note-circle.third.visible { background-color: var(--color-third); color: #fff; box-shadow: 0 0 6px var(--color-third); }
.note-circle.fifth.visible { background-color: var(--color-fifth); color: #fff; box-shadow: 0 0 6px var(--color-fifth); }
.note-circle.ext.visible { background-color: var(--color-ext); color: #fff; box-shadow: 0 0 6px var(--color-ext); }

.progression-container { display: flex; flex-direction: column; width: 100%; background-color: #2a2a2a; border-radius: 8px; border: 1px solid #333; padding: 15px 25px; }
.prog-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px dashed #555; padding-bottom: 10px; margin-bottom: 15px; }
.prog-header-left h3 { margin: 0; font-size: 16px; color: #fff; }
.prog-actions { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.prog-info { font-size: 12px; color: #aaa; font-weight: normal; margin-left: 10px; }
.progression-track { display: flex; gap: 10px; overflow-x: auto; min-height: 80px; padding: 5px 0; align-items: flex-start; }
.empty-track-msg { color: #888; font-style: italic; display: flex; align-items: center; justify-content: center; width: 100%; }

.prog-block { background-color: #3d3d3d; border: 2px solid #555; padding: 10px; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 120px; cursor: pointer; transition: all 0.2s; position: relative; gap: 4px; }
.prog-block:hover { background-color: #4d4d4d; }
.prog-block.playing { border-color: var(--color-active-btn); background-color: rgba(52, 152, 219, 0.2); box-shadow: 0 0 10px rgba(52, 152, 219, 0.5); transform: scale(1.05); z-index: 10; }
.prog-block .label { font-weight: bold; font-size: 15px; color: #fff; pointer-events: none; margin-bottom: 2px;}

.block-select { font-size: 11px; padding: 2px 4px; background-color: #1e1e1e; color: #ddd; border: 1px solid #555; border-radius: 3px; width: 100%; text-align: center; }

.prog-block .remove-btn { position: absolute; top: -8px; right: -8px; background: #c0392b; color: #fff; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 10px; opacity: 0; transition: opacity 0.2s; border: 1px solid #e74c3c; cursor: pointer; z-index: 5;}
.prog-block:hover .remove-btn { opacity: 1; }

.prog-block.dragging { opacity: 0.5; }
.prog-block.drag-over { border-color: #2ecc71; transform: scale(1.05); }