/* Jazz Changes Trainer - Vintage Jazz Club Aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Jazz Palette - warm paper tones */
    --bg-deep: #f8f5f0;
    --bg-card: #ffffff;
    --bg-card-elevated: #f3efe8;
    --accent-brass: #b8860b;
    --accent-coral: #c75d48;
    --accent-blue: #4a6fa5;
    --text-cream: #1a1a1a;
    --text-muted: #6b7280;
    --text-warm: #4a4035;

    /* Note colors - rich but visible on light */
    --root-color: #c75d48;
    --chord-tone-color: #b8860b;
    --tension-color: #7c5cbf;
    --scale-tone-color: #2a7d8c;
    --avoid-color: #9ca3af;

    /* Fretboard */
    --fret-color: #d1ccc4;
    --string-color: #8b7355;
    --nut-color: #2d2a26;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-deep);
    color: var(--text-cream);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Subtle paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.025;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    z-index: 1000;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 30px;
    position: relative;
}

/* Header - Editorial Style */
header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

header::before {
    content: '♪';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: var(--accent-brass);
    opacity: 0.6;
}

header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4.5rem;
    font-weight: 400;
    letter-spacing: 8px;
    text-transform: uppercase;
    color: var(--text-cream);
    line-height: 1;
    margin-bottom: 12px;
    background: linear-gradient(180deg, var(--text-cream) 0%, var(--text-warm) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.mobile-hint {
    display: none;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 12px;
    opacity: 0.7;
}

/* Chord Display - Hero Section */
.chord-display {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 2px;
    margin-bottom: 35px;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.current-chord {
    flex: 1;
    text-align: center;
    padding: 35px 45px;
    background: linear-gradient(135deg, var(--bg-card-elevated) 0%, var(--bg-card) 100%);
    position: relative;
}

.current-chord::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--accent-brass), transparent);
    opacity: 0.3;
}

.scale-info {
    flex: 1;
    text-align: center;
    padding: 35px 45px;
    background: var(--bg-card);
}

.chord-label, .scale-label {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.chord-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4.5rem;
    font-weight: 400;
    color: var(--accent-brass);
    display: block;
    line-height: 1;
    letter-spacing: 2px;
}

.chord-function {
    font-family: 'Instrument Serif', serif;
    font-size: 1.6rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
    display: block;
}

.scale-name {
    font-family: 'Instrument Serif', serif;
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--scale-tone-color);
    display: block;
    font-style: italic;
}

/* Fretboard - The Instrument */
.fretboard-container {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-card-elevated) 100%);
    padding: 35px 25px 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    overflow-x: auto;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

/* Fretboard wood grain effect */
.fretboard-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(184, 165, 137, 0.02) 2px,
        rgba(184, 165, 137, 0.02) 4px
    );
    pointer-events: none;
    border-radius: 16px;
}

.fretboard {
    display: grid;
    grid-template-rows: repeat(6, 42px);
    gap: 2px;
    min-width: 850px;
    position: relative;
}

.string {
    display: grid;
    grid-template-columns: 55px repeat(15, 1fr);
    align-items: center;
    position: relative;
}

.string::after {
    content: '';
    position: absolute;
    left: 55px;
    right: 0;
    top: 50%;
    height: 2px;
    background: linear-gradient(to right, var(--string-color), rgba(184, 165, 137, 0.4));
    z-index: 0;
    border-radius: 1px;
}

/* String thickness variation */
.string:nth-child(1)::after { height: 1px; opacity: 0.9; }
.string:nth-child(2)::after { height: 1.5px; opacity: 0.85; }
.string:nth-child(3)::after { height: 2px; opacity: 0.8; }
.string:nth-child(4)::after { height: 2.5px; opacity: 0.75; }
.string:nth-child(5)::after { height: 3px; opacity: 0.7; }
.string:nth-child(6)::after { height: 3.5px; opacity: 0.65; }

.open-note {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-warm);
    text-align: center;
    z-index: 1;
    letter-spacing: 1px;
}

.fret {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 2px solid var(--fret-color);
    z-index: 1;
}

.fret:first-of-type {
    border-left: 5px solid var(--nut-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.note {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    letter-spacing: 0.5px;
}

.note:hover {
    transform: scale(1.25);
}

.note.root {
    background: var(--root-color);
    color: white;
    box-shadow: 0 2px 8px rgba(199, 93, 72, 0.4);
}

.note.chord-tone {
    background: var(--chord-tone-color);
    color: white;
    box-shadow: 0 2px 8px rgba(184, 134, 11, 0.4);
}

.note.tension {
    background: var(--tension-color);
    color: white;
    box-shadow: 0 2px 6px rgba(124, 92, 191, 0.3);
}

.note.scale-tone {
    background: var(--scale-tone-color);
    color: white;
    box-shadow: 0 2px 6px rgba(42, 125, 140, 0.3);
}

.note.avoid {
    background: var(--avoid-color);
    color: var(--text-muted);
    opacity: 0.5;
}

.note.hidden {
    opacity: 0;
    pointer-events: none;
}

.fret-numbers {
    display: grid;
    grid-template-columns: 55px repeat(15, 1fr);
    margin-top: 15px;
    min-width: 850px;
}

.fret-number {
    text-align: center;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.fret-number.marker {
    color: var(--accent-brass);
    font-weight: 600;
    opacity: 1;
}

/* Legend - Refined */
.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
    margin-bottom: 35px;
    padding: 0 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dot.root { background: var(--root-color); }
.dot.chord-tone { background: var(--chord-tone-color); }
.dot.tension { background: var(--tension-color); }
.dot.scale-tone { background: var(--scale-tone-color); }
.dot.avoid { background: var(--avoid-color); }

/* Sections - Card Style */
section:not(.chord-display):not(.fretboard-container):not(.legend) {
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 25px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Progression Section */
.progression-section {
    padding: 30px;
}

.progression-section h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.progression-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 25px;
}

.progression-chord {
    padding: 14px 24px;
    background: var(--bg-card-elevated);
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: var(--text-cream);
}

.progression-chord:hover {
    background: var(--accent-blue);
    border-color: rgba(212, 168, 83, 0.2);
}

.progression-chord.active {
    background: var(--accent-brass);
    color: white;
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(184, 134, 11, 0.35);
}

.progression-select, .key-select {
    display: inline-block;
    margin-right: 25px;
    margin-top: 5px;
}

.progression-select label, .key-select label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 10px;
    letter-spacing: 1px;
}

select {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--fret-color);
    background: var(--bg-card-elevated);
    color: var(--text-cream);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

select:hover, select:focus {
    border-color: var(--accent-brass);
    outline: none;
}

/* Controls */
.controls {
    padding: 30px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 35px;
}

.tempo-control {
    flex: 1;
    min-width: 220px;
}

.tempo-control label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

#tempoValue {
    color: var(--accent-brass);
    font-weight: 600;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--bg-card-elevated);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-brass);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(184, 134, 11, 0.35);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.beats-control label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 10px;
    letter-spacing: 1px;
}

.playback-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 14px 35px;
    border: none;
    border-radius: 10px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--accent-brass);
    color: white;
    box-shadow: 0 4px 15px rgba(184, 134, 11, 0.25);
}

.btn-primary:hover {
    background: #a07a0a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(184, 134, 11, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card-elevated);
    color: var(--text-cream);
    border: 1px solid var(--fret-color);
}

.btn-secondary:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Tips Section */
.tips-section {
    padding: 30px;
}

.tips-section h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 15px;
    color: var(--text-muted);
}

.tip {
    font-family: 'Instrument Serif', serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-cream);
}

.tip strong {
    color: var(--accent-coral);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
}

/* Theory Section */
.theory-section {
    padding: 30px;
}

.theory-section h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.theory-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.interval-row {
    background: var(--bg-card-elevated);
    padding: 16px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.interval-row:hover {
    border-color: rgba(212, 168, 83, 0.2);
}

.interval-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.interval-note {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 1px;
    color: var(--text-cream);
}

.interval-row.tensions {
    opacity: 0.6;
}

.interval-row.tensions .interval-note {
    color: var(--tension-color);
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .container {
        padding: 25px 20px;
    }

    header h1 {
        font-size: 3rem;
        letter-spacing: 5px;
    }

    .subtitle {
        font-size: 1rem;
    }

    .chord-display {
        flex-direction: column;
        gap: 0;
    }

    .current-chord::after {
        display: none;
    }

    .current-chord, .scale-info {
        padding: 25px;
    }

    .chord-name {
        font-size: 3.5rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 25px;
    }

    .playback-buttons {
        justify-content: center;
    }

    .progression-select, .key-select {
        display: block;
        margin-bottom: 15px;
    }

    .legend {
        gap: 15px;
    }

    .legend-item {
        font-size: 0.8rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .container {
        padding: 15px 12px;
    }

    header {
        margin-bottom: 30px;
    }

    header::before {
        display: none;
    }

    header h1 {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }

    .subtitle {
        font-size: 0.9rem;
        letter-spacing: 1px;
    }

    .chord-display {
        flex-direction: row;
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .current-chord, .scale-info {
        padding: 18px 15px;
    }

    .chord-label, .scale-label {
        font-size: 0.6rem;
        letter-spacing: 2px;
    }

    .chord-name {
        font-size: 2.5rem;
    }

    .chord-function {
        font-size: 1.2rem;
        margin-top: 4px;
    }

    .scale-name {
        font-size: 1.2rem;
    }

    .fretboard-container {
        padding: 20px 12px 15px;
        margin-bottom: 20px;
        border-radius: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .fretboard {
        grid-template-rows: repeat(6, 38px);
        min-width: 650px;
    }

    .string {
        grid-template-columns: 40px repeat(15, 1fr);
    }

    .string::after {
        left: 40px;
    }

    .open-note {
        font-size: 0.7rem;
    }

    .note {
        width: 30px;
        height: 30px;
        font-size: 0.6rem;
    }

    .fret-numbers {
        grid-template-columns: 40px repeat(15, 1fr);
        min-width: 650px;
    }

    .fret-number {
        font-size: 0.65rem;
    }

    .legend {
        gap: 10px;
        margin-bottom: 20px;
        justify-content: space-around;
    }

    .legend-item {
        font-size: 0.7rem;
        gap: 6px;
    }

    .legend-item span:last-child {
        display: none;
    }

    .dot {
        width: 12px;
        height: 12px;
    }

    section:not(.chord-display):not(.fretboard-container):not(.legend) {
        border-radius: 12px;
        margin-bottom: 15px;
    }

    .progression-section,
    .controls,
    .tips-section,
    .theory-section {
        padding: 20px 18px;
    }

    .progression-section h2,
    .tips-section h2,
    .theory-section h2 {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }

    .progression-display {
        gap: 8px;
        margin-bottom: 18px;
    }

    .progression-chord {
        padding: 12px 18px;
        font-size: 1.3rem;
        border-radius: 8px;
    }

    select {
        padding: 12px 14px;
        font-size: 16px;
        border-radius: 8px;
    }

    .controls {
        gap: 20px;
    }

    .tempo-control {
        min-width: 100%;
    }

    .btn {
        padding: 16px 28px;
        font-size: 1rem;
        flex: 1;
        border-radius: 8px;
    }

    .playback-buttons {
        width: 100%;
    }

    .tip {
        font-size: 1rem;
        line-height: 1.6;
    }

    .theory-display {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }

    .interval-row {
        padding: 12px 14px;
        min-width: 75px;
        flex-shrink: 0;
        border-radius: 8px;
    }

    .interval-label {
        font-size: 0.6rem;
    }

    .interval-note {
        font-size: 1.5rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .mobile-hint {
        display: block;
    }

    .note {
        min-width: 34px;
        min-height: 34px;
    }

    .note:active {
        transform: scale(1.2);
    }

    .note.root:active {
        box-shadow: 0 0 30px rgba(224, 122, 95, 0.6);
    }

    .note.chord-tone:active {
        box-shadow: 0 0 30px rgba(212, 168, 83, 0.6);
    }

    .progression-chord:active {
        background: var(--accent-brass);
        color: var(--bg-deep);
        transform: scale(1.05);
    }

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

    .note:hover {
        transform: none;
    }

    .note.root:hover {
        box-shadow: 0 0 20px rgba(224, 122, 95, 0.5);
    }

    .note.chord-tone:hover {
        box-shadow: 0 0 15px rgba(212, 168, 83, 0.4);
    }

    .btn:hover {
        transform: none;
    }

    .btn-primary:hover {
        box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3);
    }

    .progression-chord:hover {
        background: var(--bg-card-elevated);
    }
}

/* Smooth scrollbar for fretboard */
.fretboard-container::-webkit-scrollbar {
    height: 6px;
}

.fretboard-container::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 3px;
}

.fretboard-container::-webkit-scrollbar-thumb {
    background: var(--fret-color);
    border-radius: 3px;
}

.fretboard-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Animation for chord changes */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 15px rgba(184, 134, 11, 0.35); }
    50% { box-shadow: 0 6px 25px rgba(184, 134, 11, 0.5); }
}

.progression-chord.active {
    animation: pulse-glow 2s ease-in-out infinite;
}
