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

body {
    background-color: #05050e; color: #fff;
    font-family: 'Outfit', sans-serif;
    overflow: hidden; width: 100vw; height: 100vh;
    display: flex; justify-content: center; align-items: center;
}
#gameContainer {
    position: relative; width: 100%; height: 100%;
    max-width: 480px; max-height: 900px;
    background-color: #080815; overflow: hidden;
}
@media (min-width: 480px) {
    #gameContainer { border: 2px solid rgba(0,242,254,0.25); border-radius: 24px; box-shadow: 0 0 40px rgba(0,242,254,0.1); }
}
canvas { width: 100%; height: 100%; display: block; }

/* ═══ HUD ═══ */
#hud {
    position: absolute; top: 0; left: 0; width: 100%;
    padding: 10px 15px; display: flex; justify-content: space-between; align-items: center;
    pointer-events: none; z-index: 10;
}
#hud > * { pointer-events: auto; }
.hud-left { display: flex; align-items: center; gap: 8px; }
.hud-center { display: flex; gap: 6px; }
.hud-right { display: flex; align-items: center; }
.hud-item { font-size: 0.85rem; font-weight: 700; letter-spacing: 1px; }
.hud-star { font-size: 1.4rem; transition: all 0.3s; }
.icon-btn {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7); width: 34px; height: 34px; border-radius: 50%;
    font-size: 0.9rem; cursor: pointer; display: flex; align-items: center;
    justify-content: center; touch-action: manipulation;
}
.dust-counter { font-size: 0.9rem; font-weight: 700; color: #ffea00; letter-spacing: 1px; }

/* ═══ BOOST PANEL ═══ */
#boostPanel {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 10;
}
#boostBarContainer {
    width: 10px; height: 100px; background: rgba(255,255,255,0.04);
    border-radius: 5px; overflow: hidden; position: relative;
    border: 1px solid rgba(255,180,60,0.15);
}
#boostFill {
    position: absolute; bottom: 0; width: 100%; height: 0%;
    background: linear-gradient(to top, #ffb040, #ffea00);
    border-radius: 5px; transition: height 0.2s ease;
}
.boost-btn {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(255,180,60,0.1); border: 2px solid rgba(255,180,60,0.3);
    color: #fff; font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    touch-action: manipulation; transition: all 0.2s;
}
.boost-btn:disabled { opacity: 0.25; }
.boost-btn:not(:disabled):active { transform: scale(0.9); background: rgba(255,180,60,0.35); }

/* ═══ OVERLAYS ═══ */
.overlayScreen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5,5,14,0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 25px; text-align: center; z-index: 20;
    transition: opacity 0.4s ease, transform 0.4s ease;
    touch-action: auto; -webkit-overflow-scrolling: touch;
}
.overlayScreen.hidden { opacity: 0; pointer-events: none; transform: scale(1.04); }

h1 {
    font-size: 2.2rem; font-weight: 900; letter-spacing: 3px; text-transform: uppercase;
    margin-bottom: 8px; color: #fff;
}
/* Títulos limpios sin gradiente */
.clean-title { font-size: 1.6rem; color: rgba(255,255,255,0.9); letter-spacing: 4px; margin-bottom: 15px; }

.subtitle { font-size: 0.9rem; color: rgba(255,255,255,0.4); margin-bottom: 25px; letter-spacing: 2px; }

/* ═══ BOTONES ═══ */
.neonBtn {
    background: transparent; border: 1.5px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.85);
    padding: 13px 30px; font-size: 0.9rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2px; border-radius: 50px;
    cursor: pointer; outline: none; transition: all 0.25s;
    font-family: 'Outfit', sans-serif; touch-action: manipulation;
}
.neonBtn:active { transform: scale(0.95); background: rgba(255,255,255,0.05); }
.small-btn { font-size: 0.8rem; padding: 10px 22px; }
.amber-btn { border-color: rgba(255,180,60,0.4); color: rgba(255,180,60,0.85); }
.btn-row { display: flex; gap: 12px; margin-top: 20px; }
@media (hover: hover) {
    .neonBtn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.5); color: #fff; }
    .amber-btn:hover { background: rgba(255,180,60,0.1); border-color: rgba(255,180,60,0.6); color: #ffb040; }
}

/* ═══ LEVEL GRID (scrollable) ═══ */
.level-grid {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 12px; max-width: 320px; width: 100%;
    max-height: 55vh; overflow-y: auto; padding: 15px 5px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
    touch-action: pan-y;
}
.level-grid::-webkit-scrollbar { width: 3px; }
.level-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.level-node {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: rgba(255,255,255,0.03); border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 14px; padding: 10px 4px 8px; cursor: pointer;
    transition: all 0.2s; touch-action: manipulation; color: #fff;
    font-family: 'Outfit', sans-serif;
}
.level-node:active { transform: scale(0.92); background: rgba(255,255,255,0.06); }
@media (hover: hover) {
    .level-node:hover { border-color: rgba(255,180,60,0.4); background: rgba(255,180,60,0.05); }
}
.lvNum { font-size: 1.1rem; font-weight: 900; color: rgba(255,255,255,0.9); }
.lvStars { font-size: 0.55rem; letter-spacing: 1px; line-height: 1; }

/* ═══ PAUSE ═══ */
.pause-options { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; width: 100%; max-width: 280px; }
.volume-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: rgba(255,255,255,0.03); border-radius: 12px;
    font-size: 0.85rem; color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.05);
}
.vol-slider {
    -webkit-appearance: none; appearance: none; width: 110px; height: 4px;
    background: rgba(255,255,255,0.08); border-radius: 2px; outline: none;
    touch-action: manipulation;
}
.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px;
    background: rgba(255,255,255,0.8); border-radius: 50%; cursor: pointer;
}

/* ═══ GAME OVER ═══ */
.death-msg {
    font-size: 0.95rem; color: rgba(255,255,255,0.45); font-style: italic;
    max-width: 280px; line-height: 1.6; margin-top: 12px;
}

/* ═══ VICTORIA ═══ */
.win-card {
    padding: 25px 20px; margin-bottom: 10px;
}
.win-title {
    font-size: 1.2rem; font-weight: 900; text-transform: uppercase; letter-spacing: 3px;
    color: #fff; margin-bottom: 20px;
}
.win-stars-row { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin-bottom: 18px; }
.win-star-wrap {
    width: 55px; height: 55px; animation: starPop 0.5s ease forwards;
    opacity: 0; transform: scale(0) rotate(-30deg);
}
.win-star-wrap.big { width: 70px; height: 70px; }
.win-star-wrap.earned { animation-delay: 0.2s; }
.win-star-wrap:nth-child(2).earned { animation-delay: 0.5s; }
.win-star-wrap:nth-child(3).earned { animation-delay: 0.8s; }
.win-star-svg { width: 100%; height: 100%; overflow: visible; }
.win-star-svg polygon {
    fill: #222; stroke: #444; stroke-width: 1;
}
.win-star-wrap.earned .win-star-svg polygon {
    fill: #ffea00; stroke: #ffd000; stroke-width: 1;
    filter: drop-shadow(0 0 6px rgba(255,220,0,0.5));
}
.win-dust { font-size: 0.9rem; color: #ffea00; font-weight: 700; margin-bottom: 8px; }
.win-msg { font-size: 0.85rem; color: rgba(255,255,255,0.4); font-style: italic; max-width: 260px; line-height: 1.5; }

@keyframes starPop {
    0% { opacity: 0; transform: scale(0) rotate(-30deg); }
    60% { opacity: 1; transform: scale(1.15) rotate(5deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* ═══ MENÚ ═══ */
.menu-dust { font-size: 1rem; color: #ffea00; font-weight: 700; margin-bottom: 18px; }
.menu-buttons {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    width: 100%; max-width: 240px;
}
.menu-buttons .neonBtn { width: 100%; }

/* ═══ SHIELD ═══ */
.shield-icon { font-size: 1.1rem; margin-right: 8px; }

/* ═══ TIENDA ═══ */
.shop-dust { font-size: 1rem; color: #ffea00; font-weight: 700; margin-bottom: 15px; }
.shop-tabs { display: flex; gap: 0; margin-bottom: 15px; border-radius: 8px; overflow: hidden; }
.tab-btn {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5); padding: 8px 20px; font-size: 0.75rem;
    font-weight: 700; letter-spacing: 2px; cursor: pointer;
    font-family: 'Outfit', sans-serif; touch-action: manipulation; transition: all 0.2s;
}
.tab-btn.active { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.2); }

.shop-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; max-width: 320px; width: 100%;
    max-height: 45vh; overflow-y: auto; padding: 5px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
    touch-action: pan-y;
}
.shop-grid::-webkit-scrollbar { width: 3px; }
.shop-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.shop-card {
    background: rgba(255,255,255,0.03); border: 1.5px solid rgba(255,255,255,0.08);
    border-radius: 14px; padding: 14px 10px 10px; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    transition: all 0.2s;
}
.shop-card.equipped { border-color: rgba(255,180,60,0.4); background: rgba(255,180,60,0.05); }

.shop-preview {
    width: 40px; height: 40px; border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}
.shop-name { font-size: 0.7rem; font-weight: 700; color: rgba(255,255,255,0.7); letter-spacing: 0.5px; }
.shop-status { font-size: 0.6rem; color: rgba(255,180,60,0.7); font-weight: 700; letter-spacing: 1px; }

.shop-equip-btn, .shop-buy-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7); padding: 4px 12px; font-size: 0.65rem;
    font-weight: 700; border-radius: 20px; cursor: pointer;
    font-family: 'Outfit', sans-serif; touch-action: manipulation;
    transition: all 0.2s; letter-spacing: 1px;
}
.shop-buy-btn { border-color: rgba(255,234,0,0.3); color: #ffea00; }
.shop-equip-btn:active, .shop-buy-btn:active { transform: scale(0.93); }

/* ═══ STATS ═══ */
.stat-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 8px; max-width: 320px; width: 100%;
    max-height: 55vh; overflow-y: auto; padding: 10px 0;
    touch-action: pan-y;
}
.stat-card {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px; padding: 12px 8px; text-align: center;
}
.stat-val { font-size: 1.3rem; font-weight: 900; color: #fff; margin-bottom: 3px; }
.stat-lbl { font-size: 0.6rem; color: rgba(255,255,255,0.35); font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }

/* ═══ LANG SELECT ═══ */
.lang-select {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; padding: 6px 10px; color: #fff;
    font-family: 'Outfit', sans-serif; font-size: 0.75rem; outline: none;
    cursor: pointer;
}
.lang-select option { background: #12122a; color: #fff; }

/* ═══ TUTORIAL ═══ */
.tutorial-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.75); z-index: 50;
    display: flex; justify-content: center; align-items: center;
    padding: 30px; transition: opacity 0.3s;
}
.tutorial-overlay.hidden { display: none; }
.tutorial-box {
    background: rgba(10,10,30,0.95); border: 1.5px solid rgba(255,180,60,0.2);
    border-radius: 20px; padding: 30px 25px; text-align: center;
    max-width: 300px; width: 100%;
    animation: tutPop 0.3s ease-out;
}
@keyframes tutPop { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.tutorial-icon { font-size: 2.5rem; margin-bottom: 12px; animation: tutBounce 1.5s infinite; }
@keyframes tutBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.tutorial-text {
    font-size: 0.85rem; color: rgba(255,255,255,0.85); line-height: 1.5;
    margin-bottom: 18px; white-space: pre-line;
}
.tutorial-skip {
    display: block; margin: 10px auto 0; background: none; border: none;
    color: rgba(255,255,255,0.25); font-family: 'Outfit', sans-serif;
    font-size: 0.65rem; font-weight: 700; letter-spacing: 1px;
    cursor: pointer; text-transform: uppercase;
}
