/* ==================================================
   SNAKE GLOBE - CORE STYLESHEET
   100% Offline, Pure Vanilla CSS
   Gulper.io-Inspired Clean Minimalist Game Hub
   ================================================== */

@font-face {
    font-family: 'LilitaOne';
    src: url('./fonts/LilitaOne.ttf') format('truetype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'FredokaGaming';
    src: url('./fonts/Fredoka-Gaming.ttf') format('truetype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-dark: #040a16;
    --bg-surface: #071528;
    --bg-card: rgba(8, 22, 40, 0.9);
    --bg-card-elevated: rgba(10, 26, 48, 0.96);
    --bg-input: rgba(6, 18, 34, 0.85);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.12);
    --border-cyan: rgba(0, 229, 255, 0.4);
    --border-gold: rgba(250, 204, 21, 0.5);

    --text-main: #f1f5f9;
    --text-muted: rgba(241, 245, 249, 0.65);
    --text-dim: rgba(241, 245, 249, 0.4);

    --accent-cyan: #00e5ff;
    --accent-blue: #0088ff;
    --accent-yellow: #facc15;
    --accent-green: #22c55e;
    --accent-purple: #a855f7;
    --accent-rose: #f43f5e;

    --btn-primary-bg: linear-gradient(135deg, #00f2fe 0%, #00a0ff 50%, #0062ff 100%);
    --btn-primary-shadow: 0 10px 28px rgba(0, 160, 255, 0.4);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    color: var(--text-main);
}

#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
}

/* ==================================================
   1. INTRO LOADING SCREEN
   ================================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #030813;
    background-image: radial-gradient(circle at 50% 45%, #0c223a 0%, #030813 75%);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

.loading-screen.hidden {
    display: none !important;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 90%;
    max-width: 440px;
    z-index: 2;
}

.loading-logo-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
}

.loading-logo-img {
    max-width: 330px;
    width: 85%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.85));
    animation: logoFloat 3s ease-in-out infinite alternate;
}

/* Pill-Shaped Striped Progress Bar (Matching Reference UI) */
.loading-bar-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-bar-track {
    width: 340px;
    max-width: 85vw;
    height: 22px;
    background: rgba(240, 246, 255, 0.18);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45);
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-full);
    background: repeating-linear-gradient(
        45deg,
        #38bdf8 0,
        #38bdf8 12px,
        #0284c7 12px,
        #0284c7 24px
    );
    background-size: 34px 100%;
    animation: stripeMove 0.8s linear infinite;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.5);
    transition: width 0.1s linear;
}

@keyframes stripeMove {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 34px 0;
    }
}

/* ==================================================
   2. GULPER.IO STYLE HOME MENU SCREEN
   ================================================== */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at 50% 45%, #0e243c 0%, #071526 50%, #030812 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.35s ease, visibility 0.35s ease;
    overflow-y: auto;
    padding: 20px;
}

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

/* Top Right Clean Neon Nav Bar */
.top-nav-bar {
    position: fixed;
    top: 24px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 160;
}

.top-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.nav-btn-help {
    color: var(--accent-green);
    filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.6));
}

.nav-btn-help:hover {
    transform: scale(1.22) rotate(-5deg);
    filter: drop-shadow(0 0 14px rgba(34, 197, 94, 0.95));
}

.nav-btn-skin {
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.6));
}

.nav-btn-skin:hover {
    transform: scale(1.22) rotate(15deg);
    filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.95));
}

.nav-btn-trophy {
    color: var(--accent-yellow);
    filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.6));
}

.nav-btn-trophy:hover {
    transform: scale(1.22) rotate(-8deg);
    filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.95));
}

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

/* Center Layout */
.menu-container.gulper-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 680px;
    margin: auto;
    position: relative;
    z-index: 2;
}

/* Animated Pop Typography Title (Left-to-Right Write-in + Continuous Pop Breathing) */
.game-title-hero {
    margin-bottom: 34px;
    position: relative;
}

.game-title-animated {
    font-family: 'LilitaOne', 'FredokaGaming', cursive, system-ui, sans-serif;
    font-size: clamp(3.6rem, 10vw, 6.8rem);
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0px;
    animation: titlePopPulse 3.5s infinite ease-in-out;
    transform-origin: center center;
    text-transform: uppercase;
}

.title-word {
    display: inline-flex;
}

.title-char {
    display: inline-block;
    opacity: 0;
    transform: translateX(-35px) scale(0.6);
    filter: blur(4px);
    animation: charSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--i) * 0.055s);
}

.word-snake .title-char {
    background: linear-gradient(180deg, #a7f3d0 0%, #38bdf8 45%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 6px 18px rgba(0, 229, 255, 0.65));
}

.word-globe .title-char {
    background: linear-gradient(180deg, #fef08a 0%, #facc15 50%, #eab308 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 6px 18px rgba(250, 204, 21, 0.65));
}

/* Staggered Letter Entrance */
@keyframes charSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-35px) scale(0.6);
        filter: blur(4px);
    }
    70% {
        opacity: 1;
        transform: translateX(4px) scale(1.12);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

/* Continuous Subtle Pop / Breathing Animation */
@keyframes titlePopPulse {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(1.035) translateY(-6px);
    }
}

/* Gulper-Style Streamlined Action Bar */
.gulper-action-hub {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 340px;
    margin-bottom: 24px;
}

.gulper-input-bar {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: stretch;
    background: rgba(10, 28, 50, 0.85);
    border: 1.5px solid rgba(0, 229, 255, 0.4);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 229, 255, 0.12);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gulper-input-bar:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.35);
}

.gulper-nickname-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0 14px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    outline: none;
}

.gulper-nickname-input::placeholder {
    color: rgba(255, 255, 255, 0.38);
    font-weight: 500;
}

.gulper-btn-play {
    width: 76px;
    background: rgba(250, 204, 21, 0.1);
    border: none;
    border-left: 1.5px solid rgba(250, 204, 21, 0.45);
    color: var(--accent-yellow);
    font-family: 'LilitaOne', 'FredokaGaming', cursive, sans-serif;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.gulper-btn-play:hover {
    background: var(--accent-yellow);
    color: #040a16;
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.7);
}

.gulper-btn-play:active {
    transform: scale(0.97);
}

.gulper-hint-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 14px;
    line-height: 1.4;
    text-align: center;
}

/* Minimalist Centered Footer (Fixed at Bottom of Screen) */
.gulper-footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-dim);
    z-index: 150;
    white-space: nowrap;
    pointer-events: auto;
}

.footer-link {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-link:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.footer-dot {
    color: var(--text-dim);
}

.version-tag {
    color: var(--text-dim);
    font-family: monospace;
    font-size: 0.72rem;
}

/* Bottom Right Quick Skin Bubble */
.bottom-skin-bubble {
    position: fixed;
    bottom: 24px;
    right: 28px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2.5px solid #ffffff;
    background: #f472b6;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(244, 114, 182, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 160;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.skin-bubble-face {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.bubble-eye {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #060e18;
    animation: eyeBlink 3.5s infinite;
}

@keyframes eyeBlink {
    0%, 94%, 100% { transform: scaleY(1); }
    97% { transform: scaleY(0.1); }
}

.bottom-skin-bubble:hover {
    transform: scale(1.16) rotate(6deg);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 229, 255, 0.6);
}

.bottom-skin-bubble:active {
    transform: scale(0.95);
}

/* ==================================================
   3. MODALS BACKDROP & CARDS
   ================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 6, 14, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-card {
    width: 500px;
    max-width: 94vw;
    background: var(--bg-card-elevated);
    background-image: linear-gradient(180deg, rgba(14, 34, 60, 0.95) 0%, rgba(8, 20, 36, 0.98) 100%);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(0, 229, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    animation: modalSlide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.hidden {
    display: none !important;
}

@keyframes modalSlide {
    from { transform: translateY(20px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: scale(1.08);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-main);
}

/* How to Play Modal */
.help-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.help-rule {
    display: flex;
    gap: 14px;
    align-items: center;
    background: rgba(6, 16, 28, 0.65);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.15s ease, background 0.15s ease;
}

.help-rule:hover {
    background: rgba(10, 24, 42, 0.8);
    transform: translateX(2px);
}

.help-rule.rule-danger {
    border-color: rgba(244, 63, 94, 0.28);
    background: rgba(36, 8, 20, 0.4);
}

.help-rule.rule-danger:hover {
    background: rgba(48, 10, 26, 0.6);
}

.rule-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.rule-icon-box.danger-icon {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.35);
    color: var(--accent-rose);
}

.rule-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rule-info strong {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
}

.rule-info p {
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* ==================================================
   4. ACHIEVEMENTS MODAL STYLING
   ================================================== */
.ach-modal-card {
    width: 540px;
    max-width: 94vw;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    overflow: hidden;
}

.ach-modal-header-section {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin-bottom: 6px;
}

.header-title-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ach-summary-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.ach-progress-bar-top {
    height: 6px;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    margin-top: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.ach-progress-fill-top {
    height: 100%;
    background: linear-gradient(90deg, #0072ff 0%, #00e5ff 100%);
    border-radius: var(--radius-full);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    transition: width 0.3s ease;
}

.ach-category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
}

.ach-category-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 6px 12px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.tab-btn.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.ach-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
    scrollbar-width: thin;
}

.ach-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(6, 16, 28, 0.55);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ach-item.locked {
    opacity: 0.6;
    background: rgba(4, 10, 18, 0.4);
}

.ach-item.unlocked {
    opacity: 1.0;
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.25);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.ach-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.ach-item.locked .ach-icon-box {
    color: var(--text-dim);
}

.ach-info {
    flex: 1;
    min-width: 0;
}

.ach-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.ach-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-main);
}

.ach-status-tag {
    font-size: 0.74rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.unlocked-tag {
    color: #34d399;
}

.locked-tag {
    color: var(--text-dim);
}

.ach-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.35;
}

.ach-item-progress-track {
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.ach-item-progress-fill {
    height: 100%;
    background: #00c6ff;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.ach-item.unlocked .ach-item-progress-fill {
    background: #34d399;
}

/* Achievement Toast Notification */
.achievement-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 400;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(8, 22, 38, 0.95);
    border: 1px solid var(--accent-cyan);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.2);
    backdrop-filter: blur(12px);
    animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastSlideIn {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-fade-out {
    animation: toastSlideOut 0.4s forwards ease-in;
}

@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(50px); opacity: 0; }
}

.toast-icon {
    width: 34px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-cyan);
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-subtitle {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-cyan);
}

.toast-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #ffffff;
}

/* ==================================================
   5. SNAKE SKINS MODAL STYLING
   ================================================== */
.skin-modal-card {
    width: 700px;
    max-width: 94vw;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
}

.skin-modal-body {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
    margin-top: 12px;
}

.skin-preview-section {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.preview-canvas-wrapper {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-card);
    overflow: hidden;
    background: rgba(4, 12, 22, 0.95);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

#skinPreviewCanvas {
    width: 100%;
    height: auto;
    display: block;
}

.skin-details-box {
    background: rgba(6, 16, 28, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    justify-content: space-between;
}

.skin-details-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selected-skin-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
}

.rarity-tag {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.rarity-common {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.rarity-rare {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.rarity-epic {
    background: rgba(192, 132, 252, 0.2);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.35);
}

.unlock-desc-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.equip-btn-wrapper {
    margin-top: 4px;
}

.equip-btn {
    width: 100%;
    height: 42px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: 0.8px;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.equip-btn.primary-equip {
    background: var(--btn-primary-bg);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 160, 255, 0.35);
}

.equip-btn.primary-equip:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.equip-btn.active-equipped {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    cursor: default;
}

.skin-grid-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skin-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    gap: 10px;
    padding-right: 4px;
    scrollbar-width: thin;
}

.skin-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    background: rgba(6, 16, 28, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.skin-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-cyan);
    transform: translateY(-2px);
}

.skin-card.selected {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.09);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.2);
}

.skin-card-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.7rem;
}

.equipped-badge {
    color: #34d399;
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.68rem;
    font-weight: 800;
}

.skin-swatch-box {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.swatch-head {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.skin-card-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ==================================================
   6. GAME OVER OVERLAY & SCREEN
   ================================================== */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 6, 14, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 250;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: auto;
}

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

.game-over-card {
    width: 460px;
    max-width: 94vw;
    background: var(--bg-card-elevated);
    background-image: linear-gradient(180deg, rgba(16, 30, 52, 0.96) 0%, rgba(6, 14, 26, 0.98) 100%);
    border: 1px solid rgba(244, 63, 94, 0.3);
    border-radius: var(--radius-xl);
    padding: 30px 24px;
    text-align: center;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.75),
        0 0 35px rgba(244, 63, 94, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    animation: modalSlide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

.game-over-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.skull-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(244, 63, 94, 0.15);
    border: 1.5px solid rgba(244, 63, 94, 0.4);
    color: var(--accent-rose);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.3);
}

.game-over-title {
    font-family: 'LilitaOne', 'FredokaGaming', cursive, sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    color: var(--accent-rose);
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
}

.game-over-reason {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 22px;
    line-height: 1.4;
}

.game-over-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.primary-score-box {
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.3);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-grid-two .stat-box {
    background: rgba(6, 16, 28, 0.65);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
}

.stat-value.highlight-score {
    font-size: 1.7rem;
    color: var(--accent-cyan);
    text-shadow: 0 0 14px rgba(0, 229, 255, 0.5);
}

#goFinalRank {
    color: var(--accent-cyan);
}

#goBestRank {
    color: #34d399;
}

.game-over-actions {
    display: flex;
    gap: 12px;
}

.go-btn {
    flex: 1;
    height: 50px;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.96rem;
    letter-spacing: 0.8px;
    cursor: pointer;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.go-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.go-btn:active {
    transform: translateY(0) scale(0.97);
}

.replay-btn {
    background: var(--btn-primary-bg);
    color: #ffffff;
    box-shadow: var(--btn-primary-shadow);
}

.menu-btn {
    background: rgba(14, 32, 54, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);
}

.menu-btn:hover {
    background: rgba(20, 44, 76, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ==================================================
   7. LIVE IN-GAME LEADERBOARD
   ================================================== */
.game-leaderboard {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 240px;
    pointer-events: none;
    z-index: 120;
}

.lb-card {
    background: rgba(6, 16, 28, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.lb-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
}

.lb-icon {
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
}

.lb-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 0;
}

.lb-rows {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lb-row {
    display: flex;
    align-items: center;
    font-size: 0.82rem;
    padding: 3px 6px;
    border-radius: 6px;
    color: var(--text-main);
}

.lb-row.player-row {
    background: rgba(0, 229, 255, 0.12);
    border-left: 2px solid var(--accent-cyan);
    font-weight: 700;
}

.lb-rank {
    width: 28px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.78rem;
    flex-shrink: 0;
}

.lb-row.player-row .lb-rank {
    color: var(--accent-cyan);
}

.lb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

.lb-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
}

.lb-you {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.15);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    letter-spacing: 0.4px;
}

.lb-score {
    font-weight: 700;
    font-size: 0.82rem;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    margin-left: 6px;
}

.lb-row-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

/* ==================================================
   8. MOBILE TOUCH BOOST BUTTON
   ================================================== */
.mobile-boost-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(10, 25, 45, 0.85);
    border: 1.5px solid var(--border-cyan);
    color: var(--accent-cyan);
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 130;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 229, 255, 0.2);
    backdrop-filter: blur(8px);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}

.mobile-boost-btn.active,
.mobile-boost-btn:active {
    transform: scale(0.92);
    background: var(--btn-primary-bg);
    border-color: var(--accent-cyan);
    color: #ffffff;
    box-shadow: 0 0 22px rgba(0, 229, 255, 0.7);
}

.mobile-boost-btn.hidden {
    display: none !important;
}

@media (pointer: coarse), (max-width: 768px) {
    .mobile-boost-btn {
        display: flex;
    }
}

/* ==================================================
   9. KEYFRAME ANIMATIONS
   ================================================== */
@keyframes pulseAura {
    0% { transform: scale(0.95); opacity: 0.4; }
    100% { transform: scale(1.05); opacity: 0.85; }
}

@keyframes logoFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-4px); }
}

@keyframes dotBlink {
    0% { opacity: 0.4; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

@keyframes snakeWave {
    0%, 100% { transform: translateY(0); background-color: rgba(0, 229, 255, 0.3); }
    50% { transform: translateY(-6px); background-color: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
}

/* ==================================================
   10. RESPONSIVE BREAKPOINTS
   ================================================== */
@media (max-width: 640px) {
    .top-nav-bar {
        top: 16px;
        right: 16px;
        gap: 14px;
    }

    .bottom-skin-bubble {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .gulper-action-hub {
        max-width: 90vw;
    }

    .skin-modal-body {
        flex-direction: column;
        gap: 14px;
    }

    .skin-preview-section {
        width: 100%;
    }

    .game-leaderboard {
        top: 12px;
        right: 12px;
        width: 190px;
    }

    .game-over-title {
        font-size: 1.8rem;
    }

    .gulper-footer {
        bottom: 12px;
        font-size: 0.72rem;
    }
}
