/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
}

/* Container and Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #4a6741 100%);
    color: white;
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
}

.logo-emblem {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    transition: transform 0.3s ease;
    object-fit: contain;
    background: white;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo-image:hover {
    transform: scale(1.1);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-main {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.logo-sub {
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-top: -2px;
}

.logo-icon {
    font-size: 1.5rem;
    color: #f39c12;
    margin-left: 0.5rem;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: #f39c12;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: #f39c12;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Search and Theme Toggle Buttons */
.search-trigger,
.theme-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    margin-left: 1rem;
}

.search-trigger:hover,
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f39c12;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #2c3e50, #4a6741);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
    
    .nav.active {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        padding: 1rem 0;
        gap: 0;
    }
    
    .nav-list li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-link {
        display: block;
        padding: 1rem 2rem;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .logo {
        gap: 0.5rem;
    }
    
    .logo-image {
        width: 42px;
        height: 42px;
    }
    
    .logo-main {
        font-size: 1.1rem;
    }
    
    .logo-sub {
        font-size: 0.8rem;
    }
    
    .logo-icon {
        font-size: 1.3rem;
    }
    
    /* Enhanced Mobile Responsive Design */
    .hero {
        padding: 30px 0 60px;
    }
    
    .hero-title {
        font-size: 1.2rem; /* Reduced from 1.4rem */
        line-height: 1.1;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem; /* Slightly smaller subtitle */
        margin-bottom: 1.5rem; /* Reduced margin */
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .content-card {
        padding: 2rem 1.5rem; /* Better padding for mobile */
    }
    
    .intro-text {
        font-size: 1.1rem;
    }
    
    .harmony-types,
    .element-grid,
    .motion-types,
    .rhythm-grid,
    .benefits-grid {
        grid-template-columns: 1fr;
    }
    
    /* Enhanced mobile styles for fundamentals section - FIXED for content compression */
    .fundamental-section {
        padding: 2rem 1.5rem; /* Increased padding for better readability */
        margin-bottom: 2.5rem;
        border-radius: 10px;
        /* Ensure proper spacing and prevent content cutoff */
        min-height: auto;
        overflow: visible;
    }
    
    .fundamental-section h3 {
        font-size: 1.4rem; /* Slightly larger heading for better hierarchy */
        margin-bottom: 2rem;
        text-align: center;
        justify-content: center;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .subsection {
        margin-bottom: 2rem; /* More space between subsections */
        overflow: visible;
        width: 100%;
    }
    
    .subsection h4 {
        font-size: 1.2rem; /* Larger mobile font for better readability */
        margin-bottom: 1rem;
        line-height: 1.3;
        word-wrap: break-word;
        color: #2c3e50;
    }
    
    .subsection h5 {
        font-size: 1.1rem; /* Larger font for h5 */
        margin-bottom: 0.75rem;
        line-height: 1.3;
        word-wrap: break-word;
        color: #2c3e50;
    }
    
    .subsection p {
        font-size: 1rem; /* Better readability */
        line-height: 1.6;
        margin-bottom: 1.2rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .subsection ul {
        margin: 1.2rem 0;
        padding-left: 1.5rem;
    }
    
    .subsection ul li {
        margin-bottom: 0.75rem;
        line-height: 1.6;
        font-size: 1rem;
        word-wrap: break-word;
    }
    
    /* Mobile-optimized grids for fundamentals - IMPROVED LAYOUT */
    .keys-explanation {
        grid-template-columns: 1fr;
        gap: 1.5rem; /* More space between cards */
        margin: 2rem 0; /* Better vertical spacing */
        width: 100%;
    }
    
    .key-type {
        padding: 1.5rem; /* Better padding for mobile */
        border-radius: 10px;
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
        overflow-x: auto; /* Enable horizontal scrolling */
        background: white;
        border-left: 5px solid #f39c12;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow for definition */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        scroll-behavior: smooth; /* Smooth scrolling behavior */
        white-space: normal; /* Allow text to wrap */
    }
    
    .key-type h5 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
        color: #2c3e50;
        line-height: 1.3;
        white-space: normal; /* Allow title to wrap */
    }
    
    .key-type p {
        font-size: 1rem;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
        min-width: 280px; /* Ensure content has minimum width for scrolling */
        white-space: normal; /* Allow text to wrap properly */
    }
    
    .scale-types {
        grid-template-columns: 1fr;
        gap: 2rem; /* More space between scale type cards */
        margin: 2rem 0;
        width: 100%;
    }
    
    .scale-type {
        padding: 1.5rem;
        border-radius: 10px;
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
        overflow-x: auto; /* Enable horizontal scrolling */
        background: white;
        border: 2px solid #e9ecef;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .scale-type h5 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
        color: #2c3e50;
        line-height: 1.3;
    }
    
    .scale-type p {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        min-width: 280px; /* Ensure content has minimum width for scrolling */
    }
    
    .chord-types {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 2rem 0;
        width: 100%;
    }
    
    .chord-type {
        padding: 1.5rem;
        border-radius: 10px;
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
        overflow-x: auto; /* Enable horizontal scrolling */
        background: white;
        border: 2px solid #e9ecef;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .chord-type h5 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
        color: #2c3e50;
        line-height: 1.3;
    }
    
    .chord-type p {
        font-size: 1rem;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
        min-width: 280px; /* Ensure content has minimum width for scrolling */
    }
    
    .scale-degrees {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Slightly larger minimum */
        gap: 1rem;
        margin: 2rem 0;
        width: 100%;
    }
    
    .degree {
        font-size: 0.9rem; /* Better readability */
        padding: 1rem;
        border-radius: 8px;
        text-align: center;
        border: 2px solid #f39c12;
        background: white;
        word-wrap: break-word;
        line-height: 1.3;
        min-height: auto;
    }
    
    .modes-list {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 2rem 0;
        width: 100%;
    }
    
    .mode {
        font-size: 0.9rem;
        padding: 1rem;
        border-radius: 8px;
        background: white;
        border-left: 4px solid #f39c12;
        word-wrap: break-word;
        line-height: 1.3;
        text-align: left;
        min-height: auto;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .learning-progress {
        /* Override tablet styles for better mobile layout */
        bottom: 20px !important;
        left: 15px !important;
        right: 15px !important;
        width: auto !important;
        padding: 0.75rem !important;
        font-size: 0.85rem !important;
    }
    
    .learning-progress .progress-header {
        margin-bottom: 0.5rem;
        padding-bottom: 0.25rem;
    }
    
    .learning-progress .progress-header h4 {
        font-size: 0.9rem;
    }
    
    .learning-progress .progress-section {
        font-size: 0.8rem;
        padding: 0.2rem 0;
    }
    
    .search-box {
        width: 95%;
    }
    
    /* Add scrolling indication for mobile */
    .key-type, .scale-type, .chord-type {
        position: relative;
    }
    
    .key-type:after, .scale-type:after, .chord-type:after {
        content: '→';
        position: absolute;
        right: 10px;
        top: 10px;
        color: #f39c12;
        font-size: 1.2rem;
        opacity: 0.7;
        animation: pulse 2s infinite;
        pointer-events: none;
        display: none; /* Hidden by default, shown when content overflows */
    }
    
    .key-type.overflow:after, .scale-type.overflow:after, .chord-type.overflow:after {
        display: block;
    }
    
    @keyframes pulse {
        0% { opacity: 0.7; }
        50% { opacity: 0.3; }
        100% { opacity: 0.7; }
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    /* Keep logo text visible on mobile - adjust layout instead */
    .logo {
        gap: 0.3rem;
        flex-wrap: wrap;
    }
    
    .logo-image {
        width: 38px;
        height: 38px;
    }
    
    .logo-main {
        font-size: 0.95rem;
    }
    
    .logo-sub {
        font-size: 0.75rem;
    }
    
    .logo-icon {
        font-size: 1.1rem;
        margin-left: 0.2rem;
    }
    
    .hero {
        padding: 25px 0 60px; /* Further reduced from 40px to 25px top padding for small mobile devices */
    }
    
    .hero-title {
        font-size: 1.1rem; /* Reduced from 1.2rem (implicit) for very compact mobile layout */
        line-height: 1.1;
        margin-bottom: 0.4rem;
    }
    
    .section {
        padding: 60px 0;
    }
    
    .content-card {
        padding: 1.5rem 1rem; /* Optimized for small screens */
    }
    
    .btn {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
    
    /* Extra small screen adjustments for fundamentals - IMPROVED FOR CONTENT VISIBILITY */
    .fundamental-section {
        padding: 1.5rem 1rem; /* Compact but readable */
        margin-bottom: 2rem;
        border-radius: 10px;
        min-height: auto;
        overflow: visible;
    }
    
    .fundamental-section h3 {
        font-size: 1.3rem; /* Balanced size for small screens */
        margin-bottom: 1.5rem;
        flex-direction: column;
        text-align: center;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .subsection {
        margin-bottom: 1.5rem;
        overflow: visible;
        width: 100%;
    }
    
    .subsection h4 {
        font-size: 1.1rem; /* Clear hierarchy */
        margin-bottom: 0.75rem;
        line-height: 1.3;
        word-wrap: break-word;
        color: #2c3e50;
    }
    
    .subsection h5 {
        font-size: 1rem; /* Readable on small screens */
        margin-bottom: 0.5rem;
        line-height: 1.3;
        word-wrap: break-word;
        color: #2c3e50;
    }
    
    .subsection p {
        font-size: 0.95rem; /* Slightly smaller but still readable */
        line-height: 1.6;
        margin-bottom: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .subsection ul {
        margin: 1rem 0;
        padding-left: 1.25rem;
    }
    
    .subsection ul li {
        margin-bottom: 0.5rem;
        line-height: 1.5;
        font-size: 0.95rem;
        word-wrap: break-word;
    }
    
    /* Optimized grids for extra small screens */
    .keys-explanation {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin: 1.5rem 0;
        width: 100%;
    }
    
    .key-type {
        padding: 1.25rem 1rem; /* Compact but comfortable */
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
        overflow: visible;
        background: white;
        border-left: 4px solid #f39c12;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .key-type h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        color: #2c3e50;
        line-height: 1.3;
    }
    
    .key-type p {
        font-size: 0.95rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .scale-types {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 1.5rem 0;
        width: 100%;
    }
    
    .scale-type {
        padding: 1.25rem 1rem;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
        overflow: visible;
        background: white;
        border: 2px solid #e9ecef;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .scale-type h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        color: #2c3e50;
        line-height: 1.3;
    }
    
    .scale-type p {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .chord-types {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin: 1.5rem 0;
        width: 100%;
    }
    
    .chord-type {
        padding: 1.25rem 1rem;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
        overflow: visible;
        background: white;
        border: 2px solid #e9ecef;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .chord-type h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        color: #2c3e50;
        line-height: 1.3;
    }
    
    .chord-type p {
        font-size: 0.95rem;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .scale-degrees {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Flexible for small screens */
        gap: 0.75rem;
        margin: 1.5rem 0;
        width: 100%;
    }
    
    .degree {
        font-size: 0.85rem; /* Compact but readable */
        padding: 0.75rem 0.5rem;
        border-radius: 6px;
        text-align: center;
        border: 2px solid #f39c12;
        background: white;
        word-wrap: break-word;
        line-height: 1.2;
        min-height: auto;
    }
    
    .modes-list {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin: 1.5rem 0;
        width: 100%;
    }
    
    .mode {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
        border-radius: 6px;
        background: white;
        border-left: 4px solid #f39c12;
        word-wrap: break-word;
        line-height: 1.3;
        text-align: left;
        min-height: auto;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .learning-progress {
        display: none;
    }
}

/* Extra aggressive mobile optimization for very small screens */
@media (max-width: 360px) {
    .hero {
        padding: 20px 0 40px; /* Further reduced from 30px to 20px for tiny screens */
        margin-top: 50px; /* Reduced margin top from 60px to 50px */
    }
    
    .hero-title {
        font-size: 0.9rem; /* Reduced from 1rem (implicit) */
        line-height: 1.1;
        margin-bottom: 0.3rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .container {
        padding: 0 10px; /* Even tighter container padding */
    }
}

/* Search Container */
.search-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-container.active {
    opacity: 1;
    visibility: visible;
}

.search-box {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.search-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.2rem;
    padding: 1rem;
    background: transparent;
}

.search-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
}

.search-results {
    background: white;
    margin-top: 1rem;
    border-radius: 10px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.search-result {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-result:hover {
    background: #f8f9fa;
}

.search-result h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.search-result p {
    color: #666;
    font-size: 0.9rem;
}

.no-results {
    padding: 2rem;
    text-align: center;
    color: #666;
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 999;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f39c12, #e67e22);
    width: 0%;
    transition: width 0.3s ease;
}

/* Learning Progress Tracker */
.learning-progress {
    position: fixed;
    bottom: 100px;
    left: 30px;
    background: white;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    width: 250px;
    z-index: 1000;
    border-left: 5px solid #f39c12;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.progress-header h4 {
    color: #2c3e50;
    font-size: 1rem;
}

.progress-percentage {
    color: #f39c12;
    font-weight: 600;
}

.progress-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: #666;
}

.progress-section.completed {
    color: #27ae60;
}

.progress-section i {
    font-size: 1rem;
}

/* Tooltips */
.tooltip-term {
    border-bottom: 1px dotted #f39c12;
    cursor: help;
}

.custom-tooltip {
    position: absolute;
    background: #2c3e50;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    max-width: 250px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
}

.custom-tooltip.visible {
    opacity: 1;
}

/* Dark Theme */
.dark-theme {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.dark-theme .header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d3436 100%);
}

.dark-theme .section:nth-child(even),
.dark-theme .content-card,
.dark-theme .highlight-box,
.dark-theme .harmony-type,
.dark-theme .element,
.dark-theme .rhythm-element,
.dark-theme .benefit-item,
.dark-theme .fundamental-section,
.dark-theme .key-type,
.dark-theme .scale-type,
.dark-theme .chord-type,
.dark-theme .degree,
.dark-theme .mode {
    background-color: #2d3436;
    color: #e0e0e0;
}

.dark-theme .section-title,
.dark-theme .intro-text {
    color: #e0e0e0;
}

.dark-theme .learning-progress,
.dark-theme .search-box,
.dark-theme .search-results {
    background: #2d3436;
    color: #e0e0e0;
}

.dark-theme .search-result:hover {
    background: #3d4447;
}

.dark-theme .progress-header {
    border-bottom-color: #4a5568;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.9), rgba(74, 103, 65, 0.9)), 
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><defs><pattern id="music-notes" x="0" y="0" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="40" r="4" fill="rgba(255,255,255,0.1)"/><rect x="24" y="20" width="2" height="25" fill="rgba(255,255,255,0.1)"/><circle cx="60" cy="60" r="4" fill="rgba(255,255,255,0.1)"/><rect x="64" y="40" width="2" height="25" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23music-notes)"/></svg>');
    color: white;
    padding: 40px 0 100px; /* Further reduced from 60px to 40px top padding */
    text-align: center;
    margin-top: 60px; /* Reduced from 70px to 60px */
}

.hero-title {
    font-size: 2.8rem; /* Reduced from 3.5rem */
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background-color: #f39c12;
    color: white;
    border-color: #f39c12;
}

.btn-primary:hover {
    background-color: #e67e22;
    border-color: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: white;
    border-color: white;
}

.btn-secondary:hover {
    background-color: white;
    color: #2c3e50;
    transform: translateY(-2px);
}

/* Section Styles */
.section {
    padding: 80px 0; /* Restored original desktop padding */
}

.section:nth-child(even) {
    background-color: white;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: #2c3e50;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #f39c12, #e67e22);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}

/* Content Card Styles */
.content-card {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    max-width: 1000px;
}

.intro-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

/* Highlight Box */
.highlight-box {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-left: 5px solid #f39c12;
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 10px;
}

.highlight-box h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.feature-list {
    list-style: none;
    margin: 1rem 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.feature-list i {
    color: #f39c12;
}

/* Harmony Section */
.harmony-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.harmony-type {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.harmony-type:hover {
    border-color: #f39c12;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.harmony-type h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.harmony-type:first-child i {
    color: #e74c3c;
}

.harmony-type:last-child i {
    color: #27ae60;
}

/* Melody Section */
.melody-elements {
    margin: 2rem 0;
}

.element-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 1.5rem 0;
}

.element {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.element:hover {
    border-color: #f39c12;
    transform: translateY(-5px);
}

.element h4 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.element i {
    color: #f39c12;
}

.melody-motion {
    margin: 2rem 0;
}

.motion-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 1.5rem 0;
}

.motion-type {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    border-left: 5px solid #f39c12;
}

.motion-type h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* Rhythm Section */
.rhythm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.rhythm-element {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.rhythm-element:hover {
    border-color: #f39c12;
    transform: translateY(-3px);
}

.rhythm-element h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Benefits Section */
.benefits-note {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #f39c12;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    transition: all 0.3s ease;
}

.benefit-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.benefit-item i {
    color: #f39c12;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.important-note {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 1px solid #28a745;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
}

/* Theory Basics Section - Optimized for faster loading */
.fundamentals-sections {
    margin: 2rem 0;
}

.fundamental-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 2.5rem;
    margin-bottom: 3rem;
    border: 2px solid #e9ecef;
    overflow: hidden; /* Prevent content overflow */
    word-wrap: break-word; /* Handle long words */
    /* Remove any animation delays for instant loading */
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

.fundamental-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    flex-wrap: wrap; /* Allow wrapping on mobile */
}

.fundamental-section i {
    color: #f39c12;
    font-size: 1.3rem;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.subsection {
    margin-bottom: 2rem;
    width: 100%; /* Ensure full width */
    /* Ensure instant visibility */
    opacity: 1 !important;
    transform: none !important;
}

.subsection h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    word-wrap: break-word;
}

.subsection h5 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    word-wrap: break-word;
}

.subsection p {
    margin-bottom: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.subsection ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.subsection ul li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.keys-explanation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
    width: 100%;
}

.key-type {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 5px solid #f39c12;
    width: 100%;
    box-sizing: border-box;
    /* Ensure instant visibility for fundamentals */
    opacity: 1 !important;
    transform: none !important;
}

.scale-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 1.5rem 0;
    width: 100%;
}

.scale-type {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease, box-shadow 0.3s ease; /* Only transition hover effects */
    width: 100%;
    box-sizing: border-box;
    /* Ensure instant visibility for fundamentals */
    opacity: 1 !important;
    transform: none !important;
}

.scale-type:hover {
    border-color: #f39c12;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.scale-degrees {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    width: 100%;
}

.degree {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #f39c12;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
    word-wrap: break-word;
    /* Ensure instant visibility */
    opacity: 1 !important;
    transform: none !important;
}

.modes-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    width: 100%;
}

.mode {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #f39c12;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
    word-wrap: break-word;
    /* Ensure instant visibility */
    opacity: 1 !important;
    transform: none !important;
}

.chord-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
    width: 100%;
}

.chord-type {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease, transform 0.3s ease; /* Only transition hover effects */
    width: 100%;
    box-sizing: border-box;
    /* Ensure instant visibility for fundamentals */
    opacity: 1 !important;
    transform: none !important;
}

.chord-type:hover {
    border-color: #f39c12;
    transform: translateY(-3px);
}

.chord-type h5 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    word-wrap: break-word;
}

/* Note Styles */
.note {
    font-style: italic;
    color: #6c757d;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    word-wrap: break-word;
}

/* Conclusion Section */
.conclusion {
    text-align: center;
}

.call-to-action {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    margin-top: 2rem;
}

.call-to-action h3 {
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: #f39c12;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: #f39c12;
}

.footer-bottom {
    border-top: 1px solid #34495e;
    padding-top: 1rem;
    text-align: center;
    color: #bdc3c7;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: #e67e22;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
}

/* Animations - Optimized for fundamentals section */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-card {
    animation: fadeInUp 0.6s ease-out;
}

/* Remove animation for fundamentals section for instant loading */
#theory-basics .content-card,
#fundamentals .content-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .scroll-to-top,
    .hero-buttons,
    .search-container,
    .learning-progress,
    .reading-progress {
        display: none;
    }
    
    .hero {
        margin-top: 0;
        padding: 2rem 0;
        background: none;
        color: #000;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .content-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .fundamental-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Further mobile enhancements for keys sections */
@media (max-width: 768px) {
    .keys-explanation, .key-type {
        display: block; /* Force block display for mobile */
        width: 100%;
    }
    
    .key-type {
        width: auto; /* Auto width */
        max-width: 100%; /* Ensure it doesn't overflow the container */
        margin-left: 0;
        margin-right: 0;
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-x: auto !important; /* Force horizontal scrolling */
        -webkit-overflow-scrolling: touch;
    }
    
    .key-type p {
        min-width: auto; /* Allow natural width */
        width: auto; /* Let content wrap naturally */
        max-width: 100%; /* Constrain to container */
        white-space: normal !important; /* Force text wrapping */
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: none; /* Prevent hyphenation */
    }
    
    /* Same for scale and chord types */
    .scale-type p, .chord-type p {
        min-width: auto;
        width: auto;
        max-width: 100%;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: none;
    }
    
    /* Add visible scrollbar only if there's actual overflow */
    .key-type::-webkit-scrollbar {
        height: 4px;
        background-color: #f5f5f5;
    }
    
    .key-type::-webkit-scrollbar-thumb {
        background-color: #f39c12;
        border-radius: 2px;
    }
} 