/* ============================================
   SPACE SHAPES - GAME STYLES (with real shapes)
   ============================================ */

:root {
    --space-dark: #0a0a1a;
    --space-purple: #1a1a3a;
    --accent-lime: #84cc16;
    --accent-green: #65a30d;
    --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%,
        #1a2a0a 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(132, 204, 22, 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(132, 204, 22, 0.5);
}

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

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

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

.shape-progress-slot.filled {
    border-color: var(--accent-lime);
    background: rgba(132, 204, 22, 0.18);
    box-shadow: 0 0 8px rgba(132, 204, 22, 0.45);
    animation: shapeProgressPop 0.35s ease-out;
}

.shape-progress-slot .progress-shape {
    width: 16px;
    height: 16px;
    box-shadow: none;
}

.shape-progress-slot .shape-rectangle {
    width: 18px;
    height: 11px;
}

.shape-progress-slot .shape-diamond {
    width: 11px;
    height: 17px;
}

@keyframes shapeProgressPop {
    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;
}

/* UFO Area */
.ufo-area {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    position: relative;
    margin-top: auto;
}

.ufo-ship {
    animation: ufoFloat 3s ease-in-out infinite;
    z-index: 3;
}

.ufo-img {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

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

.beam-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -10px;
}

.beam-light {
    width: 100px;
    height: 160px;
    background: linear-gradient(to bottom, rgba(132, 204, 22, 0.3), rgba(132, 204, 22, 0.05), transparent);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: beamPulse 1.5s ease-in-out infinite alternate;
}

@keyframes beamPulse {
    0% { opacity: 0.4; transform: scaleY(0.9); }
    100% { opacity: 0.8; transform: scaleY(1.1); }
}

/* Shape Slot — the floating platform in the beam */
.shape-slot {
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    margin-top: -60px;
    animation: shapeAppear 0.5s ease-out;
    box-shadow: none;
}

@keyframes shapeAppear {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    60% { transform: scale(1.1) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ============================================
   REAL GEOMETRIC SHAPES (drawn with CSS)
   ============================================ */

.shape-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

/* Circle */
.shape-circle {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #f472b6, #db2777);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(244, 114, 182, 0.4);
}

/* Square */
.shape-square {
    width: 85px;
    height: 85px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    border-radius: 0;
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.4);
}

/* Rectangle */
.shape-rectangle {
    width: 110px;
    height: 65px;
    background: linear-gradient(135deg, #fb923c, #ea580c);
    border-radius: 0;
    box-shadow: 0 0 20px rgba(251, 146, 60, 0.4);
}

/* Triangle */
.shape-triangle {
    width: 100px;
    height: 90px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.4);
}

/* Star */
.shape-star {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #facc15, #eab308);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.4);
}

/* Pentagon */
.shape-pentagon {
    width: 100px;
    height: 95px;
    background: linear-gradient(135deg, #4ade80, #16a34a);
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

/* Hexagon */
.shape-hexagon {
    width: 100px;
    height: 90px;
    background: linear-gradient(135deg, #22d3ee, #0891b2);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.4);
}

/* Diamond */
.shape-diamond {
    width: 70px;
    height: 110px;
    background: linear-gradient(135deg, #f87171, #dc2626);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.4);
}

/* Options Area */
.options-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(10, 10, 30, 0.6);
    border-top: 2px solid rgba(132, 204, 22, 0.2);
    min-height: 100px;
    flex-wrap: wrap;
    margin-bottom: auto;
}

.option-btn {
    padding: 15px 30px;
    border-radius: 16px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-family: var(--font-main);
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: slideUp 0.4s ease-out;
    min-width: 120px;
}

@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-lime);
    box-shadow: 0 0 25px rgba(132, 204, 22, 0.3);
    background: rgba(132, 204, 22, 0.1);
}

.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.1); }
    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-ufo {
    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-lime);
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(132, 204, 22, 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-lime), var(--accent-green));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(132, 204, 22, 0.4);
    transition: all 0.3s ease;
}

.launch-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(132, 204, 22, 0.6);
}

/* Difficulty Buttons */
.diff-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-top: 20px;
}

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

.diff-btn {
    padding: 18px 30px;
    border-radius: 18px;
    border: 3px solid;
    font-family: var(--font-main);
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    color: white;
    background: transparent;
}

.diff-btn span {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.85;
    display: block;
    margin-top: 4px;
}

.diff-btn:hover {
    transform: scale(1.08);
}

.diff-easy {
    border-color: #a3e635;
    background: rgba(163, 230, 53, 0.15);
    box-shadow: 0 0 15px rgba(163, 230, 53, 0.2);
}

.diff-easy:hover {
    background: rgba(163, 230, 53, 0.3);
    box-shadow: 0 0 25px rgba(163, 230, 53, 0.4);
}

.diff-medium {
    border-color: var(--accent-lime);
    background: rgba(132, 204, 22, 0.15);
    box-shadow: 0 0 15px rgba(132, 204, 22, 0.2);
}

.diff-medium:hover {
    background: rgba(132, 204, 22, 0.3);
    box-shadow: 0 0 25px rgba(132, 204, 22, 0.4);
}

.diff-hard {
    border-color: var(--accent-green);
    background: rgba(101, 163, 13, 0.15);
    box-shadow: 0 0 15px rgba(101, 163, 13, 0.2);
}

.diff-hard:hover {
    background: rgba(101, 163, 13, 0.3);
    box-shadow: 0 0 25px rgba(101, 163, 13, 0.4);
}

.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;
    }

    .ufo-img {
        width: 75px;
        height: 75px;
    }

    .beam-light {
        width: 70px;
        height: 120px;
    }

    .shape-slot {
        width: 120px;
        height: 120px;
        margin-top: -40px;
    }

    .shape-circle    { width: 65px; height: 65px; }
    .shape-square    { width: 60px; height: 60px; }
    .shape-rectangle { width: 80px; height: 48px; }
    .shape-triangle  { width: 75px; height: 68px; }
    .shape-star      { width: 75px; height: 75px; }
    .shape-pentagon  { width: 75px; height: 70px; }
    .shape-hexagon   { width: 75px; height: 68px; }
    .shape-diamond   { width: 50px; height: 80px; }

    .options-area {
        gap: 10px;
        padding: 15px;
    }

    .option-btn {
        padding: 12px 20px;
        font-size: 1.1rem;
        min-width: 100px;
    }

    .difficulty-buttons {
        gap: 8px;
    }

    .diff-btn {
        padding: 10px 14px;
        font-size: 0.9rem;
        min-width: 90px;
    }

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

/* Very small phones */
@media (max-width: 360px) {
    .ufo-img {
        width: 60px;
        height: 60px;
    }

    .beam-light {
        width: 55px;
        height: 100px;
    }

    .shape-slot {
        width: 100px;
        height: 100px;
        margin-top: -30px;
    }

    .shape-circle    { width: 55px; height: 55px; }
    .shape-square    { width: 50px; height: 50px; }
    .shape-rectangle { width: 65px; height: 40px; }
    .shape-triangle  { width: 60px; height: 55px; }
    .shape-star      { width: 60px; height: 60px; }
    .shape-pentagon  { width: 60px; height: 56px; }
    .shape-hexagon   { width: 60px; height: 55px; }
    .shape-diamond   { width: 40px; height: 65px; }

    .option-btn {
        padding: 10px 16px;
        font-size: 1rem;
        min-width: 85px;
    }

    .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;
    }
}
