/* Bottom navigation (G8L-211 P1-C, restyled P1-I). Five keys on every width: 掛機, 世界樹, 大廳, 裝備, 道具. On a phone the
 * keys float over the page with no bar panel (NIKKE lobby look); the pages left out are reached from the 角色 sheet, the side rail and the top bar's system menu (更多 is retired, P1-B). */
#game .nav-ico { display: none; }
body.nav-sheet-mode #game .tabs > button:not(.nav-primary) { display: none !important; }

@media (max-width: 720px) {
  body.nav-sheet-mode #game { padding-bottom: var(--bottom-reserve) !important; }
  /* G8L-243: the bar would cover the chat input above the on-screen keyboard. */
  body.nav-sheet-mode.chat-typing #game .tabs { display: none !important; }
}

/* From 721px the page's own nav strip sits under the top bar (about 27px tall, 10px below it): lobby keys on the left and right start below it (--nav-strip-h). */
:root { --nav-strip-h: 0px; }
@media (min-width: 721px) { :root { --nav-strip-h: 37px; } }

/* Phone bar (P1-I): five keys over the page, a 5px bottom edge (--bottom-edge, like the top bar; no Home-indicator inset) below them. The container ignores taps; only the keys take them.
 * First/last key centres are 24.6px + half a key in from the edge on a 393px screen (6.25vw side padding). Only the ::after gradient darkens the
 * page bottom so the labels stay readable. The key look itself is the shared block below. */
body.nav-float #game .tabs {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 0;
  position: fixed;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 20 !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 max(6.25vw, env(safe-area-inset-right)) calc(var(--bottom-edge) - 2px) max(6.25vw, env(safe-area-inset-left)) !important;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
  font-family: -apple-system, 'SF Pro Text', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
}
body.nav-float #game .tabs::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100% + 28px);
  z-index: -1;
  pointer-events: none;
  background: none;
}
/* The key look, one rule set (P1-I NIKKE look, r3c shared): the five bottom keys on a phone AND every lobby key (right rail 拍賣場/組隊/排行榜,
 * left 眾神殿/隱藏) are this. No panel behind them (no background, border, radius or shadow); hit area 64px tall (the selected line on its top
 * edge), icon 38px, label 13px bold, colours/shadows below. Lobby keys carry class ui-key; the bottom keys are the .tabs buttons. The icon is a
 * paired outline/solid drawing (ui-icons.js); the lobby keys show the solid drawing as a glass silhouette (below), white while current / pressed. */
body.nav-float #game .tabs > button,
#game .ui-key {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  height: 64px;
  min-height: 64px;
  box-sizing: border-box;
  padding: 4px 0 2px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  color: #d6d9df !important;
  font-weight: 700 !important;
  /* No outline and no haze behind the label: light grey bold, a faint 1px shadow only (readable on light art). */
  text-shadow: 0 0 1px rgb(0 0 0 / 75%), 0 1px 1px rgb(0 0 0 / 60%) !important;
  pointer-events: auto;
  cursor: pointer;
  transition: color 0.25s ease, transform 0.15s ease;
}
#game .ui-key { width: 64px; font-family: -apple-system, 'SF Pro Text', 'PingFang TC', 'Microsoft JhengHei', sans-serif; }
body.nav-float #game .tabs > button:active, #game .ui-key:active { transform: scale(0.94); }
body.nav-float #game .tabs .nav-ico, #game .ui-key .nav-ico { display: grid; place-items: center; }
body.nav-float #game .tabs .nav-ico > *, #game .ui-key .nav-ico > * { grid-area: 1 / 1; }
body.nav-float #game .tabs .nav-ico svg, #game .ui-key .nav-ico svg { width: 38px; height: 38px; overflow: visible; filter: drop-shadow(0 0 1px rgb(0 0 0 / 55%)) drop-shadow(0 1px 1px rgb(0 0 0 / 40%)); }
/* Glass icon (r4 lobby-glass, NIKKE bottom keys): a solid silhouette (the .ico-f drawing, details cut out), white about 75%, lighter on top than at the
 * bottom (#uiGlassSolidA, index.html). No backdrop-filter layer sits behind the glyph: WebKit must never tint its rectangular box.
 * The current key / pressed key is solid white. */
body.nav-float #game .tabs .nav-ico .ui-ico .ico-r, #game .ui-key .nav-ico .ui-ico .ico-r { display: none; }
body.nav-float #game .tabs .nav-ico .ui-ico .ico-f, #game .ui-key .nav-ico .ui-ico .ico-f { display: inline; fill: url(#uiGlassSolidA); }
body.nav-float #game .tabs > button.ui-swap:is(.active, [aria-selected='true'], [aria-current='page'], :active) .nav-ico .ui-ico .ico-f,
#game .ui-key.ui-swap:is(.is-on, [aria-pressed='true'], [aria-expanded='true'], :active) .nav-ico .ui-ico .ico-f { fill: #fff; }
body.nav-float #game .tabs .nav-lbl, #game .ui-key .nav-lbl { font-size: 13px; line-height: 16px; letter-spacing: 0; }
/* The current page / mode / open flyout, same on all keys: white text, a line on the top edge. */
body.nav-float #game .tabs > button.active,
body.nav-float #game .tabs > button[aria-selected='true'],
#game .ui-key.is-on,
#game .ui-key[aria-expanded='true'],
#game .ui-key[aria-pressed='true'] { color: #fff !important; }
body.nav-float #game .tabs > button.active::before,
body.nav-float #game .tabs > button[aria-selected='true']::before,
#game .ui-key.is-on::before,
#game .ui-key[aria-expanded='true']::before,
#game .ui-key[aria-pressed='true']::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 54px;
  height: 1px;
  margin-left: -27px;
  background: #fff;
}
/* Outline <-> solid: an element with class ui-swap shows the solid drawing of its icon pair while it is the current page / mode, open, pressed
 * (:active covers a finger or mouse held down) and the outline drawing otherwise; never one painted over the other. */
.ui-ico .ico-f { display: none; }
.ui-swap:is(.active, .is-on, [aria-selected='true'], [aria-current='page'], [aria-pressed='true'], [aria-expanded='true'], :active) .ui-ico .ico-r { display: none; }
.ui-swap:is(.active, .is-on, [aria-selected='true'], [aria-current='page'], [aria-pressed='true'], [aria-expanded='true'], :active) .ui-ico .ico-f { display: inline; }

/* G8L-212 iPhone Safari: inputs under 16px trigger a focus zoom that persists across the
   single-page login, select and game views; keep page edges inside the safe area. */
html, body { overscroll-behavior: none; }
html { touch-action: manipulation; }
body { min-height: 100dvh; }
@media (max-width: 720px), (pointer: coarse) {
  input:not([type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file']),
  select,
  textarea { font-size: 16px !important; }
}
@media (max-width: 650px) {
  .auth-card { max-height: calc(100dvh - 18px); }
  .auth {
    padding: max(9px, env(safe-area-inset-top)) max(9px, env(safe-area-inset-right))
      max(9px, env(safe-area-inset-bottom)) max(9px, env(safe-area-inset-left));
  }
}
@media (max-width: 720px) {
  .auth-audio {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
  }
  .auth-server-status {
    top: calc(18px + env(safe-area-inset-top));
    right: calc(58px + env(safe-area-inset-right));
  }
  #game.desktop {
    padding-top: var(--top-edge);
    padding-left: var(--edge-x);
    padding-right: var(--edge-x-right);
  }
}

/* G8L-212 the page stays locked; only the minimap and the 彩虹橋 grid map zoom and pan
   inside their own window (map-zoom.js). */
.map-zoom-viewport { position: relative; overflow: hidden; touch-action: none; overscroll-behavior: contain; }
.map-zoom-content { transform-origin: 0 0; will-change: transform; }
.map-zoom-controls { position: absolute; top: 6px; right: 6px; z-index: 3; display: flex; gap: 4px; }
.map-zoom-controls button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 8px;
  background: rgb(10 20 30 / 62%);
  color: #fff;
  font: 600 18px/1 -apple-system, 'Microsoft JhengHei', sans-serif;
  cursor: pointer;
}

/* Mail reminders survive navigation icon redecoration. */
.nav-mail-badge { position:absolute; top:2px; right:5px; color:#d23b47; font-size:14px; font-weight:700; line-height:18px; pointer-events:none; }
.nav-mail-badge[hidden] { display:none; }
#game .tabs > button[data-tab="mail"] { position:relative; }
