/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--container-bg);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px var(--shadow);
    animation: slideUp 0.3s ease-out;
    position: relative;
    transition: background 0.3s ease;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--info-bg);
    color: var(--text-color);
    transform: rotate(90deg);
}

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

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.splash-content {
    background: var(--container-bg);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px var(--shadow);
    transition: background 0.3s ease;
}

.splash-title {
    font-size: 48px;
    margin-bottom: 30px;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.splash-instructions h2 {
    font-size: 24px;
    color: var(--text-color);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.splash-instructions p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.6;
    transition: color 0.3s ease;
}

.splash-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
    text-align: center;
    margin: 20px 0 30px 0;
    max-width: 450px;
}

.splash-note {
    font-size: 14px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 20px;
    transition: color 0.3s ease;
}

.play-btn {
    margin-top: 30px;
    padding: 15px 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Splash Screen Mobile - Full screen up to 768px */
@media (max-width: 768px) {
    .splash-screen {
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .splash-content {
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 30px 20px;
        box-shadow: none;
        text-align: center;
    }

    .splash-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .splash-title {
        font-size: 36px;
        margin-bottom: 20px;
        text-align: center;
    }

    .splash-description {
        font-size: 15px;
        margin: 15px auto 25px auto;
        text-align: center;
        max-width: 100%;
    }

    .play-btn {
        width: 100%;
        max-width: 300px;
        padding: 16px 30px;
        font-size: 18px;
        margin-top: 25px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .splash-content {
        padding: 20px 20px;
    }

    .splash-title {
        font-size: 32px;
    }

    .splash-icon {
        font-size: 48px !important;
    }

    .splash-description {
        font-size: 14px;
    }

    .play-btn {
        max-width: 280px;
        padding: 14px 25px;
        font-size: 16px;
    }
}

/* Statistics Modal */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-color);
    transition: color 0.3s ease;
}

/* Help Modal */
.help-modal-content {
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

.help-content {
    color: var(--text-color);
}

.help-section {
    margin-bottom: 12px;
}

.help-section-header {
    background: var(--info-bg);
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.help-section-header:hover {
    background: var(--border-color);
}

.help-section-header > i:first-child {
    font-size: 20px;
    color: #667eea;
    flex-shrink: 0;
}

.help-section-header h3 {
    flex: 1;
    margin: 0;
    font-size: 16px;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.help-chevron {
    font-size: 14px !important;
    color: var(--text-secondary) !important;
    transition: transform 0.3s ease;
}

.help-section-header.active .help-chevron {
    transform: rotate(180deg);
}

.help-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 20px;
}

.help-section-content.expanded {
    max-height: 500px;
    padding: 15px 20px;
}

.help-section-content p {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.help-section-content p:last-child {
    margin-bottom: 0;
}

.help-section-content strong {
    color: var(--text-color);
    font-weight: 600;
}

.help-note {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 20px;
}

.help-note i {
    font-size: 20px;
    color: #667eea;
    margin-top: 2px;
    flex-shrink: 0;
}

.help-note p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.help-note strong {
    color: var(--text-color);
    font-weight: 600;
}

@media (max-width: 480px) {
    .help-modal-content {
        padding: 30px 20px;
        max-height: 90vh;
    }
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

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

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
    transition: color 0.3s ease;
}

.guess-distribution h3 {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.distribution-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.distribution-label {
    width: 50px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.distribution-graph {
    flex: 1;
    height: 25px;
    background: var(--info-bg);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 10px;
    transition: background 0.3s ease;
}

.distribution-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 25px;
    transition: width 0.3s ease;
}

/* Game Over Modal */
.game-over {
    text-align: center;
}

.game-over-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 15px;
}

.game-over-title.win {
    color: #4caf50;
}

.game-over-title.lose {
    color: #f44336;
}

.performance-rating {
    font-size: 20px;
    font-weight: bold;
    margin: 15px 0;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    display: inline-block;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
        transform: scale(1.02);
    }
}

.game-over-stats {
    margin: 20px 0;
    padding: 20px;
    background: var(--info-bg);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 16px;
}

.stat-label {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.stat-value {
    font-weight: 600;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.stat-row.streak-highlight {
    background: linear-gradient(90deg, rgba(255, 138, 0, 0.1) 0%, rgba(255, 69, 0, 0.1) 100%);
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #ff8c00;
    animation: streak-pulse 2s ease-in-out infinite;
}

@keyframes streak-pulse {
    0%, 100% {
        border-left-color: #ff8c00;
    }
    50% {
        border-left-color: #ff4500;
    }
}

.stat-row.streak-highlight .stat-value {
    color: #ff8c00;
    font-weight: 700;
}

.stat-row.answer-reveal {
    background: rgba(244, 67, 54, 0.1);
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #f44336;
    font-family: monospace;
}

.stat-row.answer-reveal .stat-value {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 2px;
}

.share-btn {
    padding: 12px 30px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    margin-bottom: 10px;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-message {
    margin-top: 10px;
    color: #4caf50;
    font-size: 14px;
    font-weight: 600;
}

/* Improved Splash Screen */
.splash-header {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.splash-icon {
    font-size: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: var(--info-bg);
    border-radius: 12px;
    transition: transform 0.2s, background 0.3s ease;
    text-align: left;
}

.instruction-item:hover {
    transform: translateY(-5px);
}

.instruction-item i {
    font-size: 20px;
    color: #667eea;
    flex-shrink: 0;
    margin-top: 2px;
}

.instruction-item p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.play-btn {
    margin-top: 30px;
    padding: 16px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.play-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.play-btn:active {
    transform: translateY(-1px);
}
