/* Discovery in the app layout (phones and touch tablets, html.gt-app): the game fills the first screen.
   Same DOM as the PC page, only the look changes (shared frame: mode-app.css / mode-app.js).
   - Phone: banner (kicker, the page's h1, "Cities found", "⋯"), map, input dock above the keyboard.
   - The session actions (#discovery-more) become the "⋯" sheet; the intro paragraph is moved under the
     game by data-gtm-move (still visible); progress and help follow in the page.
   - Tablet (900 px and more): map on the left, game panel on the right.
   The existing fullscreen mode keeps its own rules (#discover-container.geotrainer-fullscreen). */

/* The fixed sheet and the shared backdrop must live in the root stacking context. */
.gt-app main.gt-page { isolation: auto; }
.gt-app .gt-game-section { padding: 0; }
.gt-app .gt-game-section > .container { max-width: none; padding: 0; }

/* ------------------------------------------------------------ frame */
.gt-app #discover-container:not(.geotrainer-fullscreen) {
  display: flex;
  flex-direction: column;
  height: var(--gtm-game-h);
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--gt-bg);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Banner */
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-game-topbar {
  order: 0;
  flex: none;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px var(--gtm-gutter, 16px);
  border-bottom: 1px solid var(--sh-border-soft);
}
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-game-heading { flex: 1 1 auto; min-width: 0; max-width: none; display: flex; flex-direction: column; gap: 3px; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-kicker { gap: 6px; font-size: .69rem; font-weight: 800; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-game-heading h1 { margin: 0; font-size: 1.19rem; font-weight: 850; letter-spacing: -.02em; line-height: 1.15; }
.gt-app.gtm-kb-open #discover-container:not(.geotrainer-fullscreen) .gt-game-heading h1 { overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stats { width: auto; flex: none; display: flex; gap: 6px; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat { width: auto; min-width: 0; padding: 6px 12px; gap: 0; border: 0; border-radius: 14px; background: var(--sh-surface); }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat-icon { display: none; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat > span:last-child { display: flex; flex-direction: column-reverse; align-items: flex-end; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat strong { margin: 0; font-size: 1.1rem; font-weight: 900; line-height: 1.1; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat small { font-size: .69rem; font-weight: 600; white-space: nowrap; }

/* Optional strips stay compact inside the frame */
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-challenge-strip { order: 1; flex: none; margin: 8px 12px 0; }
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-admin-panel { order: 2; flex: none; max-height: 30%; margin: 8px 12px 0; overflow: auto; }

/* Map: everything that is left */
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-map-frame { order: 5; flex: 1 1 auto; min-height: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.gt-app #discover-container:not(.geotrainer-fullscreen) #map { height: 100%; min-height: 0; }

/* Dock: the input bar, right above the keyboard */
.gt-app #discover-container:not(.geotrainer-fullscreen) .gt-command-bar {
  order: 10;
  flex: none;
  display: block;
  margin: 0;
  padding: 10px 12px 12px;
  border: 0;
  border-top: 1px solid var(--sh-border-soft);
  border-radius: 0;
  background: var(--sh-card);
}
.gt-app #discover-container .gt-input-group { min-height: 52px; border-radius: 16px; box-shadow: none; }
.gt-app #discover-container .gt-city-input { font-size: 16px; }
.gt-app #discover-container .gt-btn-validate { min-width: 0; padding-inline: 16px; font-weight: 800; }

/* Pinch replaces the zoom buttons on phones; on tablets they get finger-sized. */
@media (max-width: 759.98px) {
  .gt-app #discover-container .leaflet-control-zoom { display: none; }
  /* The stopwatch keeps its accessible name (role=timer + aria-label): its visible label would crowd the banner. */
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-session-timer small { display: none; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat { padding: 6px 10px; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-kicker { white-space: nowrap; }
}
.gt-app #discover-container .leaflet-control-zoom a { width: 44px; height: 44px; font-size: 20px; line-height: 44px; }

/* The intro paragraph, moved right under the game (data-gtm-move) */
.gt-app .gt-game-section > .container > .gt-discovery-intro { max-width: 760px; margin: 0; padding: 20px var(--gtm-gutter, 16px) 0; color: var(--gt-muted); font-size: 1rem; line-height: 1.6; }

/* ------------------------------------------------------------ "⋯" sheet (the real session buttons) */
.gt-app #discovery-more { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.gt-app #discovery-more > .btn {
  width: 100%;
  min-height: 52px;
  justify-content: flex-start;
  gap: 12px;
  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;
  white-space: normal;
}
.gt-app #discovery-more > .btn > i { width: 20px; font-size: 1.1rem; text-align: center; }
.gt-app #discovery-more > #gt-homonyms-btn { grid-column: auto; }
.gt-app #discovery-more > #gt-homonyms-btn.is-unlocked,
.gt-app #discovery-more > #gt-homonyms-btn.btn-outline-success { background: color-mix(in srgb, #34d399 12%, var(--sh-surface)); color: color-mix(in srgb, #34d399 78%, var(--sh-text)); }
.gt-app #discovery-more > .btn-end-session { color: var(--gtm-danger); }
.gt-app .gt-discovery-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.gt-app .gt-discovery-sheet-head small { display: block; color: var(--sh-brand); font-size: .69rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.gt-app[data-bs-theme="light"] .gt-discovery-sheet-head small { color: color-mix(in srgb, var(--sh-brand) 80%, var(--sh-text)); }
.gt-app .gt-discovery-sheet-head strong { display: block; font-size: 1.1rem; font-weight: 800; }

/* ------------------------------------------------------------ tablet: map left, panel right */
@media (min-width: 900px) {
  .gt-app #discover-container:not(.geotrainer-fullscreen) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    column-gap: 16px;
    padding: 16px var(--gtm-gutter, 32px) 24px;
    background: transparent;
  }
  .gt-app #discover-container:not(.geotrainer-fullscreen)::before {
    content: "";
    grid-column: 2;
    grid-row: 1 / -1;
    border: 1px solid var(--sh-border-soft);
    border-radius: 22px;
    background: var(--sh-card);
  }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-map-frame { grid-column: 1; grid-row: 1 / -1; border: 1px solid var(--sh-border-soft); border-radius: 22px; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-game-topbar { grid-column: 2; grid-row: 1; flex-direction: column; align-items: stretch; gap: 14px; padding: 22px 20px 14px; border: 0; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-game-heading h1 { font-size: 1.55rem; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat { padding: 10px 14px; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat > span:last-child { align-items: flex-start; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-primary-stat strong { font-size: 1.45rem; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-challenge-strip { grid-column: 2; grid-row: 2; margin: 0 20px 12px; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-command-bar { grid-column: 2; grid-row: 3; padding: 0 20px 18px; border: 0; background: transparent; }
  .gt-app #discover-container:not(.geotrainer-fullscreen) .gt-admin-panel { grid-column: 2; grid-row: 4; margin: 0 20px 12px; }
  .gt-app #discover-container .gt-discovery-more-btn,
  .gt-app #discover-container .gt-discovery-sheet-head .gtm-iconbtn,
  .gt-app #discover-container .gt-discovery-sheet-head small { display: none; }
  /* The sheet is shown inline in the panel on tablets. */
  .gt-app #discover-container:not(.geotrainer-fullscreen) #discovery-more.gtm-modesheet {
    position: static !important;
    width: auto !important;
    max-height: none;
    margin: 16px 0 0 !important;
    padding: 0 !important;
    overflow: visible;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none;
    visibility: visible;
    transition: none;
  }
  .gt-app #discover-container:not(.geotrainer-fullscreen) #discovery-more.gtm-modesheet::before { display: none; }
}
