* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #07090c;
  color: #e8e4dc;
  font-family: "Segoe UI", system-ui, sans-serif;
  user-select: none;
  touch-action: none;
}
canvas { display: block; width: 100%; height: 100%; }

#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: radial-gradient(ellipse at 50% 30%, #1c2418, #07080a 70%);
  color: #f0d36c;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  gap: 8px;
}
#rotate .phone {
  font-size: 64px;
  transform: rotate(90deg);
  animation: spin 1.6s ease-in-out infinite;
}
#rotate p { margin: 12px 0 0; font-size: 22px; font-weight: 700; }
#rotate span { color: #9aa58b; font-size: 14px; }
@keyframes spin {
  0%, 40% { transform: rotate(0deg); }
  70%, 100% { transform: rotate(90deg); }
}

@media (orientation: portrait) and (max-width: 920px) {
  #rotate { display: flex; }
  #lobby, #hud, #touch { display: none !important; }
}

#lobby {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, #24301c 0%, #07080a 58%);
  padding: max(12px, env(safe-area-inset-top)) 24px;
}
.card {
  width: min(560px, 92vw);
  border: 1px solid rgba(212, 175, 55, 0.28);
  background: rgba(10, 12, 10, 0.9);
  padding: 16px 22px 14px;
}
.kicker {
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 11px;
  color: #9aa58b;
  text-transform: uppercase;
}
h1 {
  margin: 4px 0 6px;
  font-size: 36px;
  letter-spacing: 0.14em;
  color: #f0d36c;
}
.sub { margin: 0 0 12px; color: #b7b3a8; font-size: 13px; line-height: 1.4; }
label { display: block; font-size: 12px; color: #9aa58b; }
input {
  width: 100%;
  margin: 6px 0 12px;
  padding: 10px 12px;
  border: 1px solid #333;
  background: #101210;
  color: #fff;
  font-size: 16px;
}
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sides button {
  min-height: 48px;
  border: 1px solid #3d4a38;
  background: #151a14;
  color: #dfe8d6;
  font-size: 16px;
  font-weight: 700;
}
#pick-ct { border-color: #3d7ea6; color: #9ed0f0; }
#pick-t { border-color: #a66b32; color: #f0c49e; }
#lobby-status { margin: 10px 0 0; font-size: 13px; color: #8a9084; }

#hud { pointer-events: none; }
#topbar {
  position: fixed;
  top: max(6px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #d8d2c4;
  z-index: 5;
}
.brand { color: #e6c35a; font-weight: 700; }
#voice-state { color: #9ec4a8; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hpwrap {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 160px;
  height: 8px;
  background: #1a1a1a;
  border: 1px solid #555;
  z-index: 5;
}
#hp { height: 100%; width: 100%; background: linear-gradient(90deg, #8a1c14, #d4a24a); }
#cross {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45);
}
#killfeed {
  position: fixed;
  top: 34px;
  right: max(12px, env(safe-area-inset-right));
  text-align: right;
  font-size: 12px;
  z-index: 5;
  color: #eee;
  text-shadow: 0 1px 2px #000;
}
#names {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -120%);
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 3px #000;
  z-index: 5;
}

#touch {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
#stick {
  pointer-events: auto;
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.2);
}
#knob {
  position: absolute;
  left: 39px;
  top: 39px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(230, 195, 90, 0.9);
}
#fire, #voice {
  pointer-events: auto;
  position: absolute;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
}
#fire {
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 86px;
  height: 86px;
  border: 2px solid #e6c35a;
  background: rgba(160, 28, 22, 0.78);
}
#voice {
  right: max(112px, calc(env(safe-area-inset-right) + 96px));
  bottom: max(28px, env(safe-area-inset-bottom));
  width: 64px;
  height: 64px;
  border: 2px solid #6aa37a;
  background: rgba(18, 40, 28, 0.75);
  font-size: 12px;
}
#voice.hot { background: rgba(40, 160, 80, 0.85); border-color: #b6ffc8; }

body.lobby #hud, body.lobby #touch { display: none; }
body.play #lobby { display: none; }
