* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --gold: #fbbf24;
    --gold-glow: rgba(251, 191, 36, 0.3);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(251, 191, 36, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.cof-container {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.cof-container header {
    text-align: center;
    padding: 30px 20px;
    position: relative;
}

.cof-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a0a0b0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.cof-container .subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

.main-content {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 20px;
}

/* Circle Container */
.circle-container {
    position: relative;
    width: 520px;
    height: 520px;
    flex-shrink: 0;
}

.circle-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 40px rgba(99, 102, 241, 0.15));
}

/* Info Panel */
.info-panel {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 24px;
    padding: 30px;
    min-width: 380px;
    max-width: 450px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.key-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.key-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.key-badge.major {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
}

.key-badge.minor {
    background: linear-gradient(135deg, #64748b, #94a3b8);
    color: white;
}

.relative-info {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 25px;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent);
}

.chords-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.chord-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.chord-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.chord-card.highlighted {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.chord-numeral {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.chord-name {
    font-size: 1.3rem;
    font-weight: 600;
}

.chord-quality {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Notes display */
.notes-container {
    margin-bottom: 25px;
}

.notes-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.note-badge {
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.note-badge.highlighted {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Guitar Fretboard */
.fretboard-container {
    margin-top: 25px;
}

.fretboard {
    background: linear-gradient(180deg, #2a1810, #1a0f08);
    border-radius: 12px;
    padding: 20px 15px;
    position: relative;
    overflow: hidden;
    border: 2px solid #3d2817;
}

.fretboard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 50px,
        rgba(0,0,0,0.1) 50px,
        rgba(0,0,0,0.1) 51px
    );
    pointer-events: none;
}

.strings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.string {
    display: flex;
    align-items: center;
    gap: 10px;
}

.string-label {
    width: 28px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.string-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, #c9a962, #d4b978, #c9a962);
    position: relative;
    border-radius: 1px;
}

.string-line.thick {
    height: 4px;
}

.fret-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
    transform: translate(-50%, -50%);
    top: 50%;
}

.fret-marker.active {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.fret-marker.in-scale {
    background: rgba(251, 191, 36, 0.9);
    color: #1a0f08;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.fret-marker.root {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.fret-marker.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Fret numbers */
.fret-numbers {
    display: flex;
    justify-content: flex-start;
    margin-left: 38px;
    margin-top: 10px;
    gap: 0;
}

.fret-number {
    width: 50px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Mask Controls */
.mask-controls {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.mask-slider {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-secondary);
    padding: 12px 25px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mask-slider label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.mask-slider input[type="range"] {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.mask-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Instructions */
.cof-container .instructions {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.cof-container .instructions strong {
    color: var(--text-primary);
}

/* Scale selector */
.scale-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.scale-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scale-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.scale-btn.active {
    background: linear-gradient(135deg, var(--gold), #f59e0b);
    color: #1a0f08;
    border-color: transparent;
}

/* Footer */
.cof-container footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
        align-items: center;
    }
    
    .circle-container {
        width: 450px;
        height: 450px;
    }
    
    .info-panel {
        min-width: auto;
        width: 100%;
        max-width: 500px;
    }
}

@media (max-width: 600px) {
    .circle-container {
        width: 350px;
        height: 350px;
    }
    
    .cof-container h1 {
        font-size: 1.8rem;
    }
    
    .info-panel {
        padding: 20px;
    }
    
    .chords-grid {
        grid-template-columns: 1fr;
    }
}

/* Rotation hint */
.rotation-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.circle-container:hover .rotation-hint {
    opacity: 0;
}

/* Key signature display */
.key-signature {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.accidental {
    font-size: 1.5rem;
    color: var(--gold);
}
