/* Mobile-first, iPad-friendly, no accidental zoom on taps */
:root{
  --bg:#0b0f19;
  --card:#121a2a;
  --card2:#0f1524;
  --text:#eaf0ff;
  --muted:#9db0d6;
  --accent:#7aa7ff;
  --good:#5cffb0;
  --bad:#ff6a6a;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius:16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; background: radial-gradient(1200px 800px at 20% 10%, #142048, transparent 60%), var(--bg); color:var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
body{ overscroll-behavior:none; }
#app{ height:100%; display:grid; grid-template-rows: 56px 1fr; }

.topbar{
  display:flex; align-items:center; gap:10px;
  padding: 8px 10px;
  background: rgba(10,14,26,.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.home-btn{
  text-decoration:none; color:var(--text);
  background: rgba(255,255,255,.06);
  padding:8px 10px; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  touch-action: manipulation;
}

.stat{
  background: rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.06);
  border-radius: 14px;
  padding: 6px 10px;
  min-width: 92px;
}
.stat .k{ font-size: 11px; color: var(--muted); }
.stat .v{ font-size: 16px; font-weight: 800; }

.icon-btn{
  margin-left:auto;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  touch-action: manipulation;
}
.icon-btn:active{ transform: translateY(1px); }

.leftbar{
  position: fixed;
  top: 56px; left: 10px;
  display:flex; flex-direction: column;
  gap:8px;
  z-index: 10;
}
.navbtn{
  width: 140px;
  background: rgba(18,26,42,.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  cursor:pointer;
  text-align:left;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
  touch-action: manipulation;
}
.navbtn:active{ transform: translateY(1px); }

.stage{
  position: relative;
  overflow:hidden;
}

#scene{
  position:absolute; inset:0;
  width:100%; height:100%;
  display:block;
  touch-action: none; /* we handle pointers ourselves */
}

.center-ui{
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  align-items:center; justify-content:flex-end;
  padding: 18px;
  pointer-events:none; /* allow canvas to receive pointers */
  gap:10px;
}

.hint{
  pointer-events:none;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.click-btn{
  pointer-events:auto;
  width:min(340px, 92vw);
  height: 98px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(122,167,255,.35), rgba(122,167,255,.10));
  box-shadow: var(--shadow);
  color: var(--text);
  cursor:pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select:none;
}
.click-btn:active{ transform: translateY(2px) scale(0.995); }

.click-title{ display:block; font-size: 28px; font-weight: 900; letter-spacing: 1px; }
.click-sub{ display:block; margin-top:2px; font-size: 13px; color: rgba(234,240,255,.85); }

.boosts{
  display:flex; gap:8px; flex-wrap:wrap;
  justify-content:center;
  pointer-events:none;
}
.boost{
  pointer-events:none;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}

.float-layer{
  position:absolute; inset:0;
  pointer-events:none;
}
.float-num{
  position:absolute;
  font-weight: 900;
  font-size: 16px;
  text-shadow: 0 6px 16px rgba(0,0,0,.45);
  opacity: 0;
  transform: translate(-50%, -50%) translateY(0);
  animation: floatUp 900ms ease-out forwards;
}
@keyframes floatUp{
  0%{ opacity:0; transform: translate(-50%,-50%) translateY(10px); }
  10%{ opacity:1; }
  100%{ opacity:0; transform: translate(-50%,-50%) translateY(-70px); }
}

.panel-backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  z-index: 30;
}

.panel{
  position: fixed;
  left: 50%; top: 56%;
  transform: translate(-50%, -50%);
  width: min(720px, 94vw);
  height: min(620px, 78vh);
  background: rgba(18,26,42,.92);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 40;
  display:flex;
  flex-direction: column;
}

.panel-head{
  display:flex; align-items:center; justify-content: space-between;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.panel-title{ font-weight: 900; font-size: 16px; }
.panel-body{ padding: 12px; overflow:auto; }

.row{
  display:flex; align-items:center; justify-content: space-between;
  gap: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.row .title{ font-weight: 800; }
.row .sub{ color: var(--muted); font-size: 12px; margin-top: 2px; }
.row .right{ display:flex; gap:8px; align-items:center; }
.btn{
  background: rgba(122,167,255,.22);
  border: 1px solid rgba(122,167,255,.35);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 12px;
  cursor:pointer;
  font-weight: 800;
  touch-action: manipulation;
}
.btn:active{ transform: translateY(1px); }
.btn.secondary{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--text);
}

.small{
  font-size: 12px; color: var(--muted);
}

.input{
  width:100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline:none;
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.72);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  z-index: 60;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}

@media (max-width: 520px){
  .leftbar{ left: 8px; }
  .navbtn{ width: 124px; padding: 10px 10px; }
  .stat{ min-width: 78px; padding: 6px 8px; }
  .stat .v{ font-size: 15px; }
}


#panel[hidden], #panelBackdrop[hidden]{ display:none !important; }

/* Ensure modal is on top */
.panel-backdrop{ z-index: 10000; }
.panel{ z-index: 11000; }
#panelClose{ z-index: 12000; }

/* ===== v6 polish ===== */
.navbtn{ transition: transform 80ms ease; }
.btn{ transition: transform 80ms ease; }
.row{ transition: transform 80ms ease; }
.row:hover{ transform: translateY(-1px); }
.panel-body::-webkit-scrollbar{ width: 10px; }
.panel-body::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.12); border-radius: 999px; }
.panel-body::-webkit-scrollbar-track{ background: rgba(0,0,0,.12); border-radius: 999px; }
