/* Stats page styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    padding: 20px 8px;
}

.container {
    max-width: 650px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.header h1 {
    color: #4a5568;
    font-size: 24px;
    margin-bottom: 8px;
}

.header .subtitle {
    color: #666;
    font-size: 14px;
}

.back-button {
    position: fixed;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.stats-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #dee2e6;
    text-align: center;
}

.no-stats {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.collapsible-section {
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    overflow: hidden;
}

.collapsible-toggle {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #667eea;
    color: white;
    user-select: none;
    transition: background 0.3s ease;
}

.collapsible-toggle:hover {
    background: #5a67d8;
}

.collapsible-toggle-text {
    font-weight: 600;
    font-size: 16px;
}

.collapsible-chevron {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.collapsible-section.expanded .collapsible-chevron {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-section.expanded .collapsible-content {
    max-height: 1200px;
}

.collapsible-inner {
    padding: 20px;
}

.winloss-explanation {
    background: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 20px;
}

.winloss-explanation h3 {
    color: #2e7d32;
    margin-bottom: 12px;
    font-size: 18px;
}

.winloss-explanation p {
    margin-bottom: 10px;
    color: #333;
}

.winloss-explanation ul {
    margin: 10px 0 10px 20px;
}

.winloss-explanation li {
    margin-bottom: 6px;
    color: #333;
}

.winloss-explanation strong {
    color: #2e7d32;
}

.counts-section {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px;
    margin-top: 12px;
    border-radius: 4px;
}

.counts-section strong {
    color: #856404;
}

.legend-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.legend-column {
    background: white;
    border-radius: 8px;
    padding: 15px;
}

.legend-category {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.legend-item {
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.legend-item:hover {
    background: #e3f2fd;
}

.legend-label {
    font-weight: 600;
    color: #667eea;
    display: block;
    margin-bottom: 3px;
}

.legend-description {
    color: #666;
    font-size: 13px;
    display: block;
}

.legend-note {
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 13px;
    color: #666;
    border-left: 4px solid #667eea;
}

.desktop-table {
    display: none;
}

.mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.stats-table th,
.stats-table td {
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.stats-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    font-size: 10px;
}

.stats-table tr:hover {
    background: #f8f9fa;
}

.player-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.15s;
}
.player-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.player-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.player-card.rank-1 {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: #ffc107;
    box-shadow: 0 3px 8px rgba(255, 193, 7, 0.3);
}

.player-card.rank-2 {
    background: linear-gradient(135deg, #e2e3e5 0%, #f8f9fa 100%);
    border-color: #6c757d;
}

.player-card.rank-3 {
    background: linear-gradient(135deg, #f4cccc 0%, #fce4ec 100%);
    border-color: #e91e63;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.player-rank {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.player-name {
    font-weight: bold;
    font-size: 16px;
    flex-grow: 1;
    text-align: center;
}

.player-hands {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.player-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.stat-label {
    font-size: 11px;
    color: #666;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 14px;
    font-weight: bold;
}

.stat-value.bid-stat {
    color: #6f42c1;
}

.stat-value.nil-stat {
    color: #dc3545;
}

.stat-value.bags-stat {
    color: #fd7e14;
}

.competitive-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.competitive-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.winning-stats {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.losing-stats {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.win-loss-record {
    font-size: 14px;
    font-weight: bold;
    color: #667eea;
    text-align: center;
}

.win-loss-stat {
    color: #333;
    font-weight: bold;
}

.win-stat {
    color: #28a745;
    font-weight: 600;
}

.loss-stat {
    color: #dc3545;
    font-weight: 600;
}

.monthly-container {
    margin-top: 15px;
}

.month-card {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    background: white;
    border: 1px solid #dee2e6;
}

.month-card.current-month {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border: 2px solid #4caf50;
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.month-title {
    font-weight: bold;
    font-size: 15px;
    color: #333;
}

.current-badge {
    background: #4caf50;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.month-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.table-note {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

@media (min-width: 768px) {
    .container {
        padding: 25px;
        max-width: 900px;
    }

    .desktop-table {
        display: block;
    }

    .mobile-cards {
        display: none;
    }

    .player-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .stat-item {
        padding: 10px;
    }

    .player-card {
        padding: 20px;
    }

    .player-header {
        margin-bottom: 15px;
    }

    .player-name {
        font-size: 18px;
    }

    .legend-columns {
        grid-template-columns: repeat(2, 1fr);
    }

    .competitive-stats {
        flex-direction: row;
        gap: 15px;
    }

    .stat-group {
        flex: 1;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .month-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
        margin: 0 4px;
    }

    .header h1 {
        font-size: 20px;
    }

    .back-button {
        top: 10px;
        left: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .player-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .stat-item {
        padding: 6px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 12px;
    }

    .winloss-explanation {
        padding: 15px;
    }

    .winloss-explanation h3 {
        font-size: 16px;
    }
}

/* Overall Stats Banner */
.overall-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
}

.overall-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
}

.overall-stat {
    padding: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

.overall-value {
    font-size: 24px;
    font-weight: bold;
}

.overall-label {
    font-size: 11px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-length-note {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    opacity: 0.85;
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.achievement-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #dee2e6;
}

.achievement-title {
    font-weight: bold;
    font-size: 14px;
    color: #667eea;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.achievement-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.achievement-row:last-child {
    border-bottom: none;
}

.achievement-player {
    font-weight: 600;
    color: #333;
}

.achievement-value {
    font-weight: bold;
    color: #28a745;
}

.achievement-value.streak-value {
    color: #667eea;
}

.achievement-value.bags-value {
    color: #fd7e14;
}

.achievement-value.loss-value {
    color: #dc3545;
}

.achievement-detail {
    font-size: 11px;
    color: #666;
}

.streak-game-link {
    color: #667eea;
    text-decoration: none;
}
.streak-game-link:hover {
    text-decoration: underline;
}

@media (min-width: 768px) {
    .overall-stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .overall-value {
        font-size: 32px;
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .overall-value {
        font-size: 20px;
    }

    .overall-label {
        font-size: 10px;
    }

    .achievement-row {
        flex-wrap: wrap;
        gap: 4px;
    }

    .achievement-detail {
        width: 100%;
        text-align: right;
    }
}

/* Special Cards Section */
.special-cards-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.special-cards-intro {
    text-align: center;
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.special-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.special-card-box {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    border: 2px solid #dee2e6;
}

.special-card-box.ten-clubs {
    border-color: #333;
}

.special-card-box.seven-diamonds {
    border-color: #ff6200;
}

.card-icon {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.ten-clubs .card-icon {
    color: #333;
}

.seven-diamonds .card-icon {
    color: #ff6200;
}

.card-name {
    font-weight: bold;
    font-size: 12px;
    color: #333;
}

.card-effect {
    font-size: 11px;
    color: #28a745;
    margin-bottom: 8px;
}

.capture-stat {
    font-size: 12px;
    color: #666;
    padding: 2px 0;
}

.special-player-stats {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
}

.special-player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    flex-wrap: wrap;
    gap: 8px;
}

.special-player-row:last-child {
    border-bottom: none;
}

.special-captures {
    display: flex;
    gap: 12px;
}

.ten-capture {
    color: #333;
    font-weight: 600;
}

.seven-capture {
    color: #ff6200;
    font-weight: 600;
}

.bags-saved {
    color: #28a745;
    font-weight: bold;
    font-size: 12px;
}

.marta-comparison {
    text-align: center;
    font-size: 12px;
    color: #666;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid #dc3545;
}

@media (max-width: 480px) {
    .special-cards-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .card-icon {
        font-size: 24px;
    }

    .special-player-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .special-captures {
        width: 100%;
        justify-content: space-between;
    }
}

/* All-Time Records Section */
.overall-records-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 25px 20px;
}

.overall-records-section .section-title {
    color: #ffd700;
    border-bottom-color: rgba(255, 215, 0, 0.3);
    font-size: 22px;
}

.all-time-subtitle {
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
}

.big-numbers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.big-number-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.2s ease, background 0.2s ease;
}

.big-number-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
}

.big-number {
    font-size: 28px;
    font-weight: 800;
    color: #ffd700;
    line-height: 1.1;
    margin-bottom: 8px;
}

.big-label {
    font-size: 13px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.big-detail {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.records-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    border-left: 3px solid rgba(255, 215, 0, 0.5);
}

.record-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.record-value {
    font-weight: 700;
    font-size: 14px;
    color: #4fc3f7;
}

.record-value.highlight-value {
    color: #ffd700;
}

.first-game-note {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    margin-top: 10px;
}

@media (min-width: 768px) {
    .big-numbers-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .big-number {
        font-size: 36px;
    }

    .records-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .overall-records-section {
        padding: 20px 12px;
    }

    .big-numbers-grid {
        gap: 10px;
    }

    .big-number-card {
        padding: 15px 10px;
    }

    .big-number {
        font-size: 20px;
        word-break: break-word;
    }

    .big-label {
        font-size: 10px;
        line-height: 1.2;
    }

    .big-detail {
        font-size: 9px;
        line-height: 1.3;
    }

    .record-item {
        padding: 8px 10px;
    }

    .record-label {
        font-size: 12px;
    }

    .record-value {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .big-numbers-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .big-number-card {
        padding: 12px;
    }

    .big-number {
        font-size: 24px;
    }

    .big-label {
        font-size: 12px;
    }

    .big-detail {
        font-size: 11px;
    }
}

/* Game detail links */
.game-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
}
.game-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

/* Time Records Grid */
.time-records-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.time-record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    border-left: 3px solid #667eea;
}

.time-record-item.fastest {
    border-left-color: #28a745;
}

.time-record-item.slowest {
    border-left-color: #fd7e14;
}

.time-record-label {
    font-size: 13px;
    color: #666;
}

.time-record-value {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

@media (min-width: 768px) {
    .time-records-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

