* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', cursive;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 500px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

h1 {
    color: #764ba2;
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.hidden { display: none !important; }

/* Auth Screen */
.auth-container {
    max-width: 350px;
    margin: 0 auto;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form input {
    padding: 15px;
    border: 3px solid #764ba2;
    border-radius: 15px;
    font-size: 1.1em;
    font-family: inherit;
    outline: none;
}

.auth-form input:focus {
    border-color: #f093fb;
    box-shadow: 0 0 10px rgba(240, 147, 251, 0.3);
}

.auth-error {
    color: #e74c3c;
    font-size: 0.9em;
    min-height: 20px;
}

.auth-switch {
    margin-top: 15px;
    color: #666;
}

.auth-switch a {
    color: #764ba2;
    cursor: pointer;
    text-decoration: underline;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-radius: 15px;
}

.user-info span {
    font-size: 0.9em;
    color: #333;
}

.btn-logout {
    padding: 8px 15px;
    font-size: 0.9em;
}

/* Welcome */
.welcome-name {
    color: #f093fb;
    font-size: 1.5em;
    margin-bottom: 20px;
}

.nickname {
    color: #f5576c;
    font-weight: bold;
}

/* Score Board */
.score-board {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.score-item {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.streak-fire {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

/* Question */
.question-box {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    padding: 30px;
    border-radius: 25px;
    margin: 20px 0;
}

.question {
    font-size: 2.5em;
    color: #333;
    font-weight: bold;
}

/* Input */
.input-container { margin: 20px 0; }

#answer {
    font-size: 2em;
    width: 120px;
    padding: 15px;
    border: 4px solid #764ba2;
    border-radius: 20px;
    text-align: center;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}

#answer:focus {
    border-color: #f093fb;
    box-shadow: 0 0 20px rgba(240, 147, 251, 0.5);
    transform: scale(1.05);
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.3em;
    border-radius: 30px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(118, 75, 162, 0.4);
    margin: 5px;
    text-decoration: none;
    display: inline-block;
}

.btn:hover, .btn:active {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(118, 75, 162, 0.6);
}

.btn-start {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    font-size: 1.5em;
    padding: 20px 50px;
}

/* Table Selector */
.table-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.table-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5em;
    font-weight: bold;
    border: 3px solid #764ba2;
    background: white;
    color: #764ba2;
    cursor: pointer;
    transition: all 0.3s;
}

.table-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.1);
}

.table-btn:hover { transform: scale(1.1); }

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 10px 20px;
    border-radius: 20px;
    border: 3px solid #764ba2;
    background: white;
    color: #764ba2;
    font-family: inherit;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Timer Config */
.timer-config {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 15px;
    border-radius: 20px;
    margin: 15px 0;
}

.timer-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1em;
    color: #666;
}

.timer-toggle input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.timer-slider {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.timer-slider input[type="range"] {
    width: 150px;
    cursor: pointer;
}

.timer-value {
    font-weight: bold;
    color: #764ba2;
    min-width: 40px;
}

/* Timer Display */
.timer-display {
    font-size: 1.5em;
    font-weight: bold;
    padding: 10px 25px;
    border-radius: 25px;
    margin: 10px 0;
    display: inline-block;
}

.timer-normal {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #333;
}

.timer-warning {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #333;
    animation: pulse 0.5s ease infinite;
}

.timer-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    animation: pulse 0.3s ease infinite;
}

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

/* QCM */
.qcm-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.qcm-btn {
    padding: 20px;
    font-size: 1.8em;
    font-weight: bold;
    border: 4px solid #764ba2;
    border-radius: 20px;
    background: white;
    color: #764ba2;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.qcm-btn:hover, .qcm-btn:active {
    transform: scale(1.05);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.qcm-btn.correct-answer {
    background: linear-gradient(135deg, #84fab0 0%, #27ae60 100%);
    border-color: #27ae60;
    color: white;
    animation: bounce 0.5s ease;
}

.qcm-btn.wrong-answer {
    background: linear-gradient(135deg, #f093fb 0%, #e74c3c 100%);
    border-color: #e74c3c;
    color: white;
    animation: shake 0.5s ease;
}

.qcm-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Feedback */
.feedback {
    font-size: 1.5em;
    margin: 20px 0;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.feedback-icon {
    font-size: 4em;
    animation: bounce 0.5s ease;
}

.feedback-text { margin-top: 10px; font-weight: bold; }
.correct { color: #27ae60; }
.wrong { color: #e74c3c; }

/* Progress */
.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #84fab0 0%, #8fd3f4 50%, #a8edea 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.level-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1em;
    font-weight: bold;
    color: #8b4513;
    margin: 10px 0;
}

/* Trophies */
.trophy-case {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 15px;
    border-radius: 20px;
    margin: 15px 0;
}

.trophy-title {
    font-size: 1.2em;
    color: #8b4513;
    margin-bottom: 10px;
}

.trophies {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.trophy {
    font-size: 2em;
    filter: grayscale(100%);
    opacity: 0.3;
    transition: all 0.3s;
}

.trophy.earned {
    filter: none;
    opacity: 1;
    animation: trophyPop 0.5s ease;
}

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

/* Mistakes */
.mistakes-section {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 20px;
    border-radius: 20px;
    margin: 20px 0;
    text-align: left;
}

.mistakes-title {
    font-size: 1.2em;
    color: #8b4513;
    margin-bottom: 15px;
    text-align: center;
}

.mistake-item {
    background: white;
    padding: 10px 15px;
    border-radius: 15px;
    margin: 8px 0;
    font-size: 1.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.encouragement {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    padding: 15px;
    border-radius: 20px;
    margin: 15px 0;
    font-size: 1.1em;
    color: #333;
}

/* Stars & Effects */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
}

.star {
    position: absolute;
    font-size: 2em;
    animation: fall 2s ease-out forwards;
}

@keyframes fall {
    0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.potato { animation: shake 0.5s ease; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    75% { transform: translateX(10px) rotate(5deg); }
}

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

.confetti {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3em;
    animation: confettiFall 3s ease-out forwards;
    z-index: 1001;
}

@keyframes confettiFall {
    0% { top: -50px; opacity: 1; }
    100% { top: 100vh; opacity: 0; }
}

.mascot {
    font-size: 5em;
    margin: 20px 0;
    animation: float 3s ease-in-out infinite;
}

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

/* Responsive */
@media (max-width: 400px) {
    .container { padding: 20px; }
    h1 { font-size: 1.5em; }
    .question { font-size: 2em; }
    #answer { font-size: 1.5em; width: 100px; }
}

/* Revision button */
.btn-revision {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    margin-bottom: 15px;
    font-size: 1.2em;
    padding: 15px 30px;
}

.btn-revision:hover {
    transform: translateY(-3px) scale(1.05);
}

/* Correct answer display after wrong answer */
.correct-answer-display {
    margin-top: 15px;
    padding: 15px 25px;
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    border-radius: 20px;
    font-size: 1.4em;
    font-weight: bold;
    color: #2d5a3d;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Options config */
.options-config {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 15px;
    border-radius: 20px;
    margin: 15px 0;
}

.option-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1em;
    color: #2e7d32;
}

.option-toggle input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #4caf50;
}
