/* Spud & Root: town/bar.html, BIG CATCH, the pinball machine (bar-pinball.js).
   The machine is a canvas filling the engine's host; the top 60px belong to
   the engine's Done and Sound buttons and the bottom 56px to its line of
   talk, and the canvas leaves them clear. Laid over it: the start card with
   the high scores, how to play, and the initials. bar-pinball.js puts the
   cards over the middle of the playfield (left and top). */

.pb {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* a finger held on a flipper mustn't select text, scroll, zoom or bring
     up the copy menu */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body);
  color: var(--ink);
  outline: none;
}
.pb__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.pb__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Cards ---------- */
.pb__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  box-sizing: border-box;
  width: calc(100% - 16px);
  max-width: 360px;
  padding: 12px 14px 14px;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--ink);
  touch-action: manipulation;
  animation: pb-card 0.35s var(--ease-spring);
}
.pb__panel[hidden] {
  display: none;
}
@keyframes pb-card {
  from { translate: 0 30px; opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}
.pb__title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
}
.pb__year {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  font-size: 0.8rem;
  vertical-align: 0.25em;
  color: var(--white);
  background: #c2412f;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
}
.pb__sub {
  margin: 0 0 10px;
  font-size: 0.95rem;
  line-height: 1.35;
}

/* the high scores, the way they're chalked on a card taped to the glass */
.pb__scores {
  margin: 0 auto 12px;
  padding: 6px 12px;
  max-width: 250px;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  background: #fffdf6;
  border: 2px solid var(--ink);
  border-radius: 10px;
}
.pb__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 1px 2px;
}
.pb__row + .pb__row {
  border-top: 1px dashed #d8c9a8;
}
.pb__rk {
  width: 1.1em;
  color: #9a4f1c;
}
.pb__in {
  letter-spacing: 0.12em;
}
.pb__pts {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.pb__row.is-you {
  background: var(--logo-yellow);
  border-radius: 6px;
}

.pb__btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.pb__btn {
  min-height: 48px;
  padding: 10px 24px;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--logo-yellow);
  border: var(--stroke) solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pb__start {
  flex: 1 1 auto;
}
@media (hover: hover) {
  .pb__btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
  }
}
.pb__btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}
.pb__btn--white {
  background: var(--white);
}
.pb button:focus-visible {
  outline: 3px solid var(--logo-yellow);
  outline-offset: 3px;
}

.pb__how .pb__list {
  margin: 6px 0 14px;
  padding: 0 0 0 1.1em;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.4;
}
.pb__how li + li {
  margin-top: 6px;
}

/* ---------- Initials ---------- */
.pb__entry-score {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: #c2412f;
}
.pb__slots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
}
.pb__slots span {
  width: 46px;
  height: 52px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 48px;
  color: #ff8a3a;
  background: #120c0e;
  border: var(--stroke) solid var(--ink);
  border-radius: 10px;
}
.pb__slots .is-now {
  color: #ffd27a;
  box-shadow: 0 0 0 3px var(--logo-yellow);
  animation: pb-blink 0.9s steps(2, jump-none) infinite;
}
@keyframes pb-blink {
  50% { color: #6b3a1e; }
}
.pb__keys {
  display: grid;
  grid-template-columns: repeat(6, minmax(44px, 1fr));
  gap: 4px;
  margin: 0 auto 8px;
  max-width: 300px;
}
.pb__key {
  min-height: 44px;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}
.pb__key:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.pb__key--ok {
  grid-column: span 3;
  background: var(--logo-yellow);
}
.pb__key--back {
  background: #f1e6cc;
}
.pb__hint {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.pb__hint[hidden] {
  display: none;
}

/* ---------- Reduced motion ---------- */
.pb--still .pb__panel {
  animation: none;
}
.pb--still .pb__btn {
  transition: none;
}
.pb--still .pb__slots .is-now {
  animation: none;
}
