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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.screen.hidden {
    display: none !important;
}

.menu-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 50px 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.menu-container h1 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 3em;
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    max-width: 600px;
    width: 100%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header h1 {
    margin: 0;
    font-size: 2em;
}

.pause-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5em;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.pause-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.pause-btn:active {
    transform: scale(0.95);
}

.currency-counters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.coin-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 215, 0, 0.3);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    color: #FFD700;
}

.gem-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(147, 51, 234, 0.3);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    color: #9333EA;
}

.gem-icon {
    font-size: 1.2em;
}

.pyrite-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 200, 0, 0.3);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    color: #FFC800;
}

.pyrite-icon {
    font-size: 1.2em;
}

.stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.coin-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 215, 0, 0.3);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 10px;
}

.coin-icon {
    font-size: 1.2em;
}

.stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.stats.hidden {
    display: none;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 1.1em;
}

.label {
    font-weight: bold;
}

.game-area {
    position: relative;
    display: flex;
    justify-content: center;
    background: #0f0f1e;
    padding: 20px;
    pointer-events: auto;
}

#gameCanvas {
    border: 3px solid #2a2a3e;
    border-radius: 10px;
    background: linear-gradient(to bottom, #1a1a2e 0%, #0f0f1e 100%);
    display: block;
    width: 100%;
    max-width: 560px;
    pointer-events: none;
}

.answers-container {
    padding: 20px;
    background: #f9f9f9;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.answers-container.hidden {
    display: none;
}

.answers-label {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    color: #111;
    margin-bottom: 15px;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.answer-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px;
    font-size: 1.5em;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

.answer-btn:active {
    transform: translateY(0);
}

.answer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.answer-btn.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    animation: correctPulse 0.3s;
}

.answer-btn.incorrect {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    animation: shake 0.3s;
}

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

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

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 200;
    pointer-events: auto;
}

.game-over.hidden {
    display: none;
}

.victory-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 200;
    min-width: 300px;
    pointer-events: auto;
}

.victory-screen.hidden {
    display: none;
}

.pause-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: auto;
}

.pause-screen.hidden {
    display: none;
}

.pause-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    min-width: 300px;
}

.pause-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.resume-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.resume-btn:hover {
    transform: scale(1.05);
}

.victory-screen h2 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 2em;
}

.victory-message {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.unlock-message {
    margin: -8px 0 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.25);
    color: #2d2d2d;
    font-weight: 700;
}

.rewards {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.rewards p {
    font-size: 1.3em;
    margin: 10px 0;
    color: #111;
    font-weight: bold;
}

.rewards span {
    color: #667eea;
    font-size: 1.3em;
}

.victory-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.next-level-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.next-level-btn:hover {
    transform: scale(1.05);
}

.menu-subtitle {
    color: #222;
    margin-bottom: 30px;
    font-size: 1.2em;
    font-weight: 600;
}

.difficulty-selector {
    margin-bottom: 25px;
}

.difficulty-label {
    color: #222;
    font-size: 1.05em;
    margin-bottom: 10px;
    font-weight: bold;
}

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

.difficulty-btn {
    background: #f0f0f0;
    color: #111;
    border: 2px solid #ddd;
    padding: 10px 18px;
    font-size: 0.95em;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    min-width: 80px;
    white-space: nowrap;
}

.difficulty-btn:hover {
    background: #e0e0e0;
    border-color: #667eea;
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.difficulty-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.grade-selector {
    margin: 25px 0;
}

.grade-label {
    color: #222;
    font-size: 1.05em;
    margin-bottom: 12px;
    font-weight: bold;
}

.grade-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 500px;
    margin: 0 auto;
}

.grade-btn {
    background: #f0f0f0;
    color: #111;
    border: 2px solid #ddd;
    padding: 10px 16px;
    font-size: 1em;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    min-width: 50px;
}

.grade-btn:hover {
    background: #e0e0e0;
    border-color: #667eea;
    transform: translateY(-2px);
}

.grade-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.grade-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.subject-selector {
    margin: 25px 0;
}

.subject-label {
    color: #222;
    font-size: 1.05em;
    margin-bottom: 12px;
    font-weight: bold;
}

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

.subject-btn {
    background: #f0f0f0;
    color: #111;
    border: 2px solid #ddd;
    padding: 12px 20px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    min-width: 100px;
}

.subject-btn:hover {
    background: #e0e0e0;
    border-color: #667eea;
    transform: translateY(-2px);
}

.subject-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.subject-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.subject-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: #e0e0e0;
    color: #999;
}

.subject-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.play-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.5em;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.play-btn:active {
    transform: scale(1.02);
}

.shop-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 20px;
    margin-top: 10px;
}

.shop-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

.shop-btn:active {
    transform: scale(1.02);
}

.high-score-text {
    color: #222;
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 15px;
}

.menu-btn {
    background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
    transition: transform 0.2s;
}

.menu-btn:hover {
    transform: scale(1.05);
}

.game-over h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

.game-over p {
    font-size: 1.4em;
    margin: 10px 0;
    color: #111;
    font-weight: 600;
}

#restartBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 20px;
    font-weight: bold;
    transition: transform 0.2s;
}

#restartBtn:hover {
    transform: scale(1.05);
}

/* Shop Screen */
.shop-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 40px;
    text-align: center;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.shop-container h1 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2.5em;
    font-weight: bold;
}

.shop-back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1.1em;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.shop-back-btn:hover {
    transform: scale(1.05);
}

.shop-content {
    margin-top: 20px;
}

.shop-currency-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.boosters-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.booster-item {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.booster-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.booster-info {
    text-align: left;
    flex: 1;
}

.booster-info h3 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1.4em;
    font-weight: bold;
}

.booster-info p {
    color: #111;
    margin: 6px 0;
    font-size: 1.1em;
    font-weight: 500;
}

.booster-level {
    color: #764ba2;
    font-weight: bold;
    font-size: 1.1em;
}

.booster-purchase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.booster-cost {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1.3em;
    font-weight: bold;
    color: #111;
}

.buy-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

.buy-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.buy-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    color: #666;
}

.buy-btn:disabled:hover {
    transform: none;
}

/* Responsive design */
@media (max-width: 600px) {
    .header h1 {
        font-size: 1.5em;
    }

    .stats {
        font-size: 0.9em;
    }

    .stat {
        padding: 6px 12px;
    }

    .answer-btn {
        padding: 15px;
        font-size: 1.2em;
    }
}

