/* The green guide and his "Ask me anything" box (js/guide.js). Trial on learn.html. */
.lp-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 40%); gap: 28px; align-items: start; }
.lp-main { min-width: 0; }
.lp-top.gd-off { grid-template-columns: minmax(0, 1fr); }
.guide { --gd-glow: 46 230 110; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; }
.gd-stage { position: relative; width: 100%; height: 230px; display: flex; justify-content: center; overflow: visible; }
.gd-floor { position: absolute; left: 50%; bottom: 2px; width: 180px; height: 34px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgb(var(--gd-glow) / .55), rgb(var(--gd-glow) / .18) 60%, transparent); filter: blur(2px);
  animation: gd-pulse 3.2s ease-in-out infinite; }
@keyframes gd-pulse { 50% { opacity: .65; transform: translateX(-50%) scale(.92); } }
.gd-v, .gd-still { position: absolute; bottom: 0; left: 50%; height: 230px; width: auto; aspect-ratio: var(--gd-aw, 264) / 400; transform: translateX(-50%); pointer-events: none; z-index: 1; }
.gd-v[hidden] { display: block; }
/* The clips play unseen and are drawn, see-through, on one canvas (js/guide.js), so a switch never blanks.
   Safari's packed clips are twice as tall (picture over mask). */
video.gd-v { opacity: 0; }
.gd-cv { opacity: 1; }
.guide.gd-packed video.gd-v { aspect-ratio: var(--gd-aw, 264) / 800; }
/* Each guide's picture width (js/guide.js CAST w): 264 by default, 320 for the wider pink, blue, teal and crimson clips. */
.guide { --gd-aw: 264; }
.guide:is([data-character="white"], [data-character="pink"], [data-character="blue"], [data-character="teal"]) { --gd-aw: 320; }
.gd-still { display: none; }
.guide.gd-static .gd-v { display: none !important; }
.guide.gd-static .gd-still { display: block; }
/* Arriving and leaving: his own running clips do the moving (legs and all) inside his place, and fade in or out
   before he reaches the edge of the picture. The picture itself is never slid, so he never glides like a cut-out
   and never leaves the screen or covers the Ask box. */

.gd-form { display: flex; align-items: center; gap: 4px; width: 100%; max-width: 420px; padding: 4px 4px 4px 14px; border-radius: 999px;
  background: #fff; border: 1px solid rgba(0, 0, 0, .14); box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.gd-form:focus-within { border-color: #1f9d4c; box-shadow: 0 0 0 3px rgba(46, 200, 100, .22); }
.gd-form input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: .95rem; color: #111; padding: 7px 0; outline: none; }
.gd-form input::-webkit-search-cancel-button { display: none; }
.gd-mic[hidden] { display: none; }
.gd-mic[aria-pressed="true"] { background: #1fb257; color: #fff; animation: gd-mic 1.2s ease-in-out infinite; }
@keyframes gd-mic { 50% { box-shadow: 0 0 0 6px rgba(31, 178, 87, .25); } }
.gd-mute, .gd-mic { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: #444; cursor: pointer; display: grid; place-items: center; padding: 0; }
.gd-mute svg, .gd-mic svg { width: 18px; height: 18px; }
.gd-mute .mute { display: none; }
.gd-mute[aria-pressed="false"] .mute { display: inline; }
.gd-mute[aria-pressed="false"] .wave { display: none; }
.gd-mute:hover, .gd-mute:focus-visible, .gd-mic:hover, .gd-mic:focus-visible { background: rgba(0, 0, 0, .06); }
.gd-ask { flex: none; border: 0; border-radius: 999px; padding: 6px 16px; background: #22b35a; color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.gd-ask:hover { background: #1a9a4c; }
.gd-mute:focus-visible, .gd-mic:focus-visible, .gd-ask:focus-visible, .gd-out a:focus-visible, .gd-try:focus-visible { outline: 2px solid #0b6b2f; outline-offset: 2px; }
.gd-eg { margin: 0; font-size: .82rem; }
.gd-try { border: 0; background: none; padding: 0; font: inherit; color: #146c35; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.gd-out { width: 100%; max-width: 420px; font-size: .92rem; overflow-wrap: anywhere; }
.gd-out:empty { display: none; }
.gd-out p { margin: 0 0 6px; color: var(--paper, #111); max-width: none; font-size: .92rem; }
.gd-out .gd-say { background: #f1faf4; border: 1px solid #cfeedd; border-radius: 12px; padding: 8px 12px; }
.gd-out .gd-wait { color: var(--mist); }
.gd-take { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #22b35a; color: #fff; font-weight: 600; text-decoration: none; font-size: .88rem; }
.gd-take:hover { background: #1a9a4c; color: #fff; }
.gd-to { color: var(--mist); font-size: .86rem; }
.gd-list { margin: 2px 0 6px; padding-left: 18px; font-size: .88rem; }
.gd-list li { margin: 2px 0; }
.gd-more { font-size: .84rem; }

@media (max-width: 820px) {
  .lp-top { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .guide { order: 0; }
  .gd-stage { height: 160px; }
  .gd-v, .gd-still { height: 160px; }
  .gd-floor { width: 130px; height: 24px; }
  .gd-form, .gd-out { max-width: none; }
}
/* Jiggle when the guide is clicked or a search finds nothing (transform only, no layout shift). */
.gd-stage { cursor: pointer; transform-origin: 50% 100%; }
.gd-stage.gd-jiggle { animation: gd-jiggle .5s ease-in-out; }
@keyframes gd-jiggle {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-6deg) scale(1.03); }
  35% { transform: rotate(5deg); }
  55% { transform: rotate(-3deg); }
  75% { transform: rotate(2deg); }
}
/* Reduced motion no longer stills the guides (Joseph, 10 Nov 2026): they breathe and move on every device. */

/* Other guides (chosen in js/guide.js; the picker shows only when more than one is ready). */
.guide[data-character="pink"] { --gd-glow: 255 126 182; }
/* Under-glow: the same soft pool of light under every guide, in each one's own colour (pink #FF7EB6 to #FFB3D1;
   green keeps his green). */
.guide[data-character="pink"] .gd-floor { background: radial-gradient(closest-side, rgb(255 126 182 / .6), rgb(255 179 209 / .25) 60%, transparent); }
.guide[data-character="white"] { --gd-glow: 230 236 245; }
/* Meteor, the kids' guide (11 Nov 2026; stage from Ayaka's meteor-sparkle.css run9/run10): amber glow; a free stage that
   never clips him (his whole union of frames fits his 320x400 canvas at one uniform scale), see-through and never
   blocking a click. His alpha clamp (an SVG table, js/guide-meteor.js) is set on his canvas by js/guide.js. */
.guide[data-character="meteor"] { --gd-aw: 378; --gd-glow: 255 170 60; }
.guide[data-character="meteor"] .gd-stage { overflow: visible; background: transparent; }
.guide[data-character="meteor"] .gd-cv { pointer-events: none; background: transparent; }
/* Robot, the second kids' guide (12 Nov 2026): cyan glow, 298-wide stage, uniform scale. */
.guide[data-character="robot"] { --gd-aw: 298; --gd-glow: 80 230 230; }
.guide[data-character="robot"] .gd-stage { overflow: visible; background: transparent; }
.guide[data-character="robot"] .gd-cv { pointer-events: none; background: transparent; }
.gd-pick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.gd-pick button { font: inherit; font-size: .85rem; padding: 4px 12px; border-radius: 999px; border: 1px solid rgb(var(--gd-glow) / .6); background: transparent; color: inherit; cursor: pointer; }
.gd-pick button[aria-pressed="true"] { background: rgb(var(--gd-glow) / .25); font-weight: 600; }
.gd-pick button:focus-visible { outline: 3px solid rgb(var(--gd-glow)); outline-offset: 2px; }
.guide[hidden] { display: none !important; }
.gd-mute[hidden], .gd-pick[hidden] { display: none; }

.gd-wm{display:none!important}

/* Live results under the Ask box (js/guide.js), and the friendlier answer. */
.gd-drop { position: absolute; left: 8px; right: 8px; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid #cfeedd; border-radius: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); font-size: .88rem; text-align: left; }
.gd-drop[hidden] { display: none; }
.gd-drop li { padding: 6px 10px; border-radius: 8px; cursor: pointer; color: #111; }
.gd-drop li:hover, .gd-drop li[aria-selected="true"] { background: #e3f7ea; }
.gd-kind { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #eef2f5; color: #5b6573; font-size: .72rem; font-weight: 600; }
.gd-out .gd-what { background: #fff; border: 1px solid #e3e8ec; border-radius: 12px; padding: 8px 12px; }
.gd-out .gd-also { margin: 4px 0 0; font-size: .85rem; }
.gd-dym a { font-weight: 600; }
:root { --gd-safe-r: env(safe-area-inset-right, 0px); }
/* The overlay the guides roam on when bored (4 Nov 2026): the whole window, see-through, no layout effect, and it
   never takes a click. Below dialogs (z-index 100). */
.gd-roam { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: visible; contain: none; background: transparent; }
.gd-roam .gd-away { position: absolute; bottom: auto; transform: none; pointer-events: none; }
.gd-hidden-v { display: none; }
/* Group mode: the two member guides side by side. */
.gd-group .gd-stage .gd-cv:not(.gd-buddy) { left: calc(50% + 55px); }
.gd-group .gd-stage .gd-buddy { left: calc(50% - 75px); }

/* Group mode's play: whose line is being said. */
.gd-out .gd-line { margin: 0 0 4px; opacity: .7; transition: opacity .2s; }
.gd-out .gd-line.gd-now { opacity: 1; box-shadow: 0 0 0 2px rgb(var(--gd-glow) / .45); }
.gd-out .gd-line[data-sp="pink"] { background: #fff1f7; border-color: #ffc9df; }
@media (prefers-reduced-motion: reduce) { .gd-out .gd-line { transition: none; } }
/* Little speech bubbles when the guides chat together (group mode). Never takes a click. */
.gd-bub { position: absolute; z-index: 3; transform: translateX(-50%); max-width: 170px; padding: 5px 9px; border-radius: 12px; background: #fff;
  border: 1px solid rgba(0, 0, 0, .14); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); font-size: .78rem; line-height: 1.25; color: #111; text-align: center;
  pointer-events: none; animation: gd-bub .25s ease-out; }
.gd-bub::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; background: #fff; border: solid rgba(0, 0, 0, .14); border-width: 0 1px 1px 0; transform: translateX(-50%) rotate(45deg); }
@keyframes gd-bub { from { opacity: 0; transform: translateX(-50%) translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .gd-bub { animation: none; } }

/* The dock on every other page (js/guide-boot.js): a small figure in the bottom corner; tap him (or the ? button)
   to open the question box above him. learn.html keeps its own larger layout. */
.guide.gd-dock { will-change: transform; contain: layout style; position: fixed; right: 12px; bottom: 10px; z-index: 95; width: 150px; gap: 6px; padding: 0; align-items: flex-end; pointer-events: none; }
.guide.gd-dock > * { pointer-events: auto; }
.guide.gd-dock .gd-stage { order: 3; width: 150px; height: 170px; cursor: pointer; }
.guide.gd-dock :is(.gd-v, .gd-still) { height: 170px; }
.guide.gd-dock .gd-floor { width: 120px; height: 24px; }
.guide.gd-dock :is(.gd-form, .gd-eg, .gd-out) { display: none; }
.guide.gd-dock.gd-open { width: 320px; max-width: 96vw; }
.guide.gd-dock.gd-open :is(.gd-form, .gd-eg) { display: flex; }
.guide.gd-dock.gd-open .gd-out { display: block; max-height: 32vh; overflow: auto; width: 100%; }
.guide.gd-dock.gd-open :is(.gd-form, .gd-eg, .gd-out) { background: #fff; border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .14); }
.guide.gd-dock.gd-open .gd-eg { padding: 6px 10px; margin: 0; }
.guide.gd-dock .gd-pick { display: none; }
.guide.gd-dock.gd-open .gd-pick:not([hidden]) { display: flex; order: 2; width: 100%; padding: 8px; background: #fff; border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .14); }
.guide.gd-dock.gd-open .gd-form { border-radius: 999px; }
.gd-dock-tog { order: 4; position: absolute; right: 4px; bottom: 6px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgb(var(--gd-glow) / 1); color: #062; font: 700 1.05rem/1 inherit; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); cursor: pointer; }
.gd-dock-tog:focus-visible { outline: 3px solid #111; outline-offset: 2px; }
@media (max-width: 600px) {
  .guide.gd-dock { width: 104px; right: 6px; bottom: 6px; }
  .guide.gd-dock .gd-stage { width: 104px; height: 120px; }
  .guide.gd-dock :is(.gd-v, .gd-still) { height: 120px; }
  .guide.gd-dock .gd-floor { width: 84px; height: 18px; }
}
/* Walking: a small bob while he crosses the page (transform on the stage only). */
.guide.gd-dock.gd-walking .gd-stage { animation: gd-bob .5s ease-in-out infinite; }
@keyframes gd-bob { 50% { translate: 0 -5px; } }

@media print { .guide.gd-dock { display: none; } }
/* The open panel (4 Nov 2026): compact, sitting just above the guide in his corner, with its own close X. No picker. */
.gd-head { display: none; }
/* The ask bar is the only bar: no second "Ask me anything" title strip above it (4 Nov 2026). */
.gd-x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: #333; font: 400 1.3rem/1 inherit; cursor: pointer; }
.gd-x:hover, .gd-x:focus-visible { background: rgba(0, 0, 0, .07); outline: none; }
.guide.gd-dock .gd-pick { display: none !important; }
@media (max-width: 600px) { .guide.gd-dock.gd-open { width: min(320px, 97vw); } .guide.gd-dock.gd-open .gd-eg { font-size: .8rem; } }

/* The crimson guide (admin only) gets just the ask bar, no "Try:" suggestion. */
.guide[data-character="white"] .gd-eg { display: none !important; }
/* The crimson guide's chosen colour (admin only; the filter comes from worker/beast-tint.js). Not on his buddies. */
.guide.gd-tinted[data-character="white"] .gd-stage :is(.gd-v, .gd-still):not(.gd-buddy) { filter: url(#gd-tint); }
/* Ask bar under the guide (4 Nov 2026): the guide stands in his corner with a compact bar just below him, about his
   width; answers open above him. No Ask button (Enter / Go on the keyboard asks). Clear of the Guide party button
   (bottom left), and kept above the phone's bottom bar. Buttons stay 44px to tap. */
.guide.gd-dock { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.guide.gd-dock.gd-open { width: max(240px, calc(var(--gd-h) * var(--gd-aw) / 400)); }
.guide.gd-dock.gd-open .gd-stage { order: 2; align-self: center; }
.guide.gd-dock.gd-open .gd-form { order: 3; width: 100%; max-width: none; height: 44px; padding: 0 0 0 12px; gap: 0; }
.guide.gd-dock.gd-open .gd-form input { font-size: 16px; padding: 0; height: 44px; }
.guide.gd-dock.gd-open :is(.gd-mute, .gd-mic) { width: 44px; height: 44px; }
.guide.gd-dock.gd-open :is(.gd-eg, .gd-out) { order: 1; }
.guide.gd-dock.gd-open .gd-dock-tog { bottom: 52px; }
.gd-ask { display: none !important; }
@media (max-width: 600px) {
  .guide.gd-dock { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .guide.gd-dock.gd-open { width: max(196px, calc(var(--gd-h) * var(--gd-aw) / 400)); }
  .guide.gd-dock.gd-open .gd-out { max-height: 28vh; }
}
/* No blue tap flash or focus box on the guide himself (4 Nov 2026). */
.guide .gd-stage, .guide .gd-stage * { -webkit-tap-highlight-color: transparent; }
.guide .gd-stage:is(:focus, :active, :focus-visible) { outline: none; background: none; }
.guide .gd-stage { -webkit-user-select: none; user-select: none; }
/* The crimson guide's tap: a burst of his glow comes out toward the viewer (transform and opacity only). */
.gd-zapyou { position: absolute; left: 50%; top: 18%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; z-index: 3; pointer-events: none;
  background: radial-gradient(closest-side, #fff, rgb(var(--gd-zap, 255 50 40) / .9) 35%, rgb(var(--gd-zap, 255 50 40) / .35) 65%, transparent);
  animation: gd-zapyou .6s .45s ease-out both; }
@keyframes gd-zapyou { 0% { transform: scale(.2); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 60% { transform: scale(2); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gd-zapyou { display: none; } }
.guide.gd-tinted[data-character="white"] .gd-zapyou { filter: url(#gd-tint); }

/* Try: chip kept small and tucked above the guide; hidden at phone widths so it never covers page text */
.guide.gd-dock.gd-open .gd-eg { font-size: .74rem; padding: 3px 8px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .guide.gd-dock.gd-open .gd-eg { display: none !important; } }

/* Walking left: the moving clips all face right, so he is turned round while going left. */
.guide.gd-dock.gd-left .gd-stage > .gd-v:not(.gd-buddy), .guide.gd-dock.gd-left .gd-stage > .gd-still { transform: scaleX(-1); }
/* 10 Nov 2026 (Joseph): the guide in the corner is drawn the same size as his admin Guides preview
   (worker/admin-app.html .gd-free: height min(340px, 50vh), never wider than the screen). Every guide, every screen. */
/* 11 Nov 2026 (Joseph): the doubled size is uniform: width follows each guide's own picture width (--gd-aw: 264, or 320
   for pink, blue, teal and the silver beast), so nobody is stretched tall and thin. */
.guide.gd-dock { --gd-h: min(340px, 50vh, calc((100vw - 24px) * 400 / var(--gd-aw))); width: max(150px, calc(var(--gd-h) * var(--gd-aw) / 400)); }
.guide.gd-dock .gd-stage, .guide.gd-dock :is(.gd-v, .gd-still) { height: var(--gd-h); }
.guide.gd-dock .gd-stage { width: 100%; min-width: calc(var(--gd-h) * var(--gd-aw) / 400); } /* never narrower than the figure, so he isn't cut off at the screen edge */
@media (max-width: 600px) {
  .guide.gd-dock { width: max(104px, calc(var(--gd-h) * var(--gd-aw) / 400)); }
  .guide.gd-dock .gd-stage, .guide.gd-dock :is(.gd-v, .gd-still) { height: var(--gd-h); }
  /* Phones: the bigger figure never blocks the page under him; taps pass through him, and the round ? button opens his box. */
  .guide.gd-dock .gd-stage { pointer-events: none; }
}

/* Suggestion list: in the corner dock the ask bar sits at the bottom of the viewport, so a list
   that opens downward (the default, for the in-page learn layout) would fall off the screen.
   Open it upward, scroll if needed, and keep it on screen at 1280×800 and on a phone (12 Nov 2026). */
.guide.gd-dock .gd-form { overflow: visible; }
.guide.gd-dock .gd-drop {
  top: auto;
  bottom: calc(100% + 4px);
  max-height: min(240px, calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 54px));
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 600px) {
  .guide.gd-dock .gd-drop {
    max-height: min(200px, calc(100vh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 50px));
  }
}

/* In-page guide on learn.html: if the "We're back" box still meets him on a short phone screen, draw him above it
   (the box is z-index 60). The dock already sits at 95. Combined with the lift in js/guide.js. */
.guide:not(.gd-dock) { z-index: 61; }
