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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.expansions-section, .player-section, .scoring-section, .results-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    position: relative;
}

.expansions-section h2, .player-section h2, .scoring-section h2, .results-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2d3748;
}

/* Expansions Styles */
.expansions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.expansion-toggle {
    position: relative;
}

.expansion-checkbox {
    display: none;
}

.expansion-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #4a5568;
}

.expansion-label:hover {
    border-color: #4299e1;
    background: #edf2f7;
    transform: translateY(-1px);
}

.expansion-checkbox:checked + .expansion-label {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border-color: #4299e1;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.expansion-icon {
    font-size: 1.5rem;
    width: 24px;
    text-align: center;
}

.expansion-name {
    font-size: 1rem;
    font-weight: 600;
}

.player-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.suggestions-container {
    position: relative;
    margin-top: -20px;
    margin-bottom: 30px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

.btn-suggestions {
    background: transparent;
    color: white;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    font-size: 0.75rem;
    opacity: 0.8;
    transition: all 0.2s ease;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-suggestions:hover {
    background: #f7fafc;
    color: #4a5568;
    opacity: 1;
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Custom Donate Button Styling */
.btn-donate {
    background: transparent;
    color: white;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    font-size: 0.75rem;
    opacity: 0.8;
    transition: all 0.2s ease;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-donate:hover {
    background: #f7fafc;
    color: #4a5568;
    opacity: 1;
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-danger {
    background: #f56565;
    color: white;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.players-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.player-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
}

.player-card:hover {
    border-color: #4299e1;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.1);
}

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

.player-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 1.1rem;
    border: none;
    background: transparent;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    flex: 1;
    margin-right: 10px;
}

.player-name:focus {
    outline: none;
    background: #edf2f7;
}

.remove-player-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f56565;
    color: white;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.remove-player-btn:hover {
    background: #e53e3e;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.remove-game-btn {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f56565;
    color: white;
    border: 1px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    transform-origin: center;
}

.remove-game-btn:hover {
    background: #e53e3e;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.remove-game-details-btn {
    background: #f56565;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 15px;
}

.remove-game-details-btn:hover {
    background: #e53e3e;
}

/* Player Name Autocomplete */
.player-header {
    position: relative;
}

.player-name-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.suggestion-item:active {
    background-color: #e0e0e0;
}

.suggestion-item.selected {
    background-color: #007bff;
    color: white;
}

.suggestion-item.selected:hover {
    background-color: #0056b3;
}

/* All Categories Scoring Styles */
.all-categories-scoring {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.category-section {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.category-section:hover {
    border-color: #4299e1;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.1);
}

.category-header {
    padding: 15px 20px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 60px;
}

/* Category-specific color coding */
.category-header.military-conflict {
    background: linear-gradient(135deg, #e53e3e, #c53030);
}

.category-header.coins {
    background: linear-gradient(135deg, #f6ad55, #ed8936);
}

.category-header.debt {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
}

.category-header.wonders {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.category-header.blue-cards {
    background: linear-gradient(135deg, #3182ce, #2c5282);
}

.category-header.yellow-cards {
    background: linear-gradient(135deg, #f6e05e, #d69e2e);
}

.category-header.purple-cards {
    background: linear-gradient(135deg, #805ad5, #6b46c1);
}

.category-header.science-cards {
    background: linear-gradient(135deg, #38a169, #2f855a);
}

.category-header.naval-combat {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.category-header.islands {
    background: linear-gradient(135deg, #68d391, #48bb78);
}

.category-header.leaders {
    background: linear-gradient(135deg, #f6e05e, #d69e2e);
}

.category-header.black-cards {
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

.category-header.projects {
    background: linear-gradient(135deg, #b794f4, #9f7aea);
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}

.category-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.category-header p {
    opacity: 0.9;
    font-size: 0.85rem;
    margin: 0;
    margin-left: 52px; /* Align with the category name (icon width 40px + gap 12px) */
}

.scoring-inputs {
    padding: 20px;
}

.scoring-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.scoring-row:last-child {
    margin-bottom: 0;
}

.scoring-row:hover {
    border-color: #4299e1;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.1);
}

.player-label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
    min-width: 100px;
}

.score-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.number-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.decrease-btn, .increase-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    background: #f7fafc;
    color: #4a5568;
    font-size: 18px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.decrease-btn:hover, .increase-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.decrease-btn:active, .increase-btn:active {
    background: #e2e8f0;
    transform: scale(0.95);
}

.decrease-btn:disabled, .increase-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.number-controls input[type="number"] {
    width: 60px;
    text-align: center;
}

/* Remove spinner arrows from number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield; /* Standard property */
}

.score-input input {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    transition: border-color 0.2s ease;
}

.score-input input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.score-display {
    font-weight: 600;
    color: #4299e1;
    min-width: 35px;
    text-align: center;
    font-size: 0.85rem;
}

.debt-display {
    color: #e53e3e;
    font-weight: 700;
}

/* Science Cards Styling */
.science-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.science-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.science-symbol {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.science-symbol label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.science-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.science-symbol input {
    width: 50px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    transition: border-color 0.2s ease;
}

.science-symbol .number-controls {
    gap: 2px;
}

.science-symbol .decrease-btn, .science-symbol .increase-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
}

.science-symbol .number-controls input[type="number"] {
    width: 45px;
}

.science-symbol input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.science-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-left: 12px;
}

.science-breakdown {
    font-size: 0.75rem;
    color: #718096;
    font-style: italic;
}

.results {
    min-height: 200px;
}

.no-results {
    color: #718096;
    font-style: italic;
    text-align: center;
    margin-top: 60px;
}

.winner {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
}

.score-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}

.score-item.winner-item {
    border-left-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4, #e6fffa);
}

.player-score {
    font-weight: 600;
    color: #2d3748;
}

.score-value {
    font-weight: 700;
    color: #4299e1;
    font-size: 1.1rem;
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.storage-notice {
    text-align: center;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #666666;
    opacity: 0.8;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
    box-sizing: border-box;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Statistics Content Styles */
.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    color: #2d3748;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #4299e1;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #4299e1;
    margin-bottom: 8px;
}

.stat-value[onclick] {
    transition: color 0.2s ease;
}

.stat-value[onclick]:hover {
    color: #2d3748;
}

.stat-label {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

.player-stats {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-stats:hover {
    border-color: #4299e1;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.1);
}

.player-stats.expanded {
    padding: 15px;
    margin-bottom: 10px;
}

.player-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

        .player-stats.expanded .player-stats-header {
            margin-bottom: 12px;
            padding-bottom: 8px;
        }

.player-stats-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

.player-stats-summary {
    display: none;
}

.player-stats.expanded .player-stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.player-stats-compact {
    display: flex;
    gap: 15px;
    align-items: center;
}

.player-stats.expanded .player-stats-compact {
    display: none;
}

.compact-stat {
    font-size: 0.85rem;
    color: #718096;
    font-weight: 500;
}

/* Hide win rate and average score on mobile */
@media (max-width: 768px) {
    .compact-stat.win-rate,
    .compact-stat.avg-score {
        display: none;
    }
}

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

.player-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #4299e1;
}

.player-stat-value[onclick] {
    transition: color 0.2s ease;
}

.player-stat-value[onclick]:hover {
    color: #2d3748;
}

.player-stat-label {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 4px;
}

.recent-games-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.recent-games-header h3 {
    margin: 0;
}

.sort-select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.sort-select:hover {
    border-color: #4299e1;
}

.sort-select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* New sorting controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-buttons {
    display: flex;
    gap: 2px;
}

.sort-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.sort-btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.sort-btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}

.sort-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.sort-btn.active {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

.sort-btn.active:hover {
    background: #3182ce;
    border-color: #3182ce;
}

.sort-order-btn {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sort-order-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.sort-order-btn:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Recent games controls */
.recent-games-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Filters button */
.filters-button-container {
    margin: 0;
    text-align: left;
}

.filters-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters-btn:hover {
    background: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Expansion filters */
.expansion-filters {
    margin: 15px 0;
    padding: 15px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.filter-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 10px;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-checkbox {
    position: relative;
}

.filter-checkbox-input {
    display: none;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
}

.filter-checkbox-label:hover {
    border-color: #4299e1;
    background: #edf2f7;
}

.filter-checkbox-input:checked + .filter-checkbox-label {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border-color: #4299e1;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
}

.filter-icon {
    font-size: 1.1rem;
    width: 16px;
    text-align: center;
}

.filter-name {
    font-size: 0.85rem;
}

.recent-games {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.game-entry {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.game-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    max-width: calc(100% - 180px);
}

.game-date {
    font-weight: bold;
    margin-bottom: 3px;
    font-size: 0.8rem;
    color: #718096;
}

.game-players {
    color: #4a5568;
    font-size: 0.75rem;
    word-wrap: break-word;
}

.game-winner {
    text-align: right;
    min-width: 0;
    flex-shrink: 0;
    font-weight: 600;
    color: #48bb78;
    word-wrap: break-word;
    max-width: 120px;
    font-size: 0.8rem;
    margin-right: 30px;
}

.game-entry {
    cursor: pointer;
}

.game-entry:hover {
    border-color: #4299e1;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.1);
    background: #edf2f7;
}

.game-score {
    font-weight: 700;
    color: #4299e1;
    font-size: 1.1rem;
}

.clear-stats-btn {
    background: #f56565;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-stats-btn:hover {
    background: #e53e3e;
}

/* Game Details Modal Styles */
.game-details-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.game-details-date {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.game-details-players {
    font-size: 0.9rem;
    color: #718096;
}

.game-details-expansions {
    font-size: 0.85rem;
    color: #4299e1;
    font-weight: 500;
    margin-top: 5px;
}

.game-details-scores {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-score-detail {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.player-score-detail.winner-detail {
    background: linear-gradient(135deg, #f0fff4, #e6fffa);
    border-color: #48bb78;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.2);
}

.player-score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.player-rank {
    background: #4299e1;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.winner-detail .player-rank {
    background: #48bb78;
}

.player-name-detail {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    flex: 1;
    margin-left: 12px;
}

.player-total-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: #4299e1;
}

.winner-detail .player-total-score {
    color: #48bb78;
}

.player-score-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.score-category {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}



        .category-name {
            font-size: 0.85rem;
            color: #4a5568;
            flex: 1;
        }

        .category-score {
            font-weight: 600;
            font-size: 0.85rem;
        }

        .category-score.positive-score {
            color: #48bb78;
        }

        .category-score.negative-score {
            color: #e53e3e;
        }

        /* Override text colors for colored category backgrounds */
        .score-category.military-conflict .category-name,
        .score-category.coins .category-name,
        .score-category.debt .category-name,
        .score-category.wonders .category-name,
        .score-category.blue-cards .category-name,
        .score-category.yellow-cards .category-name,
        .score-category.purple-cards .category-name,
        .score-category.science-cards .category-name,
        .score-category.naval-combat .category-name,
        .score-category.islands .category-name,
        .score-category.leaders .category-name,
        .score-category.black-cards .category-name,
        .score-category.projects .category-name {
            color: white;
        }

        .score-category.military-conflict .category-score,
        .score-category.coins .category-score,
        .score-category.debt .category-score,
        .score-category.wonders .category-score,
        .score-category.blue-cards .category-score,
        .score-category.yellow-cards .category-score,
        .score-category.purple-cards .category-score,
        .score-category.science-cards .category-score,
        .score-category.naval-combat .category-score,
        .score-category.islands .category-score,
        .score-category.leaders .category-score,
        .score-category.black-cards .category-score,
        .score-category.projects .category-score {
            color: white;
        }

               /* Game Details Modal Category Background Colors */
        .score-category.military-conflict {
            background: linear-gradient(135deg, #e53e3e, #c53030);
            border-color: #c53030;
            color: white;
        }
 
        .score-category.coins {
            background: linear-gradient(135deg, #f6ad55, #ed8936);
            border-color: #ed8936;
            color: white;
        }
 
        .score-category.debt {
            background: linear-gradient(135deg, #9f7aea, #805ad5);
            border-color: #805ad5;
            color: white;
        }
 
        .score-category.wonders {
            background: linear-gradient(135deg, #48bb78, #38a169);
            border-color: #38a169;
            color: white;
        }
 
        .score-category.blue-cards {
            background: linear-gradient(135deg, #3182ce, #2c5282);
            border-color: #2c5282;
            color: white;
        }
 
        .score-category.yellow-cards {
            background: linear-gradient(135deg, #f6e05e, #d69e2e);
            border-color: #d69e2e;
            color: white;
        }
 
        .score-category.purple-cards {
            background: linear-gradient(135deg, #805ad5, #6b46c1);
            border-color: #6b46c1;
            color: white;
        }
 
        .score-category.science-cards {
            background: linear-gradient(135deg, #38a169, #2f855a);
            border-color: #2f855a;
            color: white;
        }
 
        .score-category.naval-combat {
            background: linear-gradient(135deg, #4299e1, #3182ce);
            border-color: #3182ce;
            color: white;
        }
 
        .score-category.islands {
            background: linear-gradient(135deg, #68d391, #48bb78);
            border-color: #48bb78;
            color: white;
        }
 
        .score-category.leaders {
            background: linear-gradient(135deg, #f6e05e, #d69e2e);
            border-color: #d69e2e;
            color: white;
        }
 
        .score-category.black-cards {
            background: linear-gradient(135deg, #2d3748, #1a202c);
            border-color: #1a202c;
            color: white;
        }
 
        .score-category.black-cards .category-name {
            color: white;
        }
 
        .score-category.projects {
            background: linear-gradient(135deg, #b794f4, #9f7aea);
            border-color: #9f7aea;
            color: white;
        }

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .statistics-modal {
        padding: 10px;
    }
    
    .modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .game-entry {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
        align-items: flex-start;
    }
    
    .game-info {
        max-width: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    
    .game-winner {
        text-align: left;
        align-self: flex-start;
        max-width: 100%;
        margin-right: 0;
        font-size: 0.9rem;
        padding: 4px 8px;
        background: #f0fff4;
        border-radius: 4px;
        border: 1px solid #c6f6d5;
    }
    
    .game-date {
        font-size: 0.85rem;
    }
    
    .game-players {
        font-size: 0.8rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .expansions-section, .player-section, .scoring-section, .results-section {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .expansions-grid {
        grid-template-columns: 1fr;
    }
    
    .players-list {
        grid-template-columns: 1fr;
    }
    
    .all-categories-scoring {
        grid-template-columns: 1fr;
    }
    
    .scoring-row {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .score-input {
        justify-content: center;
    }
    
    .player-label {
        min-width: auto;
        text-align: center;
    }
    
    .player-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .player-name {
        margin-right: 0;
        text-align: center;
    }
    
    .suggestions-container {
        margin-top: 10px;
        margin-bottom: 20px;
    }
}