/* Shared FQRS shell — same top position on recharge / wallet / own / (later hungry) */
:root {
  /* Match Hungry game column inset (~8px) on every screen */
  --fqrs-side: 8px;
}
.fqrs-shell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.fqrs-shell-top.is-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  margin-bottom: 0;
  padding: max(10px, env(safe-area-inset-top, 0px))
    max(var(--fqrs-side), env(safe-area-inset-right, 0px) + var(--fqrs-side))
    10px
    max(var(--fqrs-side), env(safe-area-inset-left, 0px) + var(--fqrs-side));
  box-sizing: border-box;
  /* Solid through the button row so flow titles never paint under the menu. */
  background: #0a1018;
}
/* Android WebView already pads the status bar in MainActivity — don't stack safe-area again.
   Keep 10px gap above/below the ☰ button. */
html.is-android-app .fqrs-shell-top.is-fixed {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}
/* Flow pages (wallet/tx/…) — keep h1 below fixed menu + status bar.
   Must beat Hungry/OWN `html.is-android-app body{padding:0!important}` left in <head> after soft-nav.
   Keep this floor tight — JS fitFixed sets the exact value. */
html body.fqrs-flow-pad,
html.is-android-app body.fqrs-flow-pad {
  /* Reset Hungry centered-flex WITHOUT breaking Support's column flex chat */
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  padding-top: calc(max(6px, env(safe-area-inset-top, 0px)) + 48px) !important;
  /* Side inset — Wallet/Tx (.shell) AND Dev Fee (no .shell) */
  padding-left: var(--fqrs-side) !important;
  padding-right: var(--fqrs-side) !important;
}
/* Shell fills padded body. Do NOT force display:block — Support .shell is flex column */
html body.fqrs-flow-pad .shell,
html.is-android-app body.fqrs-flow-pad .shell {
  width: 100% !important;
  max-width: 420px;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
  align-self: stretch !important;
  flex: 1 1 auto;
  min-height: 0;
}
/* Sticky buy/redeem docks — same inset as Hungry */
html body.fqrs-flow-pad .dock,
html.is-android-app body.fqrs-flow-pad .dock {
  left: var(--fqrs-side) !important;
  right: var(--fqrs-side) !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box;
}
/* Hungry / OWN — body often forces padding:0; inset the game column instead */
html.is-android-app #game-wrapper {
  padding-left: max(var(--fqrs-side), env(safe-area-inset-left, 0px)) !important;
  padding-right: max(var(--fqrs-side), env(safe-area-inset-right, 0px)) !important;
  box-sizing: border-box;
}
@media (max-width: 480px) {
  #game-wrapper {
    padding-left: max(var(--fqrs-side), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--fqrs-side), env(safe-area-inset-right, 0px)) !important;
    box-sizing: border-box;
  }
}
.fqrs-nav-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(158, 197, 232, 0.18);
  background: rgba(18, 26, 40, 0.9);
  color: #9ec5e8;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
}
.fqrs-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  font: 700 10px/1 system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
}
.fqrs-nav-badge[hidden] { display: none !important; }
.fqrs-nav-badge.is-menu {
  position: absolute;
  top: -5px;
  right: -5px;
  box-shadow: 0 0 0 2px #0a1018;
  z-index: 2;
}
.fqrs-nav-btn.has-badge {
  border-color: rgba(229, 57, 53, 0.55);
}
.fqrs-nav-btn:active {
  border-color: rgba(158, 197, 232, 0.45);
  background: rgba(26, 40, 60, 0.95);
}
.fqrs-nav-lines {
  width: 18px;
  height: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.fqrs-nav-lines i {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.fqrs-help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(158, 197, 232, 0.35);
  background: rgba(18, 26, 40, 0.9);
  color: #b7d3ea;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
}
.fqrs-help-btn:active {
  border-color: #8eb6d4;
  color: #fff;
}

.fqrs-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(6, 10, 18, 0.62);
  display: none;
}
.fqrs-nav-overlay.show { display: block; }
.fqrs-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10051;
  width: min(300px, 86vw);
  background: linear-gradient(180deg, #1c2c44 0%, #101a2a 100%);
  border-right: 1px solid rgba(158, 197, 232, 0.22);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
  transform: translateX(-105%);
  transition: transform .22s ease;
  padding: 18px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}
.fqrs-nav-drawer.show { transform: translateX(0); }
.fqrs-nav-drawer .fqrs-nav-title {
  margin: 2px 4px 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ec5e8;
}
.fqrs-nav-drawer a.fqrs-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #e8eef6;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 650;
}
.fqrs-nav-drawer a.fqrs-nav-link .fqrs-nav-link-label { flex: 1 1 auto; min-width: 0; }
.fqrs-nav-drawer a.fqrs-nav-link.has-sub {
  align-items: flex-start;
  padding-top: 10px;
  padding-bottom: 10px;
}
.fqrs-nav-drawer a.fqrs-nav-link.has-sub .dot { margin-top: 6px; }
.fqrs-nav-drawer a.fqrs-nav-link.has-sub .fqrs-nav-link-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}
.fqrs-nav-drawer a.fqrs-nav-link.has-sub .fqrs-nav-link-label strong {
  font-weight: 700;
  font-size: 15px;
}
.fqrs-nav-drawer a.fqrs-nav-link.has-sub .fqrs-nav-link-label small {
  font-size: 11px;
  font-weight: 600;
  color: rgba(183, 211, 234, 0.78);
  letter-spacing: 0.01em;
}
.fqrs-nav-drawer a.fqrs-nav-link.has-sub.on .fqrs-nav-link-label small {
  color: rgba(232, 242, 250, 0.78);
}
.fqrs-nav-drawer a.fqrs-nav-link .fqrs-nav-badge { margin-left: auto; flex: 0 0 auto; }
.fqrs-nav-drawer a.fqrs-nav-link:active,
.fqrs-nav-drawer a.fqrs-nav-link:hover {
  background: rgba(107, 159, 212, 0.14);
  border-color: rgba(158, 197, 232, 0.2);
}
.fqrs-nav-drawer a.fqrs-nav-link.on {
  background: rgba(107, 159, 212, 0.2);
  border-color: rgba(158, 197, 232, 0.35);
  color: #e8f2fa;
}
.fqrs-nav-drawer a.fqrs-nav-link .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ec5e8;
  opacity: 0.7;
  flex-shrink: 0;
}
.fqrs-nav-drawer a.fqrs-nav-link.on .dot {
  background: #ffd56a;
  opacity: 1;
}
/* OWN Game — only text color + blinking start dot */
.fqrs-nav-drawer a.fqrs-nav-link.is-own {
  color: #ffd56a;
  font-weight: 700;
}
.fqrs-nav-drawer a.fqrs-nav-link.is-own.on {
  color: #ffe9a8;
}
.fqrs-nav-drawer a.fqrs-nav-link.is-own .dot {
  background: #ffd56a;
  opacity: 1;
  animation: fqrs-own-dot-blink 1.1s ease-in-out infinite;
}
.fqrs-nav-drawer a.fqrs-nav-link.is-support .dot {
  background: #6b9fd4;
  opacity: 1;
}
@keyframes fqrs-own-dot-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(0.75); }
}
/* Terms always sits just above Account; line is the foot border. */
.fqrs-nav-drawer .fqrs-nav-tail {
  margin-top: auto;
  padding-top: 6px;
  flex: 0 0 auto;
}
.fqrs-nav-drawer .fqrs-nav-foot {
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(158, 197, 232, 0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fqrs-nav-drawer .fqrs-nav-foot-label {
  margin: 0 4px 2px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(158, 197, 232, 0.72);
}
.fqrs-nav-drawer .fqrs-nav-action,
.fqrs-nav-drawer a.fqrs-tg-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(158, 197, 232, 0.16);
  background: rgba(12, 20, 32, 0.72);
  color: #e8eef6;
  font-size: 14px;
  font-weight: 650;
  font-family: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.fqrs-nav-drawer .fqrs-nav-action:active,
.fqrs-nav-drawer a.fqrs-tg-link:active,
.fqrs-nav-drawer a.fqrs-tg-link:hover {
  background: rgba(107, 159, 212, 0.14);
  border-color: rgba(158, 197, 232, 0.28);
}
.fqrs-nav-drawer .fqrs-nav-ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(107, 159, 212, 0.16);
  border: 1px solid rgba(158, 197, 232, 0.18);
  color: #9ec5e8;
}
.fqrs-nav-drawer .fqrs-nav-ico svg {
  width: 16px;
  height: 16px;
  display: block;
}
.fqrs-nav-drawer .fqrs-nav-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fqrs-nav-drawer .fqrs-nav-action-text strong {
  font-size: 14px;
  font-weight: 700;
  color: #e8f2fa;
  line-height: 1.15;
}
.fqrs-nav-drawer .fqrs-nav-action-text span {
  font-size: 11px;
  font-weight: 500;
  color: #8a9db2;
  line-height: 1.2;
}
.fqrs-nav-drawer .fqrs-nav-update {
  display: block;
  margin: 0 4px 2px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  line-height: 1.35;
  white-space: nowrap;
  cursor: default;
}
.fqrs-nav-drawer .fqrs-nav-update[hidden] { display: none !important; }
.fqrs-nav-drawer .fqrs-nav-update.is-old { color: #ff6b78; }
.fqrs-nav-drawer .fqrs-nav-update.is-latest { color: #5ddea0; }
.fqrs-nav-drawer .fqrs-nav-action.is-logout .fqrs-nav-ico {
  background: rgba(232, 140, 148, 0.12);
  border-color: rgba(232, 140, 148, 0.28);
  color: #e88c94;
}
.fqrs-nav-drawer a.fqrs-tg-link .fqrs-nav-ico {
  background: rgba(34, 158, 217, 0.2);
  border-color: rgba(42, 171, 238, 0.4);
  color: #7fd0ff;
}
.fqrs-nav-drawer a.fqrs-tg-link.is-update {
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(225, 29, 72, 0.14);
}
.fqrs-nav-drawer a.fqrs-tg-link.is-update .fqrs-nav-ico {
  background: rgba(225, 29, 72, 0.22);
  border-color: rgba(251, 113, 133, 0.45);
  color: #ffb4c0;
}
.fqrs-nav-drawer a.fqrs-tg-link.is-update strong {
  color: #ffe4ea;
}
.fqrs-nav-drawer .fqrs-nav-version {
  margin-top: 2px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #7e93a8;
  white-space: pre-line;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(10, 16, 24, 0.55);
  border: 1px solid rgba(158, 197, 232, 0.1);
}

html:not(.has-auth-session) #fqrs-top-bar,
html:not(.has-auth-session) #fqrs-help-btn,
html:not(.has-auth-session) #fqrs-nav-drawer,
html:not(.has-auth-session) #fqrs-nav-overlay {
  display: none !important;
}

/* Phase 1: instant shell paint while APIs load (HTML/CSS only; no soft-nav) */
.fqrs-skel {
  display: inline-block;
  min-width: 3.2em;
  height: 0.85em;
  border-radius: 6px;
  vertical-align: -0.05em;
  color: transparent !important;
  background: linear-gradient(
    90deg,
    rgba(158, 197, 232, 0.1) 0%,
    rgba(158, 197, 232, 0.28) 45%,
    rgba(158, 197, 232, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: fqrs-skel 1.15s ease-in-out infinite;
}
.fqrs-skel.is-lg {
  min-width: 4.5em;
  height: 1.15em;
  border-radius: 8px;
}
.fqrs-skel-row {
  display: block;
  height: 56px;
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(158, 197, 232, 0.1);
  background: linear-gradient(
    90deg,
    rgba(18, 26, 40, 0.55) 0%,
    rgba(40, 56, 78, 0.65) 45%,
    rgba(18, 26, 40, 0.55) 100%
  );
  background-size: 200% 100%;
  animation: fqrs-skel 1.15s ease-in-out infinite;
}
@keyframes fqrs-skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Soft-nav progress — only used on wallet↔transactions step */
.fqrs-soft-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 100000;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, #9ec5e8, #ffd56a, #9ec5e8);
  background-size: 200% 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: opacity 0.15s ease;
}
.fqrs-soft-bar.show {
  opacity: 1;
  animation: fqrs-soft-bar 0.9s linear infinite;
}
@keyframes fqrs-soft-bar {
  0% { transform: scaleX(0.15); background-position: 0% 0; }
  50% { transform: scaleX(0.7); background-position: 100% 0; }
  100% { transform: scaleX(0.25); background-position: 0% 0; }
}
