#saveGate[open] {
  box-sizing: border-box;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(clamp(18px, 6vw, 80px), env(safe-area-inset-left));
  background: linear-gradient(90deg, #081413f2, #081413aa 48%, #08141322),
    url("afa358a83383f5050df612ab.jpg") center 40% / cover no-repeat #101e1c;
}
#saveGate .savePanel {
  width: min(100%, 400px);
  box-sizing: border-box;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid #a8bca157;
  border-top: 2px solid #e8be7b;
  border-radius: 14px;
  background: #142422ed;
}
#saveGate .savePanel h1 { margin: 6px 0 8px; }
#webStart .go {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  background: #edbd76;
  color: #24251c;
  border-color: #ffda9f;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
}
#webStart .go:active { background: #ffd497; }
#webStart p { margin: 10px 0 0; font-size: 13px; }
#webStartNote:not(:empty) { color: #ffd19d; }
@media (orientation: portrait) {
  #saveGate[open] {
    align-items: end;
    background-image: linear-gradient(0deg, #081413f2, #0814131f 80%),
      url("afa358a83383f5050df612ab.jpg");
  }
  #saveGate .savePanel { margin-inline: auto; }
}
@media (max-height: 440px) and (orientation: landscape) {
  #saveGate .savePanel { padding: 16px 20px; }
  #webStart .go { margin-top: 12px; }
}

[data-touch-game] #home .dockbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 6px;
  padding: 0 10px;
  min-height: auto;
  background: #10201ff9;
}
[data-touch-game] #home .dockbrand { min-width: 0; font-size: clamp(12px, 2.5vw, 17px); }
[data-touch-game] #home .dockbrand small { display: none; }
[data-touch-game] #home .dockbrand .ferry-mark { flex: 0 0 21px; width: 21px; height: 21px; }
[data-touch-game] #home .barTools {
  grid-column: 2;
  grid-row: 1;
  gap: 3px;
  padding: 0;
  min-width: 0;
  white-space: nowrap;
}
[data-touch-game] #home .barTools > button { min-height: 44px; min-width: 40px; padding-inline: 5px; }
[data-touch-game] #home .barTools .balance { font-size: 12px; padding: 0 4px; }
[data-touch-game] #home .barTools #controls { display: none; }
[data-touch-game] #home .docknav {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-content: flex-start;
  border-top: 1px solid #7e999344;
  padding-inline-end: 10px;
  gap: 2px;
  overscroll-behavior-x: contain;
}
[data-touch-game] #home .docknav .depotNav { gap: 2px; }
[data-touch-game] #home .docknav button {
  min-height: 44px;
  padding-inline: 11px;
  font-size: 13px;
}
[data-touch-game] #home #lobbyPage {
  min-height: calc(100dvh - 90px);
  box-sizing: border-box;
  gap: 12px;
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
}
[data-touch-game] #home #lobbyPage .lobbyName h1 {
  font-size: clamp(22px, 4.2vw, 42px);
  margin: 3px 0;
}
[data-touch-game] #home #skinPoster { width: clamp(100px, 17vw, 150px); padding: 6px 8px; }
[data-touch-game] #home #skinPoster img { height: 26px; }
[data-touch-game] #home .mission {
  width: min(320px, 46vw);
  box-sizing: border-box;
  border-radius: 11px;
  overflow: hidden;
  background: #122322f5;
}
[data-touch-game] #home .missionText { padding: 8px 11px; }
[data-touch-game] #home .missionText h2 { font-size: 16px; margin: 2px 0; }
[data-touch-game] #home .missionText p { max-height: 3.2em; margin-top: 3px; overscroll-behavior: contain; }
[data-touch-game] #home .loadLine { min-height: 44px; padding: 0 10px; }
[data-touch-game] #home .mission button { min-height: 44px; }
[data-touch-game] #home #mapEntry { padding: 7px 10px; gap: 4px; }
[data-touch-game] #home #mapEntry b { overflow-wrap: anywhere; }
[data-touch-game] #home #launch { min-height: 50px; padding: 8px 12px; font-size: 18px; }

[data-touch-game] .raid-heading {
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
}
[data-touch-game] .raid-vitals {
  top: calc(max(8px, env(safe-area-inset-top)) + 43px);
  left: max(8px, env(safe-area-inset-left));
  bottom: auto;
  width: clamp(96px, 24vw, 142px);
  gap: 3px;
}
[data-touch-game] .raid-vital { border-radius: 5px; padding: 4px 6px; font-size: 10px; }
[data-touch-game] .raid-health .raid-meter { height: 8px; }
[data-touch-game] #raidTouch button { min-width: 44px; min-height: 44px; }
[data-touch-game] #touchStick { width: clamp(76px, 18vmin, 104px); height: clamp(76px, 18vmin, 104px); }
[data-touch-game] #touchFight #touchFire {
  width: clamp(64px, 17vmin, 80px);
  height: clamp(64px, 17vmin, 80px);
  background: #6a3e27e8;
  font-size: 15px;
}
[data-touch-game] #touchAmmo { right: calc(clamp(64px, 17vmin, 80px) + 6px); bottom: 19px; }
[data-touch-game] #touchContext {
  position: static;
  max-width: min(45vw, 220px);
}
[data-touch-game] #touchContext button { background: #254538f5; border-color: #b4c4a1; }
[data-touch-game] #touchFight .touchFireRow { position: relative; align-self: flex-end; }
[data-touch-game] #weaponBar button { border-radius: 7px; }
[data-touch-game] #lootPanel {
  --loot-left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  width: min(840px, calc(100vw - var(--loot-left) - max(8px, env(safe-area-inset-right))));
  box-sizing: border-box;
  border-radius: 11px;
  padding: 8px;
  scrollbar-width: thin;
}
[data-touch-game] #lootPanel #lootMsg { height: auto; max-height: 3.2em; min-height: 0; }
[data-touch-game] #lootPanel #closeLoot,
[data-touch-game] #lootPanel .touchInventory { min-height: 44px; }
@media (max-width: 370px) {
  [data-touch-game] #home .dockbrand .ferry-mark { display: none; }
  [data-touch-game] #home .barTools > button { min-width: 36px; }
}
@media (max-height: 460px) and (orientation: landscape) {
  [data-touch-game] #home .missionText > small { display: none; }
  [data-touch-game] #home .missionText p { max-height: 1.6em; }
  [data-touch-game] #lootPanel[data-personal=no] .lootColumns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 8px;
  }
  [data-touch-game] #lootPanel[data-personal=no] .lootColumns > * { grid-row: auto; }
}
@media (orientation: portrait) {
  [data-touch-game] #home #lobbyPage {
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    align-content: end;
    padding-inline: 10px;
  }
  [data-touch-game] #home #lobbyPage .mission { width: 100%; }
  [data-touch-game] #home #lobbyPage :is(#lobbyScene, #costumeBackdrop) { top: 0; }
  [data-touch-game] #weaponBar { bottom: calc(167px + env(safe-area-inset-bottom)); max-width: 92vw; }
  html[data-touch-game] #hint { bottom: calc(216px + env(safe-area-inset-bottom)); }
  [data-touch-game] #touchContext { max-width: 60vw; }
  [data-touch-game] #touchNav { gap: 3px; }
}

/* Inventory remains scrollable until a drag begins from its grip. */
[data-touch-game] #home :is(.slots .item,.gearTile),
[data-touch-game] #lootPanel :is(.item,.fieldRack button) { touch-action: pan-x pan-y; }
[data-touch-game] :is(#home,#lootPanel) .itemDragGrip {
  position: absolute;
  z-index: 2;
  bottom: 1px;
  right: 1px;
  display: grid;
  place-items: center;
  width: 27px;
  height: 26px;
  border-radius: 5px;
  background: #10221ded;
  color: #f0d19a;
  font: 700 20px/1 system-ui, sans-serif;
  touch-action: none;
  pointer-events: auto;
}
[data-touch-game] :is(#home,#lootPanel) [data-item-selected] {
  outline: 2px solid #ffe0a1;
  outline-offset: -2px;
  touch-action: none;
}
[data-touch-game] :is(#home,#lootPanel) .touchDropTarget {
  outline: 2px solid #bdedbb;
  outline-offset: -2px;
}
.touchDragGhost {
  position: fixed;
  z-index: 150;
  top: 0;
  left: 0;
  max-width: min(240px, 48vw);
  pointer-events: none;
  padding: 6px 9px;
  border: 1px solid #ecc982;
  border-radius: 6px;
  color: #fff5da;
  background: #1c352a;
  font: 700 13px/1.35 system-ui, sans-serif;
}
[data-touch-game] #home .touchWear,
[data-touch-game] #lootPanel .touchWear {
  min-height: 46px;
  padding-inline: 14px;
  background: #ecbf7c;
  border-color: #ffe1ab;
  color: #24261b;
  font-weight: 800;
}
[data-touch-game] #home #touchCampWear {
  position: fixed;
  z-index: 11;
  inset-inline-start: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  translate: -50% 0;
}
[data-touch-game] #home #gearChoices { scroll-margin-top: 96px; }
[data-touch-game] #home #gearChoices button { min-height: 44px; }
[data-touch-game] #lootPanel #fieldEquip,
[data-touch-game] #discardZone { display: none; }
[data-touch-game] #lootPanel .touchStockActions { display: flex; flex-wrap: wrap; gap: 4px; }
[data-touch-game] #lootPanel .touchStockActions:empty { display: none; }
[data-touch-game] #lootPanel .touchStockActions:not(:has(button:not([hidden]))) { display: none; }
[data-touch-game] .touchStockActions button { height: auto; }

[data-touch-game] #home #trainingStatus {
  position: static;
  width: auto;
  max-width: none;
  max-height: none;
  margin: 7px 10px;
  padding: 6px 9px;
  zoom: 1;
}
[data-touch-game] #home #trainingStatus #trainingText { margin-block: 3px; }
[data-touch-game] #home .campTouchActions {
  position: fixed;
  z-index: 11;
  inset-inline: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  pointer-events: none;
}
[data-touch-game] #home #touchCampWear {
  position: static;
  translate: none;
}
[data-touch-game] #home .campTouchActions button {
  min-height: 46px;
  pointer-events: auto;
}
[data-touch-game] #home:has(.campTouchActions button:not([hidden])) {
  scroll-padding-bottom: 66px;
}
[data-touch-game] #home #stock .item { scroll-margin-top: 98px; }
