/* ── Bottom Mobile Navigation ─────────────────────────── */
/* Only visible on mobile (≤620px) */

.btm-nav {
  display: none;
}
.btm-extra-popup-backdrop {
  display: none;
}
.btm-extra-popup {
  display: none;
}
.btm-profile-modal {
  display: none;
}
.topbar-missions-btn {
  display: none;
}

.alex-world-hints-fab {
  position: fixed;
  right: 20px;
  left: auto;
  bottom: 84px;
  z-index: 2147483008;
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #3b1a00;
  background: radial-gradient(circle at 30% 30%, #ff8a00, #ff5b00 58%, #facc15 100%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .35), 0 0 0 6px rgba(250, 204, 21, .16);
  transition: transform .18s ease, box-shadow .18s ease;
  -webkit-tap-highlight-color: transparent;
}

html[dir="rtl"] .alex-world-hints-fab {
  right: 20px;
  left: auto;
}

html[dir="ltr"] .alex-world-hints-fab,
html:not([dir]) .alex-world-hints-fab {
  right: 20px;
  left: auto;
}

.alex-world-hints-fab:hover,
.alex-world-hints-fab:focus-visible {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 18px 36px rgba(0, 0, 0, .42), 0 0 0 8px rgba(250, 204, 21, .18);
  outline: none;
}

.alex-world-hints-fab-icon {
  position: relative;
  z-index: 1;
  font-size: 28px;
  line-height: 1;
}

.alex-world-hints-fab-ring {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid rgba(255, 230, 120, .6);
  animation: alexHintsPulse 1.9s ease-out infinite;
}

@keyframes alexHintsPulse {
  0% {
    opacity: .9;
    transform: scale(.92);
  }
  70% {
    opacity: 0;
    transform: scale(1.22);
  }
  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

.alex-world-hints-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483012;
  display: none;
}

.alex-world-hints-modal.is-open {
  display: block;
}

.alex-world-hints-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 22, .72);
  backdrop-filter: blur(8px);
}

.alex-world-hints-panel {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 32px));
  max-height: min(86vh, 860px);
  margin: 4vh auto;
  overflow: auto;
  border-radius: 28px;
  border: 1px solid rgba(123, 173, 255, .22);
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(52, 214, 255, .14), transparent 70%),
    radial-gradient(520px 260px at 0% 100%, rgba(255, 165, 0, .12), transparent 72%),
    linear-gradient(165deg, rgba(11, 24, 49, .98), rgba(8, 20, 40, .98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, .48);
  padding: 22px;
}

.alex-world-hints-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -22px -22px 18px;
  padding: 22px 22px 14px;
  background:
    linear-gradient(180deg, rgba(11, 24, 49, .99), rgba(11, 24, 49, .96) 78%, rgba(11, 24, 49, .82));
  border-bottom: 1px solid rgba(123, 173, 255, .16);
  backdrop-filter: blur(10px);
}

.alex-world-hints-copy {
  max-width: 720px;
}

.alex-world-hints-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(250, 204, 21, .12);
  border: 1px solid rgba(250, 204, 21, .18);
  color: #ffd86b;
  font-size: 12px;
  font-weight: 700;
}

.alex-world-hints-title {
  margin: 10px 0 8px;
  font-size: clamp(1.55rem, 2.6vw, 2.25rem);
  line-height: 1.15;
  color: var(--ink);
}

.alex-world-hints-lead {
  margin: 0;
  font-size: .98rem;
  line-height: 1.75;
  color: var(--muted);
}

.alex-world-hints-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(123, 173, 255, .18);
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.alex-world-hints-close:hover,
.alex-world-hints-close:focus-visible {
  background: rgba(123, 173, 255, .12);
  outline: none;
}

.alex-world-hints-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.alex-world-hints-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(123, 173, 255, .16);
  background: linear-gradient(180deg, rgba(18, 39, 80, .78), rgba(11, 24, 49, .82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.alex-world-hints-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alex-world-hints-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, .07);
  font-size: 28px;
}

.alex-world-hints-card-copy {
  min-width: 0;
}

.alex-world-hints-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 214, 255, .1);
  border: 1px solid rgba(52, 214, 255, .16);
  color: #93efff;
  font-size: 11px;
  font-weight: 700;
}

.alex-world-hints-card-title {
  margin: 8px 0 0;
  font-size: 1.1rem;
  line-height: 1.45;
  color: var(--ink);
}

.alex-world-hints-card-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.alex-world-hints-steps {
  margin: 0;
  padding-inline-start: 20px;
  color: #d9e9ff;
  line-height: 1.8;
}

.alex-world-hints-steps li + li {
  margin-top: 4px;
}

.alex-world-hints-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
}

.alex-world-hints-link:hover,
.alex-world-hints-link:focus-visible {
  filter: brightness(1.06);
  outline: none;
}

body.alex-world-hints-open {
  overflow: hidden;
}

[data-theme="light"] .alex-world-hints-fab {
  color: #5c2a00;
  box-shadow: 0 14px 26px rgba(240, 169, 0, .28), 0 0 0 6px rgba(250, 204, 21, .2);
}

[data-theme="light"] .alex-world-hints-panel {
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(52, 214, 255, .1), transparent 70%),
    radial-gradient(520px 260px at 0% 100%, rgba(255, 165, 0, .08), transparent 72%),
    linear-gradient(165deg, rgba(252, 253, 255, .98), rgba(241, 246, 255, .98));
  border-color: rgba(91, 141, 227, .18);
}

[data-theme="light"] .alex-world-hints-kicker {
  color: #8a5a00;
  background: rgba(250, 204, 21, .18);
}

[data-theme="light"] .alex-world-hints-title,
[data-theme="light"] .alex-world-hints-card-title {
  color: #10223f;
}

[data-theme="light"] .alex-world-hints-lead,
[data-theme="light"] .alex-world-hints-card-desc {
  color: #51637f;
}

[data-theme="light"] .alex-world-hints-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(240, 246, 255, .96));
  border-color: rgba(91, 141, 227, .14);
}

[data-theme="light"] .alex-world-hints-steps {
  color: #243754;
}

:root {
  --mobile-bottom-nav-height: 0px;
  --mobile-bottom-nav-content-offset: 0px;
  --mobile-bottom-nav-menu-offset: 0px;
  --mobile-bottom-nav-overlay-offset: 24px;
}

@media (max-width: 620px) {
  :root {
    --mobile-bottom-nav-height: calc(64px + env(safe-area-inset-bottom, 0px));
    --mobile-bottom-nav-content-offset: calc(var(--mobile-bottom-nav-height) + 4px);
    --mobile-bottom-nav-menu-offset: calc(var(--mobile-bottom-nav-height) + 4px);
    --mobile-bottom-nav-overlay-offset: calc(var(--mobile-bottom-nav-height) + 14px);
  }

  .alex-world-hints-fab {
    bottom: calc(var(--mobile-bottom-nav-height) + 18px);
    right: 12px;
    left: auto;
    width: 58px;
    height: 58px;
  }

  html[dir="rtl"] .alex-world-hints-fab {
    right: 12px;
    left: auto;
  }

  html[dir="ltr"] .alex-world-hints-fab,
  html:not([dir]) .alex-world-hints-fab {
    right: 12px;
    left: auto;
  }

  .alex-world-hints-panel {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 20px);
    margin: 10px auto;
    padding: 16px;
    border-radius: 22px;
  }

  .alex-world-hints-head {
    gap: 12px;
    margin: -16px -16px 14px;
    padding: 16px 16px 12px;
  }

  .alex-world-hints-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .alex-world-hints-card {
    padding: 16px;
    border-radius: 18px;
  }

  /* reserve space so content doesn't hide behind the bar */
  body.game-page { padding-bottom: var(--mobile-bottom-nav-content-offset); }

  .btm-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2147483005;
    height: 64px;
    background: rgba(6, 14, 31, .96);
    border-top: 1px solid var(--line);
    justify-content: space-around;
    align-items: stretch;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .btm-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 2px;
    background: none;
    border: none;
    color: var(--muted);
    text-decoration: none;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    padding: 6px 2px 4px;
    cursor: pointer;
    position: relative;
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.2;
  }
  .btm-nav-item:hover,
  .btm-nav-item:focus-visible {
    color: var(--cyan);
    outline: none;
  }
  .btm-nav-item.is-active {
    color: var(--cyan);
  }
  .btm-nav-item.is-active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2.5px;
    border-radius: 0 0 3px 3px;
    background: var(--cyan);
  }

  .btm-nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
  }
  .btm-nav-icon i.fa-solid {
    font-size: 20px;
  }
  .btm-nav-item.is-active .btm-nav-icon i.fa-solid {
    filter: drop-shadow(0 0 4px currentColor);
  }
  .btm-nav-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: grayscale(.4) brightness(1.2);
  }
  .btm-nav-item.is-active .btm-nav-icon img,
  .btm-nav-item:hover .btm-nav-icon img {
    filter: none;
  }
  .btm-nav-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
  }

  .btm-nav-label {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 64px;
  }

  /* ── Extra popup menu ──────────────────────────────── */
  .btm-extra-popup {
    display: none;
    position: fixed;
    bottom: var(--mobile-bottom-nav-menu-offset);
    z-index: 2147483006;
    width: 220px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 -8px 30px rgba(0,0,0,.5);
    padding: 8px 0;
    margin-bottom: env(safe-area-inset-bottom, 0);
  }
  /* RTL: popup on left side */
  html[dir="rtl"] .btm-extra-popup {
    left: 8px;
    right: auto;
    border-radius: 14px 14px 14px 4px;
  }
  /* LTR: popup on right side */
  html[dir="ltr"] .btm-extra-popup,
  html:not([dir]) .btm-extra-popup {
    right: 8px;
    left: auto;
    border-radius: 14px 14px 4px 14px;
  }
  .btm-extra-popup.is-open {
    display: block;
    animation: btmPopIn .18s ease-out;
  }
  @keyframes btmPopIn {
    from { opacity: 0; transform: translateY(12px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  .btm-extra-popup-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483005;
    background: transparent;
  }
  .btm-extra-popup-backdrop.is-open {
    display: block;
  }

  .btm-extra-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .12s;
  }
  .btm-extra-item:hover,
  .btm-extra-item:focus-visible {
    background: rgba(52,214,255,.08);
    outline: none;
  }
  .btm-extra-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }
  .btm-extra-icon i.fa-solid {
    font-size: 16px;
  }
  .btm-extra-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .btm-extra-text strong {
    font-size: 13px;
    font-weight: 600;
  }
  .btm-extra-text small {
    font-size: 11px;
    color: var(--muted);
  }
  .btm-extra-sep {
    height: 1px;
    background: var(--line);
    margin: 4px 12px;
  }
  /* Profile item at bottom of extra menu */
  .btm-extra-profile {
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 8px;
  }
  .btm-extra-profile .btm-extra-item {
    font-weight: 600;
  }
  .btm-extra-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
  }

  /* ── Missions badge inside extra popup item ─────── */
  .btm-extra-badge {
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #e53935;
    border-radius: 9px;
    padding: 0 5px;
    margin-inline-start: auto;
    flex-shrink: 0;
  }
  .btm-extra-badge[data-count="0"],
  .btm-extra-badge:empty {
    display: none;
  }

  /* ── Missions badge on extra ───────────────────────── */
  .btm-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #e53935;
    border-radius: 50%;
    padding: 0 3px;
  }
  .btm-nav-badge:empty,
  .btm-nav-badge[data-count="0"] {
    display: none;
  }

  /* ── Profile modal (iframe overlay) ────────────────── */
  .btm-profile-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483010;
  }
  .btm-profile-modal.is-open {
    display: flex;
    flex-direction: column;
  }
  .btm-profile-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
  }
  .btm-profile-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding-top: env(safe-area-inset-top, 0);
  }
  .btm-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(6, 14, 31, .96);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
  }
  .btm-profile-header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
  }
  .btm-profile-close {
    background: none;
    border: none;
    color: var(--ink);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
  }
  .btm-profile-close:hover {
    background: rgba(255,255,255,.1);
  }
  .btm-profile-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: var(--bg-0);
  }

  /* ── Move missions FAB when bottom nav is present ──── */
  .msn-fab {
    bottom: var(--mobile-bottom-nav-overlay-offset) !important;
  }

  /* ── Light theme overrides ─────────────────────────── */
  [data-theme="light"] .btm-nav {
    background: rgba(245, 247, 252, .96);
    border-top-color: rgba(0,0,0,.1);
  }
  [data-theme="light"] .btm-nav-item { color: #777; }
  [data-theme="light"] .btm-nav-item.is-active { color: #2563eb; }
  [data-theme="light"] .btm-nav-item.is-active::after { background: #2563eb; }
  [data-theme="light"] .btm-extra-popup {
    background: #fff;
    border-color: rgba(0,0,0,.1);
    box-shadow: 0 -8px 30px rgba(0,0,0,.15);
  }
  [data-theme="light"] .btm-extra-item { color: #222; }
  [data-theme="light"] .btm-extra-item:hover { background: rgba(37,99,235,.06); }
  [data-theme="light"] .btm-extra-text small { color: #888; }
  [data-theme="light"] .btm-profile-header { background: rgba(245,247,252,.96); }
  [data-theme="light"] .btm-profile-header-title { color: #222; }
  [data-theme="light"] .btm-profile-close { color: #222; }

  /* ── Topbar missions button (replaces hamburger) ───── */
  .topbar-missions-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 14px;
    border: 1px solid rgba(123,169,240,.45);
    background: rgba(9,22,45,.56);
    box-shadow: 0 0 0 1px rgba(126,211,255,.18);
    flex: 0 0 54px;
    order: 2;
    position: relative;
    z-index: var(--mobile-nav-toggle-z);
    cursor: pointer;
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .topbar-missions-btn:hover {
    background: rgba(52,214,255,.15);
  }
  .topbar-missions-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #e53935;
    border-radius: 50%;
    padding: 0 4px;
    pointer-events: none;
  }
  html[dir="rtl"] .topbar-missions-badge {
    right: auto;
    left: 6px;
  }
  .topbar-missions-badge:empty,
  .topbar-missions-badge[data-count="0"] {
    display: none;
  }
  /* Hide hamburger toggle on mobile, show missions btn */
  .top-nav-toggle[data-mobile-drawer] {
    display: none !important;
  }
  [data-theme="light"] .topbar-missions-btn {
    background: rgba(255,255,255,.7);
    border-color: rgba(0,0,0,.1);
    color: #222;
  }
}
