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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #050a10;
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* ── 游戏 Canvas 全屏 ── */
#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: block;
    background: #050a10;
    touch-action: none;
}

/* ── 游戏结束弹窗 ── */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(10, 10, 30, 0.92) 0%, rgba(0, 0, 0, 0.95) 100%);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 200;
    backdrop-filter: blur(6px);
}

.game-over h2 {
    font-size: 3.2em;
    margin-bottom: 20px;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.8), 0 0 40px rgba(255, 68, 68, 0.4);
    letter-spacing: 4px;
    font-weight: 700;
}

.game-over p {
    font-size: 1.4em;
    margin-bottom: 12px;
    color: #c8e8ff;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.game-over p span {
    color: #00c8ff;
    font-weight: 700;
}

.game-over-btns {
    display: flex;
    gap: 16px;
    margin-top: 30px;
}

/* ── 通用按钮 ── */
button {
    background: linear-gradient(135deg, #1a7aad 0%, #0d5c87 100%);
    color: #ffffff;
    border: 1px solid rgba(0, 200, 255, 0.4);
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    letter-spacing: 1px;
    transition: all 0.22s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

button:hover {
    background: linear-gradient(135deg, #2196c8 0%, #1470a0 100%);
    border-color: rgba(0, 200, 255, 0.7);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 12px rgba(0, 200, 255, 0.3);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}

#restartBtn, #backToLobbyBtn {
    font-size: 1.1em;
    padding: 14px 36px;
    letter-spacing: 2px;
}

#restartBtn {
    background: linear-gradient(135deg, #1aad6e 0%, #0d875a 100%);
    border-color: rgba(0, 255, 150, 0.4);
}

#restartBtn:hover {
    background: linear-gradient(135deg, #21c87e 0%, #14a06e 100%);
    border-color: rgba(0, 255, 150, 0.7);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 255, 150, 0.4);
}

/* ── 联机大厅 overlay ── */
.mp-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(5, 15, 30, 0.97) 0%, rgba(3, 8, 16, 0.99) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.mp-card {
    background: linear-gradient(160deg, #0d1f35 0%, #091624 100%);
    border: 1px solid rgba(0, 200, 255, 0.25);
    border-radius: 20px;
    padding: 40px 36px;
    width: min(420px, 92vw);
    box-shadow: 0 0 60px rgba(0, 200, 255, 0.1), 0 20px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.mp-title {
    color: #00c8ff;
    font-size: 2.4em;
    font-weight: 800;
    letter-spacing: 6px;
    text-shadow: 0 0 24px rgba(0, 200, 255, 0.7), 0 0 48px rgba(0, 200, 255, 0.3);
    margin-bottom: 6px;
}

.mp-subtitle {
    color: rgba(0, 200, 255, 0.45);
    font-size: 0.85em;
    letter-spacing: 3px;
    margin-bottom: 32px;
}

.mp-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mp-btn {
    width: 100%;
    padding: 14px;
    font-size: 1em;
    border-radius: 10px;
    letter-spacing: 2px;
}

.mp-btn-primary {
    background: linear-gradient(135deg, #1aad6e 0%, #0d875a 100%);
    border-color: rgba(0, 255, 150, 0.4);
}

.mp-btn-primary:hover {
    background: linear-gradient(135deg, #21c87e 0%, #14a06e 100%);
    border-color: rgba(0, 255, 150, 0.7);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 255, 150, 0.35);
}

.mp-btn-secondary {
    background: linear-gradient(135deg, #1a7aad 0%, #0d5c87 100%);
    border-color: rgba(0, 200, 255, 0.4);
    width: auto;
    white-space: nowrap;
    padding: 14px 20px;
    flex-shrink: 0;
}

.mp-btn-ghost {
    background: transparent;
    border: 1px solid rgba(0, 200, 255, 0.2);
    color: rgba(200, 232, 255, 0.6);
    font-size: 0.9em;
    letter-spacing: 1px;
}

.mp-btn-ghost:hover {
    border-color: rgba(0, 200, 255, 0.5);
    color: rgba(200, 232, 255, 0.9);
    background: rgba(0, 200, 255, 0.05);
    box-shadow: none;
}

.mp-join-row {
    display: flex;
    gap: 8px;
}

.mp-input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(0, 200, 255, 0.06);
    border: 1px solid rgba(0, 200, 255, 0.25);
    border-radius: 10px;
    color: #fff;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
}

.mp-input::placeholder {
    color: rgba(200, 232, 255, 0.3);
    font-size: 0.85em;
    letter-spacing: 1px;
    font-weight: 400;
    text-transform: none;
}

.mp-input:focus {
    border-color: rgba(0, 200, 255, 0.6);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.15);
}

.mp-status {
    margin-top: 16px;
    min-height: 24px;
    font-size: 0.9em;
    color: rgba(200, 232, 255, 0.7);
    letter-spacing: 1px;
}

.mp-status.error {
    color: #ff6666;
}

.mp-status.success {
    color: #66ffbb;
}

/* ── 大厅等待区 ── */
.mp-lobby {
    margin-top: 20px;
    padding: 16px;
    background: rgba(0, 200, 255, 0.04);
    border: 1px solid rgba(0, 200, 255, 0.15);
    border-radius: 12px;
    text-align: left;
}

.mp-room-code {
    color: rgba(200, 232, 255, 0.6);
    font-size: 0.85em;
    margin-bottom: 12px;
    text-align: center;
}

.mp-room-code span {
    color: #00c8ff;
    font-size: 1.8em;
    font-weight: 800;
    letter-spacing: 6px;
    display: block;
    margin-top: 4px;
    text-shadow: 0 0 12px rgba(0, 200, 255, 0.6);
}

.mp-player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.mp-player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 200, 255, 0.06);
    border-radius: 8px;
    color: #c8e8ff;
    font-size: 0.9em;
}

.mp-player-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mp-start-btn {
    width: 100%;
    margin-top: 4px;
}

.mp-wait-msg {
    text-align: center;
    color: rgba(200, 232, 255, 0.5);
    font-size: 0.85em;
    letter-spacing: 1px;
    margin-top: 4px;
    padding: 8px 0;
}

/* ── 响应式：窄屏/横屏手机 ── */
@media (max-height: 500px) {
    .mp-card {
        padding: 24px 28px;
    }
    .mp-title {
        font-size: 1.8em;
        margin-bottom: 4px;
    }
    .mp-subtitle {
        margin-bottom: 20px;
    }
    .mp-buttons {
        gap: 8px;
    }
    .mp-btn {
        padding: 10px;
    }
}

@media (max-width: 380px) {
    .mp-card {
        padding: 28px 20px;
        border-radius: 14px;
    }
    .mp-title {
        font-size: 2em;
        letter-spacing: 4px;
    }
}
