/* Phone layout only. html.hunt-phone is set for phone user agents and for a
   coarse pointer on a short screen. Desktop rules in main.css and hunt.css
   stay in effect when that class is absent. */

html.hunt-phone,
html.hunt-phone body {
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

html.hunt-phone body.game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
}

html.hunt-phone #foreground,
html.hunt-phone #background,
html.hunt-phone #entities,
html.hunt-phone #canvas,
html.hunt-phone #container {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html.hunt-phone #portrait {
  display: none !important;
}

html.hunt-phone body.game #container {
  display: block !important;
}

html.hunt-phone body.intro {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: auto;
  min-height: 100%;
}

html.hunt-phone body.intro #parchment {
  display: block !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: min(480px, calc(100vw - 16px)) !important;
  height: auto !important;
  margin: 0 auto 28px !important;
  background: none !important;
  color: #eee;
}

html.hunt-phone body.intro #logo {
  position: relative !important;
  display: block !important;
  top: auto !important;
  left: auto !important;
  width: min(320px, 78vw) !important;
  height: auto !important;
  margin: 72px auto 8px !important;
  transform: none !important;
}

html.hunt-phone body.intro .parchment-left,
html.hunt-phone body.intro .parchment-right {
  display: none !important;
}

html.hunt-phone body.intro .parchment-middle {
  position: relative !important;
  left: 0 !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  background: none !important;
}

html.hunt-phone body.intro #loadcharacter,
html.hunt-phone body.intro #confirmation,
html.hunt-phone body.intro #createcharacter,
html.hunt-phone body.intro #error {
  display: none;
  position: relative;
  left: 0;
  top: auto;
  width: 100%;
  height: auto;
  margin: 0;
}

html.hunt-phone body.intro #parchment.loadcharacter #loadcharacter,
html.hunt-phone body.intro #parchment.confirmation #confirmation,
html.hunt-phone body.intro #parchment.createcharacter #createcharacter,
html.hunt-phone body.intro #parchment.error #error {
  display: block;
}

/* main.css hides the legacy spritesheet portrait under 800px. The HUNT
   title card uses hunt-portrait.png, so keep that image on phones. */
html.hunt-phone #createcharacter #character,
html.hunt-phone #createcharacter #character div {
  display: block !important;
}

html.hunt-phone body.intro #parchment input,
html.hunt-phone #nameinput,
html.hunt-phone #chatinput {
  font-size: 16px !important;
  min-height: 44px;
  line-height: 1.2;
}

html.hunt-phone body.intro .button,
html.hunt-phone body.intro .play,
html.hunt-phone body.intro .play div,
html.hunt-phone #respawn {
  min-height: 48px;
  min-width: 160px;
}

html.hunt-phone #hunt-links {
  gap: 8px;
  padding: 4px 8px;
  padding-top: max(4px, env(safe-area-inset-top));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
  align-items: center;
}

html.hunt-phone #hunt-links .hunt-brand {
  min-height: 44px;
  font-size: 22px;
  flex: 0 0 auto;
}

html.hunt-phone .hunt-nav {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100vw - 88px);
  overflow-x: auto;
  flex-wrap: nowrap;
  gap: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

html.hunt-phone .hunt-nav > a,
html.hunt-phone .hunt-nav > button,
html.hunt-phone .hunt-nav > span,
html.hunt-phone #hunt-shop-nav {
  min-height: 44px;
  min-width: 44px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 12px;
}

html.hunt-phone #hunt-panel {
  top: calc(env(safe-area-inset-top, 0px) + 56px);
  left: 8px;
  right: auto;
  width: min(420px, calc(100vw - 16px));
  max-height: min(46vh, 320px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

html.hunt-phone #hunt-map-button,
html.hunt-phone #hunt-home,
html.hunt-phone #hunt-character-button,
html.hunt-phone #hunt-pack-button,
html.hunt-phone #hunt-market-button,
html.hunt-phone #hunt-chat-button,
html.hunt-phone #hunt-save,
html.hunt-phone #hunt-unclaimed,
html.hunt-phone #hunt-panel-toggle {
  min-height: 44px;
  min-width: 44px;
  height: 44px;
  box-sizing: border-box;
}

html.hunt-phone .barbutton {
  position: absolute;
}

html.hunt-phone .barbutton::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

html.hunt-phone dialog,
html.hunt-phone #hunt-class-dialog,
html.hunt-phone #hunt-character-dialog,
html.hunt-phone #hunt-market-dialog,
html.hunt-phone #hunt-list-dialog,
html.hunt-phone #hunt-wallet-dialog,
html.hunt-phone #hunt-auth-dialog,
html.hunt-phone #hunt-map-dialog,
html.hunt-phone #hunt-card-modal,
html.hunt-phone #hunt-hold-dialog,
html.hunt-phone #hunt-intro-dialog,
html.hunt-phone #hunt-progress-dialog,
html.hunt-phone #hunt-class-switch-dialog {
  max-width: calc(100vw - 12px);
  max-height: calc(100dvh - 12px);
  overflow: auto;
  box-sizing: border-box;
}

html.hunt-phone .hunt-class-card,
html.hunt-phone #hunt-class-connect,
html.hunt-phone #hunt-class-guest,
html.hunt-phone #hunt-signin,
html.hunt-phone #hunt-pack-connect,
html.hunt-phone #hunt-wallet-dialog button,
html.hunt-phone #hunt-auth-dialog button,
html.hunt-phone #hunt-pack-close,
html.hunt-phone #hunt-market-close,
html.hunt-phone #hunt-list-close,
html.hunt-phone #hunt-character-close,
html.hunt-phone #hunt-map-close,
html.hunt-phone #hunt-card-close,
html.hunt-phone #hunt-hold-close,
html.hunt-phone #hunt-hold-buy,
html.hunt-phone #hunt-hold-refresh,
html.hunt-phone #hunt-intro-close,
html.hunt-phone #hunt-progress-close,
html.hunt-phone #hunt-intro-buy,
html.hunt-phone #hunt-intro-got,
html.hunt-phone .hunt-pack-actions button,
html.hunt-phone .hunt-tip-actions button,
html.hunt-phone .hunt-market-tabs button,
html.hunt-phone .hunt-buy,
html.hunt-phone .hunt-cancel {
  min-height: 44px;
  min-width: 44px;
  box-sizing: border-box;
}

html.hunt-phone #hunt-pack-dialog {
  max-width: calc(100vw - 12px);
  max-height: calc(100dvh - 12px);
  overflow: visible;
  box-sizing: border-box;
}

html.hunt-phone #hunt-item-tip,
html.hunt-phone .hunt-tip-actions button {
  pointer-events: auto;
  touch-action: manipulation;
}

html.hunt-phone #chatbox.hunt-mobile-chat {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: auto !important;
  min-height: 48px;
  margin: 0 !important;
  bottom: auto !important;
  transform: none !important;
  z-index: 13000 !important;
  box-sizing: border-box;
  background: #111 !important;
  border-top: 1px solid #3a3a3a;
  padding: 4px 10px env(safe-area-inset-bottom);
}

html.hunt-phone #chatbox.hunt-mobile-chat input {
  font-size: 16px !important;
  min-height: 44px;
  width: 100% !important;
  margin: 0 !important;
  padding: 10px 0 !important;
  color: #eee;
}

html.hunt-phone #hunt-zone-banner {
  pointer-events: none;
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
}

@media (orientation: landscape) {
  html.hunt-phone #hunt-panel {
    width: min(300px, 46vw);
    max-height: calc(100dvh - 60px);
  }

  html.hunt-phone body.intro #logo {
    margin-top: 56px !important;
  }
}
