/* v30 mobile pass: scrolling sheets, one sheet at a time, sheet headers, the phone build mode.
   Loaded last; desktop rules here are small and shared. */

/* Scrolling. The page itself never scrolls (overflow hidden), so the body no longer needs touch-action:none,
   which on iOS Safari also blocked scrolling inside the sheets. Only the map canvas takes raw touches. */
html,
body {
  touch-action: manipulation;
}
#c {
  touch-action: none;
}
.panel,
.tray,
.qbody,
.side > .card,
.dev {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}

/* Sheet header: the title and the close button on one line; the content below uses the full width. */
.panel > h3:first-child,
.side > .card > .shead {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel > h3:first-child > [data-p='close'],
.shead > .sx {
  float: none !important;
  margin-left: auto;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  font-size: 16px;
}
.panel .acts.menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.panel .acts.menu .btn {
  width: 100%;
  margin: 0;
}

/* Camp card: a header that can fold the card away, tabs, and a separate card for the selected building. */
.campCard .shead h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.campCard.folded > :not(.shead) {
  display: none !important;
}
.campCard .ctabs {
  display: flex;
  gap: 6px;
  margin: 8px 0 6px;
}
.campCard .ctabs .pill {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.campCard .ctabs .pill[aria-pressed='true'] {
  background: var(--ink);
  color: var(--stone);
}

/* Wallet: shells in the HUD; tapping them opens the other resources. */
.rpill .chip[data-it='money'] {
  cursor: pointer;
}
.wallet .rrow {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--stone-lo);
  font-size: 15px;
}

/* Build cards: the name, then the price written as "2,500 (shell)" on its own line. */
.item .price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  white-space: nowrap;
}
.item .price .coin {
  width: 15px;
  height: 15px;
}
.item .sub {
  display: block;
  font-size: 11px;
  opacity: 0.85;
}

/* Guest thought bubbles stay small (drawn by PixiJS, see js/ui/guestinfo.js). */

/* Phone build mode: the picked building sits in the middle of the screen; check and cross below it. */
.placeBar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--cmdH, 100px) + 18px);
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  z-index: 8;
  pointer-events: auto;
}
.placeBar[hidden],
body.qopen .placeBar,
body.popen .placeBar,
body.bopen:not(.bmini) .placeBar {
  display: none;
}
.placeBar button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--stone-lo);
  box-shadow: 0 4px 0 rgba(36, 21, 9, 0.35);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.placeBar button svg {
  width: 30px;
  height: 30px;
}
.placeBar .pbOk {
  background: #4f8a2b;
  color: #fff;
}
.placeBar .pbOk:disabled {
  background: #9aa58e;
}
.placeBar .pbX {
  background: var(--stone);
  color: var(--ink);
}
.placeBar .pbWarn {
  color: #ffd23a;
  white-space: normal;
}
/* build orders: «Bring» for what the building is short of, a small pill (not one of the round check / cross buttons) */
.placeBar .pbName .pbBring {
  display: inline-block;
  width: auto;
  height: auto;
  border-radius: 9px;
  border: 1px solid var(--stone-lo);
  box-shadow: none;
  padding: 1px 8px;
  margin-left: 4px;
  font: inherit;
  font-weight: 700;
  background: var(--orange, #e07a2a);
  color: #fff;
}
.placeBar .pbName {
  position: absolute;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--dim);
  color: #f6eedc;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 13px;
}
body.placing .toolChip {
  display: none !important;
}
/* Phone coaster builder: while the track is drawn its buttons stand in a bar over the command bar, in place of the
   ride's sheet, so the map stays in view (js/ui/place.js) */
.trackBar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(var(--cmdH, 100px) + 8px);
  z-index: 8;
  pointer-events: auto;
  background: var(--dim);
  color: #f6eedc;
  border-radius: 14px;
  padding: 6px 8px 8px 12px;
}
.trackBar[hidden],
body.qopen .trackBar,
body.popen .trackBar,
body.bopen:not(.bmini) .trackBar {
  display: none;
}
.trackBar .tbTop {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.trackBar .tbText {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}
.trackBar .tbText b {
  display: block;
  font-size: 13px;
}
.trackBar .tbText small {
  display: block;
  font-size: 11.5px;
  opacity: 0.85;
}
.trackBar .tbX {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  color: var(--bark);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.trackBar .tbX svg {
  width: 16px;
  height: 16px;
}
.trackBar .tbBtns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.trackBar .tbBtns .btn {
  min-height: 38px;
  padding: 2px 4px;
  font-size: 13.5px;
  white-space: nowrap;
}
body.tracking .toolChip {
  display: none !important;
}

@media (max-width: 700px) {
  /* one sheet at a time: the cards on the right never sit on top of an open drawer, menu or quest list */
  body.bopen:not(.bmini) .side,
  body.qopen .side,
  body.popen .side {
    display: none;
  }
  .side > .card {
    max-height: min(48vh, calc(100vh - var(--hudB, 110px) - var(--cmdH, 100px) - 40px));
  }
  .panel {
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
    max-height: calc(100% - var(--hudB, 110px) - var(--cmdH, 100px) - 24px);
  }
  /* build drawer: tabs scroll sideways, with a fade at the edge that shows there is more */
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
    padding-right: 28px;
  }
  .tabs .tab {
    flex: none;
  }
  .tray::after {
    content: '';
    position: sticky;
    display: block;
    bottom: calc(var(--cmdH, 100px) + 4px);
    height: 0;
  }
  .items .item b {
    font-size: 12.5px;
    line-height: 1.15;
  }
  .scrollHint {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 2px 0 6px;
  }
}
@media (min-width: 701px) {
  .scrollHint {
    display: none;
  }
  .placeBar,
  .trackBar {
    display: none !important;
  }
}
.items .scrollHint {
  grid-column: 1 / -1;
  margin: 0;
}
/* the camp card put away: a small pill at the bottom, the camp stays in view */
.campCard.folded {
  padding: 6px 8px !important;
  width: auto !important;
}
.campCard.folded .shead {
  gap: 6px;
}
.campCard.folded .cfoldpill {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campCard.folded .sx {
  white-space: nowrap;
}
.campCard.folded::before {
  display: none !important;
}
