/* SMASH RUSH - Arcade Badminton Stylesheet */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    height: 100%;
    min-height: -webkit-fill-available;
    overflow: hidden;
    background-color: #060a12;
    font-family: 'Chakra Petch', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #ffffff;
    touch-action: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#game-wrapper {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle at center, #0f192d 0%, #050811 100%);
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    height: 100vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.75), 0 0 30px rgba(0, 229, 255, 0.15);
    background-color: #0a101d;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* UI Overlays */
.overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(6, 10, 18, 0.88);
    backdrop-filter: blur(6px);
    z-index: 20;
    transition: opacity 0.25s ease;
}

.overlay-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.82);
    z-index: 30;
}

.hidden {
    display: none !important;
}

.menu-card {
    text-align: center;
    padding: 2.5rem 3.5rem;
    background: linear-gradient(145deg, #111e33, #0b1424);
    border: 2px solid rgba(0, 229, 255, 0.35);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 229, 255, 0.2);
    max-width: 580px;
    width: 90%;
    max-height: 95dvh;
    overflow-y: auto;
}

.menu-card::-webkit-scrollbar, .modal-box::-webkit-scrollbar {
    width: 4px;
}
.menu-card::-webkit-scrollbar-thumb, .modal-box::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.5);
    border-radius: 4px;
}

.logo-wrapper {
    margin-bottom: 2rem;
}

.game-title {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

.title-highlight {
    color: #ff2a6d;
    text-shadow: 0 0 20px rgba(255, 42, 109, 0.6);
}

.game-tagline {
    font-size: 1.15rem;
    color: #00e5ff;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 0.3rem;
    text-transform: uppercase;
}

/* Difficulty Picker */
.difficulty-picker {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 0.65rem 0.85rem;
}

.diff-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #94a3b8;
    text-transform: uppercase;
    text-align: left;
}

.diff-options {
    display: flex;
    gap: 0.45rem;
    width: 100%;
}

.diff-btn {
    flex: 1;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 0.55rem 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.16s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.diff-btn:hover {
    background: rgba(51, 65, 85, 0.85);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

.diff-btn[data-diff="EASY"].active {
    background: #10b981;
    color: #022c22;
    border-color: #34d399;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
}

.diff-btn[data-diff="MEDIUM"].active {
    background: #ffe600;
    color: #451a03;
    border-color: #fef08a;
    box-shadow: 0 0 16px rgba(255, 230, 0, 0.5);
}

.diff-btn[data-diff="HARD"].active {
    background: #ff0055;
    color: #ffffff;
    border-color: #f43f5e;
    box-shadow: 0 0 16px rgba(255, 0, 85, 0.6);
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 2rem;
}

.btn {
    font-family: inherit;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 0.85rem 1.8rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    text-transform: uppercase;
    letter-spacing: 1px;
    outline: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(90deg, #00e5ff, #00a8ff);
    color: #060a12;
    box-shadow: 0 4px 18px rgba(0, 229, 255, 0.45);
}

.btn-primary:hover {
    background: linear-gradient(90deg, #33ebff, #29b6ff);
    box-shadow: 0 6px 24px rgba(0, 229, 255, 0.65);
}

.btn-secondary {
    background: #1c2b45;
    color: #ecf0f1;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: #25395c;
    border-color: rgba(255, 255, 255, 0.4);
}

.menu-btn-row {
    display: flex;
    gap: 0.9rem;
}

.menu-btn-row .btn {
    flex: 1;
    padding: 0.85rem 0.5rem;
    font-size: 0.95rem;
}

.btn-tertiary {
    background: transparent;
    color: #a4b0be;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
    padding: 0.65rem 1.2rem;
}

.btn-tertiary:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Profile Modal Styles */
.rank-display {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}

.rank-label {
    display: block;
    font-size: 0.8rem;
    color: #94a3b8;
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}

.rank-title {
    font-size: 2.2rem;
    font-weight: 900;
    margin: 0;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #ffffff;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    letter-spacing: 1px;
    margin-top: 0.2rem;
}

.quick-controls-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.2rem;
}

.quick-controls-hint code {
    background: rgba(255, 255, 255, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    color: #ffe600;
    font-family: monospace;
}

/* Modals */
.modal-box {
    background: #101c30;
    border: 2px solid #00e5ff;
    border-radius: 18px;
    padding: 2.2rem 2.8rem;
    max-width: 520px;
    width: 90%;
    text-align: center;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9);
    max-height: 95dvh;
    overflow-y: auto;
}

.modal-box h2 {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 1.2rem;
    color: #00e5ff;
    letter-spacing: 1px;
}

.rules-list {
    list-style: none;
    text-align: left;
    margin-bottom: 1.8rem;
    line-height: 1.7;
    font-size: 1.05rem;
    color: #e2e8f0;
}

.rules-list li {
    margin-bottom: 0.7rem;
}

.result-box .victory-title {
    color: #ffe600;
    font-size: 2.6rem;
    font-weight: 900;
    margin-bottom: 0.4rem;
}

.result-box .defeat-title {
    color: #ff2a6d;
    font-size: 2.6rem;
    font-weight: 900;
    margin-bottom: 0.4rem;
}

.final-score-display {
    font-size: 3.2rem;
    font-weight: 900;
    margin: 1.2rem 0 1.6rem;
    color: #ffffff;
    letter-spacing: 3px;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Pause Overlay */
.pause-box {
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.2), 0 12px 35px rgba(0, 0, 0, 0.9);
}

.pause-box h2 {
    color: #ffffff;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.pause-hint {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1.6rem;
}

.pause-hint code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #00e5ff;
    font-family: monospace;
}

.pause-actions {
    flex-direction: column;
    gap: 0.75rem;
}

.pause-actions .btn {
    width: 100%;
    padding: 0.75rem 1.4rem;
}

/* On-screen Touch Controls */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1.2rem 1.8rem;
}

.touch-group {
    display: flex;
    gap: 1.2rem;
    pointer-events: auto;
}

.touch-top-bar {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    pointer-events: auto;
    display: flex;
    gap: 0.8rem;
}

.joystick-base {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(16, 28, 48, 0.5);
    border: 2px solid rgba(0, 229, 255, 0.4);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.joystick-puck {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.9), rgba(0, 168, 255, 0.9));
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    position: absolute;
    pointer-events: none;
    transition: transform 0.05s ease-out;
}

.touch-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(16, 28, 48, 0.7);
    border: 2px solid rgba(0, 229, 255, 0.6);
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 900;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    transition: transform 0.08s, background-color 0.08s;
}

.touch-btn.active, .touch-btn:active {
    transform: scale(0.92);
    background: rgba(0, 229, 255, 0.45);
    border-color: #00e5ff;
}

.jump-btn {
    width: 76px;
    height: 76px;
    font-size: 0.95rem;
    background: rgba(0, 140, 255, 0.75);
    border-color: #00e5ff;
}

.smash-btn {
    width: 86px;
    height: 86px;
    font-size: 1.05rem;
    background: linear-gradient(135deg, rgba(255, 42, 109, 0.85), rgba(255, 106, 0, 0.85));
    border-color: #ffe600;
    box-shadow: 0 0 20px rgba(255, 42, 109, 0.6);
}

.small-btn {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    border-radius: 10px;
    background: rgba(16, 28, 48, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsiveness & Orientation */
@media (max-width: 900px) {
    #game-container {
        aspect-ratio: auto;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }

    .touch-btn {
        width: 60px;
        height: 60px;
    }

    .jump-btn {
        width: 68px;
        height: 68px;
    }

    .smash-btn {
        width: 76px;
        height: 76px;
    }

    #touch-controls {
        padding: 0.8rem 1rem;
    }

    .menu-card {
        padding: 1.5rem 1rem;
        width: 95%;
    }

    .modal-box {
        padding: 1.5rem 1.2rem;
        width: 95%;
    }

    .stats-grid {
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .stat-item {
        padding: 0.6rem;
    }

    .game-title {
        font-size: 2.2rem;
    }

    .menu-btn-row {
        flex-direction: column;
        gap: 0.6rem;
    }

    .btn {
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }

    .diff-options {
        flex-direction: column;
    }

    .diff-btn {
        padding: 0.8rem 0;
        font-size: 1rem;
    }
}
