/* -----------------------------
   Table of Contents
   -----------------------------
   1. CSS Reset & Base Styles
   2. Variables & Theme
   3. Typography
   4. Layout & Containers
   5. Game Progress & Navigation
   6. Voter Information
   7. Model Prediction & Changes
   8. Buttons & Interactive Elements
   9. Feedback & Messages
   10. Performance Summary & Stats
   11. Modal & Overlays
   12. Info Section
   13. Practice Mode
   14. Responsive Design
   ---------------------------- */

/* 1. CSS Reset & Base Styles
   ---------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
    font-family: 'Libre Franklin', sans-serif;
    margin: 0;
    padding: 12px;
    background-color: var(--background);
    color: var(--text);
}

/* 2. Variables & Theme
   ---------------------------- */
:root {
    /* Feedback Colors */
    --feedback-success-rgb: 0, 109, 104;    /* Deep teal for success */
    --feedback-error-rgb: 176, 54, 54;      /* New muted red for error states */
    
    /* Political Colors */
    --dem-rgb: 59, 88, 152;                 /* Deeper, more serious blue */
    --rep-rgb: 150, 42, 42;                 /* Richer, darker red */
    --other-rgb: 87, 87, 87;                /* Neutral gray */
    
    /* System Colors */
    --primary-rgb: 51, 51, 51;              /* Almost black for primary */
    --primary: rgb(var(--primary-rgb));
    --background: #f9f9f9;                  /* Slightly warmer background */
    --card-bg: #ffffff;
    --text: #333333;                        /* Darker text for readability */
    --text-secondary: #666666;              /* Warmer gray for secondary text */
    --border: #e6e6e6;                      /* Slightly warmer border */
    --segment-empty: #ebebeb;               /* Warmer empty state */
    
    /* Define solid colors */
    --feedback-success: rgb(var(--feedback-success-rgb));
    --feedback-error: rgb(var(--feedback-error-rgb));
}

/* 3. Typography
   ---------------------------- */
h1 {
    text-align: center;
    color: var(--text);
    margin: 0 0 16px 0;
    font-weight: 700;
    font-size: 24px;
}

.text-center {
    text-align: center;
}

.question-text {
    text-align: center;
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text);
}

/* 4. Layout & Containers
   ---------------------------- */


/* Header layout */
.header-container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    width: 100%;
}

.header-container h1 {
    grid-column: 2;
    text-align: center;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    white-space: nowrap;
    justify-self: center;
}

/* New game button container */
.new-game-button {
    font-size: 14px;
    padding: 6px 12px !important;
    height: 32px;
    width: max-content;
    border-radius: 6px;
    background-color: transparent;
    border: 1.5px solid var(--text) !important;
    color: var(--text) !important;
}

/* Header buttons container */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
}

.header-buttons button {
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

/* Common styles for both icon buttons */
.recent-games-button,
.info-button {
    display: inline-flex; /* Make buttons display inline */
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: none;
    border: none;
}

/* SVG sizing for both buttons */
.recent-games-button svg,
.info-button svg {
    width: 24px;
    height: 24px;
}

/* Remove the absolute positioning section and replace with this */
.info-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.info-button:hover {
    color: var(--primary);
}

/* And let's make sure the recent-games-button matches */
.recent-games-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.recent-games-button:hover {
    color: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 500px) {
    .header-container {
        gap: 8px;
    }
    
    .header-container h1 {
        font-size: 20px;
    }
    
    .new-game-button {
        font-size: 13px;
        padding: 4px 10px !important;
        height: 28px;
    }
    
    .header-buttons {
        gap: 4px;
    }
    
    .recent-games-button,
    .info-button {
        padding: 4px;
    }
    
    .recent-games-button svg,
    .info-button svg {
        width: 20px;
        height: 20px;
    }
}

/* Additional centering safeguards */
@media (max-width: 360px) {
    .header-container h1 {
        font-size: 18px;
    }
    
    .new-game-button {
        font-size: 12px;
        padding: 3px 8px !important;
    }
}

#game-container {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
}

#game-progress {
    margin-bottom: 16px;
}

#voter-info-container {
    position: relative;
    background-color: var(--background);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

/* 5. Game Progress & Navigation
   ---------------------------- */
/* Progress Bar Styles */
.competition-progress {
    margin: 16px 0;
    padding: 12px;
    background: var(--background);
    border-radius: 12px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    margin-bottom: 32px;
}

/* Container for both scores */
.progress-scores {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Individual score row */
.progress-score {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.progress-score .label {
    width: 45px;
    color: var(--text-secondary);
}

.progress-score .value {
    font-weight: 600;
    color: var(--text);
    min-width: 20px;
}

/* Progress bars container */
.unified-progress {
    display: flex;
    gap: 3px;
    height: 32px;
}

.progress-segment-wrapper {
    flex: 1;
    position: relative;
}

.progress-segment {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.segment {
    height: calc(50% - 1px);
    background: var(--segment-empty);
    transition: all 0.3s ease;
    border-radius: 3px;
}

.review-instruction {
    position: static;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin: 0px;
    grid-column: 1 / -1;
}

/* Current segment and hover states */
.progress-segment-wrapper.current .progress-segment {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.progress-segment-wrapper.current .progress-segment::after {
    content: '';
    position: absolute;
    top: -1.5px;
    left: -1.5px;
    right: -1px;
    bottom: -1.5px;
    border-radius: 4px;
    border: 2px solid var(--primary);
    pointer-events: none;
}

.progress-segment-wrapper.clickable {
    cursor: pointer;
}

.review-mode .progress-segment-wrapper.clickable:hover .progress-segment {
    transform: scaleY(1.05);
}

.review-mode .review-instruction {
    display: block; /* Ensure visibility in review mode */
}

.segment.correct {
    background: rgba(var(--feedback-success-rgb), 0.8);
}

.segment.incorrect {
    background: rgba(var(--feedback-error-rgb), 0.8);
}

@media (max-width: 500px) {
    .competition-progress {
        margin-bottom: 28px; /* Slightly reduce spacing on mobile */
    }
    
    .review-instruction {
        font-size: 11px;
    }
}

@media (max-width: 500px) {
    .competition-progress {
        padding: 8px;
        gap: 8px;
    }

    .progress-score {
        font-size: 13px;
    }

    .progress-score .label {
        width: 40px;
    }

    .unified-progress {
        height: 28px;
    }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.player-score, .model-score {
    display: flex;
    align-items: center;
}

.player-feedback, .model-feedback {
    margin: 4px 0;
}

.competition-feedback {
    margin-top: 12px;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.competition-feedback.win {
    background-color: rgba(var(--feedback-success-rgb), 0.1);
    color: var(--feedback-success);
}

.competition-feedback.loss {
    background-color: rgba(var(--feedback-error-rgb), 0.1);
    color: var(--feedback-error);
}

.competition-feedback.tie {
    background-color: var(--background);
    color: var(--text);
}

.back-to-summary {
    margin-bottom: 16px;
    text-align: left;
    width: 100%;
}

.back-to-summary .secondary-button {
    padding: 8px 16px;
    font-size: 14px;
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-to-summary .secondary-button:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
}

/* 6. Voter Information
   ---------------------------- */
.voter-name {
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    margin: 0;
    color: var(--text);
}

.voter-info {
    text-align: center;
    color: var(--text-secondary);
    margin: 8px 0;
    font-size: 15px;
}

ul {
    list-style-type: disc;
    padding-left: 24px;
    margin: 12px 0;
}

li {
    margin: 6px 0;
    color: var(--text);
    line-height: 1.4;
    font-size: 14px;
}

/* 7. Model Prediction & Changes
   ---------------------------- */
.model-change {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    margin-left: 6px;
    animation: fadeIn 0.3s ease-out;
}

.model-change.biden {
    background-color: rgba(var(--dem-rgb), 0.1);
    color: rgb(var(--dem-rgb));
}

.model-change.trump {
    background-color: rgba(var(--rep-rgb), 0.1);
    color: rgb(var(--rep-rgb));
}

.model-change.other {
    background-color: rgba(var(--other-rgb), 0.1);
    color: rgb(var(--other-rgb));
}

.model-prediction {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    background-color: var(--background);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    animation: fadeIn 0.3s ease-out;
}

/* 8. Buttons & Interactive Elements
   ---------------------------- */
.button-group {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    justify-content: center;
}

button {
    box-sizing: border-box;
    background-color: var(--primary);
    color: white;
    border: 2px solid transparent;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.3px;
    flex: 1;
    max-width: 200px;
}

button:disabled {
    opacity: 0.7;
    transform: none;
    background-color: var(--text-secondary);
    border: 2px solid var(--text-secondary);
}

.secondary-button {
    background-color: transparent !important;
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
    padding: 8px 16px !important;
}

.secondary-button:hover {
    background-color: var(--background) !important;
}

.share-button {
    background-color: var(--primary) !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

.share-button.copied {
    background-color: var(--success) !important;
}

.reset-button {
    background-color: rgb(var(--feedback-error-rgb)) !important;
    color: white !important;
    font-size: 14px !important;
    padding: 8px 16px !important;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.reset-button:hover {
    opacity: 1;
}

/* Button States */
button.correct {
    background-color: var(--feedback-success);
    border: 2px solid var(--feedback-success);
}

button.correct-answer {
    color: var(--text) !important;
    background-color: var(--background);
    border: 2px solid var(--feedback-success) !important;
}

button.incorrect {
    background-color: var(--feedback-error);
    border: 2px solid var(--feedback-error);
}

button.disabled {
    background-color: var(--text-secondary);
}

/* Add to styles.css */

/* Recent Games List
   ---------------------------- */
.recent-games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.recent-game-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--background);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recent-game-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-id {
    font-weight: 600;
    color: var(--text);
}

.game-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.game-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.game-score {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.resume-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.resume-link:hover {
    background-color: rgba(var(--primary-rgb), 0.9);
}

/* Add responsive styles for smaller screens */
@media (max-width: 500px) {
    .recent-game-item {
        padding: 12px;
    }

    .game-id {
        font-size: 14px;
    }

    .game-time {
        font-size: 12px;
    }

    .game-score {
        font-size: 13px;
    }

    .resume-link {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* Loading state for recent games
   ---------------------------- */
.recent-games-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--text-secondary);
}

.recent-games-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Empty state animation */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recent-game-item {
    animation: fadeSlideIn 0.3s ease-out;
    animation-fill-mode: both;
}

.recent-game-item:nth-child(2) { animation-delay: 0.1s; }
.recent-game-item:nth-child(3) { animation-delay: 0.2s; }
.recent-game-item:nth-child(4) { animation-delay: 0.3s; }
.recent-game-item:nth-child(5) { animation-delay: 0.4s; }

/* Recent Games Button in Header
   ---------------------------- */
.recent-games-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    max-width: unset;
}

.recent-games-button:hover {
    color: var(--text);
}

.recent-games-button svg {
    width: 24px;
    height: 24px;
}

/* Badge for incomplete games */
.recent-games-button .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: rgb(var(--feedback-error-rgb));
    color: white;
    font-size: 11px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Empty state messaging */
.recent-games-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px;
    color: var(--text-secondary);
    text-align: center;
}

.recent-games-empty svg {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.recent-games-empty p {
    margin: 0;
    font-size: 15px;
}

/* Enhance modal transitions */
.stats-modal {
    animation: modalFadeIn 0.3s ease-out;
}

.stats-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 9. Feedback & Messages
   ---------------------------- */
.feedback-area {
    margin-bottom: 24px;
    min-height: 0;
    transition: min-height 0.3s ease;
}

.model-reasoning {
    background: var(--background);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-thinking {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    margin: 12px 0;
}

.thinking-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.thinking-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: thinking 1.4s infinite;
}

.thinking-indicator span:nth-child(2) { animation-delay: 0.2s; }
.thinking-indicator span:nth-child(3) { animation-delay: 0.4s; }

.prediction-confidence {
    display: block;
    font-size: 13px;
    opacity: 0.9;
    margin-top: 4px;
}

.predictions-showdown {
    margin-top: 24px;
    animation: fadeIn 0.3s ease-out;
}

.predictions-showdown .prediction-card {
    flex: 1;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    background: var(--background);
    border: 1px solid var(--border);
}

.prediction-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.prediction-card .predictor {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.prediction-card .prediction {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.prediction-card .confidence {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.answer-reveal {
    background: var(--background);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: slideUp 0.4s ease-out;
}

.answer-header {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.answer-text {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.answer-reveal.correct .answer-text {
    color: var(--feedback-success);
}

.answer-reveal.incorrect .answer-text {
    color: var(--feedback-error);
}

.result-message {
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    display: inline-block;
    padding: 6px 12px;
    margin-top: 8px;
}

.result-message.win {
    background: rgba(var(--feedback-success-rgb), 0.1);
    color: var(--feedback-success);
}

.result-message.loss {
    background: rgba(var(--feedback-error-rgb), 0.1);
    color: var(--feedback-error);
}

.result-message.tie {
    background: var(--background);
    color: var(--text-secondary);
}

@media (max-width: 500px) {
    .result-message {
        font-size: 13px;
        padding: 5px 10px;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes thinking {
    0%, 100% { transform: scale(0.6); opacity: 0.4; }
    50% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.model-factor {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

.factor-label {
    color: var(--text);
}

.factor-change {
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--background);
}

.factor-change.positive {
    color: var(--feedback-success);
    background: rgba(var(--feedback-success-rgb), 0.1);
}

.factor-change.negative {
    color: var(--feedback-error);
    background: rgba(var(--feedback-error-rgb), 0.1);
}

.prediction-header {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.prediction-content {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.prediction-confidence {
    font-size: 14px;
    font-weight: normal;
    color: var(--text-secondary);
    margin-left: 8px;
}

.answer-reveal {
    margin-top: 16px;
    animation: slideIn 0.3s ease-out;
}

.answer-content {
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
}

.answer-content.correct {
    background: rgba(var(--feedback-success-rgb), 0.1);
    color: var(--feedback-success);
}

.answer-content.incorrect {
    background: rgba(var(--feedback-error-rgb), 0.1);
    color: var(--feedback-error);
}

.next-voter-button {
    margin-top: 16px;
    width: 100%;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.correct-text, .incorrect-text {
    color: var(--feedback-success);
    font-weight: bold;
    text-align: center;
    font-size: 15px;
    margin-top: 8px;
}

.incorrect-text {
    color: var(--feedback-error);
}

.feedback-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.feedback-text {
    text-align: center;
    margin-top: 16px;
    min-height: 24px;
}

.feedback-text .correct-text {
    color: var(--feedback-success);
    font-weight: 500;
}

.feedback-text .incorrect-text {
    color: var(--feedback-error);
    font-weight: 500;
}

.return-tomorrow {
    margin: 24px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* 10. Performance Summary & Stats
   ---------------------------- */
.performance-summary {
    background-color: var(--background);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.performance-summary h2 {
    color: var(--text);
    font-size: 24px;
    margin-bottom: 8px;
}

.final-scores {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin: 32px 0;
}

.player-final, .model-final {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.score-label {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.score-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary);
}

.score-percentage {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.score-divider {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 500;
}

.final-competition-result {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    margin: 24px 0;
}

.final-competition-result h3 {
    font-size: 24px;
    margin: 0 0 12px 0;
}

.final-competition-result p {
    font-size: 16px;
    margin: 0;
}

.final-competition-result.win {
    background-color: rgba(var(--feedback-success-rgb), 0.1);
    color: var(--feedback-success);
}

.final-competition-result.loss {
    background-color: rgba(var(--feedback-error-rgb), 0.1);
    color: var(--feedback-error);
}

.final-competition-result.tie {
    background-color: var(--background);
    color: var(--text);
}

.performance-breakdown {
    margin: 32px 0;
}

.performance-breakdown h3 {
    text-align: center;
    margin-bottom: 16px;
}

.candidate-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
}

.candidate-name {
    font-weight: 500;
}

.comparison-stats {
    display: flex;
    gap: 16px;
}

.player-stat, .model-stat {
    font-size: 14px;
    color: var(--text-secondary);
}

.share-section {
    margin: 32px 0;
    text-align: center;
}

.stats-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.next-game {
    text-align: center;
    margin-top: 32px;
}

.score-distribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.distribution-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bar-label {
    width: 20px;
    text-align: center;
}

.bar-container {
    flex: 1;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
    height: 24px;
}

.bar {
    background: var(--primary);
    height: 100%;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    transition: width 0.3s ease;
}

/* 11. Modal & Overlays
   ---------------------------- */
.stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.stats-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 90%;
    width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}


.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--text);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-item {
    background: var(--background);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 14px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text);
}

.highlight .stat-value {
    color: rgb(var(--feedback-success-rgb));
}

.score-distribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.distribution-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    width: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.bar-container {
    flex: 1;
    background: var(--background);
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
}

.bar {
    height: 100%;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    transition: width 0.5s ease;
}

.category-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.category-item {
    background: var(--background);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-label {
    font-weight: 500;
}

.category-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.accuracy {
    font-weight: 600;
    color: var(--text);
}

.stats-total {
    font-size: 13px;
    color: var(--text-secondary);
}

.total-games {
    text-align: center;
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.stats-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.info-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.stats-section {
    margin: 24px 0;
}

.stats-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

@media (max-width: 500px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 20px;
    }
}

.head-to-head {
    margin: 24px 0;
}

.record-card {
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.record-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.record-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 16px;
}

.stat-group {
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
}

.stat-value.wins {
    color: rgb(var(--feedback-success-rgb));
}

.stat-value.losses {
    color: rgb(var(--feedback-error-rgb));
}

.win-rate {
    font-size: 16px;
    color: var(--text);
}

/* Performance Comparison */
.performance-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    background: var(--background);
    padding: 20px;
    border-radius: 12px;
}

.player-avg, .model-avg {
    text-align: center;
}

.score {
    font-size: 32px;
    font-weight: bold;
    color: var(--text);
}

.vs {
    font-size: 18px;
    color: var(--text-secondary);
}

.label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Voter Types */
.voter-types {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.voter-type-card {
    background: var(--background);
    padding: 16px;
    border-radius: 8px;
}

.type-title {
    font-weight: 600;
    margin-bottom: 12px;
}

.type-stats {
    display: flex;
    justify-content: space-around;
}

.player-stat, .model-stat {
    text-align: center;
}

.stat-detail {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Recent Games */
.recent-games {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.game-result {
    background: var(--background);
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.game-result.win {
    background: rgba(var(--feedback-success-rgb), 0.1);
    color: rgb(var(--feedback-success-rgb));
}

.game-result.loss {
    background: rgba(var(--feedback-error-rgb), 0.1);
    color: rgb(var(--feedback-error-rgb));
}

.game-result.tie {
    background: var(--background);
    color: var(--text);
}

.game-result .divider {
    color: var(--text-secondary);
}

/* Streaks */
.streaks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.streak-item {
    background: var(--background);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.streak-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.streak-value {
    font-size: 20px;
    font-weight: 600;
}

.streak-value.positive {
    color: rgb(var(--feedback-success-rgb));
}

.streak-value.negative {
    color: rgb(var(--feedback-error-rgb));
}

/* Responsive Adjustments */
@media (max-width: 500px) {
    .stats-content {
        padding: 16px;
    }

    .modal-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .record-stats {
        gap: 16px;
    }

    .stat-value {
        font-size: 20px;
    }

    .performance-comparison {
        padding: 16px;
    }

    .score {
        font-size: 24px;
    }

    .streaks-container {
        grid-template-columns: 1fr;
    }

    .game-result {
        padding: 6px 12px;
        font-size: 13px;
    }
}

.modal-title {
    margin-top: 0px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    max-width: unset;
    min-width: unset;
    z-index: 2;
}

.modal-close:hover {
    color: var(--text);
}

.modal-close svg {
    width: 24px;
    height: 24px;
}

/* 12. Info Section
    ---------------------------- */
.info-content h3 {
    color: var(--text);
    font-size: 20px;
    margin: 24px 0 16px 0;
}

.info-section {
    margin: 24px 0;
}

.info-section p {
    margin: 12px 0;
    line-height: 1.5;
    color: var(--text);
}

.info-section ul {
    margin: 12px 0;
    padding-left: 24px;
}

.info-section li {
    margin: 8px 0;
    color: var(--text);
}

.faq-item {
    margin: 16px 0;
}

.faq-item h4 {
    color: var(--primary);
    font-size: 16px;
    margin-bottom: 8px;
}

.faq-item p {
    color: var(--text);
    margin: 0;
}

.credits {
    border-top: 1px solid var(--border);
    padding-top: 0px;
}

.credits a {
    color: var(--primary);
    text-decoration: none;
    margin-left: 4px;
}

.credits a:hover {
    text-decoration: underline;
}

/* 13. Practice Mode
   ---------------------------- */
.practice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 24px 0;
    padding: 8px 16px;
    background-color: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.practice-mode-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.practice-stats-summary {
    font-size: 15px;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.practice-stats-summary span {
    color: var(--primary);
    font-weight: 600;
}

.practice-buttons {
    display: flex;
    gap: 8px;
}

.practice-buttons .secondary-button {
    padding: 6px 12px;
    font-size: 13px;
    height: 28px;
    display: flex;
    align-items: center;
}

/* 14. Responsive Design
   ---------------------------- */
@media (max-width: 510px) {
    .voter-navigation {
        gap: 4px;
        padding: 4px 2px;
    }

    .review-button {
        min-width: 36px;
        height: 36px;
        padding: 4px;
    }

    .review-name {
        display: none;
    }

    .review-number {
        font-size: 12px;
    }
}

@media (max-width: 500px) {
    .practice-mode-label {
        display: none;
    }
    
    .practice-stats-summary {
        font-size: 14px;
    }
}

/* Animations
   ---------------------------- */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}