/* ============================================
   Crypto Cat Adventure - Platformer Styles
   Dark cyber theme with pixel art game
   ============================================ */

/* Base resets */
.game-view {
    min-height: 100px;
}

.game-view button,
.game-stats-bar button {
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.game-subtitle {
    color: #8892b0;
    font-size: 1rem;
    margin-top: 0.25rem;
}

/* ---- Stats Bar ---- */
.game-stats-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: #1a2332;
    border: 1px solid rgba(78, 205, 196, 0.15);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    font-weight: 600;
    font-size: 1.1rem;
}

.stat-coins {
    color: #f7931a;
    font-family: 'Courier New', monospace;
}

.stat-cats {
    color: #4ecdc4;
}

.stat-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.btn-game {
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    border: 1px solid rgba(78, 205, 196, 0.3);
    background: #1e293b;
    color: #e6f1ff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-game:hover {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.15);
}

.btn-reset {
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-reset:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* ---- World Map ---- */
.world-map-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    max-width: 1000px;
    margin: 0 auto;
}

.level-node {
    background: #1a2332;
    border: 2px solid rgba(78, 205, 196, 0.2);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.level-node:hover:not(.locked) {
    transform: translateY(-4px);
    border-color: #4ecdc4;
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.25);
}

.level-node.locked {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

.level-node.completed {
    border-color: rgba(16, 185, 129, 0.4);
}

.level-node.perfect {
    border-color: rgba(247, 147, 26, 0.5);
    box-shadow: 0 0 18px rgba(247, 147, 26, 0.15);
}

.level-number {
    font-size: 2.2rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: #4ecdc4;
    line-height: 1;
}

.level-world {
    font-size: 1rem;
    color: #e6f1ff;
    margin: 0.5rem 0 0.25rem;
    font-weight: 600;
}

.level-difficulty {
    color: #f7931a;
    font-size: 0.85rem;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.level-score {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #8892b0;
}

.level-score .score-value {
    color: #10b981;
    font-weight: 600;
}

.level-cat-preview {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.level-lock {
    font-size: 0.9rem;
    color: #64748b;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    margin-bottom: 0.3rem;
}

.level-crown {
    position: absolute;
    top: -6px;
    left: 10px;
    font-size: 1rem;
    color: #f7931a;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* ---- Platformer Canvas ---- */
.game-canvas-wrapper {
    max-width: 820px;
    margin: 0 auto;
    border: 2px solid rgba(78, 205, 196, 0.3);
    border-radius: 12px;
    overflow: hidden;
    background: #0a1628;
    position: relative;
    z-index: 1;
}

.game-canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    position: relative;
    z-index: 1;
}

/* ---- Quiz Overlay ---- */
/* Quiz is shown as an overlay ON TOP of the platformer canvas.
   The canvas is never hidden, preventing Phaser resize loops. */

.quiz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: rgba(10, 22, 40, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-overlay-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 2rem 1rem;
}

.quiz-popup {
    background: #1a2332;
    border: 2px solid rgba(78, 205, 196, 0.3);
    border-radius: 16px;
    padding: 2rem;
    max-width: 650px;
    width: 90%;
    margin: 0 auto;
}

/* Quiz question/options reuse */
.quiz-popup .question-card {
    background: #151d2b;
    border: 1px solid rgba(78, 205, 196, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.quiz-popup .question-text {
    font-size: 1.1rem;
    color: #e6f1ff;
    line-height: 1.7;
}

.quiz-popup .options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.quiz-popup .option-btn {
    display: block;
    width: 100%;
    background: #1e293b;
    border: 2px solid rgba(78, 205, 196, 0.15);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    color: #e6f1ff;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    line-height: 1.5;
    -webkit-appearance: none;
    appearance: none;
}

.quiz-popup .option-btn:hover:not(.disabled) {
    border-color: #4ecdc4;
    background: #1e3a4a;
}

.quiz-popup .option-btn.correct {
    border-color: #10b981;
    background: #132b23;
    color: #34d399;
}

.quiz-popup .option-btn.incorrect {
    border-color: #ef4444;
    background: #2b1313;
    color: #f87171;
}

.quiz-popup .option-btn.disabled {
    cursor: default;
    opacity: 0.7;
}

.feedback-panel {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-top: 1rem;
    animation: feedbackSlide 0.3s ease;
}

.feedback-panel.correct {
    background: #132b23;
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.feedback-panel.incorrect {
    background: #2b1313;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.feedback-panel .feedback-text {
    color: #cbd5e1;
    margin-top: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.btn-next {
    display: block;
    margin: 1.25rem auto 0;
    padding: 0.6rem 2rem;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: #0a0e1a;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

/* ---- Results ---- */
.result-container {
    max-width: 550px;
    margin: 0 auto;
    text-align: center;
}

.result-card {
    background: #1a2332;
    border: 1px solid rgba(78, 205, 196, 0.15);
    border-radius: 16px;
    padding: 2.5rem 2rem;
}

.result-title {
    font-size: 1.5rem;
    color: #e6f1ff;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.score-display {
    font-size: 3.5rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #4ecdc4;
    margin: 0.75rem 0;
    line-height: 1;
}

.score-display .score-total {
    font-size: 1.8rem;
    color: #64748b;
}

.coins-earned {
    font-size: 1.3rem;
    color: #f7931a;
    font-family: 'Courier New', monospace;
    margin: 0.75rem 0;
    animation: coinPop 0.5s ease;
}

.result-message {
    color: #8892b0;
    font-size: 0.95rem;
    margin: 1rem 0;
    line-height: 1.5;
}

/* Cat Reveal */
.cat-reveal {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(78, 205, 196, 0.15);
    animation: catReveal 0.6s ease;
}

.cat-reveal-title {
    color: #4ecdc4;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.cat-reveal-img {
    width: 96px;
    height: 96px;
    margin: 0 auto 0.75rem;
    border: 2px solid rgba(78, 205, 196, 0.3);
    border-radius: 12px;
    overflow: hidden;
    background: #151d2b;
}

.cat-reveal-img img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    object-fit: contain;
}

.cat-reveal-name {
    font-size: 1.2rem;
    color: #e6f1ff;
    font-weight: 600;
}

.cat-reveal-breed {
    color: #8892b0;
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.cat-reveal-quote {
    color: #cbd5e1;
    font-style: italic;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

.result-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.result-buttons .btn-game {
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
}

.btn-primary-game {
    background: linear-gradient(135deg, #4ecdc4, #44a08d) !important;
    color: #0a0e1a !important;
    font-weight: 600;
    border: none !important;
}

.btn-primary-game:hover {
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

/* ---- Gallery ---- */
.gallery-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.gallery-header h2 {
    color: #e6f1ff;
    font-size: 1.5rem;
}

.gallery-subtitle {
    color: #8892b0;
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
    max-width: 1100px;
    margin: 0 auto;
}

.cat-card {
    background: #1a2332;
    border: 2px solid rgba(78, 205, 196, 0.15);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.cat-card.unlocked {
    border-color: var(--cat-color, rgba(78, 205, 196, 0.3));
}

.cat-card.unlocked:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.cat-card.locked {
    filter: grayscale(0.8);
    opacity: 0.45;
}

.cat-img-display {
    width: 80px;
    height: 80px;
    margin: 0 auto 0.75rem;
    border-radius: 8px;
    overflow: hidden;
    background: #151d2b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-img-display img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    object-fit: contain;
}

.cat-img-display.locked-img {
    color: #64748b;
    font-size: 2rem;
    font-family: 'Courier New', monospace;
}

.cat-name {
    font-size: 1rem;
    color: #e6f1ff;
    font-weight: 600;
}

.cat-breed {
    color: #8892b0;
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.cat-personality {
    color: #cbd5e1;
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

.cat-rarity {
    color: #f7931a;
    font-size: 0.85rem;
    letter-spacing: 2px;
    margin-top: 0.4rem;
    font-family: 'Courier New', monospace;
}

.cat-quote {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.78rem;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.cat-locked-text {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.crown-badge {
    position: absolute;
    top: -4px;
    right: 8px;
    font-size: 1rem;
    color: #f7931a;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* ---- Touch Controls ---- */
.touch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 820px;
    margin: 0.5rem auto 0;
}

.touch-dpad {
    display: flex;
    gap: 0.5rem;
}

.touch-btn {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 2px solid rgba(78, 205, 196, 0.3);
    background: #1a2332;
    color: #4ecdc4;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.touch-btn:active {
    background: rgba(78, 205, 196, 0.2);
    border-color: #4ecdc4;
}

.touch-jump {
    width: 80px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* ---- Animations ---- */
@keyframes feedbackSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes coinPop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes catReveal {
    0% { transform: scale(0.7) rotate(-5deg); opacity: 0; }
    60% { transform: scale(1.05) rotate(2deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .game-stats-bar {
        gap: 0.75rem;
        padding: 0.6rem 1rem;
    }

    .stat-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .world-map-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .quiz-popup .options-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .score-display {
        font-size: 2.5rem;
    }

    .touch-controls {
        padding: 0.5rem 1rem;
    }

    .touch-btn {
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .world-map-container {
        grid-template-columns: 1fr;
    }
}
