/* ============================================================================
   css/polish-middlegame.css  (C153, launch polish: the Middlegame puzzle screen as a club player feels it)
   Loaded after the tab's own injected CSS (js/tab-middlegame.js). Only puzzle-screen details live here.
   ========================================================================== */

/* Desktop: the column beside the board is a flex column with a max height. Its first block (goal, "Why this puzzle", side chip)
   had min-height:38px, so once the review below grew it SHRANK to 38px and the Explain row was drawn on top of the text.
   Nothing in that column may shrink: the column scrolls instead. */
.mg-split > .bt-grid > .bt-side > * { flex-shrink: 0; }

/* Phones (one column): board, then the feedback, then Hint / Retry / Next, then the extra tools. Before, the Tools / Engine row
   sat between the board and the feedback, so "Not quite" was pushed under the sticky Hint bar and could not be read. */
@container (max-width: 699.98px) {
  .mg-split #mg-msg { order: 1; }
  .mg-split .mg-controls { order: 2; }
  .mg-split #mg-tools { order: 3; }
  .mg-split .mg-sess { order: 4; }
  .mg-split #mg-reveal { order: 5; }
}
/* Phone focus mode, tall screens: if the page is taller than the screen, the feedback stays readable right above the sticky
   Hint / Next bar instead of sliding under it (short phones keep the board free). */
@media (max-width: 899px) and (min-height: 700px) {
  html.drill-focus .mg-split #mg-msg {
    position: sticky;
    bottom: calc(var(--nav-h, 66px) + var(--safe-b, 0px) + 6px + 64px);
    z-index: 5;
    box-shadow: 0 -6px 14px -10px rgba(0, 0, 0, .35);
  }
}

/* The feedback box: moves in bold read as moves */
.mg-msg b { font-weight: 900; }
.mg-msg small b { font-weight: 900; }

/* Who moves: "Black just moved" while their last move is played, then "White to move" with one soft pulse; "Solved" after */
.mg-side { transition: background-color .2s ease, color .2s ease; }
.mg-side.is-wait { opacity: .78; font-style: italic; }
.mg-side.is-go { animation: mg153-pop .45s ease-out 1; }
.mg-side.is-done { background: color-mix(in srgb, var(--mg-good, #4caf50) 20%, var(--surface-2, #eef0f5)); }
.mg-side.is-shown { background: color-mix(in srgb, var(--mg-warn, #f0a020) 22%, var(--surface-2, #eef0f5)); }
@keyframes mg153-pop {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-middlegame, #e8833a) 55%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}

/* Takeaway: what happened in this exact position, above the general rule */
.mg-idea { font-size: 15px; line-height: 1.4; font-weight: 800; margin: 4px 0 6px; color: var(--text, #1c1d22); }
.mg-idea b { color: var(--c-middlegame, var(--mg-acc, #e8833a)); font-weight: 900; }

/* Next puzzle shows its key (Enter) on desktop, like Hint shows H */
.mg-btn .mg-kbd { margin-left: 8px; font-size: 10.5px; padding: 2px 5px; opacity: .65; }

@media (prefers-reduced-motion: reduce) {
  .mg-side.is-go { animation: none; }
  .mg-side { transition: none; }
}
html[data-motion="off"] .mg-side.is-go { animation: none; }
