/* =========================================================
   Fidget Zone — styles just for this page.
   Works with mouse (desktop) AND touch (phone/tablet) because
   all the JS in js/fidget.js uses "pointer" events, which cover
   both at once.
   ========================================================= */

.toy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.toy-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  /* Stops the browser's own touch scrolling/zooming from fighting
     with our drag gestures inside the toy area. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.toy-card h2 {
  font-size: 0.8rem;
  margin: 0;
  color: var(--text);
  text-align: center;
}

.toy-card .toy-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  margin: -0.5rem 0 0;
}

/* ---------- Spinner ---------- */

.spinner-wrap {
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.spinner-wrap:active {
  cursor: grabbing;
}

.spinner-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 14px rgba(0, 245, 212, 0.45));
  will-change: transform;
}

/* ---------- Squishy blob ---------- */
/* Transform is driven entirely by JS now (js/fidget.js) — instant while
   pressed, then a slow, wobbly "spring" animation on release — so there's
   no CSS transition on transform here; a transition would fight the JS
   updates and make it look stuttery. The layered radial-gradients below
   are the "texture": a few faint highlights/dimples so it reads as a
   squishy, slightly grainy material instead of a flat gradient circle. */

.squishy {
  width: 160px;
  height: 160px;
  background-image:
    radial-gradient(circle at 22% 20%, rgba(255, 255, 255, 0.45) 0%, transparent 8%),
    radial-gradient(circle at 68% 15%, rgba(255, 255, 255, 0.3) 0%, transparent 6%),
    radial-gradient(circle at 40% 68%, rgba(0, 0, 0, 0.18) 0%, transparent 10%),
    radial-gradient(circle at 78% 60%, rgba(0, 0, 0, 0.14) 0%, transparent 7%),
    radial-gradient(circle at 30% 45%, rgba(255, 255, 255, 0.18) 0%, transparent 5%),
    radial-gradient(circle at 58% 78%, rgba(0, 0, 0, 0.12) 0%, transparent 6%),
    radial-gradient(circle at 35% 30%, #ff8fe0, var(--neon-magenta));
  border-radius: 60% 40% 55% 45% / 55% 45% 60% 40%;
  box-shadow: 0 10px 30px -8px rgba(255, 62, 201, 0.6), inset 0 -10px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  will-change: transform;
}

.squishy.squishing {
  filter: brightness(0.94);
  transition: filter 0.1s ease;
}

/* ---------- Clicky button ---------- */

.clicker-btn {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, #7fffe0, var(--neon-green) 70%);
  box-shadow: 0 10px 0 0 #1b8a55, 0 14px 24px -6px rgba(57, 255, 136, 0.5);
  cursor: pointer;
  font-family: 'Press Start 2P', sans-serif;
  font-size: 0.7rem;
  color: #04231a;
  transform: translateY(0);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.clicker-btn:active,
.clicker-btn.pressed {
  transform: translateY(8px);
  box-shadow: 0 2px 0 0 #1b8a55, 0 4px 10px -2px rgba(57, 255, 136, 0.5);
}

.click-count {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.click-count span {
  color: var(--neon-green);
  font-weight: 700;
}

/* ---------- Pop-it grid ---------- */

.popper-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 260px;
}

.popper-bubble {
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, #ffe38f, var(--neon-yellow) 75%);
  box-shadow: 0 4px 0 0 #8a6a1b, inset 0 -4px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.06s ease;
}

.popper-bubble.popped {
  background: radial-gradient(circle at 40% 40%, #2a2f42, #1b2032 75%);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6);
  transform: translateY(3px) scale(0.94);
}

/* ---------- Leaderboard (shared by all four toys) ---------- */

.toy-leaderboard {
  width: 100%;
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.toy-best {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 0;
  text-align: center;
}

.toy-best .best-value {
  color: var(--neon-yellow);
  font-weight: 700;
}

.score-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.score-name-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.75rem;
  font-family: inherit;
}

.score-name-input:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.15);
}

.score-form button {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: none;
  background: var(--neon-yellow);
  color: #2b1a00;
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.score-form button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.score-form button:disabled {
  opacity: 0.4;
  cursor: default;
}

.score-feedback {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin: -0.15rem 0 0;
  min-height: 0.9em;
  text-align: center;
}

.leaderboard-details {
  width: 100%;
}

.leaderboard-details summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text);
  text-align: center;
  padding: 0.35rem 0;
  list-style: none;
}

.leaderboard-details summary::-webkit-details-marker {
  display: none;
}

.leaderboard-details summary::after {
  content: " ▾";
  color: var(--text-dim);
}

.leaderboard-details[open] summary::after {
  content: " ▴";
}

.leaderboard-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
}

.leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
}

.leaderboard-rank {
  flex: 0 0 auto;
  width: 1.6em;
  text-align: center;
}

.leaderboard-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.leaderboard-score {
  flex: 0 0 auto;
  color: var(--neon-cyan);
  font-weight: 700;
}

.leaderboard-list li.leaderboard-empty {
  color: var(--text-dim);
  font-style: italic;
  justify-content: center;
}
