:root {
    --bg-color: #050510;
    --primary: #00f3ff;
    --secondary: #ff00ea;
    --success: #00ff66;
    --warning: #ffb700;
    --danger: #ff0055;
    --font-arcade: 'Press Start 2P', cursive;
    --font-modern: 'Outfit', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    color: #fff;
    font-family: var(--font-modern);
    overflow: hidden;
    touch-action: none;
}

#gameWrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#hud {
    height: 70px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 15px;
    background: rgba(5, 5, 16, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
    border-bottom: 1px solid rgba(0, 243, 255, 0.2);
    position: relative;
}

.hud-left { display: flex; justify-content: flex-start; }
.hud-center { display: flex; justify-content: center; }
.hud-right { display: flex; justify-content: flex-end; gap: 10px; }

.hub-btn {
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.home-btn {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
    transition: all 0.2s ease;
}

.home-btn:hover {
    color: #fff;
    text-shadow: 0 0 15px var(--primary);
}

.hud-pill {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 30px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
}

.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

.hud-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}

.hud-value {
    font-family: var(--font-arcade);
    font-size: 12px;
    color: var(--primary);
    margin-top: 4px;
    text-shadow: 0 0 5px var(--primary);
}

.hud-divider {
    width: 1px;
    height: 20px;
    background: rgba(0, 243, 255, 0.3);
}

.header-controls {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
    transform: scale(1.1);
}

/* Canvas */
canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 16, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

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

.overlay h1 {
    font-family: var(--font-arcade);
    font-size: 48px;
    color: #fff;
    text-align: center;
    text-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary);
    margin-bottom: 20px;
    line-height: 1.2;
}

.overlay-title {
    font-family: var(--font-arcade);
    font-size: 32px;
    color: var(--secondary);
    margin-bottom: 25px;
    text-shadow: 0 0 15px var(--secondary);
}

.instruction-box {
    width: 100%;
    max-width: 320px;
    margin-bottom: 25px;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 14px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.instruction-item p { font-size: 14px; color: rgba(255, 255, 255, 0.8); }

.control-text { font-size: 12px; opacity: 0.5; margin-bottom: 20px; line-height: 1.6; text-align: center; }

.btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-arcade);
    font-size: 16px;
    padding: 15px 30px;
    margin: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.btn:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px var(--primary);
    transform: scale(1.05);
}

/* Game Over Overlay (Special Style) */
.go-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 85, 0.15);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
    transition: opacity 0.4s ease;
}

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

.go-card {
    background: rgba(10, 5, 10, 0.9);
    border: 2px solid var(--danger);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 0, 85, 0.3);
    max-width: 400px;
    width: 90%;
}

.go-title {
    font-family: var(--font-arcade);
    font-size: 32px;
    color: var(--danger);
    text-shadow: 0 0 15px var(--danger);
    margin-bottom: 20px;
}

.go-score-text {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
}

.go-score-text span {
    color: #fff;
    font-family: var(--font-arcade);
    font-size: 28px;
    text-shadow: 0 0 10px #fff;
}

.go-best-text {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.share-row {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.share-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease;
    color: #fff;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn.twitter {
    background: #1DA1F2;
}

.share-btn.whatsapp {
    background: #25D366;
}

.arcade-btn {
    width: 100%;
    padding: 18px;
    border: none;
    background: var(--danger);
    color: #fff;
    font-family: var(--font-arcade);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
    margin-bottom: 15px;
}

.arcade-btn:hover {
    background: #ff3377;
    box-shadow: 0 0 30px rgba(255, 0, 85, 0.6);
    transform: scale(1.02);
}

/* Level Up Menu */
#levelUpMenu {
    background: rgba(5, 5, 16, 0.95);
    z-index: 40;
}

.level-up-title {
    font-family: var(--font-arcade);
    color: var(--warning);
    font-size: 32px;
    text-shadow: 0 0 20px var(--warning);
    margin-bottom: 10px;
}

.level-up-subtitle {
    font-size: 18px;
    color: #fff;
    margin-bottom: 30px;
}

.upgrade-container {
    display: flex;
    gap: 20px;
    max-width: 900px;
    width: 90%;
    justify-content: center;
    flex-wrap: wrap;
}

.upgrade-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    width: 250px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upgrade-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 243, 255, 0.2);
}

.upgrade-icon {
    font-size: 48px;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.5));
}

.upgrade-name {
    font-weight: 700;
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 10px;
}

.upgrade-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

/* Modals */
.modal-content {
    background: rgba(10, 10, 20, 0.95);
    border: 1px solid var(--primary);
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
}

.powerup-hint {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.pu-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    flex-shrink: 0;
}

.control-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-arcade);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
    pointer-events: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.3; }
    50% { opacity: 0.7; }
    100% { opacity: 0.3; }
}

/* Responsive */
@media (max-width: 768px) {
    .overlay h1 { font-size: 36px; }
    .hud-pill { padding: 5px 15px; gap: 10px; }
    .header { padding: 10px; }
    .upgrade-container { flex-direction: column; align-items: center; }
    .upgrade-card { width: 100%; max-width: 300px; flex-direction: row; text-align: left; padding: 15px; gap: 15px; }
    .upgrade-icon { font-size: 32px; margin-bottom: 0; }
    .upgrade-info { flex: 1; }
    .upgrade-name { margin-bottom: 5px; font-size: 16px; }
}
