* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #06081a;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #e0e0e0;
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#backBtn {
    position: fixed; top: 14px; left: 14px; z-index: 100;
    color: #aaa; text-decoration: none; font-size: 14px; font-weight: 600;
    background: rgba(0,0,0,0.5); padding: 6px 14px; border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
#backBtn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.menu-link {
    display: inline-block; margin-top: 12px;
    color: #aaa; text-decoration: none; font-size: 13px; font-weight: 600;
    transition: color 0.2s;
}
.menu-link:hover { color: #fff; }

/* ---- Start Screen ---- */
#startScreen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(6,8,26,0.92);
    z-index: 10;
    gap: 16px;
}

#startScreen h1 {
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 12px;
    background: linear-gradient(135deg, #ff8844 0%, #ffcc44 50%, #ff6622 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0;
}

.tagline {
    font-size: 15px;
    color: #556;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.controls {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    font-size: 14px; color: #778;
}
.controls b { color: #ffaa66; }

#playBtn, #restartBtn, #createBtn, #joinBtn {
    margin-top: 20px;
    padding: 14px 48px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 4px;
    border: 2px solid rgba(255,136,68,0.3);
    border-radius: 6px;
    background: rgba(255,136,68,0.08);
    color: #ff8844;
    cursor: pointer;
    transition: all 0.2s;
}
#playBtn:hover, #restartBtn:hover, #createBtn:hover, #joinBtn:hover {
    background: rgba(255,136,68,0.18);
    border-color: rgba(255,136,68,0.5);
    transform: scale(1.04);
}

/* ---- Lobby Form ---- */
.lobby-form {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    margin-top: 18px;
}
.lobby-form input {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,136,68,0.25);
    border-radius: 6px;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    padding: 10px 16px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    width: 220px;
}
.lobby-form input:focus { border-color: rgba(255,136,68,0.6); }
.lobby-form input::placeholder { color: #556; }
#codeInput {
    width: 80px; letter-spacing: 4px; text-transform: uppercase; font-size: 18px;
}
.lobby-buttons {
    display: flex; align-items: center; gap: 16px; margin-top: 4px;
}
.lobby-join {
    display: flex; align-items: center; gap: 8px;
}
#createBtn, #joinBtn {
    margin-top: 0; padding: 10px 28px; font-size: 15px; letter-spacing: 3px;
}

/* ---- Lobby Waiting ---- */
#lobby {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(6,8,26,0.95);
    z-index: 12;
    gap: 18px;
}
#lobby h2 {
    font-size: 48px; font-weight: 900; letter-spacing: 10px;
    background: linear-gradient(135deg, #ff8844 0%, #ffcc44 50%, #ff6622 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.lobby-code {
    font-size: 22px; color: #aab; letter-spacing: 2px; font-weight: 600;
}
.lobby-code span {
    color: #ffcc44; font-size: 32px; letter-spacing: 6px; font-weight: 900;
}
#lobbyStatus {
    font-size: 14px; color: #667; letter-spacing: 1px; text-align: center;
    white-space: pre-line; line-height: 1.7;
}

/* ---- HUD ---- */
#hud {
    position: fixed;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 12px 20px;
    z-index: 5;
    pointer-events: none;
}
#hud.hidden { display: none; }

#scoreBox {
    font-size: 28px;
    font-weight: 800;
    color: #ff8844;
    letter-spacing: 2px;
    text-shadow: 0 0 12px rgba(255,136,68,0.4);
}

#heightBox {
    font-size: 18px;
    font-weight: 600;
    color: #ffcc44;
    letter-spacing: 1px;
}

/* ---- End Overlay ---- */
#endOverlay {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(6,8,26,0.92);
    z-index: 10;
    gap: 14px;
}
#endOverlay.hidden { display: none; }

#endTitle {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: 8px;
    color: #ff4444;
}

#endScore {
    font-size: 26px;
    font-weight: 700;
    color: #ff8844;
    letter-spacing: 2px;
}

#endStats {
    font-size: 13px;
    color: #667;
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.8;
}
