/* Quiz Engine Styles - Akirach.com Diamond Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

/* Stars Background */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.8)"/><circle cx="50" cy="30" r="1" fill="rgba(255,255,255,0.6)"/><circle cx="80" cy="60" r="1" fill="rgba(255,255,255,0.9)"/></svg>') repeat;
    animation: starsMove 100s linear infinite;
    z-index: 0;
}

@keyframes starsMove {
    from { transform: translateY(0); }
    to { transform: translateY(-100px); }
}

/* Main Container */
#quiz-app {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Welcome Screen */
.quiz-welcome {
    text-align: center;
    padding: 40px 20px;
    animation: fadeInUp 0.8s ease-out;
}

.quiz-logo {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.quiz-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
    font-weight: 700;
}

.quiz-description {
    font-size: 1.2rem;
    color: #cbd5e1;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* User Info */
.user-info {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.guest-badge, .user-badge {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #fbbf24;
}

/* Difficulty Selector */
.difficulty-selector {
    margin: 40px 0;
}

.difficulty-selector h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #f1f5f9;
}

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

.diff-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.diff-btn:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(96, 165, 250, 0.3);
}

.diff-btn.active {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-color: #60a5fa;
    box-shadow: 0 0 30px rgba(96, 165, 250, 0.5);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 15px 40px;
    font-size: 1.2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    margin: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    color: #fff;
    box-shadow: 0 10px 30px rgba(96, 165, 250, 0.4);
}

.btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(96, 165, 250, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.btn-large {
    font-size: 1.5rem;
    padding: 20px 60px;
}

/* Question Container */
.quiz-question-container {
    animation: fadeInUp 0.5s ease-out;
}

.quiz-progress {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa 0%, #a78bfa 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.8);
}

.progress-text {
    text-align: center;
    color: #cbd5e1;
    font-size: 1.1rem;
}

/* Question Card */
.question-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.question-text {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 30px;
    line-height: 1.5;
    color: #f1f5f9;
}

/* Answers Grid */
.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.answer-btn {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
    font-size: 1.1rem;
}

.answer-letter {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.answer-text {
    flex: 1;
}

.answer-btn:hover {
    transform: translateX(10px);
    background: rgba(96, 165, 250, 0.2);
    border-color: #60a5fa;
    box-shadow: 0 10px 30px rgba(96, 165, 250, 0.3);
}

.answer-btn:focus {
    outline: none;
}

.answer-btn:focus-visible {
    outline: none;
}

/* Feedback Overlay */
.feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.feedback-overlay.correct {
    background: rgba(74, 222, 128, 0.9);
}

.feedback-overlay.wrong {
    background: rgba(239, 68, 68, 0.9);
}

.feedback-content {
    text-align: center;
    animation: scaleIn 0.5s ease-out;
}

.feedback-icon {
    font-size: 8rem;
    margin-bottom: 20px;
}

.feedback-content h3 {
    font-size: 3rem;
    font-weight: 700;
}

/* Results Screen */
.quiz-results {
    text-align: center;
    padding: 40px 20px;
    animation: fadeInUp 0.8s ease-out;
}

.results-header {
    margin-bottom: 40px;
}

.trophy-icon {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.results-header h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.new-best {
    color: #fbbf24;
    font-size: 1.5rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Results Stats */
.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(96, 165, 250, 0.3);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.stat-label {
    color: #cbd5e1;
    font-size: 1rem;
}

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

/* High Scores */
.highscores-container {
    animation: fadeInUp 0.8s ease-out;
}

.highscores-title {
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.highscores-chart {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#scoresChart {
    width: 100%;
    height: 300px;
}

/* High Scores Table */
.highscores-table {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(96, 165, 250, 0.2);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 700;
    color: #60a5fa;
    border-bottom: 2px solid rgba(96, 165, 250, 0.5);
}

td {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

tr.current-user {
    background: rgba(251, 191, 36, 0.2);
    border-left: 4px solid #fbbf24;
}

.rank {
    font-weight: 700;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.username {
    font-weight: 600;
    color: #f1f5f9;
}

.difficulty-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.difficulty-badge.easy {
    background: #4ade80;
    color: #000;
}

.difficulty-badge.medium {
    background: #fbbf24;
    color: #000;
}

.difficulty-badge.hard {
    background: #ef4444;
    color: #fff;
}

/* Auth Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.auth-modal-content {
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    padding: 40px;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    border: 2px solid rgba(96, 165, 250, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: scaleIn 0.4s ease-out;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #fff;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.close-modal:hover {
    opacity: 1;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
}

.auth-tab.active {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-color: #60a5fa;
}

.auth-form h2 {
    margin-bottom: 20px;
    color: #f1f5f9;
}

.auth-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.auth-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

.auth-message {
    margin-top: 10px;
    font-size: 0.95rem;
    min-height: 20px;
}

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

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

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stars {
        animation: none;
        background: none;
    }

    /* Disable heavy animations on mobile */
    .quiz-logo,
    .trophy-icon,
    .new-best {
        animation: none !important;
    }

    /* Disable backdrop blur on mobile for performance */
    .question-card,
    .stat-card,
    .highscores-chart,
    .highscores-table {
        backdrop-filter: none;
    }

    #quiz-app {
        padding: 15px;
    }

    .question-card {
        padding: 25px;
    }

    .answers-grid {
        grid-template-columns: 1fr;
    }

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

    .difficulty-buttons {
        flex-direction: column;
    }

    .diff-btn {
        width: 100%;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 10px 5px;
    }

    .auth-modal-content {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .quiz-title {
        font-size: 1.8rem;
    }

    .question-text {
        font-size: 1.3rem;
    }

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

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