* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    height: 100%; overflow: hidden; background: #000;
    font-family: sans-serif; touch-action: none;
    user-select: none; -webkit-user-select: none;
}

#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

/* HUD */
#hud {
    position: fixed; top: 0; left: 0; right: 0;
    display: flex; align-items: center; gap: 14px;
    padding: 8px 12px;
    color: #fff; font-size: 1em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none; z-index: 5;
}
#progbar {
    flex: 1; height: 8px; border-radius: 4px;
    background: rgba(255,255,255,0.25); overflow: hidden;
}
#progfill { height: 100%; width: 0; background: #2ecc71; }

#msg {
    position: fixed; top: 18%; left: 0; right: 0;
    text-align: center; color: #ffd166; font-size: 1.4em; font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
    opacity: 0; transition: opacity 0.4s;
    pointer-events: none; z-index: 6;
}

/* 虚拟摇杆 */
#stick {
    position: fixed; left: 22px; bottom: 22px;
    width: 130px; height: 130px; border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.35);
    z-index: 6; touch-action: none;
}
#knob {
    position: absolute; left: 50%; top: 50%;
    width: 56px; height: 56px; border-radius: 50%;
    margin: -28px 0 0 -28px;
    background: rgba(255,255,255,0.45);
}

/* 按钮 */
#gas, #brake, #atk {
    position: fixed; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.5);
    color: #fff; line-height: 1.25; z-index: 6; touch-action: none;
}
#gas {
    right: 24px; bottom: 20px;
    width: 104px; height: 104px; font-size: 1.2em;
    background: rgba(46,158,68,0.85);
}
#gas:active { background: rgba(30,110,46,0.95); }
#brake {
    right: 146px; bottom: 28px;
    width: 76px; height: 76px; font-size: 1em;
    background: rgba(40,40,60,0.8);
}
#brake:active { background: rgba(20,20,35,0.95); }
#atk {
    right: 40px; bottom: 140px;
    width: 76px; height: 76px; font-size: 1em;
    background: rgba(230,57,70,0.85);
}
#atk:active { background: rgba(183,31,44,0.95); }

#home {
    position: fixed; top: 40px; left: 12px;
    color: rgba(255,255,255,0.75); font-size: 0.85em;
    text-decoration: none; text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    z-index: 5;
}

/* 面板 */
.panel {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center; gap: 12px;
    background: rgba(0,0,0,0.72); color: #fff;
    text-align: center; z-index: 10; padding: 16px;
    overflow-y: auto;
}
.panel.hidden { display: none; }
.panel h1 { font-size: 1.8em; }
.panel .help { color: #aaa; font-size: 0.85em; line-height: 1.7; }
button.big {
    font-size: 1.1em; padding: 12px 42px;
    border: none; border-radius: 10px;
    background: #2e9e44; color: #fff; cursor: pointer;
    min-width: 240px;
}
button.big:active { background: #1e6e2e; }
#btn-shop, #btn-res-shop { background: #e67e22; }
#btn-shop:active, #btn-res-shop:active { background: #b35f15; }
#btn-shop-back, #btn-retry { background: #555; }
#btn-shop-back:active, #btn-retry:active { background: #333; }

/* 商店列表 */
#shop-list { display: flex; flex-direction: column; gap: 8px; width: min(560px, 92vw); }
.shop-item {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.08); border-radius: 10px;
    padding: 8px 12px; text-align: left; font-size: 0.9em;
}
.shop-item .info { flex: 1; }
.shop-item .stats { color: #aaa; font-size: 0.85em; }
.shop-item button {
    padding: 8px 16px; border: none; border-radius: 8px;
    background: #e67e22; color: #fff; cursor: pointer; white-space: nowrap;
}
.shop-item button.owned { background: #2e9e44; }
.shop-item button.current { background: #555; }
.shop-item button:disabled { background: #333; color: #888; }

/* 竖屏提示 */
#rotate {
    display: none;
    position: fixed; inset: 0; z-index: 99;
    background: #000; color: #fff;
    font-size: 1.6em; text-align: center;
    padding-top: 40vh;
}
@media (orientation: portrait) { #rotate { display: block; } }
