html {
  background: #111219;
  -webkit-text-size-adjust: 100%;
}

.home-install {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  background: none;
  border-color: transparent;
}
.home-install::before {
  content: '+';
  width: 17px;
  height: 17px;
  border: 1.4px solid currentColor;
  border-radius: 4px;
  font: 16px/14px system-ui, sans-serif;
}
.home-install:focus-visible, .home-install:hover { border-color: #665741; }
#home-help { max-height: 85dvh; overflow: auto; }
#home-help h2 { font-size: 25px; font-weight: 500; }
#home-help .home-icon { display: block; margin-bottom: 14px; border-radius: 13px; }
#home-help ol { display: grid; gap: .65rem; padding-left: 1.4rem; }
#home-help li { padding-left: .15rem; color: var(--muted); }
#home-help li::marker { color: var(--gold); font-weight: 600; }
#home-help strong { color: var(--ink); }
#home-help .action { min-height: 44px; width: 100%; text-align: center; }
#offline-status { font-size: 14px; color: var(--muted); }
#offline-status:not(:empty) { margin: 0 0 14px; }

@media (pointer: coarse) {
  .top {
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(15px, env(safe-area-inset-left, 0px));
    padding-right: max(15px, env(safe-area-inset-right, 0px));
  }
  .content {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
  .controls select, .controls input, .mobile-character select, .guidepick {
    font-size: 16px;
    min-height: 44px;
  }
  .segment button, .slot, .action, button.close { min-height: 44px; }
  button.close { min-width: 44px; text-align: center; }
  .slot-owned summary, .mail-coverage summary { padding-block: 9px; }
  dialog { max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 28px); overflow: auto; }
  button, summary, select { touch-action: manipulation; }
}

@media (max-width: 700px) {
  :root { --armory-tab-height: calc(59px + env(safe-area-inset-bottom, 0px)); }
  html { scroll-padding-bottom: calc(var(--armory-tab-height) + 12px); }
  .content { padding-bottom: calc(var(--armory-tab-height) + 26px); }
  .top .meta { gap: 0; }
  .top .meta:has(.home-install) .private { display: none; }
  .mast { margin-block: 13px 17px; }
  .tabs {
    position: fixed;
    z-index: 10;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    min-height: var(--armory-tab-height);
    padding: 0 max(7px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(7px, env(safe-area-inset-left, 0px));
    margin: 0;
    border: 0;
    border-top: 1px solid #45404c;
    background: #171820;
    box-shadow: 0 -5px 18px #0c0d1529;
  }
  .mast + .tabs { margin-top: 0; }
  .tabs button {
    position: relative;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 4px;
    padding: 5px 4px;
    border: 0;
    font: 600 12px/1.2 system-ui, sans-serif;
    letter-spacing: .01em;
    text-align: center;
  }
  .tabs button::before {
    content: '';
    width: 21px;
    height: 21px;
    background: currentColor;
    -webkit-mask: var(--tab-icon) center / contain no-repeat;
    mask: var(--tab-icon) center / contain no-repeat;
  }
  .tabs button[data-tab="Equipment"] {
    --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='m12 2 8 3v6c0 4-3 8-8 11-5-3-8-7-8-11V5z'/%3E%3Cpath d='m8.2 11.5 2.6 2.7 5-5'/%3E%3C/svg%3E");
  }
  .tabs button[data-tab="Inventory"] {
    --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='15' rx='3'/%3E%3Cpath d='M8.5 6V4c0-1 1-2 2-2h3c1 0 2 1 2 2v2M4 12h16M10 12v2h4v-2'/%3E%3C/svg%3E");
  }
  .tabs button[data-tab="Mail plan"] {
    --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Crect x='2.5' y='4.5' width='19' height='15' rx='2.5'/%3E%3Cpath d='m3.5 6 8.5 7 8.5-7'/%3E%3C/svg%3E");
  }
  .tabs button[aria-pressed=true]::after {
    position: absolute;
    top: -1px;
    width: 32px;
    height: 2px;
    content: '';
    background: var(--gold);
  }
  .filterbox .controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbox .search { grid-column: 1 / -1; }
  .controls label, .controls .action, .itemcard { min-width: 0; }
  .controls :is(input, select), .mobile-character select { width: 100%; }
  .mobile-character select { flex: 1; }
  .segment { padding: 1px; }
  .segment button { padding: 4px 7px; }
  .panelhead { flex-wrap: wrap; }
  .stat { grid-template-columns: 27px minmax(8px, 1fr) minmax(65px, auto) minmax(8px, 1fr) 27px; }
}
.armory-update {
  position: fixed;
  z-index: 12;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  min-height: 44px;
  padding: 8px 14px;
  background: #ebcf9b;
  border: 1px solid #a88b5d;
  color: #251d15;
  box-shadow: 0 4px 22px #0008;
  font-weight: 600;
}
@media (max-width: 700px) {
  .armory-update {bottom: calc(70px + env(safe-area-inset-bottom));}
}
