/* Shared Black Rain portrait destinations. The original city controls keep their handlers. */
.survival-global-nav { display: none; }
html.survival-portrait body .game > .survival-global-nav.is-visible {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 52px;
  padding: 1px 2px 4px;
  gap: 2px;
  box-sizing: border-box;
  z-index: 95;
  border-top: 2px solid #b6844b;
  background: linear-gradient(180deg, #28231efa 0%, #151515fc 45%, #0a0d10 100%);
  box-shadow: 0 -5px 18px #050b13bb, inset 0 1px #f0c48955;
}
/* Profile is a full-screen layer above the city; its free bottom strip can host nav. */
html.survival-portrait body .game > .survival-global-nav.is-visible[data-screen="profile"] {
  z-index: 201;
}
html.survival-portrait body .game > .survival-global-nav.is-visible[data-screen="team"] {
  z-index: 1011;
}
html.survival-portrait body .game > .survival-global-nav > button {
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 3px 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: url('../img/ui/survival/kit/button_secondary.webp') center / 100% 100% no-repeat;
  border: 0;
  border-radius: 0;
  color: #f1dfc2;
  cursor: pointer;
  text-align: center;
  text-shadow: 0 1px 2px #050a0e;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
html.survival-portrait body .game > .survival-global-nav > button[aria-current="page"],
html.survival-portrait body .game > .survival-global-nav > button[aria-expanded="true"] {
  color: #fff1d5;
  background-image: url('../img/ui/survival/kit/button_primary.webp');
  text-shadow: 0 1px 2px #271506;
}
html.survival-portrait body .game > .survival-global-nav .nav-icon {
  width: 31px;
  height: 26px;
  display: block;
  flex: none;
  filter: drop-shadow(0 1px 2px #02070b);
}
html.survival-portrait body .game > .survival-global-nav .nav-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
html.survival-portrait body .game > .survival-global-nav .nav-label {
  display: block;
  max-width: 100%;
  font: 800 12px/15px var(--br-display);
  letter-spacing: 0;
  white-space: nowrap;
}
/* Only the tutorial uses the original city targets; modal dialogs must not reveal them. */
html.survival-portrait body .game:not(.survival-tutorial-nav):not(.city-nav-visible) .frame_city > .interface > .left >
  :is(#hero-btn,#team-btn,#inventory-btn,#home-btn,#survival-city-more) {
  visibility: hidden !important;
  pointer-events: none !important;
}
/* More is an opaque panel of proxy buttons. Every button fires the existing city handler. */
.survival-global-more-grid { display: none; }
html.survival-portrait body .game > .survival-global-more-grid.is-visible {
  display: block;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 58px;
  z-index: 94;
  box-sizing: border-box;
  padding: 8px 6px 10px;
  border: 1px solid #bd9669;
  border-radius: 11px;
  background: #0c1a29;
  box-shadow: 0 0 0 3px #050b14, 0 10px 27px #03070de8, inset 0 1px #d8b58755;
  color: #e8e9e5;
  text-shadow: 0 1px 2px #02060b;
}
html.survival-portrait body .game > .survival-global-more-grid .survival-more-heading {
  display: flex;
  height: 27px;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 6px;
  color: #f1bd82;
  font: 800 12px/16px var(--br-display);
  letter-spacing: 1px;
  text-transform: uppercase;
}
html.survival-portrait body .game > .survival-global-more-grid .survival-more-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: url('../img/ui/survival/kit/button_close.webp') center / contain no-repeat;
  color: transparent;
  font: 0/0 Arial, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
html.survival-portrait body .game > .survival-global-more-grid .survival-more-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 66px;
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  gap: 4px;
}
html.survival-portrait body .game > .survival-global-more-grid .survival-more-action {
  display: flex;
  min-width: 0;
  margin: 0;
  padding: 3px 1px;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 0;
  background: url('../img/ui/survival/kit/button_secondary.webp') center / 100% 100% no-repeat;
  color: #e8edf0;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;

  font: 800 12px/14px var(--br-display);
}
html.survival-portrait body .game > .survival-global-more-grid .survival-more-action:active {
  background-image: url('../img/ui/survival/kit/button_primary.webp');
}
html.survival-portrait body .game > .survival-global-more-grid .survival-more-action[hidden] { display: none !important; }
html.survival-portrait body .game > .survival-global-more-grid .more-icon {
  display: block;
  width: 27px;
  height: 27px;
  color: #e2ae72;
}
html.survival-portrait body .game > .survival-global-more-grid .more-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
html.survival-portrait body .game > .survival-global-more-grid .more-label {
  width: 100%;
  color: #f0ede7;
  font: 700 12px/14px var(--br-display);
  white-space: normal;
  overflow-wrap: anywhere;
}
/* Old decorative rows stay in the DOM for delegated click handlers. */
html.survival-portrait body .game.survival-global-more-visible .frame_city.survival-more-open > .interface > .left::after {
  display: none !important;
}
html.survival-portrait body .game.survival-global-more-visible .frame_city.survival-more-open > .interface > .left >
  :is(#hero-btn,#home-btn,#zadanie_icon,#scroll_menu,.dostijenie_icon,#chat-btn,#guild_icon,.vip,#dailyBonusHero-btn,#start_kit-btn,#firstBuy-btn,#groupBonus-btn,#eventPass-btn),
html.survival-portrait body .game.survival-global-more-visible .frame_city.survival-more-open > .interface > .top >
  :is(.music,.mail_top,.friends_top,.settings_top,.eventTicketsBlock) {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* The team popup retains the city resource HUD; its utility buttons must stay behind it. */
html.survival-portrait body .game.start-kit-pet-open > .frame_city > .interface > .top >
  :is(.music,.mail_top,.friends_top,.settings_top,.eventTicketsBlock) {
  display: none !important;
}
/* Keep the portrait game centered in wide browser windows and WebViews. */
html.survival-portrait body > #game,
html.survival-portrait body > .screen {
  margin-left: auto !important;
  margin-right: auto !important;
}

html.survival-portrait .rotateMobile {
  display: none !important;
  pointer-events: none !important;
}


/* The same three live balances head the portrait dossiers and their subviews. */
.br-wallet { display: none; }
html.survival-portrait .br-wallet {
  position: absolute; inset: 0 0 auto; z-index: 12;
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 2px;
  height: 34px; padding: 2px; box-sizing: border-box;
  background: #111311;
}
.br-wallet > .br-balance {
  container: hud-balance / inline-size;
  position: relative; display: flex; align-items: center; justify-content: center;
  gap: 2px; min-width: 0; height: 100%; box-sizing: border-box;
  padding: 0 2px; border: var(--balance-border); border-radius: var(--balance-radius);
  background: var(--balance-surface); color: var(--balance-color);
  font: var(--balance-font); white-space: nowrap;
  cursor: pointer; touch-action: manipulation;
}
.br-balance::before, .br-balance::after {
  content: ''; display: block; flex: 0 1 var(--balance-icon-size); height: var(--balance-icon-size);
  background: var(--balance-art) center / contain no-repeat;
}
.br-balance-coins { --balance-art: url('../img/ui/survival/resources/credit_steel.webp'); }
.br-balance-gold { --balance-art: url('../img/ui/survival/resources/plasma_credit.webp'); }
.br-balance-energy { --balance-art: url('../img/ui/survival/resources/energy.webp'); }
.br-balance::after { flex-basis: 16px; background-image: url('../img/ui/survival/kit/button_plus.webp'); }
.br-balance:disabled { cursor: default; }
.br-balance:disabled::after { display: none; }

html.survival-portrait body :is(#coinPopup,#goldPopup,#energyPopup).br-wallet-offer { z-index: 99990 !important; }
html.survival-portrait body #energyPopup.br-wallet-offer ~ #energy1Promo { z-index: 99991 !important; }
