@import url('css2?family=Montserrat:wght@400;600;800&family=Outfit:wght@400;600;800&display=swap');

:root {
    --primary: #ffa502;      /* Yuzu orange */
    --primary-glow: rgba(255, 165, 2, 0.45);
    --secondary: #00adb5;    /* Power-up teal */
    --secondary-glow: rgba(0, 173, 181, 0.45);
    --shield: #2ed573;       /* Shield green */
    --shield-glow: rgba(46, 213, 115, 0.45);
    --danger: #ff4757;       /* Crash red */
    --background: #0b0c10;   /* Slate black */
    --glass: rgba(15, 23, 42, 0.5);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Montserrat', sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    touch-action: none !important;
    overscroll-behavior: none !important;
    overscroll-behavior-y: none !important;
    overscroll-behavior-x: none !important;
}

body, html {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background-color: var(--background);
    color: #f8fafc;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    position: fixed !important; /* Prevents bouncing scrolls on iOS */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    touch-action: none !important;
    overscroll-behavior: none !important;
    overscroll-behavior-y: none !important;
    overscroll-behavior-x: none !important;
    -webkit-overflow-scrolling: auto !important;
}

/* Prevent image selection, context calls, and magnifier on mobile devices */
img {
    pointer-events: none;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    touch-action: none !important;
}

/* Canvas container */
#canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    touch-action: none !important;
    overscroll-behavior: none !important;
}

/* UI Overlay Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    touch-action: none !important;
    overscroll-behavior: none !important;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.3) 0%, rgba(11, 12, 16, 0.75) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Glassmorphism Panel */
.panel {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px 40px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: floatIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.panel-left,
.panel-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@keyframes floatIn {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Titles */
h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(255, 165, 2, 0.2));
    animation: titleGlow 3s ease-in-out infinite alternate;
}

/* Russian Title Adapting & Line Constraints */
.title-line {
    display: block;
    white-space: nowrap;
}

body.lang-ru #menu-title,
body.lang-ru #loading-title {
    font-size: clamp(1.4rem, 6.8vw, 2.2rem);
    line-height: 1.15;
}

body.lang-ru #menu-title span,
body.lang-ru #loading-title span {
    display: block;
    white-space: nowrap;
}

@media (max-width: 480px) and (orientation: portrait) {
    body.lang-ru #menu-title,
    body.lang-ru #loading-title {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 360px) and (orientation: portrait) {
    body.lang-ru #menu-title,
    body.lang-ru #loading-title {
        font-size: 1.25rem !important;
    }
}

@media (max-height: 480px) and (orientation: landscape) {
    body.lang-ru #menu-title,
    body.lang-ru #loading-title {
        font-size: 1.4rem !important;
    }
}

h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #e2e8f0;
}

@keyframes titleGlow {
    from { filter: drop-shadow(0 2px 8px rgba(255, 165, 2, 0.2)); }
    to { filter: drop-shadow(0 2px 16px rgba(255, 165, 2, 0.5)); }
}

/* Custom Buttons */
.btn {
    width: 100%;
    max-width: 280px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff7f50 100%);
    color: #0b0c10;
    border: none;
    border-radius: 14px;
    padding: 14px 28px;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--primary-glow);
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.05);
}

.btn-secondary:active {
    box-shadow: none;
}

.btn-green {
    background: linear-gradient(135deg, var(--shield) 0%, #26af5a 100%);
    color: #0b0c10;
    box-shadow: 0 6px 20px var(--shield-glow);
}
.btn-green:hover { box-shadow: 0 8px 25px var(--shield-glow); }
.btn-green:active { box-shadow: 0 4px 10px var(--shield-glow); }

.btn-blue {
    background: linear-gradient(135deg, var(--secondary) 0%, #008f96 100%);
    color: #0b0c10;
    box-shadow: 0 6px 20px var(--secondary-glow);
}
.btn-blue:hover { box-shadow: 0 8px 25px var(--secondary-glow); }
.btn-blue:active { box-shadow: 0 4px 10px var(--secondary-glow); }

/* Quick Control Buttons (Sound & Lang) */
.settings-row {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    width: 100%;
    justify-content: center;
}

.icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Loading Splash */
#loading-screen {
    z-index: 100;
}

.loader {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 165, 2, 0.1);
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 25px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* In-game HUD overlay */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none; /* Let clicks pass to canvas */
    display: none;
    padding: 20px;
}

#hud.active {
    display: block;
}

.hud-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: auto;
}

.hud-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-panel-unified {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    box-sizing: border-box;
    height: 60px;
}

.hud-multiplier-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 900;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.hud-score-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hud-score-container span {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1;
    margin-bottom: 3px;
}

.hud-score-val {
    color: #ffffff;
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
    font-feature-settings: "tnum";
}

.hud-yuzu-val {
    color: #ffbe76;
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
    font-feature-settings: "tnum";
}

.pause-trigger {
    pointer-events: auto;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 1.4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: background 0.2s, transform 0.2s;
    box-sizing: border-box;
    transition: background 0.2s, transform 0.2s;
}

.pause-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Power-up indicators container */
.powerups-hud {
    position: absolute;
    top: 95px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 140px;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

.powerup-bar-wrapper {
    width: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 8px 12px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: bold;
}

.powerup-bar-wrapper.active {
    display: flex;
}

.powerup-bar-fill-bg {
    flex-grow: 1;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.powerup-bar-fill {
    height: 100%;
    width: 100%;
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* Colors for specific power-ups */
.powerup-magnet { color: var(--secondary); }
.powerup-magnet .powerup-bar-fill { background: var(--secondary); box-shadow: 0 0 8px var(--secondary-glow); }
.powerup-shield { color: var(--shield); }
.powerup-shield .powerup-bar-fill { background: var(--shield); box-shadow: 0 0 8px var(--shield-glow); }
.powerup-double { color: var(--primary); }
.powerup-double .powerup-bar-fill { background: var(--primary); box-shadow: 0 0 8px var(--primary-glow); }

/* Swipe Tutorial Overlay */
.tutorial-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 1.1rem;
    font-weight: 600;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.tutorial-overlay.fade {
    opacity: 0;
}

.swipe-icon {
    width: 60px;
    height: 60px;
    border: 2px dashed rgba(255,255,255,0.4);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    animation: bounceUpDown 1.5s infinite alternate;
}

@keyframes bounceUpDown {
    0% { transform: translateY(0); }
    100% { transform: translateY(-12px); }
}

.shop-selector-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0;
    position: relative;
    height: 75px;
}

.shop-arrow {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    transition: 0.2s;
    user-select: none;
}

.shop-arrow:hover {
    background: rgba(255,255,255,0.15);
}

.skin-info-card {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.skin-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
    margin-bottom: 2px;
}

.skin-desc {
    font-size: 0.8rem;
    color: #8b8b9c;
    margin-bottom: 4px;
}

.skin-price {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffbe76;
}

.shop-yuzu-balance {
    background: rgba(255, 190, 118, 0.1);
    border: 1px solid rgba(255, 190, 118, 0.2);
    border-radius: 12px;
    padding: 6px 12px;
    color: #ffbe76;
    font-weight: bold;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Game Over Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin: 20px 0;
}

.stat-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px;
}

.stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin-top: 3px;
}

.stat-val.primary {
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: #8b8b9c;
    text-transform: uppercase;
    font-weight: 600;
}

/* High score notification banner in HUD */
.high-score-banner {
    position: absolute;
    top: 92px; /* 20px padding from screen top + 72px top offset */
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #0b0c10;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s, transform 0.5s, left 0.3s, right 0.3s, background 0.3s;
    z-index: 10;
}

.high-score-banner.align-left {
    left: 20px;
    right: auto;
    background: linear-gradient(90deg, #ffa502 0%, transparent 100%);
    transform: translateX(-20px);
}
.high-score-banner.align-left.show {
    opacity: 1;
    transform: translateX(0);
}

.high-score-banner.align-right {
    right: 20px;
    left: auto;
    background: linear-gradient(270deg, #ffa502 0%, transparent 100%);
    transform: translateX(20px);
}
.high-score-banner.align-right.show {
    opacity: 1;
    transform: translateX(0);
}

/* Adaptive styles for landscape orientation on phones */
@media (max-height: 480px) and (orientation: landscape) {
    .panel {
        padding: 15px 30px;
        border-radius: 18px;
        flex-direction: row;
        max-width: 620px;
        width: 95%;
        gap: 20px;
        align-items: center;
        justify-content: space-around;
    }
    
    .panel-left {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .panel-right {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 260px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 2px;
    }
    
    h2 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .shop-selector-container {
        height: 80px;
        margin: 10px 0;
    }
    
    .shop-arrow {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .skin-name {
        font-size: 1.1rem;
    }
    
    .stats-grid {
        margin: 10px 0;
        gap: 6px;
    }
    
    .stat-item {
        padding: 6px;
    }
    
    .stat-val {
        font-size: 1.1rem;
    }
}

/* Adaptive styles for portrait orientation on phones */
@media (max-width: 480px) and (orientation: portrait) {
    .panel {
        padding: 16px 20px;
        max-width: 95%;
        border-radius: 18px;
    }
    
    /* Compact HUD for mobile portrait */
    .hud-panel-unified {
        height: 44px;
        padding: 0 10px;
        gap: 6px;
        border-radius: 12px;
    }
    .hud-multiplier-badge {
        font-size: 1.0rem;
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }
    .hud-score-val,
    .hud-yuzu-val {
        font-size: 1.15rem;
    }
    .hud-score-container span {
        font-size: 0.6rem;
    }
    .pause-trigger {
        width: 44px;
        height: 44px;
        font-size: 1.0rem;
        border-radius: 12px;
    }
    

    /* Compact Shop for mobile portrait */
    #shop-screen .panel {
        max-width: 95%;
        padding: 8px 12px;
        border-radius: 16px;
    }
    .shop-selector-container {
        height: 60px !important;
        margin: 2px 0 !important;
    }
    .skin-name {
        font-size: 1.05rem !important;
    }
    .skin-desc {
        font-size: 0.72rem !important;
        margin-bottom: 2px !important;
    }
    .skin-price {
        font-size: 1.05rem !important;
    }
    #shop-carousel-dots {
        margin: 2px 0 6px 0 !important;
        gap: 6px !important;
    }
    #shop-action-btn {
        margin-top: 2px !important;
        padding: 6px 12px !important;
        font-size: 0.9rem !important;
    }
    #shop-back-btn {
        margin-top: 4px !important;
        padding: 6px 12px !important;
        font-size: 0.9rem !important;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.05rem;
        margin-bottom: 12px;
    }
    
    .btn {
        padding: 10px 18px;
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .stats-grid {
        margin: 10px 0;
        gap: 8px;
    }
    
    .stat-item {
        padding: 8px;
    }
    
    .stat-val {
        font-size: 1.2rem;
    }
    
    .shop-selector-container {
        height: 85px;
        margin: 10px 0;
    }
    
    .shop-arrow {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .skin-name {
        font-size: 1.1rem;
    }
}

/* Responsive shop screen layouts to keep the 3D capybara visible */
#shop-screen {
    justify-content: flex-end;
    padding-bottom: 45px;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#shop-screen .panel {
    max-width: 440px;
    padding: 8px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 0;
    margin-top: auto;
}
#shop-screen .panel h1 {
    margin-top: 5px;
    margin-bottom: 5px;
}

@media (min-width: 768px) {
    #shop-screen {
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        padding-right: 80px;
        padding-bottom: 20px;
    }
    #shop-screen .panel {
        max-width: 400px;
        margin-right: 20px;
        margin-top: 0;
        margin-left: auto;
    }
}

/* Upgrade Card Component */
.upgrade-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 14px;
    margin-top: 15px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: background 0.3s, border-color 0.3s;
}

.upgrade-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.upgrade-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 4px;
}

.upgrade-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.upgrade-card-price {
    font-size: 0.95rem;
    font-weight: 800;
    color: #ffbe76;
    display: flex;
    align-items: center;
    gap: 4px;
}

.upgrade-actions-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.upgrade-actions-row .btn {
    flex: 1;
    margin-bottom: 0;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 10px;
    height: 36px;
    text-transform: none;
    letter-spacing: 0;
}

/* Colors for specific power-ups */
.powerup-magnet { color: var(--secondary); }
.powerup-magnet .powerup-bar-fill { background: var(--secondary); box-shadow: 0 0 8px var(--secondary-glow); }
.powerup-shield { color: var(--shield); }
.powerup-shield .powerup-bar-fill { background: var(--shield); box-shadow: 0 0 8px var(--shield-glow); }
.powerup-double { color: var(--primary); }
.powerup-double .powerup-bar-fill { background: var(--primary); box-shadow: 0 0 8px var(--primary-glow); }
.powerup-boost { color: #f1c40f; }
.powerup-boost .powerup-bar-fill { background: #f1c40f; box-shadow: 0 0 8px rgba(241, 196, 15, 0.6); }

/* Green gradient for standard Yuzu upgrade button */
.btn-yuzu-upgrade {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.btn-yuzu-upgrade:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

.btn-yuzu-upgrade:active {
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3) !important;
}

/* Blue gradient for Ad upgrade button */
.btn-ad-upgrade {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}

.btn-ad-upgrade:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4) !important;
}

.btn-ad-upgrade:active {
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3) !important;
}

/* Global Disabled Button State */
.btn:disabled,
.btn[disabled] {
    background: #475569 !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 0.65 !important;
}

/* Megabox Opening Overlay & Animations */
.megabox-box-drawing {
    width: 150px;
    height: 150px;
    background: #0984e3;
    border: 8px solid #2d3436;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6), inset 0 -12px 0 rgba(0,0,0,0.2);
}

.megabox-lid {
    width: 166px;
    height: 48px;
    background: #0984e3;
    border: 8px solid #2d3436;
    border-radius: 14px;
    position: absolute;
    top: -14px;
    left: -16px;
    box-shadow: inset 0 -6px 0 rgba(0,0,0,0.2);
}

.megabox-stripes {
    position: absolute;
    width: 20px;
    height: 100%;
    background: #fdcb6e;
    left: 24px;
    border-left: 8px solid #2d3436;
    border-right: 8px solid #2d3436;
}

.megabox-latch-red {
    position: absolute;
    width: 34px;
    height: 40px;
    background: #d63031;
    border: 6px solid #2d3436;
    border-radius: 10px;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.megabox-latch-red::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #fdcb6e;
    border-radius: 50%;
}

.megabox-tap-val {
    position: absolute;
    right: -12px;
    bottom: -12px;
    background: #ff7675;
    border: 4px solid #fff;
    color: #fff;
    font-size: 1.9rem;
    font-weight: 900;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 15px rgba(255,118,117,0.5);
    animation: pulse 0.8s infinite alternate;
}

/* Shaking Keyframes */
.megabox-shake {
    animation: shakeBox 0.25s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeBox {
    10%, 90% { transform: translate3d(-5px, 0, 0) rotate(-2deg); }
    20%, 80% { transform: translate3d(7px, 0, 0) rotate(3deg); }
    30%, 50%, 70% { transform: translate3d(-9px, 0, 0) rotate(-4deg); }
    40%, 60% { transform: translate3d(9px, 0, 0) rotate(4deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.18); }
}

/* Flash Reveal and Ray Rotations */
.reveal-rays {
    position: absolute;
    width: 250%;
    height: 250%;
    background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.12) 0deg 15deg, transparent 15deg 30deg);
    animation: rotateRays 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes rotateRays {
    100% { transform: rotate(360deg); }
}

@keyframes scaleUp {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes flashReveal {
    0% { background: #fff; }
    100% { background: radial-gradient(circle, rgba(255,223,0,0.95) 0%, rgba(218,165,32,0.98) 50%, rgba(0,0,0,0.95) 100%); }
}

/* Carousel dots */
.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
    border: 1px solid rgba(255,255,255,0.25);
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.15);
}

.carousel-dot.active {
    background: #f39c12;
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.7);
    border-color: #f39c12;
}

/* Megabox button in shop */
.btn-megabox {
    background: linear-gradient(135deg, #0984e3 0%, #2980b9 100%) !important;
    color: #ffffff !important;
    border: 3px solid #ffde00 !important;
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.4), 0 0 10px rgba(255, 222, 0, 0.3) !important;
}

.btn-megabox:hover {
    box-shadow: 0 8px 25px rgba(9, 132, 227, 0.6), 0 0 15px rgba(255, 222, 0, 0.5) !important;
    transform: translateY(-2px);
}

.btn-megabox:active {
    box-shadow: 0 4px 10px rgba(9, 132, 227, 0.3) !important;
    transform: translateY(1px);
}

/* Tara Ability Slow Motion Visual Overlay */
body.tara-slowmo canvas {
    filter: hue-rotate(250deg) saturate(1.3) contrast(1.05);
    transition: filter 0.8s ease;
}

/* Floating Megabox Button */
.megabox-floating-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    z-index: 1000;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: top right;
    transition: transform 0.2s;
}

.megabox-floating-btn:hover {
    transform: scale(1.05);
}

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

.megabox-floating-container {
    width: 130px;
    height: 130px;
    position: relative;
    animation: megabox-idle-bounce 2s ease-in-out infinite alternate;
}

.megabox-floating-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.megabox-floating-label {
    margin-top: 12px;
    background: linear-gradient(135deg, #0984e3 0%, #2980b9 100%);
    border: 2px solid #ffde00;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 900;
    padding: 6px 12px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Disabled styling */
.megabox-floating-btn.disabled {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.7;
}

.megabox-floating-btn.disabled:hover {
    transform: none;
}

@keyframes megabox-idle-bounce {
    0% {
        transform: translateY(0) rotate(-2deg);
    }
    100% {
        transform: translateY(-8px) rotate(2deg);
    }
}

/* Megabox floating shortcut button in menu/gameover */
.megabox-shortcut-btn {
    transition: transform 0.2s, box-shadow 0.2s;
}

.megabox-shortcut-btn:hover {
    transform: scale(1.15) rotate(5deg) !important;
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.4) !important;
}

.megabox-shortcut-btn:active {
    transform: scale(0.9);
}

.menu-yuzu-balance-container {
    transition: transform 0.2s, background-color 0.2s;
}
.menu-yuzu-balance-container:hover {
    transform: scale(1.05);
    background-color: rgba(0,0,0,0.55) !important;
}

@media (max-width: 600px) {
    .shop-panel {
        width: 90%;
        max-width: 400px;
    }
}

/* Floating Megabox Section */
.shop-megabox-section {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 10px 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    width: 120px;
    text-align: center;
    box-sizing: border-box;
    transition: transform 0.2s;
}

.shop-megabox-section:hover {
    transform: translateY(-2px);
}

.shop-megabox-image {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 4px;
    animation: floating 3s ease-in-out infinite;
}

.shop-megabox-price {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 6px;
    font-family: 'Outfit', sans-serif;
}

.shop-megabox-price.sufficient {
    color: #ffbe76;
    text-shadow: 0 0 4px rgba(255, 190, 118, 0.3);
}

.shop-megabox-price.insufficient {
    color: #8b8b9c;
}

/* Smaller buttons helper */
.btn-sm {
    padding: 5px 10px !important;
    font-size: 0.8rem !important;
    min-width: 75px !important;
    height: auto !important;
    margin-top: 0 !important;
    box-shadow: none !important;
}

