/* ============================================
   PATTERN PLANET - GAME STYLES
   ============================================ */

:root {
    --space-dark: #0a0a1a;
    --space-purple: #1a1a3a;
    --accent-amber: #f59e0b;
    --accent-orange: #d97706;
    --accent-gold: #ffd166;
    --accent-cyan: #4ecdc4;
    --font-main: 'Nunito', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: radial-gradient(
        ellipse at 50% 50%,
        #2a1a0a 0%,
        #1a1a2e 30%,
        var(--space-dark) 70%,
        #050510 100%
    );
}

/* Background Canvas */
#game-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Game Container */
.game-container {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 30px;
    background: rgba(10, 10, 30, 0.7);
    border-bottom: 2px solid rgba(245, 158, 11, 0.3);
    position: relative;
}

.question-box {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.score-box {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 2px;
}

#question-text {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 900;
    color: white;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.score-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.pattern-progress {
    display: flex;
    gap: 3px;
}

.pattern-progress-slot {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    overflow: hidden;
    border: 2px solid rgba(245, 158, 11, 0.45);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.pattern-progress-slot.filled {
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.45);
    animation: progressIconPop 0.35s ease-out;
}

.pattern-progress-slot img {
    width: 17px;
    height: 17px;
    object-fit: contain;
}

@keyframes progressIconPop {
    0% { transform: scale(0.3); }
    70% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.score-text {
    font-size: 1.3rem;
    font-weight: 900;
    color: white;
}

/* Pattern Area */
.pattern-area {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    margin-top: auto;
}

.pattern-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 700px;
}

.pattern-item {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    animation: popIn 0.4s ease-out;
}

.pattern-item img {
    width: 55px;
    height: 55px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

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

.question-mark {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.15);
    border: 3px dashed var(--accent-amber);
    border-radius: 20px;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent-amber);
    animation: pulseMark 1.5s ease-in-out infinite;
}

.question-mark.filled {
    border-style: solid;
    border-color: #4ade80;
    background: rgba(34, 197, 94, 0.18);
    animation: slotFilled 0.35s ease-out;
}

.question-mark img {
    width: 62%;
    height: 62%;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

@keyframes slotFilled {
    0% { transform: scale(0.85); }
    70% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

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

/* Options Area */
.options-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    padding: 20px;
    background: rgba(10, 10, 30, 0.6);
    border-top: 2px solid rgba(245, 158, 11, 0.2);
    min-height: 140px;
    margin-bottom: auto;
}

.option-btn {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.option-btn:hover {
    transform: scale(1.08);
    border-color: var(--accent-amber);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.1);
}

.option-btn img {
    width: 70px;
    height: 70px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

.option-btn.moving img {
    opacity: 0;
}

.flying-pattern-answer {
    position: fixed;
    z-index: 200;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 0 14px rgba(255, 209, 102, 0.85));
}

.option-btn.correct {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #4ade80;
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.4);
    animation: correctPop 0.4s ease-out;
}

.option-btn.wrong {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #f87171;
    animation: wrongShake 0.4s ease-in-out;
}

@keyframes correctPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-8px); }
}

/* Message */
.message {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message.show {
    opacity: 1;
}

/* Overlays */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 16, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
}

.overlay-icon {
    margin-bottom: 20px;
}

.overlay-robot {
    width: 100px;
    height: 100px;
    animation: float 2s ease-in-out infinite;
}

.overlay h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    color: var(--accent-amber);
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.overlay p {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 10px;
    line-height: 1.5;
}

.game-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto 20px;
}

.launch-btn {
    display: inline-block;
    margin-top: 25px;
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: 900;
    font-family: var(--font-main);
    color: var(--space-dark);
    background: linear-gradient(135deg, var(--accent-amber), var(--accent-orange));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
}

.launch-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(245, 158, 11, 0.6);
}

.difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 25px;
}

.diff-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-top: 10px;
}

.diff-btn {
    padding: 20px 44px;
    font-size: 1.4rem;
    font-weight: 900;
    font-family: var(--font-main);
    color: var(--space-dark);
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: all 0.2s ease;
}

.diff-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

.diff-btn:active {
    transform: translateY(0) scale(0.98);
}

.diff-easy {
    background: linear-gradient(135deg, #86efac, #22c55e);
    border-color: rgba(34, 197, 94, 0.6);
}

.diff-easy:hover {
    background: linear-gradient(135deg, #4ade80, #16a34a);
}

.diff-medium {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-amber));
    border-color: rgba(245, 158, 11, 0.6);
}

.diff-medium:hover {
    background: linear-gradient(135deg, var(--accent-amber), var(--accent-orange));
}

.diff-hard {
    background: linear-gradient(135deg, #f87171, #dc2626);
    border-color: rgba(220, 38, 38, 0.6);
}

.diff-hard:hover {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.home-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-decoration: none;
    border: 2px solid var(--accent-cyan);
    border-radius: 50px;
    transition: all 0.3s ease;
}

.home-btn:hover {
    background: var(--accent-cyan);
    color: var(--space-dark);
}

/* Win Screen */
.win-icon {
    margin: 20px 0;
    animation: float 2s ease-in-out infinite;
}

.win-icon img {
    width: 80px;
    height: 80px;
}

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

/* Exit Button */
.exit-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    padding: 8px 16px;
    border-radius: 24px;
    background: rgba(10, 10, 30, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.15);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.exit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 600px) {
    .game-header {
        flex-direction: column;
        gap: 8px;
        padding: 12px 15px;
    }

    .question-box {
        text-align: center;
    }

    .score-box {
        position: static;
        transform: none;
        order: -1;
    }

    .pattern-item {
        width: 70px;
        height: 70px;
    }

    .pattern-item img {
        width: 45px;
        height: 45px;
    }

    .question-mark {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    .options-area {
        gap: 15px;
        padding: 15px;
        min-height: 110px;
    }

    .option-btn {
        width: 90px;
        height: 90px;
    }

    .option-btn img {
        width: 55px;
        height: 55px;
    }

    .exit-btn {
        bottom: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .pattern-item {
        width: 55px;
        height: 55px;
    }

    .pattern-item img {
        width: 35px;
        height: 35px;
    }

    .question-mark {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }

    .option-btn {
        width: 75px;
        height: 75px;
    }

    .option-btn img {
        width: 45px;
        height: 45px;
    }

    .question-box {
        font-size: 1.2rem;
    }

    .score-box {
        font-size: 0.85rem;
    }
}

/* Short landscape screens (Nest Hub, landscape phones, small tablets) */
@media (max-width: 1050px) {
    .game-header {
        flex-direction: column;
        gap: 6px;
        padding: 12px 18px;
    }

    .score-box {
        position: static;
        transform: none;
        order: -1;
        justify-content: center;
    }

    #question-text {
        font-size: clamp(1.35rem, 4vw, 2.25rem);
        line-height: 1.15;
    }
}

@media (max-height: 640px) {
    .game-container {
        padding: 8px;
    }

    .game-header {
        padding: 8px 14px;
        margin-bottom: 8px;
    }

    .message {
        margin-bottom: 6px;
        min-height: 22px;
        font-size: 0.95rem;
    }
}
