html,body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  background:#bfe9df;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#29405a;
  touch-action:none;
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
}
#game{
  position:fixed;
  inset:0;
  width:100%;
  height:100%;
  display:block;
}
#hud{
  position:fixed;
  top:12px;
  left:14px;
  right:14px;
  z-index:20;
  display:flex;
  gap:10px;
  align-items:center;
  pointer-events:none;
}
.hud-card{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border-radius:22px;
  background:rgba(255,250,235,.84);
  border:1px solid rgba(255,255,255,.95);
  box-shadow:0 12px 28px rgba(0,68,120,.16), inset 0 1px rgba(255,255,255,.9);
  backdrop-filter:blur(14px);
  font-size:15px;
}
.hud-card b{font-size:22px;color:#2f6f8f}
.icon{font-size:24px}
.weather{margin-left:auto}
#restartBtn{
  position:fixed;
  top:86px;
  right:16px;
  z-index:22;
  width:104px;
  height:82px;
  border:0;
  border-radius:22px;
  background:linear-gradient(#76a9c8,#3f7b9e);
  color:white;
  font-size:36px;
  font-weight:900;
  box-shadow:0 14px 30px rgba(0,60,120,.25), inset 0 2px rgba(255,255,255,.35);
}
#restartBtn span{
  display:block;
  font-size:12px;
  letter-spacing:.04em;
}
#toast{
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  z-index:40;
  padding:14px 20px;
  border-radius:18px;
  background:rgba(0,35,60,.78);
  color:white;
  font-size:22px;
  font-weight:900;
  opacity:0;
  transition:opacity .15s;
  pointer-events:none;
}
#controls{
  position:fixed;
  left:18px;
  right:18px;
  bottom:16px;
  z-index:25;
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
}
.control-card{
  position:relative;
  width:152px;
  height:152px;
  border-radius:28px;
  background:rgba(255,255,255,.54);
  border:1px solid rgba(255,255,255,.9);
  box-shadow:0 14px 34px rgba(0,60,110,.22), inset 0 1px rgba(255,255,255,.85);
  backdrop-filter:blur(14px);
}
.control-card button{
  position:absolute;
  width:50px;
  height:50px;
  border:0;
  border-radius:15px;
  color:white;
  background:linear-gradient(#7db7d3,#407d9e);
  font-size:22px;
  font-weight:1000;
  box-shadow:0 8px 16px rgba(0,70,130,.22), inset 0 2px rgba(255,255,255,.35);
  touch-action:none;
}
.control-card button:nth-child(1){left:51px;top:8px}
.control-card button:nth-child(2){left:8px;top:51px}
.control-card button:nth-child(3){left:51px;top:94px}
.control-card button:nth-child(4){left:94px;top:51px}
.control-card label{
  position:absolute;
  left:0;
  right:0;
  bottom:10px;
  text-align:center;
  font-size:12px;
  font-weight:900;
  color:#155a9e;
}
#countBtn{
  width:230px;
  height:72px;
  border:0;
  border-radius:24px;
  color:white;
  font-size:24px;
  font-weight:1000;
  background:linear-gradient(#9cd56f,#5fa343);
  box-shadow:0 14px 30px rgba(24,120,40,.28), inset 0 2px rgba(255,255,255,.45);
  margin-bottom:2px;
}
button:active{transform:scale(.96)}
.small-note{
  width:152px;
}
.range-dot{
  position:absolute;
  left:50%;
  top:52px;
  width:56px;
  height:56px;
  transform:translate(-50%,-50%);
  border-radius:50%;
  background:radial-gradient(circle at 35% 30%, #84c9ff, #166fd0);
  box-shadow:0 0 0 10px rgba(23,112,208,.18), inset 0 2px rgba(255,255,255,.4);
}
@media(max-width:760px){
  #hud{gap:6px;left:8px;right:8px;top:8px}
  .hud-card{padding:8px 9px;font-size:12px}
  .hud-card b{font-size:18px}
  .weather{display:none}
  #restartBtn{top:74px;right:10px;width:84px;height:68px;font-size:28px}
  #controls{left:10px;right:10px;bottom:10px;gap:8px}
  .control-card{width:128px;height:128px;border-radius:24px}
  .control-card button{width:42px;height:42px;font-size:18px}
  .control-card button:nth-child(1){left:43px;top:7px}
  .control-card button:nth-child(2){left:7px;top:43px}
  .control-card button:nth-child(3){left:43px;top:79px}
  .control-card button:nth-child(4){left:79px;top:43px}
  .control-card label{font-size:10px;bottom:7px}
  #countBtn{width:140px;height:62px;font-size:18px}
  .small-note{display:none}
}


.logo-pill{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 16px;
  border-radius:999px;
  background:rgba(255,248,234,.88);
  border:1px solid rgba(255,255,255,.95);
  box-shadow:0 12px 28px rgba(0,68,120,.16), inset 0 1px rgba(255,255,255,.9);
  backdrop-filter:blur(14px);
  font-weight:900;
  color:#38596a;
  letter-spacing:.02em;
}
#hud{flex-wrap:wrap}
#restartBtn,#soundBtn{
  position:fixed;
  z-index:22;
  width:104px;
  height:82px;
  border:0;
  border-radius:22px;
  color:white;
  box-shadow:0 14px 30px rgba(0,60,120,.25), inset 0 2px rgba(255,255,255,.35);
}
#restartBtn{
  top:86px;
  right:16px;
  background:linear-gradient(#76a9c8,#3f7b9e);
  font-size:36px;
  font-weight:900;
}
#soundBtn{
  top:176px;
  right:16px;
  background:linear-gradient(#e2c56e,#b58c3a);
  font-size:30px;
  font-weight:900;
}
#restartBtn span,#soundBtn span{
  display:block;
  font-size:12px;
  letter-spacing:.04em;
}
#soundBtn.muted{background:linear-gradient(#c7c7c7,#8b8b8b)}
.control-card{
  background:rgba(255,252,246,.58);
}
#countBtn{
  width:246px;
  height:76px;
  border-radius:26px;
  background:linear-gradient(#a8d874,#6bac45);
  text-shadow:0 1px 0 rgba(0,0,0,.15);
}
#countBtn.ready{
  transform:scale(1.03);
  box-shadow:0 16px 34px rgba(24,120,40,.34), inset 0 2px rgba(255,255,255,.45), 0 0 0 6px rgba(110,180,70,.16);
}
#countBtn:active{transform:scale(.98)}
#toast{max-width:min(70vw,420px);text-align:center;line-height:1.2}
@media(max-width:760px){
  .logo-pill{padding:8px 12px;font-size:13px}
  #restartBtn{top:74px;right:10px;width:84px;height:68px;font-size:28px}
  #soundBtn{top:148px;right:10px;width:84px;height:60px;font-size:24px}
    #countBtn{width:152px;height:62px;font-size:18px}
}


/* Website fix / compact UI */
#failMsg{
  position:fixed;
  inset:auto 12px 88px 12px;
  z-index:5;
  text-align:center;
  color:rgba(35,64,82,.72);
  font-weight:800;
  pointer-events:none;
}
body.loaded #failMsg{display:none}

#hud{
  align-items:flex-start;
  gap:8px;
}
.logo-pill{
  display:none !important;
}
.hud-card{
  padding:7px 10px;
  border-radius:16px;
  font-size:13px;
}
.hud-card b{
  font-size:17px;
}
.icon{
  font-size:17px;
}
.weather{
  display:none !important;
}
#restartBtn,#soundBtn{
  width:72px !important;
  height:48px !important;
  border-radius:16px !important;
  font-size:21px !important;
}
#restartBtn{
  top:10px !important;
  right:10px !important;
}
#soundBtn{
  top:64px !important;
  right:10px !important;
}
#restartBtn span,#soundBtn span{
  display:none !important;
}
#controls{
  left:10px;
  right:10px;
  bottom:10px;
  align-items:flex-end;
  justify-content:space-between;
  pointer-events:none;
}
#controls button,
.control-card{
  pointer-events:auto;
}
.control-card{
  width:118px !important;
  height:118px !important;
  border-radius:22px !important;
}
.control-card button{
  width:38px !important;
  height:38px !important;
  border-radius:13px !important;
  font-size:17px !important;
}
.control-card button:nth-child(1){left:40px !important;top:6px !important}
.control-card button:nth-child(2){left:6px !important;top:40px !important}
.control-card button:nth-child(3){left:40px !important;top:74px !important}
.control-card button:nth-child(4){left:74px !important;top:40px !important}
.control-card label{
  display:none;
}
#countBtn{
  width:154px !important;
  height:58px !important;
  border-radius:20px !important;
  font-size:18px !important;
  margin:0 auto 3px auto;
}
.small-note{display:none !important}

@media(max-width:760px){
  #hud{
    left:8px;
    right:92px;
    top:8px;
  }
  .hud-card{
    padding:6px 8px;
    font-size:12px;
  }
  .hud-card b{font-size:16px}
  #countBtn{
    width:138px !important;
    height:56px !important;
    font-size:16px !important;
  }
}


/* Server Top-3 Highscore */
.hud-card.best #bestName{
  font-weight:800;
  max-width:74px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.score-overlay{
  position:fixed;
  inset:0;
  z-index:60;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(28,50,56,.28);
  backdrop-filter:blur(7px);
}
.score-overlay.hidden{display:none}
.score-card{
  width:min(86vw,360px);
  padding:22px 22px 18px;
  border-radius:28px;
  background:rgba(255,250,235,.94);
  border:1px solid rgba(255,255,255,.95);
  box-shadow:0 24px 60px rgba(0,45,80,.28), inset 0 1px rgba(255,255,255,.9);
  color:#274357;
  text-align:center;
}
.score-card h2{margin:0 0 14px;font-size:30px}
#scoreList{list-style-position:inside;margin:0 0 18px;padding:0;text-align:left}
#scoreList li{
  display:grid;
  grid-template-columns:34px 1fr auto;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  margin:8px 0;
  border-radius:16px;
  background:rgba(255,255,255,.62);
  font-weight:900;
}
#scoreList .rank{color:#6a8a3a}
#scoreList .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#scoreList .time{color:#2f6f8f}
#scoreCloseBtn{
  width:160px;
  height:52px;
  border:0;
  border-radius:18px;
  background:linear-gradient(#9cd56f,#5fa343);
  color:white;
  font-size:20px;
  font-weight:1000;
  box-shadow:0 12px 24px rgba(24,120,40,.24), inset 0 2px rgba(255,255,255,.45);
}
@media(max-width:760px){
  .hud-card.best span:nth-child(2){display:none}
  .hud-card.best #bestName{max-width:44px}
  .score-card{width:min(90vw,330px);padding:18px}
  .score-card h2{font-size:25px}
}
