body {
    position: relative;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background: #000;
    min-height: 100vh;
    margin: 0;
    display: block;
    align-items: center;
    justify-content: center;
    font-family: 'Share Tech Mono', 'Consolas', monospace;
    cursor: url("./cursor/cursor.png") 0 0, auto;
}

html {
    cursor: url("./cursor/cursor.png");
}

button,
a,
.neon-btn {
    cursor: url("./cursor/select-cursor.png") 6 2, pointer;
}

#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

#gameScreen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 16px;
    box-sizing: border-box;
}

#gameContainer {
    width: 100%;
    max-width: 980px;
    min-width: 320px;
    box-sizing: border-box;
    border: 6px solid #39ff14;
    box-shadow: 0 0 32px rgba(57, 255, 20, 0.9), 0 0 0 18px #000;
    border-radius: 18px;
    background: #00000092;
    margin: 0 auto;
    padding: 50px 0 50px 0;
    text-align: center;
    position: relative;
    min-height: 600px;
    background: radial-gradient(circle at top, rgba(0, 0, 0, 0.87), rgba(0, 0, 0, 0.72));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: transform 0.22s ease-out, box-shadow 0.22s ease-out, border-color 0.22s ease-out;
    z-index: 1;
}

#gameContainer:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 72px #39ff14, 0 0 0 28px #000;
    border-color: #6dff6d;
}

#topBar {
    position: absolute;
    top: 18px;
    left: 22px;
    right: 22px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#difficultyButtons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

#difficultyModal select#roundSelect {
    transform: none !important;
    -webkit-transform: none !important;
    transform-origin: center center;
    position: relative;
    z-index: 5;
    will-change: auto;
    max-width: 120px;
    width: auto;
    box-sizing: border-box;
}

#difficultyModal {
    overflow: hidden;
}

.rounds-row {
    margin: 22px auto 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.rounds-label {
    font-size: 2rem;
    letter-spacing: 0.08rem;
}

.rounds-select {
    background: rgb(0, 0, 0);
    border: 2px solid #39ff14;
    border-radius: 18px;
    padding: 4px 10px;
    color: #39ff14;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.7rem;
    outline: none;
    box-shadow: 0 0 26px rgba(57, 255, 20, 0.6);
    max-width: 90px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: url("./cursor/select-cursor.png") 6 2, pointer;
}

.rounds-select:focus {
    box-shadow: 0 0 26px rgba(57, 255, 20, 0.9);
}

.rounds-select option {
    cursor: url("./cursor/select-cursor.png") 6 2, pointer;
}

#rallyDisplay {
    font-size: 1.1rem;
    letter-spacing: 0.12rem;
}

#bestRallyEver {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-left: 12px;
    min-width: 65px;
}

#topRightControls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.neon-btn.small-icon {
    padding: 10px 16px;
    margin: 0;
    font-size: 1.1rem;
}

#backBtn {
    padding: 10px 24px;
    font-size: 1rem;
    border-radius: 9px;
}

#scoreBoard {
    position: relative;
    margin: 90px auto 10px;
    text-align: center;
    font-size: 2.6rem;
    letter-spacing: 1.55rem;
    color: #39ff14;
    text-shadow: 0 0 25px #39ff14, 0 0 44px #13ff00, 0 0 75px #48ff00;
}

#gameCanvas {
    width: 100%;
    height: 45vw;
    max-width: 860px;
    max-height: 480px;
    min-width: 280px;
    min-height: 170px;
    display: block;
    margin: 0 auto;
    background: #000;
    border-radius: 10px;
    border: 3px solid #39ff14;
    box-shadow: 0 0 14px rgba(57, 255, 20, 0.8),
        0 0 26px rgba(57, 255, 20, 0.5) inset;
}

.neon-text {
    color: #39ff14;
    text-shadow: 0 0 8px #39ff14, 0 0 20px #13ff00;
    transition: text-shadow 0.3s, color 0.2s;
    font-family: 'Share Tech Mono', monospace;
}

.neon-text:hover {
    color: #9fffcb;
    text-shadow: 0 0 19px #39ff14, 0 0 54px #13ff00, 0 0 88px #0f0;
}

.neon-btn {
    margin: 0 14px 0 0;
    padding: 15px 44px;
    background: #111;
    color: #39ff00;
    font-weight: bold;
    font-size: 1.5rem;
    border: 2.5px solid #39ff14;
    border-radius: 12px;
    text-shadow: 0 0 8px #39ff14;
    box-shadow: 0 0 12px rgba(19, 255, 0, 0.7), 0 0 18px rgba(57, 255, 20, 0.55) inset;
    outline: none;
    transition: bacground 0.25s, color 0.25s, box-shadow 0.25s, transform 0.18s;
    font-family: inherit;
    position: relative;
}

.neon-btn:after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    border-radius: 11px;
    box-shadow: 0 0 18px 0 #39ff14, 0 0 32px 0 rgba(19, 255, 0, 0.7) inset;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

.neon-btn:hover:after,
.neon-btn:focus:after {
    opacity: 1;
}

#controls {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 32px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.neon-btn.active {
    background: #39ff14;
    color: #000;
    box-shadow: 0 0 35px #39ff14;
}

.modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 18px;
}

#modalTitle {
    font-size: 3rem;
}

.modal.hidden {
    display: none;
}

#matchSummary {
    font-size: 1rem;
    margin-top: 6px;
}

.modal-content {
    text-align: center;
    transform: scale(0.7);
    opacity: 0;
    animation: modalPop 0.4s ease-out forwards;
    position: relative;
    padding: 26px 40px;
    border-radius: 18px;
    background: radial-gradient(circle at top, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.75));
    border: 3px solid rgba(57, 255, 20, 0.8);
    box-shadow: 0 0 26px rgba(57, 255, 20, 0.9), 0 0 60px rgba(57, 255, 20, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: transform 0.25s ease-out, box-shadow 0.25s ease-out, border-color 0.25s ease-out;
}

.modal-content:hover {
    transform: scale(0.71);
    box-shadow: 0 0 34px rgba(57, 255, 20, 1), 0 0 78px rgba(57, 255, 20, 0.6);
    border-color: #7dff7d;
}

#playfieldWrapper {
    position: relative;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}

#pausedOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 50;
}

#pausedOverlay.hidden {
    display: none;
}

.paused-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.600);
    backdrop-filter: blur(2px);
}

.paused-text {
    position: relative;
    font-size: 3rem;
    letter-spacing: 0.25rem;
    text-transform: uppercase;
}

.score-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    row-gap: 10px;
    column-gap: 18px;
    padding: 18px 20px;
    border-radius: 14px;
    background: radial-gradient(circle at top, #021602 0%, #000 55%);
    box-shadow: 0 0 22px #39ff14, inset 0 0 28px rgba(57, 255, 20, 0.35);
    border: 2px solid rgba(57, 255, 20, 0.7);
}

#gameOverModal .score-grid {
    margin-bottom: 26px;
}

#matchSummary {
    margin-top: 10px;
    margin-bottom: 14px;
}

#gameOverModal .neon-btn.large {
    margin-top: 10px;
}

.score-label {
    font-size: 0.8rem;
    letter-spacing: 0.15rem;
    color: #7dff7d;
    text-align: left;
    text-transform: uppercase;
}

.score-value {
    font-family: "Share Tech Mono", monospace;
    font-size: 1.1rem;
    color: #39ff14;
    text-align: right;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    box-shadow: 0 0 14px rgba(57, 255, 20, 0.6);
}

.small-summary {
    font-size: 0.9rem;
    margin: 4px 0 4px;
}

.tiny-note {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 10px;
}

.badge {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    letter-spacing: 0.12rem;
    background: #39ff14;
    color: #000;
    box-shadow: 0 0 10px #39ff14;
}

.badge.hidden {
    display: none;
}

#controlsHint {
    font-size: 1rem;
    margin-top: 10px;
    opacity: 0.9;
    letter-spacing: 0.1rem;
}

@keyframes modalPop {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.neon-btn.large {
    padding: 20px 40px;
    font-size: 1.2rem;
}

.hidden {
    display: none !important;
}

.rules-line {
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: #bfffbf;
    letter-spacing: 0.06rem;
}

.mode-label {
    margin-top: 10px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.18rem;
    text-transform: uppercase;
    color: #69ff69;
}

.pro-tip-line {
    margin-top: 4px;
    text-align: center;
    font-size: 0.8rem;
    letter-spacing: 0.06rem;
    color: #ffffff;
    opacity: 0.9;
    min-height: 1.6rem;
    white-space: normal;
    word-wrap: break-word;
    max-width: 88%;
    margin-left: auto;
    margin-right: auto;
}

.pro-tip-prefix {
    color: #44cdff;
    font-weight: 700;
    margin-right: 6px;
    font-size: 1.5rem;
}

.pro-tip-cursor {
    display: inline-block;
    margin-left: 2px;
    animation: proTipBlink 0.9s step-end infinite;
}

@keyframes proTipBlink {

    0%,
    50% {
        opacity: 1;
    }

    50.1%,
    100% {
        opacity: 0;
    }
}

.rally-hype {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
}

.rally-hype.hidden {
    display: none;
}

.rally-hype span {
    position: absolute;
    font-family: "Share Tech Mono", monospace;
    font-size: 1.8rem;
    color: #ff4f14;
    text-shadow: 0 0 20px #ff3714, 0 0 40px #ff3714;
    letter-spacing: 0.18rem;
    text-transform: uppercase;
    opacity: 0;
    transform-origin: center;
}

.rally-hype span.rally-pop {
    animation: rallyPop 4.5s ease-out forwards;
}

@keyframes rallyPop {
    0% {
        transform: translateY(12px) scale(0.9);
        opacity: 0;
    }

    10% {
        transform: translateY(0) scale(1.02);
        opacity: 1;
    }

    80% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-6px) scale(0.98);
        opacity: 0;
    }
}

.options-panel {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #39ff14;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 0 24px rgba(57, 255, 20, 0.8);
    backdrop-filter: blur(12px);
    min-width: 220px;
    z-index: 25;
}

.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 0.9rem;
    color: #7dff7d;
}

.option-row:last-child {
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: auto !important;
    position: absolute;
    cursor: pointer;
    z-index: 2;
}

.slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #333;
    border-radius: 24px;
    transition: 0.3s;
    border: 1px solid #39ff14;
    cursor: pointer;
}

.slider:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #39ff14;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 0 8px #39ff14;
}

input:checked+.slider {
    background: rgba(57, 255, 20, 0.3);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

#optionsPanel input[type="range"] {
    width: 70px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#optionsPanel input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #39ff14;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px #39ff14;
}

@media (max-width: 600px) {
    #topBar {
        top: 10px;
        right: 8px;
    }

    #backBtn {
        padding: 8px 10vw;
        font-size: 0.89rem;
    }

    #gameCanvas {
        height: 45vw;
        max-height: 290px;
        border: 2px solid #39ff14;
        box-shadow: 0 0 14px rgba(57, 255, 20, 0.8), 0 0 26px rgba(57, 255, 20, 0.5) inset;
    }
}

@media (max-width: 900px) {
    #gameContainer {
        width: 100vw;
        padding: 22px 3vw 35px 3vw;
    }

    #scoreBoard {
        font-size: 1.7rem;
        letter-spacing: 0.82rem;
    }

    #gameCanvas {
        height: 50vw;
        max-height: 310px;
    }

    .neon-btn {
        padding: 11px 16vw;
        font-size: 0.98rem;
    }
}

@media (max-width: 600px) {

    #gameScreen {
        padding: 20px 10px;
    }

    #gameContainer {
        padding-top: 32px;
        padding-bottom: 32px;
        min-height: auto;
    }

    .neon-btn {
        padding: 13px 26px;
        font-size: 0.95rem;
        margin: 6px 6px 0 0;
    }

    .neon-btn.small-icon {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    #scoreBoard {
        margin: 60px auto 4px;
        font-size: 1.8rem;
        letter-spacing: 0.7rem;
    }

    #controls {
        gap: 12px;
        margin-top: 18px;
        margin-bottom: 14px;
    }

    #difficultyButtons {
        gap: 10px;
        margin-top: 14px;
    }
}

@media (max-width: 600px) and (min-height: 700px) {
    #gameCanvas {
        height: 55vw;
        max-height: 420px;
    }

    #gameContainer {
        padding-top: 36px;
        padding-bottom: 40px;
        min-height: auto;
    }
}