* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Custom cursor styling */
body, html {
    cursor: url('cursor1-small.png'), auto !important;
}

/* Custom cursor styling for interactive elements */
button, 
.action-btn, 
.radio-btn, 
.settings-btn, 
.send-btn, 
.reward-btn,
.ui-tab-vertical,
.chat-tab,
.inventory-item,
.treasure-chest,
.chest-image,
.pet-sprite,
.egg-option,
a,
input[type="button"],
input[type="submit"],
[onclick],
[role="button"] {
    cursor: url('cursor2-small.png'), pointer !important;
}

/* Hover states for interactive elements */
button:hover, 
.action-btn:hover, 
.radio-btn:hover, 
.settings-btn:hover, 
.send-btn:hover, 
.reward-btn:hover,
.ui-tab-vertical:hover,
.chat-tab:hover,
.inventory-item:hover,
.treasure-chest:hover,
.chest-image:hover,
.pet-sprite:hover,
.egg-option:hover {
    cursor: url('cursor2-small.png'), pointer !important;
}

/* Text input areas get text cursor */
input[type="text"], 
textarea, 
.chat-input-container input {
    cursor: text !important;
}

/* Egg Selection Screens */
.egg-selection-screen,
.hatching-screen,
.pet-reveal-screen,
.battle-screen,
.game-over-screen,
.victory-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4a3829 0%, #8b7355 50%, #4a3829 100%);
    z-index: 1001; /* Higher than other elements to ensure visibility */
}

/* General hidden class */
.hidden {
    display: none !important;
}

.egg-selection-screen.hidden,
.hatching-screen.hidden,
.pet-reveal-screen.hidden,
.battle-screen.hidden,
.game-over-screen.hidden,
.victory-popup.hidden,
.main-game.hidden {
    display: none;
}

/* Egg Selection */
.egg-selection-content {
    text-align: center;
    max-width: 800px;
    padding: 40px;
    margin: 20px;
}

.egg-selection-content h1 {
    font-size: 3rem;
    color: #ffff00;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.egg-selection-subtitle {
    font-size: 1.2rem;
    color: #e6d3b7;
    margin-bottom: 40px;
}

.egg-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.egg-option {
    background: linear-gradient(145deg, #6b5b47, #9c8b73);
    border: 3px solid #8b6914;
    border-radius: 15px;
    padding: 25px;
    width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.1),
        inset -2px -2px 4px rgba(0,0,0,0.3),
        0 4px 8px rgba(0,0,0,0.2);
}

.egg-option:hover {
    transform: translateY(-5px);
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.2),
        inset -2px -2px 4px rgba(0,0,0,0.2),
        0 8px 16px rgba(0,0,0,0.3);
    border-color: #ffff00;
}

.egg-visual {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: eggFloat 2s ease-in-out infinite;
}

@keyframes eggFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.egg-option h3 {
    color: #ffff00;
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.egg-option p {
    color: #e6d3b7;
    margin-bottom: 15px;
}

.egg-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.egg-stats span {
    background: rgba(0,0,0,0.3);
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #e6d3b7;
}

/* Hatching Animation */
.hatching-content {
    text-align: center;
    color: #ffff00;
}

.hatching-egg {
    font-size: 8rem;
    margin-bottom: 30px;
    animation: hatchingShake 0.5s ease-in-out infinite;
}

@keyframes hatchingShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg) scale(1.05); }
    75% { transform: rotate(5deg) scale(1.05); }
}

.hatching-text {
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hatching-effects {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.crack-effect,
.sparkle-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    animation: sparkle 1s ease-in-out infinite;
}

.crack-effect {
    background: radial-gradient(circle, rgba(255,255,0,0.3) 0%, transparent 70%);
}

.sparkle-effect {
    background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 50%);
    animation-delay: 0.5s;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* Pet Reveal */
.pet-reveal-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    margin: 20px;
}

.pet-reveal-content h1 {
    font-size: 3rem;
    color: #ffff00;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.revealed-pet {
    font-size: 8rem;
    margin-bottom: 20px;
    animation: petReveal 2s ease-out;
}

@keyframes petReveal {
    0% { 
        opacity: 0; 
        transform: scale(0.3) rotate(180deg); 
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.2) rotate(90deg); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1) rotate(0deg); 
    }
}

.pet-reveal-content h2 {
    font-size: 2rem;
    color: #ffff00;
    margin-bottom: 15px;
}

.pet-reveal-content p {
    font-size: 1.2rem;
    color: #e6d3b7;
    margin-bottom: 30px;
}

.start-adventure-btn {
    background: linear-gradient(145deg, #8b6914, #b8860b);
    border: 2px solid #ffd700;
    color: #ffff00;
    font-size: 1.2rem;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.2),
        inset -1px -1px 2px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.2);
}

.start-adventure-btn:hover {
    background: linear-gradient(145deg, #b8860b, #daa520);
    transform: translateY(-2px);
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.3),
        inset -1px -1px 2px rgba(0,0,0,0.2),
        0 4px 8px rgba(0,0,0,0.3);
}

.start-adventure-btn:active {
    transform: translateY(0px);
    box-shadow: 
        inset 2px 2px 4px rgba(0,0,0,0.3),
        inset -1px -1px 2px rgba(255,255,255,0.1);
}

/* Mobile responsiveness for egg selection */
@media (max-width: 768px) {
    /* Egg Selection Screen Mobile Optimization */
    .egg-selection-screen {
        padding: 5px;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: 100vh;
        width: 100vw;
    }
    
    .egg-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 5px;
        box-sizing: border-box;
        width: 100%;
        max-width: 100vw;
    }
    
    .egg-option {
        width: 90vw;
        max-width: 280px;
        padding: 12px;
        min-height: 140px;
        margin: 5px 0;
        box-sizing: border-box;
        font-size: 12px;
    }
    
    .egg-option h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .egg-option p {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .egg-selection-content {
        padding: 10px;
        margin: 0;
        max-height: 95vh;
        overflow-y: auto;
        box-sizing: border-box;
        width: 100vw;
    }
    
    .egg-selection-content h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .egg-selection-subtitle {
        font-size: 12px;
        margin-bottom: 15px;
    }
    
    /* Hatching Screen Mobile Optimization */
    .hatching-screen {
        padding: 10px;
        box-sizing: border-box;
        overflow: hidden;
        max-height: 100vh;
        width: 100vw;
    }
    
    .hatching-content {
        padding: 15px;
        box-sizing: border-box;
        max-width: 90vw;
        margin: 0 auto;
        text-align: center;
    }
    
    .hatching-egg {
        font-size: 4rem;
        margin: 20px 0;
    }
    
    .hatching-text {
        font-size: 14px;
        margin: 10px 0;
    }
    
    /* Pet Reveal Screen Mobile Optimization */
    .pet-reveal-screen {
        padding: 10px;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: 100vh;
        width: 100vw;
    }
    
    .pet-reveal-content {
        padding: 15px;
        margin: 0;
        max-height: 90vh;
        overflow-y: auto;
        box-sizing: border-box;
        max-width: 90vw;
        margin: 0 auto;
        text-align: center;
    }
    
    .pet-reveal-content h1 {
        font-size: 1.6rem;
        margin-bottom: 10px;
    }
    
    .pet-reveal-content h2 {
        font-size: 1.2rem;
        margin: 8px 0;
    }
    
    .pet-reveal-content p {
        font-size: 11px;
        line-height: 1.4;
        margin: 8px 0;
    }
    
    .pet-reveal-sprite {
        font-size: 4rem;
        margin: 15px 0;
    }
    
    .continue-btn {
        padding: 10px 20px;
        font-size: 12px;
        margin-top: 15px;
        box-sizing: border-box;
    }
}

/* Mobile landscape specific optimization */
@media (max-width: 926px) and (orientation: landscape) {
    /* Ultra-compact for landscape mode */
    .egg-selection-screen,
    .hatching-screen,
    .pet-reveal-screen {
        padding: 2px;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .egg-selection-content,
    .hatching-content,
    .pet-reveal-content {
        padding: 8px;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .egg-selection-content h1 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }
    
    .egg-option {
        min-height: 100px;
        padding: 8px;
        margin: 3px 0;
        width: 85vw;
        max-width: 250px;
    }
    
    .egg-option h3 {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .egg-option p {
        font-size: 10px;
        line-height: 1.2;
    }
    
    .hatching-egg,
    .pet-reveal-sprite {
        font-size: 3rem;
        margin: 10px 0;
    }
    
    .hatching-text {
        font-size: 12px;
        margin: 5px 0;
    }
    
    .pet-reveal-content h1 {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .pet-reveal-content h2 {
        font-size: 1rem;
        margin: 5px 0;
    }
    
    .pet-reveal-content p {
        font-size: 10px;
        margin: 5px 0;
    }
    
    .continue-btn {
        padding: 6px 15px;
        font-size: 11px;
        margin-top: 10px;
    }
}
/* Action Popup System */
.action-popup {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 100, 200, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 100;
    order: 0;
}

.action-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(10px);
}

.action-popup.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
}

/* Enhanced Action Buttons */
.action-info {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

.action-info p {
    margin: 5px 0;
    font-size: 0.8rem;
    color: #e6d3b7;
}

.action-btn {
    position: relative;
    min-height: 45px;
}

.cooldown-text {
    display: block;
    font-size: 0.7rem;
    color: #ff6b6b;
    font-weight: normal;
    margin-top: 2px;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(145deg, #5a5a5a, #3a3a3a);
}

/* Battle Screen */
.battle-content {
    max-width: 800px;
    width: 90%;
    padding: 30px;
    text-align: center;
}

.battle-content h2 {
    color: #ffff00;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.battle-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.pet-battle-info,
.monster-battle-info {
    flex: 1;
    min-width: 200px;
}

.pet-battle-info h3,
.monster-battle-info h3 {
    color: #ffff00;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.pet-battle-sprite,
.monster-battle-sprite {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: battleFloat 2s ease-in-out infinite;
}

@keyframes battleFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.vs-indicator {
    font-size: 2rem;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.health-bar-container {
    margin-bottom: 10px;
}

.health-bar {
    width: 100%;
    height: 20px;
    background: #8B0000; /* Dark red background like RuneScape */
    border: 2px solid #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff00 0%, #32CD32 50%, #00ff00 100%); /* Bright green like RuneScape */
    transition: width 0.5s ease;
    border-radius: 8px;
}

.health-bar-container span {
    color: #e6d3b7;
    font-size: 0.9rem;
    font-weight: bold;
}

.battle-log {
    background: rgba(0,0,0,0.3);
    border: 2px solid #8b6914;
    border-radius: 10px;
    padding: 15px;
    height: 100px;
    overflow-y: auto;
    margin-bottom: 20px;
    text-align: left;
}

.battle-log p {
    color: #e6d3b7;
    margin: 5px 0;
    font-size: 0.9rem;
}

.battle-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.battle-btn {
    background: linear-gradient(145deg, #8b6914, #b8860b);
    border: 2px solid #ffd700;
    color: #ffff00;
    font-size: 1.1rem;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.2),
        inset -1px -1px 2px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.2);
}

.battle-btn:hover {
    background: linear-gradient(145deg, #b8860b, #daa520);
    transform: translateY(-2px);
}

.battle-btn.attack {
    border-color: #ff6b6b;
}

.battle-btn.flee {
    border-color: #6bb6ff;
}

/* Game Over Screen */
.game-over-content {
    max-width: 600px;
    padding: 40px;
    text-align: center;
}

.game-over-content h1 {
    font-size: 3rem;
    color: #ff4444;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.death-animation {
    font-size: 6rem;
    margin: 20px 0;
    animation: deathShake 0.5s ease-in-out infinite;
}

@keyframes deathShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

.game-over-content h2 {
    color: #ffff00;
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.game-over-content p {
    color: #e6d3b7;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.game-over-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.restart-btn {
    background: linear-gradient(145deg, #8b6914, #b8860b);
    border: 2px solid #ff6b6b;
    color: #ffff00;
    font-size: 1.1rem;
    padding: 15px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.2),
        inset -1px -1px 2px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.2);
}

.restart-btn:hover {
    background: linear-gradient(145deg, #b8860b, #daa520);
    transform: translateY(-2px);
}

/* Victory Popup */
.victory-content {
    max-width: 500px;
    padding: 40px;
    text-align: center;
}

.victory-content h1 {
    font-size: 2.5rem;
    color: #00ff00;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.victory-animation {
    font-size: 4rem;
    margin: 20px 0;
    animation: victoryPulse 1s ease-in-out infinite;
}

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

.victory-content h2 {
    color: #ffff00;
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.victory-rewards {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.reward-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0,0,0,0.2);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #8b6914;
}

.reward-icon {
    font-size: 1.5rem;
}

.reward-text {
    color: #e6d3b7;
    font-size: 1.1rem;
    font-weight: bold;
}

.reward-item.level-up .reward-text {
    color: #00ff00;
    animation: levelUpGlow 0.5s ease-in-out infinite alternate;
}

@keyframes levelUpGlow {
    from { text-shadow: 0 0 5px #00ff00; }
    to { text-shadow: 0 0 15px #00ff00, 0 0 25px #00ff00; }
}

.victory-btn {
    background: linear-gradient(145deg, #8b6914, #b8860b);
    border: 2px solid #00ff00;
    color: #ffff00;
    font-size: 1.1rem;
    padding: 15px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.2),
        inset -1px -1px 2px rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.2);
}

.victory-btn:hover {
    background: linear-gradient(145deg, #b8860b, #daa520);
    transform: translateY(-2px);
}

/* Mobile responsiveness for battle and game over */
@media (max-width: 768px) {
    .battle-content {
        padding: 20px 15px;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .battle-content h2 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .battle-area {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    .pet-battle-info,
    .monster-battle-info {
        width: 100%;
        max-width: 250px;
        text-align: center;
    }
    
    .vs-indicator {
        font-size: 1.5rem;
        padding: 10px;
        margin: 10px 0;
    }
    
    .battle-actions {
        flex-direction: row; /* Keep horizontal on mobile */
        gap: 15px;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .battle-btn {
        flex: 1;
        min-width: 120px;
        max-width: 150px;
        padding: 16px 12px;
        font-size: 1rem;
        min-height: 56px; /* Good touch target */
    }
    
    .battle-log {
        max-height: 120px;
        font-size: 0.9rem;
        padding: 15px;
        margin: 15px 0;
    }
    
    .game-over-content {
        padding: 30px 20px;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .game-over-actions {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        width: 100%;
    }
    
    .restart-btn {
        padding: 16px 32px;
        font-size: 1.1rem;
        min-height: 56px;
        width: 100%;
        max-width: 280px;
    }
    
    .pet-battle-sprite,
    .monster-battle-sprite {
        font-size: 3.5rem;
        margin: 10px 0;
    }
    
    .health-bar-container {
        margin: 10px 0;
        width: 100%;
    }
    
    .health-bar {
        height: 14px; /* Slightly taller for mobile */
    }
    
    /* Victory popup mobile */
    .victory-content {
        padding: 25px 20px;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .victory-content h1 {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .victory-animation {
        font-size: 3rem;
        margin: 15px 0;
    }
    
    .victory-rewards {
        margin: 20px 0;
    }
    
    .reward-item {
        padding: 10px 15px;
        margin: 8px 0;
        font-size: 1rem;
    }
    
    .victory-btn {
        padding: 16px 32px;
        font-size: 1rem;
        min-height: 56px;
        width: 100%;
        max-width: 280px;
    }
    
    .death-animation {
        font-size: 4rem;
    }
}

html {
    overflow: hidden; /* Disable scrolling on html element */
    height: 100vh;
    width: 100vw;
    /* Improve mobile performance */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Trebuchet MS', 'Arial', sans-serif;
    background: #2d5016;
    background-image: 
        radial-gradient(circle at 25% 25%, #3d6b1f 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, #4a7c26 0%, transparent 50%),
        linear-gradient(135deg, #2d5016 0%, #1a3009 100%);
    height: 100vh; /* Fixed height instead of min-height */
    width: 100vw; /* Fixed width */
    color: #ffff00;
    overflow: hidden; /* Disable all scrolling */
    padding: 0; /* Remove all padding */
    margin: 0; /* Remove all margin */
    /* Mobile optimizations */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Smooth scrolling where allowed */
    scroll-behavior: smooth;
    /* Performance improvements */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Universal button touch improvements for mobile */
button, .btn, .action-btn, .battle-btn, .ui-tab-vertical, .chat-tab, .inventory-item {
    /* Better touch targets */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Add small mobile optimizations for smaller screens */
@media (max-width: 480px) {
    .egg-option {
        width: 260px;
        max-width: 85vw;
    }
    
    .egg-selection-content h1 {
        font-size: 1.8rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr; /* Single column on very small screens */
        gap: 10px;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(2, 1fr); /* Even fewer columns on tiny screens */
    }
    
    .ui-tab-vertical {
        padding: 10px 2px;
        min-height: 55px;
    }
    
    .tab-icon {
        font-size: 1.3rem;
    }
    
    .tab-label {
        font-size: 0.7rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .pet-sprite {
        font-size: 4.2rem; /* Increased by 20% from 3.5rem */
    }
    
    .battle-btn {
        min-width: 100px;
        padding: 14px 10px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0; /* Remove padding to eliminate green space */
}

header {
    position: absolute; /* Position over the content */
    top: 0;
    left: 0;
    right: 300px; /* Extend to touch the right UI panel (reduced from 320px) */
    z-index: 1000; /* Ensure it appears above the content */
    text-align: center;
    margin-bottom: 0; /* Remove bottom margin to connect to main content */
    /* Brown RuneScape-style UI instead of green */
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 50%, #4a3d2a 100%);
    border: 3px solid;
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    border-top: none; /* Remove top border for edge-to-edge */
    border-radius: 0 0 8px 8px; /* Only round bottom corners */
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.3),
        inset -2px -2px 4px rgba(0,0,0,0.5),
        0 4px 8px rgba(0,0,0,0.6);
    padding: 8px; /* Reduced from 15px to make header smaller */
}

header h1 {
    color: #ffff00;
    font-size: 1.8rem; /* Reduced from 2.2rem to make text smaller */
    text-shadow: 
        2px 2px 0px #000000,
        -1px -1px 0px #000000,
        1px -1px 0px #000000,
        -1px 1px 0px #000000;
    margin-bottom: 6px; /* Reduced from 8px */
    font-weight: bold;
    letter-spacing: 2px;
}

.ca-announcement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.9) 0%, rgba(107, 93, 66, 0.9) 100%);
    border: 2px solid #7da373;
    border-radius: 6px;
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.2),
        inset -2px -2px 4px rgba(0,0,0,0.3),
        0 4px 8px rgba(0,0,0,0.4);
}

.ca-label {
    font-size: 0.9rem;
    color: #ffff00;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    white-space: nowrap;
}

.ca-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px inset #555;
    border-radius: 5px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
}

.ca-container:hover {
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    border-color: #7da373;
    box-shadow: 0 2px 8px rgba(125, 163, 115, 0.3);
}

.ca-container:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.ca-input {
    background: transparent;
    border: none;
    color: #ffff00;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    flex: 1;
    outline: none;
}

.copy-icon {
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.ca-container:hover .copy-icon {
    opacity: 1;
}



main {
    position: absolute; /* Position absolutely to control exact placement */
    top: 72px; /* Reduced from 80px to give more space for smaller CA section */
    left: 0;
    right: 300px; /* Extend to touch right UI panel boundary */
    bottom: 300px; /* Above chat area */
    display: grid;
    grid-template-columns: 1fr 320px; /* Increased stats width from 300px to 320px */
    grid-template-rows: auto;
    gap: 0; /* Remove gap completely to eliminate green showing through */
    margin: 0; /* Remove any margin */
    padding: 0; /* Remove padding to fill edge to edge */
    grid-template-areas: 
        "pet stats";
}

/* RuneScape-style panel styling */
.rs-panel {
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 50%, #4a3d2a 100%);
    border: 3px solid;
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    border-radius: 8px;
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.3),
        inset -2px -2px 4px rgba(0,0,0,0.5),
        0 4px 8px rgba(0,0,0,0.6);
    color: #ffff00;
}

.pet-display {
    grid-area: pet;
    position: relative;
    width: 100%; /* Fill entire available width */
    height: 100%; /* Fill entire available height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0; /* Remove any margin */
    border-radius: 0; /* Remove border radius to fill edge to edge */
}

.pet-display.rs-panel {
    background: linear-gradient(135deg, #4a6741 0%, #2d4025 50%, #1a2615 100%);
    border-color: #7da373 #1a2615 #1a2615 #7da373;
}

/* Pet-specific backgrounds */
.pet-display.pet-turtle {
    background: linear-gradient(rgba(74, 103, 65, 0.7), rgba(45, 64, 37, 0.7), rgba(26, 38, 21, 0.7)), url('Turtlebg.png');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
}

.pet-display.pet-snail {
    background: linear-gradient(rgba(74, 103, 65, 0.7), rgba(45, 64, 37, 0.7), rgba(26, 38, 21, 0.7)), url('Snailbg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.pet-display.pet-tiger {
    background: linear-gradient(rgba(74, 103, 65, 0.7), rgba(45, 64, 37, 0.7), rgba(26, 38, 21, 0.7)), url('Tigerbg.png');
    background-size: cover;
    background-position: center 75%;
    background-repeat: no-repeat;
}

.pet-container {
    position: relative;
    z-index: 2; /* Ensure pet appears above background */
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end; /* Changed from center to flex-end to align with ground */
    justify-content: center;
    transition: none; /* Removed CSS transition since we're using JS animation */
    padding-bottom: 3%; /* Reduced from 6% to make pets even lower */
}

.pet {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: float 3s ease-in-out infinite;
    flex-shrink: 0; /* Prevent pet from shrinking */
}

.pet-sprite {
    font-size: 9rem; /* Increased by 20% from 7.5rem */
    margin-bottom: 0; /* Removed bottom margin */
    cursor: pointer;
    transition: transform 0.3s ease;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.7));
    position: relative;
    z-index: 3; /* Ensure pet emoji is clearly visible above background */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8), -1px -1px 2px rgba(255,255,255,0.3);
    width: 9rem; /* Increased by 20% from 7.5rem */
    height: 9rem; /* Increased by 20% from 7.5rem */
    display: flex;
    align-items: center;
    justify-content: center;
    order: 2; /* Put sprite after name and popup */
}

.pet-sprite img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.7));
}

.pet-sprite:hover {
    transform: scale(1.1);
}

.pet-name {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 
        1px 1px 0px #000000,
        -1px -1px 0px #000000,
        1px -1px 0px #000000,
        -1px 1px 0px #000000;
    order: 1; /* Put name above sprite */
    margin-bottom: 5px; /* Smaller gap between name and sprite */
    z-index: 4; /* Ensure name appears above everything */
    position: relative;
}

.mood-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2.5rem;
    animation: pulse 2s infinite;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.8));
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.stats-panel {
    grid-area: stats;
    padding: 80px 16px 16px 16px; /* Increased top padding from 50px to 80px */
    width: 100%; /* Fill entire available width */
    height: 100%; /* Fill entire available height */
    overflow-y: auto; /* Allow scrolling if content overflows */
    margin: 0; /* Remove any margin */
    border-radius: 0; /* Remove border radius to fill edge to edge */
}

.stats-panel h3 {
    margin-bottom: 25px;
    color: #ffff00;
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 
        1px 1px 0px #000000,
        -1px -1px 0px #000000,
        1px -1px 0px #000000,
        -1px 1px 0px #000000;
}

.stat {
    margin-bottom: 12px;
}

.stat-label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
    color: #ffff00;
    font-size: 0.95rem;
    text-shadow: 1px 1px 0px #000000;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid #000;
    border-radius: 2px;
    overflow: hidden;
    margin: 2px 0;
}

.progress-bar.health {
    background: #8B0000; /* Dark red background like RuneScape */
    border: 2px solid #000;
    height: 14px;
}

.progress-bar.experience {
    background: #4a4a4a; /* Dark grey background */
    border: 2px solid #000;
    height: 14px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff00 0%, #90EE90 100%);
    transition: width 0.3s ease;
    border-radius: 1px;
}

.progress-bar.health .progress-fill {
    background: linear-gradient(90deg, #00ff00 0%, #32CD32 50%, #00ff00 100%); /* Bright green like RuneScape */
}

.progress-bar.experience .progress-fill {
    background: linear-gradient(90deg, #8A2BE2 0%, #9370DB 50%, #8A2BE2 100%); /* Purple like RuneScape */
}

.stat-value {
    font-size: 0.9rem;
    color: #e2e8f0;
    font-weight: bold;
    text-shadow: 1px 1px 0px #000000;
}

/* Movement Instructions */
.movement-instructions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #4a5568;
}

.movement-instructions .stat-value {
    font-size: 0.8rem;
    color: #cbd5e0;
    font-style: italic;
}

/* ===== MOBILE ROTATION PROMPT ===== */
.rotation-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 50%, #1a202c 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.rotation-content {
    text-align: center;
    padding: 40px 30px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    border: 2px solid #68d391;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 350px;
    margin: 20px;
}

.phone-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.rotate-icon {
    font-size: 3rem;
    margin: 10px 0;
    animation: rotate 2s infinite;
}

.landscape-icon {
    font-size: 4rem;
    margin: 20px 0;
    transform: rotate(90deg);
    animation: glow 2s infinite alternate;
}

.rotation-content h2 {
    color: #68d391;
    font-size: 24px;
    margin: 20px 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.rotation-content p {
    color: #e2e8f0;
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 25px;
}

.dismiss-btn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: #e2e8f0;
    border: 2px solid #68d391;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.dismiss-btn:hover {
    background: linear-gradient(135deg, #68d391 0%, #48bb78 100%);
    color: #1a202c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(90deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(270deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px #68d391, 0 0 20px #68d391, 0 0 30px #68d391;
    }
    to {
        text-shadow: 0 0 20px #48bb78, 0 0 30px #48bb78, 0 0 40px #48bb78;
    }
}

/* Show rotation prompt only on mobile in portrait mode */
@media (max-width: 768px) and (orientation: portrait) {
    .rotation-prompt {
        display: flex;
    }
    
    /* Hide main content when rotation prompt is shown */
    .rotation-prompt.show ~ .container {
        display: none;
    }
}

/* Hide rotation prompt in landscape mode or when dismissed */
@media (max-width: 768px) and (orientation: landscape) {
    .rotation-prompt {
        display: none !important;
    }
}

/* Never show on desktop */
@media (min-width: 769px) {
    .rotation-prompt {
        display: none !important;
    }
}

/* ===== COMPREHENSIVE MOBILE OPTIMIZATION ===== */

/* Enhanced Mobile Movement Controls */
.mobile-movement-controls {
    margin-top: 15px;
    display: block;
    padding: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 99998;
    pointer-events: auto;
}

.movement-pad {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    position: relative;
    z-index: 99999;
    pointer-events: auto;
}

.arrow-btn {
    width: 60px;
    height: 60px;
    border: 3px solid #4a5568;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: #e2e8f0;
    font-size: 1.8rem;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 2px 2px 0px #000000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    pointer-events: auto !important;
    position: relative;
    z-index: 99999;
    outline: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.arrow-btn:hover, .arrow-btn:active, .arrow-btn:focus {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.6);
    border-color: #68d391;
}

.arrow-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* Mobile-specific optimizations */
@media (max-width: 1024px) {
    /* Ensure all UI elements are properly sized for tablets */
    .game-container {
        max-width: 100%;
        padding: 10px;
    }
    
    .pet-display {
        height: 350px;
        min-height: 350px;
    }
    
    .ui-panel {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .action-btn {
        min-width: 120px;
        padding: 12px 16px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    /* Tablet and mobile optimization */
    body {
        font-size: 11px;
        -webkit-text-size-adjust: 100%;
        -webkit-font-smoothing: antialiased;
        overflow-x: hidden;
        padding: 0;
        margin: 0;
    }
    
    .game-container {
        padding: 1px;
        max-width: 100vw;
        overflow-x: hidden;
        min-height: 100vh;
        box-sizing: border-box;
    }
    
    .container {
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Ultra-compact pet display */
    .pet-display {
        height: 160px;
        min-height: 160px;
        position: relative;
        overflow: hidden;
        margin-bottom: 3px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ultra-compact stats panel */
    .stats-panel {
        padding: 2px 4px;
        gap: 2px;
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(10px);
        flex-wrap: wrap;
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .stat {
        padding: 2px 4px;
        min-width: 60px;
        font-size: 9px;
        margin: 1px;
        border-radius: 3px;
        flex: 1;
        text-align: center;
        max-width: calc(33.33% - 4px);
        box-sizing: border-box;
        overflow: hidden;
        white-space: nowrap;
    }
    
    .stat-label {
        font-size: 8px;
        font-weight: 600;
        display: block;
        margin-bottom: 1px;
    }
    
    .stat-value {
        font-size: 9px;
        font-weight: bold;
    }
    
    /* Compact movement instructions - hide completely */
    .movement-instructions {
        display: none !important;
    }
    
    /* Ultra-compact mobile UI panel */
    .ui-panel {
        flex-wrap: wrap;
        gap: 2px;
        padding: 2px;
        justify-content: center;
        background: rgba(0, 0, 0, 0.8);
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .action-btn {
        min-width: 60px;
        padding: 4px 6px;
        font-size: 9px;
        border-radius: 4px;
        flex: 1;
        max-width: calc(25% - 4px);
        margin: 1px;
        line-height: 1.1;
        box-sizing: border-box;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    /* Compact sidebar for mobile */
    .sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        right: 0 !important;
        top: 0 !important;
        max-height: none !important;
        order: 2;
        margin-top: 3px;
        box-sizing: border-box;
    }
    
    .main-content {
        width: 100% !important;
        margin-right: 0 !important;
        order: 1;
        box-sizing: border-box;
    }
    
    .sidebar-content {
        max-height: none !important;
        padding: 4px;
        box-sizing: border-box;
    }
    
    /* Ultra-compact mobile tabs */
    .ui-tab-vertical {
        padding: 4px 6px;
        font-size: 10px;
        min-height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 1px 0;
        box-sizing: border-box;
        overflow: hidden;
        white-space: nowrap;
    }
    
    /* Ultra-compact inventory */
    .inventory-grid {
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
        gap: 2px;
        padding: 3px;
        box-sizing: border-box;
        width: 100%;
        overflow: hidden;
    }
    
    .inventory-item {
        width: 45px;
        height: 45px;
        font-size: 14px;
        border-radius: 4px;
        border-width: 1px;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    /* Ultra-compact chat */
    .chat-messages {
        height: 100px;
        max-height: 100px;
        font-size: 9px;
        padding: 3px;
        line-height: 1.2;
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .chat-input-container {
        padding: 3px;
        gap: 3px;
        box-sizing: border-box;
        width: 100%;
    }
    
    .chat-input-container input {
        font-size: 12px; /* Prevent zoom on iOS */
        padding: 4px;
        border-radius: 4px;
        height: 28px;
        flex: 1;
        box-sizing: border-box;
        min-width: 0;
    }
    
    .send-btn {
        padding: 4px 8px;
        font-size: 10px;
        min-width: 35px;
        height: 28px;
        box-sizing: border-box;
        flex-shrink: 0;
    }
    
    /* Ultra-compact overlays */
    .popup-overlay, .overlay {
        padding: 5px;
        backdrop-filter: blur(8px);
        box-sizing: border-box;
    }
    
    .popup, .battle-screen, .game-over-screen {
        width: 95vw;
        max-width: 300px;
        max-height: 80vh;
        overflow-y: auto;
        border-radius: 6px;
        padding: 8px;
        font-size: 10px;
        box-sizing: border-box;
        margin: auto;
    }
    
    /* Ultra-compact chest overlay */
    .chest-overlay {
        width: 90vw;
        max-width: 250px;
        padding: 8px;
        border-radius: 6px;
        box-sizing: border-box;
    }
    
    #chestOpenBtn {
        padding: 6px 12px;
        font-size: 11px;
        min-height: 32px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ultra-compact mobile movement controls */
    .mobile-movement-controls {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 6px;
        padding: 4px;
        margin: 3px 0;
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
        width: 100%;
        box-sizing: border-box;
    }
    
    .movement-pad {
        gap: 6px;
        padding: 2px 0;
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
    }
    
    .arrow-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
        border-radius: 6px;
        border: 2px solid #68d391;
        background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        box-sizing: border-box;
        flex-shrink: 0;
    }
    
    .arrow-btn:active {
        background: linear-gradient(135deg, #2f855a 0%, #276749 100%);
        transform: scale(0.95);
    }
    
    /* Ultra-compact progress bars */
    .progress-bar {
        height: 8px;
        border-radius: 4px;
        border: 1px solid #4a5568;
        width: 100%;
        box-sizing: border-box;
    }
    
    .progress-bar-fill {
        border-radius: 3px;
        height: 100%;
        box-sizing: border-box;
    }
    
    /* Ultra-compact form elements */
    input, textarea, select {
        font-size: 12px !important;
        padding: 4px;
        border-radius: 4px;
        border: 1px solid #4a5568;
        background: rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
    }
    
    /* Ultra-compact button optimization */
    button, .btn {
        min-height: 28px;
        padding: 4px 6px;
        font-size: 10px;
        border-radius: 4px;
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        box-sizing: border-box;
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    /* Ultra-compact pet name and level display */
    .pet-info h2 {
        font-size: 14px;
        margin: 1px 0;
    }
    
    .pet-info p {
        font-size: 9px;
        margin: 1px 0;
    }
    
    /* Ultra-compact battle interface */
    .battle-actions {
        gap: 2px;
        padding: 4px;
        flex-wrap: wrap;
    }
    
    .battle-btn {
        padding: 4px 6px;
        font-size: 9px;
        min-width: 50px;
        flex: 1;
        box-sizing: border-box;
    }
    
    /* Ultra-compact status messages */
    .status-message {
        font-size: 9px;
        padding: 2px 4px;
        margin: 1px 0;
        box-sizing: border-box;
    }
    
    /* Settings buttons */
    .settings-btn {
        width: 100%;
        padding: 6px 8px;
        font-size: 10px;
        margin: 2px 0;
        box-sizing: border-box;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .setting-item {
        width: 100%;
        box-sizing: border-box;
        margin: 2px 0;
    }
    
    /* Ensure tab content doesn't overflow */
    .tab-content {
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        padding: 4px;
    }
    
    /* Allow overflow for inventory content to show tooltips */
    .tab-content#inventoryContent {
        overflow: visible;
    }
    
    /* Fix any remaining overflow issues */
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    /* Prevent horizontal scrolling globally */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
}

@media (max-width: 480px) {
    /* Ultra-small mobile phones optimization */
    body {
        font-size: 11px;
    }
    
    .game-container {
        padding: 1px;
    }
    
    .pet-display {
        height: 150px;
        min-height: 150px;
    }
    
    .stats-panel {
        padding: 3px;
        gap: 2px;
        flex-direction: column;
    }
    
    .stat {
        padding: 2px 4px;
        min-width: 60px;
        font-size: 9px;
        margin: 1px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-direction: row;
    }
    
    .stat-label {
        font-size: 8px;
        margin-bottom: 0;
        margin-right: 4px;
    }
    
    .stat-value {
        font-size: 9px;
    }
    
    .ui-panel {
        gap: 2px;
        padding: 3px;
        flex-direction: column;
    }
    
    .action-btn {
        min-width: 60px;
        padding: 4px 6px;
        font-size: 9px;
        margin: 1px 0;
        width: 100%;
    }
    
    .arrow-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .movement-pad {
        gap: 6px;
        padding: 2px 0;
    }
    
    .mobile-movement-controls {
        padding: 4px;
        margin: 3px 0;
    }
    
    .popup, .battle-screen, .game-over-screen {
        width: 98%;
        padding: 8px;
        font-size: 10px;
    }
    
    .chest-overlay {
        width: 95%;
        padding: 8px;
    }
    
    #chestOpenBtn {
        padding: 6px 12px;
        font-size: 10px;
        min-height: 28px;
    }
    
    .inventory-item {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 2px;
        padding: 3px;
    }
    
    .chat-messages {
        height: 80px;
        font-size: 9px;
        padding: 3px;
    }
    
    .chat-input-container {
        padding: 3px;
        gap: 3px;
    }
    
    .chat-input-container input {
        font-size: 12px;
        padding: 4px;
        height: 24px;
    }
    
    .send-btn {
        padding: 4px 6px;
        font-size: 9px;
        min-width: 30px;
        height: 24px;
    }
    
    .ui-tab-vertical {
        padding: 4px 6px;
        font-size: 9px;
        min-height: 24px;
    }
    
    .sidebar-content {
        padding: 4px;
    }
    
    .progress-bar {
        height: 8px;
    }
    
    /* Stack everything vertically on very small screens */
    .stats-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ui-panel {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        text-align: center;
    }
}

/* Mobile landscape optimization */
@media (max-width: 926px) and (orientation: landscape) {
    .pet-display {
        height: 200px;
        min-height: 200px;
    }
    
    .stats-panel {
        flex-wrap: wrap;
        max-height: none;
    }
    
    /* Only apply full-width sidebar for larger landscape screens, not compact mobile */
    .sidebar {
        position: relative !important;
    }
    
    .mobile-movement-controls {
        margin: 10px 0;
    }
    
    .arrow-btn {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .game-container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    .pet-display {
        -webkit-overflow-scrolling: touch;
    }
    
    input, textarea {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
}

/* Mobile landscape optimizations for compact right side UI - HIGHEST PRIORITY */
@media screen and (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
    body .sidebar {
        width: 280px !important;
        height: 25vh !important;
        position: fixed !important;
        right: 10px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 12px !important;
        overflow-y: auto !important;
        z-index: 1000 !important;
    }
    
    .sidebar h3 {
        font-size: 14px;
        margin: 8px 0 4px 0;
    }
    
    .sidebar .pet-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin: 8px 0;
    }
    
    .sidebar button {
        padding: 6px 8px;
        font-size: 11px;
        margin: 2px 0;
    }
    
    .sidebar .stats div {
        margin: 3px 0;
        font-size: 11px;
    }
    
    .sidebar .message {
        font-size: 8px;
        padding: 3px;
        margin: 2px 0;
        max-height: 40px;
        overflow-y: auto;
        line-height: 1.2;
        border-radius: 3px;
    }
    
    .game-content {
        margin-right: 300px;
    }
    
    .pet-display {
        width: calc(100% - 300px);
        margin-right: 10px;
    }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .arrow-btn {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
}

/* High DPI displays optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .pet-sprite img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .arrow-btn {
        border-width: 2px;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .pet-container {
        will-change: transform;
        transform: translateZ(0);
    }
    
    .progress-bar-fill {
        will-change: width;
    }
    
    .popup-overlay {
        -webkit-overflow-scrolling: touch;
    }
}

.arrow-btn:hover {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: #718096;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.arrow-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.arrow-btn.jump {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    border-color: #68d391;
    color: #f7fafc;
}

.arrow-btn.jump:hover {
    background: linear-gradient(135deg, #68d391 0%, #48bb78 100%);
    border-color: #9ae6b4;
}

/* Treasure Chest Styles */
.treasure-chest {
    position: absolute;
    right: 20px;
    bottom: 9%; /* Lifted from 3% to 9% (6% higher) */
    z-index: 2;
    display: block; /* Always visible */
}

.chest-image {
    width: 80px;
    height: 80px;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.7));
    transition: transform 0.3s ease;
    cursor: url('cursor2-small.png'), pointer !important;
}

.treasure-chest:hover .chest-image {
    transform: scale(1.05);
}

/* Chest Interaction Overlay */
.chest-overlay {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background: rgba(51, 25, 0, 0.95); /* Dark brown overlay */
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    animation: slideUp 0.3s ease-out;
    z-index: 10;
    min-width: 140px;
    text-align: center;
    display: none; /* Force hidden by default */
}

.chest-overlay.show {
    display: block;
}

.chest-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chest-open-btn {
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
    color: #FFD700;
    border: 2px solid #DAA520;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.chest-open-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #A0522D 0%, #8B4513 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.chest-open-btn:disabled {
    background: linear-gradient(135deg, #666666 0%, #444444 100%);
    color: #999999;
    border-color: #666666;
    cursor: not-allowed;
    opacity: 0.7;
}

.chest-cooldown {
    color: #FFA500;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Chest Overlay Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Alternative blue overlay option */
.chest-overlay.blue-theme {
    background: rgba(25, 25, 51, 0.95); /* Blueish overlay */
    border-color: #4169E1;
}

.chest-overlay.blue-theme .chest-open-btn {
    background: linear-gradient(135deg, #4169E1 0%, #1E3A8A 100%);
    border-color: #6495ED;
}

.chest-overlay.blue-theme .chest-open-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5A7FE1 0%, #4169E1 100%);
}

/* Treasure Chest Glow Animation */
@keyframes glow {
    0%, 100% {
        filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.7)) drop-shadow(0 0 10px rgba(255,215,0,0.5));
    }
    50% {
        filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.7)) drop-shadow(0 0 20px rgba(255,215,0,0.8));
    }
}

.action-panel {
    padding: 15px;
}

.action-panel h3 {
    margin-bottom: 15px;
    color: #ffff00;
    text-align: center;
    font-size: 1.4rem;
    font-weight: bold;
    text-shadow: 
        1px 1px 0px #000000,
        -1px -1px 0px #000000,
        1px -1px 0px #000000,
        -1px 1px 0px #000000;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Changed from 3 to 2 columns */
    gap: 8px;
    max-height: 300px; /* Prevent overflow */
    overflow-y: auto; /* Add scroll if needed */
}

.action-btn {
    padding: 10px 6px; /* Slightly reduced padding */
    border: 3px solid;
    border-radius: 6px;
    font-size: 0.9rem; /* Slightly smaller font */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffff00;
    text-shadow: 1px 1px 0px #000000;
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    font-family: 'Trebuchet MS', Arial, sans-serif;
    word-wrap: break-word; /* Prevent text overflow */
}

.action-btn.feed { 
    border-color: #7da373 #2d4025 #2d4025 #7da373;
    background: linear-gradient(135deg, #4a6741 0%, #2d4025 100%);
}
.action-btn.play { 
    border-color: #d4af37 #8b7500 #8b7500 #d4af37;
    background: linear-gradient(135deg, #b8860b 0%, #8b7500 100%);
}
.action-btn.sleep { 
    border-color: #9370db #4b0082 #4b0082 #9370db;
    background: linear-gradient(135deg, #8a2be2 0%, #4b0082 100%);
}
.action-btn.train { 
    border-color: #cd5c5c #8b0000 #8b0000 #cd5c5c;
    background: linear-gradient(135deg, #dc143c 0%, #8b0000 100%);
}
.action-btn.explore { 
    border-color: #4682b4 #2f4f4f #2f4f4f #4682b4;
    background: linear-gradient(135deg, #5f9ea0 0%, #2f4f4f 100%);
}
.action-btn.battle { 
    border-color: #ff6347 #8b0000 #8b0000 #ff6347;
    background: linear-gradient(135deg, #ff4500 0%, #8b0000 100%);
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.4),
        0 3px 6px rgba(0,0,0,0.5);
}

.action-btn:active {
    transform: translateY(1px);
    box-shadow: 
        inset 2px 2px 4px rgba(0,0,0,0.5),
        0 1px 2px rgba(0,0,0,0.3);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.inventory-panel {
    padding: 15px;
}

.inventory-panel h3 {
    margin-bottom: 15px;
    color: #ffff00;
    text-align: center;
    font-size: 1.4rem;
    font-weight: bold;
    text-shadow: 
        1px 1px 0px #000000,
        -1px -1px 0px #000000,
        1px -1px 0px #000000,
        -1px 1px 0px #000000;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Reduced to 3 columns for better fit */
    gap: 8px;
    max-height: none; /* Remove height restriction */
    overflow: visible; /* Allow content to be visible */
    margin: 0 auto 10px auto; /* Center the grid horizontally */
    width: fit-content; /* Make grid only as wide as needed */
    justify-content: center; /* Center grid items */
}

.inventory-item {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #3c2f1e 0%, #2d1f0f 100%);
    border: 2px solid;
    border-color: #5c3e2a #1a0f08 #1a0f08 #5c3e2a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: url('cursor2-small.png'), pointer !important;
    transition: all 0.2s ease;
    box-shadow: 
        inset 1px 1px 2px rgba(0,0,0,0.8),
        0 2px 4px rgba(0,0,0,0.6);
    pointer-events: auto !important;
    position: relative;
    z-index: 100;
}

.inventory-item:hover {
    border-color: #d4af37 #8b7500 #8b7500 #d4af37;
    background: linear-gradient(135deg, #4a3d2a 0%, #3c2f1e 100%);
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.2),
        0 3px 6px rgba(0,0,0,0.7);
}

.inventory-item:active {
    transform: translateY(1px);
    box-shadow: 
        inset 2px 2px 4px rgba(0,0,0,0.8),
        0 1px 2px rgba(0,0,0,0.4);
}

/* Gold slot styling */
.gold-slot {
    flex-direction: column !important;
    padding: 6px;
    background: linear-gradient(135deg, #4a3d2a 0%, #3c2f1e 100%) !important;
    min-height: 60px; /* Ensure adequate height for content */
}

.gold-slot:hover {
    cursor: url('cursor2-small.png'), pointer !important;
    border-color: #5c3e2a #1a0f08 #1a0f08 #5c3e2a !important;
    background: linear-gradient(135deg, #4a3d2a 0%, #3c2f1e 100%) !important;
    transform: none !important;
}

.gold-emoji {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.gold-amount {
    font-size: 0.65rem;
    color: #00ff00;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    font-family: 'Courier New', monospace;
    line-height: 1;
}

/* Gold Tooltip */
.gold-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    white-space: nowrap;
    z-index: 9999;
    border: 1px solid #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.gold-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.gold-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.9);
}

/* Gold tooltip positioning variations */
.gold-tooltip.tooltip-below::after {
    top: -5px;
    bottom: auto;
    border-top: none;
    border-bottom: 5px solid rgba(0, 0, 0, 0.9);
}

.gold-tooltip.tooltip-left::after {
    left: 20px;
}

.gold-tooltip.tooltip-right::after {
    left: auto;
    right: 20px;
}

/* WoW-Style Item Tooltip */
.item-tooltip {
    position: fixed;
    min-width: 200px;
    max-width: 250px;
    background: linear-gradient(180deg, #0b0b23 0%, #1a1a3a  100%);
    border: 2px solid #4a90e2;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: 'Arial', sans-serif;
    font-size: 0.75rem;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    box-shadow: 
        0 0 10px rgba(74, 144, 226, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.item-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.item-tooltip.rare {
    background: linear-gradient(180deg, #1a1a3a 0%, #2a2a5a 100%);
    border-color: #0070dd;
    box-shadow: 
        0 0 10px rgba(0, 112, 221, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.6);
}

.item-tooltip.epic {
    background: linear-gradient(180deg, #2a1a3a 0%, #4a2a5a 100%);
    border-color: #a335ee;
    box-shadow: 
        0 0 10px rgba(163, 53, 238, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.6);
}

.item-tooltip.legendary {
    background: linear-gradient(180deg, #3a2a1a 0%, #5a4a2a 100%);
    border-color: #ffd700;
    box-shadow: 
        0 0 15px rgba(255, 215, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.7);
}

.item-tooltip-header {
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

.item-tooltip-name {
    font-weight: bold;
    font-size: 0.8rem;
    color: #ffd100;
    margin-bottom: 2px;
}

.item-tooltip-type {
    font-size: 0.65rem;
    color: #cccccc;
    font-style: italic;
}

.item-tooltip-stats {
    margin: 6px 0;
    padding: 4px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.item-tooltip-stat {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
    font-size: 0.7rem;
}

.item-tooltip-stat-name {
    color: #00ff96;
}

.item-tooltip-stat-value {
    color: #ffffff;
    font-weight: bold;
}

.item-tooltip-description {
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    color: #ffff88;
    font-style: italic;
    line-height: 1.3;
}

.item-tooltip-footer {
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.65rem;
    color: #cccccc;
    text-align: center;
}

.item-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top: 6px solid #4a90e2;
}

.item-tooltip.rare::after {
    border-top-color: #0070dd;
}

.item-tooltip.epic::after {
    border-top-color: #a335ee;
}

.item-tooltip.legendary::after {
    border-top-color: #ffd700;
}

/* Tooltip positioning variations - arrows adjusted for different positions */
.item-tooltip.tooltip-below::after {
    top: -6px;
    bottom: auto;
    border-top: none;
    border-bottom: 6px solid #4a90e2;
}

.item-tooltip.tooltip-below.rare::after {
    border-bottom-color: #0070dd;
}

.item-tooltip.tooltip-below.epic::after {
    border-bottom-color: #a335ee;
}

.item-tooltip.tooltip-below.legendary::after {
    border-bottom-color: #ffd700;
}

.item-tooltip.tooltip-left::after {
    left: 20px;
}

.item-tooltip.tooltip-right::after {
    left: auto;
    right: 20px;
}

/* Right UI Panel */
.right-ui-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh; /* Full height to cover entire right side */
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 50%, #4a3d2a 100%); /* Changed to brown to match panels */
    border-left: 3px solid #7da373;
    display: flex;
    z-index: 1000;
    padding-bottom: 0;
    pointer-events: auto !important;
    /* Add brown panel styling to match other UI elements */
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.3),
        inset -2px -2px 4px rgba(0,0,0,0.5),
        0 4px 8px rgba(0,0,0,0.6);
}

.ui-tabs-vertical {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #4a3d2a 0%, #3c2f1e 100%);
    border-right: 2px solid #1a0f08;
    padding: 10px 0;
    width: 80px;
}

.ui-tab-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    margin: 2px 5px;
    background: linear-gradient(135deg, #6d5a42 0%, #4a3d2a 100%);
    border: 2px solid;
    border-color: #8b7355 #2d1f0f #2d1f0f #8b7355;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ui-tab-vertical:hover {
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    border-color: #a0845f #3c2f1e #3c2f1e #a0845f;
}

.ui-tab-vertical.active {
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    border-right: 2px solid #8b7355;
    margin-right: -2px;
}

.ui-content-vertical {
    flex: 1;
    margin: 0; /* Remove all margins to extend to all edges */
    padding: 15px;
    overflow-y: auto; /* Allow vertical scrolling for content */
    height: 100vh; /* Full viewport height from top to bottom */
    box-sizing: border-box; /* Include padding in height calculation */
}

/* Bottom Chat Panel */
.bottom-chat-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 300px; /* Further reduced from 310px to cover the green gap completely */
    height: 300px; /* Much taller chat area */
    background: linear-gradient(135deg, #2d5016 0%, #1a3009 100%);
    border-top: 3px solid #7da373;
    border-right: 3px solid #7da373; /* Add border to separate from right panel */
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.chat-tabs {
    display: flex;
    background: linear-gradient(135deg, #4a3d2a 0%, #3c2f1e 100%);
    border-bottom: 2px solid #1a0f08;
    padding: 0 10px;
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 4px; /* Smaller gap */
    padding: 6px 12px; /* Smaller padding */
    margin: 4px 2px 0; /* Smaller margin */
    background: linear-gradient(135deg, #6d5a42 0%, #4a3d2a 100%);
    border: 2px solid;
    border-color: #8b7355 #2d1f0f #2d1f0f #8b7355;
    border-bottom: none;
    border-radius: 6px 6px 0 0; /* Smaller radius */
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px; /* Smaller minimum width */
}

.chat-tab:hover {
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    border-color: #a0845f #3c2f1e #3c2f1e #a0845f;
}

.chat-tab.active {
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    border-bottom: 2px solid #8b7355;
    margin-bottom: -2px;
}

.chat-tab .tab-icon {
    font-size: 1.1rem; /* Smaller icon */
}

.chat-tab .tab-label {
    font-size: 0.75rem; /* Smaller label */
    color: #ffff00;
    font-weight: bold;
    text-shadow: 1px 1px 0px #000000;
}

.chat-content {
    flex: 1;
    margin: 0 10px 10px 10px;
    padding: 12px; /* Slightly more padding */
    overflow: visible; /* Changed from hidden to visible */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Ensure proper flexbox behavior */
}

.chat-tab-content {
    display: none;
    height: 100%;
    flex-direction: column;
    min-height: 0; /* Ensure proper flexbox behavior */
}

.chat-tab-content.active {
    display: flex;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px; /* More padding */
    background: linear-gradient(135deg, #2d1f0f 0%, #1a1108 100%);
    border: 2px solid;
    border-color: #1a0f08 #5c3e2a #5c3e2a #1a0f08;
    border-radius: 4px;
    margin-bottom: 10px; /* More margin */
    font-size: 0.9rem; /* Slightly larger text */
    line-height: 1.4; /* Better line height */
}

.chat-message {
    margin-bottom: 4px;
    color: #e2e8f0;
    text-shadow: 1px 1px 0px #000000;
}

.username {
    color: #d4af37;
    font-weight: bold;
}

.system-message {
    color: #7da373;
    font-style: italic;
    margin-bottom: 4px;
}

.chat-input-container {
    flex-shrink: 0; /* Prevent the input container from shrinking */
    display: flex;
    gap: 10px; /* Slightly more gap */
}

.chat-input-container input {
    flex: 1;
    padding: 8px 10px; /* More padding */
    background: linear-gradient(135deg, #3c2f1e 0%, #2d1f0f 100%);
    border: 2px solid;
    border-color: #1a0f08 #5c3e2a #5c3e2a #1a0f08;
    border-radius: 4px;
    color: #ffff00;
    font-family: 'Trebuchet MS', Arial, sans-serif;
    font-size: 0.95rem; /* Slightly larger font */
}

.chat-input-container input:focus {
    outline: none;
    border-color: #d4af37 #8b7500 #8b7500 #d4af37;
}

.send-btn {
    padding: 8px 16px; /* More padding */
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    border: 2px solid;
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    border-radius: 4px;
    color: #ffff00;
    font-weight: bold;
    font-family: 'Trebuchet MS', Arial, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 1px 1px 0px #000000;
    font-size: 0.9rem; /* Slightly larger font */
}

.send-btn:hover {
    background: linear-gradient(135deg, #a0845f 0%, #8b7355 100%);
    transform: translateY(-1px);
}

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

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #2d1f0f;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8b7355 0%, #5c3e2a 100%);
    border-radius: 4px;
    border: 1px solid #3c2f1e;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a0845f 0%, #6d5a42 100%);
}

/* Settings Panel */
.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-item label {
    color: #ffff00;
    font-weight: bold;
    text-shadow: 1px 1px 0px #000000;
}

.setting-item input {
    padding: 8px;
    background: linear-gradient(135deg, #3c2f1e 0%, #2d1f0f 100%);
    border: 2px solid;
    border-color: #1a0f08 #5c3e2a #5c3e2a #1a0f08;
    border-radius: 4px;
    color: #ffff00;
    font-family: 'Trebuchet MS', Arial, sans-serif;
}

.setting-item input:focus {
    outline: none;
    border-color: #d4af37 #8b7500 #8b7500 #d4af37;
}

.settings-btn {
    padding: 10px 15px;
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    border: 3px solid;
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    border-radius: 6px;
    color: #ffff00;
    font-weight: bold;
    font-family: 'Trebuchet MS', Arial, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 1px 1px 0px #000000;
}

.settings-btn:hover {
    background: linear-gradient(135deg, #a0845f 0%, #8b7355 100%);
    transform: translateY(-1px);
}

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

.tab-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.tab-label {
    font-size: 0.8rem;
    color: #ffff00;
    font-weight: bold;
    text-shadow: 1px 1px 0px #000000;
    text-align: center;
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    margin-bottom: 15px;
    color: #ffff00;
    text-align: center;
    font-size: 1.4rem;
    font-weight: bold;
    text-shadow: 
        1px 1px 0px #000000,
        -1px -1px 0px #000000,
        1px -1px 0px #000000,
        -1px 1px 0px #000000;
}

/* Activity Log in Chat */
.log-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px; /* More padding to match chat */
    background: linear-gradient(135deg, #2d1f0f 0%, #1a1108 100%);
    border: 2px solid;
    border-color: #1a0f08 #5c3e2a #5c3e2a #1a0f08;
    border-radius: 4px;
    font-size: 0.9rem; /* Slightly larger to match chat */
    line-height: 1.4; /* Better line height */
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.8);
}

.log-content p {
    margin-bottom: 6px;
    padding: 4px 6px;
    border-left: 3px solid #d4af37;
    padding-left: 8px;
    color: #e2e8f0;
    text-shadow: 1px 1px 0px #000000;
}

.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #2d1f0f;
    border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8b7355 0%, #5c3e2a 100%);
    border-radius: 4px;
    border: 1px solid #3c2f1e;
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a0845f 0%, #6d5a42 100%);
}

/* Responsive Design */
@media (max-width: 1200px) {
    body {
        padding-right: 280px;
        padding-bottom: 320px; /* Adjust for taller chat */
    }
    
    .right-ui-panel {
        width: 260px;
        height: 100vh; /* Full height */
    }
    
    .bottom-chat-bar {
        right: 260px; /* Further reduced to cover gap for smaller right panel */
    }
    
    main {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "pet"
            "stats";
    }
    
    .stats-panel {
        max-width: none;
    }
}

@media (max-width: 768px) {
    body {
        padding-right: 0;
        padding-bottom: 480px; /* More space for mobile with much taller chat */
        font-size: 16px; /* Ensure proper text size on mobile */
    }
    
    .right-ui-panel {
        position: fixed;
        top: auto;
        bottom: 240px; /* Above much taller chat */
        left: 0;
        right: 0;
        width: 100%;
        height: 240px; /* Taller mobile panel */
        border-left: none;
        border-top: 3px solid #7da373;
        flex-direction: column;
        padding-bottom: 0;
    }
    
    .ui-tabs-vertical {
        flex-direction: row;
        width: 100%;
        padding: 5px 10px;
        gap: 5px; /* Add gap between tabs */
    }
    
    .ui-tab-vertical {
        flex: 1;
        margin: 0 2px;
        padding: 12px 4px; /* Increased padding for touch */
        min-height: 60px; /* Ensure minimum touch target */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .ui-content-vertical {
        margin: 0 10px 10px 10px;
        height: auto; /* Reset height for mobile */
        overflow-y: auto;
    }
    
    .bottom-chat-bar {
        right: 0; /* Full width on mobile */
        border-right: none;
        height: 220px; /* Taller mobile chat */
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr); /* Keep 2 columns on mobile */
        gap: 12px; /* Increased gap for touch */
    }
    
    .action-btn {
        padding: 16px 12px; /* Larger touch targets */
        font-size: 1rem;
        min-height: 60px; /* Ensure good touch target size */
    }
    
    .inventory-grid {
        grid-template-columns: repeat(3, 1fr); /* Fewer columns on mobile */
        gap: 8px; /* Better spacing */
    }
    
    .inventory-item {
        padding: 16px 8px; /* Larger touch targets */
        min-height: 80px; /* Ensure good touch target */
    }
    
    header {
        right: 0; /* Full width on mobile */
        font-size: 0.9rem;
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem; /* Reduced for mobile */
        margin: 0;
    }
    
    .ca-announcement {
        margin-top: 8px;
    }
    
    .ca-input {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    main {
        top: 100px; /* Adjust for mobile header */
        right: 0; /* Full width */
        bottom: 480px; /* Above mobile UI */
        grid-template-columns: 1fr;
        grid-template-areas: 
            "pet"
            "stats";
        gap: 10px;
        padding: 10px;
    }
    
    .pet-display {
        min-height: 250px; /* Ensure adequate space for pet */
    }
    
    /* Mobile background adjustments */
    .pet-display.pet-turtle {
        background-size: cover;
        background-position: center bottom;
    }
    
    .pet-display.pet-snail {
        background-size: cover;
        background-position: center center;
    }
    
    .pet-display.pet-tiger {
        background-size: cover;
        background-position: center 75%;
    }
    
    .pet-sprite {
        font-size: 7.2rem; /* Increased by 20% from 6rem */
        width: 7.2rem; /* Increased by 20% from 6rem */
        height: 7.2rem; /* Increased by 20% from 6rem */
        position: relative;
        z-index: 3; /* Ensure pet emoji is clearly visible above background */
        text-shadow: 2px 2px 4px rgba(0,0,0,0.8), -1px -1px 2px rgba(255,255,255,0.3);
    }
    
    .pet-container {
        padding-bottom: 2%; /* Reduced from 5% to make pets even lower on mobile */
    }
    
    .pet-name {
        font-size: 1.5rem;
        margin-top: 10px;
    }
    
    /* Treasure Chest Mobile Styles */
    .treasure-chest {
        bottom: 11%; /* Lifted from 5% to 11% (6% higher) */
        right: 15px;
    }
    
    .chest-image {
        width: 60px;
        height: 60px;
    }
    
    .chest-overlay {
        min-width: 120px;
        padding: 10px 12px;
        margin-bottom: 8px;
    }
    
    .chest-open-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .chest-cooldown {
        font-size: 0.7rem;
    }
    
    .stats-panel {
        padding: 15px;
        max-height: none; /* Remove height restriction */
    }
    
    .tab-icon {
        font-size: 1.5rem; /* Larger icons for touch */
    }
    
    .tab-label {
        font-size: 0.8rem;
        margin-top: 4px;
    }
    
    .chat-tab .tab-icon {
        font-size: 1.2rem;
    }
    
    .chat-tab .tab-label {
        font-size: 0.8rem;
    }
    
    .chat-input-container input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }
    
    .chat-messages {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    /* Settings panel mobile optimization */
    .settings-panel .setting-item {
        margin-bottom: 15px;
    }
    
    .settings-btn {
        padding: 12px 16px;
        font-size: 1rem;
        width: 100%;
        min-height: 48px;
    }
    
    #petNameInput {
        font-size: 16px; /* Prevent zoom */
        padding: 12px;
        width: 100%;
    }
}

/* Pumpfun Info Panel Styling */
.pumpfun-panel {
    padding: 10px;
}

.pumpfun-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(60, 47, 30, 0.3);
    border-radius: 4px;
    border: 1px solid #5c3e2a;
}

.pumpfun-item label {
    font-weight: bold;
    color: #d4af37;
    font-size: 0.9rem;
}

.pumpfun-item span {
    color: #e6d4b7;
    font-size: 0.9rem;
}

.pumpfun-details {
    margin: 15px 0;
    padding: 10px;
    background: rgba(60, 47, 30, 0.3);
    border-radius: 4px;
    border: 1px solid #5c3e2a;
}

.pumpfun-details h4 {
    color: #d4af37;
    margin: 0 0 10px 0;
    font-size: 1rem;
}

.pumpfun-details p {
    color: #e6d4b7;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 8px 0;
}

.pumpfun-reward {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(60, 47, 30, 0.3);
    border-radius: 4px;
    border: 1px solid #5c3e2a;
}

.reward-btn {
    background: linear-gradient(135deg, #4a3d2a 0%, #3c2f1e 100%);
    border: 2px solid;
    border-color: #5c3e2a #1a0f08 #1a0f08 #5c3e2a;
    border-radius: 4px;
    color: #e6d4b7;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 8px 12px;
    transition: all 0.2s;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reward-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5c3e2a 0%, #4a3d2a 100%);
    border-color: #6b4d35 #2a1f0f #2a1f0f #6b4d35;
    transform: translateY(-1px);
}

.reward-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #2d1f0f;
}

.reward-text {
    color: #e6d4b7;
    font-size: 0.9rem;
    flex: 1;
}

/* Radio Widget */
.radio-widget {
    margin-top: 10px;
    padding: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
}

.radio-panel {
    padding: 5px;
}

.radio-description {
    margin-top: 15px;
    padding: 10px;
    background: rgba(60, 47, 30, 0.3);
    border-radius: 4px;
    border: 1px solid #5c3e2a;
}

.radio-description p {
    color: #e6d4b7;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 8px 0;
    text-shadow: 1px 1px 0px #000000;
}

.radio-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.radio-btn {
    background: linear-gradient(135deg, #8b7355 0%, #6d5a42 100%);
    border: 2px solid;
    border-color: #d4c4a0 #3c2f1e #3c2f1e #d4c4a0;
    color: #ffff00;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 85px;
    text-shadow: 1px 1px 0px #000000;
    font-weight: bold;
}

.radio-btn:hover {
    background: linear-gradient(135deg, #a0845f 0%, #8b7355 100%);
    transform: translateY(-1px);
}

.radio-btn:active {
    transform: translateY(0px);
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.5);
}

.radio-btn.active {
    background: linear-gradient(135deg, #4a7c26 0%, #3d6b1f 100%);
    border-color: #7da373 #2d5016 #2d5016 #7da373;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.3);
}

.mute-btn.muted {
    background: linear-gradient(135deg, #8b4355 0%, #6d4242 100%);
    border-color: #d4a0a0 #3c1e1e #3c1e1e #d4a0a0;
}

.radio-info {
    text-align: center;
    font-size: 0.8rem;
    color: #ffff00;
    margin-top: 8px;
    text-shadow: 1px 1px 0px #000000;
    opacity: 0.9;
    font-weight: bold;
}

/* Mobile radio widget adjustments */
@media (max-width: 768px) {
    .radio-widget {
        margin-top: 8px;
        padding: 6px;
    }
    
    .radio-controls {
        gap: 6px;
        margin-bottom: 8px;
    }
    
    .radio-btn {
        padding: 10px 8px;
        font-size: 0.8rem;
        min-width: 75px;
        min-height: 40px;
    }
    
    .radio-info {
        font-size: 0.75rem;
        margin-top: 6px;
    }
    
    .radio-description {
        margin-top: 12px;
        padding: 8px;
    }
    
    .radio-description p {
        font-size: 0.8rem;
        margin: 6px 0;
    }
}

/* ===== LEVEL UP POPUP & CONFETTI ANIMATION ===== */

.level-up-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.level-up-popup.show {
    opacity: 1;
    visibility: visible;
}

.level-up-content {
    background: linear-gradient(145deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    border: 3px solid #e6c200;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.8),
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.6);
    animation: levelUpBounce 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.level-up-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
    animation: shimmer 2s ease-in-out infinite;
}

.level-up-text h1 {
    color: #8b4513;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 
        2px 2px 0 #ffd700,
        -2px -2px 0 #ffd700,
        2px -2px 0 #ffd700,
        -2px 2px 0 #ffd700,
        4px 4px 8px rgba(0, 0, 0, 0.5);
    margin: 0 0 20px 0;
    animation: textGlow 1.5s ease-in-out infinite alternate;
}

.level-display {
    margin: 20px 0;
}

.level-number {
    font-size: 4rem;
    font-weight: bold;
    color: #8b4513;
    text-shadow: 
        3px 3px 0 #e6c200,
        -3px -3px 0 #e6c200,
        3px -3px 0 #e6c200,
        -3px 3px 0 #e6c200,
        6px 6px 12px rgba(0, 0, 0, 0.6);
    animation: numberPulse 1s ease-in-out infinite;
}

.level-up-text p {
    color: #8b4513;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    margin: 20px 0 0 0;
}

/* Confetti Animation */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff6b9d;
    animation: confettiFall 3s linear infinite;
}

.confetti:nth-child(2n) { background: #4ecdc4; }
.confetti:nth-child(3n) { background: #ffe66d; }
.confetti:nth-child(4n) { background: #ff6b6b; }
.confetti:nth-child(5n) { background: #a8e6cf; }
.confetti:nth-child(6n) { background: #ffd93d; }
.confetti:nth-child(7n) { background: #6bcf7f; }
.confetti:nth-child(8n) { background: #ff8b94; }

/* Animations */
@keyframes levelUpBounce {
    0% {
        transform: scale(0.3) rotateX(60deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotateX(0deg);
    }
    100% {
        transform: scale(1) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes textGlow {
    0% {
        text-shadow: 
            2px 2px 0 #ffd700,
            -2px -2px 0 #ffd700,
            2px -2px 0 #ffd700,
            -2px 2px 0 #ffd700,
            4px 4px 8px rgba(0, 0, 0, 0.5);
    }
    100% {
        text-shadow: 
            2px 2px 0 #ffed4e,
            -2px -2px 0 #ffed4e,
            2px -2px 0 #ffed4e,
            -2px 2px 0 #ffed4e,
            4px 4px 12px rgba(255, 215, 0, 0.8);
    }
}

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

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotateZ(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotateZ(720deg);
        opacity: 0;
    }
}

/* Mobile responsive adjustments for level up popup */
@media (max-width: 768px) {
    .level-up-content {
        padding: 30px 20px;
        margin: 20px;
        border-radius: 15px;
    }
    
    .level-up-text h1 {
        font-size: 2rem;
    }
    
    .level-number {
        font-size: 3rem;
    }
    
    .level-up-text p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .level-up-content {
        padding: 25px 15px;
        margin: 15px;
    }
    
    .level-up-text h1 {
        font-size: 1.5rem;
    }
    
    .level-number {
        font-size: 2.5rem;
    }
    
    .level-up-text p {
        font-size: 0.9rem;
    }
}

/* ===== MOBILE TOUCH OPTIMIZATIONS ===== */

/* Prevent zoom on double tap */
* {
    touch-action: manipulation;
}

/* Prevent text selection on mobile */
body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for input fields and chat */
input, textarea, .chat-messages, .log-content {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Improve tap targets for mobile */
button, .arrow-btn, .tab-button, .inventory-item {
    min-height: 44px;
    min-width: 44px;
}

/* Prevent highlight flash on mobile tap */
button, .arrow-btn, .tab-button, .inventory-item {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Ensure smooth scrolling on mobile */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Mobile safari specific fixes */
@supports (-webkit-overflow-scrolling: touch) {
    .chat-messages, .log-content, .inventory-grid {
        -webkit-overflow-scrolling: touch;
    }
}

/* COMPLETELY OVERHAULED LANDSCAPE MOBILE LAYOUT - CLEAN & FUNCTIONAL */
/* This approach uses floating overlays and optimized positioning for landscape mobile */
@media screen and (orientation: landscape) and (max-width: 950px) and (min-width: 300px) {
    
    /* === HEADER CONTENT 50% SMALLER === */
    html body header,
    body header,
    header {
        padding: 4px !important; /* 50% smaller padding (was 8px) */
        height: auto !important;
        min-height: 30px !important; /* 50% smaller min height */
        width: calc(100vw - 300px) !important; /* Extend to sidebar left edge */
        position: fixed !important;
        top: 0px !important;
        left: 0px !important;
        z-index: 8000 !important;
    }
    
    html body header h1,
    body header h1,
    header h1 {
        font-size: 12px !important; /* 50% smaller font (was 24px typically) */
        margin: 2px 0 !important; /* 50% smaller margins */
        line-height: 1.2 !important;
    }
    
    html body header .stats-panel,
    body header .stats-panel,
    header .stats-panel {
        padding: 2px 4px !important; /* 50% smaller padding */
        font-size: 6px !important; /* 50% smaller font */
        gap: 3px !important; /* 50% smaller gap */
    }
    
    html body header .stat-item,
    body header .stat-item,
    header .stat-item {
        padding: 1px 3px !important; /* 50% smaller padding */
        font-size: 6px !important; /* 50% smaller font */
        min-height: 12px !important; /* 50% smaller height */
    }
    
    html body header .stat-icon,
    body header .stat-icon,
    header .stat-icon {
        font-size: 8px !important; /* 50% smaller icon */
        margin-right: 2px !important; /* 50% smaller margin */
    }
    
    html body header .stat-value,
    body header .stat-value,
    header .stat-value {
        font-size: 6px !important; /* 50% smaller font */
    }
    
    /* === CONTRACT ADDRESS 50% SMALLER === */
    html body header .ca-announcement,
    body header .ca-announcement,
    header .ca-announcement {
        gap: 4px !important; /* 50% smaller gap (was 8px) */
        margin-top: 3px !important; /* 50% smaller margin (was 6px) */
        padding: 4px 8px !important; /* 50% smaller padding (was 8px 16px) */
        border-radius: 3px !important; /* 50% smaller border radius (was 6px) */
        min-height: 15px !important; /* 50% smaller height */
    }
    
    html body header .ca-label,
    body header .ca-label,
    header .ca-label {
        font-size: 0.45rem !important; /* 50% smaller font (was 0.9rem) */
    }
    
    html body header .ca-container,
    body header .ca-container,
    header .ca-container {
        gap: 3px !important; /* 50% smaller gap (was 6px) */
        border-radius: 2.5px !important; /* 50% smaller border radius (was 5px) */
        padding: 3px 5px !important; /* 50% smaller padding (was 6px 10px) */
        min-width: 90px !important; /* 50% smaller min width (was 180px) */
        min-height: 12px !important; /* 50% smaller height */
    }
    
    html body header .ca-input,
    body header .ca-input,
    header .ca-input {
        font-size: 0.4rem !important; /* 50% smaller font */
        padding: 1px 2px !important; /* 50% smaller padding */
        height: 10px !important; /* 50% smaller height */
    }
    
    html body header .copy-icon,
    body header .copy-icon,
    header .copy-icon {
        font-size: 0.4rem !important; /* 50% smaller icon */
    }
    
    /* === CORE LAYOUT RESET === */
    /* Reset the main game area to fit between left edge and Pet Stats UI */
    html body .pet-display,
    body .pet-display,
    .pet-display {
        width: calc(100vw - 460px) !important; /* Extend to Pet Stats UI left edge (300px sidebar + 160px stats) */
        height: 100vh !important; /* Full height to be flush with chat area */
        margin: 0 !important; /* No margins */
        padding: 0 !important;
        position: fixed !important; /* Fixed positioning for precise control */
        overflow: hidden !important;
        left: 0 !important; /* Align to left edge */
        top: 0 !important; /* Start at top, then adjust with padding */
        padding-top: 60px !important; /* Push content down to clear header */
        box-sizing: border-box !important; /* Include padding in height calculation */
        max-width: calc(100vw - 460px) !important; /* Ensure it doesn't exceed the calculated space */
    }
    
    /* === PET ELEMENTS PROPORTIONAL FOR MOBILE LANDSCAPE === */
    /* Make pet, pet name, and chest proportional to phone display */
    html body .pet-display .pet,
    body .pet-display .pet,
    .pet-display .pet {
        transform: scale(0.7) translateY(10%) !important; /* 70% size + move down 10% to center in full height */
        transform-origin: center !important;
        max-width: 120px !important; /* Maximum width constraint */
        max-height: 120px !important; /* Maximum height constraint */
    }
    
    html body .pet-display .pet img,
    body .pet-display .pet img,
    .pet-display .pet img {
        max-width: 100% !important; /* Ensure image fits within container */
        max-height: 100% !important;
        object-fit: contain !important; /* Maintain aspect ratio */
    }
    
    html body .pet-display .pet-name,
    body .pet-display .pet-name,
    .pet-display .pet-name {
        font-size: 0.7rem !important; /* 70% smaller font for better readability */
        transform: scale(0.8) !important; /* 80% scale for proportional sizing */
        transform-origin: center !important;
        white-space: nowrap !important; /* Prevent wrapping */
        max-width: 150px !important; /* Maximum width constraint */
        overflow: hidden !important;
        text-overflow: ellipsis !important; /* Handle long names gracefully */
    }
    
    html body .pet-display .treasure-chest,
    body .pet-display .treasure-chest,
    .pet-display .treasure-chest {
        transform: scale(0.7) translateY(-40%) !important; /* 70% size + standard positioning */
        transform-origin: center !important;
    }
    
    html body .pet-display .chest-image,
    body .pet-display .chest-image,
    .pet-display .chest-image {
        width: 35px !important; /* Proportional size for mobile */
        height: 35px !important;
        transform: scale(0.8) !important; /* Additional scaling for proportion */
    }
    
    /* === PET STATS PANEL OVERLAY === */
    /* Position Pet Stats panel on the right side next to the sidebar, flush with bottom */
    html body main .stats-panel,
    body main .stats-panel,
    main .stats-panel {
        position: fixed !important;
        width: 160px !important; /* Reduced by 40px (was 200px) */
        height: calc(100vh - 60px) !important; /* Match pet screen height */
        max-height: none !important; /* Remove max-height constraint */
        right: 300px !important; /* Left edge flush with chat UI right edge */
        top: 60px !important; /* Align with pet screen top */
        bottom: 0px !important; /* Flush with bottom of screen */
        z-index: 9000 !important; /* High priority but below sidebar */
        background: linear-gradient(135deg, #8b7355 0%, #6d5a42 50%, #4a3d2a 100%) !important; /* Brown UI gradient */
        border: 2px solid #8B4513 !important;
        border-radius: 8px !important;
        padding: 8px !important;
        font-size: 8px !important;
        overflow-y: auto !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
        display: block !important; /* Ensure it's visible */
    }
    
    /* Pet Stats panel content styling - MUCH SMALLER FOR MOVEMENT BUTTON VISIBILITY */
    html body main .stats-panel h3,
    body main .stats-panel h3,
    main .stats-panel h3 {
        font-size: 0.6rem !important; /* Much smaller title */
        margin: 0 0 6px 0 !important; /* Reduced margin significantly */
        color: #ffff00 !important; /* Same yellow as desktop */
        text-align: center !important;
        font-weight: bold !important;
        text-shadow: 
            1px 1px 0px #000000,
            -1px -1px 0px #000000,
            1px -1px 0px #000000,
            -1px 1px 0px #000000 !important; /* Same text shadow as desktop */
    }
    
    html body main .stats-panel .stat,
    body main .stats-panel .stat,
    main .stats-panel .stat {
        margin: 0 0 4px 0 !important; /* Much smaller margin between stats */
        font-size: inherit !important; /* Use default font sizing */
        line-height: 1 !important; /* Tighter line height */
    }
    
    html body main .stats-panel .stat-label,
    body main .stats-panel .stat-label,
    main .stats-panel .stat-label {
        display: block !important;
        font-weight: bold !important;
        margin-bottom: 1px !important; /* Minimal margin */
        color: #ffff00 !important; /* Same yellow as desktop */
        font-size: 0.5rem !important; /* Much smaller font */
        text-shadow: 1px 1px 0px #000000 !important; /* Same text shadow as desktop */
    }
    
    html body main .stats-panel .stat-value,
    body main .stats-panel .stat-value,
    main .stats-panel .stat-value {
        font-size: 0.45rem !important; /* Much smaller font */
        color: #e2e8f0 !important; /* Same as desktop */
        font-weight: bold !important;
        text-shadow: 1px 1px 0px #000000 !important; /* Same text shadow as desktop */
    }
    
    html body main .stats-panel .progress-bar,
    body main .stats-panel .progress-bar,
    main .stats-panel .progress-bar {
        width: 100% !important;
        height: 6px !important; /* Much smaller progress bars */
        background: rgba(0,0,0,0.3) !important; /* Same as desktop */
        border: 1px solid #000 !important; /* Same as desktop */
        border-radius: 2px !important; /* Same as desktop */
        overflow: hidden !important;
        margin: 1px 0 !important; /* Minimal margin */
    }
    
    /* Health progress bar styling - much smaller */
    html body main .stats-panel .progress-bar.health,
    body main .stats-panel .progress-bar.health,
    main .stats-panel .progress-bar.health {
        background: #8B0000 !important; /* Dark red background like desktop */
        border: 1px solid #000 !important; /* Thinner border */
        height: 6px !important; /* Much smaller height */
    }
    
    /* Experience progress bar styling - much smaller */
    html body main .stats-panel .progress-bar.experience,
    body main .stats-panel .progress-bar.experience,
    main .stats-panel .progress-bar.experience {
        background: #4a4a4a !important; /* Dark grey background like desktop */
        border: 1px solid #000 !important; /* Thinner border */
        height: 6px !important; /* Much smaller height */
    }
    
    /* Progress fill styling - same as desktop */
    html body main .stats-panel .progress-fill,
    body main .stats-panel .progress-fill,
    main .stats-panel .progress-fill {
        height: 100% !important;
        background: linear-gradient(90deg, #00ff00 0%, #90EE90 100%) !important; /* Same as desktop */
        transition: width 0.3s ease !important;
        border-radius: 1px !important;
    }
    
    /* Health progress fill - same as desktop */
    html body main .stats-panel .progress-bar.health .progress-fill,
    body main .stats-panel .progress-bar.health .progress-fill,
    main .stats-panel .progress-bar.health .progress-fill {
        background: linear-gradient(90deg, #00ff00 0%, #32CD32 50%, #00ff00 100%) !important; /* Bright green like desktop */
    }
    
    /* Experience progress fill - same as desktop */
    html body main .stats-panel .progress-bar.experience .progress-fill,
    body main .stats-panel .progress-bar.experience .progress-fill,
    main .stats-panel .progress-bar.experience .progress-fill {
        background: linear-gradient(90deg, #8A2BE2 0%, #9370DB 50%, #8A2BE2 100%) !important; /* Purple like desktop */
    }
    
    /* Show mobile movement controls in landscape mode - VERY COMPACT FOR VISIBILITY */
    html body main .stats-panel .mobile-movement-controls,
    body main .stats-panel .mobile-movement-controls,
    main .stats-panel .mobile-movement-controls {
        display: block !important; /* Show the controls */
        margin-top: 4px !important; /* Much smaller margin */
        padding-top: 4px !important; /* Much smaller padding */
        border-top: 1px solid #4a5568 !important; /* Same border as desktop */
    }
    
    /* Style the movement pad for better mobile landscape experience - COMPACT */
    html body main .stats-panel .movement-pad,
    body main .stats-panel .movement-pad,
    main .stats-panel .movement-pad {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2px !important; /* Reduced from 3px */
        padding: 3px !important; /* Reduced from 4px */
    }
    
    /* Style arrow buttons for mobile landscape - SMALLER */
    html body main .stats-panel .arrow-btn,
    body main .stats-panel .arrow-btn,
    main .stats-panel .arrow-btn {
        width: 22px !important; /* Reduced from 25px */
        height: 22px !important; /* Reduced from 25px */
        font-size: 9px !important; /* Reduced from 10px */
        padding: 1px !important; /* Reduced from 2px */
        margin: 1px !important;
        background: rgba(139, 69, 19, 0.8) !important; /* Brown theme */
        border: 1px solid #8B4513 !important;
        border-radius: 3px !important; /* Reduced from 4px */
        color: #FFF !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
    }
    
    /* Hover effects for arrow buttons */
    html body main .stats-panel .arrow-btn:hover,
    body main .stats-panel .arrow-btn:hover,
    main .stats-panel .arrow-btn:hover {
        background: rgba(139, 69, 19, 1) !important;
        transform: scale(1.05) !important;
    }
    
    /* Active state for arrow buttons */
    html body main .stats-panel .arrow-btn:active,
    body main .stats-panel .arrow-btn:active,
    main .stats-panel .arrow-btn:active {
        transform: scale(0.95) !important;
        background: rgba(105, 52, 14, 1) !important;
    }
    
    html body main .stats-panel .movement-instructions,
    body main .stats-panel .movement-instructions,
    main .stats-panel .movement-instructions {
        margin-top: 4px !important; /* Much smaller margin */
        padding-top: 4px !important; /* Much smaller padding */
        border-top: 1px solid #4a5568 !important; /* Same border as desktop */
    }
    
    html body main .stats-panel .movement-instructions .stat-value,
    body main .stats-panel .movement-instructions .stat-value,
    main .stats-panel .movement-instructions .stat-value {
        font-size: 0.4rem !important; /* Much smaller font for instructions */
        color: #cbd5e0 !important; /* Same as desktop */
        font-style: italic !important; /* Same as desktop */
    }
    
    /* === FLOATING SIDEBAR OVERLAY === */
    /* Transform sidebar into a larger floating overlay extending full height flush with screen edges */
    html body .right-ui-panel,
    body .right-ui-panel,
    .right-ui-panel {
        position: fixed !important;
        width: 300px !important; /* 300px as requested */
        height: 100vh !important; /* Full screen height - flush with screen */
        right: 0px !important; /* Flush with right edge of screen */
        top: 0px !important; /* Flush with top edge */
        bottom: 0px !important; /* Flush with bottom edge */
        z-index: 10000 !important; /* Highest priority */
        background: rgba(0, 0, 0, 0.9) !important;
        border: 2px solid #8B4513 !important;
        border-radius: 8px !important;
        padding: 8px !important;
        transform: none !important;
        font-size: 10px !important;
        overflow: hidden !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
        display: flex !important;
        flex-direction: row !important; /* Side-by-side layout for vertical tabs */
    }
    
    /* Vertical tabs on the left side of sidebar */
    html body .ui-tabs-vertical,
    body .ui-tabs-vertical,
    .ui-tabs-vertical {
        display: flex !important;
        flex-direction: column !important; /* Vertical tabs as requested */
        gap: 3px !important;
        margin-right: 8px !important;
        flex-shrink: 0 !important;
        width: 60px !important; /* Wider for better touch targets */
    }
    
    html body .ui-tab-vertical,
    body .ui-tab-vertical,
    .ui-tab-vertical {
        width: 60px !important; /* Increased width for better usability */
        height: 40px !important; /* Increased height for better touch targets */
        font-size: 8px !important;
        padding: 4px !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        border-radius: 4px !important;
        background: rgba(0, 0, 0, 0.3) !important;
        border: 1px solid #555 !important;
    }
    
    html body .ui-tab-vertical.active,
    body .ui-tab-vertical.active,
    .ui-tab-vertical.active {
        background: rgba(139, 69, 19, 0.6) !important;
        border-color: #8B4513 !important;
    }
    
    html body .tab-icon,
    body .tab-icon,
    .tab-icon {
        font-size: 12px !important; /* Larger icon for better visibility */
        margin: 0 0 2px 0 !important;
    }
    
    html body .tab-label,
    body .tab-label,
    .tab-label {
        font-size: 7px !important; /* Readable label size */
        margin: 0 !important;
        line-height: 1 !important;
        text-align: center !important;
    }
    
    /* Tab content area takes remaining space in sidebar */
    html body .tab-content-area,
    body .tab-content-area,
    .tab-content-area {
        flex: 1 !important;
        height: 100% !important; /* Full height of sidebar */
        font-size: 9px !important; /* Slightly larger for 300px width */
        padding: 6px !important;
        overflow-y: auto !important;
        background: rgba(0, 0, 0, 0.3) !important;
        border: 1px solid #555 !important;
        border-radius: 4px !important;
        display: block !important;
    }
    
    html body .tab-content,
    body .tab-content,
    .tab-content {
        height: 100% !important;
        font-size: 9px !important; /* Slightly larger for better readability */
        padding: 4px !important;
        overflow-y: auto !important;
    }
    
    html body .tab-content h3,
    body .tab-content h3,
    .tab-content h3 {
        font-size: 11px !important; /* Larger heading for 300px width */
        margin: 4px 0 !important;
        color: #FFD700 !important;
    }
    
    html body .tab-content button,
    body .tab-content button,
    .tab-content button {
        padding: 4px 8px !important; /* More padding for 300px width */
        font-size: 8px !important; /* Readable button text */
        margin: 2px 0 !important;
        min-height: 26px !important; /* Good touch target */
        width: 100% !important;
        border-radius: 3px !important;
    }
    
    /* Pet stats display */
    html body .tab-content .stats,
    body .tab-content .stats,
    .tab-content .stats {
        font-size: 8px !important;
        line-height: 1.3 !important;
        color: #FFF !important;
    }
    
    html body .tab-content .stats div,
    body .tab-content .stats div,
    .tab-content .stats div {
        margin: 2px 0 !important;
        padding: 1px 0 !important;
    }
    
    /* Pet buttons grid for actions */
    html body .tab-content .pet-buttons,
    body .tab-content .pet-buttons,
    .tab-content .pet-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 4px !important;
        margin: 6px 0 !important;
    }
    
    /* Inventory grid */
    html body .tab-content .inventory-grid,
    body .tab-content .inventory-grid,
    .tab-content .inventory-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 3px !important; /* Slightly more gap for 300px width */
        margin: 6px 0 !important;
    }
    
    html body .tab-content .inventory-item,
    body .tab-content .inventory-item,
    .tab-content .inventory-item {
        min-height: 35px !important; /* Better touch targets for inventory */
        font-size: 8px !important;
    }
    
    /* === FLOATING CHAT OVERLAY === */
    /* Transform chat to extend from left edge to Pet Stats UI */
    html body .bottom-chat-bar,
    body .bottom-chat-bar,
    .bottom-chat-bar {
        position: fixed !important;
        width: calc(100vw - 480px) !important; /* Flush with Pet Stats UI left edge */
        height: 120px !important; /* Compact height */
        left: 0px !important; /* Flush with left side of screen */
        bottom: 0px !important; /* Flush with bottom of screen */
        z-index: 9999 !important;
        background: rgba(0, 0, 0, 0.9) !important;
        border: none !important; /* Remove border for flush alignment */
        border-radius: 0px !important; /* Remove border radius for flush alignment */
        padding: 6px !important;
        transform: none !important;
        overflow: hidden !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
    }
    
    /* Compact chat tabs */
    html body .chat-tabs,
    body .chat-tabs,
    .chat-tabs {
        display: flex !important;
        gap: 2px !important;
        margin-bottom: 5px !important;
        height: 20px !important;
    }
    
    html body .chat-tab,
    body .chat-tab,
    .chat-tab {
        padding: 2px 6px !important;
        font-size: 7px !important;
        height: 20px !important;
        border-radius: 3px !important;
        display: flex !important;
        align-items: center !important;
        gap: 3px !important;
    }
    
    html body .chat-tab .tab-icon,
    body .chat-tab .tab-icon,
    .chat-tab .tab-icon {
        font-size: 8px !important;
    }
    
    html body .chat-tab .tab-label,
    body .chat-tab .tab-label,
    .chat-tab .tab-label {
        font-size: 6px !important;
    }
    
    /* Compact chat content */
    html body .chat-content,
    body .chat-content,
    .chat-content {
        height: calc(100% - 30px) !important; /* Account for tabs */
        padding: 3px !important;
        background: rgba(0, 0, 0, 0.3) !important;
        border: 1px solid #555 !important;
        border-radius: 3px !important;
    }
    
    html body .chat-messages,
    body .chat-messages,
    .chat-messages {
        height: 50px !important; /* Fixed reasonable height */
        font-size: 7px !important;
        overflow-y: auto !important;
        margin-bottom: 3px !important;
        line-height: 1.1 !important;
        padding: 2px !important;
    }
    
    html body .chat-input-container,
    body .chat-input-container,
    .chat-input-container {
        display: flex !important;
        gap: 3px !important;
        height: 25px !important;
        align-items: center !important;
    }
    
    html body .chat-input-container input,
    body .chat-input-container input,
    .chat-input-container input {
        flex: 1 !important;
        height: 20px !important;
        font-size: 7px !important;
        padding: 2px 4px !important;
        border-radius: 3px !important;
    }
    
    html body .chat-input-container .send-btn,
    body .chat-input-container .send-btn,
    .chat-input-container .send-btn {
        height: 16px !important; /* Smaller height */
        padding: 1px 4px !important; /* Smaller padding */
        font-size: 6px !important; /* Smaller font */
        min-width: 25px !important; /* Smaller minimum width */
        border-radius: 2px !important; /* Smaller border radius */
    }
    
    /* === GAME AREA CLEANUP === */
    /* Ensure game content doesn't interfere with floating overlays */
    html body .game-content,
    body .game-content,
    .game-content {
        margin: 0 !important; /* Remove all margins */
        padding: 0 !important;
        width: 100% !important;
        height: 100vh !important;
    }
    
    /* Make sure pet and treasure elements are properly positioned */
    html body .pet-container,
    body .pet-container,
    .pet-container {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    html body .treasure-chest,
    body .treasure-chest,
    .treasure-chest {
        position: absolute !important;
        right: 20px !important; /* Away from floating sidebar */
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    /* === HIDE DESKTOP ELEMENTS === */
    /* Hide any desktop-specific elements that don't work on mobile */
    html body .mobile-movement-controls,
    body .mobile-movement-controls,
    .mobile-movement-controls {
        display: none !important; /* Hide movement controls in landscape - use touch */
    }
    
    /* === RESPONSIVE ADJUSTMENTS === */
    /* For very small landscape screens */
    @media screen and (orientation: landscape) and (max-height: 400px) {
        html body .right-ui-panel,
        body .right-ui-panel,
        .right-ui-panel {
            height: 100vh !important; /* Full screen height - flush with screen edges */
            width: 280px !important; /* Slightly smaller but still substantial */
            top: 0px !important; /* Flush with top edge */
            bottom: 0px !important; /* Flush with bottom edge */
        }
        
        html body .ui-tab-vertical,
        body .ui-tab-vertical,
        .ui-tab-vertical {
            height: 35px !important; /* Smaller tabs for very small screens */
        }
        
        html body .bottom-chat-bar,
        body .bottom-chat-bar,
        .bottom-chat-bar {
            height: 100px !important;
            width: calc(100vw - 470px) !important; /* Dynamic width for small screens too */
            left: 0px !important; /* Flush with left edge */
            bottom: 0px !important; /* Maintain flush bottom even on small screens */
        }
    }
    
    /* === ACTION POPUPS PROPORTIONAL FOR MOBILE LANDSCAPE === */
    /* Make action popups smaller and better positioned for mobile */
    html body .action-popup,
    body .action-popup,
    .action-popup {
        font-size: 0.7rem !important; /* Smaller font for mobile */
        padding: 4px 8px !important; /* Reduced padding */
        border-radius: 4px !important; /* Smaller border radius */
        top: -40px !important; /* Closer to the pet */
        max-width: 120px !important; /* Prevent overflow on small screens */
        word-wrap: break-word !important; /* Handle long text */
        white-space: normal !important; /* Allow wrapping if needed */
        text-align: center !important; /* Center align text */
        box-shadow: 0 2px 6px rgba(0,0,0,0.4) !important; /* Slightly stronger shadow */
    }
    
    html body .action-popup.show,
    body .action-popup.show,
    .action-popup.show {
        transform: translateX(-50%) translateY(5px) !important; /* Smaller movement */
    }
    
    html body .action-popup.fade-out,
    body .action-popup.fade-out,
    .action-popup.fade-out {
        transform: translateX(-50%) translateY(-5px) !important; /* Smaller fade movement */
    }
    
    /* === STATUS MESSAGES PROPORTIONAL FOR MOBILE LANDSCAPE === */
    /* Make status messages smaller and better positioned */
    html body .status-message,
    body .status-message,
    .status-message {
        font-size: 0.6rem !important; /* Smaller font for mobile landscape */
        padding: 3px 6px !important; /* Reduced padding */
        margin: 2px 0 !important; /* Smaller margins */
        max-width: 200px !important; /* Prevent overflow */
        word-wrap: break-word !important; /* Handle long text */
        border-radius: 3px !important; /* Smaller border radius */
    }
    
    /* === NOTIFICATIONS AND FLOATING TEXT PROPORTIONAL === */
    /* Ensure any floating text or notifications are mobile-friendly */
    html body .floating-text,
    body .floating-text,
    .floating-text {
        font-size: 0.6rem !important; /* Smaller font */
        font-weight: bold !important;
        text-shadow: 1px 1px 0px #000000 !important; /* Maintain readability */
    }
    
    html body .notification,
    body .notification,
    .notification {
        font-size: 0.65rem !important; /* Slightly larger than floating text */
        padding: 4px 8px !important; /* Comfortable padding */
        max-width: 180px !important; /* Prevent overflow */
        border-radius: 4px !important; /* Rounded corners */
    }
}
