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

body {
    background: #0a0014;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#game-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

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

#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

#hud-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#avatar-container {
    width: 40px;
    height: 40px;
    border: 3px solid #8a2be2;
    border-radius: 8px;
    background: linear-gradient(135deg, #1a0a2e, #2d1b4e);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

#avatar-placeholder {
    font-size: 24px;
}

#phase-indicator {
    font-size: 10px;
    color: #ffa500;
    text-shadow: 2px 2px 0 #000, 0 0 10px currentColor;
    background: rgba(0, 0, 0, 0.8);
    padding: 6px 10px;
    border: 2px solid #8a2be2;
    border-radius: 4px;
    transition: all 0.3s ease;
}

#phase-indicator.glitch-text {
    animation: glitch 0.3s infinite;
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(2px, 2px); }
}

#hud-right {
    text-align: right;
}

#stats {
    font-size: 9px;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 12px;
    border: 2px solid #8a2be2;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.3);
}

#energy-container {
    position: absolute;
    top: 60px;
    left: 10px;
    z-index: 10;
}

#energy-label {
    font-size: 7px;
    color: #00ffff;
    margin-bottom: 4px;
    text-shadow: 1px 1px 0 #000, 0 0 5px #00ffff;
}

#energy-bar {
    width: 120px;
    height: 14px;
    background: #1a0a2e;
    border: 2px solid #8a2be2;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

#energy-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00ff00, #00ffaa);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px currentColor;
}

#tweet-input {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    z-index: 20;
    background: rgba(0, 0, 0, 0.95);
    padding: 15px;
    border: 3px solid #ff69b4;
    border-radius: 8px;
    animation: slideUp 0.3s ease;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 0 30px rgba(255, 105, 180, 0.4);
}

#tweet-input.hidden {
    display: none;
}

#tweet-text {
    width: 100%;
    padding: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 9px;
    background: linear-gradient(135deg, #1a0a2e, #0a0014);
    border: 2px solid #00ffff;
    border-radius: 4px;
    color: #fff;
    outline: none;
}

#tweet-text::placeholder {
    color: #666;
}

#tweet-text:focus {
    border-color: #ff69b4;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.5);
}

#send-tweet {
    padding: 10px 16px;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    background: linear-gradient(180deg, #ff69b4, #ff1493);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    white-space: nowrap;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

#send-tweet:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 105, 180, 0.7);
}

#send-tweet:active {
    transform: scale(0.95);
}

#instructions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 7px;
    color: #888;
    text-shadow: 1px 1px 0 #000;
    text-align: center;
    pointer-events: none;
    max-width: 90%;
}

#meta-bubble {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    animation: metaBubbleIn 0.5s ease;
}

#meta-bubble.hidden {
    display: none;
}

#meta-content {
    background: rgba(0, 0, 0, 0.95);
    border: 4px solid #00ffff;
    border-radius: 16px;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.5), inset 0 0 30px rgba(0, 255, 255, 0.1);
    animation: glitchBorder 0.5s ease infinite;
}

@keyframes glitchBorder {
    0%, 100% { border-color: #00ffff; }
    25% { border-color: #ff00ff; }
    50% { border-color: #ffff00; }
    75% { border-color: #ff69b4; }
}

#kai-avatar {
    font-size: 48px;
    animation: bounce 0.5s ease infinite;
}

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

#meta-text {
    font-size: 12px;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    line-height: 1.8;
}

.meta-author {
    color: #ff69b4;
    font-size: 10px;
}

@keyframes metaBubbleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

#win-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(26, 10, 46, 0.95));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.5s ease;
    padding: 20px;
}

#win-screen.hidden {
    display: none;
}

#win-content {
    text-align: center;
    animation: bounceIn 0.6s ease;
}

#win-content h1 {
    font-size: 18px;
    color: #ff69b4;
    margin-bottom: 15px;
    text-shadow: 0 0 20px #ff69b4;
}

#win-content p {
    font-size: 11px;
    color: #00ffff;
    margin-bottom: 10px;
}

.meta-text {
    font-size: 9px !important;
    color: #ffff00 !important;
    margin-bottom: 15px !important;
}

#win-emoji {
    font-size: 60px;
    margin-bottom: 15px;
}

#beach-characters {
    font-size: 10px;
    color: #ff69b4;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

#play-again {
    padding: 12px 24px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    background: linear-gradient(180deg, #00ffff, #0099cc);
    border: none;
    border-radius: 4px;
    color: #000;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

#play-again:hover {
    transform: scale(1.1);
}

#footer {
    padding: 12px;
    text-align: center;
    background: linear-gradient(180deg, #0a0014, #1a0a2e);
    border-top: 2px solid #8a2be2;
    cursor: pointer;
    transition: background 0.3s;
}

#footer:hover {
    background: linear-gradient(180deg, #1a0a2e, #2d1b4e);
}

#footer-text {
    font-size: 8px;
    color: #888;
}

#footer a {
    color: #ff69b4;
    text-decoration: none;
}

#footer a:hover {
    text-shadow: 0 0 10px #ff69b4;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

@media (max-width: 600px) {
    #phase-indicator {
        font-size: 7px;
        padding: 5px 7px;
    }
    
    #stats {
        font-size: 7px;
        padding: 6px 8px;
    }
    
    #avatar-container {
        width: 32px;
        height: 32px;
    }
    
    #avatar-placeholder {
        font-size: 18px;
    }
    
    #energy-bar {
        width: 90px;
    }
    
    #energy-label {
        font-size: 6px;
    }
    
    #tweet-input {
        padding: 12px;
    }
    
    #tweet-text {
        font-size: 8px;
        padding: 8px;
    }
    
    #send-tweet {
        font-size: 7px;
        padding: 8px 12px;
    }
    
    #instructions {
        font-size: 6px;
    }
    
    #win-content h1 {
        font-size: 14px;
    }
    
    #win-content p {
        font-size: 9px;
    }
    
    #win-emoji {
        font-size: 48px;
    }
    
    #play-again {
        font-size: 9px;
        padding: 10px 20px;
    }
    
    #meta-content {
        flex-direction: column;
        padding: 15px 20px;
    }
    
    #meta-text {
        font-size: 10px;
        text-align: center;
    }
    
    #kai-avatar {
        font-size: 36px;
    }
    
    #footer-text {
        font-size: 6px;
    }
}