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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'Courier New', monospace;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Touch Controls */
#touch-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.touch-zone {
    position: absolute;
    pointer-events: auto;
}

#touch-left {
    left: 0;
    bottom: 0;
    width: 25%;
    height: 40%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    border-radius: 0 20px 0 0;
}

#touch-left::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 20px solid rgba(255,255,255,0.3);
}

#touch-right {
    right: 0;
    bottom: 0;
    width: 25%;
    height: 40%;
    background: linear-gradient(225deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    border-radius: 20px 0 0 0;
}

#touch-right::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 20px solid rgba(255,255,255,0.3);
}

#touch-jump {
    left: 25%;
    bottom: 0;
    width: 50%;
    height: 40%;
    background: linear-gradient(180deg, transparent 0%, rgba(255,107,157,0.1) 100%);
}

#touch-jump::after {
    content: 'JUMP';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.3);
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Touch active states */
#touch-left:active {
    background: linear-gradient(135deg, rgba(255,107,157,0.3) 0%, transparent 100%);
}

#touch-right:active {
    background: linear-gradient(225deg, rgba(255,107,157,0.3) 0%, transparent 100%);
}

#touch-jump:active {
    background: linear-gradient(180deg, transparent 0%, rgba(255,107,157,0.3) 100%);
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 0 #000;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 8px;
}

#collectible-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

.ui-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(26, 26, 46, 0.95);
    color: white;
    text-align: center;
    padding: 20px;
    pointer-events: auto;
}

.ui-screen.hidden {
    display: none;
}

.ui-screen h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #ffd700;
    text-shadow: 3px 3px 0 #b8860b;
    letter-spacing: 2px;
}

.ui-screen p {
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.6;
    max-width: 300px;
    color: #e0e0e0;
}

.ui-screen button {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(180deg, #ff6b9d, #c44569);
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 0 #8b2a4a;
    transition: transform 0.1s, box-shadow 0.1s;
}

.ui-screen button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #8b2a4a;
}

/* Level Intro */
#level-intro h1 {
    font-size: 28px;
}

#level-subtitle {
    font-style: italic;
    color: #aaa;
}

/* Story Dialog */
#story-dialog {
    background: rgba(26, 26, 46, 0.95);
    padding: 30px 20px;
}

#story-dialog .story-content {
    max-width: 350px;
    width: 100%;
}

#story-dialog h2 {
    font-size: 20px;
    color: #ffd700;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#story-text {
    font-size: 16px;
    line-height: 1.8;
    padding: 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
    color: #e0e0e0;
    margin-bottom: 25px;
    white-space: pre-wrap;
}

#story-text::-webkit-scrollbar {
    width: 6px;
}

#story-text::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#story-text::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 3px;
}

#story-text::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.7);
}

/* Ending Screen */
#ending-screen {
    background: linear-gradient(180deg, #1a1a2e 0%, #2d1f3d 50%, #1a1a2e 100%);
}

#ending-screen h1 {
    font-size: 28px;
    animation: pulse 2s ease-in-out infinite;
}

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

#birthday-message {
    font-size: 20px;
    color: #ff6b9d;
    font-style: italic;
}

#hearts-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.floating-heart {
    position: absolute;
    font-size: 24px;
    animation: floatUp 4s ease-in-out infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

#confetti-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s linear infinite;
}

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

/* Title Screen */
#title-screen {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

#title-screen h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

#title-screen p {
    font-size: 14px;
    color: #888;
    margin-bottom: 20px;
}

#controls-hint {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

#controls-hint span {
    font-size: 11px;
    color: #666;
}

/* Mobile optimizations */
@media (max-height: 700px) {
    .ui-screen h1 {
        font-size: 24px;
    }
    .ui-screen p {
        font-size: 14px;
    }
    .ui-screen button {
        font-size: 16px;
        padding: 12px 30px;
    }
}
