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

body {
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
}

/* ===== PARTICLES ===== */
.particles-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    font-size: 1.8rem;
    animation: floatParticle linear infinite;
    opacity: 0.6;
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.2));
}

@keyframes floatParticle {
    0% { transform: translateY(110vh) rotate(0deg) scale(0.8); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-10vh) rotate(360deg) scale(1.2); opacity: 0; }
}

/* ===== APP ===== */
#app {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 700px;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    animation: screenIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
    display: flex;
}

@keyframes screenIn {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== GLASSMORPHISM ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ===== HOME ===== */
.home-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.4rem;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #a855f7, #6366f1, #3b82f6);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
    line-height: 1.2;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.home-subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2.5rem;
    font-weight: 600;
}

.home-emoji-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    animation: bounceIn 1s ease;
}

.home-emoji-row span {
    animation: emojiFloat 3s ease-in-out infinite;
    display: inline-block;
}

.home-emoji-row span:nth-child(2) { animation-delay: 0.3s; }
.home-emoji-row span:nth-child(3) { animation-delay: 0.6s; }
.home-emoji-row span:nth-child(4) { animation-delay: 0.9s; }
.home-emoji-row span:nth-child(5) { animation-delay: 1.2s; }

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

.input-group {
    width: 100%;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.input-group input {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-group input:focus {
    border-color: #a855f7;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 16px;
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before { left: 100%; }

.btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

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

.btn-primary {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #00e676, #00c853);
    color: #ffffff;
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== MODE ===== */
.mode-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 0.3rem;
    color: #ffffff;
}

.mode-welcome {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    margin-bottom: 2rem;
    font-size: 1rem;
}

.mode-card {
    width: 100%;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.mode-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    padding: 2px;
    background: linear-gradient(135deg, #a855f7, #6366f1, #3b82f6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.mode-card:hover::after { opacity: 1; }
.mode-card:hover {
    transform: translateY(-5px) scale(1.02);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.mode-card-icon { font-size: 3rem; margin-bottom: 0.8rem; }
.mode-card-title { font-family: 'Fredoka One', cursive; font-size: 1.4rem; margin-bottom: 0.4rem; }
.mode-card-desc { color: rgba(255, 255, 255, 0.6); font-size: 0.95rem; font-weight: 600; }
.mode-card-badge {
    display: inline-block;
    padding: 0.25rem 0.8rem;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 0.8rem;
}

/* ===== GAME HUD ===== */
.game-hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

.hud-score {
    color: #ffd700;
    font-weight: 800;
    font-size: 1.1rem;
}

/* ===== PROGRESS ===== */
.progress-container {
    width: 100%;
    margin-bottom: 1.2rem;
}

.progress-text {
    font-weight: 700;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    text-align: center;
}

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

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #6366f1);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== GAME ARENA ===== */
.game-arena {
    width: 100%;
}

.question-box {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.question-box h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    line-height: 1.6;
    color: #ffffff;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
}

.quiz-option {
    width: 100%;
    padding: 1.1rem 1.5rem;
    background: rgba(255, 255, 255, 0.07);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    color: #ffffff;
    font-family: 'Nunito', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
}

.quiz-option-letter {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.quiz-option:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(168, 85, 247, 0.5);
    transform: translateX(8px);
}

.quiz-option:hover:not(.disabled) .quiz-option-letter {
    background: rgba(168, 85, 247, 0.3);
}

.quiz-option.correct {
    background: rgba(0, 230, 118, 0.2);
    border-color: #00e676;
    animation: correctPulse 0.6s ease;
}

.quiz-option.correct .quiz-option-letter {
    background: #00e676;
    color: #000;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.04); }
    60% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

.quiz-option.wrong {
    background: rgba(255, 23, 68, 0.2);
    border-color: #ff1744;
    animation: wrongShake 0.5s ease;
}

.quiz-option.wrong .quiz-option-letter {
    background: #ff1744;
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-12px); }
    40% { transform: translateX(12px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

.quiz-option.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.quiz-option.disabled.correct {
    opacity: 1;
}

/* ===== RESULT ===== */
.result-icon {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 1rem;
    animation: resultBounce 1s ease;
}

@keyframes resultBounce {
    0% { transform: scale(0) rotate(-20deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(5deg); }
    70% { transform: scale(0.9) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.3rem;
}

.result-player {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.result-stars {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    animation: starsIn 1s ease 0.3s both;
}

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

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

.stat-box {
    text-align: center;
    padding: 1rem 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    animation: statIn 0.5s ease both;
}

.stat-box:nth-child(1) { animation-delay: 0.4s; }
.stat-box:nth-child(2) { animation-delay: 0.55s; }
.stat-box:nth-child(3) { animation-delay: 0.7s; }

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

.stat-value {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.stat-value.green { color: #00e676; }
.stat-value.red { color: #ff1744; }
.stat-value.blue { color: #00d2ff; }

.stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

.result-wrong-section {
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.result-wrong-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wrong-item {
    background: rgba(255, 23, 68, 0.08);
    border: 1px solid rgba(255, 23, 68, 0.2);
    border-radius: 16px;
    padding: 1.2rem;
    margin-bottom: 0.8rem;
    animation: wrongItemIn 0.5s ease both;
}

.wrong-item:nth-child(2) { animation-delay: 0.1s; }
.wrong-item:nth-child(3) { animation-delay: 0.2s; }
.wrong-item:nth-child(4) { animation-delay: 0.3s; }
.wrong-item:nth-child(5) { animation-delay: 0.4s; }

@keyframes wrongItemIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.wrong-item-question {
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.wrong-item-answers {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
}

.wrong-item-given { color: #ff6b6b; font-weight: 600; }
.wrong-item-correct { color: #69f0ae; font-weight: 600; }

.result-buttons {
    display: flex;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
}

.result-buttons .btn {
    flex: 1;
    min-width: 140px;
}

/* ===== CONFETTI ===== */
.confetti-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    top: -20px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg) scale(0.3); opacity: 0; }
}

/* ===== FLASH ===== */
.flash-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.flash-overlay.flash-correct {
    background: radial-gradient(circle, rgba(0,230,118,0.15), transparent 70%);
    opacity: 1;
    animation: flashFade 0.6s ease forwards;
}

.flash-overlay.flash-wrong {
    background: radial-gradient(circle, rgba(255,23,68,0.15), transparent 70%);
    opacity: 1;
    animation: flashFade 0.6s ease forwards;
}

@keyframes flashFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    .home-title { font-size: 1.9rem; }
    .glass-card { padding: 1.8rem 1.2rem; border-radius: 20px; }
    .result-stats { grid-template-columns: 1fr 1fr 1fr; gap: 0.6rem; }
    .stat-value { font-size: 1.6rem; }
    .game-hud { justify-content: center; }
    .question-box h3 { font-size: 1.15rem; }
    .home-emoji-row { font-size: 2rem; }
    .result-buttons { flex-direction: column; }
}
