/* ============================================================
   Nut Sort CSS (SCOPED)
   Everything is under #game-root so it won't affect your site
   ============================================================ */

#game-root{
  --bg1:#c9b08c;
  --bg2:#b49a78;
  --board-pad:18px;
  --bolt-h:360px;
  --bolt-w:66px;
  --nut-h:34px;
  --nut-w:52px;
  --gap:18px;
  --shadow: 0 10px 20px rgba(0,0,0,.18);
  --ui: rgba(255,255,255,.55);
  --ui2: rgba(255,255,255,.35);
  --text: #1f1f1f;

  color: var(--text);
  width: 100%;
  display:flex;
  justify-content:center;
}

#game-root *{ box-sizing:border-box; }

/* Put the game background on the game container, not the whole body */
#game-root .app{
  width:min(1150px, 96vw);
  padding:18px;
  border-radius: 18px;
  background:
    radial-gradient(1200px 700px at 30% 20%, rgba(255,255,255,.18), transparent 55%),
    radial-gradient(1000px 600px at 70% 80%, rgba(0,0,0,.10), transparent 55%),
    linear-gradient(135deg, var(--bg1), var(--bg2));
  box-shadow: var(--shadow);
}

#game-root .topbar{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}

#game-root h1,
#game-root h2{
  font-size: clamp(18px, 2.6vw, 28px);
  margin:0;
  letter-spacing:.4px;
  text-transform:uppercase;
}

#game-root .subtitle{
  font-size:13px;
  opacity:.85;
  margin-top:6px;
  max-width:560px;
  line-height:1.45;
}

#game-root .panel{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

#game-root button{
  border:0;
  padding:10px 12px;
  border-radius:12px;
  background: var(--ui);
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
  cursor:pointer;
  font-weight:700;
  transition: transform .08s ease, background .12s ease;
}
#game-root button:hover{ background: rgba(255,255,255,.68); }
#game-root button:active{ transform: translateY(1px); }
#game-root button.secondary{ background: var(--ui2); }

#game-root .stats{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(255,255,255,.35);
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
  font-weight:800;
}
#game-root .badge{
  display:inline-flex;
  gap:6px;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  background: rgba(0,0,0,.06);
  font-size:12px;
  font-weight:900;
}
#game-root .dot{
  width:10px;height:10px;border-radius:50%;
  background: #222;
  opacity:.75;
}

#game-root .board{
  padding: var(--board-pad);
  border-radius: 20px;
  background: rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  position:relative;
  overflow:hidden;
}

#game-root .bolts{
  display:flex;
  flex-wrap:wrap;
  gap: var(--gap);
  justify-content:center;
  align-items:flex-end;
  padding: 16px 10px 10px;
}

#game-root .bolt{
  width: var(--bolt-w);
  height: var(--bolt-h);
  position:relative;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  cursor:pointer;
  transform: translateZ(0);
  user-select:none;
  touch-action: manipulation;
  outline:none;
}

/* threaded rod */
#game-root .bolt::before{
  content:"";
  position:absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: calc(100% - 42px);
  border-radius: 10px;
  background:
    repeating-linear-gradient(
      to bottom,
      #d9dde3 0px,
      #d9dde3 4px,
      #b7bec7 4px,
      #b7bec7 6px
    );
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
  opacity:.95;
}

/* base */
#game-root .base{
  position:absolute;
  bottom:0;
  left:50%;
  transform:translateX(-50%);
  width: 58px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
}

#game-root .stack{
  position:relative;
  width: 100%;
  display:flex;
  flex-direction:column-reverse;
  align-items:center;
  gap: 4px;
  padding-bottom: 12px;
  z-index: 2;
}

#game-root .nut{
  width: var(--nut-w);
  height: var(--nut-h);
  border-radius: 10px;
  clip-path: polygon(12% 0%, 88% 0%, 100% 50%, 88% 100%, 12% 100%, 0% 50%);
  box-shadow:
    0 6px 10px rgba(0,0,0,.20),
    inset 0 2px 0 rgba(255,255,255,.45),
    inset 0 -2px 0 rgba(0,0,0,.12);
  position:relative;
  transition: transform .12s ease, filter .12s ease;
}
#game-root .nut::after{
  content:"";
  position:absolute;
  inset: 9px 13px;
  border-radius: 8px;
  background: rgba(0,0,0,.14);
  clip-path: polygon(12% 0%, 88% 0%, 100% 50%, 88% 100%, 12% 100%, 0% 50%);
  opacity:.35;
}

#game-root .bolt.selected .nut.top{
  transform: translateY(-6px) scale(1.02);
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.25));
}
#game-root .bolt.selected{
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.18));
}

#game-root .bolt.invalid{
  animation: shake .18s linear 2;
}
@keyframes shake{
  0%{ transform: translateX(0); }
  25%{ transform: translateX(-3px); }
  50%{ transform: translateX(3px); }
  75%{ transform: translateX(-2px); }
  100%{ transform: translateX(0); }
}

#game-root .message{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.35);
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  font-weight:800;
}

#game-root .message small{
  font-weight:700;
  opacity:.85;
}

#game-root .win{
  background: rgba(129, 233, 161, .28);
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}

#game-root .legend{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  font-size:12px;
  opacity:.95;
  font-weight:800;
}
#game-root .swatch{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
#game-root .chip{
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
}

@media (max-width: 720px){
  #game-root{
    --bolt-h: 320px;
    --bolt-w: 62px;
    --nut-w: 48px;
    --nut-h: 32px;
    --gap: 14px;
  }
  #game-root .subtitle{ display:none; }
}
