/* Design System & Custom Properties */
:root {
    --bg-dark: #07080e;
    --bg-darker: #030407;
    --neon-cyan: #00ffff;
    --neon-pink: #ff007c;
    --neon-purple: #bd00ff;
    --text-light: #f0f3f8;
    --text-muted: #8a94a6;
    
    --font-display: 'Orbitron', sans-serif;
    --font-sans: 'Rajdhani', sans-serif;
    
    --glow-cyan: 0 0 10px rgba(0, 255, 255, 0.5), 0 0 20px rgba(0, 255, 255, 0.2);
    --glow-pink: 0 0 10px rgba(255, 0, 124, 0.5), 0 0 20px rgba(255, 0, 124, 0.2);
    --glow-purple: 0 0 10px rgba(189, 0, 255, 0.5), 0 0 20px rgba(189, 0, 255, 0.2);
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-light);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}



/* Main Container Layout */
.game-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1300px;
    height: 100%;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    padding: 3rem;
    pointer-events: none; /* Let canvas capture bg clicks, enable on elements */
}

/* Left Side: Logo & Menu */
.menu-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding-left: 2rem;
    pointer-events: auto;
}

.logo-container {
    margin-bottom: 4rem;
}

/* Rating Badge styling */
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 20px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-light);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: var(--transition-smooth);
    cursor: pointer;
}

.rating-badge:hover {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.15);
}

.rating-badge .stars {
    color: #ffd700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.4);
    font-size: 1.05rem;
}

.rating-badge .rating-val {
    font-weight: 700;
    color: #ffd700;
}

.rating-badge .rating-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}


.game-title {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
    animation: titlePulse 4s ease-in-out infinite alternate;
}

.game-subtitle {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 12px;
    margin-top: 0.5rem;
    color: var(--neon-pink);
    text-shadow: var(--glow-pink);
    padding-left: 4px;
}

/* Menu Navigation Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 240px;
    margin-bottom: 5rem;
}

.menu-btn {
    position: relative;
    background: #111;
    border: 4px solid #000;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    font-family: 'Lilita One', var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 2px;
    padding: 0.8rem 2rem;
    text-align: center;
    box-shadow: 6px 6px 0px #000;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.2s ease;
}

/* Play button */
.btn-play {
    background: #00ffcc;
    color: #000;
}
.btn-play:hover {
    background: #33ffdd;
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0px #000;
}
.btn-play:active {
    transform: translate(6px, 6px);
    box-shadow: 0px 0px 0px #000;
}

/* Settings button */
.btn-settings {
    background: #bd00ff;
    color: #fff;
}
.btn-settings:hover {
    background: #d45dff;
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0px #000;
}
.btn-settings:active {
    transform: translate(6px, 6px);
    box-shadow: 0px 0px 0px #000;
}

/* Quit button */
.btn-quit {
    background: #ff007c;
    color: #fff;
}
.btn-quit:hover {
    background: #ff479e;
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0px #000;
}
.btn-quit:active {
    transform: translate(6px, 6px);
    box-shadow: 0px 0px 0px #000;
}

.game-footer {
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* Right Side: Character Area */
.character-section {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
}

.character-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 450px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: charFloat 5s ease-in-out infinite alternate;
    overflow: visible;
}

.character-glow {
    position: absolute;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(189, 0, 255, 0.12) 0%, rgba(255, 0, 124, 0.05) 50%, transparent 70%);
    z-index: 1;
    border-radius: 50%;
    animation: glowPulse 4s ease-in-out infinite alternate;
}

.shadow-character {
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.8));
    overflow: visible;
}

/* Character SVGs details animations */
.sword-group {
}

.blade-glow {
    animation: bladePulse 2s ease-in-out infinite alternate;
}

.eye {
    animation: eyeBlink 8s infinite alternate;
}

/* Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 4, 7, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto !important;
}

.modal-overlay.active .modal-content,
.modal-overlay.active .menu-btn,
.modal-overlay.active .modal-close-btn {
    pointer-events: auto !important;
}

.modal-content {
    background: rgba(12, 13, 20, 0.9);
    border: 1px solid rgba(189, 0, 255, 0.3);
    box-shadow: 0 0 30px rgba(189, 0, 255, 0.15);
    border-radius: 8px;
    width: 450px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 4px;
    color: var(--text-light);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1rem;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-row label {
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

/* Range Slider styling */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--neon-purple);
    box-shadow: var(--glow-purple);
    cursor: pointer;
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-light);
    width: 40px;
    text-align: right;
}

/* Toggle Switch styling */
.toggle-wrapper {
    position: relative;
    width: 50px;
    height: 24px;
}

.toggle-wrapper input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 34px;
    transition: .4s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: var(--text-light);
    border-radius: 50%;
    transition: .4s;
}

.toggle-wrapper input:checked + .toggle-slider {
    background-color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.4);
}

.toggle-wrapper input:checked + .toggle-slider:before {
    transform: translateX(26px);
    background-color: #ffffff;
}

/* Keybinds display */
.controls-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.5rem;
}

.controls-row h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: var(--text-light);
}

.control-keybinds {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.keybind {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.key {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--neon-cyan);
}

.modal-close-btn {
    background: transparent;
    border: 1px solid var(--neon-purple);
    border-radius: 4px;
    color: var(--neon-purple);
    padding: 0.8rem;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    background: var(--neon-purple);
    color: #ffffff;
    box-shadow: var(--glow-purple);
}

/* Screen Transition Overlay */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-darker);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.transition-overlay.fade-in {
    opacity: 1;
    pointer-events: auto;
}

/* Animations */
@keyframes titlePulse {
    0% {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }
    100% {
        text-shadow: 0 0 20px rgba(165, 180, 252, 0.3), 0 0 40px rgba(189, 0, 255, 0.1);
    }
}

@keyframes charFloat {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-15px) rotate(1deg);
    }
}

@keyframes swordFloat {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-8px) rotate(-3deg);
    }
}

@keyframes bladePulse {
    0% {
        filter: drop-shadow(0 0 5px rgba(255, 0, 124, 0.5)) blur(0.5px);
        opacity: 0.85;
    }
    100% {
        filter: drop-shadow(0 0 18px rgba(0, 255, 255, 0.95)) blur(0px);
        opacity: 1;
    }
}

@keyframes glowPulse {
    0% {
        opacity: 0.8;
        transform: scale(0.95);
    }
    100% {
        opacity: 1.2;
        transform: scale(1.05);
    }
}

@keyframes eyeBlink {
    0%, 95%, 100% {
        transform: scaleY(1);
    }
    97% {
        transform: scaleY(0);
    }
}


/* Button Slashed Hit Effects */
.menu-btn.slashed {
    animation: btnHitShake 0.25s ease-out !important;
}

.menu-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -10%;
    width: 120%;
    height: 4px;
    background: #00ffff;
    box-shadow: 0 0 12px #00ffff, 0 0 20px #ff007c;
    transform: translateY(-50%) rotate(-10deg) scaleX(0);
    transform-origin: left;
    transition: transform 0.15s cubic-bezier(0.1, 0.8, 0.3, 1);
    pointer-events: none;
    z-index: 10;
}

.menu-btn.slashed::after {
    transform: translateY(-50%) rotate(-10deg) scaleX(1);
}

@keyframes btnHitShake {
    0% { transform: translate(0, 0) scale(1); }
    15% { transform: translate(-10px, 4px) rotate(-3deg); }
    30% { transform: translate(15px, -6px) rotate(4deg); }
    50% { transform: translate(-8px, 2px) rotate(-2deg); }
    70% { transform: translate(6px, -2px) rotate(1deg); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Background Scenery */
.background-scenery {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

/* Cartoon Moon */
.bg-moon {
    position: absolute;
    top: 5%;
    right: 8%;
    width: 220px;
    height: 220px;
    filter: drop-shadow(0 0 25px rgba(255, 245, 157, 0.3));
    animation: moonFloat 8s ease-in-out infinite alternate;
}

@keyframes moonFloat {
    0% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 20px rgba(255, 245, 157, 0.25));
    }
    100% {
        transform: translateY(-8px) scale(1.03);
        filter: drop-shadow(0 0 35px rgba(255, 245, 157, 0.45));
    }
}

/* Clouds and Drift Animations */
.bg-clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
}

.bg-cloud {
    position: absolute;
    width: 200px;
    height: 100px;
    opacity: 0.7;
}

.cloud-1 {
    top: 10%;
    left: -220px;
    animation: drift 65s linear infinite;
    animation-delay: -10s;
}

.cloud-2 {
    top: 25%;
    left: -220px;
    width: 160px;
    height: 80px;
    animation: drift 85s linear infinite;
    animation-delay: -40s;
    opacity: 0.55;
}

.cloud-3 {
    top: 5%;
    left: -220px;
    width: 230px;
    height: 115px;
    animation: drift 110s linear infinite;
    animation-delay: -75s;
    opacity: 0.4;
}

@keyframes drift {
    0% {
        transform: translateX(-220px) translateY(0);
    }
    25% {
        transform: translateX(calc(25vw)) translateY(12px);
    }
    50% {
        transform: translateX(calc(50vw)) translateY(-8px);
    }
    75% {
        transform: translateX(calc(75vw)) translateY(10px);
    }
    100% {
        transform: translateX(calc(100vw + 220px)) translateY(0);
    }
}

/* Tree Silhouettes at Bottom */
.bg-trees {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 280px;
}

.tree-line {
    position: absolute;
    bottom: -2px; /* overlap screen bottom slightly to avoid lines */
    left: 0;
    width: 100%;
}

.tree-line-back {
    height: 240px;
    opacity: 0.85;
    transform-origin: bottom center;
    animation: swayBack 7s ease-in-out infinite alternate;
}

.tree-line-front {
    height: 180px;
    z-index: 2;
    transform-origin: bottom center;
    animation: swayFront 5s ease-in-out infinite alternate;
}

@keyframes swayFront {
    0% { transform: skewX(-1.5deg) scaleY(1); }
    100% { transform: skewX(1.5deg) scaleY(0.98); }
}

@keyframes swayBack {
    0% { transform: skewX(-0.8deg) scaleY(1); }
    100% { transform: skewX(0.8deg) scaleY(0.99); }
}

/* Twinkling Background Stars */
.bg-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 55vh;
    pointer-events: none;
    z-index: 1;
}

.bg-star {
    position: absolute;
    width: 14px;
    height: 14px;
    animation: twinkle 3s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}

.star-1 { top: 12%; left: 15%; animation-delay: 0s; width: 16px; height: 16px; }
.star-2 { top: 22%; left: 45%; animation-delay: 0.8s; width: 12px; height: 12px; }
.star-3 { top: 8%; left: 75%; animation-delay: 1.5s; width: 18px; height: 18px; }
.star-4 { top: 35%; left: 28%; animation-delay: 2.2s; width: 10px; height: 10px; }
.star-5 { top: 28%; left: 88%; animation-delay: 0.4s; width: 14px; height: 14px; }

@keyframes twinkle {
    0% {
        transform: scale(0.5) rotate(0deg);
        opacity: 0.2;
    }
    100% {
        transform: scale(1.1) rotate(15deg);
        opacity: 0.95;
    }
}

/* Top Status Bar (Wallet & Spin Icon Group) */
.top-bar {
    position: absolute;
    top: 2rem;
    left: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    pointer-events: auto; /* Allow clicks on children */
}

/* Coin Panel (Wallet) */
.coin-panel {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #ffb700;
    border: 4px solid #000;
    padding: 0.4rem 1rem;
    border-radius: 12px;
    font-family: 'Lilita One', sans-serif;
    font-size: 1.4rem;
    color: #000;
    box-shadow: 4px 4px 0 #000;
    user-select: none;
    transition: transform 0.1s ease;
}

.coin-panel.pulse {
    animation: coinPulse 0.45s ease-out;
}

@keyframes coinPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.22); background: #ffea00; }
    100% { transform: scale(1); }
}

.coin-panel:hover {
    transform: scale(1.05);
}

.coin-icon {
    filter: drop-shadow(1px 1px 0 #000);
}

/* Spin Icon Button (Round) */
.spin-icon-btn {
    width: 52px;
    height: 52px;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #ffb700 !important;
    border: 4px solid #000 !important;
    box-shadow: 4px 4px 0 #000 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    animation: spinBtnFloat 4s ease-in-out infinite alternate;
}

@keyframes spinBtnFloat {
    0% { margin-top: 0px; }
    100% { margin-top: -6px; }
}

.spin-icon-btn:hover {
    transform: scale(1.1) !important;
}

.spin-icon-btn:active {
    transform: translate(3px, 3px) scale(1.02) !important;
    box-shadow: 1px 1px 0 #000 !important;
}

.spin-icon-btn:hover .spin-icon-inner svg {
    animation: iconSpin 3.5s linear infinite;
}

.spin-cooldown-text {
    font-family: 'Lilita One', sans-serif;
    font-size: 1rem;
    color: #8a94a6;
    user-select: none;
}

.spin-icon-btn.disabled-cooldown {
    background: #2a2e45 !important;
    border-color: #000 !important;
    box-shadow: 4px 4px 0 #131520 !important;
    cursor: not-allowed !important;
}

.spin-icon-btn.disabled-cooldown:hover {
    transform: none !important;
}

@keyframes iconSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Spinner Modal */
.spin-modal-content {
    background: linear-gradient(135deg, #18002a 0%, #0d0016 100%) !important;
    border: 6px solid #ffb700 !important;
    box-shadow: 0 0 30px rgba(255, 183, 0, 0.3), inset 0 0 15px rgba(255, 183, 0, 0.2) !important;
    max-width: 450px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem !important;
}

/* Wheel Container */
.wheel-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel-pointer {
    position: absolute;
    top: -22px;
    z-index: 10;
    font-size: 2.2rem;
    color: #ffd700;
    filter: drop-shadow(0px 3px 0px #000) drop-shadow(0 0 8px #ff007c);
    animation: pointerWiggle 1s ease-in-out infinite alternate;
}

@keyframes pointerWiggle {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

.wheel-outer-border {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid #000;
    background: #ffb700;
    padding: 6px;
    box-shadow: 0 10px 0px #000, 0 0 25px rgba(255, 0, 124, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #000;
    overflow: hidden;
    background-color: #000;
    transition: transform 4s cubic-bezier(0.1, 0.8, 0.1, 1);
}

.spin-feedback-text {
    font-family: 'Lilita One', sans-serif;
    font-size: 1.25rem;
    color: #ffd700;
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0px #000;
    min-height: 1.8rem;
}

.spin-btn {
    background-color: #ffb700 !important;
    color: #000 !important;
    border: 4px solid #000 !important;
    box-shadow: 4px 4px 0px #000 !important;
    width: 100%;
    margin-bottom: 1rem;
}

.spin-btn:hover {
    background-color: #ffd700 !important;
}

.spin-btn:active {
    transform: translate(4px, 4px) !important;
    box-shadow: 0px 0px 0px #000 !important;
}

.menu-btn.disabled-cooldown {
    background-color: #3b4266 !important;
    color: #8a94a6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: 4px 4px 0px #1a1c2e !important;
    transform: none !important;
}

/* Drifting Cartoon Wind / Breeze Lines */
.bg-wind-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
    z-index: 2; /* float above clouds and stars */
}

.wind-line {
    position: absolute;
    opacity: 0;
}

.wind-1 {
    top: 25%;
    left: -350px;
    width: 320px;
    height: 50px;
    animation: windBlowClose 14s linear infinite;
    z-index: 3; /* closer layer */
}

.wind-2 {
    top: 50%;
    left: -250px;
    width: 200px;
    height: 32px;
    animation: windBlowFar 26s linear infinite;
    animation-delay: -7s;
    z-index: 1; /* distanced layer behind */
}

@keyframes windBlowClose {
    0% {
        transform: translateX(-350px) translateY(0) scale(1);
        opacity: 0;
    }
    12% {
        opacity: 0.65;
    }
    82% {
        opacity: 0.65;
    }
    100% {
        transform: translateX(calc(100vw + 350px)) translateY(-60px) scale(0.8);
        opacity: 0;
    }
}

@keyframes windBlowFar {
    0% {
        transform: translateX(-250px) translateY(0) scale(0.6);
        opacity: 0;
    }
    18% {
        opacity: 0.35;
    }
    85% {
        opacity: 0.35;
    }
    100% {
        transform: translateX(calc(100vw + 250px)) translateY(-25px) scale(0.5);
        opacity: 0;
    }
}

/* Levels Page Layout & Grid */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.2rem;
    margin-top: 1.5rem;
    max-width: 480px;
    width: 100%;
}

.level-btn {
    width: 72px;
    height: 72px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Lilita One', sans-serif;
    color: #fff !important;
    background: rgba(14, 15, 30, 0.65) !important;
    backdrop-filter: blur(8px);
    border: 4px solid #000 !important;
    border-radius: 18px !important;
    cursor: pointer;
    padding: 4px 0 0 0 !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease !important;
}

.level-num {
    font-size: 2rem;
    line-height: 1;
}

.level-stars {
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-top: -2px;
}

.level-btn.locked {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    border-color: #444550 !important;
    box-shadow: 4px 4px 0 #000 !important;
    text-shadow: none !important;
}

.level-btn.locked .level-num {
    color: #888895 !important;
}

.level-btn.locked .level-stars {
    font-size: 1rem;
    margin-top: 1px;
}

/* Coming Soon Countdown Timer */
.coming-soon-timer {
    margin-top: 12px;
    padding: 10px 18px;
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(255, 200, 0, 0.5);
    border-radius: 10px;
    color: #ffdd00;
    font-family: 'Orbitron', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 200, 0, 0.7);
    box-shadow: 0 0 18px rgba(255, 200, 0, 0.15), inset 0 0 10px rgba(255, 200, 0, 0.05);
    animation: timerPulse 2s ease-in-out infinite;
    min-height: 20px;
}

.coming-soon-timer:empty {
    display: none;
}

@keyframes timerPulse {
    0%, 100% { box-shadow: 0 0 18px rgba(255, 200, 0, 0.15), inset 0 0 10px rgba(255, 200, 0, 0.05); }
    50% { box-shadow: 0 0 28px rgba(255, 200, 0, 0.35), inset 0 0 14px rgba(255, 200, 0, 0.12); }
}

.level-btn:hover {
    transform: scale(1.1) !important;
}

/* Glassmorphic Toon Ghost Styling for individual levels */
.level-btn:nth-child(1) {
    border-color: #00f0ff !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(0, 240, 255, 0.4) !important;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
}
.level-btn:nth-child(1):hover {
    background: rgba(0, 240, 255, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(0, 240, 255, 0.7) !important;
}

.level-btn:nth-child(2) {
    border-color: #ff007c !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(ff, 0, 124, 0.4) !important;
    text-shadow: 0 0 8px rgba(255, 0, 124, 0.8);
}
.level-btn:nth-child(2):hover {
    background: rgba(255, 0, 124, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(255, 0, 124, 0.7) !important;
}

.level-btn:nth-child(3) {
    border-color: #ffd700 !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(255, 215, 0, 0.4) !important;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
}
.level-btn:nth-child(3):hover {
    background: rgba(255, 215, 0, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(255, 215, 0, 0.7) !important;
}

.level-btn:nth-child(4) {
    border-color: #39ff14 !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(57, 255, 20, 0.4) !important;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
}
.level-btn:nth-child(4):hover {
    background: rgba(57, 255, 20, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(57, 255, 20, 0.7) !important;
}

.level-btn:nth-child(5) {
    border-color: #bd00ff !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(189, 0, 255, 0.4) !important;
    text-shadow: 0 0 8px rgba(189, 0, 255, 0.8);
}
.level-btn:nth-child(5):hover {
    background: rgba(189, 0, 255, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(189, 0, 255, 0.7) !important;
}

.level-btn:nth-child(6) {
    border-color: #00f0ff !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(0, 240, 255, 0.4) !important;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
}
.level-btn:nth-child(6):hover {
    background: rgba(0, 240, 255, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(0, 240, 255, 0.7) !important;
}

.level-btn:nth-child(7) {
    border-color: #ff007c !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(255, 0, 124, 0.4) !important;
    text-shadow: 0 0 8px rgba(255, 0, 124, 0.8);
}
.level-btn:nth-child(7):hover {
    background: rgba(255, 0, 124, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(255, 0, 124, 0.7) !important;
}

.level-btn:nth-child(8) {
    border-color: #ffd700 !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(255, 215, 0, 0.4) !important;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
}
.level-btn:nth-child(8):hover {
    background: rgba(255, 215, 0, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(255, 215, 0, 0.7) !important;
}

.level-btn:nth-child(9) {
    border-color: #39ff14 !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(57, 255, 20, 0.4) !important;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
}
.level-btn:nth-child(9):hover {
    background: rgba(57, 255, 20, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(57, 255, 20, 0.7) !important;
}

.level-btn:nth-child(10) {
    border-color: #bd00ff !important;
    box-shadow: 4px 4px 0 #000, 0 0 12px rgba(189, 0, 255, 0.4) !important;
    text-shadow: 0 0 8px rgba(189, 0, 255, 0.8);
}
.level-btn:nth-child(10):hover {
    background: rgba(189, 0, 255, 0.25) !important;
    box-shadow: 4px 4px 0 #000, 0 0 20px rgba(189, 0, 255, 0.7) !important;
}

/* Top Bar Back Button */
.back-btn {
    background-color: #ff4b5c !important;
    color: #fff !important;
    border: 4px solid #000 !important;
    box-shadow: 4px 4px 0 #000 !important;
    border-radius: 12px !important;
    font-family: 'Lilita One', sans-serif;
    font-size: 1.2rem;
    padding: 0.5rem 1.2rem !important;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease !important;
    height: auto !important;
    width: auto !important;
}

.back-btn:hover {
    transform: scale(1.06) !important;
}

.back-btn:active {
    transform: translate(3px, 3px) scale(1.02) !important;
    box-shadow: 1px 1px 0 #000 !important;
}

/* Battle Mode Styles */
.battle-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;
    z-index: 5;
}

.hud-bar {
    width: 800px;
    max-width: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    z-index: 10;
}

.hud-progress-container, .hud-health-container {
    background: rgba(14, 15, 30, 0.7);
    border: 3px solid #000;
    border-radius: 10px;
    padding: 0.4rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 3px 3px 0 #000;
    user-select: none;
}

.hud-progress-container {
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-start;
    width: 250px;
}

.hud-progress-label {
    font-family: 'Lilita One', sans-serif;
    font-size: 0.8rem;
    color: #888895;
    letter-spacing: 0.5px;
}

.hud-progress-bg, .hud-health-bg {
    width: 100%;
    height: 12px;
    background: #11111d;
    border: 2px solid #000;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.hud-progress-fill {
    height: 100%;
    background: #00f0ff;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px #00f0ff;
}

.hud-health-container {
    width: 200px;
}

.hud-health-bg {
    height: 16px;
}

.hud-health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4b5c, #ff1a30);
    width: 100%;
    transition: width 0.2s ease;
    box-shadow: 0 0 10px #ff4b5c;
}

.canvas-wrapper {
    position: relative;
    width: 800px;
    height: 500px;
    border: 6px solid #000;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6), 8px 8px 0 #000;
    background: rgba(14, 15, 30, 0.4);
    backdrop-filter: blur(4px);
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* Floating Combo indicator */
.combo-overlay {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-family: 'Lilita One', sans-serif;
    font-size: 1.8rem;
    color: #ff007c;
    text-shadow: 3px 3px 0 #000, 0 0 10px rgba(255, 0, 124, 0.5);
    animation: comboPulse 0.4s ease infinite alternate;
}

#combo-num {
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 3px 3px 0 #000;
}

@keyframes comboPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* Combat Guide */
.combat-guide {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    pointer-events: none;
    user-select: none;
}

/* Victory Stars display */
.victory-stars {
    font-family: 'Lilita One', sans-serif;
    font-size: 3.5rem;
    color: #ffd700;
    text-shadow: 4px 4px 0 #000, 0 0 15px rgba(255, 215, 0, 0.4);
    letter-spacing: 0.8rem;
    margin: 1rem 0;
    user-select: none;
}

/* Premium Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #030407; /* Sleek black/dark color matching --bg-darker */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Ensure it is above everything else */
    opacity: 1;
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 24px;
}

.loading-logo {
    max-width: 280px;
    height: auto;
    animation: logoPulse 2s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 15px rgba(189, 0, 255, 0.4)); /* Premium glow */
}

/* Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    border-top-color: var(--neon-cyan, #00ffff);
    border-bottom-color: var(--neon-pink, #ff007c);
    animation: loadingSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.loading-text {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-light, #f0f3f8);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    animation: textPulse 1.5s ease-in-out infinite alternate;
}

@keyframes logoPulse {
    0% {
        transform: scale(0.96);
        filter: drop-shadow(0 0 10px rgba(189, 0, 255, 0.3));
    }
    100% {
        transform: scale(1.04);
        filter: drop-shadow(0 0 25px rgba(189, 0, 255, 0.6)) drop-shadow(0 0 10px rgba(0, 255, 255, 0.4));
    }
}

@keyframes loadingSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes textPulse {
    0% {
        opacity: 0.6;
        text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 15px rgba(0, 255, 255, 0.8), 0 0 5px rgba(255, 0, 124, 0.5);
    }
}

/* â”€â”€ Game Footer â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.game-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 0;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}
.footer-link:hover {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

.footer-sep {
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.9rem;
    user-select: none;
}

.footer-copy {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.18);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* â”€â”€ Terms & Conditions Modal â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.terms-modal-content {
    max-width: 560px !important;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    gap: 0 !important;
    padding: 2rem 2rem 1.5rem !important;
}

.terms-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.25rem 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.25) transparent;
    margin-bottom: 1.2rem;
}
.terms-body::-webkit-scrollbar {
    width: 4px;
}
.terms-body::-webkit-scrollbar-track {
    background: transparent;
}
.terms-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.25);
    border-radius: 4px;
}
.terms-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.45);
}

.terms-date {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 1.4rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.terms-body h3 {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    text-transform: uppercase;
    margin: 1.3rem 0 0.4rem;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}
.terms-body h3:first-of-type {
    margin-top: 0;
}

.terms-body p {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.7;
    color: rgba(240, 243, 248, 0.75);
    letter-spacing: 0.3px;
}

.terms-body strong {
    color: var(--text-light);
    font-weight: 700;
}

.terms-highlight {
    color: var(--neon-pink);
    text-shadow: 0 0 6px rgba(255, 0, 124, 0.4);
    font-weight: 700;
}
/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   RESPONSIVE â€” All Pages
   Breakpoints: 600px (phone), 768px (large phone/small tablet), 900px (tablet)
â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Tablet: â‰¤ 900px â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 900px) {

    /* â”€â”€ MAIN MENU â”€â”€ */
    body { overflow-y: auto; }

    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 0;
        padding: 6rem 2rem 2rem;
        height: auto;
        min-height: 100vh;
        align-items: start;
    }

    .menu-section {
        padding-left: 0;
        align-items: center;
        text-align: center;
        order: 2;
    }

    .logo-container { margin-bottom: 2rem; }

    .game-title { font-size: 3.5rem; }

    .game-subtitle {
        font-size: 1.2rem;
        letter-spacing: 8px;
    }

    .menu-buttons {
        width: 100%;
        max-width: 240px;
        margin-bottom: 2rem;
        gap: 1.2rem;
    }

    .character-section {
        order: 1;
        justify-content: center;
        height: 260px;
        margin-top: 1rem;
    }

    .character-wrapper {
        max-width: 240px;
        height: 240px;
    }

    .character-glow {
        width: 220px;
        height: 220px;
    }

    /* â”€â”€ TOP BAR â”€â”€ */
    .top-bar {
        top: 1rem;
        left: 1rem;
        gap: 0.7rem;
    }
    .top-bar:has(.coin-panel),
    .top-bar:has(#btn-back) {
        top: auto;
        left: auto;
        bottom: 1.5rem;
        right: 1.5rem;
        z-index: 99;
    }

    .coin-panel {
        font-size: 1.1rem;
        padding: 0.3rem 0.7rem;
    }

    .spin-icon-btn {
        width: 44px !important;
        height: 44px !important;
    }

    /* â”€â”€ MODALS â”€â”€ */
    .modal-content {
        width: calc(100vw - 2rem);
        max-width: 440px;
        padding: 1.5rem;
        gap: 1.4rem;
    }

    .modal-title { font-size: 1.5rem; letter-spacing: 3px; }

    .spin-modal-content {
        width: calc(100vw - 2rem) !important;
        max-width: 400px !important;
        padding: 1.5rem !important;
    }

    .wheel-container {
        width: 230px;
        height: 230px;
        margin: 1rem 0;
    }

    .terms-modal-content {
        width: calc(100vw - 2rem) !important;
        max-height: 88vh;
        padding: 1.5rem 1.2rem 1.2rem !important;
    }

    /* â”€â”€ LEVELS PAGE â”€â”€ */
    .levels-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.9rem;
        max-width: 340px;
    }

    .level-btn {
        width: 64px !important;
        height: 64px !important;
    }

    .level-num { font-size: 1.7rem; }

    /* â”€â”€ BATTLE PAGES â”€â”€ */
    .battle-container { padding: 0.8rem; }

    .hud-bar {
        width: 100%;
        max-width: 100%;
        margin-bottom: 0.6rem;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .hud-progress-container { width: 180px; }
    .hud-health-container { width: 160px; }

    .canvas-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 8 / 5;
        border-width: 4px;
        border-radius: 12px;
    }

    .combat-guide { display: none; }
}

/* â”€â”€ Large Phone / Small Tablet: â‰¤ 768px â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 768px) {

    /* â”€â”€ MAIN MENU â”€â”€ */
    .game-container { padding: 5rem 1.2rem 1.5rem; }

    .game-title { font-size: 3rem; }

    .menu-btn {
        font-size: 1.3rem;
        padding: 0.7rem 1.5rem;
    }

    .character-section { height: 200px; }

    .character-wrapper {
        max-width: 190px;
        height: 190px;
    }

    /* â”€â”€ LEVELS PAGE â”€â”€ */
    .levels-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.8rem;
        max-width: 300px;
    }

    .level-btn {
        width: 56px !important;
        height: 56px !important;
        border-width: 3px !important;
        border-radius: 14px !important;
    }

    .level-num { font-size: 1.5rem; }
    .level-stars { font-size: 0.62rem; }

    /* â”€â”€ GAME HUD â”€â”€ */
    .hud-progress-container { width: 150px; }
    .hud-health-container { width: 130px; }

    .hud-progress-label { font-size: 0.68rem; }

    /* â”€â”€ MODAL â”€â”€ */
    .modal-title { font-size: 1.3rem; }

    .setting-row label { font-size: 0.85rem; letter-spacing: 1px; }

    .back-btn {
        font-size: 1rem !important;
        padding: 0.4rem 0.9rem !important;
    }
}

/* â”€â”€ Phone: â‰¤ 600px â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 600px) {

    /* â”€â”€ MAIN MENU â”€â”€ */
    .game-container { padding: 4.5rem 1rem 1.2rem; }

    .game-title { font-size: 2.4rem; letter-spacing: 1px; }

    .game-subtitle { font-size: 0.9rem; letter-spacing: 5px; }

    .logo-container { margin-bottom: 1.2rem; }

    .menu-buttons {
        gap: 1rem;
        max-width: 220px;
        margin-bottom: 1.5rem;
    }

    .menu-btn {
        font-size: 1.15rem;
        padding: 0.65rem 1rem;
        border-width: 3px;
        border-radius: 10px;
        box-shadow: 4px 4px 0 #000;
    }

    .character-section { height: 160px; }

    .character-wrapper {
        max-width: 150px;
        height: 150px;
    }

    .character-glow {
        width: 140px;
        height: 140px;
    }

    /* â”€â”€ TOP BAR â”€â”€ */
    .coin-panel {
        font-size: 1rem;
        padding: 0.25rem 0.55rem;
        border-width: 3px;
        box-shadow: 3px 3px 0 #000;
    }

    .spin-icon-btn {
        width: 38px !important;
        height: 38px !important;
        border-width: 3px !important;
        box-shadow: 3px 3px 0 #000 !important;
    }

    /* â”€â”€ MODALS â”€â”€ */
    .modal-content {
        width: calc(100vw - 1.2rem);
        padding: 1.2rem;
        gap: 1rem;
        border-radius: 6px;
    }

    .modal-title { font-size: 1.1rem; letter-spacing: 2px; }

    .modal-close-btn {
        padding: 0.65rem;
        font-size: 0.8rem;
        letter-spacing: 1.5px;
    }

    .spin-modal-content {
        padding: 1.2rem !important;
    }

    .wheel-container {
        width: 190px;
        height: 190px;
        margin: 0.6rem 0;
    }

    .spin-feedback-text { font-size: 1rem; }

    .terms-modal-content {
        padding: 1.2rem 1rem 1rem !important;
        max-height: 90vh;
    }

    .terms-body h3 { font-size: 0.65rem; }
    .terms-body p  { font-size: 0.88rem; }

    /* â”€â”€ FOOTER â”€â”€ */
    .game-footer { gap: 7px; margin-top: 12px; }
    .footer-link { font-size: 0.7rem; }
    .footer-copy { font-size: 0.65rem; }

    /* â”€â”€ LEVELS PAGE â”€â”€ */
    .levels-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.7rem;
        max-width: 230px;
    }

    .level-btn {
        width: 58px !important;
        height: 58px !important;
    }

    /* â”€â”€ BATTLE PAGES â”€â”€ */
    .battle-container { padding: 0.5rem; }

    .hud-bar {
        margin-bottom: 0.4rem;
        gap: 0.3rem;
    }

    .hud-progress-container {
        width: 130px;
        padding: 0.3rem 0.5rem;
    }

    .hud-health-container {
        width: 110px;
        padding: 0.3rem 0.5rem;
    }

    .hud-progress-label { font-size: 0.6rem; }

    .hud-progress-bg, .hud-health-bg { height: 9px; }

    .canvas-wrapper {
        border-width: 3px;
        border-radius: 10px;
    }

    /* Victory / Defeat modals */
    .victory-stars { font-size: 2.5rem; letter-spacing: 0.5rem; }
}

/* â”€â”€ Small phones: â‰¤ 380px â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 380px) {
    .game-title { font-size: 2rem; }

    .menu-btn { font-size: 1rem; padding: 0.6rem 0.8rem; }

    .menu-buttons { max-width: 200px; }

    .character-section { height: 130px; }

    .character-wrapper { max-width: 120px; height: 120px; }

    .levels-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 200px;
        gap: 0.5rem;
    }

    .level-btn {
        width: 50px !important;
        height: 50px !important;
    }

    .level-num { font-size: 1.3rem; }
}

/* â”€â”€ Landscape phones (short height) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (orientation: landscape) and (max-width: 1280px) {
    body { overflow-y: auto; }

    .game-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr;
        padding: 3.5rem 1rem 1rem;
        min-height: 100vh;
        height: auto;
        gap: 1rem;
    }

    .menu-section {
        order: 1;
        align-items: flex-start;
        text-align: left;
    }

    .character-section {
        order: 2;
        height: auto;
    }

    .character-wrapper {
        max-width: 200px;
        height: 200px;
    }

    .logo-container { margin-bottom: 1rem; }

    .game-title { font-size: 2.2rem; }

    .menu-buttons {
        max-width: 220px;
        gap: 0.6rem;
        margin-bottom: 0.8rem;
    }

    .menu-btn {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }

    /* Battle in landscape: make canvas fill available height */
    .battle-container {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0.5rem;
        position: relative;
    }

    .hud-bar {
        position: absolute;
        top: 12px;
        left: 12px;
        right: 12px;
        width: auto;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        z-index: 950;
        margin: 0;
        height: auto;
        pointer-events: none;
    }
    .hud-bar > * {
        pointer-events: auto;
    }

    .hud-progress-container,
    .hud-health-container {
        width: 130px;
    }

    .canvas-wrapper {
        width: auto;
        height: calc(100vh - 1rem);
        max-width: 100%;
        max-height: 100%;
        aspect-ratio: 8 / 5;
    }
}

/* ── Mobile Responsive Modals (Landscape & Small Heights/Widths) ── */
@media (max-height: 520px) {
    .modal-content {
        padding: 0.8rem 1.2rem !important;
        gap: 0.6rem !important;
        max-height: 95vh !important;
        width: 90% !important;
        max-width: 360px !important;
        overflow-y: auto !important;
    }
    .modal-title {
        font-size: 1.3rem !important;
        padding-bottom: 0.3rem !important;
        margin: 0 !important;
    }
    .victory-stars {
        font-size: 2rem !important;
        margin: 0.2rem 0 !important;
        letter-spacing: 0.4rem !important;
    }
    #victory-feedback,
    #defeat-modal p {
        font-size: 1rem !important;
        margin: 0.2rem 0 !important;
    }
    .modal-content .menu-btn,
    .modal-content .modal-close-btn {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem !important;
        margin-top: 0.2rem !important;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 92% !important;
        max-width: 92% !important;
        padding: 1.2rem !important;
        gap: 1rem !important;
    }
}



/* ── Discord Button ──────────────────────────────────────────────────────────── */
.discord-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 8px;
    border-radius: 6px;
    background: rgba(88, 101, 242, 0.15);
    border: 1px solid rgba(88, 101, 242, 0.45);
    color: #8b9aff;
    font-family: var(--font-display);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    user-select: none;
}

.discord-btn:hover {
    background: rgba(88, 101, 242, 0.35);
    border-color: rgba(88, 101, 242, 0.9);
    color: #c3caff;
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.5);
}

.discord-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}
