body {
    font-family: 'Inter', 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(140deg, #0a0a0a 0%, #1a1a1a 50%, #222 100%);
    color: #f2f2f2;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    font-feature-settings: 'liga' 1, 'kern' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main page scrollbar styling to match selection panel */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    border: 1px solid #333;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Navigation links */
.navigation-links {
    margin: 1rem 0 2rem 0;
    text-align: center;
}

.nav-link {
    display: inline-block;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.nav-link:hover {
    background: linear-gradient(135deg, #2980b9, #1f639a);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

::-webkit-scrollbar-thumb:active {
    background: #666;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    background: linear-gradient(to bottom right, rgba(28, 28, 28, 0.97), rgba(18, 18, 18, 0.95));
    padding: 40px 64px;
    border-radius: 20px;
    box-shadow: 
        0 12px 40px rgba(0,0,0,0.75),
        0 2px 4px rgba(255,255,255,0.03) inset;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.05);
}

h1, h2, h3 {
    color: #fff;
    font-family: 'Plus Jakarta Sans', 'SF Pro Display', system-ui, sans-serif;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    padding-bottom: 16px;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    margin-top: 1.5em;
    margin-bottom: 1em;
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    background: linear-gradient(90deg, #fff, #ccc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1.5em;
    max-width: 15ch;
}

a {
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    padding: 2px 4px;
}

a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255,255,255,0.4);
}

a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

a:hover::after {
    transform: scaleX(1);
}

ul.link-list {
    list-style-type: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

ul.link-list li {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.95), rgba(35, 35, 35, 0.92));
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.3),
        0 1px 2px rgba(255,255,255,0.02) inset;
    min-height: 44px;
    display: flex;
    align-items: center;
}

ul.link-list li:hover {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.97), rgba(40, 40, 40, 0.95));
    border-left: 4px solid rgba(255,255,255,0.9);
    transform: translateX(4px) translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(0,0,0,0.4),
        0 1px 2px rgba(255,255,255,0.03) inset;
}

ul.link-list li a {
    display: block;
    width: 100%;
    padding: 12px 0;
    font-size: 1.1em;
}

.play-card {
    background: linear-gradient(135deg, rgba(35, 35, 35, 0.97), rgba(25, 25, 25, 0.95));
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 
        0 4px 16px rgba(0,0,0,0.32),
        0 1px 2px rgba(255,255,255,0.02) inset;
    transform: translateY(0);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    display: grid;
    gap: 24px;
}

.play-card:hover {
    background: rgba(16, 16, 16, 1);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.55),
        0 1px 2px rgba(255,255,255,0.03) inset;
    border: 1px solid rgba(255,255,255,0.08);
}

.play-card img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    transition: transform 0.3s ease;
}

.play-card:hover img {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 24px 16px;
        margin: 0;
        border-radius: 12px;
    }

    ul.link-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
        margin-top: 0.8em;
        margin-bottom: 1em;
        max-width: 100%;
    }

    h3 {
        font-size: 1.3em;
        padding-bottom: 12px;
        margin-top: 1.2em;
        margin-bottom: 0.8em;
    }

    ul.link-list li {
        padding: 16px;
        min-height: 54px; /* Larger touch target on mobile */
    }

    ul.link-list li a {
        padding: 12px 0;
        font-size: 1.15em;
    }

    #searchInput {
        padding: 16px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        margin-bottom: 20px;
        border-radius: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

#searchInput {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid #333;
    border-radius: 12px;
    font-size: 1.1em;
    background: linear-gradient(to bottom, rgba(45, 45, 45, 0.95), rgba(40, 40, 40, 0.92));
    color: #f2f2f2;
    transition: all 0.3s ease;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.1) inset,
        0 1px 2px rgba(255,255,255,0.02);
    letter-spacing: 0.5px;
    -webkit-appearance: none;
    appearance: none;
}

#searchInput:focus {
    border-color: #fff;
    background: linear-gradient(to bottom, rgba(50, 50, 50, 0.97), rgba(45, 45, 45, 0.95));
    outline: none;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.15) inset,
        0 0 2px rgba(255,255,255,0.1);
    transform: scale(1.01);
}

#searchInput::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-result-group {
    margin-bottom: 2em;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 15px;
}

.search-result-group h4 {
    margin-bottom: 0.5em;
    color: #fff;
}

.search-result-group ul {
    padding-left: 20px;
}

/* Formation styling */
.formation-link {
    color: #4CAF50 !important;
    font-weight: bold;
    font-size: 1.1em;
    text-decoration: none;
}

.formation-link:hover {
    color: #66BB6A !important;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

/* Apply formation styling to back links to formations */
a[href*="formation-"] {
    color: #4CAF50 !important;
    font-weight: bold;
}

a[href*="formation-"]:hover {
    color: #66BB6A !important;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

/* Set styling */
.set-link {
    color: #2196F3 !important;
    font-weight: 600;
    font-size: 1.0em;
    text-decoration: none;
}

.set-link:hover {
    color: #42A5F5 !important;
    text-shadow: 0 0 8px rgba(33, 150, 243, 0.3);
}

/* Apply set styling to links to sets */
a[href*="set-"] {
    color: #2196F3 !important;
    font-weight: 600;
}

a[href*="set-"]:hover {
    color: #42A5F5 !important;
    text-shadow: 0 0 8px rgba(33, 150, 243, 0.3);
}

.set-label {
    color: #64B5F6;
    font-weight: 500;
    margin-right: 5px;
}

/* Play styling */
.play-link {
    color: #FF9800 !important;
    font-weight: normal;
    font-size: 0.95em;
    text-decoration: none;
}

.play-link:hover {
    color: #FFB74D !important;
    text-shadow: 0 0 8px rgba(255, 152, 0, 0.3);
}

/* Play titles on set pages */
.play-card h3 {
    color: #FF9800 !important;
    font-weight: 600;
}

.play-card:hover h3 {
    color: #FFB74D !important;
    text-shadow: 0 0 8px rgba(255, 152, 0, 0.3);
}

/* Enhanced list styling for better hierarchy */
.search-result-group > ul {
    margin-left: 10px;
    padding-left: 15px;
}

.search-result-group > ul > li > ul {
    margin-left: 10px;
    padding-left: 15px;
    margin-top: 8px;
}

/* Type indicators */
.type-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
    margin-right: 8px;
    text-transform: uppercase;
}

.formation-indicator {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

.set-indicator {
    background: rgba(33, 150, 243, 0.2);
    color: #2196F3;
    border: 1px solid #2196F3;
}

.play-indicator {
    background: rgba(255, 152, 0, 0.2);
    color: #FF9800;
    border: 1px solid #FF9800;
}

/* --- MODAL STYLES --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(10, 10, 10, 0.96);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: linear-gradient(135deg, rgba(35, 35, 35, 0.98), rgba(25, 25, 25, 0.97));
    margin: 5% auto;
    padding: 28px;
    border: 1px solid #222;
    width: 80%;
    max-width: 700px;
    border-radius: 16px;
    position: relative;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.75),
        0 2px 4px rgba(255,255,255,0.02) inset;
    color: #f2f2f2;
    backdrop-filter: blur(6px);
}

.modal-content img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.28);
}

.close-button {
    color: #fff;
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    transition: color 0.3s;
}

.close-button:hover,
.close-button:focus {
    color: #f2f2f2;
    text-decoration: none;
    cursor: pointer;
}

/* Mobile styles for better popup experience */
@media (max-width: 768px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        width: 100%;
        margin: 0;
        min-height: 100vh;
        border-radius: 0;
        padding: 20px;
    }

    .modal-header h3 {
        font-size: 1.4em;
        margin-top: 0.5em;
    }

    .close-button {
        top: 15px;
        right: 20px;
        font-size: 40px;
        padding: 10px;
    }

    .play-card {
        padding: 20px;
        margin-bottom: 20px;
        gap: 16px;
        border-radius: 12px;
    }

    .play-card h3 {
        font-size: 1.2em;
        border-bottom: none;
        margin: 0;
        padding-bottom: 0;
    }

    .play-card img {
        border-radius: 8px;
        margin-bottom: 0;
    }

    .modal-body img {
        border-radius: 8px;
        margin: 10px 0;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 32px;
        max-width: 100%;
    }

    .play-card {
        padding: 24px;
        gap: 20px;
    }

    h1 {
        font-size: clamp(2.2rem, 4vw, 3rem);
    }
}

/* Collapsible sections */
.collapsible-section {
    margin: 1.5rem 0;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.collapsible-header:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.collapse-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: #3498db;
}

.collapsible-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 1000px; /* Adjust based on your content */
}

.collapsible-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
}