/* --- The beginner trail: José Fergulocci, the coach, in a speech balloon (web/src/tutorial.mjs, 2026-11-25) ---------------------
   The overlay lets clicks through (the task steps need the screen under it); only the card takes the pointer. The spotlight dims the
   rest of the screen with one large shadow around the target. On phones the card is a bottom sheet above the dock. */
/* Above everything the game draws (modals, drawers, the radio): the coach is never seen through. */
/* Over the page itself (#app, 1) but under the drawers (20), the modals (60), the menus (40), the search (45) and the toasts (100): a player's
   drawer opened during the trail is never crossed by the ring or the dimming, and a toast is read over the coach. (26/11/2026; was 100000.) */
.coach-overlay { position: fixed; inset: 0; z-index: 18; pointer-events: none; }
.coach-spotlight {
  position: fixed; z-index: 1; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(3, 11, 20, 0.4);
  transition: top 180ms ease-out, left 180ms ease-out, width 180ms ease-out, height 180ms ease-out;
}
/* A task step: the ring only, nothing dimmed (the manager has to read and use the whole screen). */
.coach-overlay.task .coach-spotlight { box-shadow: none; }
.coach-spotlight-ring { position: absolute; inset: -3px; border: 2px solid var(--accent, #b8f34b); border-radius: 14px; animation: coach-pulse 1.6s ease-in-out infinite; }
@keyframes coach-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.coach-card {
  /* The coach's height and how much of him rises above the balloon (the rest, his legs, stands behind it). */
  --coach-h: min(560px, calc(100vh - 32px)); --coach-over: calc(var(--coach-h) - 120px);
  position: fixed; z-index: 2; pointer-events: none;
  bottom: 16px; padding-top: var(--coach-over);
  width: min(560px, calc(100vw - 32px));
  transition: left 180ms ease-out;
}
.coach-card.centered { left: 50%; transform: translateX(-50%); }
.coach-overlay.dim { background: rgba(3, 11, 20, 0.4); }
.coach-card:focus { outline: none; }

/* The coach stands on the card's bottom edge (the screen's) behind the balloon's left side: a taller balloon covers more of him, he does
   not move (2026-11-26);
   the image is a 560 px cut-out (web/assets/coach). */
.coach-figure { position: absolute; left: 8px; bottom: 0; z-index: 0; width: auto; height: var(--coach-h); opacity: 1; pointer-events: none; }   /* no filter and no fade-in: a composited image layer was seen through (2026-11-25) */
/* A task step: no figure, the card is only the balloon, and the head sits at the right of the words. */
.coach-card.compact { padding-top: 0; }
.coach-card.compact .coach-figure { display: none; }
.coach-line { display: flex; align-items: center; gap: 12px; }
.coach-head { display: none; flex: 0 0 72px; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent, #b8f34b); background: #0d1b29; }
.coach-card.compact .coach-head { display: block; }

.coach-balloon {
  position: relative; z-index: 1; pointer-events: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 14px 10px;
  background: linear-gradient(150deg, #1b3041 0%, #0d1b29 100%);
  border: 1px solid #496679; border-radius: 14px;
  color: #e7f0f4; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.coach-balloon-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.coach-name { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 750; color: var(--accent, #b8f34b); letter-spacing: -0.01em; }
.coach-name small { display: inline; margin-left: 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #8aa3b3; }

.coach-text { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 15px; line-height: 1.45; color: #e7f0f4; min-height: 2.9em; }

/* The task line of a step that waits for the manager: an arrow while open, a tick when done. */
.coach-task { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px dashed #557961; border-radius: 10px; background: #182d2a; font-size: 13px; font-weight: 600; color: #d8f3b0; }
.coach-task-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent, #b8f34b); color: #0d1b29; font-size: 13px; font-weight: 800; flex: 0 0 22px; }
.coach-task.done { border-style: solid; border-color: var(--accent, #b8f34b); background: #203a2a; color: #e9fbd0; }

.coach-progress { height: 3px; border-radius: 2px; background: #2a4150; overflow: hidden; }
.coach-progress-fill { height: 100%; width: 0; background: var(--accent, #b8f34b); transition: width 200ms ease-out; }

.coach-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coach-footer .coach-next { margin-left: auto; min-height: 36px; display: inline-flex; align-items: center; gap: 8px; }
.coach-footer .coach-next:disabled { opacity: 0.45; cursor: not-allowed; }
/* The read lock (tutorial.mjs READ_LOCK_MS): grey, a ring turning, until the words have had their seconds. */
.coach-footer .coach-next.waiting, .coach-footer .coach-next.waiting:disabled { opacity: 1; background: #3b4f5c; border-color: #3b4f5c; color: #b7c8d2; cursor: wait; }
.coach-spin { display: none; width: 16px; height: 16px; border: 2px solid rgba(183, 200, 210, 0.3); border-top-color: #e7f0f4; border-radius: 50%; }
.coach-next.waiting .coach-spin { display: inline-block; animation: coach-spin 0.8s linear infinite; }
@keyframes coach-spin { to { transform: rotate(360deg); } }
.coach-footer .coach-prev { min-height: 36px; color: #c3d5de; }

@media (max-width: 760px) {
  /* Phones (owner, 26/11/2026): a small coach at the left, the box low on the screen; the dock (z-index 71, above the trail) goes away
     while the trail is open, so nothing stands over the box and the pages are reached only through the coach. */
  body.coach-open .stadium-mobile-nav { display: none; }
  /* Room under the page, so a sector at its end can still be scrolled up clear of the box. */
  body.coach-open #app { padding-bottom: 460px; }
  .coach-card, .coach-card.centered {
    --coach-h: 440px; --coach-over: 196px;
    top: auto !important; left: 10px !important; right: 10px; transform: none;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
  }
  .coach-figure { left: -28px; bottom: -64px; }   /* lower and further left (owner, 26/11/2026): his legs go behind the box */
  .coach-balloon { padding: 10px 12px; gap: 8px; border-radius: 12px; }
  .coach-text { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .coach-spotlight-ring { animation: none; opacity: 0.9; }
  .coach-spotlight, .coach-card, .coach-progress-fill { transition: none; }
  .coach-next.waiting .coach-spin { animation-duration: 2s; }
}
