/* motorush — 竖屏优先，桌面调试也可玩 */

:root {
  --pad: 22px;
  --btn: 74px;
  --joy: 128px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #05060c;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Courier New", ui-monospace, monospace;
}

#app { position: fixed; inset: 0; }

#screen {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------- 控制区 ---------- */

.pad {
  position: absolute;
  display: flex;
  pointer-events: none;
  z-index: 10;
}

.pad > * { pointer-events: auto; }

/* 左：拳 / 踢 */
.pad.left {
  left: calc(var(--pad) + var(--safe-l));
  bottom: calc(var(--pad) + var(--safe-b));
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 10px;
}

.btn {
  width: var(--btn); height: var(--btn);
  border-radius: 50%;
  background: rgba(20, 22, 34, 0.55);
  border: 2px solid rgba(226, 220, 206, 0.42);
  display: grid; place-items: center;
  color: #f0ece0;
  font-size: 26px;
  text-shadow: 0 2px 4px rgba(0,0,0,.7);
  transition: transform .05s linear, background .05s linear;
}

.btn.down {
  background: rgba(210, 84, 68, 0.72);
  border-color: rgba(255, 226, 200, 0.9);
  transform: scale(0.93);
}

/* 踢比拳小一号、更靠外侧（次要动作） */
#btnKick {
  width: calc(var(--btn) * 0.86);
  height: calc(var(--btn) * 0.86);
  font-size: 22px;
  margin-left: 22px;
}

/* 右：固定摇杆 */
.pad.right {
  right: calc(var(--pad) + var(--safe-r));
  bottom: calc(var(--pad) + var(--safe-b));
}

#stick {
  position: relative;
  width: var(--joy); height: var(--joy);
  border-radius: 50%;
  background: rgba(20, 22, 34, 0.42);
  border: 2px solid rgba(226, 220, 206, 0.34);
}

#stick::before,
#stick::after {
  content: "";
  position: absolute;
  background: rgba(226, 220, 206, 0.16);
}
/* 十字方向提示：上下=油门/刹车，左右=转向 */
#stick::before { left: 50%; top: 12%; bottom: 12%; width: 2px; margin-left: -1px; }
#stick::after  { top: 50%; left: 12%; right: 12%; height: 2px; margin-top: -1px; }

#knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 46%; height: 46%;
  margin: -23% 0 0 -23%;
  border-radius: 50%;
  background: rgba(232, 226, 210, 0.82);
  box-shadow: 0 2px 8px rgba(0,0,0,.55);
  will-change: transform;
}

/* ---------- 开场遮罩 ---------- */

#start {
  position: absolute; inset: 0;
  z-index: 20;
  display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 20%, #1a1147 0%, #0a0e27 55%, #05060c 100%);
  text-align: center;
  padding: 24px;
}

#start.hide { display: none; }

#start h1 {
  font-size: clamp(30px, 11vw, 54px);
  letter-spacing: 2px;
  background: linear-gradient(180deg, #fff 25%, #cdd6ff 70%, #a9b7f2 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

#start .sub {
  color: #8f93ad;
  font-size: 13px;
  margin-top: 8px;
  letter-spacing: 1px;
}

#start button {
  margin: 26px 0 18px;
  padding: 13px 34px;
  font: inherit;
  font-size: 16px;
  letter-spacing: 2px;
  color: #0a0e27;
  background: #d8dcf2;
  border: 0; border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}
#start button:active { transform: scale(.96); }

#start .tip {
  color: #6d7189;
  font-size: 12px;
  line-height: 1.7;
}

/* 桌面端把摇杆和按键排开一点，方便鼠标试玩 */
@media (pointer: fine) and (min-width: 700px) {
  :root { --joy: 150px; --btn: 84px; --pad: 32px; }
}