/* GeoScore in the app layout (phones and touch tablets, html.gt-app). Shared frame: assets/css/mode-app.css.
   Same HTML as on PC. The welcome screen keeps its layout (it already fits a phone); during the test (#gs-test)
   the question fills the screen: skill, counter and Quit on top, the timer and the question, the map, and the
   answer field (or "Confirm this location") as the dock above the on-screen keyboard. GeoScore has no "⋯":
   Quit is its only secondary action. Every rule is under .gt-app: the PC layout never changes. */

.gt-app .gt-gs-page {
  --gtm-accent: #8d63ff;
  isolation: auto;
  overflow: clip; /* not hidden: the result's action bar stays sticky */
}
.gt-app .gt-gs-page .gt-page-grid,
.gt-app .gt-gs-page .gt-page-glow { display: none; }
.gt-app .gt-gs-page .gt-game-section { padding: 16px 0 40px; }

/* ------------------------------------------------------------ the test: full-screen frame */
.gt-app .gt-gs-page .gt-game-section:has(#gs-test:not(.d-none)) { padding: 0; }
.gt-app .gt-gs-page .gt-game-section:has(#gs-test:not(.d-none)) > .container { max-width: none; padding: 0; }
.gt-app #gs-app:has(#gs-test:not(.d-none)) {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--gt-bg);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.gt-app #gs-test {
  position: relative;
  display: flex;
  flex-direction: column;
  height: var(--gtm-game-h);
  min-height: 0;
}
.gt-app #gs-test .gt-gs-test-top {
  flex: none;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 10px var(--gtm-gutter, 16px) 0;
}
.gt-app #gs-test #gs-quit { min-height: 44px; padding-inline: 14px; }
.gt-app #gs-test .gt-gs-progress { flex: none; margin: 10px var(--gtm-gutter, 16px) 10px; }
.gt-app #gs-test .gt-gs-question {
  flex: none;
  gap: 12px;
  margin: 0;
  padding: 0 var(--gtm-gutter, 16px) 12px;
}
.gt-app #gs-test .gt-gs-prompt { font-size: 1.19rem; }
.gt-app #gs-test .gt-gs-prompt-sub { font-size: .85rem; }
.gt-app.gtm-kb-open #gs-test .gt-gs-progress { margin-bottom: 6px; }
.gt-app.gtm-kb-open #gs-test .gt-gs-question { padding-bottom: 8px; }
.gt-app.gtm-kb-open #gs-test .gt-gs-prompt-sub { display: none; }

/* Map: the rest of the screen. */
.gt-app #gs-test .gt-gs-map-frame {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--gt-border-soft);
  border-radius: 0;
}
.gt-app #gs-test #gs-map { height: 100%; min-height: 0; }

/* Dock: the answer field, or "Confirm this location" for a placement. */
.gt-app #gs-test .gt-gs-answer {
  flex: none;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--gt-border-soft);
  background: var(--gt-card);
}
.gt-app.gtm-kb-open #gs-test .gt-gs-answer { padding-bottom: 10px; }
.gt-app #gs-test .gt-gs-answer .input-group { flex-wrap: nowrap; }
.gt-app #gs-test .gt-gs-answer .input-group-text { min-height: 52px; border-radius: 16px 0 0 16px; }
.gt-app #gs-test .gt-gs-answer .form-control { min-height: 52px; font-size: 16px; }
.gt-app #gs-test .gt-gs-answer .input-group > .btn { min-height: 52px; padding-inline: 16px; border-radius: 0 16px 16px 0; font-size: 1rem; }
.gt-app #gs-test #gs-place .btn { min-height: 52px; border-radius: 16px; font-size: 1rem; }

/* Comparisons have no map: the two choices take its place. */
.gt-app #gs-test .gt-gs-choices {
  flex: 1 1 auto;
  align-content: center;
  padding: 0 var(--gtm-gutter, 16px) calc(16px + env(safe-area-inset-bottom));
}

/* Feedback on the previous answer: laid over the bottom of the map, right above the dock. */
.gt-app #gs-test .gt-gs-feedback {
  position: absolute;
  z-index: 820;
  right: 12px;
  bottom: calc(var(--gtm-dock-h) + 12px);
  left: 12px;
  margin: 0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
  pointer-events: none;
}
.gt-app #gs-test .gt-gs-feedback.is-visible { margin: 0; }
.gt-app #gs-test .gt-gs-feedback.is-right { background: color-mix(in srgb, #22c55e 22%, var(--gt-card)); }
.gt-app #gs-test .gt-gs-feedback.is-wrong { background: color-mix(in srgb, #ff6b6b 20%, var(--gt-card)); }
/* Light theme: readable feedback and weakest-skill colours (the PC colours are under 4.5:1 on light grounds). */
.gt-app[data-bs-theme="light"] #gs-test .gt-gs-feedback.is-right { color: color-mix(in srgb, #15803d 55%, #101820); }
.gt-app[data-bs-theme="light"] #gs-test .gt-gs-feedback.is-wrong { color: #b42318; }
.gt-app[data-bs-theme="light"] .gt-gs-skill-list li.is-weakest span:first-child,
.gt-app[data-bs-theme="light"] .gt-gs-continent-list li.is-weakest span:first-child { color: #b42318; }

/* ------------------------------------------------------------ result: actions kept at hand */
/* One row that scrolls sideways: share and "Take it again" first, the ranking link (kept visible) next. */
.gt-app .gt-gs-result-actions {
  position: sticky;
  z-index: 5;
  bottom: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 18px calc(-1 * var(--gtm-gutter, 16px)) 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  overflow-x: auto;
  border-top: 1px solid var(--gt-border-soft);
  background: var(--gt-card);
  scrollbar-width: none;
}
.gt-app .gt-gs-result-actions::-webkit-scrollbar { display: none; }
.gt-app .gt-gs-result-actions > * { flex: none; }
.gt-app .gt-gs-result-actions #gs-share-slot { order: 1; width: auto; }
.gt-app .gt-gs-result-actions #gs-again { order: 2; }
.gt-app .gt-gs-result-actions > a[href*="leaderboards"] { order: 3; }
.gt-app .gt-gs-result-actions #gs-certificate { order: 4; }
.gt-app .gt-gs-result-actions .btn,
.gt-app .gt-gs-result-actions #gs-share-slot .btn {
  width: auto;
  min-height: 48px;
  justify-content: center;
  white-space: nowrap;
}
.gt-app .gt-gs-result-actions #gs-share-slot:empty { display: none; }

@media (max-width: 899.98px) {
  .gt-app #gs-test .leaflet-control-zoom { display: none; }
}

/* ------------------------------------------------------------ tablet landscape: map left, panel right */
@media (min-width: 900px) {
  .gt-app #gs-test {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    column-gap: 16px;
    box-sizing: border-box;
    padding: 16px var(--gtm-gutter, 32px) 24px;
  }
  .gt-app #gs-test.d-none { display: none !important; }
  .gt-app #gs-test::before {
    content: "";
    grid-column: 2;
    grid-row: 1 / -1;
    border: 1px solid var(--gt-border-soft);
    border-radius: 22px;
    background: var(--gt-card);
  }
  .gt-app #gs-test .gt-gs-map-frame {
    grid-column: 1;
    grid-row: 1 / -1;
    border: 1px solid var(--gt-border-soft);
    border-radius: 22px;
  }
  .gt-app #gs-test .gt-gs-test-top { grid-column: 2; grid-row: 1; flex-wrap: wrap; padding: 20px 20px 0; }
  .gt-app #gs-test .gt-gs-progress { grid-column: 2; grid-row: 2; margin: 14px 20px; }
  .gt-app #gs-test .gt-gs-question { grid-column: 2; grid-row: 3; align-items: flex-start; padding: 0 20px 14px; }
  .gt-app #gs-test .gt-gs-prompt { font-size: 1.45rem; }
  /* The field stays at the top of the panel: the keyboard covers the bottom of a tablet. */
  .gt-app #gs-test .gt-gs-answer { grid-column: 2; grid-row: 4; padding: 0 20px 14px; border: 0; background: none; }
  .gt-app #gs-test .gt-gs-feedback,
  .gt-app #gs-test .gt-gs-feedback.is-visible { position: static; grid-column: 2; grid-row: 5; align-self: start; margin: 0 20px; box-shadow: none; }
  .gt-app #gs-test .gt-gs-choices { grid-column: 1 / -1; grid-row: 4 / -1; padding: 0; }
  /* Questions without a map (recall, capital, comparisons): one centred column. */
  .gt-app #gs-test:has(#gs-map-frame.d-none) { grid-template-columns: minmax(0, 760px); justify-content: center; }
  .gt-app #gs-test:has(#gs-map-frame.d-none)::before { grid-column: 1; }
  .gt-app #gs-test:has(#gs-map-frame.d-none) > * { grid-column: 1; }
  .gt-app .gt-gs-result-actions { display: flex; flex-wrap: wrap; margin-inline: 0; padding-inline: 0; border-top: 0; background: transparent; position: static; }
  .gt-app .gt-gs-result-actions .btn,
  .gt-app .gt-gs-result-actions #gs-share-slot,
  .gt-app .gt-gs-result-actions #gs-share-slot .btn { width: auto; }
}
