/* ============================================================
   BALA HANUMAN DELUXE - STYLESHEET
   Modern, High-Graphic Vedic Fantasy Aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Poppins:wght@400;600;700;800&family=Tiro+Devanagari+Hindi&display=swap');

:root {
    --gold-primary: #FFD700;
    --gold-bright: #FFE97D;
    --gold-dark: #C69214;
    --saffron: #FF7700;
    --saffron-glow: rgba(255, 119, 0, 0.45);
    --divine-cyan: #00F5D4;
    --emerald: #2EC4B6;
    --demon-crimson: #E63946;
    --dark-bg: #0A0A12;
    --glass-bg: rgba(14, 13, 26, 0.82);
    --glass-border: rgba(255, 215, 0, 0.25);
    --hud-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--dark-bg);
    font-family: 'Poppins', sans-serif;
    color: #FFFFFF;
}

#game-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #19162B 0%, #08070E 100%);
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: auto;
}

/* ================= HUD LAYER ================= */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px 24px;
}

.hud-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.hud-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.realm-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold-bright);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.realm-badge .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00F5D4;
    box-shadow: 0 0 10px #00F5D4;
    animation: pulseGlow 1.5s infinite;
}

.score-display {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: 'Cinzel', serif;
}

.score-display .lbl {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-display .val {
    font-size: 2rem;
    font-weight: 900;
    color: #FFFFFF;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    letter-spacing: 1px;
}

/* Center Progress Bar & Boss HP */
.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 240px;
    max-width: 420px;
    flex: 1;
}

.progress-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    padding: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    position: relative;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FF9E00, #FFD700, #00F5D4);
    border-radius: 10px;
    transition: width 0.1s linear;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
}

.progress-marker {
    position: absolute;
    top: -6px;
    left: 0%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: url('assets/images/hero_badge.png') center/cover no-repeat;
    filter: drop-shadow(0 0 6px #FFD700);
    transition: left 0.1s linear;
}

.realm-subtext {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Boss HP HUD */
#boss-hud {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    animation: fadeInDown 0.5s ease forwards;
}

#boss-hud.active {
    display: flex;
}

.boss-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: #FF5A5F;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(230, 57, 70, 0.7);
}

.boss-bar-wrap {
    width: 100%;
    height: 16px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #E63946;
    border-radius: 10px;
    padding: 2px;
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.5);
    position: relative;
    overflow: hidden;
}

.boss-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #800E13, #AD2831, #E63946, #FF758F);
    border-radius: 6px;
    transition: width 0.25s ease-out;
}

/* Right HUD */
.hud-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.lives-box {
    display: flex;
    gap: 6px;
}

.heart-icon {
    width: 28px;
    height: 28px;
    fill: #FF4D6D;
    filter: drop-shadow(0 0 8px rgba(255, 77, 109, 0.6));
    transition: transform 0.2s, opacity 0.3s;
}

.heart-icon.lost {
    fill: rgba(255, 255, 255, 0.2);
    filter: none;
    transform: scale(0.8);
}

.banana-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 30px;
}

.banana-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px #FFD700);
}

.banana-count {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--gold-bright);
    font-family: 'Cinzel', serif;
}

.combo-gauge {
    display: none;
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.8), rgba(255, 215, 0, 0.8));
    color: #000;
    font-weight: 900;
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: 0 0 16px var(--saffron-glow);
    animation: bouncePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-gauge.active {
    display: block;
}

/* Bottom HUD: Divine Ultimate Bar */
.hud-bottom {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.ultimate-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
}

.ultimate-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--gold-bright);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.ultimate-track {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 12px;
    padding: 2px;
    position: relative;
    overflow: hidden;
}

.ultimate-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #F7C59F, #FFD700);
    border-radius: 8px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 14px #FFD700;
}

.ultimate-track.ready {
    border-color: #00F5D4;
    box-shadow: 0 0 20px rgba(0, 245, 212, 0.8);
    animation: ultimateReadyPulse 1s infinite alternate;
}

.ultimate-track.ready .ultimate-fill {
    background: linear-gradient(90deg, #00F5D4, #7000FF, #FFD700);
}

.hud-buttons {
    display: flex;
    gap: 12px;
    pointer-events: auto;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(20, 18, 35, 0.75);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.icon-btn:hover {
    transform: scale(1.08);
    border-color: var(--gold-primary);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}

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

/* ================= TOUCH CONTROLS ================= */
#touch-controls {
    position: absolute;
    bottom: 24px;
    left: 0;
    width: 100%;
    padding: 0 24px;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 15;
}

.touch-cluster {
    display: flex;
    gap: 16px;
    pointer-events: auto;
}

.touch-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(20, 18, 38, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #FFF;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
    transition: transform 0.08s, background 0.15s, border-color 0.15s;
    -webkit-user-select: none;
    user-select: none;
}

.touch-btn .btn-sub {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.touch-btn:active {
    transform: scale(0.9);
    background: rgba(255, 215, 0, 0.3);
    border-color: var(--gold-primary);
}

.touch-btn.jump-btn {
    border-color: rgba(46, 196, 182, 0.6);
    background: rgba(46, 196, 182, 0.2);
}

.touch-btn.dash-btn {
    border-color: rgba(0, 245, 212, 0.6);
    background: rgba(0, 245, 212, 0.2);
}

.touch-btn.gada-btn {
    border-color: rgba(255, 119, 0, 0.6);
    background: rgba(255, 119, 0, 0.25);
}

.touch-btn.avatar-btn {
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.2);
}

/* ================= MODAL SCREENS ================= */
.screen-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 5, 12, 0.82);
    backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    padding: 20px;
}

.screen-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 215, 0, 0.15);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 600px;
    width: 100%;
    text-align: center;
    position: relative;
    transform: scale(0.92);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.screen-modal.active .modal-card {
    transform: scale(1);
}

.modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #FF6B35, #FFD700, #00F5D4);
}

.hero-avatar-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.2rem;
}

.hero-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(255, 119, 0, 0.5));
    animation: floatBob 3s ease-in-out infinite;
}

.hero-glow-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 215, 0, 0.4);
    animation: rotateAura 12s linear infinite;
}

h1.game-title {
    font-family: 'Cinzel', serif;
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.1;
    margin-bottom: 0.4rem;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFE57F 40%, #FFB300 80%, #FF8F00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.3));
}

.sanskrit-verse {
    font-family: 'Tiro Devanagari Hindi', serif;
    color: var(--gold-bright);
    font-size: 1.15rem;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
    opacity: 0.95;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.modal-desc {
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.8rem;
}

/* Button Styling */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 1rem;
}

.btn-deluxe {
    background: linear-gradient(135deg, #FFA000, #FF6F00);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 0.9rem 2.4rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 111, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-deluxe:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(255, 111, 0, 0.6), 0 0 20px var(--gold-primary);
}

.btn-deluxe:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 0.75rem 1.6rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--gold-primary);
    transform: translateY(-2px);
}

/* Control Pills */
.controls-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 1.4rem 0;
}

.pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.key-tag {
    background: rgba(255, 215, 0, 0.2);
    color: var(--gold-bright);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
}

/* Run Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    margin: 1.5rem 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-card .val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold-bright);
    font-family: 'Cinzel', serif;
}

.stat-card .lbl {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Settings Sliders */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-row label {
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.slider-input {
    width: 140px;
    accent-color: var(--gold-primary);
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch 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.2);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background-color: var(--emerald);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Animations */
@keyframes floatBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes rotateAura {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes ultimateReadyPulse {
    0% { box-shadow: 0 0 10px rgba(0, 245, 212, 0.5); }
    100% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.9); }
}

@keyframes bouncePop {
    0% { transform: scale(0.6); opacity: 0; }
    80% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mario-Style Course Clear & Tally Styling */
.mario-clear-banner {
    display: inline-block;
    margin-bottom: 0.3rem;
}

.mario-clear-ribbon {
    background: linear-gradient(90deg, #FF6B35, #FFD700);
    color: #1A0B00;
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 0.9rem;
    letter-spacing: 2.5px;
    padding: 4px 18px;
    border-radius: 20px;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    display: inline-block;
}

.mario-star-rating {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin: 0.8rem 0 1.2rem;
}

.mario-star {
    font-size: 2.8rem;
    color: rgba(255, 255, 255, 0.15);
    text-shadow: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s;
    user-select: none;
    display: inline-block;
}

.mario-star.earned {
    color: #FFD700;
    text-shadow: 0 0 18px #FFD700, 0 0 32px #FF9E00;
    transform: scale(1.25) rotate(6deg);
    animation: starPopAnim 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes starPopAnim {
    0% { transform: scale(0.2) rotate(-45deg); opacity: 0; }
    65% { transform: scale(1.45) rotate(12deg); opacity: 1; }
    100% { transform: scale(1.25) rotate(6deg); }
}

.tally-box {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 16px;
    padding: 14px 22px;
    margin: 1rem 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.4);
    text-align: left;
}

.tally-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-family: 'Poppins', sans-serif;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.88);
}

.tally-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tally-val {
    font-family: 'Cinzel', serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--gold-bright);
    min-width: 80px;
    text-align: right;
    transition: transform 0.15s ease;
}

.tally-val.counting {
    color: #00F5D4;
    transform: scale(1.15);
}

.tally-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
    margin: 8px 0;
}

.tally-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 4px;
}

.tally-total-label {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #00F5D4;
}

.tally-total-val {
    font-family: 'Cinzel', serif;
    font-size: 1.7rem;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.7);
    letter-spacing: 1px;
}

.auto-advance-bar-wrap {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 14px;
}

.auto-advance-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #FF6B35, #FFD700);
    border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #hud-overlay {
        padding: 10px 14px;
    }
    .score-display .val {
        font-size: 1.5rem;
    }
    h1.game-title {
        font-size: 2rem;
    }
    .modal-card {
        padding: 1.8rem 1.2rem;
    }
    .btn-deluxe {
        padding: 0.8rem 1.8rem;
        font-size: 1rem;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
