/* Chill Domains — mini-golf.css
   The /mini-golf page ("Jack's Mini Golf"): the course stage, its HUD, the
   toast, and the card that holds the title / hole / scorecard screens.
   Pairs with /assets/js/mini-golf.js. Started as a copy of renewal-run.css. */

/* the game sits straight under the breadcrumb; heading and intro follow it */
.mg-top { padding-block: clamp(1rem, 2.5vw, 1.75rem) clamp(2rem, 4vw, 3.5rem); }
.mg-top .crumb { max-width: 1100px; margin: 0 auto var(--space-3); }
.mg-intro { max-width: 760px; margin: var(--space-7) auto 0; text-align: center; }
.mg-intro h1 { margin-bottom: var(--space-4); }
.mg-lede { color: var(--text-muted); font-size: var(--fs-xl); }
@media (max-width: 640px) { .mg-lede { font-size: var(--fs-lg); } }
.mg-wrap { max-width: 1100px; margin-inline: auto; position: relative; }
.mg-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; isolation: isolate;
  background: #cfe0c4; border-radius: var(--radius-lg); color: var(--color-ink);
  box-shadow: 0 24px 60px -24px rgba(31, 41, 55, 0.5);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
@media (max-width: 640px) { .mg-stage { aspect-ratio: 1 / 2; max-height: calc(100vh - 90px); max-height: calc(100svh - 90px); min-height: 480px; } }
.mg-stage:focus { outline: none; }
.mg-stage:focus-visible { outline: 3px solid var(--color-coral); outline-offset: 3px; }
.mg-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

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

/* HUD */
.mg-hud {
  position: absolute; z-index: 5; inset: 0 0 auto 0; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; pointer-events: none; font: 700 0.8rem/1.2 var(--font-sans);
}
.mg-hud__stats { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; flex: 1; min-width: 0; }
.mg-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px;
  background: rgba(251, 247, 238, 0.88); border: 1px solid rgba(44, 56, 72, 0.15); white-space: nowrap;
}
.mg-chip b { font-variant-numeric: tabular-nums; }
.mg-chip--bill b { color: var(--color-danger); }
.mg-hud__btns { display: flex; gap: 6px; margin-left: auto; pointer-events: auto; }
/* over a card, only the Pause / Sound / Full screen buttons stay on top */
.mg-stage.has-panel .mg-hud__stats { visibility: hidden; }
.mg-icon {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid rgba(44, 56, 72, 0.15); border-radius: 50%; background: rgba(251, 247, 238, 0.88);
  color: var(--color-ink); cursor: pointer;
}
.mg-icon:hover { background: #fff; }
.mg-icon:focus-visible { outline: 3px solid var(--color-coral); outline-offset: 1px; }
.mg-icon:disabled { opacity: 0.45; cursor: default; }
@media (pointer: coarse) { .mg-icon { width: 44px; height: 44px; } }
.mg-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mg-icon .mg-i-play, .mg-icon.is-paused .mg-i-pause { display: none; }
.mg-icon.is-paused .mg-i-play { display: block; }
.mg-icon .mg-slash { display: none; }
.mg-icon[aria-pressed="false"] .mg-slash { display: block; }
.mg-icon .mg-i-shrink, .mg-icon.is-fs .mg-i-grow { display: none; }
.mg-icon.is-fs .mg-i-shrink { display: block; }
@media (max-width: 640px) {
  /* on a phone the buttons stay at the top and the score chips move to a strip along the bottom */
  .mg-hud { inset: 0; align-items: flex-start; font-size: 0.74rem; }
  .mg-hud__stats { position: absolute; left: 8px; right: 8px; bottom: 8px; flex-wrap: nowrap; justify-content: center; gap: 6px; }
  .mg-toast { bottom: 50px; }
  .mg-chip { padding: 4px 8px; }
  .mg-hide-sm { display: none; }
}

/* the card: title, pause, stage clear, game over, win */
.mg-panel {
  position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 56px 12px 12px; background: rgba(44, 56, 72, 0.3);
}
.mg-panel[hidden] { display: none; }
.mg-card {
  width: 100%; max-width: 560px; 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(31, 41, 55, 0.55); padding: clamp(16px, 3.5cqw, 28px);
  touch-action: pan-y; user-select: text; -webkit-user-select: text;
}
.mg-stage { container-type: inline-size; }
.mg-card h2 { font-family: var(--font-display); font-size: clamp(1.4rem, 4.2cqw, 2.1rem); line-height: 1.1; margin: 0 0 0.5rem; }
.mg-card p { margin: 0 0 0.7rem; font-size: 0.95rem; }
.mg-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; }
.mg-small, .mg-receipt__fine { color: var(--color-muted); font-size: 0.82rem !important; }
.mg-stats, .mg-best { font-size: 0.9rem !important; }
.mg-controls { margin: 0 0 0.8rem; padding-left: 1.1rem; font-size: 0.9rem; }
.mg-controls li { margin-bottom: 0.25rem; }
.mg-controls kbd, .mg-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;
}
/* the buttons stay in view at the bottom of the card when the results scroll */
.mg-btns {
  position: sticky; bottom: calc(-1 * clamp(16px, 3.5cqw, 28px)); z-index: 1;
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0.9rem calc(-1 * clamp(16px, 3.5cqw, 28px)) calc(-1 * clamp(16px, 3.5cqw, 28px));
  padding: 10px clamp(16px, 3.5cqw, 28px) clamp(12px, 3cqw, 22px); background: var(--color-cream-3);
  border-top: 1px solid var(--color-line-2);
}
.mg-btns .btn { min-height: 44px; }

.mg-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0.6rem 0 0.8rem; }
@container (max-width: 520px) { .mg-compare { grid-template-columns: 1fr; } }
.mg-receipt, .mg-chill { border-radius: var(--radius); padding: 12px 12px 6px; font-size: 0.84rem; }
.mg-compare .mg-receipt { margin: 0; }
.mg-receipt { background: #fff; border: 1px dashed rgba(44, 56, 72, 0.35); margin: 0.6rem 0 0.8rem; }
.mg-chill { background: rgba(143, 179, 154, 0.2); border: 1px solid var(--color-sage); }
.mg-receipt__h { font: 800 0.72rem/1.3 var(--font-sans) !important; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.4rem !important; }
.mg-receipt table, .mg-chill table { width: 100%; border-collapse: collapse; }
.mg-receipt td, .mg-chill td { padding: 3px 0; vertical-align: top; border-bottom: 1px dotted rgba(44, 56, 72, 0.2); }
.mg-receipt td:last-child, .mg-chill td:last-child { text-align: right; padding-left: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mg-receipt td span { color: var(--color-muted); }
.mg-receipt tr.is-base td { color: var(--color-ink-2); }
.mg-receipt tfoot td, .mg-chill tfoot td { font-weight: 800; border-bottom: 0; padding-top: 6px; }
.mg-receipt tfoot td:last-child { color: var(--color-danger); }
.mg-chill tfoot td:last-child { color: var(--color-success); }

/* below the stage */
.mg-under { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-top: var(--space-4); }
.mg-keys { margin: 0; font-size: var(--fs-sm); color: var(--color-ink-2); }
.mg-note { max-width: 760px; margin: var(--space-5) auto 0; text-align: center; font-size: var(--fs-sm); color: var(--color-muted); }
.mg-tricks { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-4); margin: var(--space-5) 0 0; padding: 0; list-style: none; }
.mg-tricks li { background: var(--bg-card); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-4) var(--space-5); }
.mg-tricks h3 { font-size: var(--fs-md, 1.05rem); margin: 0 0 var(--space-2); }
.mg-tricks p { margin: 0 0 var(--space-2); font-size: var(--fs-sm); }
.mg-tricks p:last-child { margin-bottom: 0; }
.mg-tricks .mg-us { color: var(--color-sage-2); font-weight: 700; }
.mg-related { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); margin-top: var(--space-8); }
.mg-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);
}
.mg-related a:hover { box-shadow: var(--shadow); transform: translateY(-1px); color: var(--color-ink); }
.mg-related strong { display: block; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--space-1); }
.mg-related span { font-size: var(--fs-sm); color: var(--color-ink-2); }

/* the toast: what just happened (a charge, a lip-out, the off switch) */
.mg-toast {
  position: absolute; z-index: 3; left: 50%; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px);
  padding: 8px 14px; border-radius: 14px; background: rgba(44, 56, 72, 0.92); color: var(--color-cream-3);
  font: 700 0.85rem/1.35 var(--font-sans); text-align: center; pointer-events: none; transition: opacity 0.25s ease;
}
.mg-toast[hidden] { display: none; }
.mg-toast.is-out { opacity: 0; }
.mg-stage canvas { cursor: crosshair; }
.mg-stage.has-panel canvas { cursor: default; }

/* hole card: the trick, and what we do instead */
.mg-trick { margin: 0.4rem 0 0.2rem; padding: 12px 14px; border-radius: var(--radius); background: #fff; border: 1px solid var(--color-line); }
.mg-trick p { font-size: 0.9rem !important; margin-bottom: 0.45rem !important; }
.mg-trick p:last-child { margin-bottom: 0 !important; }
.mg-trick__h { font: 800 0.74rem/1.3 var(--font-sans) !important; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-coral-2); }
.mg-us { color: var(--color-sage-2); font-weight: 700; }

/* the scorecard */
.mg-score { width: 100%; border-collapse: collapse; margin: 0.3rem 0 0.9rem; font-size: 0.86rem; background: #fff; border-radius: var(--radius); overflow: hidden; }
.mg-score th, .mg-score td { padding: 4px 8px; border-bottom: 1px solid var(--color-line-2); text-align: center; font-variant-numeric: tabular-nums; }
.mg-score th:nth-child(2), .mg-score td:nth-child(2) { text-align: left; }
.mg-score thead th { font: 800 0.7rem/1.3 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); background: var(--color-cream-2, #f3ecdf); }
.mg-score tfoot td { font-weight: 800; border-bottom: 0; }
.mg-score .is-under { color: var(--color-success); font-weight: 800; }
.mg-score .is-over { color: var(--color-danger); }
