:root{
  --bg1:#a1c4fd;
  --bg2:#c2e9fb;

  --card: rgba(255,255,255,.88);
  --card2:#ffffff;
  --stroke: rgba(0,0,0,.08);

  --text:#0f172a;
  --muted:#475569;

  --you:#22c55e;
  --pc:#ef4444;

  --shadow: 0 25px 70px rgba(15,23,42,.18);
  --shadow2: 0 12px 28px rgba(15,23,42,.12);

  --radius: 26px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:"Poppins",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:linear-gradient(135deg,var(--bg1),var(--bg2));
  color:var(--text);
  overflow-x:hidden;
}

/* Orbs */
.bg-orb{
  position:fixed;
  border-radius:50%;
  filter: blur(120px);
  opacity:.38;
  z-index:0;
}
.o1{width:420px;height:420px;background:#6a11cb;top:-140px;left:-130px}
.o2{width:380px;height:380px;background:#2575fc;bottom:-150px;right:-120px}
.o3{width:320px;height:320px;background:#ff9a9e;top:40%;left:60%}

/* Page */
.page{
  position:relative;
  z-index:1;
  max-width:1050px;
  margin:0 auto;
  padding:28px 16px 40px;
  text-align:center;
}

/* Arcade nav */
.arcade-nav{ position:absolute; top:16px; left:16px; z-index:20; }
.arcade-btn{
  display:inline-flex; align-items:center; gap:10px;
  padding:10px 18px; border-radius:40px;
  font-weight:700; font-size:14px; text-decoration:none;
  color:var(--text);
  background:rgba(255,255,255,.72);
  border:1px solid rgba(255,255,255,.55);
  box-shadow:0 15px 35px rgba(0,0,0,.15);
  backdrop-filter: blur(10px);
  transition:.25s ease;
}
.arcade-btn:hover{ transform:translateY(-3px); box-shadow:0 25px 55px rgba(0,0,0,.22); }
.arcade-btn .icon{ font-size:18px; }

/* Top */
.top{ padding-top:34px; }
.chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 16px; border-radius:999px;
  background:rgba(255,255,255,.6);
  border:1px solid rgba(255,255,255,.55);
  box-shadow:var(--shadow2);
  font-weight:700;
}
.top h1{
  margin:14px 0 8px;
  font-size:52px;
  line-height:1.05;
  letter-spacing:-.5px;
}
.top p{ margin:0; color:rgba(15,23,42,.78); font-weight:600; }

/* Cards */
.card{
  background:var(--card);
  border:1px solid rgba(255,255,255,.65);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  backdrop-filter: blur(14px);
  padding:22px;
  margin:18px auto;
}

.hidden{ display:none !important; }

/* Start */
.start-card{ max-width:860px; }
.start-grid{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap:14px;
  align-items:end;
}
@media (max-width: 860px){
  .start-grid{ grid-template-columns:1fr; }
}
.field{ text-align:left; }
.field label{ display:block; font-weight:800; font-size:12px; color:rgba(15,23,42,.75); margin-bottom:6px; }
.field input, .field select{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.10);
  outline:none;
  font-weight:700;
  background:rgba(255,255,255,.85);
}

.btn{
  border:none;
  cursor:pointer;
  font-weight:800;
  border-radius:16px;
  padding:12px 18px;
  font-size:14px;
  transition:.2s ease;
  box-shadow:0 12px 28px rgba(15,23,42,.12);
}
.btn.primary{
  color:white;
  background:linear-gradient(135deg,#2563eb,#22c55e);
}
.btn.primary:hover{ transform:translateY(-3px); }
.btn.ghost{
  background:rgba(255,255,255,.75);
  border:1px solid rgba(0,0,0,.08);
}
.btn.ghost:hover{ transform:translateY(-2px); }

.rules{
  margin-top:16px;
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:12px;
}
@media(max-width:860px){
  .rules{ grid-template-columns:1fr; }
}
.rule{
  background:rgba(255,255,255,.70);
  border:1px solid rgba(0,0,0,.06);
  border-radius:18px;
  padding:12px 14px;
  text-align:left;
  font-weight:700;
  color:rgba(15,23,42,.85);
}
.rule span{ margin-right:8px; }

/* HUD */
.hud{
  max-width:860px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.hud-left{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.pill{
  background:rgba(255,255,255,.72);
  border:1px solid rgba(0,0,0,.06);
  border-radius:999px;
  padding:10px 14px;
  font-weight:800;
}
.you{ color:var(--you); }
.pc{ color:var(--pc); }
.sep{ margin:0 8px; opacity:.5; }

/* Game */
.game-card{ max-width:980px; }
.board-wrap{
  width:100%;
  display:flex;
  justify-content:center;
  align-items:center;
  padding:8px 6px 2px;
}
#board{
  width:min(840px, 92vw);
  aspect-ratio: 1.2 / 1;
  border-radius:22px;
  background:rgba(255,255,255,.70);
  border:1px solid rgba(0,0,0,.06);
  box-shadow:0 18px 40px rgba(0,0,0,.12);
  position:relative;
  overflow:hidden;
}

.hint{
  margin-top:12px;
  font-weight:800;
  color:rgba(15,23,42,.78);
}

/* SVG styles */
svg{ width:100%; height:100%; display:block; }
.edgeHit{
  stroke: rgba(15,23,42,.08);
  stroke-width: 18;
  cursor:pointer;
  stroke-linecap: round;
}
.edgeBase{
  stroke: rgba(15,23,42,.10);
  stroke-width: 6;
  stroke-linecap: round;
}
.edgeYou{ stroke: var(--you); }
.edgePC{ stroke: var(--pc); }

.dot{
  fill: rgba(15,23,42,.90);
}

.triFill{
  opacity:.22;
}
.triYou{ fill: var(--you); }
.triPC{ fill: var(--pc); }

/* Overlay */
.overlay{
  position:fixed; inset:0;
  background:rgba(2,6,23,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:50;
}
.overlay-card{
  width:min(520px, 92vw);
  background:rgba(255,255,255,.92);
  border-radius:28px;
  padding:28px;
  box-shadow:0 35px 90px rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.75);
  text-align:center;
  position:relative;
  z-index:60;
}
.result-emoji{ font-size:44px; margin-bottom:6px; }
.overlay-actions{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:14px; }
.overlay-card a.btn{ text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }

/* Toast */
.toast{
  position:fixed;
  left:50%;
  bottom:22px;
  transform:translateX(-50%);
  background:rgba(255,255,255,.88);
  border:1px solid rgba(0,0,0,.08);
  border-radius:999px;
  padding:10px 14px;
  font-weight:800;
  box-shadow:0 16px 40px rgba(0,0,0,.18);
  opacity:0;
  pointer-events:none;
  transition:.25s ease;
  z-index:80;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(-6px); }

/* FX layer */
.fxLayer{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:55;
}
.fx-fire{
  position:absolute;
  width:10px;height:10px;
  border-radius:3px;
  animation: pop 1.05s ease-out forwards;
}
@keyframes pop{
  0%{ transform:translate(0,0) scale(1); opacity:1; }
  100%{ transform:translate(var(--dx), var(--dy)) scale(.6); opacity:0; }
}

.fx-monkey{
  position:absolute;
  font-weight:900;
  font-size:28px;
  animation: floaty 1.6s ease-in-out forwards;
  text-shadow:0 10px 30px rgba(0,0,0,.25);
}
@keyframes floaty{
  0%{ transform:translateY(12px) scale(.92); opacity:0; }
  20%{ opacity:1; }
  100%{ transform:translateY(-30px) scale(1.02); opacity:0; }
}

.foot{
  margin-top:16px;
  color:rgba(15,23,42,.75);
  font-weight:800;
}
