/* Statistics Page Styles */

/* Main container */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Statistics content */
.stats-main {
    flex: 1;
    margin-top: 1rem;
}

.stats-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.stats-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.stats-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: block;
    padding: 2rem 0;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    text-align: center;
}

.player-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.player-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.player-name {
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Stats cards grid */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: var(--text-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Feature icons for how-to-play page */
.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* Special card types */
.stat-card.best-score {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #1a202c;
}

.stat-card.streak-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-card.best-score h3,
.stat-card.streak-card h3 {
    color: inherit;
    opacity: 0.9;
}

.stat-card.best-score .stat-subtext,
.stat-card.streak-card .stat-subtext {
    color: inherit;
    opacity: 0.8;
}

.stat-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-accent);
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card p {
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

.stat-card ul {
    color: var(--text-color);
    text-align: left;
    margin: 0;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.stat-card li {
    margin-bottom: 0.5rem;
}

.stat-card li:last-child {
    margin-bottom: 0;
}

.stat-card a {
    color: var(--text-accent);
    text-decoration: none;
}

.stat-card a:hover {
    text-decoration: underline;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-accent);
    margin: 0 0 0.5rem 0;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.stat-subtext {
    font-size: 0.875rem;
    color: #b3b9c5;
    margin: 0;
    line-height: 1.4;
}

/* Stats sections */
.stats-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-accent);
    margin: 0 0 1.5rem 0;
    text-align: center;
    position: relative;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* Stats subsections */
.stats-subsection {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.subsection-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-accent);
    margin: 0 0 1rem 0;
    text-align: center;
}

/* No game stats */
.no-game-stats {
    text-align: center;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin: 1rem 0;
}

.no-game-stats h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-accent);
    margin: 0 0 0.5rem 0;
}

.no-game-stats p {
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

/* Attempt distribution */
.attempt-distribution {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    margin: 0 auto;
}

.attempt-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.attempt-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-accent);
    min-width: 30px;
    text-align: center;
}

.attempt-bar-container {
    flex: 1;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.attempt-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.attempt-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-accent);
    min-width: 30px;
    text-align: right;
}

/* Text center utility */
.text-center {
    text-align: center;
}

/* Recent games */
.recent-games {
    max-width: 1000px;
    margin: 0 auto;
    box-sizing: border-box;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.recent-game-card {
    height: 100%;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: unset;
    cursor: pointer;
    position: relative;
}

.recent-game-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--bg-light);
    border-color: var(--accent-fg);
}

.recent-game-card:hover::after {
    opacity: 0.7;
}

.recent-game-card:focus-visible {
    outline: 2px solid var(--accent-fg);
    outline-offset: 2px;
}

.recent-game-card,
.recent-game-card:visited,
.recent-game-card:active,
.recent-game-card:focus {
    text-decoration: none !important;
    color: inherit !important;
}
.recent-game-card:hover {
    text-decoration: none !important;
    color: inherit !important;
}





.game-score {
    font-size: 1.05rem;
    font-weight: 700;
    color: #667eea;
    margin: 0;
}

.game-percent {
    font-size: 0.95rem;
    font-weight: 600;
    color: #48bb78;
    margin: 0;
}

.game-words {
    font-size: 0.85rem;
    color: #b3b9c5;
    margin: 0;
}

.game-date {
    font-size: 0.8rem;
    color: #7a8599;
    font-style: italic;
    margin: 0;
}

.recent-game-card .game-score,
.recent-game-card .game-percent,
.recent-game-card .game-words,
.recent-game-card .game-date {
    display: inline-block;
    margin-right: 0.5rem;
}

.recent-game-card .game-date {
    margin-right: 0;
}

/* Game info layout */
.game-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Achievements */
.achievements {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.achievement-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #1a202c;
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.achievement-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.achievement-icon {
    font-size: 1.2rem;
}

.achievement-text {
    font-size: 0.875rem;
}

/* Last game info */
.last-game {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

/* No stats message */
.no-stats {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.no-stats h3 {
    font-size: 1.5rem;
    color: var(--text-accent);
    margin: 0 0 1rem 0;
}

.no-stats p {
    font-size: 1rem;
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

/* Buttons */
.buttons {
    text-align: center;
    margin-top: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-align: center;
    margin: 0 0.5rem 0.5rem 0;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #64748b;
    color: white;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(100, 116, 139, 0.4);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 768px) {
    .stats-title {
        font-size: 2rem;
    }

    .player-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .player-avatar {
        width: 48px;
        height: 48px;
    }

    .player-name {
        font-size: 1.25rem;
    }

    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .stat-card {
        padding: 1.5rem 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .container {
        padding: 0 0.5rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .recent-games {
        grid-template-columns: 1fr;
    }

    .recent-game-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .game-info {
        justify-content: center;
        flex-wrap: wrap;
    }

    .achievements {
        flex-direction: column;
        align-items: center;
    }

    .achievement-badge {
        width: 100%;
        max-width: 300px;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }

    .stats-subsection {
        padding: 1rem;
    }

    .subsection-title {
        font-size: 1.125rem;
    }

    .attempt-distribution {
        max-width: 300px;
    }

    .attempt-bar {
        gap: 0.5rem;
    }

    .attempt-label,
    .attempt-count {
        font-size: 0.75rem;
        min-width: 25px;
    }

    .attempt-bar-container {
        height: 16px;
    }
}

@media (max-width: 480px) {
    .stats-header {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
    }

    .stats-title {
        font-size: 1.75rem;
    }

    .stats-cards {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .recent-games {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .recent-game-card {
        padding: 0.5rem;
    }

    .game-info {
        font-size: 0.875rem;
    }

    .achievement-badge {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .achievement-icon {
        font-size: 1rem;
    }

    .stats-subsection {
        padding: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .subsection-title {
        font-size: 1rem;
    }

    .no-game-stats {
        padding: 1.5rem 1rem;
    }

    .no-game-stats h3 {
        font-size: 1.125rem;
    }

    .attempt-distribution {
        max-width: 250px;
        gap: 0.5rem;
    }

    .attempt-bar {
        gap: 0.375rem;
    }

    .attempt-label,
    .attempt-count {
        font-size: 0.6875rem;
        min-width: 20px;
    }

    .attempt-bar-container {
        height: 14px;
    }
}

@media (max-width: 900px) {
    .recent-games {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .recent-games {
        grid-template-columns: 1fr;
    }
}

/* Yesterday Game Stats Page Styles */
.yesterday-stats-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.yesterday-stats-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-accent);
    text-align: center;
    margin: 0 0 1rem 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.date-display {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-color);
    margin: 0 0 3rem 0;
    opacity: 0.8;
}

.no-data-message {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.no-data-message p {
    font-size: 1.125rem;
    color: var(--text-color);
    margin: 0 0 2rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.game-board-section {
    grid-column: 1 / -1;
    text-align: center;
}

.game-board-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-accent);
    margin: 0 0 1.5rem 0;
}

.game-board-display {
    display: inline-block;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.board-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.board-cell {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.user-performance-section h2,
.overall-stats-section h2,
.top-players-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-accent);
    margin: 0 0 1.5rem 0;
}

.user-stats {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
    color: var(--text-color);
}

.stat-value {
    font-weight: 600;
    color: var(--text-accent);
    font-size: 1.125rem;
}

.found-words {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.found-words h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-accent);
    margin: 0 0 1rem 0;
}

.words-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.word-tag {
    background: var(--text-accent);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.missed-words {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.missed-words h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-accent);
    margin: 0 0 1rem 0;
}

.missed-words-list {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
}

.missed-word-tag {
    background: var(--border-color);
    color: var(--text-color);
    opacity: 0.7;
}

.no-play-message {
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    font-style: italic;
}

.stats-grid-small {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.leaderboard {
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 50px 1fr 80px 80px 80px;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

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

.leaderboard-row:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.rank {
    font-weight: 600;
    color: var(--text-accent);
    text-align: center;
}

.username {
    font-weight: 500;
    color: var(--text-color);
}

.score,
.percentage,
.words-count {
    text-align: center;
    font-weight: 500;
    color: var(--text-color);
}

.actions {
    text-align: center;
    margin-top: 3rem;
}

.actions .btn {
    margin: 0 0.5rem;
}

/* Dumino Statistics Full-Page Styling (adapted from popup) */

.stats-title {
    font-size: 2rem;
    font-weight: 600;
    margin: 2rem 0 1.5rem 0;
    color: var(--fg-default, #1a1a1a);
    text-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 2px #fff;
    background: var(--bg-canvas-subtle, rgba(255,255,255,0.7));
    border-radius: 8px;
    display: inline-block;
    padding: 0.4em 1.2em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.stats-section {
    margin-bottom: 2rem;
    background: var(--bg-canvas-subtle, #f7f7fa);
    border-radius: 8px;
    border: 1px solid var(--border-default, #e0e0e0);
    padding: 1.2rem 1.5rem;
}

.stats-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.15rem;
    color: var(--fg-default, #1a1a1a);
    border-bottom: 1px solid var(--border-default, #e0e0e0);
    padding-bottom: 0.4em;
    font-weight: 600;
}

.yesterday-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7em 1em;
    background-color: var(--bg-canvas, #fff);
    border-radius: 6px;
    border: 1px solid var(--border-default, #e0e0e0);
    margin-bottom: 0.5em;
}

.yesterday-stat-item .stat-label {
    color: var(--fg-muted, #888);
    font-size: 1em;
    font-weight: 500;
}

.yesterday-stat-item .stat-value {
    color: var(--fg-default, #1a1a1a);
    font-size: 1em;
    font-weight: 600;
}

.stats-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding: 5px;
    background: var(--bg-canvas, #fff);
    border-radius: 6px;
    border: 1px solid var(--border-default, #e0e0e0);
}

.stats-word {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 1em;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    background: var(--bg-canvas-subtle, #f7f7fa);
    color: var(--fg-default, #1a1a1a);
}

.stats-word.found {
    background-color: var(--success-emphasis, #4caf50);
    color: var(--fg-on-emphasis, #fff);
}

.stats-word.missed {
    background-color: var(--danger-emphasis, #e57373);
    color: var(--fg-on-emphasis, #fff);
}

@media (max-width: 768px) {
    .stats-title {
        font-size: 1.3rem;
        padding: 0.3em 0.7em;
    }
    .stats-section {
        padding: 0.7rem 0.7rem;
    }
    .stats-word-list {
        max-height: 120px;
        font-size: 0.95em;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .stats-grid-small {
        grid-template-columns: 1fr;
    }

    .leaderboard-row {
        grid-template-columns: 40px 1fr 70px 70px 70px;
        gap: 0.5rem;
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    .board-cell {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .yesterday-stats-container h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .yesterday-stats-container {
        padding: 1rem 0.5rem;
    }

    .yesterday-stats-container h1 {
        font-size: 1.75rem;
    }

    .leaderboard-row {
        grid-template-columns: 30px 1fr 60px 60px 60px;
        gap: 0.25rem;
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .board-cell {
        width: 35px;
        height: 35px;
        font-size: 0.875rem;
    }

    .words-list {
        max-height: 200px;
        gap: 0.125rem;
        padding: 0.25rem;
    }

    .word-tag {
        padding: 0.125rem 0.375rem;
        font-size: 0.6875rem;
        border-radius: 8px;
    }

    .actions .btn {
        display: block;
        margin: 0.5rem auto;
        max-width: 200px;
    }
}
