/* 💡 First-time tips (tips.js, window.BoyTips): a Marmot kit file, the same bytes in every Boy app. A speech bubble by
   the thing, with the app's 🧑‍🏫 guide standing over its top edge (guide.css: .boy-guide-behind, .boy-guide-tail), and a
   ring round the thing. Nothing dims and nothing under it is blocked (the layer takes no taps; only the bubble does),
   so the dialog it's about keeps working. Over every dialog (z-index). Docked to the bottom on a phone (≤ 600 px).
   Motion (the words fading in, the ring's pulse) only without prefers-reduced-motion and not at <html data-fx="off">.
   The app's own tokens (--surface, --text, --border, --accent, --radius-lg, --shadow-lg), with fallbacks. */

.boy-tip { position: fixed; inset: 0; z-index: 900; pointer-events: none; }
.boy-tip-ring { position: fixed; border-radius: var(--radius, 10px); box-shadow: 0 0 0 3px var(--accent, #2563eb), 0 0 0 7px color-mix(in srgb, var(--accent, #2563eb) 22%, transparent); pointer-events: none; }
.boy-tip-ring[hidden] { display: none; }
.boy-tip-move .boy-tip-ring { animation: boy-tip-pulse 1.6s ease-in-out infinite; transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease; }
@keyframes boy-tip-pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--accent, #2563eb), 0 0 0 7px color-mix(in srgb, var(--accent, #2563eb) 22%, transparent); } 50% { box-shadow: 0 0 0 3px var(--accent, #2563eb), 0 0 0 11px color-mix(in srgb, var(--accent, #2563eb) 8%, transparent); } }

.boy-tip-bubble { position: fixed; width: min(20rem, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; margin: 0; padding: .85rem 1rem .75rem; pointer-events: auto;
  background: var(--surface, #fff); color: var(--text, #1c1917); border: 1px solid var(--border, rgba(0, 0, 0, .14)); border-radius: var(--radius-lg, 16px); box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, .22)); }
.boy-tip-move .boy-tip-bubble { transition: top .3s cubic-bezier(.3, .7, .2, 1), left .3s cubic-bezier(.3, .7, .2, 1); }
.boy-tip-count { margin: 0 0 .2rem; font-size: .72rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3, #78716c); }
.boy-tip-h { margin: 0 0 .3rem; font-size: 1rem; line-height: 1.3; }
.boy-tip-text { margin: 0; font-size: .9rem; line-height: 1.45; color: var(--text-2, #44403c); overflow-wrap: anywhere; }
.boy-tip-btns { display: flex; align-items: center; gap: .45rem; margin-top: .75rem; }
.boy-tip-btn { min-height: 2.25rem; padding: .3rem .8rem; border: 1px solid var(--border, rgba(0, 0, 0, .14)); border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.boy-tip-btn[hidden] { display: none; }
.boy-tip-btn:focus-visible { outline: 3px solid var(--accent, #2563eb); outline-offset: 2px; }
.boy-tip-x { margin-right: auto; min-width: 2.25rem; padding: .3rem; color: var(--text-3, #78716c); }
.boy-tip-go { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); color: var(--on-accent, #fff); }
.boy-tip-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* While a tip is open, what it scrolls to the top stops clear of an app's sticky top bar. */
body:has(> .boy-tip) * { scroll-margin-top: 72px; }

/* A phone: docked to the bottom (room over it for the guide). */
.boy-tip-docked .boy-tip-bubble { top: auto !important; left: 16px !important; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: auto; max-height: 50vh; }
.boy-tip-docked .boy-tip-btn { min-height: 2.75rem; }

/* A new step's words fade and slide in. */
.boy-tip-move .boy-tip-turn :is(.boy-tip-count, .boy-tip-h, .boy-tip-text) { animation: boy-tip-in .22s ease-out backwards; }
@keyframes boy-tip-in { from { opacity: 0; transform: translateX(10px); } }
html[data-fx="off"] .boy-tip-ring, html[data-fx="off"] .boy-tip-turn * { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .boy-tip-ring, .boy-tip-turn * { animation: none !important; transition: none !important; } }
@media print { .boy-tip { display: none !important; } }
