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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Force portrait aspect ratio on all platforms */
#game-container {
    /* On mobile: full screen. On desktop: fixed portrait ratio */
    width: 100%;
    height: 100%;
    max-width: 450px;        /* max portrait width */
    max-height: 100vh;
    aspect-ratio: 9 / 16;    /* portrait ratio */
    position: relative;
    overflow: hidden;
    background: #81D4FA;
    /* Center with rounded corners on desktop */
    border-radius: 0;
}

/* Desktop: show as phone-shaped frame */
@media (min-width: 500px) {
    #game-container {
        height: 95vh;
        width: auto;
        border-radius: 20px;
        box-shadow: 0 0 60px rgba(0,0,0,0.5);
    }
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ===== Name Overlay ===== */
#name-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#name-box {
    background: #fff;
    border-radius: 20px;
    padding: 30px 25px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    animation: nameBoxIn 0.3s ease-out;
}

@keyframes nameBoxIn {
    from { transform: scale(0.85) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

#name-title {
    font-size: 22px;
    font-weight: 800;
    color: #2C3E50;
    margin-bottom: 20px;
}

#name-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    outline: none;
    text-align: center;
    transition: border-color 0.2s;
    background: #F8F9FA;
    color: #2C3E50;
}

#name-input:focus {
    border-color: #E67E22;
    background: #FFF;
}

#name-input::placeholder {
    color: #AAA;
    font-weight: 400;
}

#name-btn {
    margin-top: 18px;
    width: 100%;
    padding: 14px;
    font-size: 18px;
    font-weight: 700;
    color: #FFF;
    background: linear-gradient(135deg, #F39C12, #D35400);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(211, 84, 0, 0.3);
}

#name-btn:active {
    transform: scale(0.96);
}
