:root {
    --bg-color: #0f172a;
    --ui-bg: rgba(15, 23, 42, 0.8);
    --accent: #8b5cf6;
    --text: #f8fafc;
    --border: #334155;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100%;
    max-height: 800px;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 50px rgba(139, 92, 246, 0.2);
    overflow: hidden;
    backdrop-filter: blur(5px);
}

/* Stars Animation */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: stars 100s linear infinite;
    opacity: 0.5;
    z-index: -1;
}

@keyframes stars {
    from { background-position: 0 0; }
    to { background-position: 0 1000px; }
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.header {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    pointer-events: auto;
}

.score-box, .best-box, .next-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.next-box {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 70px;
    height: 70px;
    justify-content: center;
}

.label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-bottom: 4px;
}

.value {
    font-size: 20px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

#next-planet-preview {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #333;
    box-shadow: 0 0 10px currentColor;
    transition: all 0.3s ease;
}

.controls-overlay, .game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    backdrop-filter: blur(5px);
    z-index: 20;
}

.hidden {
    display: none !important;
}

h2 {
    font-size: 32px;
    margin-bottom: 20px;
    background: linear-gradient(to right, #c084fc, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.tutorial p {
    font-size: 18px;
    margin: 10px 0;
    opacity: 0.9;
}

.btn-primary {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 18px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

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

.abilities {
    position: absolute;
    bottom: 30px;
    right: 20px;
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.ability-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 24px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.ability-btn:hover:not(:disabled) {
    transform: scale(1.1);
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.2);
}

.ability-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.7);
    transition: height 0.1s linear;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .game-container {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .header {
        padding: 15px;
    }
    
    .next-box {
        top: 70px;
        right: 15px;
    }
}
