/* Chill Domains — pinball.css
   The /pinball page ("Jack's Pinball"): the table stage, its HUD, the card
   that holds the title / pause / game-over screens, and the scoring guide
   beside the table. Pairs with /assets/js/pinball.js. */

/* the game sits straight under the breadcrumb; heading and intro follow it */
.pb-top { padding-block: clamp(1rem, 2.5vw, 1.75rem) clamp(2rem, 4vw, 3.5rem); }
.pb-top .crumb { max-width: 1000px; margin: 0 auto var(--space-3); }
.pb-intro { max-width: 760px; margin: var(--space-7) auto 0; text-align: center; }
.pb-intro h1 { margin-bottom: var(--space-4); }
.pb-lede { color: var(--text-muted); font-size: var(--fs-xl); }
@media (max-width: 640px) { .pb-lede { font-size: var(--fs-lg); } }

/* the table on the left, the scoring guide on the right; one column on narrow screens */
.pb-layout { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: var(--space-6); max-width: 1000px; margin-inline: auto; }
.pb-wrap { position: relative; flex: 0 1 auto; width: min(100%, calc((100vh - 120px) * 0.5607)); width: min(100%, calc((100svh - 120px) * 0.5607)); min-width: min(100%, 300px); }
.pb-stage {
  position: relative; width: 100%; aspect-ratio: 600 / 1070; overflow: hidden; isolation: isolate;
  background: #1b2430; border-radius: var(--radius-lg); color: var(--color-ink); container-type: inline-size;
  box-shadow: 0 24px 60px -24px rgba(31, 41, 55, 0.6);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.pb-stage.is-playing { touch-action: none; }   /* only block scrolling while a ball is in play */
.pb-stage:focus { outline: none; }
.pb-stage:focus-visible { outline: 3px solid var(--color-coral); outline-offset: 3px; }
.pb-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.pb-wrap:fullscreen { width: 100%; max-width: none; background: #1b2430; display: flex; align-items: center; justify-content: center; }
.pb-wrap:fullscreen .pb-stage { aspect-ratio: auto; width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
.pb-wrap.is-pseudo-fs { position: fixed; inset: 0; z-index: 9999; width: auto; max-width: none; background: #1b2430; }
.pb-wrap.is-pseudo-fs .pb-stage { aspect-ratio: auto; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
html.pb-lock, html.pb-lock body { overflow: hidden; }

/* HUD: sits in the dark strip above the table */
.pb-hud {
  position: absolute; z-index: 5; inset: 0 0 auto 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; pointer-events: none; font: 700 0.78rem/1.2 var(--font-sans);
}
.pb-hud__stats { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.pb-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px;
  background: rgba(251, 247, 238, 0.92); border: 1px solid rgba(44, 56, 72, 0.15); white-space: nowrap;
}
.pb-chip b { font-variant-numeric: tabular-nums; }
.pb-balls { display: inline-flex; gap: 3px; }
.pb-ball { width: 12px; height: 12px; border-radius: 50%; background: #d4e348; box-shadow: inset 0 0 0 2px rgba(44, 56, 72, 0.25); }
.pb-ball.is-gone { background: transparent; box-shadow: inset 0 0 0 2px rgba(44, 56, 72, 0.3); }
.pb-hud__btns { display: flex; gap: 6px; pointer-events: auto; }
.pb-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(44, 56, 72, 0.18); background: rgba(251, 247, 238, 0.92); color: var(--color-ink); cursor: pointer;
}
.pb-icon:hover { background: #fff; }
.pb-icon:focus-visible { outline: 3px solid var(--color-coral); outline-offset: 2px; }
.pb-icon[disabled] { opacity: 0.45; cursor: default; }
.pb-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pb-icon .pb-i-play, .pb-icon.is-paused .pb-i-pause { display: none; }
.pb-icon.is-paused .pb-i-play { display: block; }
.pb-icon .pb-slash { display: none; }
.pb-icon[aria-pressed="false"] .pb-slash { display: block; }
.pb-icon .pb-i-shrink, .pb-icon.is-fs .pb-i-grow { display: none; }
.pb-icon.is-fs .pb-i-shrink { display: block; }
@container (max-width: 380px) {
  .pb-hud { font-size: 0.72rem; padding: 6px 8px; }
  .pb-chip { padding: 4px 8px; }
  .pb-hide-sm { display: none; }
  .pb-icon { width: 30px; height: 30px; }
}

/* the card: title, pause, game over */
.pb-panel {
  position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 56px 12px 12px; background: rgba(27, 36, 48, 0.45);
}
.pb-panel[hidden] { display: none; }
.pb-card {
  width: 100%; max-width: 420px; max-height: 100%; overflow: auto; overscroll-behavior: contain;
  background: var(--color-cream-3); border: 1px solid var(--color-line); border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px -20px rgba(15, 22, 32, 0.7); padding: clamp(16px, 5cqw, 26px);
  touch-action: pan-y; user-select: text; -webkit-user-select: text;
}
.pb-card h2 { font-family: var(--font-display); font-size: clamp(1.4rem, 7cqw, 2rem); line-height: 1.1; margin: 0 0 0.5rem; }
.pb-card p { margin: 0 0 0.7rem; font-size: 0.93rem; }
.pb-kicker { font: 700 0.72rem/1.2 var(--font-sans) !important; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-sage-2); margin-bottom: 0.35rem !important; }
.pb-small { color: var(--color-muted); font-size: 0.82rem !important; }
.pb-best-line { font-size: 0.9rem !important; font-weight: 700; }
.pb-final { font: 600 clamp(2rem, 12cqw, 3rem)/1 var(--font-display) !important; margin-bottom: 0.3rem !important; font-variant-numeric: tabular-nums; }
.pb-stats { margin: 0 0 0.8rem; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 0.88rem; }
.pb-controls { margin: 0 0 0.8rem; padding-left: 1.1rem; font-size: 0.9rem; }
.pb-controls li { margin-bottom: 0.25rem; }
.pb-controls kbd, .pb-keys kbd {
  display: inline-block; min-width: 1.6em; padding: 0.05em 0.4em; border: 1px solid var(--color-line); border-bottom-width: 2px;
  border-radius: 5px; background: #fff; font: 700 0.8em/1.4 var(--font-sans); text-align: center;
}
.pb-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.9rem; }
.pb-btns .btn { min-height: 44px; }

/* the scoring guide beside the table */
.pb-guide { flex: 1 1 280px; max-width: 400px; }
.pb-guide h2 { font-size: var(--fs-xl); margin: 0 0 var(--space-3); }
.pb-guide ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-3); }
.pb-guide li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; background: var(--bg-card); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); font-size: var(--fs-sm); }
.pb-guide li strong { display: block; font-size: var(--fs-base); }
.pb-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 800 0.72rem/1 var(--font-sans); color: var(--color-ink); margin-top: 2px; }
.pb-dot--red { background: #B94A4A; color: #fff; }
.pb-dot--sage { background: var(--color-sage); }
.pb-dot--coral { background: var(--color-coral); }
.pb-dot--tan { background: #D4B89A; }
.pb-dot--ball { background: radial-gradient(circle at 35% 30%, #f3fb8e, #d4e348 60%, #a9b92c); }
.pb-keys { margin: var(--space-4) 0 0; font-size: var(--fs-sm); color: var(--color-ink-2); }

.pb-note { max-width: 760px; margin: var(--space-5) auto 0; text-align: center; font-size: var(--fs-sm); color: var(--color-muted); }
.pb-related { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); margin-top: var(--space-8); }
.pb-related a {
  display: block; padding: var(--space-5); text-decoration: none; color: var(--color-ink);
  background: var(--bg-card); border: 1px solid var(--color-line); border-radius: var(--radius);
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.pb-related a:hover { box-shadow: var(--shadow); transform: translateY(-1px); color: var(--color-ink); }
.pb-related strong { display: block; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--space-1); }
.pb-related span { font-size: var(--fs-sm); color: var(--color-ink-2); }
