/* BAL HANUMAN 2D ACTION PLATFORMER STYLESHEET */

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

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0F172A;
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    color: #F8FAFC;
    touch-action: none;
}

/* MAIN CONTAINER & CANVAS RESIZING */
#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1E1B4B 0%, #0F172A 100%);
}

#gameCanvas {
    display: block;
    background: #000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.2);
    border-radius: 8px;
}

/* OVERLAYS & MODALS */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
    text-align: center;
}

.modal-card {
    background: linear-gradient(145deg, rgba(30, 27, 75, 0.96), rgba(15, 23, 42, 0.96));
    border: 2px solid #F59E0B;
    border-radius: 20px;
    padding: 24px 30px;
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.35), inset 0 0 15px rgba(245, 158, 11, 0.1);
    max-width: 440px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.main-menu-clean {
    gap: 30px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
}

.menu-logo-img {
    max-width: 80%;
    height: auto;
    max-height: 220px;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.8));
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-play-img {
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    padding: 0;
    transition: transform 0.2s ease, filter 0.2s ease;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-play-img:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 0 30px rgba(245, 158, 11, 0.9));
}

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

.play-btn-img {
    max-width: 100%;
    height: auto;
    max-height: 140px;
    display: block;
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.game-title {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #FFF 0%, #FBBF24 50%, #F59E0B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
    margin-bottom: 2px;
}

.game-subtitle {
    font-size: 0.95rem;
    color: #FCD34D;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.score-display {
    font-size: 1.25rem;
    font-weight: 800;
    color: #4ADE80;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 24px;
    border-radius: 50px;
    border: 1px solid rgba(74, 222, 128, 0.4);
    margin-bottom: 6px;
}

/* BUTTONS */
.btn {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: #FFF;
    border: none;
    padding: 12px 32px;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: inherit;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.4);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(245, 158, 11, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 8px 25px rgba(51, 65, 85, 0.4);
}

.btn-secondary:hover {
    box-shadow: 0 12px 30px rgba(51, 65, 85, 0.6);
}

/* HOW TO PLAY CARD */
.instructions-box {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    padding: 16px 20px;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #CBD5E1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.instructions-box strong {
    color: #FBBF24;
}

/* MOBILE ON-SCREEN CONTROLS */
#mobile-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 80;
}

.touch-group-left {
    position: absolute;
    bottom: 24px;
    left: 24px;
    display: flex;
    gap: 16px;
    pointer-events: auto;
}

.touch-group-right {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 16px;
    pointer-events: auto;
}

.touch-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(30, 27, 75, 0.7);
    border: 2px solid #F59E0B;
    color: #FBBF24;
    font-size: 1.6rem;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(245, 158, 11, 0.2);
    touch-action: none;
    transition: transform 0.1s ease, background-color 0.1s ease;
}

.touch-btn:active {
    transform: scale(0.9);
    background: rgba(245, 158, 11, 0.8);
    color: #FFF;
}

.touch-btn-attack {
    border-color: #EF4444;
    color: #EF4444;
}

.touch-btn-attack:active {
    background: rgba(239, 68, 68, 0.8);
    color: #FFF;
}

/* PORTRAIT LANDSCAPE PROMPT */
#portrait-prompt {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0F172A;
    z-index: 999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
}

#portrait-prompt .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: rotatePhone 2s infinite ease-in-out;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

@media (orientation: portrait) and (max-width: 900px) {
    #portrait-prompt {
        display: flex;
    }
}

/* LEVEL SELECTOR MODAL & GRID */
.level-modal-card {
    max-width: 680px;
    width: 90%;
    padding: 30px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    width: 100%;
    margin: 20px 0;
}

.lvl-box {
    background: linear-gradient(145deg, rgba(30, 27, 75, 0.9), rgba(15, 23, 42, 0.95));
    border: 2px solid #F59E0B;
    border-radius: 18px;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(245, 158, 11, 0.15);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
}

.lvl-box:hover {
    transform: translateY(-4px) scale(1.08);
    background: linear-gradient(145deg, #F59E0B, #D97706);
    border-color: #FBBF24;
    box-shadow: 0 12px 25px rgba(245, 158, 11, 0.5);
}

.lvl-box:hover .lvl-box-num,
.lvl-box:hover .lvl-box-sub {
    color: #FFFFFF;
}

.lvl-box:active {
    transform: scale(0.95);
}

.lvl-box-special {
    border-color: #FBBF24;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
}

.lvl-box-locked {
    opacity: 0.45;
    border-color: #475569;
    background: linear-gradient(145deg, #1E293B, #0F172A);
    box-shadow: none;
    cursor: not-allowed;
}

.lvl-box-locked:hover {
    transform: none;
    background: linear-gradient(145deg, #1E293B, #0F172A);
    border-color: #475569;
    box-shadow: none;
}

.lvl-box-locked .lvl-box-num {
    color: #64748B;
}

.lvl-box-locked .lvl-box-sub {
    color: #64748B;
}

.lvl-box-num {
    font-size: 2rem;
    font-weight: 900;
    color: #FBBF24;
    line-height: 1;
}

.lvl-box-sub {
    font-size: 0.65rem;
    font-weight: 800;
    color: #CBD5E1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

@media (max-width: 650px) {
    .level-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }
    .lvl-box-num {
        font-size: 1.5rem;
    }
    .lvl-box-sub {
        font-size: 0.5rem;
    }
}
