body {
    margin: 0;
    overflow: hidden;
    background-color: #001219;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    user-select: none;
    touch-action: none;
}

canvas {
    display: block;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* SMALL TOP LEFT BUTTONS */
#sound-btn,
#rules-btn,
#fullscreen-btn {
    position: absolute;
    left: 20px;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #555;
    color: white;
    padding: 0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
    z-index: 200;
    font-weight: bold;
}

#sound-btn {
    top: 20px;
}

#rules-btn {
    top: 70px;
}

/* Position the new button below the rules button */
#fullscreen-btn {
    top: 120px;
    font-size: 1.5rem;
}

#sound-btn:hover,
#rules-btn:hover,
#fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

#fps-display {
    position: absolute;
    top: 5px;
    left: 5px;
    /* Positioned to the right of the sound/rules buttons */
    color: #949494ef;
    font-size: 10px;
    font-family: monospace;
    font-weight: bold;
    pointer-events: none;
    z-index: 200;
    text-shadow: 1px 1px 0 #000;
}

/* RULES OVERLAY */
#rules-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 18, 25, 0.95);
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.rules-content {
    background: #001219;
    border: 2px solid #0A9396;
    padding: 10px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    color: #ddd;
    box-shadow: 0 0 30px rgba(10, 147, 150, 0.2);
    text-align: left;
    max-height: 85vh;
    overflow-y: auto;
    touch-action: pan-y;
}

.rules-content h2 {
    text-align: center;
    color: #0A9396;
    margin-top: 0;
    text-transform: uppercase;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.rules-section {
    margin-bottom: 15px;
}

.rules-section h3 {
    color: #AE2012;
    margin-bottom: 5px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rules-section p {
    margin: 5px 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.warning {
    color: #EE9B00;
    font-weight: bold;
}

.item-list {
    list-style: none;
    padding: 0;
}

.item-list li {
    margin: 5px 0;
    font-size: 0.9rem;
}

.item-list span {
    display: inline-block;
    width: 25px;
    font-size: 1.2rem;
    vertical-align: middle;
}

.rules-icon {
    width: 20px;
    height: 20px;
    vertical-align: top;
}


.close-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #0A9396;
    border: none;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 20px;
    border-radius: 5px;
    transition: 0.2s;
}

.close-btn:hover {
    background: #fff;
    transform: scale(1.02);
}

#boss-timer-container {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
}

#boss-label {
    font-size: 0.8rem;
    color: #AE2012;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 2px;
    text-shadow: 0 0 5px black;
}

#boss-timer {
    font-size: 3.5rem;
    font-weight: 900;
    color: #AE2012;
    text-shadow: 0 0 10px #AE2012;
    font-variant-numeric: tabular-nums;
    margin-top: 5px;
}

#score-board {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
    display: flex;
    gap: 40px;
    align-items: center;
}

.hud-stat {
    display: flex;
    flex-direction: column;
}

#current-score,
#current-kills {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    display: block;
    line-height: 1;
}

.hud-label {
    font-size: 0.9rem;
    color: #aaa;
    font-weight: bold;
    letter-spacing: 1px;
}

#personal-best-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 10px;
    border-left: 4px solid #0A9396;
    pointer-events: none;
}

.pb-label {
    font-size: 0.8rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#personal-best-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

#buffs-container {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    pointer-events: none;
}

.buff-box {
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.5rem;
    display: none;
    align-items: center;
    gap: 10px;
    border: 3px solid white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#buff-boost {
    border-color: #00ffff;
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
}



#buff-gun {
    border-color: #AE2012;
    color: #AE2012;
    text-shadow: 0 0 5px #AE2012;
}

#lb-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.lb-box {
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 12px;
    text-align: right;
    border: 1px solid #333;
    min-width: 160px;
}

.lb-box h3 {
    margin: 0 0 5px 0;
    color: #888;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid #444;
    padding-bottom: 3px;
}

.lb-box ol {
    padding: 0;
    margin: 0;
    list-style: none;
}

.lb-box li {
    margin-bottom: 3px;
    font-size: 0.85rem;
    color: #ccc;
}

.highlight-me {
    color: #0A9396 !important;
    font-weight: bold;
    text-shadow: 0 0 5px #0A9396;
}

.king-icon {
    color: #EE9B00;
    margin-right: 5px;
}

#notification-area {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    width: 100%;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.toast {
    display: block;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.9), transparent);
    color: black;
    font-weight: bold;
    padding: 10px 60px;
    font-size: 1.5rem;
    margin-bottom: 10px;
    opacity: 0;
    transition: opacity 0.5s;
    text-shadow: none;
    border-top: 2px solid white;
    border-bottom: 2px solid white;
}

.toast.show {
    opacity: 1;
}

#start-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 18, 25, 0.95);
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    pointer-events: auto;
    border: 2px solid #333;
    box-shadow: 0 0 60px rgba(10, 147, 150, 0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 600px;
    max-height: 95vh;
    z-index: 100;
    overflow-y: auto;
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    text-shadow: 3px 3px 0 #000;
    letter-spacing: 2px;
}

.title-part {
    color: #0A9396;
}

.instruction-label {
    color: #fff;
    font-size: 1.1rem;
    margin-top: 5px;
    font-weight: bold;
    color: #0A9396;
}

/* BUTTONS AND INPUT UNIFORMITY */
#username-input,
button#play-btn,
button#skins-menu-btn,
button#leaderboard-btn,
button#main-rules-btn {
    width: 60%;
    max-width: 400px;
    box-sizing: border-box;
    /* Ensure padding doesn't affect width */
    margin-left: auto;
    margin-right: auto;
    display: block;
    /* Ensure centering */
}

/* USERNAME INPUT */
#username-input {
    background: #001219;
    border: 2px solid #005F73;
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 1.2rem;
    text-align: center;
    outline: none;
    transition: all 0.2s;
    font-weight: bold;
    margin-bottom: 20px;
    font-family: inherit;
}

#username-input:focus {
    border-color: #0A9396;
    box-shadow: 0 0 15px rgba(10, 147, 150, 0.3);
    background: #001219;
}

#username-input::placeholder {
    color: #555;
    font-weight: normal;
}

.skin-section-title {
    color: #aaa;
    font-size: 0.9rem;
    text-align: left;
    margin-left: 10px;
    margin-top: 5px;
    font-weight: bold;
}

.skin-section-title.boss-title {
    color: #AE2012;
}

.skin-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    background: #001219;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #333;
    /* max-height: 150px; Removed to allow full height */
    overflow-y: auto;
}

.skin-grid::-webkit-scrollbar {
    width: 8px;
}

.skin-grid::-webkit-scrollbar-track {
    background: #001219;
}

.skin-grid::-webkit-scrollbar-thumb {
    background: #005F73;
    border-radius: 4px;
}

.skin-card {
    position: relative;
    background: #001219;
    border: 2px solid #005F73;
    border-radius: 8px;
    height: 70px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.skin-card:hover {
    transform: scale(1.05);
    border-color: #555;
}

.skin-card.selected {
    border-color: #EE9B00;
    box-shadow: 0 0 10px rgba(238, 155, 0, 0.3);
}

.skin-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.skin-preview {
    width: 45px;
    height: 45px;
    background: transparent;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skin-name {
    font-size: 0.6rem;
    color: #ccc;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.unlock-req {
    position: absolute;
    top: 2px;
    font-size: 0.9rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 4px;
    border-radius: 4px;
}

/* BUTTONS */
@keyframes pulse-btn {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(10, 147, 150, 0);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 0 10px rgba(10, 147, 150, 0.3);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(10, 147, 150, 0);
    }
}

button#play-btn {
    padding: 12px 0;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #0A9396, #94D2BD);
    border: none;
    border-radius: 30px;
    color: #000;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s, filter 0.2s, box-shadow 0.2s;
    margin-bottom: 15px;
    animation: pulse-btn 2s infinite ease-in-out;
}

button#play-btn:hover {
    animation: none;
    transform: scale(1.06);
    filter: brightness(1.1);
    box-shadow: 0 0 15px rgba(10, 147, 150, 0.6);
}

button#play-btn:active {
    animation: none;
    transform: scale(0.95);
}

button#play-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
}

button#main-rules-btn {
    padding: 12px 0;
    font-size: 1.1rem;
    background: transparent;
    border: 2px solid #0A9396;
    border-radius: 30px;
    color: #0A9396;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 20px;
}

button#main-rules-btn:hover {
    background: rgba(10, 147, 150, 0.1);
    transform: scale(1.05);
}

#game-over-container {
    display: none;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #333;
}

#game-over-title {
    color: #AE2012;
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0 0 0 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    margin: 5px 0;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.stat-row span:last-child {
    font-weight: bold;
    color: #0A9396;
}

/* --- SKINS MENU BUTTON --- */
button#skins-menu-btn {
    padding: 12px 0;
    font-size: 1.1rem;
    background: transparent;
    border: 2px solid #EE9B00;
    /* Purple theme for skins */
    border-radius: 30px;
    color: #EE9B00;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 15px;
    margin-top: 0;
}

button#skins-menu-btn:hover {
    background: rgba(238, 155, 0, 0.1);
    transform: scale(1.05);
    border-color: #E9D8A6;
}

/* --- LEADERBOARD BUTTON --- */
button#leaderboard-btn {
    padding: 12px 0;
    font-size: 1.1rem;
    background: transparent;
    border: 2px solid #9B2226;
    /* Ruby Red for Leaderboard */
    border-radius: 30px;
    color: #9B2226;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 15px;
    margin-top: 0;
}

button#leaderboard-btn:hover {
    background: rgba(155, 34, 38, 0.1);
    transform: scale(1.05);
    color: #ff99ac;
    border-color: #ff99ac;
}

/* --- SKINS PAGE OVERLAY --- */
#skins-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 18, 25, 0.95);
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.skins-content {
    background: #001219;
    border: 2px solid #EE9B00;
    padding: 10px;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    color: #ddd;
    box-shadow: 0 0 50px rgba(238, 155, 0, 0.15);
    text-align: center;
    height: 85vh !important;
    max-height: 85vh !important;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
}

.skins-content h2 {
    color: #EE9B00;
    margin: 0;
    text-shadow: 0 0 10px rgba(238, 155, 0, 0.5);
    font-size: 2rem;
}

/* SKIN PREVIEW */
#skin-preview-container {
    display: flex;
    justify-content: center;
}

#skin-preview-canvas {

    width: 100%;
    max-width: 600px;
}

/* --- ADJUST GRID FOR DEDICATED PAGE --- */
/* We override the previous max-height because we have more room now */


/* --- MOBILE CONTROLS --- */
#mobile-controls {
    display: none;
    /* Hidden by default, shown via JS on mobile */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

#joystick-zone {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
    /* Prevents browser zooming/scrolling */
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(10, 147, 150, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(10, 147, 150, 0.5);
    pointer-events: none;
    transition: 0.1s;
}

#mobile-boost-btn {
    position: absolute;
    bottom: 50px;
    right: 40px;
    width: 90px;
    height: 90px;
    background: rgba(174, 32, 18, 0.6);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    cursor: pointer;
}

#mobile-boost-btn:active {
    background: rgba(174, 32, 18, 0.9);
    transform: scale(0.95);
}

/* --- RESPONSIVE FIXES --- */
/* --- RESPONSIVE FIXES --- */
@media (max-width: 768px) {
    #start-screen {
        min-width: 0;
        width: 85%;
        padding: 10px;
        max-height: 85vh;
        /* Ensure it fits */
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    #username-input {
        padding: 8px 15px;
        font-size: 1rem;
        margin-bottom: 10px;
    }

    /* Adjust grids for smaller screens */
    .skin-grid {
        grid-template-columns: repeat(3, 1fr);
        /* max-height: 100px; REMOVED */
    }

    #lb-container {
        transform: scale(0.7);
        transform-origin: top right;
        top: 10px;
        right: 10px;
    }

    #boss-timer-container {
        top: 60px;
        transform: scale(0.8) translateX(-60%);
    }

    #score-board {
        top: 5px;
        transform: scale(0.8) translateX(-60%);
    }

    /* Tweaks for small buttons */
    button#play-btn,
    button#skins-menu-btn,
    button#leaderboard-btn,
    button#main-rules-btn {
        padding: 8px 20px;
        font-size: 0.9rem;
        width: 60%;
        margin-top: 5px;
        margin-bottom: 5px;
    }

    /* Hide desktop-specific instructions */
    .rules-section p,
    .item-list li {
        font-size: 0.7rem;
    }
}

/* Landscape Mode Fixes (often an issue on mobile/tablet) */
@media (max-height: 500px) {
    #start-screen {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    h1 {
        width: 100%;
        font-size: 1.5rem;
    }

    #username-input {
        width: 40%;
    }

    button#play-btn {
        width: 40%;
    }

    /* Hide non-essentials in strict landscape */
    .instruction-label,
    button#skins-menu-btn,
    button#main-rules-btn {
        display: none;
    }
}

/* --- LEADERBOARD OVERLAY --- */
#leaderboard-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 18, 25, 0.95);
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.leaderboard-content {
    background: #001219;
    border: 2px solid #9B2226;
    padding: 10px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    color: #ddd;
    box-shadow: 0 0 50px rgba(155, 34, 38, 0.15);
    text-align: center;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
}

.leaderboard-content h2 {
    color: #9B2226;
    margin-top: 0;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(155, 34, 38, 0.5);
    font-size: 2rem;
    text-transform: uppercase;
}

.lb-scroll-area {
    overflow-y: auto;
    flex: 1;
    /* Take remaining space */
    margin-bottom: 15px;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
}

/* Custom Scrollbar */
.lb-scroll-area::-webkit-scrollbar {
    width: 8px;
}

.lb-scroll-area::-webkit-scrollbar-track {
    background: #001219;
}

.lb-scroll-area::-webkit-scrollbar-thumb {
    background: #9B2226;
    border-radius: 4px;
}

#lb-full-table {
    width: 100%;
    border-collapse: collapse;
    color: #ccc;
    font-size: 0.9rem;
}

#lb-full-table th {
    position: sticky;
    top: 0;
    background: #001219;
    /* Opaque background for sticky header */
    color: #9B2226;
    padding: 10px 5px;
    text-transform: uppercase;
    font-size: 0.9rem;
    border-bottom: 2px solid #333;
    z-index: 2;
}

#lb-full-table td {
    padding: 8px 5px;
    border-bottom: 1px solid #222;
}

#lb-full-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.rank-col {
    width: 40px;
    font-weight: bold;
    color: #EE9B00;
}

.score-col {
    text-align: right;
    font-weight: bold;
    color: #0A9396;
}

.top-3-row {
    color: #EE9B00;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(238, 155, 0, 0.3);
}

#lb-loading {
    font-size: 1.2rem;
    color: #888;
    margin: 20px 0;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {

    /* Adjust Start Screen */
    #start-screen {
        min-width: unset;
        width: 90%;
        padding: 15px;
        gap: 5px;
    }

    h1 {
        font-size: 2rem;
    }

    /* Buttons */
    #username-input,
    button#play-btn,
    button#skins-menu-btn,
    button#leaderboard-btn,
    button#main-rules-btn {
        width: 100%;
        /* Use full width of container */
        max-width: unset;
        font-size: 1rem;
        padding: 10px 0;
    }

    /* HUD elements */
    #score-board {
        top: 10px;
    }

    #current-score {
        font-size: 2rem;
    }

    /* Move leaderboards (in-game) down or hide */
    #lb-container {
        transform: scale(0.8);
        transform-origin: top right;
        top: 50px;
    }

    #personal-best-container {
        transform: scale(0.8);
        transform-origin: bottom left;
    }

    #boss-timer {
        font-size: 1.2rem;
    }

    /* Overlays */
    .skins-content,
    .leaderboard-content,
    .rules-content {
        padding: 30px 20px;
        max-height: calc(100% - 60px);
        width: 90%;
        margin: auto;
        box-sizing: border-box;
    }

    .skins-content h2,
    .leaderboard-content h2,
    .rules-content h2 {
        font-size: 1.5rem;
    }

    .skin-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .skin-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    #lb-container {
        display: none;
        /* Hide in-game leaderboard on very small screens to save space */
    }
}

.credits {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-top: 15px;
    font-weight: normal;
    letter-spacing: 1px;
    margin-bottom: 0;
}

.credits a {
    color: white;
    text-decoration: underline dotted;
    font-weight: bold;
}

/* --- NEW SKINS PAGE STYLES --- */
.skin-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    border: 2px solid #555;
    color: #888;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: 0.2s;
    text-transform: uppercase;
}

.tab-btn:hover {
    border-color: #aaa;
    color: #ccc;
}

.tab-btn.active {
    border-color: #EE9B00;
    color: #EE9B00;
    background: rgba(238, 155, 0, 0.1);
    box-shadow: 0 0 10px rgba(238, 155, 0, 0.2);
}

/* Override Grid to use Main Grid ID and be bigger */

#skins-overlay #main-skin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    align-content: start;
    background: #001219;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #333;
    max-height: none !important;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
}



/* Larger cards for better visibility */
.skin-card {
    height: 100px;
    border-width: 2px;
}

.skin-preview {
    width: 60px;
    height: 60px;
}

.skin-name {
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 5px;
}

/* Custom Scrollbar for grid */
#main-skin-grid::-webkit-scrollbar {
    width: 20px;
}

#main-skin-grid::-webkit-scrollbar-track {
    background: #111;
    border-radius: 10px;
    border: 1px solid #333;
}

#main-skin-grid::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 10px;
    border: 3px solid #111;
    /* Padding effect */
}

/* --- NEW MODAL CLOSE BUTTON --- */
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    color: #888;
    cursor: pointer;
    line-height: 1;
    transition: 0.2s;
    font-weight: bold;
    z-index: 1001;
    /* Ensure on top */
}

.modal-close:hover {
    color: #ff4444;
    transform: scale(1.1);
}

/* Ensure parents are relative for absolute positioning of close button */
.skins-content,
.rules-content,
.leaderboard-content {
    position: relative;
    max-width: 650px;
    /* Slightly wider for better skin grid */
}

/* RESPONSIVE */
@media (max-width: 768px) {
    /* .skins-content override REMOVED to share styles with other modals (border, padding etc) */


    /* Make grid take available space */
    #skins-overlay #main-skin-grid {
        flex: 1;
        max-height: none;
        grid-template-columns: repeat(3, 1fr);
        /* 3 cols on mobile */
        gap: 8px;
    }

    .skin-card {
        height: 80px;
    }

    .skin-preview {
        width: 40px;
        height: 40px;
    }

    .skin-name {
        font-size: 0.7rem;
    }

    .tab-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    #skin-preview-canvas {
        width: 100%;
        height: auto;
        margin-top: 20px;
    }

    /* Hide the old grid scrollbar on mobile if native feels better, 
       but keeping custom is usually fine for Games feel */
}

/* --- TUTORIAL OVERLAY --- */
#tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 18, 25, 0.98);
    z-index: 2000;
    /* Higher than everything else */
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.tutorial-content {
    background: #001219;
    border: 3px solid #0A9396;
    padding: 30px;
    border-radius: 30px;
    max-width: 700px;
    width: 90%;
    color: #ddd;
    box-shadow: 0 0 60px rgba(10, 147, 150, 0.3);
    text-align: center;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tutorial-content h2 {
    color: #ffffff;
    margin: 0 0 30px 0;
    font-size: 2.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(10, 147, 150, 0.4);
}

.tutorial-grid {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.tutorial-step {
    flex: 1;
    min-width: 150px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s;
}

.tutorial-step:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: #0A9396;
}

.step-icon {
    font-size: 3.5rem;
    margin-bottom: 10px;
    display: block;
    text-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
}

.tutorial-step p {
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.4;
    color: #ccc;
}

.tutorial-step strong {
    color: #EE9B00;
    display: block;
    font-size: 1.3rem;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.tutorial-btn {
    padding: 15px 50px;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #EE9B00, #E9D8A6);
    border: none;
    border-radius: 40px;
    color: #001219;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 10px 20px rgba(238, 155, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tutorial-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(238, 155, 0, 0.5);
    filter: brightness(1.1);
}

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

@media (max-width: 768px) {
    .tutorial-content {
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
        width: 95%;
    }

    .tutorial-content h2 {
        font-size: 1.5rem;
        margin: 0 0 15px 0;
    }

    .tutorial-grid {
        gap: 10px;
        margin-bottom: 20px;
    }

    .tutorial-step {
        min-width: 40%;
        /* 2 per row */
        padding: 10px 5px;
    }

    .step-icon {
        font-size: 2rem;
        margin-bottom: 5px;
    }

    .tutorial-step strong {
        font-size: 0.9rem;
    }

    .tutorial-step p {
        font-size: 0.8rem;
    }

    .tutorial-btn {
        padding: 10px 30px;
        font-size: 1.2rem;
    }

    /* Fixed HUD consistency for mobile */
    .hud-stat {
        flex-direction: column-reverse;
    }

    #current-score,
    #current-kills {
        font-size: 2rem;
        /* Ensure consistent size */
    }

    .hud-label {
        font-size: 0.7rem;
    }

    #score-board {
        gap: 20px;
        top: 10px;
    }

    #boss-timer {
        font-size: 1.5rem;
    }

    /* Reduce font size / stack layout for stats page on mobile */
    .stats-container {
        grid-template-columns: 1fr;
        /* Stack vertically */
    }
}

/* IN-GAME WATERMARK */
#ingame-watermark {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(10, 147, 150, 0.4);
    pointer-events: none;
    z-index: 100;
    opacity: 0.8;
}

.watermark-part {
    color: #0A9396
}