/* Bilby X3M - styles kept simple for broad browser support */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#game-wrap {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

#game {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: #87ceeb;
    /* keep the pixel look crisp when scaled on old machines */
    image-rendering: optimizeSpeed;
    image-rendering: pixelated;
}

/* ---------- HUD ---------- */
#hud {
    position: absolute;
    top: 10px; left: 0;
    width: 100%;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}
.hud-item {
    display: inline-block;
    margin: 0 8px;
    padding: 4px 12px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-weight: bold;
    font-size: 20px;
    letter-spacing: 1px;
    border-radius: 6px;
}
#hud-time { color: #ffe14d; min-width: 90px; }
#hud-flips { color: #7CFC9A; }
#hud-best { color: #9ecbff; }

/* ---------- Centre overlay ---------- */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    text-align: center;
    background: rgba(20,20,40,0.78);
    color: #fff;
    z-index: 10;
    padding: 20px;
}
.overlay.hidden { display: none; }

.title {
    font-size: 64px;
    letter-spacing: 4px;
    text-shadow: 4px 4px 0 #e94560;
    line-height: 1;
}
.title span { color: #ffe14d; }
.subtitle { font-size: 20px; margin: 6px 0 20px; color: #9ecbff; letter-spacing: 2px; }
.keys { font-size: 16px; line-height: 1.9; margin-bottom: 22px; opacity: 0.92; }
.keys b { color: #ffe14d; }
.hint { margin-top: 16px; font-size: 14px; opacity: 0.7; }

.btn {
    font-family: inherit;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #1a1a2e;
    background: #ffe14d;
    border: none;
    border-bottom: 5px solid #c9ad1f;
    padding: 14px 38px;
    border-radius: 10px;
    cursor: pointer;
}
.btn:active { border-bottom-width: 2px; -webkit-transform: translateY(3px); transform: translateY(3px); }

/* ---------- Touch controls ---------- */
#touch-controls {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 120px;
    display: none;
    z-index: 6;
}
.touch-btn {
    position: absolute;
    bottom: 14px;
    width: 90px;
    height: 90px;
    line-height: 90px;
    text-align: center;
    font-size: 40px;
    color: #fff;
    background: rgba(0,0,0,0.35);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50%;
}
#touch-left { left: 18px; }
#touch-right { right: 18px; }

/* show touch controls only when the page flags a touch device */
body.touch #touch-controls { display: block; }
