* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
    -webkit-text-size-adjust: 100%; /* Prevent text size adjustment on orientation change */
    touch-action: manipulation; /* Improve touch responsiveness */
}

.game-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background: transparent;
    max-width: 1400px;
    width: 100%;
}

/* Ultimate Reward Banner */
.ultimate-reward-banner {
    width: 100%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffd93d 50%, #6bcf7f 100%);
    border-radius: 15px;
    padding: 20px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 20px 60px rgba(0, 0, 0, 0.2),
                0 0 30px rgba(255, 215, 0, 0.4),
                inset 0 2px 0 rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    animation: ultimateBannerPulse 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    order: -1; /* Ensure banner appears at the top */
}

.ultimate-reward-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 70%);
    animation: ultimateShine 3s linear infinite;
}

@keyframes ultimateBannerPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                    0 20px 60px rgba(0, 0, 0, 0.2),
                    0 0 30px rgba(255, 215, 0, 0.4),
                    inset 0 2px 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 12px 50px rgba(0, 0, 0, 0.35),
                    0 25px 70px rgba(0, 0, 0, 0.25),
                    0 0 50px rgba(255, 215, 0, 0.6),
                    inset 0 2px 0 rgba(255, 255, 255, 0.5);
    }
}

@keyframes ultimateShine {
    0% {
        transform: translateX(-50%) translateY(-50%) rotate(45deg);
    }
    100% {
        transform: translateX(150%) translateY(50%) rotate(45deg);
    }
}

.ultimate-reward-icon {
    font-size: 60px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: ultimateIconBounce 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes ultimateIconBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(-5deg);
    }
    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.ultimate-reward-content {
    flex: 1;
    text-align: center;
    z-index: 1;
}

.ultimate-reward-title {
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4),
                 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
    animation: ultimateTextGlow 2s ease-in-out infinite;
    letter-spacing: 2px;
}

@keyframes ultimateTextGlow {
    0%, 100% {
        text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4),
                     0 1px 3px rgba(0, 0, 0, 0.3);
    }
    50% {
        text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4),
                     0 1px 3px rgba(0, 0, 0, 0.3),
                     0 0 20px rgba(255, 255, 255, 0.6);
    }
}

.ultimate-reward-name {
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5),
                 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.ultimate-reward-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.ultimate-reward-cost {
    font-size: 1.3em;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.ultimate-progress-bar-container {
    width: 100%;
    max-width: 600px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2),
                0 2px 4px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.ultimate-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 50%, #ffeb3b 100%);
    border-radius: 15px;
    transition: width 0.5s ease;
    position: relative;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.ultimate-progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.6), 
        transparent);
    animation: ultimateProgressShimmer 2s infinite;
}

@keyframes ultimateProgressShimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Desktop Layout - Ensure proper three-column layout */
@media (min-width: 1025px) {
    .game-container {
        flex-wrap: wrap; /* Allow wrapping so banner can be on its own row */
    }
    
    .ultimate-reward-banner {
        flex: 1 1 100%; /* Take full width and force to own row */
        width: 100%;
        order: -1;
    }
    
    .left-sidebar {
        flex: 0 0 260px; /* Don't grow or shrink, fixed 260px */
        order: 0;
    }
    
    .main-game-area {
        flex: 1 1 auto; /* Grow to fill remaining space */
        min-width: 0;
        order: 1;
    }
    
    .right-sidebar {
        flex: 0 0 280px; /* Don't grow or shrink, fixed 280px */
        order: 2;
    }
}

/* Left Sidebar */
.left-sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 20px 60px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: translateZ(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.left-sidebar:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35),
                0 25px 70px rgba(0, 0, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.left-sidebar h1 {
    color: #333;
    margin: 0;
    font-size: 2em;
    text-align: center;
}

.left-sidebar h3 {
    color: #667eea;
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.tagline {
    color: #667eea;
    font-size: 0.9em;
    margin: 0;
    font-weight: bold;
    text-align: center;
}

/* Right Sidebar - Active Quests */
.right-sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 20px 60px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: translateZ(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.right-sidebar:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35),
                0 25px 70px rgba(0, 0, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.right-sidebar h2 {
    color: #667eea;
    margin: 0;
    font-size: 1.5em;
    text-align: center;
}

/* Main Game Area */
.main-game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0; /* Allow flex item to shrink below its content size */
}

/* Position display removed */

/* Player Stats */
.player-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 10px;
    color: white;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4),
                0 4px 10px rgba(118, 75, 162, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateZ(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.player-stats h3 {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3),
                 0 1px 2px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    margin-bottom: 12px;
}

.player-stats:hover {
    transform: translateY(-3px) scale(1.02) translateZ(0);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5),
                0 6px 15px rgba(118, 75, 162, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Quest Acceptance Animation */
.player-stats.quest-accepted {
    animation: questAcceptPulse 0.6s ease-out;
}

@keyframes questAcceptPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4),
                    0 4px 10px rgba(118, 75, 162, 0.3),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 12px 40px rgba(102, 126, 234, 0.8),
                    0 8px 25px rgba(118, 75, 162, 0.6),
                    inset 0 2px 0 rgba(255, 255, 255, 0.3),
                    0 0 20px rgba(255, 215, 0, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4),
                    0 4px 10px rgba(118, 75, 162, 0.3),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    font-size: 1.1em;
    transition: transform 0.2s ease;
}

.stat-row:hover {
    transform: translateX(2px);
}

.stat-label {
    font-weight: bold;
}

.stat-value {
    color: #ffeb3b;
    font-weight: bold;
}

.stat-separator {
    margin: 0 3px;
    color: #ffeb3b;
}

.xp-bar-container {
    background: rgba(255, 255, 255, 0.3);
    height: 20px;
    border-radius: 10px;
    margin-top: 12px;
    overflow: hidden;
}

.xp-bar {
    background: linear-gradient(90deg, #ffeb3b 0%, #ffc107 100%);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

/* Player Quests Section (now in right sidebar) */
.player-quest-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.player-quest-list::-webkit-scrollbar {
    width: 6px;
}

.player-quest-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.player-quest-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

/* Hide scrollbar on mobile but keep functionality */
@media (max-width: 768px) {
    .player-quest-list::-webkit-scrollbar {
        width: 3px;
    }
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85em;
}

/* Info Section */
.info {
    background: #f8f8f8;
    padding: 15px;
    border-radius: 10px;
}

.info p {
    margin: 8px 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Current Location */
.current-location {
    background: #f8f8f8;
    padding: 12px;
    border-radius: 10px;
}

.current-location p {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    color: #333;
    font-weight: bold;
}

.room-quick-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.room-nav-btn {
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 8px 4px;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
                0 4px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(0);
    position: relative;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    min-height: 44px; /* Minimum touch target size */
}

.room-nav-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.room-nav-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15),
                0 8px 20px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.room-nav-btn:hover::before {
    opacity: 0.1;
}

.room-nav-btn:active {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.room-nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5),
                0 2px 8px rgba(118, 75, 162, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Touch-specific behavior */
@media (hover: none) and (pointer: coarse) {
    .room-nav-btn {
        min-height: 48px; /* Larger touch target on mobile */
    }
    
    .room-nav-btn:hover {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
                    0 4px 8px rgba(0, 0, 0, 0.05);
        border-color: #ddd;
    }
    
    .room-nav-btn:hover::before {
        opacity: 0;
    }
    
    .room-nav-btn:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

#position {
    color: #667eea;
    font-weight: bold;
}

/* Parent Mode Button */
.parent-mode-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2),
                0 6px 20px rgba(255, 152, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.parent-mode-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.parent-mode-btn:hover::before {
    width: 300px;
    height: 300px;
}

.parent-mode-btn:hover {
    background: linear-gradient(135deg, #fb8c00 0%, #ef6c00 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25),
                0 8px 30px rgba(255, 152, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.parent-mode-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

/* Room Navigation - Hidden (doors replace buttons) */
.room-nav {
    display: none;
}

/* Game World */
#game-world {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 600px;
    background:
        repeating-linear-gradient(
            0deg,
            #8bc34a 0px,
            #8bc34a 40px,
            #7cb342 40px,
            #7cb342 80px
        ),
        repeating-linear-gradient(
            90deg,
            #8bc34a 0px,
            #8bc34a 40px,
            #7cb342 40px,
            #7cb342 80px
        );
    border: 4px solid #333;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 20px 80px rgba(0, 0, 0, 0.2),
                inset 0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 -2px 4px rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateZ(0);
    transition: box-shadow 0.3s ease;
    touch-action: none; /* Allow custom touch handling */
}

#game-world:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.35),
                0 25px 90px rgba(0, 0, 0, 0.25),
                inset 0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 -2px 4px rgba(255, 255, 255, 0.1);
}

/* Container for NPCs - ensure it scales with game world */
#npcs-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#npcs-container > * {
    pointer-events: auto;
}

/* Obstacles/Furniture (rendered dynamically per room) */
.obstacle {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(139, 69, 19, 0.3);
    border-radius: 8px;
    border: 2px solid rgba(101, 67, 33, 0.6);
    z-index: 5;
    transition: all 0.2s;
}

.obstacle.furniture {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: help;
}

.obstacle.furniture:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Doors */
.door {
    position: absolute;
    width: 40px;
    height: 60px;
    background: linear-gradient(135deg, #8b4513 0%, #654321 100%);
    border: 4px solid #333;
    border-radius: 8px;
    z-index: 7;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4),
                0 8px 16px rgba(0, 0, 0, 0.2),
                inset 2px 2px 4px rgba(0, 0, 0, 0.3),
                inset -2px -2px 4px rgba(255, 255, 255, 0.1);
    transform: perspective(1000px) translateZ(0);
}

.door:hover {
    transform: perspective(1000px) translateY(-4px) scale(1.08) translateZ(10px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5),
                0 12px 24px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(255, 215, 0, 0.3),
                inset 2px 2px 4px rgba(0, 0, 0, 0.3),
                inset -2px -2px 4px rgba(255, 255, 255, 0.2);
}

.door:active {
    transform: perspective(1000px) translateY(-2px) scale(1.05) translateZ(5px);
}

.door::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ffd700;
    border-radius: 50%;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.5);
}

.door-label {
    font-size: 20px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.door-text {
    font-size: 8px;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    line-height: 1;
}

/* Door hover effect */
@keyframes doorGlow {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 8px 2px rgba(255, 255, 255, 0.6);
    }
}

.door:hover {
    animation: doorGlow 1s infinite;
}

/* Player - Roblox-style Character */
#player {
    position: absolute;
    width: 40px;
    height: 40px;
    transition: all 0.1s ease;
    z-index: 10;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3))
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transform: translateZ(0);
}

/* Head - More blocky like Roblox */
#player::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: #ffd1a3;
    border-radius: 4px;
    top: 0;
    left: 9px;
    border: 2px solid #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Body - Blockier torso like Roblox */
#player::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 18px;
    background: #2196f3;
    border-radius: 3px;
    top: 20px;
    left: 7px;
    border: 2px solid #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Eyes - created with a pseudo-element wrapper */
#player {
    --eye-color: #333;
}

/* Arms and legs container */
.player-limbs {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Eyes - Roblox style (two separate circular eyes) */
.player-eye {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #333;
    border-radius: 50%;
    top: 8px;
    z-index: 2;
}

.player-eye.left-eye {
    left: 13px;
}

.player-eye.right-eye {
    left: 22px;
}

/* Smile - Simple curved line */
.player-smile {
    position: absolute;
    width: 10px;
    height: 5px;
    border: 2px solid #333;
    border-top: none;
    border-radius: 0 0 8px 8px;
    top: 15px;
    left: 15px;
    z-index: 2;
}

/* Arms - Blockier like Roblox */
.player-arm {
    position: absolute;
    width: 5px;
    height: 16px;
    background: #ffd1a3;
    border: 1px solid #333;
    border-radius: 2px;
    top: 21px;
}

.left-arm {
    left: 2px;
}

.right-arm {
    right: 2px;
}

/* Legs - Blockier like Roblox */
.player-leg {
    position: absolute;
    width: 8px;
    height: 14px;
    background: #1976d2;
    border: 1px solid #333;
    border-radius: 2px;
    top: 36px;
}

.left-leg {
    left: 10px;
}

.right-leg {
    right: 10px;
}

/* Movement animation */
@keyframes move {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes walk-left {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

@keyframes walk-right {
    0%, 100% { transform: rotate(10deg); }
    50% { transform: rotate(-10deg); }
}

#player.moving {
    animation: move 0.2s ease;
}

#player.moving .left-leg {
    animation: walk-left 0.3s ease;
}

#player.moving .right-leg {
    animation: walk-right 0.3s ease;
}

#player.moving .left-arm {
    animation: walk-right 0.3s ease;
}

#player.moving .right-arm {
    animation: walk-left 0.3s ease;
}

/* Main Objects (NPCs without background) */
.main-object {
    position: absolute;
    width: 50px;
    height: 50px;
    z-index: 8;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3))
            drop-shadow(0 8px 12px rgba(0, 0, 0, 0.15));
    transform: translateZ(0);
}

.main-object:hover {
    transform: translateY(-6px) scale(1.25) translateZ(0);
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.4))
            drop-shadow(0 12px 20px rgba(0, 0, 0, 0.2))
            drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
    animation: floatBounce 0.6s ease-in-out;
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(-6px) scale(1.25); }
    50% { transform: translateY(-10px) scale(1.28); }
}

.main-object:active {
    transform: translateY(-3px) scale(1.2);
}

/* Interactive Objects (clickable furniture with levels) */
.interactive-object {
    position: absolute;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    border: 2px solid rgba(102, 126, 234, 0.4);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2),
                0 6px 12px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 6;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transform: translateZ(0);
}

.interactive-object:hover {
    transform: translateY(-5px) scale(1.18) translateZ(0);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3),
                0 12px 24px rgba(0, 0, 0, 0.15),
                0 0 15px rgba(102, 126, 234, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border-color: rgba(102, 126, 234, 0.8);
    background: rgba(255, 255, 255, 0.95);
    animation: wiggle 0.5s ease;
}

@keyframes wiggle {
    0%, 100% { transform: translateY(-5px) scale(1.18) rotate(0deg); }
    25% { transform: translateY(-5px) scale(1.18) rotate(-3deg); }
    75% { transform: translateY(-5px) scale(1.18) rotate(3deg); }
}

.interactive-object:active {
    transform: translateY(-2px) scale(1.12);
}

/* Level badge on interactive objects */
.object-level-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Old NPC styles - kept for backward compatibility */
.npc {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 8;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.npc:hover {
    transform: scale(1.15);
}

/* NPC with quest indicator - pulse animation */
@keyframes questPulse {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(255, 215, 0, 0.7);
    }
    50% {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 0 12px rgba(255, 215, 0, 0);
    }
}

.npc.has-quest {
    animation: questPulse 1.5s infinite;
    border-color: #ffd700;
}

.npc.has-quest::after {
    content: '!';
    position: absolute;
    top: -10px;
    right: -5px;
    background: #ffd700;
    color: #333;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #fff;
}

/* Panels */
.quest-panel,
.parent-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px; /* Add padding for mobile */
    overflow-y: auto; /* Allow scrolling if content is too tall */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.quest-panel-content,
.parent-panel-content {
    position: relative;
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Make sure modals don't bounce on iOS */
@supports (-webkit-touch-callout: none) {
    .quest-panel,
    .parent-panel {
        position: fixed;
        overflow: hidden;
    }
    
    .quest-panel-content,
    .parent-panel-content {
        max-height: 85vh;
    }
}

.quest-panel-content h2,
.parent-panel-content h2 {
    color: #333;
    margin-bottom: 15px;
}

.quest-panel-content h3,
.parent-panel-content h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
}

.quest-panel-content p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* NPC Header in Quest Panel */
.npc-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.npc-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.npc-dialogue {
    font-style: italic;
    background: #f8f8f8;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

/* Rename Pet Button */
.btn-rename {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-left: auto;
}

.btn-rename:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.quest-rewards {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.reward-item {
    margin: 8px 0;
    font-size: 1.1em;
}

.reward-label {
    font-weight: bold;
    color: #333;
}

.reward-value {
    color: #667eea;
    font-weight: bold;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1),
                0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateZ(0);
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation; /* Improve touch responsiveness */
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15),
                0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0) translateZ(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Touch-specific button behavior */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: translateY(0) translateZ(0);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1),
                    0 2px 4px rgba(0, 0, 0, 0.06);
    }
    
    .btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3),
                0 2px 4px rgba(118, 75, 162, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4),
                0 4px 8px rgba(118, 75, 162, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    color: #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #d0d0d0 0%, #a8a8a8 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
    box-shadow: 0 6px 12px rgba(244, 67, 54, 0.4);
}

.quest-panel-buttons,
.panel-buttons {
    margin-top: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 1em;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* Password Entry */
.password-entry {
    text-align: center;
}

.password-entry p {
    margin-bottom: 15px;
    font-weight: bold;
}

.password-entry input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    margin-bottom: 15px;
}

/* Quests List */
.quests-list {
    max-height: 300px;
    overflow-y: auto;
}

.quest-item {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    text-align: left;
}

.quest-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.quest-item-title {
    font-weight: bold;
    color: #333;
}

.quest-item-npc {
    padding: 5px 12px;
    border-radius: 15px;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.quest-item-description {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.quest-item-xp {
    color: #667eea;
    font-weight: bold;
}

.quest-item-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.85em;
    color: #999;
    margin-bottom: 8px;
}

.quest-item-meta span {
    white-space: nowrap;
}

/* Help Button */
.help-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.95em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2),
                0 6px 20px rgba(33, 150, 243, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    width: 100%;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.help-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.help-btn:hover::before {
    width: 300px;
    height: 300px;
}

.help-btn:hover {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25),
                0 8px 30px rgba(33, 150, 243, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.help-btn:active {
    transform: translateY(-1px);
}

/* Help Modal */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.help-modal-content {
    position: relative;
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.help-modal-header h2 {
    margin: 0;
    color: #333;
}

/* Generic modal close button (top-right X) */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f44336;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.modal-close-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.close-help-btn {
    background: #f44336;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.close-help-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.help-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-section {
    background: #f8f8f8;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.help-section h3 {
    color: #667eea;
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.help-section p {
    margin: 6px 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Reward Vault Button */
.reward-vault-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #333;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2),
                0 6px 20px rgba(255, 215, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
    width: 100%;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.reward-vault-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.reward-vault-btn:hover::before {
    width: 300px;
    height: 300px;
}

.reward-vault-btn:hover {
    background: linear-gradient(135deg, #ffdd00 0%, #ff9900 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25),
                0 8px 30px rgba(255, 215, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}

.reward-vault-btn:active {
    transform: translateY(-1px) scale(1.01);
}

/* Reward Vault Panel */
.reward-vault-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.reward-vault-content {
    position: relative;
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.reward-vault-content h2 {
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.reward-vault-content h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 15px;
}

.vault-description {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95em;
}

/* Gem Display */
.gem-display {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.gem-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.gem-icon {
    font-size: 48px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.gem-number {
    font-size: 36px;
    font-weight: bold;
    color: #333;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.5);
}

.gem-label {
    font-size: 14px;
    color: #333;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Vault Rewards List */
.vault-rewards-list {
    max-height: 400px;
    overflow-y: auto;
}

.vault-rewards-list::-webkit-scrollbar {
    width: 8px;
}

.vault-rewards-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.vault-rewards-list::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 4px;
}

/* Difficulty Badges */
.quest-difficulty {
    margin-bottom: 15px;
}

.difficulty-label {
    font-weight: bold;
    color: #333;
    margin-right: 8px;
}

.difficulty-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-easy {
    background: #4caf50;
    color: white;
}

.difficulty-medium {
    background: #ff9800;
    color: white;
}

.difficulty-hard {
    background: #f44336;
    color: white;
}

/* In-App Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification {
    background: white;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3),
                0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    min-width: 280px;
    border-left: 4px solid #667eea;
    transform: translateZ(0);
}

.notification.success {
    border-left-color: #4caf50;
}

.notification.error {
    border-left-color: #f44336;
}

.notification.warning {
    border-left-color: #ff9800;
}

.notification.info {
    border-left-color: #2196f3;
}

.notification.gem-collect {
    border-left-color: #ffd700;
    animation: slideIn 0.3s ease, gemPulse 0.6s ease, fadeOut 0.3s ease 2.7s;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
}

@keyframes gemPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3),
                    0 4px 10px rgba(0, 0, 0, 0.2);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 12px 30px rgba(255, 215, 0, 0.4),
                    0 8px 20px rgba(255, 215, 0, 0.3);
    }
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    font-size: 0.95em;
}

.notification-message {
    color: #666;
    font-size: 0.85em;
    line-height: 1.4;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Gem Collection Animation */
.gem-float {
    position: fixed;
    font-size: 32px;
    pointer-events: none;
    z-index: 9999;
    animation: floatUpGem 1.5s ease-out forwards;
    filter: drop-shadow(0 4px 8px rgba(255, 215, 0, 0.5));
}

@keyframes floatUpGem {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    50% {
        transform: translateY(-100px) scale(1.3) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0.8) rotate(360deg);
    }
}

/* Quest Completion Celebration Particles */
.celebration-particle {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-size: 32px;
    animation: celebrationFloat 2s ease-out forwards;
}

@keyframes celebrationFloat {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(0.5) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translateY(-150px) translateX(var(--drift-x)) scale(1.2) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-300px) translateX(var(--drift-x)) scale(0.8) rotate(360deg);
    }
}

.confetti-particle {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    width: 10px;
    height: 10px;
    animation: confettiFall 2.5s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(600px) translateX(var(--drift-x)) rotate(720deg);
    }
}

.star-burst {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-size: 48px;
    animation: starBurst 1s ease-out forwards;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

@keyframes starBurst {
    0% {
        opacity: 1;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(2) rotate(360deg);
    }
}

/* XP Bar Animation */
.xp-bar {
    background: linear-gradient(90deg, #ffeb3b 0%, #ffc107 100%);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.xp-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.6), 
        transparent);
    animation: shimmerXP 2s infinite;
}

@keyframes shimmerXP {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Quest Template Modal */
.template-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    padding: 20px;
}

.template-modal-content {
    position: relative;
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.template-modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px 15px 0 0;
}

.template-modal-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5em;
}

.close-template-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-template-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.template-quests-container {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.template-category {
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.template-category-header {
    color: #667eea;
    font-size: 1.2em;
    margin: 0;
    padding: 15px 20px;
    background: #f9f9ff;
    border-bottom: 2px solid #e0e0e0;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.template-category-header:hover {
    background: #f0f0ff;
}

.template-category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 15px;
}

.template-category.expanded .template-category-content {
    padding: 15px;
}

.category-toggle {
    font-size: 0.8em;
    color: #999;
    transition: transform 0.3s;
}

.template-item {
    display: flex;
    align-items: start;
    padding: 12px;
    margin-bottom: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: all 0.2s;
}

.template-item:hover {
    background: #f9f9f9;
    border-color: #667eea;
}

.template-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 2px 12px 0 0;
    cursor: pointer;
    flex-shrink: 0;
}

.template-item label {
    flex: 1;
    cursor: pointer;
    font-size: 14px;
}

.template-item label strong {
    display: block;
    color: #333;
    font-size: 15px;
    margin-bottom: 4px;
}

.template-meta {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    background: #e0e0e0;
    margin-right: 6px;
    text-transform: uppercase;
}

.template-desc {
    color: #666;
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.4;
}

.custom-quest-input {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px dashed #ccc;
    border-radius: 5px;
    background: #fafafa;
}

.custom-quest-input input,
.custom-quest-input textarea,
.custom-quest-input select {
    font-family: 'Courier New', monospace;
}

.template-modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #e0e0e0;
    background: #f9f9f9;
    border-radius: 0 0 15px 15px;
}

/* Scrollbar styling for template modal */
.template-quests-container::-webkit-scrollbar {
    width: 10px;
}

.template-quests-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.template-quests-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 5px;
}

.template-quests-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Welcome Modal */
.welcome-modal {
    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;
    animation: fadeIn 0.3s ease;
    padding: 20px 0; /* Add vertical padding for mobile */
}

.welcome-modal.hidden {
    display: none;
}

.welcome-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
    margin: auto; /* Ensure centering with padding */
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.welcome-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px 20px 0 0;
    text-align: center;
    color: white;
}

.welcome-greeting h1 {
    margin: 0 0 10px 0;
    font-size: 2.2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.welcome-date {
    margin: 0;
    font-size: 1.1em;
    opacity: 0.95;
    font-weight: normal;
}

.welcome-body {
    padding: 25px;
}

.welcome-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.welcome-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.welcome-section h3 {
    color: #667eea;
    margin: 0 0 15px 0;
    font-size: 1.2em;
}

/* Stats Cards */
.stats-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.gems-card {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe9a8 100%);
}

.stat-card.level-card {
    background: linear-gradient(135deg, #e8f5e9 0%, #a5d6a7 100%);
}

.stat-card.xp-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #90caf9 100%);
}

.stat-icon {
    font-size: 2em;
}

.stat-content {
    flex: 1;
}

.stat-card .stat-label {
    font-size: 0.85em;
    color: #666;
    font-weight: bold;
    text-transform: uppercase;
}

.stat-card .stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    margin-top: 2px;
}

/* Quest Info */
.welcome-quest-info,
.welcome-reward-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.welcome-quest-info .quest-item,
.welcome-reward-info .reward-item {
    margin-bottom: 8px;
}

.welcome-quest-info .quest-name {
    font-weight: bold;
    color: #333;
    font-size: 1.1em;
    display: block;
    margin-bottom: 5px;
}

.welcome-quest-info .quest-npc {
    color: #667eea;
    font-size: 0.95em;
}

.welcome-quest-info .quest-difficulty {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 10px;
}

.quest-difficulty.easy {
    background: #c8e6c9;
    color: #2e7d32;
}

.quest-difficulty.medium {
    background: #fff9c4;
    color: #f57f17;
}

.quest-difficulty.hard {
    background: #ffcdd2;
    color: #c62828;
}

.no-quest-msg,
.no-reward-msg {
    color: #999;
    font-style: italic;
    margin: 0;
}

/* Reward Info */
.welcome-reward-info .reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome-reward-info .reward-name {
    font-weight: bold;
    color: #333;
    font-size: 1.05em;
}

.welcome-reward-info .reward-cost {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1em;
}

.welcome-reward-info .reward-progress {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Progress Info */
.welcome-progress-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
}

.progress-item:last-child {
    margin-bottom: 0;
}

.progress-label {
    color: #666;
    font-weight: 500;
}

.progress-value {
    color: #667eea;
    font-weight: bold;
    font-size: 1.1em;
}

/* Welcome Footer */
.welcome-footer {
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0 0 20px 20px;
    text-align: center;
}

.motivational-quote {
    color: #667eea;
    font-size: 1.1em;
    font-weight: bold;
    margin: 0 0 20px 0;
    font-style: italic;
}

.welcome-start-btn {
    width: 100%;
    padding: 15px 30px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.welcome-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Responsive Design for Welcome Modal */
@media (max-width: 768px) {
    .welcome-greeting h1 {
        font-size: 1.7em;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
    }
    
    .welcome-modal-content {
        max-height: 95vh;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .ultimate-reward-banner {
        width: 100%;
        order: -1;
    }

    .left-sidebar {
        width: 100%;
        max-width: 600px;
    }

    .right-sidebar {
        width: 100%;
        max-width: 600px;
        order: 3;
    }

    .main-game-area {
        width: 100%;
        align-items: center;
        order: 2;
    }

    #game-world {
        width: 100%;
        max-width: 600px;
        height: 600px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .game-container {
        gap: 12px;
    }

    /* Ultimate Reward Banner - Mobile */
    .ultimate-reward-banner {
        padding: 15px 20px;
        gap: 12px;
    }

    .ultimate-reward-icon {
        font-size: 40px;
    }

    .ultimate-reward-title {
        font-size: 1.2em;
        letter-spacing: 1px;
    }

    .ultimate-reward-name {
        font-size: 1.4em;
    }

    .ultimate-reward-cost {
        font-size: 1em;
        padding: 5px 12px;
    }

    .ultimate-progress-bar-container {
        height: 24px;
        max-width: 100%;
    }

    .left-sidebar, .right-sidebar {
        padding: 15px;
        max-width: 100%;
    }

    .left-sidebar h1 {
        font-size: 1.5em;
    }

    .left-sidebar h3,
    .right-sidebar h2 {
        font-size: 1.1em;
    }

    #game-world {
        width: 100%;
        max-width: 100%;
        height: 400px;
    }

    /* Adjust room navigation buttons for mobile */
    .room-quick-nav {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .room-nav-btn {
        padding: 10px 4px;
        font-size: 1.5em;
    }

    /* Make stat rows more compact */
    .stat-row {
        font-size: 1em;
    }

    /* Adjust player stats padding */
    .player-stats {
        padding: 12px;
    }

    /* Modal adjustments */
    .quest-panel-content,
    .parent-panel-content,
    .reward-vault-content,
    .help-modal-content {
        padding: 20px;
        max-height: 85vh;
        width: 95%;
    }
    
    .welcome-modal {
        padding: 25px 10px; /* Add vertical padding */
    }
    
    .welcome-modal-content {
        max-height: 85vh; /* Reduced to ensure buttons aren't clipped */
    }

    /* Button sizing */
    .btn {
        padding: 10px 16px;
        font-size: 0.95em;
    }

    /* Notification positioning */
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .notification {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .game-container {
        gap: 10px;
    }

    /* Ultimate Reward Banner - Small Mobile */
    .ultimate-reward-banner {
        padding: 12px 15px;
        gap: 8px;
        flex-direction: column;
    }

    .ultimate-reward-icon {
        font-size: 35px;
    }

    .ultimate-reward-icon:last-child {
        display: none; /* Hide second icon on very small screens */
    }

    .ultimate-reward-title {
        font-size: 1em;
        margin-bottom: 5px;
    }

    .ultimate-reward-name {
        font-size: 1.2em;
        margin-bottom: 8px;
    }

    .ultimate-reward-cost {
        font-size: 0.9em;
        padding: 4px 10px;
    }

    .ultimate-progress-bar-container {
        height: 20px;
    }

    .left-sidebar, .right-sidebar {
        padding: 12px;
        border-radius: 12px;
    }

    .left-sidebar h1 {
        font-size: 1.3em;
    }

    .tagline {
        font-size: 0.8em;
    }

    .left-sidebar h3 {
        font-size: 1em;
        margin-bottom: 8px;
    }

    .right-sidebar h2 {
        font-size: 1em;
    }

    /* Game world adjustments */
    #game-world {
        height: 350px;
        border-width: 3px;
        border-radius: 8px;
    }

    /* Scale down game elements */
    #player {
        width: 32px;
        height: 32px;
    }

    #player::before {
        width: 18px;
        height: 18px;
        left: 7px;
    }

    #player::after {
        width: 22px;
        height: 15px;
        top: 16px;
        left: 5px;
    }

    .player-eye {
        width: 5px;
        height: 5px;
        top: 6px;
    }

    .player-eye.left-eye {
        left: 10px;
    }

    .player-eye.right-eye {
        left: 17px;
    }

    .player-smile {
        width: 8px;
        height: 4px;
        top: 12px;
        left: 12px;
    }

    .player-arm {
        width: 4px;
        height: 13px;
        top: 17px;
    }

    .player-leg {
        width: 6px;
        height: 11px;
        top: 29px;
    }

    .left-leg {
        left: 8px;
    }

    .right-leg {
        right: 8px;
    }

    /* Scale NPCs and objects */
    .main-object, .npc {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }

    .interactive-object {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }

    .door {
        width: 35px;
        height: 50px;
    }

    .door-label {
        font-size: 18px;
    }

    .door-text {
        font-size: 7px;
    }

    /* Room navigation */
    .room-quick-nav {
        gap: 6px;
    }

    .room-nav-btn {
        padding: 8px 2px;
        font-size: 1.2em;
        border-width: 1.5px;
    }

    /* Stats adjustments */
    .stat-row {
        font-size: 0.95em;
        margin: 6px 0;
    }

    .player-stats {
        padding: 10px;
    }

    .xp-bar-container {
        height: 16px;
        margin-top: 10px;
    }

    /* Buttons */
    .btn {
        padding: 8px 12px;
        font-size: 0.9em;
        margin: 3px;
    }

    .parent-mode-btn,
    .reward-vault-btn,
    .help-btn {
        padding: 10px 16px;
        font-size: 0.95em;
    }

    /* Quest items in sidebar */
    .player-quest-list {
        max-height: calc(100vh - 180px);
    }

    .quest-item {
        padding: 12px;
        margin-bottom: 8px;
    }

    .quest-item-title {
        font-size: 0.95em;
    }

    .quest-item-description {
        font-size: 0.85em;
    }

    /* Modals */
    .quest-panel-content,
    .parent-panel-content,
    .reward-vault-content,
    .help-modal-content {
        padding: 15px;
        max-height: 90vh;
        width: 98%;
        border-radius: 12px;
    }

    .modal-close-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: 10px;
        right: 10px;
    }

    .npc-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .npc-avatar {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .quest-panel-content h2,
    .parent-panel-content h2,
    .reward-vault-content h2 {
        font-size: 1.3em;
        margin-top: 35px;
    }

    .quest-panel-content h3,
    .parent-panel-content h3 {
        font-size: 1.1em;
    }

    /* Form elements */
    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 0.9em;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 8px;
        font-size: 0.9em;
    }

    /* Welcome modal */
    .welcome-modal {
        padding: 30px 10px; /* Increased vertical padding for mobile */
    }
    
    .welcome-modal-content {
        width: 95%;
        max-height: 85vh; /* Reduced max height to ensure room for padding */
        border-radius: 15px;
    }

    .welcome-header {
        padding: 25px 15px; /* Increased top padding */
    }

    .welcome-greeting h1 {
        font-size: 1.4em;
    }

    .welcome-date {
        font-size: 0.95em;
    }

    .welcome-body {
        padding: 15px;
    }

    .stats-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .welcome-section {
        margin-bottom: 18px;
        padding-bottom: 15px;
    }

    .welcome-section h3 {
        font-size: 1em;
        margin-bottom: 12px;
    }

    .welcome-footer {
        padding: 20px 15px; /* Increased bottom padding */
    }

    .motivational-quote {
        font-size: 0.95em;
        margin-bottom: 15px;
    }

    .welcome-start-btn {
        padding: 12px 20px;
        font-size: 1em;
        margin-bottom: 10px; /* Add margin below button */
    }

    /* Template modal */
    .template-modal-content {
        width: 98%;
        max-height: 95vh;
    }

    .template-modal-header {
        padding: 15px 20px;
    }

    .template-modal-header h2 {
        font-size: 1.2em;
    }

    .template-quests-container {
        padding: 15px;
    }

    .template-item {
        padding: 10px;
        flex-direction: column;
    }

    .template-item input[type="checkbox"] {
        margin: 0 0 8px 0;
    }

    /* Gem display */
    .gem-display {
        padding: 15px;
        margin-bottom: 20px;
    }

    .gem-icon {
        font-size: 36px;
    }

    .gem-number {
        font-size: 28px;
    }

    .gem-label {
        font-size: 12px;
    }

    /* Info section */
    .info p {
        font-size: 0.85em;
    }

    .current-location p {
        font-size: 1em;
    }

    /* Notification adjustments */
    .notification {
        padding: 12px 16px;
        min-width: 0;
    }

    .notification-icon {
        font-size: 20px;
    }

    .notification-title {
        font-size: 0.9em;
    }

    .notification-message {
        font-size: 0.8em;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .left-sidebar h1 {
        font-size: 1.1em;
    }

    .tagline {
        font-size: 0.75em;
    }

    #game-world {
        height: 300px;
    }

    .room-quick-nav {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .room-nav-btn {
        padding: 6px 2px;
        font-size: 1.1em;
    }

    .stat-row {
        font-size: 0.9em;
    }

    .btn {
        font-size: 0.85em;
        padding: 7px 10px;
    }

    .quest-panel-content h2,
    .parent-panel-content h2 {
        font-size: 1.1em;
    }

    .welcome-greeting h1 {
        font-size: 1.2em;
    }
}

/* Landscape mode optimization for mobile */
@media (max-width: 896px) and (orientation: landscape) {
    body {
        padding: 5px;
        min-height: 100vh;
    }

    .game-container {
        flex-direction: row;
        gap: 10px;
        align-items: flex-start;
    }

    .left-sidebar {
        width: 240px;
        max-width: 240px;
        padding: 12px;
        max-height: calc(100vh - 10px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .right-sidebar {
        width: 240px;
        max-width: 240px;
        padding: 12px;
        order: 3;
        max-height: calc(100vh - 10px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-game-area {
        flex: 1;
        order: 2;
    }

    #game-world {
        width: 100%;
        height: calc(100vh - 20px);
        max-height: 500px;
    }

    .left-sidebar h1 {
        font-size: 1.2em;
    }

    .left-sidebar h3,
    .right-sidebar h2 {
        font-size: 0.95em;
    }

    .tagline {
        font-size: 0.75em;
    }

    .stat-row {
        font-size: 0.9em;
        margin: 5px 0;
    }

    .player-stats {
        padding: 10px;
    }

    .room-quick-nav {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .room-nav-btn {
        padding: 6px 4px;
        font-size: 1.1em;
    }

    .btn,
    .parent-mode-btn,
    .reward-vault-btn,
    .help-btn {
        padding: 8px 12px;
        font-size: 0.85em;
        margin: 3px 0;
    }

    .info p {
        font-size: 0.8em;
    }

    /* Modals in landscape */
    .quest-panel-content,
    .parent-panel-content,
    .reward-vault-content {
        max-height: 95vh;
        max-width: 600px;
    }

    .welcome-modal-content {
        max-height: 95vh;
        max-width: 650px;
    }

    .stats-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-icon {
        font-size: 1.5em;
    }

    .stat-card .stat-value {
        font-size: 1.2em;
    }
}

/* iPad and tablet specific */
@media (min-width: 768px) and (max-width: 1024px) {
    .left-sidebar,
    .right-sidebar {
        max-width: 320px;
    }

    #game-world {
        max-width: 600px;
        height: 600px;
    }

    .notification-container {
        max-width: 400px;
    }
}
