/* typing-test - fullscreen fit. Paired with fullscreen-fit.js, which sets --fs-w (content
   width) and --fs-font (the text size). Scoped to html.pip-immersive: normal play and
   leaving fullscreen are untouched. The shell lifts the page's width cap, so without this
   the paragraph ran as one 1900px line on a wide screen. */
html.pip-immersive .game-wrap.pip-stage > * { max-width: var(--fs-w, 100%); margin-left: auto; margin-right: auto; width: 100%; box-sizing: border-box; }
html.pip-immersive .tt-text { font-size: var(--fs-font, 1.15rem); line-height: calc(var(--fs-font, 1.15rem) * 1.83); }
html.pip-immersive .tt-board { height: calc(3 * var(--fs-font, 1.15rem) * 1.83 + .6rem + 4px); }
html.pip-immersive .tt-board.review { height: auto; }
html.pip-immersive .tt-how { display: none; }
html.pip-immersive .hud, html.pip-immersive .tt-modes, html.pip-immersive .tt-stats { margin-top: .25rem; margin-bottom: .25rem; }
html.pip-immersive .tt-bar { margin: .15rem 0 .3rem; }
html.pip-immersive #status { min-height: 1.3em; }
html.pip-immersive .tt-practice, html.pip-immersive .pip-actions { display: none; }

/* wave3 additions: tap targets, compact result, landscape, finish */
html.pip-immersive .game-wrap.pip-stage { overflow-y: auto; overscroll-behavior: contain; padding-bottom: max(.5rem, env(safe-area-inset-bottom, 0px)); }
html.pip-immersive .tt-mode, html.pip-immersive .hud .btn, html.pip-immersive .tt-r-actions .btn { min-height: 44px; }
html.pip-immersive #tt-profile { display: none; }
html.pip-immersive .tt-board { background: linear-gradient(180deg, #fff, #f1f5f9); box-shadow: 0 6px 18px -10px rgba(79,70,229,.45), inset 0 1px 0 #fff; }
html.pip-immersive .tt-board.focused { box-shadow: 0 0 0 3px rgba(99,102,241,.22), 0 8px 22px -10px rgba(79,70,229,.55); }
html.pip-immersive .tt-r-bars, html.pip-immersive .tt-r-keys { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  html.pip-immersive .tt-stats { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  html.pip-immersive .tt-stat { padding: .15rem; }
  html.pip-immersive .tt-stat b { font-size: 1rem; }
  html.pip-immersive .tt-result { padding: .5rem .75rem; }
  html.pip-immersive .tt-r-grid { gap: 4px; }
  html.pip-immersive .tt-r-pb, html.pip-immersive .tt-r-cap { display: none; }
}

/* fullscreen fill: the board takes all the space the controls leave */
html.pip-immersive .game-wrap.pip-stage, html.pip-native .game-wrap.pip-stage { display: flex; flex-direction: column; box-sizing: border-box; }
html.pip-immersive .game-wrap.pip-stage > *, html.pip-native .game-wrap.pip-stage > * { flex: 0 0 auto; }
html.pip-immersive .game-title, html.pip-immersive .facts, html.pip-native .game-title, html.pip-native .facts,
html.pip-native .tt-how, html.pip-native .tt-practice, html.pip-native .pip-actions, html.pip-native #tt-profile { display: none; }
html.pip-immersive .game-wrap.pip-stage > .tt-board:not(.review), html.pip-native .game-wrap.pip-stage > .tt-board:not(.review) { flex: 1 1 0; min-height: 96px; height: auto; }
html.pip-native .tt-board:not(.review) { height: auto; }
html.pip-immersive .game-wrap.pip-stage > .tt-board.review, html.pip-native .game-wrap.pip-stage > .tt-board.review { flex: 0 1 auto; }
html.pip-native .game-wrap.pip-stage { max-width: var(--fs-w, 100%); }
html.pip-native .tt-text { font-size: var(--fs-font, 1.15rem); line-height: calc(var(--fs-font, 1.15rem) * 1.83); }
html.pip-native .tt-mode, html.pip-native .hud .btn, html.pip-native .tt-r-actions .btn { min-height: 44px; }
@media (orientation: landscape) and (max-height: 520px) {
  html.pip-immersive .game-wrap.pip-stage, html.pip-native .game-wrap.pip-stage {
    display: grid; grid-template-columns: 270px minmax(0, 1fr); grid-template-rows: repeat(8, auto) 1fr; column-gap: 10px; align-content: stretch; }
  html.pip-immersive .game-wrap.pip-stage > *, html.pip-native .game-wrap.pip-stage > * { grid-column: 1; max-width: none; margin-left: 0; margin-right: 0; }
  html.pip-immersive .game-wrap.pip-stage > .tt-board, html.pip-native .game-wrap.pip-stage > .tt-board { grid-column: 2; grid-row: 1 / 10; height: auto; min-height: 0; }
  html.pip-immersive .game-wrap.pip-stage > .tt-result, html.pip-native .game-wrap.pip-stage > .tt-result {
    grid-column: 2; grid-row: 1 / 10; z-index: 3; overflow: auto; background: #fff; border-radius: 14px; margin: 0; }
  html.pip-immersive .tt-result[hidden], html.pip-native .tt-result[hidden] { display: none; }
}
