/* Tutorial coach: dimmed screen with a spotlight on a skull / HUD part, an explanation card,
   and the goal hint + bouncing arrow shown while the player acts. */

#coach { position: fixed; inset: 0; z-index: 16; display: none; }
#coach.show { display: block; }
#coach.nospot { background: rgba(4,0,3,.72); }
.coach-spot {
    position: absolute; border-radius: 50%; pointer-events: none;
    box-shadow: 0 0 0 200vmax rgba(4,0,3,.72);
    transition: left .3s, top .3s, width .3s, height .3s, border-radius .3s;
}
.coach-spot::after {
    content: ''; position: absolute; inset: -6px; border-radius: inherit; border: 3px solid var(--gold);
    box-shadow: 0 0 18px var(--gold), inset 0 0 18px rgba(255,213,74,.35); animation: spotPulse .9s ease-in-out infinite alternate;
}
#coach.nospot .coach-spot { display: none; }

.coach-card {
    position: absolute; left: 50%; transform: translateX(-50%); width: min(580px, calc(100vw - 24px));
    display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px 18px 16px;
    background: linear-gradient(180deg, #2c0a12, #12040a); border: 3px solid var(--gold); border-radius: 10px;
    box-shadow: 0 0 30px rgba(255,200,60,.35), 0 8px 0 #000;
}
.coach-card.bottom { bottom: max(16px, env(safe-area-inset-bottom)); }
.coach-card.top { top: max(16px, env(safe-area-inset-top)); }
.coach-card.center { top: 50%; transform: translate(-50%, -50%); }
.coach-card img { width: 110px; flex: none; aspect-ratio: 6 / 5; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0,0,0,.7)); }
.cc-body { flex: 1; min-width: 0; }
.cc-progress { height: 3px; background: #3a1016; margin-bottom: 10px; border-radius: 2px; overflow: hidden; }
.cc-progress > div { height: 100%; background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.cc-title { font-family: 'Creepster', cursive; font-size: clamp(22px, calc(var(--u) * 3.4), 34px); color: var(--gold); letter-spacing: 2px; line-height: 1.05; text-shadow: 2px 2px 0 #000; }
.cc-text { font-size: clamp(8px, calc(var(--u) * 1.2), 12px); line-height: 1.9; color: var(--bone); margin: 8px 0 12px; }
.cc-text b { color: var(--gold); font-weight: 400; }
.cc-row { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.cc-row .btn { padding: 12px 18px; font-size: clamp(10px, calc(var(--u) * 1.4), 13px); }
.cc-skip { font: inherit; font-size: 8px; letter-spacing: 1px; color: #a88; background: none; border: 0; padding: 8px 4px; margin-right: auto; cursor: pointer; text-decoration: underline; }
.cc-skip:hover { color: #fff; }
@media (max-width: 540px) {
    .coach-card { flex-direction: column; text-align: center; gap: 4px; padding: 12px 14px 14px; }
    .coach-card img { width: 84px; }
    .cc-row { justify-content: center; }
    .cc-skip { margin-right: 0; order: 2; width: 100%; }
}

#coach-goal {
    position: fixed; z-index: 14; left: 50%; transform: translateX(-50%); display: none; pointer-events: none;
    top: calc(var(--pad) + clamp(92px, calc(var(--u) * 14), 150px));
    width: max-content; max-width: 92vw; text-align: center; line-height: 1.7; padding: 8px 14px; border-radius: 6px;
    font-size: clamp(9px, calc(var(--u) * 1.4), 14px); letter-spacing: 2px; color: var(--gold);
    background: rgba(10,2,6,.7); border: 2px solid rgba(255,213,74,.55); text-shadow: 0 0 10px var(--ember), 2px 2px 0 #000;
}
#coach-goal.show { display: block; animation: fadeIn .3s ease-out; }
#coach-arrow {
    position: fixed; z-index: 14; display: none; pointer-events: none; transform: translate(-50%, -100%);
    font-size: clamp(26px, calc(var(--u) * 3.6), 40px); color: var(--gold); text-shadow: 0 0 12px var(--ember), 2px 2px 0 #000;
    animation: arrowBob .55s ease-in-out infinite alternate;
}
@keyframes spotPulse { to { opacity: .45; transform: scale(1.04); } }
@keyframes arrowBob { to { margin-top: -12px; } }

/* While a coach card sits at the bottom (or centre), achievement toasts drop in from the top instead. */
body[data-coach="bottom"] #toast { bottom: auto; top: max(16px, env(safe-area-inset-top)); transform: translate(-50%, -160%); }
body[data-coach="bottom"] #toast.show { transform: translate(-50%, 0); }
