* {
    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;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

header h1 {
    color: white;
    font-size: 2.2em;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

.user-info, .nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info #current-user {
    color: white;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9em;
}

.btn-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.score-display {
    display: flex;
    gap: 15px;
    color: white;
    font-weight: bold;
    font-size: 1.1em;
}

main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    display: none;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    text-align: center;
}

.screen.active {
    display: block;
}

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

.category-btn {
    padding: 18px 12px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.category-btn .category-icon {
    font-size: 2em;
    margin-bottom: 3px;
}

.category-btn .category-name {
    font-size: 1.1em;
    font-weight: bold;
    line-height: 1.2;
}

.category-btn .category-description {
    font-size: 0.85em;
    opacity: 0.9;
    font-weight: normal;
    line-height: 1.3;
    max-width: 200px;
}

.category-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.4);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.question-container {
    margin-bottom: 25px;
}

#question-text {
    font-size: 1.4em;
    margin-bottom: 20px;
    line-height: 1.5;
    color: #333;
}

.answers-container {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.answer-btn {
    padding: 12px;
    font-size: 1.1em;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.answer-btn:hover {
    background: #f8f9fa;
    border-color: #4facfe;
    transform: translateY(-2px);
}

.answer-btn.selected {
    background: #4facfe;
    color: white;
    border-color: #4facfe;
}

.answer-btn.correct {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.answer-btn.incorrect {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.answer-btn:disabled {
    cursor: not-allowed;
}

.quiz-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.control-btn {
    padding: 10px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:not(.secondary) {
    background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.control-btn.secondary {
    background: #6c757d;
    color: white;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.result-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 40px 0;
    flex-wrap: wrap;
    gap: 30px;
}

.result-score h3 {
    font-size: 2.5em;
    color: #4facfe;
    margin-bottom: 10px;
}

.result-score p {
    font-size: 1.3em;
    color: #666;
}

.percentage-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(#4facfe 0deg, #e0e0e0 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.percentage-circle::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
}

#percentage-text {
    font-size: 1.5em;
    font-weight: bold;
    color: #4facfe;
    z-index: 1;
}

.result-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    main {
        align-items: flex-start;
        padding-top: 10px;
    }
    
    header {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .score-display {
        flex-direction: column;
        gap: 8px;
        font-size: 1em;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 15px;
    }
    
    .category-btn {
        padding: 15px 10px;
        font-size: 1.1em;
    }
    
    .category-btn .category-icon {
        font-size: 1.8em;
    }
    
    .category-btn .category-name {
        font-size: 1em;
    }
    
    .category-btn .category-description {
        font-size: 0.85em;
    }
    
    .screen {
        padding: 15px;
        border-radius: 15px;
        margin-top: 0;
    }
    
    #question-text {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .question-container {
        margin-bottom: 15px;
        margin-top: 0;
    }
    
    .answers-container {
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .answer-btn {
        padding: 10px;
        font-size: 1em;
    }
    
    .quiz-controls {
        gap: 8px;
    }
    
    .control-btn {
        padding: 8px 15px;
        font-size: 1em;
    }
    
    .result-info {
        flex-direction: column;
        margin: 20px 0;
        gap: 15px;
    }
    
    .result-score h3 {
        font-size: 2.2em;
    }
    
    .result-score p {
        font-size: 1.2em;
    }
    
    .percentage-circle {
        width: 100px;
        height: 100px;
    }
    
    .percentage-circle::before {
        width: 70px;
        height: 70px;
    }
    
    #percentage-text {
        font-size: 1.4em;
    }
    
    .result-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .control-btn {
        width: 100%;
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 10% auto;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    color: white;
    text-align: center;
}

.modal-content.large {
    max-width: 800px;
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-content p {
    margin-bottom: 20px;
    opacity: 0.9;
}

#username-input {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    margin-bottom: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
}

#username-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Highscore Modal */
.highscore-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.category-tab {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.category-tab.active {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.category-tab:hover {
    background: rgba(255, 255, 255, 0.3);
}

.highscore-list {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.highscore-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.highscore-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.highscore-item.current-user {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.highscore-rank {
    font-weight: bold;
    margin-right: 15px;
    min-width: 30px;
}

.highscore-name {
    flex: 1;
    text-align: left;
}

.highscore-score {
    font-weight: bold;
    color: #FFD700;
}

.no-highscores {
    text-align: center;
    opacity: 0.7;
    font-style: italic;
    padding: 40px;
}

/* Achievement */
.achievement {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
    animation: achievementPulse 2s ease-in-out;
}

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

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    main {
        align-items: flex-start;
        padding-top: 5px;
    }
    
    header {
        padding: 8px;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .score-display {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .highscore-categories {
        flex-direction: column;
        align-items: center;
    }
    
    header h1 {
        font-size: 1.6em;
    }
    
    .screen {
        padding: 12px;
    }
    
    #question-text {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .answer-btn {
        padding: 8px;
        font-size: 0.95em;
    }
    
    .control-btn {
        padding: 6px 12px;
        font-size: 0.95em;
    }
    
    .category-btn {
        padding: 12px 8px;
    }
    
    .category-btn .category-icon {
        font-size: 1.6em;
    }
    
    .category-btn .category-name {
        font-size: 0.95em;
    }
    
    .result-score h3 {
        font-size: 2em;
    }
}

/* Footer Styles */
.category-footer {
    margin-top: 40px;
    background: linear-gradient(135deg, rgba(30, 30, 45, 0.95), rgba(20, 20, 35, 0.98));
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(15px);
    color: white;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 20px;
}

.footer-section {
    text-align: left;
}

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #FFD700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

.footer-section p {
    line-height: 1.6;
    opacity: 1;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #f0f0f0;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section li {
    padding: 4px 0;
    opacity: 1;
    font-size: 0.9em;
    color: #f0f0f0;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-link {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.4);
    color: #f0f0f0;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 0.9em;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.footer-link:hover {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    color: #FFD700;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    margin: 5px 0;
    opacity: 1;
    font-size: 0.9em;
    color: #e0e0e0;
}

.version {
    font-style: italic;
    color: #FFD700;
}

/* Info Modal Content Styles */
.about-content, .help-content, .privacy-content {
    text-align: left;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.about-content section, 
.help-content section, 
.privacy-content section {
    margin-bottom: 25px;
}

.about-content h4, 
.help-content h4, 
.privacy-content h4 {
    color: #FFD700;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.about-content p, 
.help-content p, 
.privacy-content p {
    line-height: 1.6;
    margin-bottom: 10px;
    opacity: 0.9;
}

.about-content ul, 
.help-content ul, 
.privacy-content ul,
.help-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.about-content li, 
.help-content li, 
.privacy-content li {
    margin-bottom: 8px;
    line-height: 1.5;
    opacity: 0.9;
}

.help-content ol li {
    margin-bottom: 10px;
    padding-left: 5px;
}

.about-content strong, 
.help-content strong, 
.privacy-content strong {
    color: #FFD700;
}

/* Scrollbar Styling for Modal Content */
.about-content::-webkit-scrollbar,
.help-content::-webkit-scrollbar,
.privacy-content::-webkit-scrollbar {
    width: 6px;
}

.about-content::-webkit-scrollbar-track,
.help-content::-webkit-scrollbar-track,
.privacy-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.about-content::-webkit-scrollbar-thumb,
.help-content::-webkit-scrollbar-thumb,
.privacy-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.about-content::-webkit-scrollbar-thumb:hover,
.help-content::-webkit-scrollbar-thumb:hover,
.privacy-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile Responsiveness for Footer */
@media (max-width: 768px) {
    .category-footer {
        padding: 20px;
        margin-top: 30px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }
    
    .footer-section h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .footer-section p,
    .footer-section li {
        font-size: 0.9em;
    }
    
    .footer-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .footer-link {
        flex: 1;
        min-width: 110px;
        text-align: center;
        font-size: 0.85em;
        padding: 8px 10px;
        background: rgba(255, 215, 0, 0.2);
        border: 2px solid rgba(255, 215, 0, 0.5);
        color: #f0f0f0;
    }
    
    .footer-link:hover {
        background: rgba(255, 215, 0, 0.3);
        color: #FFD700;
    }
    
    .footer-bottom p {
        font-size: 0.85em;
    }
}
