/* =====================================================
   NEONSERPENT
   Responsive / Mobile First
   ===================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background:
        radial-gradient(circle at 50% 40%, #101b32 0%, #050812 45%, #02040a 100%);
    color: white;
    font-family:
        Arial,
        Helvetica,
        sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: crosshair;
}

/* =====================================================
   COMMON SCREEN
   ===================================================== */

.screen {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100dvh;

    display: flex;
    justify-content: center;
    align-items: center;

    overflow: hidden;

    padding:
        max(18px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        max(18px, env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));

    background:
        linear-gradient(
            135deg,
            rgba(0, 255, 200, 0.025),
            rgba(0, 120, 255, 0.03)
        );
}

.hidden {
    display: none !important;
}


/* =====================================================
   HOME MENU
   ===================================================== */

.menu-card {
    width: min(92vw, 540px);

    max-height: calc(100dvh - 30px);

    padding:
        clamp(24px, 6vw, 48px)
        clamp(20px, 6vw, 50px);

    display: flex;
    flex-direction: column;
    align-items: center;

    border: 1px solid rgba(0, 255, 220, 0.25);

    border-radius: 24px;

    background:
        linear-gradient(
            145deg,
            rgba(11, 25, 45, 0.95),
            rgba(3, 8, 20, 0.97)
        );

    box-shadow:
        0 0 70px rgba(0, 255, 220, 0.08),
        inset 0 0 40px rgba(0, 255, 220, 0.025);

    backdrop-filter: blur(14px);

    overflow: hidden;
}


/* IMPORTANT:
   Responsive title so NEONSERPENT NEVER OVERFLOWS.
*/

.logo-wrap {
    width: 100%;
    max-width: 100%;
    text-align: center;
    overflow: hidden;
}

.logo {
    width: 100%;

    font-size: clamp(30px, 9vw, 64px);
    line-height: 0.95;

    font-weight: 1000;
    letter-spacing: clamp(1px, 1vw, 5px);

    color: #63ffe5;

    text-shadow:
        0 0 8px #00ffd5,
        0 0 22px rgba(0, 255, 213, 0.65),
        0 0 50px rgba(0, 150, 255, 0.35);

    white-space: nowrap;

    transform-origin: center;
}

.subtitle {
    margin-top: 12px;

    font-size: clamp(9px, 2.5vw, 13px);

    letter-spacing: clamp(3px, 1.5vw, 7px);

    color: #6f86a5;
}

.home-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    gap: 10px;

    margin-top: 18px;
}

.home-best {
    padding: 8px 18px;

    border-radius: 30px;

    background: rgba(255, 214, 0, 0.08);

    border: 1px solid rgba(255, 214, 0, 0.3);

    color: #ffdd66;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

.home-best strong {
    margin-left: 6px;

    color: #fff3c4;

    font-size: 13px;
}

.home-diamonds {
    padding: 8px 18px;

    border-radius: 30px;

    background: rgba(0, 200, 255, 0.08);

    border: 1px solid rgba(0, 200, 255, 0.3);

    color: #8fe8ff;

    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;

    display: flex;
    align-items: center;
}

.home-diamonds strong {
    margin-left: 6px;

    color: #eafcff;

    font-size: 14px;
}

.player-form {
    width: 100%;
    margin-top: 24px;
}

.player-form label {
    display: block;

    margin-bottom: 8px;

    color: #6e8aa9;

    font-size: 11px;
    letter-spacing: 2px;
}

.player-form input {
    width: 100%;
    height: 52px;

    border: 1px solid rgba(0, 255, 213, 0.25);
    border-radius: 12px;

    outline: none;

    background: rgba(0, 0, 0, 0.35);

    color: #fff;

    padding: 0 16px;

    font-size: 16px;

    transition: 0.2s;
}

.player-form input:focus {
    border-color: #00ffd5;

    box-shadow:
        0 0 20px rgba(0, 255, 213, 0.18);
}

.player-form input::placeholder {
    color: #52647b;
}


/* =====================================================
   BUTTONS
   ===================================================== */

button {
    font-family: inherit;

    border: none;

    cursor: pointer;

    touch-action: manipulation;
}

.main-btn,
.secondary-btn,
.revive-btn {
    width: 100%;
    min-height: 52px;

    margin-top: 14px;

    border-radius: 12px;

    font-size: 14px;
    font-weight: 900;

    letter-spacing: 2px;

    transition:
        transform 0.15s,
        box-shadow 0.15s,
        background 0.15s;
}

.main-btn {
    color: #00120f;

    background:
        linear-gradient(
            135deg,
            #00ffd5,
            #38a7ff
        );

    box-shadow:
        0 0 25px rgba(0, 255, 213, 0.22);
}

.main-btn:hover {
    box-shadow:
        0 0 35px rgba(0, 255, 213, 0.45);
}

.main-btn:active,
.secondary-btn:active,
.revive-btn:active {
    transform: scale(0.97);
}

.secondary-btn {
    color: #8ca5c2;

    background: rgba(255, 255, 255, 0.035);

    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover {
    color: #fff;
    border-color: rgba(0, 255, 213, 0.4);
}

.revive-btn {
    color: #1a1200;

    background:
        linear-gradient(
            135deg,
            #ffe066,
            #ff9d00
        );

    box-shadow:
        0 0 25px rgba(255, 180, 0, 0.3);
}

.revive-btn:hover {
    box-shadow:
        0 0 38px rgba(255, 180, 0, 0.55);
}

.controls-hint {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    gap: 12px;

    margin-top: 28px;

    color: #566d88;

    font-size: 10px;
}


/* =====================================================
   SHOP
   ===================================================== */

.shop-card {
    width: min(94vw, 850px);

    max-height: calc(100dvh - 30px);

    padding: clamp(20px, 4vw, 35px);

    border-radius: 22px;

    background:
        linear-gradient(
            145deg,
            rgba(11, 25, 45, 0.97),
            rgba(3, 8, 20, 0.98)
        );

    border: 1px solid rgba(0, 255, 213, 0.22);

    box-shadow:
        0 0 70px rgba(0, 255, 213, 0.08);

    overflow-y: auto;
}

.shop-header {
    display: flex;
    align-items: center;
    gap: 16px;

    margin-bottom: 25px;
}

.shop-header h1 {
    color: #65ffe6;
    font-size: clamp(22px, 6vw, 35px);
    letter-spacing: 3px;
}

.shop-header p {
    margin-top: 4px;
    color: #637b99;
    font-size: 12px;
}

.shop-currency {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 22px;

    padding: 12px 16px;

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.03);

    border: 1px solid rgba(0, 200, 255, 0.2);
}

.diamond-count {
    display: flex;
    align-items: center;

    color: #8fe8ff;

    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
}

.diamond-count strong {
    margin-left: 6px;

    color: #ffffff;

    font-size: 16px;
}

.watch-ad-btn {
    padding: 12px 20px;

    border-radius: 10px;

    color: #1a0033;

    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;

    background:
        linear-gradient(
            135deg,
            #c084fc,
            #7c3aed
        );

    box-shadow:
        0 0 20px rgba(140, 80, 255, 0.35);

    transition:
        transform 0.15s,
        box-shadow 0.15s,
        opacity 0.15s;
}

.watch-ad-btn:hover {
    box-shadow:
        0 0 32px rgba(140, 80, 255, 0.55);
}

.watch-ad-btn:active {
    transform: scale(0.96);
}

.watch-ad-btn:disabled {
    opacity: 0.5;

    cursor: not-allowed;

    box-shadow: none;
}


/* =====================================================
   AD OVERLAY
   ===================================================== */

.ad-overlay {
    position: fixed;

    z-index: 50;
}

.ad-card .ad-icon {
    font-size: 42px;
}

.ad-progress {
    margin-top: 22px;

    height: 8px;

    border-radius: 6px;

    background: rgba(255, 255, 255, 0.08);

    overflow: hidden;
}

.ad-progress-bar {
    height: 100%;
    width: 0%;

    background:
        linear-gradient(
            90deg,
            #c084fc,
            #7c3aed
        );

    transition: width 0.1s linear;
}

.back-btn {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border-radius: 10px;

    color: #8da8c4;
    background: rgba(255, 255, 255, 0.05);

    font-size: 22px;
}

.skin-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(min(160px, 42vw), 1fr)
        );

    gap: 15px;
}

.skin-card {
    position: relative;

    min-height: 180px;

    padding: 15px;

    border-radius: 16px;

    background: rgba(255, 255, 255, 0.035);

    border: 1px solid rgba(255, 255, 255, 0.08);

    transition: 0.2s;
}

.skin-card:hover {
    transform: translateY(-3px);

    border-color: rgba(0, 255, 213, 0.4);
}

.skin-card.selected {
    border-color: #00ffd5;

    box-shadow:
        0 0 25px rgba(0, 255, 213, 0.15);
}

.skin-preview {
    height: 90px;

    border-radius: 12px;

    margin-bottom: 12px;

    position: relative;

    overflow: hidden;

    background: #0b1220;
}

.preview-snake {
    position: absolute;

    left: 15%;
    top: 42%;

    width: 70%;
    height: 22px;

    border-radius: 20px;

    box-shadow:
        0 0 14px currentColor;
}

.skin-name {
    font-size: 13px;
    font-weight: 800;
}

.skin-price {
    margin-top: 5px;

    font-size: 11px;

    color: #00ffd5;
}

.skin-card.locked {
    opacity: 0.62;
}

.lock {
    position: absolute;

    top: 10px;
    right: 10px;

    padding: 5px 7px;

    border-radius: 6px;

    background: rgba(0, 0, 0, 0.6);

    font-size: 10px;
}


/* =====================================================
   GAME
   ===================================================== */

.game-screen {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100dvh;

    overflow: hidden;

    background: #02050c;
}

#gameCanvas {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    touch-action: none;
}


/* =====================================================
   HUD
   ===================================================== */

#hud {
    position: absolute;

    top: max(12px, env(safe-area-inset-top));
    left: 0;
    right: 0;

    display: flex;
    justify-content: space-between;

    padding:
        12px
        max(12px, env(safe-area-inset-right))
        12px
        max(12px, env(safe-area-inset-left));

    pointer-events: none;
}

.hud-left {
    display: flex;
    gap: 8px;
}

.hud-box {
    padding: 8px 12px;

    min-width: 75px;

    border-radius: 9px;

    background: rgba(3, 10, 20, 0.72);

    border: 1px solid rgba(0, 255, 213, 0.15);

    backdrop-filter: blur(8px);
}

.hud-label {
    display: block;

    color: #607791;

    font-size: 8px;

    letter-spacing: 1.5px;
}

.hud-box strong {
    display: block;

    margin-top: 3px;

    color: #7fffea;

    font-size: 13px;
}

.pause-btn {
    pointer-events: auto;

    min-height: 42px;

    padding: 0 15px;

    border-radius: 10px;

    color: #b4c7dc;

    background: rgba(3, 10, 20, 0.78);

    border: 1px solid rgba(0, 255, 213, 0.2);

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 1px;

    backdrop-filter: blur(8px);
}


/* =====================================================
   MINIMAP
   ===================================================== */

.minimap-canvas {
    position: absolute;

    left: max(12px, env(safe-area-inset-left));
    bottom: max(12px, env(safe-area-inset-bottom));

    width: 140px;
    height: 140px;

    border-radius: 50%;

    background: rgba(3, 10, 20, 0.65);

    border: 1px solid rgba(0, 255, 213, 0.3);

    box-shadow:
        0 0 25px rgba(0, 255, 213, 0.15);

    backdrop-filter: blur(6px);

    z-index: 8;
}

@media (max-width: 380px) {

    .minimap-canvas {
        width: 100px;
        height: 100px;
    }
}


/* =====================================================
   MOBILE BOOST
   ===================================================== */

.boost-btn {
    position: absolute;

    right: max(20px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));

    width: 82px;
    height: 82px;

    border-radius: 50%;

    color: #00150f;

    background:
        radial-gradient(
            circle,
            #8affec,
            #00d8ba
        );

    border: 3px solid rgba(255, 255, 255, 0.35);

    box-shadow:
        0 0 25px rgba(0, 255, 213, 0.35);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    font-size: 24px;

    z-index: 10;
}

.boost-btn span {
    font-size: 9px;
    font-weight: 1000;
    letter-spacing: 1px;
}

.boost-btn.active {
    transform: scale(0.92);

    background: #fff;

    box-shadow:
        0 0 45px rgba(255, 255, 255, 0.8);
}


/* =====================================================
   OVERLAYS
   ===================================================== */

.game-overlay {
    position: absolute;

    inset: 0;

    z-index: 20;

    display: flex;

    justify-content: center;
    align-items: center;

    padding: 20px;

    background:
        rgba(1, 4, 10, 0.72);

    backdrop-filter: blur(8px);

    overflow-y: auto;
}

.overlay-card {
    width: min(90vw, 400px);

    padding: 35px 25px;

    text-align: center;

    border-radius: 20px;

    background:
        linear-gradient(
            145deg,
            rgba(10, 25, 45, 0.98),
            rgba(2, 7, 16, 0.99)
        );

    border: 1px solid rgba(0, 255, 213, 0.25);

    box-shadow:
        0 0 60px rgba(0, 255, 213, 0.1);
}

.overlay-card h2 {
    margin-top: 10px;

    color: #72ffe9;

    font-size: clamp(24px, 7vw, 34px);

    letter-spacing: 3px;
}

.overlay-card p {
    margin-top: 10px;

    color: #657d99;

    font-size: 13px;
}

.pause-icon,
.dead-icon {
    color: #00ffd5;

    font-size: 42px;

    text-shadow:
        0 0 20px #00ffd5;
}

.dead-icon {
    color: #ff4e82;

    text-shadow:
        0 0 20px #ff4e82;
}

.final-score {
    margin-top: 20px;

    color: #607993;

    font-size: 10px;

    letter-spacing: 2px;
}

.final-score strong {
    display: block;

    margin-top: 5px;

    color: white;

    font-size: 32px;
}

.best-line {
    margin-top: 12px;

    color: #8a7000;

    font-size: 10px;

    letter-spacing: 2px;
}

.best-line strong {
    margin-left: 6px;

    color: #ffdd66;

    font-size: 16px;
}


/* =====================================================
   SMALL PHONES
   ===================================================== */

@media (max-width: 380px) {

    .menu-card {
        padding: 24px 18px;
    }

    .logo {
        font-size: 28px;
        letter-spacing: 1px;
    }

    .subtitle {
        letter-spacing: 3px;
    }

    .player-form {
        margin-top: 22px;
    }

    .controls-hint {
        margin-top: 20px;
        gap: 7px;
        font-size: 9px;
    }

    .boost-btn {
        width: 72px;
        height: 72px;
        font-size: 20px;
    }

    .skin-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .skin-card {
        min-height: 160px;
    }

    .skin-preview {
        height: 70px;
    }
}


/* =====================================================
   LANDSCAPE MOBILE
   ===================================================== */

@media (max-height: 500px) {

    .menu-card {
        padding: 18px 30px;
    }

    .logo {
        font-size: 30px;
    }

    .player-form {
        margin-top: 15px;
    }

    .player-form input {
        height: 42px;
    }

    .main-btn,
    .secondary-btn,
    .revive-btn {
        min-height: 42px;
        margin-top: 8px;
    }

    .controls-hint {
        margin-top: 10px;
    }

    .minimap-canvas {
        width: 90px;
        height: 90px;
    }
}