
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --neon-orange: #ff8c1a;
    --neon-orange-glow: #ff9d3d;
    --neon-green: #7dff3f;
    --neon-green-glow: #9dff6b;
    --neon-blue: #4dd8ff;
    --neon-purple: #c47dff;
    --panel-bg: rgba(20, 22, 42, 0.55);
    --panel-border: rgba(255, 255, 255, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    color: white;
    position: relative;
    padding: 20px 12px;
    background:
    linear-gradient(rgba(28, 19, 82, 0.10), rgba(28, 19, 82, 0.10)),
    url('bg.png') center center / cover no-repeat;
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, #1b1440 0%, #060613 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease;
}
.spinner {
    width: 56px;
    height: 56px;
    border: 6px solid rgba(255, 140, 26, 0.25);
    border-top-color: var(--neon-orange);
    border-right-color: var(--neon-green);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-bottom: 22px;
    box-shadow: 0 0 25px rgba(255, 140, 26, 0.35);
}
@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}
#preloader h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    text-transform: uppercase;
}

.game-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 760px;
}

.header {
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;    margin-top: 15px;margin-bottom: 20px;
}
.header .badge-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}
.header .badge {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--neon-blue);
    background: rgba(77, 216, 255, 0.1);
    border: 1px solid rgba(77, 216, 255, 0.35);
    padding: 4px 14px;
    border-radius: 20px;
}
.header .level-badge {
    display: inline-block;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--neon-purple);
    background: rgba(196, 125, 255, 0.12);
    border: 1px solid rgba(196, 125, 255, 0.4);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 700;
    animation: levelPulse 2.5s ease-in-out infinite;
    box-shadow: 0 0 14px rgba(196, 125, 255, 0.15);
}
.logo{margin-top: 2 0px;border-radius: 50px;padding: 20px;margin-bottom: 20px;}
@keyframes levelPulse {
    0%,
    100% {
        box-shadow: 0 0 14px rgba(196, 125, 255, 0.15);
    }
    50% {
        box-shadow: 0 0 26px rgba(196, 125, 255, 0.35);
    }
}
.header h1 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: 1px;
    background: linear-gradient(90deg, var(--neon-orange-glow), #ffe08a 45%, var(--neon-green-glow));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 18px rgba(255, 140, 26, 0.35)) drop-shadow(0 0 18px rgba(125, 255, 63, 0.2));
}

.canvas-frame {
    position: relative;
    padding: 0px;
    border-radius: 32px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--panel-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 60px rgba(77, 216, 255, 0.06);
    backdrop-filter: blur(6px);
}

canvas {
    background: transparent;
    touch-action: none;
    max-width: 100%;
    display: block;
    border-radius: 20px;
}

.controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: stretch;
    margin-top: 20px;
    background: var(--panel-bg);
    padding: 10px 20px;
    border-radius: 24px;
    border: 1px solid var(--panel-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.group-label {
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
    margin-bottom: 2px;
}

button {
    border: none;
    color: white;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.spin-btn {
    background: linear-gradient(155deg, #5bc4f0, #2c7fb8);
    padding: 12px 18px;
    border-radius: 14px;
    box-shadow: 0 4px 0 #1f5c85, 0 6px 16px rgba(44, 127, 184, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    min-width: 130px;
}
.spin-btn.right-track {
    background: linear-gradient(155deg, #7de05a, #3d9c2a);
    box-shadow: 0 4px 0 #297019, 0 6px 16px rgba(61, 156, 42, 0.4);
}
.spin-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1f5c85, 0 2px 8px rgba(44, 127, 184, 0.4);
}
.spin-btn.right-track:active {
    box-shadow: 0 1px 0 #297019, 0 2px 8px rgba(61, 156, 42, 0.4);
}

.btn-swap {
    background: linear-gradient(155deg, #ffb04d, #e0670d);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 1.05rem;
    border-radius: 16px;
    padding: 14px 22px;
    box-shadow: 0 4px 0 #a84a05, 0 8px 20px rgba(224, 103, 13, 0.45);
    letter-spacing: 1px;
}
.btn-swap span.icon {
    font-size: 1.4rem;
    line-height: 1;
}
.btn-swap:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #a84a05, 0 3px 10px rgba(224, 103, 13, 0.45);
}

.btn-help {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.3rem;
    font-family: 'Orbitron', sans-serif;
    backdrop-filter: blur(10px);
    z-index: 50;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.btn-help:active {
    transform: scale(0.92);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 4, 16, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
    padding: 20px;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.modal {
    background: linear-gradient(160deg, rgba(38, 32, 74, 0.95), rgba(20, 18, 46, 0.97));
    padding: 34px 30px;
    border-radius: 24px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(77, 216, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transform: scale(0.92);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal {
    transform: scale(1);
}
.modal h2 {
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 16px;
    font-size: 1.5rem;
    background: linear-gradient(90deg, var(--neon-blue), #a985ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.modal p {
    margin-bottom: 14px;
    line-height: 1.6;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.82);
}
.modal p strong {
    color: var(--neon-orange-glow);
}
.modal .btn-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 18px;
}
.modal button {
    padding: 13px 26px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    border: none;
    color: white;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
    letter-spacing: 0.5px;
}
.modal button:active {
    transform: translateY(3px);
}
.btn-next-level {
    background: linear-gradient(155deg, #ffb84d, #e07b0d);
    box-shadow: 0 4px 0 #a84a05, 0 8px 20px rgba(224, 123, 13, 0.5);
    font-size: 1.05rem;
}
.btn-next-level:active {
    box-shadow: 0 1px 0 #a84a05, 0 3px 10px rgba(224, 123, 13, 0.45);
}
.btn-retry {
    background: linear-gradient(155deg, #52e089, #1f9c5a);
    box-shadow: 0 4px 0 #157040, 0 8px 20px rgba(31, 156, 90, 0.4);
}
.btn-retry:active {
    box-shadow: 0 1px 0 #157040, 0 3px 10px rgba(31, 156, 90, 0.4);
}
.btn-start {
    background: linear-gradient(155deg, #52e089, #1f9c5a);
    box-shadow: 0 4px 0 #157040, 0 8px 20px rgba(31, 156, 90, 0.4);
    padding: 13px 30px;
    border-radius: 30px;
    font-size: 1rem;
}
.btn-start:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #157040, 0 3px 10px rgba(31, 156, 90, 0.4);
}

#winModal h2 {
    background: linear-gradient(90deg, #ffd76b, var(--neon-orange-glow), var(--neon-green-glow));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.7rem;
}
#winModal .level-cleared {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--neon-purple);
    margin-bottom: 6px;
    text-transform: uppercase;
}

@media (max-width: 640px) {
    .header h1 {
        font-size: 1.7rem;
    }
    .canvas-frame {
        padding: 10px;
        border-radius: 22px;
    }
    .controls {
        gap: 12px;
        padding: 14px;
    }
    .btn-swap {
        padding: 12px 18px;
    }
    .modal .btn-row {
        flex-direction: column;
        gap: 10px;
    }
    .modal button {
        width: 100%;
    }
}
