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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a15 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    background: #87CEEB;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(34, 139, 34, 0.4), 0 0 100px rgba(34, 139, 34, 0.2);
    overflow: hidden;
    border: 3px solid #228B22;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Start Screen - Modern Clean Design */
#start-screen {
    background: linear-gradient(180deg, #1a2a3a 0%, #2d4a5a 50%, #3d5a6a 100%);
    padding: 20px;
    overflow-y: auto;
    gap: 12px;
}

#start-screen h1 {
    font-size: 42px;
    color: #FFFFFF;
    text-shadow: 0 2px 20px rgba(100, 200, 255, 0.5);
    margin: 0;
    letter-spacing: 3px;
    font-weight: 300;
}

.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.toby-icon {
    filter: drop-shadow(0 4px 20px rgba(255, 255, 255, 0.3));
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.toby-icon svg {
    width: 80px;
    height: 80px;
}

.version {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 12px;
    border-radius: 15px;
    display: inline-block;
    flex-shrink: 0;
}

.version-row {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: row;
    flex-direction: row;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.total-plays {
    font-size: 11px;
    color: rgba(255, 200, 100, 0.9);
    font-weight: 500;
    display: inline-block;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Setup Row - Name & Difficulty */
.setup-row {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.player-name-section {
    display: flex;
    align-items: center;
}

.player-name-section input {
    padding: 8px 16px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    text-align: center;
    width: 160px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transition: all 0.3s ease;
}

.player-name-section input:focus {
    outline: none;
    border-color: #64B5F6;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 20px rgba(100, 181, 246, 0.3);
}

.player-name-section input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.player-name-section input.input-error {
    border-color: #FF6B6B;
    background: rgba(255, 107, 107, 0.2);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.difficulty-buttons {
    display: flex;
    gap: 5px;
}

.difficulty-btn {
    padding: 8px 14px;
    font-size: 12px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

/* Main Action Buttons */
.main-buttons {
    display: flex;
    gap: 15px;
}

.game-btn {
    border: none;
    padding: 14px 35px;
    font-size: 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 1px;
}

.game-btn.primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.5);
    font-size: 18px;
    padding: 16px 50px;
}

.game-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(76, 175, 80, 0.6);
}

.game-btn.secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.game-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.game-btn:active {
    transform: scale(0.98);
}

/* Quick Action Buttons */
.quick-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 10px 18px;
    font-size: 13px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Settings Bar */
.settings-bar {
    display: flex;
    gap: 10px;
    position: absolute;
    top: 15px;
    right: 15px;
}

.settings-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Collapsible Panels */
.panel {
    position: absolute;
    background: rgba(20, 30, 40, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: slideIn 0.3s ease;
}

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

.panel.hidden {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.close-panel-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-panel-btn:hover {
    background: rgba(255, 100, 100, 0.3);
}

.panel-content {
    padding: 20px;
}

.panel-content p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    margin: 8px 0;
    text-align: center;
}

.panel-content .worlds {
    color: #64B5F6;
    font-size: 12px;
    margin-top: 15px;
}

.panel-content .difficulty-info {
    color: #FFD54F;
    font-size: 11px;
    margin-top: 8px;
    padding: 5px 10px;
    background: rgba(255, 215, 79, 0.15);
    border-radius: 8px;
    display: inline-block;
}

.panel-content .legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 15px 0;
}

.panel-content .legend-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 13px;
}

.panel-content .legend-item.good {
    background: rgba(76, 175, 80, 0.2);
    color: #81C784;
}

.panel-content .legend-item.bad {
    background: rgba(244, 67, 54, 0.2);
    color: #E57373;
}

.panel-content .legend-item.power {
    background: rgba(33, 150, 243, 0.2);
    color: #64B5F6;
}

.key {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 5px;
    font-weight: bold;
    margin: 0 2px;
    font-size: 12px;
}

/* Leaderboard - Compact Modern */
.leaderboard {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 15px;
    text-align: center;
    min-width: 280px;
    max-width: 350px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard h3 {
    font-size: 14px;
    color: #FFD700;
    margin-bottom: 10px;
    font-weight: 500;
}

#leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 100px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 12px;
}

.leaderboard-entry.first {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 215, 0, 0.1) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-entry .rank {
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    width: 25px;
}

.leaderboard-entry.first .rank {
    color: #FFD700;
}

.leaderboard-entry .name {
    flex: 1;
    text-align: left;
    color: #fff;
    padding: 0 10px;
}

.leaderboard-entry .score {
    font-weight: bold;
    color: #4CAF50;
}

.no-scores {
    font-style: italic;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin: 5px 0;
}

/* Firebase Status */
.firebase-status {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 500;
}

.firebase-status.online {
    background: rgba(76, 175, 80, 0.2);
    color: #81C784;
}

.firebase-status.offline {
    background: rgba(158, 158, 158, 0.2);
    color: rgba(255, 255, 255, 0.5);
}

/* Kitty Coins Display */
.kitty-coins {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Shop Panel */
.shop-panel .panel-content {
    max-height: 400px;
    overflow-y: auto;
}

.shop-info {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.6) !important;
    margin-bottom: 12px !important;
}

/* Shop Category Tabs */
.shop-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 4px;
}

.shop-tab {
    flex: 1;
    padding: 8px 4px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.shop-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.shop-tab.active {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
    color: #1a1a2e;
    font-weight: bold;
}

/* Shop Sort Options */
.shop-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.shop-sort select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
}

.shop-sort select:focus {
    outline: none;
    border-color: #FFD700;
}

/* Skin Selector in Panel */
.skin-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    justify-content: center;
}

.skin-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

/* New Badge */
.new-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #FF4081 0%, #FF1744 100%);
    color: #fff;
    font-size: 8px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    animation: newBadgePulse 1.5s ease-in-out infinite;
    z-index: 1;
}

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

.skin-option:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.skin-option.selected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
}

.skin-option.locked {
    opacity: 0.7;
    cursor: default;
}

.skin-option.locked.can-afford {
    opacity: 1;
    cursor: pointer;
    border-color: #FFD700;
    animation: canAffordPulse 2s ease-in-out infinite;
}

@keyframes canAffordPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 15px 5px rgba(255, 215, 0, 0.3); }
}

.skin-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

/* Preview Animation on Hover */
.skin-option:hover .skin-preview {
    animation: previewBounce 0.5s ease-in-out;
}

@keyframes previewBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(1.15) rotate(0deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* Accessory Preview */
.accessory-preview {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 8px;
}

.skin-option:hover .accessory-preview {
    animation: accessoryWiggle 0.4s ease-in-out;
}

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

/* Power-up Preview */
.powerup-preview {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 8px;
}

.skin-option:hover .powerup-preview {
    animation: powerupGlow 0.5s ease-in-out;
}

@keyframes powerupGlow {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.2); filter: brightness(1.3); }
}

.skin-name {
    font-size: 11px;
    color: #fff;
    text-align: center;
    margin-bottom: 4px;
}

.skin-price {
    font-size: 12px;
    color: #FFD700;
    font-weight: bold;
}

.skin-price.affordable {
    color: #4CAF50;
}

.skin-equipped {
    font-size: 10px;
    color: #4CAF50;
    font-weight: bold;
}

.skin-owned {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

/* Game Screen */
#game-screen {
    background: transparent;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 100%);
    color: white;
    font-size: 16px;
    z-index: 10;
    border-bottom: 1px solid #4a4a6a;
}

#timer-display {
    font-size: 18px;
    font-weight: bold;
    color: #88aadd;
}

#score-display, #level-display {
    font-weight: bold;
}

#energy-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#energy-bar {
    width: 150px;
    height: 18px;
    background: #222;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #444;
}

#energy-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff4444 0%, #ffaa00 50%, #44ff44 100%);
    transition: width 0.3s ease;
}

#speed-indicator {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, rgba(255, 100, 0, 0.9) 0%, rgba(255, 50, 0, 0.9) 100%);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 18px;
    animation: pulse 0.4s ease-in-out infinite alternate;
    z-index: 20;
    box-shadow: 0 0 30px rgba(255, 100, 0, 0.6);
    border: 2px solid #ff8800;
    pointer-events: none;
}

@keyframes pulse {
    from {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 0 30px rgba(255, 100, 0, 0.6);
    }
    to {
        transform: translateX(-50%) scale(1.1);
        box-shadow: 0 0 50px rgba(255, 100, 0, 0.8);
    }
}

#boss-indicator {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, rgba(100, 0, 100, 0.9) 0%, rgba(150, 0, 50, 0.9) 100%);
    color: #FFD700;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 16px;
    animation: boss-pulse 0.5s ease-in-out infinite alternate;
    z-index: 20;
    box-shadow: 0 0 30px rgba(150, 0, 100, 0.6);
    border: 2px solid #FF0000;
    text-shadow: 0 0 10px #FF0000;
    pointer-events: none;
}

@keyframes boss-pulse {
    from {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 0 30px rgba(150, 0, 100, 0.6);
    }
    to {
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 0 50px rgba(255, 0, 0, 0.8);
    }
}

#punch-counter {
    background: linear-gradient(90deg, #FF6B35 0%, #FF4500 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.4);
    border: 2px solid #FF8C00;
}

#game-canvas {
    display: block;
}

/* Mobile Touch Controls */
#touch-controls {
    display: none;
    position: absolute;
    bottom: auto;
    top: calc(100vw * 9 / 16 - 80px); /* Position higher - above scenery */
    left: 0;
    right: 0;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    pointer-events: none;
    /* Prevent iOS selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.touch-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.6);
    color: white;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.1s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    /* Prevent iOS Safari selection/highlight */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none; /* Prevent all default touch behaviors */
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.95);
}

#touch-left {
    margin-left: 10px;
}

#touch-right {
    margin-right: 10px;
}

/* Mobile punch button */
#touch-punch {
    width: 70px;
    height: 70px;
    background: rgba(255, 100, 0, 0.5);
    border-color: rgba(255, 150, 50, 0.8);
    font-size: 32px;
    display: none; /* Hidden by default, shown during boss battles */
}

#touch-punch:active {
    background: rgba(255, 100, 0, 0.8);
}

#touch-punch.visible {
    display: block;
}\n\n/* Sponsors section */\n#sponsors {
    display: none; /* Hidden by default, shown during gameplay */
    position: relative;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px;
    margin-top: 5px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

#sponsors a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

#sponsors a:hover {
    color: #FFFFFF;
    text-decoration: underline;
}

/* Show touch controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    #touch-controls {
        display: flex;
    }
    
    /* Fix iOS Safari energy bar visibility - pin below HUD at top of screen */
    #energy-container {
        position: fixed;
        top: 55px; /* Below the HUD bar */
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        padding: 8px 15px;
        border-radius: 25px;
        z-index: 101;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        border: 2px solid rgba(255, 255, 255, 0.2);
    }
    
    #energy-bar {
        width: 120px;
        height: 14px;
    }
    
    /* Move indicators below energy bar on mobile */
    #speed-indicator,
    #boss-indicator {
        top: 110px; /* Below the energy bar */
    }
    
    #hud {
        flex-wrap: wrap;
        gap: 5px 10px;
    }
}

/* Also show on small screens */
@media (max-width: 800px) {
    #touch-controls {
        display: flex;
    }
    
    #game-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    body {
        align-items: stretch;
    }
    
    /* Ensure energy bar is visible on mobile - pinned below HUD at top */
    #energy-container {
        position: fixed;
        top: 55px; /* Below the HUD bar */
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        padding: 8px 15px;
        border-radius: 25px;
        z-index: 101;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        border: 2px solid rgba(255, 255, 255, 0.2);
    }
    
    #energy-bar {
        width: 120px;
        height: 14px;
    }
    
    #hud {
        flex-wrap: wrap;
        gap: 5px 10px;
        padding: 10px;
    }
}

/* Game Over Screen */
#game-over-screen {
    background: linear-gradient(180deg, rgba(10, 10, 21, 0.98) 0%, rgba(26, 26, 46, 0.98) 100%);
    color: white;
}

#game-over-screen h1 {
    font-size: 52px;
    color: #FF6464;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 100, 100, 0.6);
}

#game-over-screen > p {
    font-size: 20px;
    margin: 10px 0;
    color: #aaaacc;
}

#final-stats {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px 50px;
    border-radius: 15px;
    margin: 25px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#final-stats p {
    font-size: 22px;
    margin: 12px 0;
    color: #ccccdd;
}

#final-stats span {
    color: #FFD700;
    font-weight: bold;
    font-size: 26px;
}

/* Skin Section */
.skin-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 11px;
    color: #333;
}

.skin-selector {
    display: flex;
    gap: 5px;
}

.skin-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #ccc;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 2px;
}

.skin-option:hover {
    border-color: #228B22;
    transform: scale(1.05);
}

.skin-option.selected {
    border-color: #228B22;
    background: rgba(34, 139, 34, 0.2);
}

.skin-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.skin-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.skin-name {
    font-size: 6px;
    text-align: center;
    max-width: 38px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Button Row */
.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.daily-btn {
    background: linear-gradient(180deg, #FF8C00 0%, #FF6600 100%);
    box-shadow: 0 4px 15px rgba(255, 100, 0, 0.4);
    font-size: 12px;
    padding: 8px 15px;
}

.daily-btn:hover {
    box-shadow: 0 8px 30px rgba(255, 100, 0, 0.6);
}

/* Power-up legend */
.legend-item.power {
    background: rgba(255, 100, 200, 0.2);
    border: 1px solid rgba(255, 100, 200, 0.4);
    color: #CC0066;
}

/* Pause Overlay */
.pause-overlay {
    position: absolute;
    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: 200;
}

.pause-content {
    text-align: center;
    color: white;
}

.pause-content h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

.pause-content p {
    margin-bottom: 20px;
    color: #aaa;
}

/* HUD Pause Button */
.hud-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Achievements Modal */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.modal-content {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    padding: 20px;
    max-width: 500px;
    max-height: 80%;
    overflow-y: auto;
    border: 2px solid #FFD700;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}

.modal-content h2 {
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
}

#achievements-progress {
    font-size: 14px;
    color: #aaa;
}

#achievements-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.achievement-item.unlocked {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
}

.achievement-item.locked {
    opacity: 0.6;
}

.achievement-icon {
    font-size: 24px;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    color: #FFD700;
    font-weight: bold;
    font-size: 14px;
}

.achievement-desc {
    color: #aaa;
    font-size: 11px;
}

/* Responsive adjustments */
@media (max-width: 850px) {
    #game-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    #game-canvas {
        width: 100%;
        height: auto;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 90%;
    }
    
    .button-row {
        flex-direction: column;
        align-items: center;
    }
    
    .skin-selector {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Personal Best Display */
.personal-best {
    font-size: 14px;
    color: #FFD700;
    margin: 10px 0;
    min-height: 24px;
}

.personal-best .new-best {
    font-size: 18px;
    font-weight: bold;
    color: #00FF00;
    animation: celebratePulse 0.5s ease-in-out infinite alternate;
}

.personal-best.celebrating {
    animation: celebrateShake 0.3s ease-in-out;
}

@keyframes celebratePulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

@keyframes celebrateShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Game Over Buttons Container */
.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.share-btn {
    background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF;
}

.share-btn:hover {
    background: linear-gradient(180deg, #5dade2 0%, #3498db 100%);
    color: #FFFFFF !important;
}

.share-btn:disabled {
    background: #666;
    cursor: default;
}

.home-btn {
    background: linear-gradient(180deg, #9b59b6 0%, #8e44ad 100%);
    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF;
}

.home-btn:hover {
    background: linear-gradient(180deg, #a569bd 0%, #9b59b6 100%);
    color: #FFFFFF !important;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 15px 0;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.stat-icon {
    display: block;
    font-size: 24px;
    margin-bottom: 5px;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 3px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
}

@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 400;
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-content {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 2px solid #FFD700;
}

.tutorial-content h2 {
    color: #FFD700;
    margin-bottom: 20px;
}

.tutorial-steps {
    margin: 20px 0;
}

.tutorial-step {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    text-align: left;
}

.tutorial-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.tutorial-step p {
    font-size: 14px;
    color: #fff;
    margin: 0;
}

.tutorial-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.tutorial-checkbox input {
    cursor: pointer;
}

/* Easy Mode Suggestion */
.easy-suggestion {
    display: block;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 200, 100, 0.2);
    border-radius: 10px;
    font-size: 14px;
}

.easy-mode-btn {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin-left: 5px;
}

.easy-mode-btn:hover {
    background: linear-gradient(180deg, #58d68d 0%, #2ecc71 100%);
}

/* Landscape Mode Support for Mobile */
@media (max-width: 850px) and (orientation: landscape) {
    #game-container {
        max-height: 100vh;
        overflow-y: auto;
    }
    
    #start-screen {
        padding: 10px;
    }
    
    #start-screen h1 {
        font-size: 24px;
        margin-bottom: 5px;
    }
    
    .toby-icon svg {
        width: 50px;
        height: 50px;
    }
    
    .version-row {
        margin-bottom: 5px;
    }
    
    .setup-row {
        padding: 8px 15px;
    }
    
    .quick-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .action-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    #touch-controls {
        top: auto;
        bottom: 10px;
    }
    
    .touch-btn {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    #sponsors {
        font-size: 10px;
        padding: 5px;
    }
    
    /* Compact game over screen in landscape */
    #game-over-screen {
        padding: 10px;
    }
    
    #game-over-screen h1 {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    #game-over-screen .toby-icon svg {
        width: 40px;
        height: 40px;
    }
    
    #final-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    #final-stats p {
        margin: 0;
        font-size: 14px;
    }
    
    .game-over-buttons {
        margin-top: 10px;
    }
}
