/* GeoTrainers game pages in the app layout (phones and touch tablets, html.gt-app).
   Shared frame of the 12 mode pages, loaded after mobile-shell.css (app bar, --sh-* colour tokens).
   Every rule that changes a page is scoped to .gt-app: the PC layout never changes.
   Each mode's own layout lives in assets/css/<mode>-app.css; the behaviour in assets/js/mode-app.js. */

:root {
  --gtm-appbar: 58px;
  --gtm-vvh: 100dvh;   /* visible height, shrinks with the on-screen keyboard (set by mode-app.js) */
  --gtm-kb: 0px;       /* on-screen keyboard height (set by mode-app.js) */
  --gtm-dock-h: 0px;   /* height of the [data-gtm-dock] bar (set by mode-app.js) */
  --gtm-danger: #c0262d;
}
[data-bs-theme="dark"] { --gtm-danger: #f87171; }

/* Height left to the game under the app bar; follows the on-screen keyboard. */
.gt-app { --gtm-game-h: calc(var(--gtm-vvh) - var(--gtm-appbar) - env(safe-area-inset-top)); }

/* Game pages have no bottom tab bar: drop the room mobile-shell.css keeps for it. */
.gt-app body { padding-bottom: 0; }

/* Game frame: fills the screen under the app bar (the help, rules and FAQ follow below it, in the page). */
.gt-app .gtm-frame { display: flex; flex-direction: column; height: var(--gtm-game-h); min-height: 0; overflow: hidden; }

/* Mode banner: eyebrow + the page's real h1 (small), counters, "⋯". */
.gt-app .gtm-modebar { display: flex; align-items: center; gap: 10px; padding: 10px var(--gtm-gutter, 16px); border-bottom: 1px solid var(--sh-border-soft); }
.gt-app .gtm-modebar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gt-app .gtm-eyebrow { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--gtm-accent-ink, var(--sh-brand)); font-size: .69rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.gt-app .gtm-eyebrow::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--gtm-accent, var(--sh-brand)); }
.gt-app .gtm-h1 { margin: 0; color: var(--sh-text); font-size: 1.19rem; font-weight: 850; letter-spacing: -.02em; line-height: 1.15; }
.gt-app.gtm-kb-open .gtm-h1 { overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }

/* Counter pill. */
.gt-app .gtm-chip { display: inline-flex; flex: none; flex-direction: column; align-items: flex-end; padding: 6px 12px; border-radius: 14px; background: var(--sh-surface); color: var(--sh-text); line-height: 1.1; }
.gt-app .gtm-chip > strong { font-size: 1.1rem; font-weight: 900; }
.gt-app .gtm-chip > span, .gt-app .gtm-chip > small { color: var(--sh-muted); font-size: .69rem; font-weight: 600; }

/* Round icon button (44 px): "⋯", and the buttons laid on the map (.gtm-mapbtn). */
.gt-app .gtm-iconbtn, .gt-app .gtm-mapbtn { display: inline-grid; flex: none; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--sh-border); border-radius: 50%; background: var(--sh-surface); color: var(--sh-text); font-size: 1.1rem; line-height: 1; }
.gt-app .gtm-mapbtn { background: var(--sh-navbar-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.gt-app .gtm-iconbtn:focus-visible, .gt-app .gtm-mapbtn:focus-visible, .gt-app .gtm-sheet-item:focus-visible { outline: 3px solid color-mix(in srgb, var(--sh-brand) 62%, transparent); outline-offset: 2px; }

/* Dock: the input bar at the bottom of the game frame, right above the on-screen keyboard. */
.gt-app .gtm-dock { display: flex; flex: none; align-items: center; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--sh-border-soft); background: var(--sh-card); }
.gt-app.gtm-kb-open .gtm-dock { padding-bottom: 10px; }

/* Bottom sheet of the secondary actions, opened by [data-gtm-more]. Any element can be the sheet: it keeps its
   content and ids, only its look changes in the app layout. Closed = off screen and hidden from assistive tech. */
.gt-app .gtm-modesheet { position: fixed !important; inset: auto auto 0 50% !important; z-index: 1060; box-sizing: border-box; width: min(100%, 560px) !important; max-height: min(80vh, calc(var(--gtm-vvh) - 24px)); margin: 0 !important; padding: .5rem var(--gtm-gutter, 16px) calc(18px + env(safe-area-inset-bottom)) !important; overflow-y: auto; border: 0 !important; border-radius: 26px 26px 0 0 !important; background: var(--sh-card) !important; color: var(--sh-text); box-shadow: 0 -20px 60px rgba(0, 0, 0, .3) !important; transform: translate(-50%, 105%); visibility: hidden; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .3s; }
.gt-app .gtm-modesheet.is-open { transform: translate(-50%, 0); visibility: visible; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.gt-app .gtm-modesheet::before { content: ""; display: block; width: 42px; height: 5px; margin: 0 auto .75rem; border-radius: 999px; background: var(--sh-border); }
.gtm-backdrop { position: fixed; inset: 0; z-index: 1055; background: rgba(4, 8, 12, .55); opacity: 0; transition: opacity .25s ease; }
.gtm-backdrop.is-open { opacity: 1; }
.gtm-backdrop[hidden] { display: none; }
.gt-app .gtm-sheet-item { display: flex; align-items: center; gap: 12px; box-sizing: border-box; width: 100%; min-height: 52px; padding: 0 14px; border: 0; border-radius: 16px; background: var(--sh-surface); color: var(--sh-text); font-size: .95rem; font-weight: 650; text-align: left; text-decoration: none; }
.gt-app .gtm-sheet-item + .gtm-sheet-item { margin-top: 8px; }
.gt-app .gtm-sheet-item.is-danger { color: var(--gtm-danger); }
.gt-app .gtm-sheet-item > i { flex: none; width: 20px; font-size: 1.1rem; text-align: center; }

/* Tablet landscape: map on the left, game panel on the right (each <mode>-app.css builds it with these). */
.gt-app .gtm-split { display: flex; gap: 16px; min-height: 0; }
.gt-app .gtm-panel { display: flex; flex: none; flex-direction: column; gap: 14px; box-sizing: border-box; width: 380px; padding: 20px; border: 1px solid var(--sh-border-soft); border-radius: 22px; background: var(--sh-card); }

@media (prefers-reduced-motion: reduce) {
  .gt-app .gtm-modesheet, .gt-app .gtm-modesheet.is-open, .gtm-backdrop { transition: none; }
}
