/* ============================================================================
   骑龙课 · TONE GLIDER (HANDS-ON v2) — prom/js/drills/tone2.js
   ============================================================================
   Benchmark: Alto's Odyssey. The sky, the parallax, the dragon, the ribbon and
   the lantern string are all painted on the canvas — a contour you RIDE cannot
   be made of DOM nodes. This sheet is the ground crew: Sky's clipboard, the
   press-and-hold plate the thumb actually lives on, and the reveal slip.

   Materials are the kit's: ink #241335, cream stock #f2e4c2, lantern gold
   #ffc84a, vermillion #e04a3a, teal #3ee6c4 for "flown clean" and nothing else.
   Loaded after drill-kit.css; the drill claims the sheet itself (ensureCss).
   ========================================================================= */

.tg-game {
  --dk-accent: #ffc84a;             /* the drill's ONE accent: lantern gold */
  --tg-lane: 0px;                   /* room reserved for Sky's cutout on wide screens */
  width: 100%; display: flex; flex-direction: column; align-items: center;
}
.tg-court {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: min(880px, 95vw); margin-top: 6px; padding-left: var(--tg-lane);
}
@media (min-width: 1120px) { .tg-game { --tg-lane: 140px; } }

/* --------------------------------------------------------------- THE SKY */
.tg-skycase { width: 100%; position: relative; line-height: 0; }
.tg-sky {
  width: 100%; height: auto; display: block; border-radius: 14px;
  border: 3px solid var(--dk-ink); box-shadow: 0 5px 0 rgba(14, 6, 24, 0.8);
  touch-action: none;               /* the thumb is the throttle; no scroll-drag */
  cursor: pointer; user-select: none;
}
.tg-sky:focus-visible { outline: 3px solid var(--dk-gold); outline-offset: 3px; }

/* --------------------------------------------------- SKY'S CLIPBOARD (板)
   A paper board on a wooden backing: the syllable to fly, the tools, and after
   the flight the word itself. Nothing here is a segmented control — the four
   tone buttons the classic drill used are gone, because picking the contour off
   a menu is the exact move this rebuild exists to delete. */
.tg-desk {
  width: 100%; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px 11px; position: relative;
}
/* ROUND-16: THE CLIP IS GONE. It was a 58x11 gold tab on the top edge of the
   clipboard, pure decoration, and a blind judge listed it among the things they
   could not identify with the only "no guess at all" in their whole sweep: "a
   small rounded yellow tab poking out of the top edge of a strip, like a little
   bookmark or drawer handle… I cannot tell if it is a handle to drag, a
   progress bar that has barely filled, or just a decorative notch." It sat
   directly under the hold plate, which now wears the drill's one gold ring, so
   it was also a second gold thing competing with the live control at 3mm tall.
   Nothing was lost: .dk-plate already draws the board's paper and its edge. */

/* the flight counter, moved off .mg-score and onto the clipboard, where it
   changes and where the syllable it counts already lives. Subordinate on
   purpose — the goal chip in the header is the score, and this is the position
   in the class. Latin only: the chip carries the hanzi for both of them. */
.tg-flight {
  font-size: var(--dk-caption); font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--dk-ink-soft); white-space: nowrap;
}
.tg-flight b { font-weight: 900; color: var(--dk-ink); }
/* THE TYPE HIERARCHY, THE RIGHT WAY UP (round 9).
   This was exactly backwards for a tone drill. The clipboard's prompt is the
   syllable with its tone mark STRIPPED — "ba", the one string on screen that
   carries no tone at all — and it was set at the display step, 36px, the
   biggest thing in the frame. The diagnosis the drill exists to deliver — the
   character 爸 and the tone 四声 — landed in the reveal at 20px and 16px, the
   tone name under the hanzi floor because it was inside an English sentence.
   So: the reveal's hanzi and tone name take the display step, and the bare
   pinyin drops to the reading step, which is what a prompt with no answer in
   it should be. Three sizes on this surface — display, --dk-read, --dk-label —
   and the head's two are the same 20/16, so the drill measures four total. */
.tg-syl {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  font-size: var(--dk-read); font-weight: 800; letter-spacing: 0.02em;
  line-height: 1.3; color: var(--dk-ink); min-width: 3.2em;
}
/* The question mark is punctuation, not a verdict. It was painted in the
   wrong-answer token on every single round — the one colour rule the house
   states absolutely — which taught the eye that vermillion means "a question is
   open" and left nothing for "you got it wrong" to mean. Soft ink: it is the
   quietest thing on the clipboard, which is what a question mark should be. */
/* ROUND-17: THE QUESTION MARK BECAME THE QUESTION. It used to be a lone "?" and
   a blind judge could not tell whether it was punctuation, a mystery to solve or
   a button. It now reads "which tone?" (or "which one?" on the pair round) — the
   same block, no new line on the clipboard — so it drops to the label step and
   stays the quietest thing on the board, which is what a prompt's tail should
   be. Still soft ink, never the wrong-answer token: see the note above. */
.tg-syl .q { color: var(--dk-ink-soft); font-weight: 700; font-size: var(--dk-label); }
/* the minimal-pair round shows BOTH characters from the start — you cannot
   choose between two words you have not been shown, and the choosing is the
   round. Nothing here says which is which: only the flown contour does. */
/* The pair round is the one time the clipboard holds hanzi BEFORE the flight,
   and there the two characters are the round's subject, so they keep the
   display step. The slash and the bare syllable ride the container's reading
   step — they used to be 24px and 22px, two sizes that existed only to sit
   between the old 40px and the 20px reveal. */
.tg-syl .pw { font-family: var(--han); font-size: var(--dk-display); font-weight: 900;
  line-height: var(--dk-lh-tight); }
.tg-syl .sl { font-weight: 700; color: var(--dk-ink-soft); }
.tg-syl .bare { font-weight: 800; color: var(--dk-ink-soft); margin-left: 4px; }
/* the display line is reserved from the start, so landing does not shove the
   board and the lantern count down the page mid-verdict */
.tg-reveal { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0;
  min-height: calc(var(--dk-display) * var(--dk-lh-tight)); }
.tg-reveal .han { font-family: var(--han); font-size: var(--dk-display); font-weight: 900;
  line-height: var(--dk-lh-tight); color: var(--dk-ink); }
/* 爸 四声 — the character and the tone, the same weight and the same step,
   because in a tone drill they are one fact and neither outranks the other.
   A two-syllable word prints one tone name per syllable (谢谢 → 四声 轻声), so
   the tone band needs to sit clear of the word or the four hanzi read as one
   run: the extra margin makes the gap to the word wider than the space INSIDE
   the band, which is what tells the eye where the word stops. */
.tg-reveal .tone { letter-spacing: 0.01em; margin-left: 6px; }
/* ROUND-17: TWO LINES, NEVER THREE — and on a TONE drill the pinyin is the line
   that stays. The slip used to run 玩 / 四声 / wán / "to play · 9 of 13 lanterns
   lit": four statements of one word, which is the exact zigzag the judges named.
   The English MEANING came off; it is not lost, it moved to the hover/tap card
   on the character itself, which also speaks it. So .py is now the slip's only
   gloss — ink, not soft ink, because it is the lesson — and .en carries only the
   DIAGNOSIS, which is not a gloss of the word at all. */
.tg-reveal .py { font-size: var(--dk-label); font-weight: 800; color: var(--dk-ink); }
.tg-reveal .en { font-size: var(--dk-label); font-weight: 700; color: var(--dk-ink-soft); }
/* A character NAMED INSIDE the gloss (the minimal-pair round says which of the
   two you landed on) is a hanzi in a sentence, not a verdict: reading step so
   it clears the floor, and the sentence's own ink so vermillion still means
   only "this round was wrong" and marks only the character being judged. */
.tg-reveal .en .han { font-size: var(--dk-read); font-weight: 800; color: inherit; }
.tg-reveal.is-right .han { color: #0e7c62; }
.tg-reveal.is-wrong .han { color: #a8281b; }
.tg-reveal.is-right .en .han, .tg-reveal.is-wrong .en .han { color: inherit; }

.tg-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tg-btn {
  font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer;
  background: var(--dk-stock-2); color: var(--dk-ink);
  border: 3px solid var(--dk-ink); border-radius: 10px; padding: 6px 12px;
  box-shadow: 0 3px 0 rgba(14, 6, 24, 0.75);
}
.tg-btn .han { font-family: var(--han); font-size: 20px; font-weight: 900; margin-right: 5px; }
.tg-btn:hover { background: #fff6e0; }
.tg-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(14, 6, 24, 0.75); }
.tg-btn.on { background: var(--dk-gold); }
.tg-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
/* 再听 reads as an icon alone — see AGAIN_ICON — so it drops the label. */
.tg-btn-ic { display: flex; align-items: center; justify-content: center; padding: 8px; }
.tg-btn-ic svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------- THE THROTTLE
   The whole sky is the button, exactly as in the benchmark — this plate is the
   redundant, obvious, thumb-sized copy of it for phones and for anyone who
   wants somewhere deliberate to hold. It says what the HAND does, never an
   amount: how long you hold is entirely yours. */
.tg-hold {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 13px 16px; cursor: pointer; user-select: none; touch-action: none;
  border: 3px solid var(--dk-ink); border-radius: 12px;
  background: var(--dk-stock); color: var(--dk-ink);
  box-shadow: 0 4px 0 rgba(14, 6, 24, 0.8);
  font-family: inherit;
}
.tg-hold .han { font-family: var(--han); font-size: 20px; font-weight: 900; }
.tg-hold .lat { font-size: 16px; font-weight: 700; color: var(--dk-ink-soft); }
.tg-hold.gk-holding, .tg-hold:active { background: var(--dk-gold); transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(14, 6, 24, 0.8); }
.tg-hold:disabled { opacity: 0.45; cursor: default; transform: none; }

/* ---------------------------------------------------------------- THE BOARD
   The scaffold, and it is in the fiction: Sky reads everything off a clipboard,
   so Sky writes the tone on it and hangs the lantern string to match. Never
   hidden, never punished, always available — but a round flown off the board is
   billed to `cc`, so the save banks 读 instead of 听 for a run flown by eye.
   Type floors: hanzi 20px, latin 16px, nothing at caption size, because every
   line here is a fact and not a gloss.
   ROUND 5: the board no longer prints what the HAND must do — not in English,
   which taught the tone-to-thumb mapping in the player's own language during
   the exact two rounds meant to teach it, and not in Chinese either. It carries
   the tone's NAME and its 五度 numerals, which are facts about the tone and
   only readable against the staff on the sky. The hand is named once, by Sky,
   on the rehearsal after a miss.

   ROUND 15: this strip is now REACHED ONLY BY PRESSING 板上. It used to appear
   on its own for the first two flights, riding on the free lantern string, so
   the first board a player ever saw printed "má 二声 35" one line under a
   prompt reading "ma ?" — the answer, three times over, on a board nobody had
   touched. The gate moved from hung() to capShown() in tone2.js. Nothing about
   the strip's LOOK changed: when it is up, it was bought, and it should read
   like the plain fact it is. */
.tg-cc {
  width: 100%; padding: 8px 13px; display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap;
  min-height: 32px;
}
.tg-cc .han { font-family: var(--han); font-size: 20px; font-weight: 800; }
/* The board's pinyin was the only gold text in the drill and it is the one run
   here that never changes state: it is printed by paintCap() when the board is
   hung and then sits there for the whole round. Gold on this stage is spoken
   for — the hold button takes it while the thumb is down, and that IS the
   verb — so a caption wearing the same colour was telling the player to look at
   the scaffold instead of at the sky. Cream; the pinyin still leads the band on
   size (20px against the 16px of the tone name's numerals) and on weight. */
.tg-cc .py { font-family: inherit; color: var(--paper, #f2efe9); letter-spacing: 0.01em; }
.tg-cc .lat { font-size: 16px; font-weight: 700; display: inline-flex; align-items: baseline; gap: 6px; }
.tg-cc[hidden] { display: none; }

/* ------------------------------------------------------- SKY SAYS IT TWICE
   House rule from playtesting: every direction, warning, correction and
   notice carries English as well as Chinese. Sky's hanzi leads the bubble and
   the English sits beneath it as its own line — at --dk-label (16px, the
   absolute readable floor) and NOT at --dk-caption, because the kit reserves
   caption size for pinyin and glosses that are never load-bearing, and a
   translated instruction is load-bearing by definition.
   The bubble's stock is pinned to #fdf6e0 in both themes (prom.css), so this
   ink measures the same in each: #4b3a63 on #fdf6e0 is 9.3:1.
   The hanzi line also comes up to the 20px floor here — prom.css sets the
   bubble's .han at 19px, which is a hair under it, and the sister drills
   (dance2, hoops2) already correct it on their own roots. */
.tg-host .mg-bubble .han { font-size: var(--dk-read); }
/* ROUND-17 — SKY'S LINE HAD TO BE REACHABLE BEFORE IT COULD BE READABLE.
   The wave's whole mechanism on desktop is HOVER, and the bubble is docked
   inside .mg-host, which carries pointer-events:none so the host's cutout can
   never swallow a press meant for the board. Measured (dev/scratch/w17-tone-hit
   .mjs): a hover over Sky's first word landed on div.tg-game, not on the word —
   the card could not open at all. Only the WORD SPANS opt back in: the bubble's
   stock, its tail and its English line stay transparent to the pointer, so the
   panel still cannot intercept anything, and nothing in tone2 listens for a
   press here anyway (pointerdown is bound to the canvas and the plate only, so
   a pointer resting on a word cannot start or steal a flight). On phones the
   kit floats the bubble into the column, where it already inherits auto — this
   rule is a no-op there. */
.tg-host .mg-bubble .w { pointer-events: auto; }
.tg-host .mg-bubble .en {
  display: block; margin-top: 4px;
  font-size: var(--dk-label); font-weight: 700; line-height: 1.35;
  letter-spacing: 0.01em; color: #4b3a63;
}

@media (max-width: 720px) {
  .tg-game { --tg-lane: 0px; }
  /* 92vw, not 96: the hold plate wears the kit's live ring, which stands 10px
     off the object at the top of its breath. At 96vw that outer edge was the
     widest thing on the page and the body scrolled sideways. */
  .tg-court { width: 92vw; gap: 8px; margin-top: 4px; }
  .tg-desk { padding: 9px 11px 10px; gap: 10px; }
  .tg-tools { margin-left: 0; width: 100%; }
}

/* .minigame centres its single column, so once the column is taller than the
   viewport the centring CLIPS THE TOP and the first row lands under the
   absolutely-positioned .mg-head (measured: column top at -15px, header at
   18-60px in light mode). The drill's own root carries this class, so no :has()
   and no edit to prom.css: top-align, and leave room for the header. */
.minigame.tg-host { justify-content: flex-start; padding-top: 64px; }

/* ------------------------------------------------------------ THE REST STATE
   This selector used to be .tg-wait and it covered the whole LISTEN beat: the
   plate went quiet and its words changed to 先听…… because a press during the
   listen phase was swallowed (FTUE pass, 2026-07-31 — the blind audit had
   pressed the throttle for twenty seconds believing the drill was broken).
   Round 16 fixed that from the other end: a press during the listen beat now
   takes off, so the plate honours a press at every moment a round is on screen
   and never has to say "wait". What is left is the VERDICT beat — the two
   seconds after a landing while Sky says what happened and the reveal is on the
   clipboard — where the hand genuinely has nothing to do. The plate rests, and
   the gold ring lifts off it (setLive(box, null) in tone2.js): dim plus no ring
   is the board's way of saying "not now", and it is never a disabled attribute,
   because the very next frame is a new round. */
.tg-hold.tg-rest { background: var(--dk-stock-2); opacity: 0.72; }
.tg-hold.tg-rest:active { transform: none; box-shadow: 0 4px 0 rgba(14, 6, 24, 0.8); background: var(--dk-stock-2); }

/* ------------------------------------------------------------- THE LIVE RING
   The kit draws .dk-live as an outline standing 5px off the object and
   breathing out to 10px. The plate is the full width of the court, so on a
   phone the ring's outer edge would be the widest thing on the page; the court
   is trimmed above (92vw) to leave it room. Nothing here restyles the ring —
   it is kit furniture and it must look identical on all fifteen boards. */
.tg-hold.dk-live { position: relative; z-index: 1; }

/* Packet 08: headers take real space as text grows; the board follows them. */
.minigame.tg-host { justify-content:flex-start; padding-top:12px; overflow-y:auto; }
.minigame.tg-host > .mg-head { position:relative; top:auto; left:auto; transform:none;
  flex:0 0 auto; margin:0 auto 12px; max-width:calc(100% - 16px); height:auto; }
.minigame.tg-host .mg-score { min-width:0; max-width:100%; white-space:normal; flex-wrap:wrap; }
.minigame.tg-host .dk-goal { max-width:100%; white-space:normal; flex-wrap:wrap; }
.minigame.tg-host .tool { min-width:44px; min-height:44px; }

.tg-host .tg-game { flex-shrink:0; }
.tg-host .tg-court { margin-top:8px; }

.minigame.tg-host .dk-goal-zh, .minigame.tg-host .dk-goal-count { flex-shrink:0; white-space:nowrap; }

.minigame.tg-host.motor-over > .dk-goal-verdict { position:relative; inset:auto; transform:none;
  flex:0 0 auto; margin:8px auto; max-width:calc(100% - 24px); }
