/* The roaming coach (R&D test, Civics only, Nov 10, 2026; v2/coach-float.js). Nothing here applies unless that test is
   on: every rule hangs off #coach-help, #coach-walker, .c-float, .cw-target, .teach-away or body.coach-float, which only
   it creates. */

/* "Get help", beside the coach waiting in the corner. */
#coach-help { position: fixed; z-index: 61; bottom: 16px; display: inline-flex; align-items: center; padding: 0 18px; min-height: 44px; border: 0; border-radius: 99px; background: var(--navy); color: #fff; font: 700 16px var(--text, system-ui); box-shadow: 0 6px 20px rgba(1,26,68,.28); cursor: pointer; }
#coach-help:hover { background: var(--navy-2); }
#coach-help:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
#coach-help[hidden], #coach-walker[hidden] { display: none; }
body.coach-float .coach-fab { display: none !important; } /* one way to the coach on screen */

/* The coach character, in screen coordinates (v2/coach-float.js keeps it beside the question as the page scrolls).
   The walk is the tea shop's: a long eased glide with a little step-bob, then it stops and points. */
#coach-walker { position: fixed; left: 0; top: 0; z-index: 62; width: var(--w, 104px); height: var(--w, 104px); pointer-events: none; transition: transform 1.4s cubic-bezier(.3,.7,.3,1), width .5s, height .5s; filter: drop-shadow(0 6px 8px rgba(1,26,68,.22)); }
#coach-walker.cw-home { pointer-events: auto; cursor: pointer; }
#coach-walker .cw-body { width: 100%; height: 100%; display: flex; }
#coach-walker .cw-body > *, #coach-walker .cw-body svg, #coach-walker .cw-body img { width: 100% !important; height: 100% !important; }
#coach-walker.walking .cw-body { animation: cw-step .4s ease-in-out infinite; }
#coach-walker .cw-hand { position: absolute; width: 34px; height: 34px; color: var(--amber, #b26a00); opacity: 0; transition: opacity .3s; }
#coach-walker[data-side="right"] .cw-hand { left: -34px; top: calc(50% - 17px); }
#coach-walker[data-side="below"] .cw-hand { left: -8px; top: -26px; transform: rotate(45deg); }
#coach-walker.pointing .cw-hand { opacity: 1; animation: cw-nudge 1s ease-in-out infinite; }
#coach-walker[data-side="below"].pointing .cw-hand { animation-name: cw-nudge-up; }
#coach-walker.pointing .cw-body { animation: cw-lean .5s ease-out forwards; }
@keyframes cw-step { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes cw-lean { to { transform: rotate(-6deg); } }
@keyframes cw-nudge { 0%, 100% { translate: 0 0; } 50% { translate: -6px 0; } }
@keyframes cw-nudge-up { 0%, 100% { translate: 0 0; } 50% { translate: -4px -4px; } }

/* What it points at. */
.cw-target { outline: 3px solid var(--amber, #b26a00); outline-offset: 6px; border-radius: 12px; animation: cw-glow 1.6s ease-in-out 2; }
@keyframes cw-glow { 50% { outline-color: var(--sky, #54c8e8); } }

/* The classroom while its teacher has stepped out to help: an empty seat and a line saying so. */
.teach-inline.teach-away .teach-big { visibility: hidden; }
.teach-inline.teach-away .teach-left::after { content: attr(data-away); font-size: 13.5px; color: var(--muted); text-align: center; max-width: 170px; }
/* One coach on screen: the little coach faces decorating the page (the next-step card, help offers, the folded classroom)
   step aside; the classroom's teacher and the roaming coach are the only ones. */
body.coach-float main#app :is(.opti, .coach[role="img"]):not(.teach-big *), body.coach-float main#app span:has(> :is(.opti, .coach[role="img"])):not(.teach-big *), body.coach-float .teach-bar-face { display: none !important; }

/* The same coach conversations, drawn as a speech bubble by the question: the lesson panel (#coach) and the drawer. */
#coach.c-float, #drawer.c-float { position: fixed; right: auto; bottom: auto; z-index: 31; height: auto; max-height: min(460px, 70vh); border: 2px solid var(--navy); border-radius: 18px; box-shadow: 0 12px 32px rgba(1,26,68,.22); opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .35s, transform .35s; padding-bottom: 0; overflow: visible; }
#coach.c-float { grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; }
#coach.c-float.cw-here, #drawer.c-float.cw-here { opacity: 1; transform: none; }
#coach.c-float::before, #drawer.c-float::before { content: ""; position: absolute; top: -11px; left: 28px; width: 18px; height: 18px; background: var(--coach, #e9f1fb); border-left: 2px solid var(--navy); border-top: 2px solid var(--navy); transform: rotate(45deg); }
#coach.c-float[data-side="right"]::before, #drawer.c-float[data-side="right"]::before { left: auto; right: 40px; } /* under the question, its tail toward the coach at the right */
#coach.c-float .c-head { border-radius: 16px 16px 0 0; padding: 8px 10px 8px 14px; }
#coach.c-float .coach-pic-btn { display: none; }
#coach.c-float .c-log { max-height: 260px; }
#coach.c-float .c-note { padding-top: 6px; }
#drawer.c-float { display: flex; flex-direction: column; background: var(--card, #fff); animation: none; }
#drawer.c-float > div { height: auto !important; display: flex; flex-direction: column; min-height: 0; flex: 1; border-radius: 16px; overflow: hidden; }
#drawer.c-float .chat { height: auto; max-height: inherit; display: flex; flex-direction: column; min-height: 0; flex: 1; }
#drawer.c-float .chat-head { background: var(--coach, #e9f1fb); }
#drawer.c-float #opti-small { display: none; }
#drawer.c-float .chat-log { max-height: 240px; min-height: 90px; overflow-y: auto; flex: 1 1 auto; }
#drawer.c-float .chat-suggest { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
#drawer.c-float .chat-suggest button { flex: none; white-space: nowrap; }
#drawer.c-float .chat-note { font-size: 12px; }
@media (max-width: 719px) {
  #coach.c-float, #drawer.c-float { max-height: 52vh; }
  #coach.c-float .c-log { max-height: 30vh; min-height: 96px; }
  #coach.c-float .c-why { font-size: 12px; padding: 4px 14px; }
  #coach.c-float .c-note { font-size: 11px; padding-bottom: 6px; }
  #coach.c-float .c-ladder .chip { min-height: 32px; font-size: 13px; }
  #drawer.c-float .chat-log { max-height: 22vh; }
}
@media (prefers-reduced-motion: reduce) {
  #coach-walker, #coach.c-float, #drawer.c-float { transition: none; }
  #coach-walker .cw-body, #coach-walker .cw-hand, .cw-target { animation: none !important; }
}

/* The coach's tips and nudges (v2/guide.js) are said by the coach in the corner: a bubble above it, without a second face. */
body.coach-float .guide-pop { bottom: calc(110px + env(safe-area-inset-bottom, 0px)); right: calc(20px + env(safe-area-inset-right, 0px)); border: 2px solid var(--navy); border-radius: 18px; overflow: visible; }
body.coach-float .guide-pop > .row > span:first-child { display: none; }
body.coach-float .guide-pop::after { content: ""; position: absolute; bottom: -11px; right: 34px; width: 18px; height: 18px; background: inherit; border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(45deg); }
@media (max-width: 760px) { body.coach-float .guide-pop { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); } }
/* The phone tab bar's coach tab keeps its name; its little face steps aside (the coach on the page is the one). */
body.coach-float .tabbar .tb-coach > span:first-child { display: none; }
body.coach-float .tabbar .tb-coach::before { content: "💬"; display: block; font-size: 22px; line-height: 1.2; }
body.cw-room main#app { padding-bottom: min(480px, 60vh); }
@media (max-width: 719px) {
  #drawer.c-float .chat-note { font-size: 11px; line-height: 1.3; } /* small, but every word of it stays (the AI and voice notices) */
  #drawer.c-float .chat-suggest { display: none; }
  #drawer.c-float .chat-head .small { display: none; }
}
#coach-walker.cw-talk .cw-body { animation: cw-talk .5s ease-in-out infinite; } /* a line said without lip sync: it bobs along */
@keyframes cw-talk { 0%, 100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(-4deg) translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { #coach-walker.cw-talk .cw-body { animation: none !important; } }
/* The words the coach is pointing at ("Look here"), lit up in place; the lesson's text itself isn't changed. */
::highlight(cw-look) { background-color: #ffe08a; color: inherit; }
body.cw-out .guide-pop { display: none !important; } /* one bubble at a time: the coach is out helping, so its corner tip waits */
