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

/* Tooltips */
.has-tooltip {
    position: relative;
    border-bottom: 1px dotted #999;
    cursor: help;
}

.tooltip-text {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #2c2c2c;
    color: #f5f5f0;
    font-size: 0.8rem;
    line-height: 1.4;
    border-radius: 2px;
    white-space: normal;
    width: 220px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 100;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-style: normal;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #2c2c2c;
}

.has-tooltip:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: #f5f5f0;
    min-height: 100vh;
    padding: 40px 20px;
    color: #2c2c2c;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: #2c2c2c;
    margin-bottom: 50px;
    padding-bottom: 20px;
    border-bottom: 2px solid #d4d4ce;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 12px;
    font-weight: 400;
    letter-spacing: 1px;
    color: #1a1a1a;
}

.subtitle {
    font-size: 1rem;
    color: #666;
    font-style: italic;
    font-weight: 300;
}

main {
    background: #ffffff;
    border-radius: 4px;
    padding: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e4;
}

/* Controls */
.controls {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    padding-bottom: 30px;
    border-bottom: 1px solid #e8e8e4;
}

.control-group {
    flex: 1;
    min-width: 200px;
}

.control-group label {
    display: block;
    font-weight: 400;
    margin-bottom: 10px;
    color: #444;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.control-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 15px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Georgia', serif;
    color: #333;
}

.control-group select:hover {
    border-color: #999;
    background: #fff;
}

.control-group select:focus {
    outline: none;
    border-color: #666;
    background: #fff;
}

/* Key Info */
.key-info {
    margin-bottom: 50px;
    text-align: center;
}

.key-info h2 {
    color: #1a1a1a;
    font-size: 1.8rem;
    margin-bottom: 25px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.scale-notes {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.scale-note {
    background: #2c2c2c;
    color: #f5f5f0;
    padding: 10px 18px;
    border-radius: 2px;
    font-size: 1.1rem;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.scale-note sub {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: 3px;
}

/* Sections */
section {
    margin-bottom: 50px;
}

section h3 {
    font-size: 1.3rem;
    margin-bottom: 25px;
    color: #1a1a1a;
    font-weight: 400;
    letter-spacing: 0.5px;
    padding-bottom: 12px;
    border-bottom: 1px solid #d4d4ce;
}

/* Chords Grid */
.chords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.chord-card {
    background: #fafafa;
    border: 1px solid #d4d4ce;
    border-radius: 2px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.chord-card:hover {
    background: #fff;
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chord-card:hover .chord-notes-tooltip {
    opacity: 1;
    visibility: visible;
}

.chord-card.active {
    background: #fff;
    border-color: #2c2c2c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.chord-card.compatible {
    background: #f0f7f0;
    border-color: #5a7d5a;
    box-shadow: 0 2px 6px rgba(90, 125, 90, 0.15);
}

.chord-card.compatible::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    color: #5a7d5a;
    font-size: 0.9rem;
    font-weight: bold;
}

.chord-card.maj {
    border-left: 3px solid #5a7d5a;
}

.chord-card.min {
    border-left: 3px solid #5a6d8a;
}

.chord-card.dim {
    border-left: 3px solid #8a6d5a;
}

.chord-card.aug {
    border-left: 3px solid #8a5a6d;
}

.chord-roman {
    font-size: 1.6rem;
    font-weight: 400;
    color: #1a1a1a;
    margin-bottom: 8px;
    font-family: 'Georgia', serif;
}

.chord-name {
    font-size: 1.2rem;
    font-weight: 400;
    color: #555;
    margin-bottom: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.chord-function {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    font-family: 'Georgia', serif;
}

.chord-notes-tooltip {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c2c2c;
    color: #f5f5f0;
    padding: 6px 12px;
    border-radius: 2px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.chord-notes-tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #2c2c2c;
}

/* Progressions */
.progressions-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.progression-card {
    background: #fafafa;
    border-radius: 2px;
    padding: 20px;
    border: 1px solid #d4d4ce;
    border-left: 3px solid #2c2c2c;
    transition: all 0.2s;
}

.progression-card:hover {
    background: #fff;
    border-color: #999;
}

.progression-card.highlighted {
    background: #fff;
    border-color: #2c2c2c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.progression-name {
    font-size: 1.1rem;
    font-weight: 400;
    color: #1a1a1a;
    margin-bottom: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.progression-chords {
    font-size: 1rem;
    color: #444;
    margin-bottom: 6px;
    font-family: 'Georgia', serif;
}

.progression-roman {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

.progression-desc {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

/* Modulation */
.modulation-section {
    text-align: center;
}

.modulation-explanation {
    max-width: 700px;
    margin: 0 auto 25px;
    color: #555;
    line-height: 1.6;
    text-align: left;
    font-size: 0.95rem;
}

.modulation-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.modulation-card {
    background: #fafafa;
    border-radius: 2px;
    padding: 20px;
    border: 1px solid #d4d4ce;
    border-left: 3px solid #5a6d8a;
    transition: all 0.2s;
    cursor: pointer;
    text-align: left;
}

.modulation-card:hover {
    background: #fff;
    border-color: #999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.modulation-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.modulation-name {
    font-size: 1.1rem;
    font-weight: 400;
    color: #1a1a1a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.modulation-key {
    font-size: 1rem;
    font-weight: 400;
    color: #5a6d8a;
    font-family: 'Georgia', serif;
}

.modulation-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 6px;
    font-style: italic;
}

.modulation-relationship {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
}

.pivot-chords {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e8e8e4;
    font-size: 0.85rem;
    color: #555;
}

.pivot-chord {
    display: inline-block;
    background: #fff;
    padding: 4px 8px;
    margin: 4px 4px 0 0;
    border-radius: 2px;
    border: 1px solid #d4d4ce;
    font-family: 'Georgia', serif;
    font-size: 0.8rem;
}

/* Relationships */
.relationships-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.relationship-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background: #fafafa;
    border-radius: 2px;
    border: 1px solid #d4d4ce;
}

.rel-from, .rel-to {
    font-weight: 400;
    font-size: 1rem;
    color: #1a1a1a;
    background: white;
    padding: 8px 15px;
    border-radius: 2px;
    border: 1px solid #999;
    font-family: 'Georgia', serif;
}

.rel-arrow {
    font-size: 1.3rem;
    color: #999;
}

.rel-label {
    flex: 1;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* Circle of Fifths */
.circle-of-fifths-section {
    text-align: center;
}

.circle-explanation {
    max-width: 700px;
    margin: 0 auto 25px;
    color: #555;
    line-height: 1.8;
    text-align: left;
    font-size: 0.95rem;
}

.circle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.circle-svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

/* Interactive circle keys */
.circle-key {
    transition: all 0.2s ease;
}

.circle-key:hover:not(.active) {
    filter: brightness(0.96);
    stroke-width: 2.5;
}

.circle-key-major:hover:not(.active) {
    fill: #f0f0eb;
}

.circle-key-minor:hover:not(.active) {
    fill: #f0f0eb;
}

.circle-info {
    max-width: 600px;
    margin-top: 10px;
    padding: 15px;
    background: #fafafa;
    border-radius: 2px;
    color: #666;
    font-size: 0.9rem;
    border: 1px solid #e8e8e4;
}

.circle-legend {
    display: flex;
    gap: 30px;
    font-size: 0.85rem;
    color: #666;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid;
}

.legend-dot.major {
    background: #5a7d5a;
    border-color: #3d5a3d;
}

.legend-dot.minor {
    background: #5a6d8a;
    border-color: #3d4d66;
}

/* Footer */
footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #d4d4ce;
    text-align: center;
}

.support-section {
    margin-bottom: 20px;
}

.support-text {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 15px;
    font-style: italic;
}

.kofi-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2c2c2c;
    color: #f5f5f0;
    padding: 11px 22px;
    border-radius: 2px;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 0.3px;
}

.kofi-button:hover {
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.kofi-button svg {
    width: 16px;
    height: 16px;
}

.footer-credit {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 30px 25px;
    }

    .controls {
        flex-direction: column;
    }

    .chords-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .progressions-container {
        grid-template-columns: 1fr;
    }

    .relationships-grid {
        grid-template-columns: 1fr;
    }

    .kofi-button {
        font-size: 0.85rem;
        padding: 10px 18px;
    }
}
