/* Hop Off — scoped under .game-pegs. The board is the loud thing. */

.game-pegs { --title: var(--walnut-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .game-pegs { --title: var(--brass); }
}
:root[data-theme="dark"] .game-pegs { --title: var(--brass); }

.game-pegs main { padding-block: 8px 48px; }

.game-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 6vw, 44px);
  color: var(--title);
}
.game-lede { color: var(--ink-2); margin-top: 6px; }

/* Status line above the board */
.status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 10px 0 4px;
  font-weight: 600;
}
.status .muted { color: var(--ink-2); font-weight: 500; }
.status b { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--title); }

/* The wooden triangle */
.board-wrap {
  position: relative;
  width: min(100%, 560px);
  margin: 4px auto 0;
  aspect-ratio: 1 / 0.96;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.board-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.board-wrap .holes { position: absolute; inset: 0; }

.hole {
  position: absolute;
  width: 13%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 50% 45%, #2a1608 0%, #3a2010 55%, #4c2c14 100%);
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,.75),
    inset 0 -1px 2px rgba(255,220,170,.18),
    0 1px 0 rgba(255,220,170,.15);
  transition: box-shadow .15s ease, transform .15s ease;
}
.hole::after {              /* the peg */
  content: '';
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff1c2 0%, var(--brass) 38%, #a9731f 78%, #6e4810 100%);
  box-shadow:
    0 8px 10px -4px rgba(0,0,0,.55),
    0 2px 2px rgba(0,0,0,.35),
    inset 0 -3px 5px rgba(90,50,10,.55),
    inset 0 2px 3px rgba(255,255,255,.55);
  opacity: 0;
  transform: scale(.6) translateY(4px);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), opacity .12s ease;
  pointer-events: none;
}
.hole.peg::after { opacity: 1; transform: none; }
.hole.peg { cursor: grab; }

/* A peg that has at least one legal jump gets a whisper of a highlight */
.hole.movable::after {
  box-shadow:
    0 8px 10px -4px rgba(0,0,0,.55),
    0 2px 2px rgba(0,0,0,.35),
    inset 0 -3px 5px rgba(90,50,10,.55),
    inset 0 2px 3px rgba(255,255,255,.55),
    0 0 0 2px rgba(255,241,194,.35);
}

/* Lifted, selected peg */
.hole.selected::after {
  transform: translateY(-14%) scale(1.08);
  box-shadow:
    0 22px 14px -8px rgba(0,0,0,.5),
    0 4px 4px rgba(0,0,0,.3),
    inset 0 -3px 5px rgba(90,50,10,.55),
    inset 0 2px 3px rgba(255,255,255,.6);
}
.hole.selected { cursor: grabbing; }

/* Where the lifted peg may land */
.hole.target {
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,.75),
    inset 0 -1px 2px rgba(255,220,170,.18),
    0 0 0 3px var(--brass),
    0 0 18px 4px rgba(227,169,59,.55);
  animation: beckon 1.1s ease-in-out infinite;
}
@keyframes beckon {
  0%, 100% { box-shadow: inset 0 3px 6px rgba(0,0,0,.75), 0 0 0 3px var(--brass), 0 0 10px 2px rgba(227,169,59,.35); }
  50%      { box-shadow: inset 0 3px 6px rgba(0,0,0,.75), 0 0 0 4px #ffd27a, 0 0 22px 6px rgba(227,169,59,.7); }
}

/* Picking the starting hole in free play: every peg is inviting */
.board-wrap.picking .hole.peg { cursor: pointer; }
.board-wrap.picking .hole.peg:hover::after,
.board-wrap.picking .hole.peg:focus-visible::after { transform: translateY(-8%) scale(1.05); }

/* Flying peg used for the hop animation */
.flying-peg {
  position: absolute;
  width: 13%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
}
.flying-peg::after {
  content: '';
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1c2 0%, var(--brass) 38%, #a9731f 78%, #6e4810 100%);
  box-shadow: 0 26px 16px -8px rgba(0,0,0,.45), inset 0 -3px 5px rgba(90,50,10,.55), inset 0 2px 3px rgba(255,255,255,.55);
}

.hole.shake { animation: shake .3s ease; }
@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(-54%, -50%); }
  75% { transform: translate(-46%, -50%); }
}

/* Controls under the board */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}
.hint {
  text-align: center;
  color: var(--ink-2);
  margin: 14px auto 0;
  min-height: 1.5em;
}

/* Result modal */
.verdict {
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--title);
  line-height: 1.05;
}
.verdict.win { color: var(--ok); }

@media (max-width: 480px) {
  .status b { font-size: 20px; }
  .controls .btn { flex: 1 1 40%; }
}
