:root{
  --bg:#0b1220;
  --panel:rgba(255,255,255,.05);
  --text:#e7ebff;
  --muted:rgba(231,235,255,.72);
  --line:rgba(255,255,255,.12);
  --accent:#8fb3ff;
}
*{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;
  overflow:hidden;
  overscroll-behavior:none;
  background:radial-gradient(1000px 700px at 18% -10%, rgba(61,86,230,.18), transparent 60%),
             radial-gradient(900px 600px at 80% 10%, rgba(234,93,46,.12), transparent 60%),
             var(--bg);
  color:var(--text);
}

body.matchFullscreen .legalBar{position:fixed;left:0;right:0;top:0}
body.matchFullscreen .app-root{
  position:fixed;
  left:0;right:0;
  top:var(--legalbar-h, 0px);
  bottom:0;
  max-width:none;
  margin:0;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
body.matchFullscreen .legalBar{display:none}
body.matchFullscreen .app-root{top:0;padding:2px;gap:2px}
body.matchFullscreen .row.head{display:none}
body.matchFullscreen #hubPill{display:none}
body.matchFullscreen #btnSound{display:none}
body.matchFullscreen .diffCtl{display:none}
body.matchFullscreen .statBest{display:none}
body.matchFullscreen #msg{display:none}
body.matchFullscreen .row.wrap{display:none}
body.matchFullscreen .stats{display:none}
body.matchFullscreen .panel{
  padding:4px 6px;
  border-radius:12px;
  background:rgba(0,0,0,.18);
}
body.matchFullscreen .panel{flex:0 0 auto}
body.matchFullscreen .canvasWrap{flex:1 1 auto;min-height:0;margin-top:0}
.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}
.app-root{max-width:1100px;margin:0 auto;padding:14px}
.panel{
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--panel);
  padding:12px;
  box-shadow:0 18px 42px rgba(0,0,0,.25);
}
.row{display:flex;gap:10px;align-items:center}
.row.wrap{flex-wrap:wrap}
.row.head{justify-content:space-between;align-items:flex-start}
.right{display:flex;gap:10px;align-items:center}
.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: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;
}
select{
  background:rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.14);
  color:var(--text);
  border-radius:10px;
  padding:8px 10px;
}
.stats{margin-top:10px;justify-content:space-between}
.grow{flex:1;min-width:220px}
.stat{
  display:flex;gap:8px;align-items:baseline;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.12);
  border-radius:12px;
  padding:8px 10px;
}
.stat .k{font-size:12px;color:rgba(231,235,255,.70);font-weight:800}
.stat .v{font-size:18px;font-weight:900}
.canvasWrap{
  margin-top:12px;
  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%}

.topLine{
  display:none;
  align-items:center;
  gap:8px;
  font-size:14px;
  font-weight:850;
  color:rgba(231,235,255,.92);
}
.topLine b{font-weight:1000}
.topSep{opacity:.55}
body.matchFullscreen .topLine{display:flex}

.touchHud{
  position:absolute;
  inset:0;
  pointer-events:none;
  display:none;
}
.moveBar{
  position:absolute;
  left:calc(14px + env(safe-area-inset-left));
  bottom:calc(14px + env(safe-area-inset-bottom));
  width:min(360px, 56vw);
  height:58px;
  border-radius:16px;
  border:1px solid rgba(143,179,255,.38);
  background:rgba(143,179,255,.12);
  box-shadow:0 18px 44px rgba(0,0,0,.32);
  overflow:hidden;
  pointer-events:auto;
  touch-action:none;
  -webkit-user-select:none;
  user-select:none;
}
.moveBar.active{background:rgba(143,179,255,.16)}
.moveFill{
  position:absolute;
  inset:0;
  background:linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.20), rgba(255,255,255,.08));
  transform:translateX(calc((var(--mv, 0.5) - 0.5) * 40%));
  opacity:.65;
}
.moveText{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  font-weight:950;
  letter-spacing:.3px;
  color:rgba(231,235,255,.92);
  text-transform:uppercase;
  font-size:14px;
  pointer-events:none;
}
.joyArea{
  position:absolute;
  left:calc(14px + env(safe-area-inset-left));
  bottom:calc(14px + env(safe-area-inset-bottom));
  width:220px;
  height:220px;
  pointer-events:auto;
  --jx:0px;
  --jy:0px;
  --joyBaseSize:148px;
  touch-action:none;
}
.joyBase{
  position:absolute;
  left:50%;
  top:50%;
  width:var(--joyBaseSize);
  height:var(--joyBaseSize);
  margin-left:calc(var(--joyBaseSize) * -0.5);
  margin-top:calc(var(--joyBaseSize) * -0.5);
  border-radius:50%;
  background:transparent;
  border:1px solid rgba(255,255,255,.18);
  box-shadow:0 18px 44px rgba(0,0,0,.35);
}
.joyKnob{
  position:absolute;
  left:50%;
  top:50%;
  width:66px;
  height:66px;
  margin-left:-33px;
  margin-top:-33px;
  border-radius:50%;
  background:rgba(143,179,255,.20);
  border:1px solid rgba(143,179,255,.42);
  transform:translate(var(--jx), var(--jy));
  transition:transform 80ms ease;
}
.joyKnob.active{transition:none}
.actions{
  position:absolute;
  right:calc(14px + env(safe-area-inset-right));
  bottom:calc(14px + env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  gap:12px;
  pointer-events:auto;
}
.actBtn{
  width:120px;
  height:58px;
  border-radius:16px;
  border:1px solid rgba(143,179,255,.38);
  background:rgba(143,179,255,.18);
  color:var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:950;
  letter-spacing:.5px;
  box-shadow:0 18px 44px rgba(0,0,0,.32);
  touch-action:none;
}
.actBtn svg{width:24px;height:24px;display:block}
.actBtn:active{transform:translateY(1px)}

@media (pointer:coarse){
  .touchHud{display:block}
}
