/* box-fighter の画面の見た目 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #1b2330; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* 画面（タイトル・部屋・結果） */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(20, 28, 40, 0.82); text-align: center; padding: 16px; z-index: 20;
}
.screen h1 { font-size: clamp(32px, 8vw, 72px); letter-spacing: 0.08em; margin: 0 0 24px; }
.screen h2 { font-size: clamp(28px, 6vw, 56px); margin: 0 0 8px; }
.menu { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.menu button {
  font-size: 20px; padding: 14px 26px; border-radius: 12px; border: none; cursor: pointer;
  background: #2f8cff; color: #fff; font-weight: bold; min-width: 150px;
}
.menu button.sub { background: #56606e; }
.menu button:active { transform: scale(0.97); }
.hint { opacity: 0.7; font-size: 14px; margin-top: 24px; }
.small { font-size: 13px; opacity: 0.8; word-break: break-all; max-width: 90vw; }
.big-code { font-size: clamp(40px, 10vw, 84px); font-weight: bold; letter-spacing: 0.2em; font-family: ui-monospace, Consolas, monospace; }
#join-code {
  font-size: 36px; width: 8em; text-align: center; letter-spacing: 0.2em; text-transform: uppercase;
  font-family: ui-monospace, Consolas, monospace; padding: 8px; border-radius: 8px; border: 2px solid #2f8cff;
  user-select: text; -webkit-user-select: text;
}

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud-top {
  position: absolute; top: max(8px, env(safe-area-inset-top)); left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: center; gap: 16px; padding: 0 16px;
}
.hp-box { flex: 1; max-width: 360px; }
.hp-name { font-size: 13px; font-weight: bold; text-shadow: 0 1px 2px #000; }
.hp-bar { height: 14px; background: rgba(0, 0, 0, 0.45); border-radius: 7px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.5); }
.hp-fill { height: 100%; width: 100%; transition: width 0.15s; }
#hp-op .hp-bar { transform: scaleX(-1); }
.blue .hp-fill { background: #3b8cff; }
.orange .hp-fill { background: #ff9a2e; }
#timer { font-size: 26px; font-weight: bold; min-width: 76px; text-align: center; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
#hud-parts {
  position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.slot {
  background: rgba(0, 0, 0, 0.5); border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: bold;
  border-left: 4px solid #888; white-space: nowrap;
}
#part-popup {
  position: absolute; top: 28%; left: 50%; transform: translateX(-50%);
  font-size: clamp(28px, 6vw, 54px); font-weight: bold; text-shadow: 0 2px 6px #000; white-space: nowrap;
}
#countdown {
  position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
  font-size: clamp(64px, 16vw, 140px); font-weight: bold; text-shadow: 0 3px 10px #000;
}

/* タッチ操作 */
#touch { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#stick-zone { position: absolute; left: 0; top: 15%; bottom: 0; width: 45%; pointer-events: auto; touch-action: none; }
#stick-base {
  position: absolute; width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); border: 2px solid rgba(255, 255, 255, 0.35);
  left: 100px; bottom: 100px; transform: translate(-50%, 50%);
}
#stick-knob {
  position: absolute; width: 60px; height: 60px; border-radius: 50%; left: 50%; top: 50%;
  background: rgba(255, 255, 255, 0.45); transform: translate(-50%, -50%);
}
#buttons {
  position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: 24px;
  width: 210px; height: 210px; pointer-events: none;
}
.tbtn {
  position: absolute; width: 74px; height: 74px; border-radius: 50%; pointer-events: auto; touch-action: none;
  border: 2px solid rgba(255, 255, 255, 0.6); color: #fff; font-weight: bold; font-size: 14px;
  background: rgba(30, 40, 60, 0.45); padding: 0;
}
.tbtn.on { background: rgba(255, 255, 255, 0.45); }
/* ひし形：上＝ポッド、左＝ボム、右＝ガン、下＝ジャンプ */
#btn-pod { left: 68px; top: 0; }
#btn-bomb { left: 0; top: 68px; }
#btn-gun { left: 136px; top: 68px; }
#btn-jump { left: 68px; top: 136px; }

#btn-quit {
  position: fixed; top: calc(max(8px, env(safe-area-inset-top)) + 38px); left: max(8px, env(safe-area-inset-left)); z-index: 16;
  font-size: 13px; padding: 6px 12px; border-radius: 8px; border: none; background: rgba(0, 0, 0, 0.5); color: #fff;
}

#rotate {
  display: none; position: fixed; inset: 0; z-index: 100; background: #1b2330; color: #fff;
  align-items: center; justify-content: center; font-size: 26px; font-weight: bold; text-align: center; padding: 24px;
}
@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: flex; }
}

#debug {
  position: fixed; right: 6px; top: 50px; z-index: 50; font: 12px ui-monospace, Consolas, monospace;
  background: rgba(0, 0, 0, 0.6); padding: 4px 6px; border-radius: 4px; white-space: pre; pointer-events: none;
}
