/* =====================================================================================================
   Tutorial (js/72-tutorial.js): the goal plate, hint rings and gestures, the result and lesson-list sheets.
   Same "Bridge Terminal" grammar as the rest of the UI (docs/UI.md): ink plates, Mincho heads, stepped blinks.
   Hints are white: white is the colour of the player's own marks and of the focus ring, and it is used by no role.
   ===================================================================================================== */
/* nothing from the run is in play during a lesson: gold / relics step aside, and the countdown can be hidden
   until the lesson that is about it */
.stage.tutorial .hud-top .unit.enemy { visibility: hidden; }
.stage.tut-nocd #ehud .hrow .cd { display: none; }
.stage.tut-nobt #btKey { display: none; }
.stage.tut-nopoise #ehud .poise-row { display: none; }
.stage.tutorial #btnRestart kbd { display: none; }   /* in a lesson R retries the lesson (the plate's 重來); the toolbar button still opens the seed screen */
.stage.tutorial #deckMax { display: none; }   /* the lesson's bullets are laid out by hand: "of how many" means nothing */
.stage.tutorial #log > div:nth-last-child(n+2) { display: none; }   /* the goal plate sits above the log: only the newest line, so it stays clear of her HP plate at every text size */

/* ---------- goal plate: top left, above the battle log ---------- */
.tut-plate { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px 12px 14px; margin-bottom: 2px;
  --bk: var(--text); --arm: 10px; --fill: rgba(4, 6, 12, .86); }
.tut-plate .tp-head { display: flex; align-items: center; gap: 10px; }
.tut-plate .tp-n { font: 700 calc(12px * var(--fs))/1 var(--f-lat); font-stretch: 75%; letter-spacing: .08em; color: var(--muted); }
.tut-plate .tp-t { font: 900 calc(17px * var(--fs))/1.1 var(--f-disp); letter-spacing: .12em; color: var(--text); margin-right: auto; }
.tut-plate button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hair-hi); border-radius: 0; background: transparent; color: var(--dim-text);
  font: 500 calc(11px * var(--fs))/1 var(--zh); letter-spacing: .12em; padding: 4px 9px 4px 5px; cursor: pointer; }
.tut-plate button:hover:not(:disabled) { color: var(--text); border-color: var(--text); background: rgba(238, 241, 248, .07); }
.tut-plate button:disabled { opacity: .35; cursor: default; }
.tut-plate button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.tut-plate .tp-goal { font: 700 calc(17px * var(--fs))/1.35 var(--zh); letter-spacing: .04em; color: var(--text); }
.tut-plate .tp-tip { display: none; padding: 6px 0 0 10px; border-top: 1px solid var(--hair); box-shadow: inset 3px 0 0 var(--text);
  font: 500 calc(14px * var(--fs))/1.45 var(--zh); color: var(--text); }
.tut-plate .tp-tip.on { display: block; animation: hexBlink 500ms steps(1, end) 2; }

/* ---------- hint layer: rings and gestures follow their targets every frame ---------- */
#tutLayer { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.stage:has(> :is(#overlay, #mapOverlay, #subOverlay).show) #tutLayer { display: none; }
.tut-ring { position: absolute; box-sizing: border-box; border: 2px solid var(--text);
  box-shadow: 0 0 0 2px var(--ink-key), inset 0 0 0 1px var(--ink-key); animation: tutBlink 900ms steps(1, end) infinite; }
@keyframes tutBlink { 55% { border-color: transparent; box-shadow: none; } }
/* ghost gesture: three chevrons riding up (fire) or down (discard) off the first bullet */
.tut-gesture { position: absolute; }
.tut-gesture i { position: absolute; left: 50%; width: 34px; height: 18px; margin-left: -17px; background: var(--text);
  filter: drop-shadow(0 0 1px var(--ink-key)) drop-shadow(2px 2px 0 var(--drop-c)); opacity: 0; }
.tut-gesture.up i { top: -44px; clip-path: polygon(50% 0, 100% 70%, 100% 100%, 50% 30%, 0 100%, 0 70%); animation: tutUp 1.2s linear infinite; }
.tut-gesture.down i { top: 64px; clip-path: polygon(0 0, 50% 70%, 100% 0, 100% 30%, 50% 100%, 0 30%); animation: tutDown 1.2s linear infinite; }
.tut-gesture i:nth-child(2) { animation-delay: .15s; } .tut-gesture i:nth-child(3) { animation-delay: .3s; }
@keyframes tutUp { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; translate: 0 -120px; } }
@keyframes tutDown { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; translate: 0 100px; } }
/* rhythm cue (lesson 4 after a failed try): a ring that closes onto the 格擋 lamp exactly when the strike lands,
   the same idea as the 3D timing ring; its duration is set per strike from the scheduled contact time */
.tut-close { position: absolute; z-index: 7; pointer-events: none; box-sizing: border-box; border: 2px solid var(--stop);
  box-shadow: 0 0 0 2px var(--ink-key); animation: tutClose 500ms linear forwards; }
@keyframes tutClose { from { scale: 2.2; opacity: .2; } 85% { opacity: 1; } to { scale: 1; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tut-ring, .tut-gesture i { animation-duration: 2.4s; } }

/* ---------- result sheet ---------- */
#overlay > .card.tut { align-items: stretch; text-align: left; gap: 12px; --fill: var(--sheet); --arm: 20px; --drop: 6px; overflow: hidden; }
#overlay > .card.tut.result { width: 560px; padding: 24px 32px 22px; }
#overlay > .card.tut.result.ok { --bk: var(--text); }
#overlay > .card.tut .tr-n { font: 700 calc(12px * var(--fs))/1 var(--f-lat); font-stretch: 75%; letter-spacing: .1em; color: var(--muted); }
#overlay > .card.tut .big { font: 900 calc(44px * var(--fs))/1.1 var(--f-disp); letter-spacing: .12em; padding: 0 0 10px; color: var(--text);
  transform: scaleX(.88); transform-origin: left; border-bottom: var(--rule-heavy); }
#overlay > .card.tut .tr-note { font: 500 calc(16px * var(--fs))/1.6 var(--zh); color: var(--text); }
#overlay > .card.tut .row-btn { justify-content: flex-end; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--hair); }
#overlay > .card.tut .row-btn #tutGo { margin-left: 6px; }

/* ---------- lesson list ---------- */
#overlay > .card.tut.menu { width: 900px; padding: 26px 34px 22px; }
.overlay .tut .tm-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding-top: 4px; }
.overlay .tut .tm-item { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 104px; padding: 14px 16px;
  border: 1px solid var(--hair-hi); border-radius: 0; background: rgba(4, 6, 12, .5); color: var(--text); text-align: left; cursor: pointer;
  box-shadow: 0 0 0 1px var(--ink-key), 3px 3px 0 1px var(--drop-c); }
.overlay .tut .tm-item .n { font: 800 calc(26px * var(--fs))/1 var(--f-lat); font-stretch: 75%; color: var(--muted); }
.overlay .tut .tm-item b { font: 900 calc(19px * var(--fs))/1.2 var(--zh); letter-spacing: .1em; }
.overlay .tut .tm-item i { position: absolute; right: 12px; top: 10px; font: 700 calc(16px * var(--fs))/1 var(--f-lat); font-style: normal; color: var(--gain); }
.overlay .tut .tm-item.done .n { color: var(--gain); }
.overlay .tut .tm-item.next { border-color: var(--text); box-shadow: 0 0 0 1px var(--ink-key), inset 0 0 0 1px var(--text), 3px 3px 0 1px var(--drop-c); }
.overlay .tut .tm-item:hover, .overlay .tut .tm-item:focus-visible { background: rgba(238, 241, 248, .07); border-color: var(--text); outline: none; }
