/* Pac-Man WebGPU - Whacky Cartoon Styling */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Fredoka:wght@600;700&family=Orbitron:wght@800;900&display=swap');

:root {
    --pac-yellow: #ffe600;
    --ghost-red: #ff2244;
    --ghost-pink: #ff66cc;
    --ghost-cyan: #00f0ff;
    --ghost-orange: #ff9900;
    --bg-dark: #050814;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Fredoka', sans-serif;
    color: #ffffff;
}

#canvasContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#renderCanvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

/* ========================================= */
/* HUD OVERLAY                               */
/* ========================================= */

#hudOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 20px;
}

.hud-interactive {
    pointer-events: auto;
}

/* TOP HUD */
.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.hud-card {
    background: rgba(10, 16, 32, 0.85);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 230, 0, 0.4);
    border-radius: 12px;
    padding: 6px 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.hud-label {
    font-family: 'Bangers', cursive;
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    color: #94a3b8;
}

.hud-val {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--pac-yellow);
    text-shadow: 0 0 10px rgba(255, 230, 0, 0.6);
}

.high-score-val {
    color: var(--ghost-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.lives-badge {
    font-size: 1.4rem;
    letter-spacing: 3px;
}

/* BOTTOM HUD */
.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
}

.webgpu-badge {
    background: rgba(10, 16, 32, 0.85);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    color: var(--ghost-cyan);
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-btn {
    background: rgba(20, 28, 55, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #cbd5e1;
    font-family: 'Bangers', cursive;
    font-size: 1.1rem;
    letter-spacing: 1px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hud-btn:hover {
    background: rgba(40, 55, 100, 0.95);
    border-color: var(--pac-yellow);
    color: var(--pac-yellow);
    transform: scale(1.06);
}

/* ========================================= */
/* SASSY PAC-MAN SPEECH BUBBLE               */
/* ========================================= */

#pacmanSpeechBubble {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    color: #111111;
    border: 3px solid #111111;
    border-radius: 18px;
    padding: 10px 18px;
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    letter-spacing: 1px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
    z-index: 40;
    pointer-events: none;
    display: none;
    animation: bubblePop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#pacmanSpeechBubble::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 14px 12px 0;
    border-style: solid;
    border-color: #ffffff transparent;
    display: block;
    width: 0;
}

@keyframes bubblePop {
    from { transform: translate(-50%, -40%) scale(0.4); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
}

/* ========================================= */
/* ARCADE BANNER                             */
/* ========================================= */

#arcadeBanner {
    position: absolute;
    top: 42%;
    left: 0;
    width: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 50;
}

.banner-text {
    font-family: 'Bangers', cursive;
    font-size: 4.8rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 0 30px rgba(255, 230, 0, 0.8);
    animation: bannerZoom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bannerZoom {
    0% { transform: scale(0.2); opacity: 0; }
    80% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1.0); }
}

.floating-text {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: 'Bangers', cursive;
    font-size: 2.2rem;
    letter-spacing: 2px;
    pointer-events: none;
    z-index: 60;
    animation: floatUp 1.2s forwards ease-out;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%, 0px) scale(0.8); }
    50% { opacity: 1; transform: translate(-50%, -40px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -80px) scale(1.0); }
}

/* ========================================= */
/* MODALS & TITLE SCREEN                     */
/* ========================================= */

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 8, 20, 0.85);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.arcade-card {
    background: radial-gradient(circle at top, #182240 0%, #0a1024 100%);
    border: 3px solid var(--pac-yellow);
    border-radius: 24px;
    padding: 30px 40px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 45px rgba(255, 230, 0, 0.35);
}

.arcade-btn {
    font-family: 'Bangers', cursive;
    font-size: 1.6rem;
    letter-spacing: 2px;
    padding: 14px 35px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--pac-yellow), #ff9900);
    color: #111111;
    box-shadow: 0 0 25px rgba(255, 230, 0, 0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.arcade-btn:hover {
    transform: scale(1.08) rotate(-1deg);
    box-shadow: 0 0 35px rgba(255, 230, 0, 0.8);
}

.ghost-roster {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.ghost-roster-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.ghost-roster-item .icon {
    font-size: 2rem;
    margin-bottom: 4px;
    animation: ghostBob 1.5s infinite alternate ease-in-out;
}

@keyframes ghostBob {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}

/* TOUCH CONTROLS FOR MOBILE */
#touchDpad {
    position: absolute;
    bottom: 25px;
    left: 25px;
    width: 140px;
    height: 140px;
    z-index: 40;
    pointer-events: auto;
    display: none;
}

.dpad-btn {
    position: absolute;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    color: #ffffff;
    cursor: pointer;
}

.dpad-up    { top: 0; left: 47px; }
.dpad-down  { bottom: 0; left: 47px; }
.dpad-left  { top: 47px; left: 0; }
.dpad-right { top: 47px; right: 0; }

@media (pointer: coarse), (max-width: 800px) {
    #touchDpad {
        display: block;
    }
    .banner-text {
        font-size: 3.2rem;
    }
}
