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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 100%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Leaderboard Sidebar */
.leaderboard {
    width: 320px;
    background: rgba(255,255,255,0.95);
    padding: 20px;
    overflow-y: auto;
    max-height: 100vh;
    position: sticky;
    top: 0;
}

.leaderboard h2 {
    color: #1a472a;
    font-size: 1.2rem;
    margin-bottom: 12px;
    text-align: center;
}

.sort-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.sort-btn {
    flex: 1;
    min-width: 50px;
    padding: 6px 8px;
    font-size: 0.7rem;
    border: 1px solid #1a472a;
    background: #fff;
    color: #1a472a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: #e8f5e9;
}

.sort-btn.active {
    background: #1a472a;
    color: #fff;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.leaderboard-table th {
    background: #1a472a;
    color: #fff;
    padding: 8px 4px;
    text-align: center;
    font-size: 0.7rem;
}

.leaderboard-table td {
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.leaderboard-table tr:hover {
    background: #f0f7f0;
}

.leaderboard-table .player-name {
    text-align: left;
    font-weight: 500;
    cursor: pointer;
    color: #1a472a;
}

.leaderboard-table .player-name:hover {
    text-decoration: underline;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    max-width: 900px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
}

/* Support/Tip Jar */
.support-bar {
    margin-top: 12px;
}

.tip-jar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffdd00;
    color: #000;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tip-jar-btn:hover {
    background: #ffe944;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.coffee-icon {
    font-size: 1.1rem;
}

/* Ad Containers */
.ad-container {
    margin: 16px 0;
    display: flex;
    justify-content: center;
}

.ad-top {
    margin-bottom: 20px;
}

.ad-bottom {
    margin-top: 24px;
}

.ad-sidebar {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.ad-container ins {
    background: transparent;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto 16px;
    position: relative;
}

#golfer-search {
    flex: 1;
    padding: 14px 18px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    outline: none;
}

#golfer-search:focus {
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

#search-btn {
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: #f4d03f;
    color: #1a472a;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#search-btn:hover {
    background: #f7dc6f;
    transform: translateY(-1px);
}

/* Compare Mode */
.compare-toggle {
    text-align: center;
    color: #fff;
    margin-bottom: 12px;
}

.compare-toggle label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#compare-count {
    margin-left: 8px;
    opacity: 0.8;
}

.compare-selections {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.compare-player {
    background: rgba(255,255,255,0.9);
    padding: 10px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
}

.compare-player .player-name {
    color: #666;
    font-size: 0.9rem;
}

.compare-player.selected .player-name {
    color: #1a472a;
    font-weight: 600;
}

.remove-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.vs {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

.compare-btn {
    background: #f4d03f;
    color: #1a472a;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.compare-btn:hover {
    background: #f7dc6f;
}

/* Autocomplete */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 100px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    margin-top: 4px;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.autocomplete-item:hover {
    background: #f0f7f0;
}

/* Loading & Error */
.loading {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #f4d03f;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    background: #e74c3c;
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Results */
.results, .compare-results {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

#golfer-name, .compare-header h2 {
    font-size: 1.4rem;
    color: #1a472a;
    margin-bottom: 16px;
    text-align: center;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #666;
}

.color-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.color-box.win { background: #2ecc71; }
.color-box.top5 { background: #9b59b6; }
.color-box.top10 { background: #f1c40f; }
.color-box.made-cut { background: #3498db; }
.color-box.missed-cut { background: #95a5a6; }

.table-wrapper {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #1a472a;
    color: #fff;
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    position: sticky;
    top: 0;
}

td {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

tr:hover td { background: #f8f9fa; }

td.year {
    font-weight: 600;
    color: #1a472a;
}

td.win { background: #2ecc71 !important; color: #fff; font-weight: 700; }
td.top5 { background: #9b59b6 !important; color: #fff; font-weight: 600; }
td.top10 { background: #f1c40f !important; color: #333; font-weight: 600; }
td.made-cut { background: #3498db !important; color: #fff; }
td.missed-cut { background: #95a5a6 !important; color: #fff; }
td.no-entry { color: #ccc; }

/* Compare Tables */
.compare-tables {
    display: flex;
    gap: 20px;
}

.compare-table-wrapper {
    flex: 1;
}

.compare-table-wrapper h3 {
    text-align: center;
    color: #1a472a;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.compare-summary {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.compare-summary h4 {
    margin-bottom: 12px;
    color: #1a472a;
}

.summary-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a472a;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }

    .leaderboard {
        width: 100%;
        max-height: 300px;
        position: relative;
    }

    .compare-tables {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    h1 { font-size: 1.6rem; }

    .search-container {
        flex-direction: column;
    }

    .compare-selections {
        flex-direction: column;
        gap: 8px;
    }

    .vs { display: none; }
}

/* Site Footer */
.site-footer {
    background: rgba(0,0,0,0.3);
    padding: 20px;
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
}

.site-footer a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}
