/* ========================================
   SPATIAL INVERSE — Game Screen Styles
   ======================================== */

/* --- Game Screen Layout --- */
#game-screen {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* --- HUD Top Bar --- */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: var(--z-hud);
    min-height: 50px;
}

.hud-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.level-name {
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.hud-center {
    display: flex;
    gap: var(--space-xl);
}

.hud-timer,
.hud-gadgets-used {
    text-align: center;
}

.hud-label {
    display: block;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    color: var(--neon-cyan);
}

.hud-right {
    text-align: right;
}

.star-targets {
    text-align: center;
}

/* --- Canvas Wrapper --- */
.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    display: block;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* --- Gravity Indicator --- */
.gravity-indicator {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 240, 255, 0.2);
}

.gravity-arrow {
    font-size: 1.5rem;
    color: var(--neon-cyan);
    animation: gravityBounce 1.5s ease-in-out infinite;
    line-height: 1;
}

.gravity-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    letter-spacing: 0.1em;
    font-family: var(--font-display);
}

/* --- Gadget Toolbar --- */
.gadget-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: var(--z-toolbar);
    min-height: 70px;
    flex-wrap: wrap;
}

.gadget-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: grab;
    transition: all var(--transition-fast);
    position: relative;
    min-width: 60px;
    user-select: none;
}

.gadget-slot:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
    transform: translateY(-2px);
}

.gadget-slot:active {
    cursor: grabbing;
}

.gadget-slot.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gadget-slot.disabled:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    transform: none;
}

.gadget-slot.selected {
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.1);
    box-shadow: var(--glow-cyan);
}

.gadget-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.gadget-label {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}

.gadget-count {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--neon-magenta);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    box-shadow: 0 2px 8px rgba(255, 0, 170, 0.4);
}

/* --- Game Controls --- */
.game-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(10, 10, 26, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.btn-control {
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-play-sim {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--neon-green), var(--neon-cyan));
    color: var(--bg-primary);
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

.btn-play-sim:hover {
    box-shadow: 0 6px 30px rgba(0, 255, 136, 0.5);
    transform: translateY(-2px);
}

.btn-play-sim.simulating {
    background: linear-gradient(135deg, var(--neon-orange), var(--neon-red));
    box-shadow: 0 4px 20px rgba(255, 136, 0, 0.3);
}

.btn-reset {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-fast {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-fast:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-fast.active {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
    box-shadow: 0 0 15px rgba(255, 238, 0, 0.2);
}

/* --- Hint Bar --- */
.hint-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: rgba(0, 240, 255, 0.06);
    border-top: 1px solid rgba(0, 240, 255, 0.1);
    min-height: 32px;
}

.hint-icon {
    font-size: 0.9rem;
}

.hint-text {
    font-size: var(--fs-xs);
    color: var(--neon-cyan);
    font-style: italic;
    line-height: 1.3;
}

/* --- How-to-Play Modal --- */
.howto-modal-content {
    max-width: 480px;
}

.howto-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    text-align: left;
}

.howto-step {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.howto-num {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: 700;
    color: #fff;
}

.howto-step strong {
    display: block;
    font-size: var(--fs-sm);
    color: var(--text-primary);
    margin-bottom: 2px;
}

.howto-step p {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    line-height: 1.4;
}

.howto-tip {
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    line-height: 1.5;
}

.howto-tip strong {
    color: var(--neon-yellow);
}

.howto-tip kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-family: var(--font-display);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* --- Drag Ghost --- */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-size: 2rem;
    opacity: 0.8;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.5));
}

/* --- Responsive: Game Screen --- */
@media (max-width: 600px) {
    .game-hud {
        padding: var(--space-xs) var(--space-sm);
        min-height: 40px;
    }

    .hud-center {
        gap: var(--space-md);
    }

    .level-name {
        font-size: var(--fs-xs);
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .gadget-toolbar {
        gap: var(--space-xs);
        padding: var(--space-xs) var(--space-sm);
        min-height: 56px;
    }

    .gadget-slot {
        min-width: 46px;
        padding: var(--space-xs) var(--space-sm);
    }

    .gadget-icon {
        font-size: 1.1rem;
    }

    .gadget-label {
        font-size: 0.5rem;
    }

    .gadget-count {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
    }

    .btn-control {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .btn-play-sim {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .game-controls {
        padding: var(--space-xs) var(--space-sm);
        gap: var(--space-sm);
    }

    .gravity-indicator {
        top: var(--space-xs);
        right: var(--space-xs);
        padding: var(--space-xs) var(--space-sm);
    }

    .gravity-arrow {
        font-size: 1rem;
    }

    .gravity-label {
        font-size: 0.5rem;
    }

    .hint-bar {
        padding: var(--space-xs) var(--space-sm);
        min-height: 26px;
    }

    .hint-icon {
        font-size: 0.75rem;
    }

    .howto-modal-content {
        max-width: 95%;
    }

    .howto-num {
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: var(--fs-xs);
    }
}

@media (max-width: 380px) {
    .hud-right {
        display: none;
    }

    .gadget-slot {
        min-width: 40px;
        padding: 3px 5px;
    }

    .gadget-icon {
        font-size: 0.95rem;
    }

    .gadget-label {
        display: none;
    }

    .btn-control {
        width: 34px;
        height: 34px;
    }

    .btn-play-sim {
        width: 42px;
        height: 42px;
    }
}