/* Shared by React headers and same-origin game frames. */
.fq-premium-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid currentColor;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  white-space: nowrap;
  pointer-events: auto;
  transition: background 150ms;
}
.fq-premium-link:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.fq-premium-link:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.fq-premium-on-image { color: #fff; background: #152034a6; border-color: #ffffff70; }
.fq-premium-on-image:hover { background: #152034e6; }
.fq-header-actions { display: flex; flex-shrink: 0; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.fq-header-row > .fq-header-actions { grid-column: 3; }
.fq-header-actions > a[href="/profile"] { flex-shrink: 0; }
/* Shared frame documents must honor the same web-checkout hiding rule. */
html[data-platform^="capacitor-"] .fq-premium-link[data-cap-hide] { display: none; }
.fq-premium-slot { display: flex; align-items: center; }
@media (pointer: coarse) { .fq-premium-link { min-height: 44px; } }
/* Keep all controls visible on phones and small tablets: navigation + upgrade on row one,
   the game title below. The homepage reserves this shape before entitlement
   loads, so its wordmark cannot jump when the upgrade link appears. */
@media (max-width: 767px) {
  .fq-premium-link { padding-inline: 8px; }
  :where(html:not([data-platform^="capacitor-"])) .fq-header-row.fq-header-row:is(.fq-home-header, :has(.fq-premium-link)) { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 8px; align-items: center; }
  :where(html:not([data-platform^="capacitor-"])) .fq-header-row.fq-header-row:is(.fq-home-header, :has(.fq-premium-link)) > :nth-child(1) { grid-row: 1; grid-column: 1; }
  :where(html:not([data-platform^="capacitor-"])) .fq-header-row.fq-header-row:is(.fq-home-header, :has(.fq-premium-link)) > :nth-child(2) { grid-row: 2; grid-column: 1 / -1; justify-self: center; text-align: center; position: static; transform: none; }
  :where(html:not([data-platform^="capacitor-"])) .fq-header-row.fq-header-row:is(.fq-home-header, :has(.fq-premium-link)) > :nth-child(3) { grid-row: 1; grid-column: 2; }
  :where(html:not([data-platform^="capacitor-"])) .fq-header-row.fq-header-row:is(.fq-home-header, :has(.fq-premium-link)) > :nth-child(2) p { position: relative; left: 50%; top: auto; transform: translateX(-50%); translate: none; width: max-content; max-width: calc(100vw - 32px); margin-top: 4px; }
  header:has(> .fq-home-header, > .fq-header-row .fq-premium-link) { padding-bottom: 8px; }
}

/* Help + upgrade + profile need their own row on narrow screens. Preserve
   every hit target instead of squeezing several controls into one icon slot. */
@media (max-width: 399px) {
  :where(html:not([data-platform^="capacitor-"])) .game-nav-row.fq-header-row:has(.game-nav-actions > :nth-child(2)):has(.fq-premium-link) {
    grid-template-columns: max-content minmax(0, 1fr);
  }
  :where(html:not([data-platform^="capacitor-"])) .game-nav-row.fq-header-row:has(.game-nav-actions > :nth-child(2)):has(.fq-premium-link) > :nth-child(2) {
    grid-row: 1; grid-column: 2; justify-self: stretch;
  }
  :where(html:not([data-platform^="capacitor-"])) .game-nav-row.fq-header-row:has(.game-nav-actions > :nth-child(2)):has(.fq-premium-link) > .game-nav-actions {
    grid-row: 2; grid-column: 1 / -1;
  }
}

/* AirportQ's counters are a separate overlay below the account controls. */
[data-game-navigation="airportq-game"] .header-actions { top: calc(var(--game-nav-top) + 48px); }
@media (max-width: 900px) {
  [data-game-navigation="airportq-game"] .header-actions { top: var(--game-nav-top); left: var(--game-nav-edge); right: var(--game-nav-edge); }
}
@media (max-width: 767px) {
  :where(html:not([data-platform^="capacitor-"])) [data-game-navigation="airportq-game"]:has(.fq-premium-link) .status-strip { top: 84px; }
  :where(html:not([data-platform^="capacitor-"])) [data-game-navigation="airportq-game"]:has(.fq-premium-link) .daily-games-switcher { top: calc(var(--game-nav-top) + 130px); }
  :where(html:not([data-platform^="capacitor-"])) [data-game-navigation="airportq-game"]:has(.fq-premium-link) .map-toast { top: calc(var(--game-nav-top) + 162px); }
  :where(html:not([data-platform^="capacitor-"])) [data-game-navigation="railpass-game"] #topbar.fq-header-row.fq-header-row:has(.fq-premium-link) { grid-template-columns: minmax(0,1fr) auto; }
}
@media (max-width: 767px) {
  :where(html:not([data-platform^="capacitor-"])) [data-game-navigation="railpass-game"]:has(.fq-premium-link) #topsheet { top: calc(var(--game-nav-top) + 80px); }
}
