:root{
  --bg:#0b1220;
  --panel:rgba(255,255,255,.05);
  --text:#e7ebff;
  --muted:rgba(231,235,255,.72);
  --line:rgba(255,255,255,.12);
  --blue:#8fb3ff;
  --good:#5bf0b2;
  --bad:#ff6b6b;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
input,textarea,[contenteditable]{-webkit-user-select:text;user-select:text}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  display:flex;
  flex-direction:column;
  height:100dvh;
  overflow:hidden;
  overscroll-behavior:none;
  background:radial-gradient(1000px 700px at 18% -10%, rgba(39,177,236,.18), transparent 60%),
             radial-gradient(900px 600px at 80% 10%, rgba(233,156,32,.14), transparent 60%),
             var(--bg);
  color:var(--text);
}
.legalBar{
  position:sticky;top:0;z-index:10;
  display:flex;gap:10px;align-items:center;justify-content:center;
  padding:10px 12px;
  background:rgba(0,0,0,.35);
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(8px);
  font-size:13px;
}
.legalBar a{color:rgba(231,235,255,.9);text-decoration:none}
.legalBar a:hover{text-decoration:underline}
.sep{opacity:.55}
.playing .legalBar{padding:6px 10px;font-size:12px}
.playing .app-root{padding:8px;gap:10px}
.app-root{
  max-width:1200px;
  margin:0 auto;
  padding:12px;
  width:100%;
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.panel{
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--panel);
  padding:12px;
  box-shadow:0 18px 42px rgba(0,0,0,.25);
  min-height:0;
}
.row{display:flex;gap:10px;align-items:center}
.row.wrap{flex-wrap:wrap}
.title{font-weight:900;letter-spacing:.3px;font-size:22px}
.muted{color:var(--muted)}
.muted.small{font-size:13px}
.pill{
  padding:6px 10px;border-radius:999px;
  background:rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.12);
  font-size:13px;
}
.btn{
  border:1px solid rgba(143,179,255,.35);
  background:rgba(143,179,255,.18);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
}
.btn.small{
  padding:8px 10px;
  border-radius:12px;
  font-size:13px;
}
.btn:hover{background:rgba(143,179,255,.24)}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn.ghost{
  background:rgba(0,0,0,.18);
  border-color:rgba(255,255,255,.14);
  font-weight:750;
}
input,select,textarea{
  background:rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.14);
  color:var(--text);
  border-radius:10px;
  padding:10px 12px;
}
textarea{min-height:88px;resize:vertical}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.teamBox{
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  padding:10px;
  background:rgba(0,0,0,.12);
}
.teamHead{display:flex;justify-content:space-between;align-items:center}
.teamA{color:rgba(143,179,255,.95)}
.teamB{color:rgba(255,107,107,.95)}
.list{margin-top:8px;display:grid;gap:6px}
.teamBox .list{max-height:min(220px, 22dvh);overflow:auto}
body.lobbyCollapsed .teamBox .list{max-height:min(120px, 14dvh)}
.choiceBtn{
  min-width:110px;
}
.choiceBtn.sel{
  border-color:rgba(91,240,178,.55);
  background:rgba(91,240,178,.14);
}
.list .item{
  display:flex;justify-content:space-between;gap:8px;align-items:center;
  padding:8px 10px;border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.10);
}
.canvasWrap{
  flex:1;
  min-height:320px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:16px;
  overflow:hidden;
  background:rgba(0,0,0,.18);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
}
canvas{display:block;touch-action:none;max-width:100%;max-height:100%}
.hud{
  position:absolute;left:10px;right:10px;top:10px;
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:10px;
  align-items:flex-start;
  pointer-events:none;
}
.hudLeft{justify-self:start}
.hudCenter{justify-self:center;text-align:center}
.hudRight{justify-self:end}
.radar{
  display:block;
  width:140px;
  height:140px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.04);
}
.hud .panel{
  padding:10px;border-radius:14px;background:rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.14);
  backdrop-filter:blur(8px);
  box-shadow:none;
}
.hud .hudRight.panel{
  background:rgba(0,0,0,.18);
  border-color:rgba(255,255,255,.10);
}
.hpBar{
  position:relative;
  width:min(220px, 40vw);
  height:22px;
  border-radius:999px;
  overflow:hidden;
  background:rgba(0,0,0,.22);
  border:1px solid rgba(255,255,255,.14);
}
.hpFill{
  position:absolute;
  inset:0;
  width:0%;
  background:rgba(91,240,178,.85);
  transition:width 120ms linear;
}
.hpBar.mid .hpFill{background:rgba(233,156,32,.85)}
.hpBar.low .hpFill{background:rgba(255,107,107,.85)}
.hpText{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:900;
  letter-spacing:.2px;
  color:rgba(231,235,255,.95);
  text-shadow:0 1px 2px rgba(0,0,0,.75);
}
.chatWrap{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.chatLog{
  flex:1;
  min-height:0;
  overflow:auto;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(0,0,0,.12);
  padding:8px;
  font-size:13px;
}
.chatMsg{margin:4px 0}
.chatMsg .who{opacity:.9;font-weight:800}
.chatMsg .txt{opacity:.85}
.joysticks{
  position:absolute;left:0;right:0;bottom:0;
  display:flex;justify-content:space-between;gap:10px;
  padding:12px;
  pointer-events:none;
}
.layoutingControls .joysticks{
  position:fixed;
  inset:0;
  padding:12px;
  z-index:70;
  pointer-events:auto;
}
.joysticks.customLayout{
  top:0;
  bottom:0;
  padding:0;
}
.joysticks.customLayout .leftControls,
.joysticks.customLayout .rightControls{
  position:absolute;
}
.layoutingControls .leftControls,
.layoutingControls .rightControls{
  pointer-events:auto;
}
.leftControls{
  display:flex;
  gap:10px;
  align-items:flex-end;
  pointer-events:none;
}
.rightControls{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:10px;
  pointer-events:none;
}
.rightRow{
  display:flex;
  gap:10px;
  align-items:flex-end;
  justify-content:flex-end;
  pointer-events:none;
}
.overlayPanel{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:calc(100% - 24px);
  max-width:420px;
  pointer-events:auto;
  background:rgba(0,0,0,.55);
  border-color:rgba(143,179,255,.22);
}
.stick{
  width:min(190px, 42vw);
  aspect-ratio:1/1;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.12);
  backdrop-filter:blur(8px);
  position:relative;
  pointer-events:auto;
  touch-action:none;
}
.lookPad{
  width:min(220px, 46vw);
  height:44px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.10);
  box-shadow:0 16px 36px rgba(0,0,0,.12);
  pointer-events:auto;
  user-select:none;
  touch-action:none;
}
.lookPad:active{background:rgba(0,0,0,.16)}
.shootBtn{
  width:86px;
  height:86px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  align-self:flex-start;
  font-weight:1000;
  letter-spacing:.4px;
  color:rgba(231,235,255,.95);
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,107,107,.16);
  box-shadow:0 16px 36px rgba(0,0,0,.25);
  pointer-events:auto;
  user-select:none;
  touch-action:none;
}
.ctrlIcon{width:30px;height:30px;display:block}
.ctrlIcon path,.ctrlIcon circle{vector-effect:non-scaling-stroke}
.shootBtn:active{background:rgba(255,107,107,.26)}
.shootBtn:focus{outline:none;box-shadow:0 0 0 3px rgba(143,179,255,.35),0 16px 36px rgba(0,0,0,.25)}
.mineBtn{
  width:86px;
  height:66px;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:1000;
  letter-spacing:.4px;
  color:rgba(231,235,255,.95);
  border:1px solid rgba(255,255,255,.18);
  background:rgba(143,179,255,.14);
  box-shadow:0 16px 36px rgba(0,0,0,.20);
  pointer-events:auto;
  user-select:none;
  touch-action:none;
}
.mineBtn:active{background:rgba(143,179,255,.22)}
.mineBtn:focus{outline:none;box-shadow:0 0 0 3px rgba(143,179,255,.35),0 16px 36px rgba(0,0,0,.25)}
.specialBtn{
  width:86px;
  height:66px;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:1000;
  letter-spacing:.4px;
  color:rgba(231,235,255,.95);
  border:1px solid rgba(255,255,255,.18);
  background:rgba(233,156,32,.16);
  box-shadow:0 16px 36px rgba(0,0,0,.20);
  pointer-events:auto;
  user-select:none;
  touch-action:none;
}
.specialBtn:active{background:rgba(233,156,32,.26)}
.specialBtn:focus{outline:none;box-shadow:0 0 0 3px rgba(143,179,255,.35),0 16px 36px rgba(0,0,0,.25)}
.specialBtn.disabled{
  opacity:0.38;
  filter:grayscale(0.35);
  pointer-events:none;
}
.nub{
  position:absolute;left:50%;top:50%;
  width:46px;height:46px;border-radius:999px;
  transform:translate(-50%,-50%);
  background:rgba(143,179,255,.22);
  border:1px solid rgba(143,179,255,.35);
}
@media (max-width:760px){
  .grid2{grid-template-columns:1fr}
  .title{font-size:20px}
}

.countdownOverlay{
  position:fixed;
  inset:0;
  z-index:50;
  display:none;
  background:
    url("/countdown-bg.svg") center / cover no-repeat,
    radial-gradient(1200px 800px at 20% 10%, rgba(39,177,236,.22), transparent 55%),
    radial-gradient(1000px 700px at 80% 0%, rgba(233,156,32,.16), transparent 55%),
    rgba(6,10,18,.95);
  backdrop-filter:blur(10px);
}
.countdownOverlay.on{display:flex}
.countdownOverlay .inner{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  padding:18px;
  gap:14px;
}
.countdownOverlay .top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  font-weight:900;
  letter-spacing:.3px;
}
.countdownOverlay .mid{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  text-align:center;
}
.countdownRow{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.countdownTeam{
  width:min(260px, 32vw);
  max-height:46dvh;
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:stretch;
}
.countdownList{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:stretch;
}
.countdownList .pill{
  text-align:left;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.countdownOverlay .count{
  font-size:clamp(72px, 18vw, 190px);
  font-weight:1000;
  line-height:1;
}
.countdownOverlay .sub{
  color:rgba(231,235,255,.82);
  font-size:clamp(14px, 2.4vw, 18px);
}
.countdownOverlay .actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.countdownOverlay .hint{color:rgba(231,235,255,.72);font-size:13px}

/* Orientation hint is handled via JS per language. */

.endOverlay{
  position:fixed;
  inset:0;
  z-index:60;
  display:none;
  background:rgba(6,10,18,.86);
  backdrop-filter:blur(10px);
}
.endOverlay .inner{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.endCard{
  width:min(720px, calc(100vw - 24px));
  max-height:calc(100dvh - 24px);
  overflow:auto;
  background:rgba(0,0,0,.55);
  border-color:rgba(143,179,255,.22);
}
.endStats .statGrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.endStats .statCol{
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  padding:10px;
  background:rgba(0,0,0,.12);
  min-height:0;
}
.endStats .statList{
  margin-top:8px;
  display:grid;
  gap:6px;
  max-height:min(320px, 36dvh);
  overflow:auto;
}
.statRow{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.10);
}
.statRow .who{font-weight:900;opacity:.92}

@media (max-width:760px){
  .endStats .statGrid{grid-template-columns:1fr}
}
