/* Discovery Elo in the app layout (phones and touch tablets, html.gt-app). Same DOM as the PC page.
   - Phone (signed in): banner (kicker, the h1, Elo pill, "⋯"), compact rank strip, map, then the mission and the
     input dock right above the keyboard. Skip joins the dock (data-gtm-move); New session and the reset quota
     become the "⋯" sheet (#elo-more). The intro and the stat tiles are moved under the game (still visible).
   - Guests keep the sign-in gate under the banner, as today.
   - Tablet (900 px and more): map on the left, panel on the right.
   Shared frame: mode-app.css / mode-app.js. */

/* The fixed sheet and the shared backdrop must live in the root stacking context. */
.gt-app .gt-elo-page { isolation: auto; min-height: 0; }
.gt-app .gt-elo-hero { padding: 0 0 8px; }
.gt-app .gt-elo-hero > .gt-elo-frame { max-width: none; padding: 0; }

/* ------------------------------------------------------------ banner (guests too) */
.gt-app .gt-elo-heading { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px var(--gtm-gutter, 16px); border-bottom: 1px solid var(--sh-border-soft); }
.gt-app .gt-elo-heading > div:first-child { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gt-app .gt-elo-kicker { gap: 6px; margin: 0; font-size: .69rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.gt-app .gt-elo-heading h1 { margin: 0; font-size: 1.19rem; font-weight: 850; letter-spacing: -.02em; line-height: 1.15; }
.gt-app .gt-elo-rating-orb {
  position: static;
  width: auto;
  aspect-ratio: auto;
  flex: none;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: end;
  align-items: baseline;
  column-gap: 5px;
  padding: 6px 12px;
  border: 0;
  border-radius: 14px;
  background: var(--sh-surface);
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  text-align: right;
}
.gt-app .gt-elo-rating-orb::before { display: none; }
.gt-app .gt-elo-rating-orb strong { grid-column: 1 / -1; grid-row: 1; margin: 0; font-size: 1.1rem; font-weight: 900; line-height: 1.1; }
.gt-app .gt-elo-rating-orb small { grid-row: 2; font-size: .6rem; letter-spacing: .12em; }
.gt-app .gt-elo-rating-orb span { grid-row: 2; font-size: .69rem; }
.gt-app .gt-elo-guest .gt-elo-more-btn,
.gt-app .gt-elo-guest .gt-elo-rating-orb { display: none; } /* as on PC: no Elo before signing in */
.gt-app .gt-elo-auth-gate { margin: 16px var(--gtm-gutter, 16px) 0; }
.gt-app .gt-elo-auth-gate .btn { min-height: 48px; }

/* Intro and stat tiles, moved under the game (data-gtm-move) */
.gt-app .gt-elo-hero > .gt-elo-intro { max-width: 760px; margin: 0; padding: 18px var(--gtm-gutter, 16px) 0; color: var(--gt-muted); font-size: 1rem; line-height: 1.6; }
.gt-app .gt-elo-hero > .gt-elo-stat-grid { margin: 16px var(--gtm-gutter, 16px) 0; }
.gt-app .gt-elo-guest .gt-elo-hero > .gt-elo-stat-grid { display: none; }

/* ------------------------------------------------------------ frame (signed in) */
.gt-app .gt-elo-authenticated .gt-elo-frame { display: flex; flex-direction: column; height: var(--gtm-game-h); min-height: 0; overflow: hidden; }
.gt-app .gt-elo-authenticated .gt-elo-heading { flex: none; }
.gt-app .gt-elo-authenticated #elo-game {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Rank strip */
.gt-app .gt-elo-authenticated #elo-rank-card { flex: none; min-height: 0; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin: 0; padding: 8px var(--gtm-gutter, 16px); border: 0; border-bottom: 1px solid var(--sh-border-soft); border-radius: 0; }
.gt-app .gt-elo-authenticated #elo-rank-card .gt-elo-rank-emblem--large { --gt-rank-emblem-size: 34px; }
.gt-app .gt-elo-authenticated .gt-elo-current-rank__title-line { flex-direction: row; align-items: baseline; gap: 8px; margin: 0; }
.gt-app .gt-elo-authenticated .gt-elo-current-rank h2 { font-size: 1rem; }
.gt-app .gt-elo-authenticated .gt-elo-rank-progress { margin-top: 6px; }
.gt-app .gt-elo-authenticated .gt-elo-rank-progress__labels { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; min-height: 0; margin-top: 4px; }

/* Map: everything that is left */
.gt-app .gt-elo-authenticated .gt-elo-play-grid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 0; }
.gt-app .gt-elo-authenticated .gt-elo-map-panel { order: 1; flex: 1 1 auto; min-height: 0; padding: 0; border: 0; border-radius: 0; background: var(--gt-map-ocean); }
.gt-app .gt-elo-authenticated #elo-map { height: 100%; min-height: 0; border: 0; border-radius: 0; }
.gt-app .gt-elo-authenticated .gt-elo-map-topline { position: absolute; z-index: 600; top: 10px; left: 10px; min-height: 0; gap: 8px; padding: 5px 6px 5px 11px; border: 1px solid var(--sh-border); border-radius: 999px; background: var(--sh-navbar-bg); }
.gt-app .gt-elo-authenticated .gt-elo-map-empty { inset: 0; }
@media (max-width: 759.98px) {
  .gt-app .gt-elo-authenticated #elo-map .leaflet-control-zoom { display: none; }
}
.gt-app #elo-map .leaflet-control-zoom a { width: 44px; height: 44px; font-size: 20px; line-height: 44px; }

/* Mission + dock, right above the keyboard */
.gt-app .gt-elo-authenticated .gt-elo-mission-panel { order: 2; flex: none; overflow: visible; padding: 12px; border: 0; border-top: 1px solid var(--sh-border-soft); border-radius: 0; background: var(--sh-card); }
.gt-app .gt-elo-authenticated .gt-elo-mission-topline { display: none; }
.gt-app .gt-elo-authenticated .gt-elo-mission-loading { min-height: 52px; }
.gt-app .gt-elo-authenticated .gt-elo-tier { margin: 0 0 4px; }
.gt-app .gt-elo-authenticated #elo-mission-title { min-height: 0; font-size: 1.05rem; letter-spacing: -.02em; line-height: 1.25; }
.gt-app .gt-elo-authenticated .gt-elo-constraints { min-height: 0; flex-wrap: nowrap; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.gt-app .gt-elo-authenticated .gt-elo-constraints::-webkit-scrollbar { display: none; }
.gt-app .gt-elo-authenticated .gt-elo-constraints span { flex: none; }
.gt-app .gt-elo-authenticated #elo-form { display: flex; align-items: stretch; gap: 8px; margin-top: 10px; }
.gt-app .gt-elo-authenticated .gt-elo-input-group { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: nowrap; }
.gt-app .gt-elo-authenticated .gt-elo-input-group .form-control { width: auto; min-width: 0; font-size: 16px; }
.gt-app .gt-elo-authenticated .gt-elo-input-group .btn { grid-column: auto; width: auto; min-width: 0; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding-inline: 14px; border-radius: 12px !important; white-space: nowrap; }
.gt-app .gt-elo-authenticated #elo-form > #elo-skip { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 52px; min-height: 52px; padding: 0; border-radius: 16px; }
.gt-app .gt-elo-authenticated #elo-form > #elo-skip > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 899.98px) {
  .gt-app .gt-elo-authenticated .gt-elo-matchup { display: none; } /* decorative, aria-hidden */
  .gt-app .gt-elo-authenticated .gt-elo-current-rank__eyebrow,
  .gt-app .gt-elo-authenticated #elo-rank-range { display: none; } /* the rank name and "Next" already say it */
}

/* Result toast, laid on the bottom of the map */
.gt-app .gt-elo-authenticated .gt-elo-status { position: absolute; z-index: 700; left: 12px; right: 12px; bottom: calc(100% + 10px); min-height: 0; margin: 0; padding: 9px 12px; border-radius: 14px; background: var(--sh-card); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.gt-app .gt-elo-authenticated .gt-elo-status:empty { display: none; }
.gt-app .gt-elo-authenticated .gt-elo-status.is-success { background: color-mix(in srgb, #21b485 14%, var(--sh-card)); }
.gt-app .gt-elo-authenticated .gt-elo-status.is-error { background: color-mix(in srgb, #ff626d 14%, var(--sh-card)); }
.gt-app .gt-elo-authenticated .gt-elo-status.is-info { background: color-mix(in srgb, var(--gt-elo-violet) 12%, var(--sh-card)); }

/* Keyboard open: the map keeps its room */
.gt-app.gtm-kb-open .gt-elo-authenticated #elo-rank-card { display: none; }
.gt-app.gtm-kb-open .gt-elo-authenticated .gt-elo-heading h1 { overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.gt-app.gtm-kb-open .gt-elo-authenticated #elo-mission-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

/* ------------------------------------------------------------ "⋯" sheet: New session + quota */
.gt-app #elo-more { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.gt-app #elo-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; }
.gt-app #elo-more > .gt-elo-reset-quota { padding: 0 4px; color: var(--sh-muted); font-size: .8rem; }
.gt-app .gt-elo-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.gt-app .gt-elo-sheet-head small { display: block; color: color-mix(in srgb, var(--gt-elo-cyan) 74%, var(--sh-text)); font-size: .69rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.gt-app .gt-elo-sheet-head strong { display: block; font-size: 1.1rem; font-weight: 800; }

/* ------------------------------------------------------------ tablet: map left, panel right */
@media (min-width: 900px) {
  .gt-app .gt-elo-authenticated .gt-elo-frame {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    column-gap: 16px;
    padding: 16px var(--gtm-gutter, 32px) 24px;
  }
  .gt-app .gt-elo-authenticated .gt-elo-frame::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 .gt-elo-authenticated #elo-game,
  .gt-app .gt-elo-authenticated .gt-elo-play-grid { display: contents; }
  .gt-app .gt-elo-authenticated .gt-elo-map-panel { grid-column: 1; grid-row: 1 / -1; border: 1px solid var(--sh-border-soft); border-radius: 22px; overflow: hidden; }
  .gt-app .gt-elo-authenticated .gt-elo-map-topline { right: 12px; left: auto; } /* the zoom buttons are top left */
  .gt-app .gt-elo-authenticated .gt-elo-heading { grid-column: 2; grid-row: 1; padding: 20px 20px 12px; border: 0; }
  .gt-app .gt-elo-authenticated .gt-elo-heading h1 { font-size: 1.55rem; }
  .gt-app .gt-elo-authenticated #elo-rank-card { grid-column: 2; grid-row: 2; margin: 0 20px; padding: 12px 14px; border: 1px solid rgba(var(--gt-geo-rank-rgb), .35); border-radius: 16px; }
  .gt-app .gt-elo-authenticated .gt-elo-mission-panel { grid-column: 2; grid-row: 3; padding: 14px 20px 18px; border: 0; background: transparent; }
  .gt-app .gt-elo-authenticated .gt-elo-mission-panel::before { display: none; }
  .gt-app .gt-elo-authenticated .gt-elo-status { position: static; margin-top: 10px; box-shadow: none; }
  .gt-app .gt-elo-authenticated .gt-elo-more-btn,
  .gt-app .gt-elo-sheet-head { display: none; }
  /* The sheet is shown inline in the panel on tablets. */
  .gt-app .gt-elo-authenticated #elo-game #elo-more.gtm-modesheet {
    position: static !important;
    width: auto !important;
    max-height: none;
    margin: 10px 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 .gt-elo-authenticated #elo-game #elo-more.gtm-modesheet::before { display: none; }
  .gt-app .gt-elo-authenticated #elo-more { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .gt-app .gt-elo-authenticated #elo-more > .btn { width: auto; min-height: 44px; }
}
