/* Party hub, party picker and party battle. Base styles live in ../style.css */

/* Members */
.members { list-style: none; margin: 12px 0 0; padding: 0; }
.members li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.members .who-line { flex: 1; min-width: 140px; }
.members .member-actions { flex-wrap: nowrap; }

/* Shared Pokedex bar */
.dex-progress { margin-top: 12px; }
.dex-progress .hpbar { height: 12px; margin-top: 4px; }

/* Leader tools: Catch · Battle, then the ride button across the whole row */
.actions h3 { margin-top: 0; }
.actions .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions .btn, .actions .ride-btn { text-align: center; padding: 14px 10px; min-height: 52px; }
.actions .ride-btn {
  grid-column: 1 / -1; width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.actions .ride-btn.pending { background: #fff7e0; color: #7a5600; border: 2px solid var(--warn); }
.actions .ride-btn.accepted { background: #e6f7ed; color: #146c3a; border: 2px solid var(--ok); }

/* Ride sheets and the members' one-line ride status */
.ride-sheet h2 { padding-right: 40px; }
.ride-sheet .grid { margin-bottom: 14px; }
.ride-sheet button.big { margin-top: 14px; }
.ride-status {
  background: var(--bg); border-left: 4px solid var(--warn); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 10px;
}
.ride-status.accepted { border-color: var(--ok); }
.drivers ul { margin: 4px 0 0; padding-left: 18px; }
.drivers li { padding: 2px 0; }
.ride-line {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 14px; margin-top: -6px;
  border-left: 6px solid var(--warn); white-space: nowrap; overflow: hidden;
}
.ride-line.accepted { border-left-color: var(--ok); }
/* "is on the way" never shrinks: the destination gives way first, then a long driver name */
.ride-line .rl-ico { flex: none; width: 22px; text-align: center; }
.ride-line strong { display: flex; flex: none; min-width: 0; max-width: calc(100% - 28px); overflow: hidden; }
.ride-line .rl-who { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ride-line .rl-what { flex: none; }
.ride-line .muted { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.manage .row button { flex: 1; min-width: 110px; }
.updated { text-align: center; }

/* Party tiles (join list, admin picker, party battle) */
.party-list .tile .sub { margin-top: 2px; }

/* Party battle: fighter picking */
.pick-fighters { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.pick-fighters .tile .row { align-items: center; }

/* ---------- My Party hub (round 3) ---------- */
.place-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); vertical-align: -2px;
}
.hub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 8px; }
.hub-head > div:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-wrap { position: relative; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0;
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.team-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 2px;
}
.team-menu button {
  background: transparent; color: var(--text); text-align: left; padding: 12px 14px; border-radius: 8px; font-size: 16px;
}
.team-menu button:hover:not(:disabled) { background: var(--bg); }
.team-menu button.danger { border: none; color: var(--low); }

/* Where the team is */
.where-card { border-left: 6px solid #9ca3af; }
.where-card.at-wild { border-left-color: #e53935; }
.where-card.at-town { border-left-color: #8e44ad; }
.where-card.at-gym { border-left-color: #f5c400; }
/* Check-in: ONE line. Dot, "📍 place" (tap for details), then the leader's QR and Location buttons. */
.where-card {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  padding: 8px 8px 8px 10px; min-height: 60px;
}
.where-card .place-dot { flex: none; }
button.where-name {
  flex: 1 1 auto; min-width: 0; padding: 8px 2px; background: transparent; color: var(--text);
  text-align: left; font-size: 16px; font-weight: 700; border-radius: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
button.where-name:hover { background: transparent; color: var(--accent); }
.where-btn { flex: none; height: 44px; padding: 0 10px; font-size: 15px; white-space: nowrap; }
.where-btn.qr { width: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.place-sheet h2 { padding-right: 40px; display: flex; align-items: center; gap: 8px; }

/* Members: Team · Bag · Badges, swiped sideways (the dots show there is more) */
.members-card { padding: 8px 0 10px; overflow: hidden; }
.swipe {
  display: flex; align-items: flex-start; transition: height .2s ease;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none;
}
.swipe::-webkit-scrollbar { display: none; }
.pane { flex: 0 0 100%; min-width: 100%; scroll-snap-align: start; scroll-snap-stop: always; padding: 0 12px; }
.view-dots { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.view-dot { width: 28px; height: 28px; padding: 0; background: transparent; border-radius: 50%; position: relative; }
.view-dot::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: var(--border);
}
.view-dot:hover { background: transparent; }
.view-dot.on::after { background: var(--accent); }
.m-hint { margin: 2px 12px 0; text-align: center; }

.m-list { list-style: none; margin: 0; padding: 0; }
.m-list li + li { border-top: 1px solid var(--border); }
.m-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 6px 2px;
  background: transparent; color: var(--text); text-align: left; border-radius: 0; font-weight: 400; font-size: 15px;
}
button.m-row:hover { background: var(--bg); }
.m-row .sprite.sm { width: 46px; height: 46px; }
.m-row .sprite.sm.fallback { font-size: 18px; }
.m-who { flex: 1; min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-who .m-name { font-weight: 700; }
.m-sub { display: block; font-size: 13px; color: var(--muted); }
.star { color: #e0a800; }
.m-count { font-size: 24px; font-weight: 800; text-align: right; line-height: 1; white-space: nowrap; }
.m-count small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.chev { flex: none; width: 12px; color: var(--muted); font-size: 22px; }

/* Bag columns */
.m-col { flex: none; width: 34px; text-align: center; font-weight: 700; font-size: 16px; }
.m-col.wide { width: 44px; font-size: 14px; }
.m-col.none { color: #c2c7d0; font-weight: 400; }
.m-col.yes { color: var(--ok); }
/* Narrow phones: slimmer Bag columns so the name keeps ~100 px (not ~46 px) */
@media (max-width: 400px) {
  .m-list.bag .m-row, .m-list.bag .m-head { gap: 6px; }
  .m-list.bag .m-col { width: 26px; }
  .m-list.bag .m-col.wide { width: 38px; font-size: 13px; }
}
.m-list .m-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 6px; font-size: 18px; border-top: none; }
.m-head .chev { visibility: hidden; }
.ball {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%; position: relative; vertical-align: middle;
  border: 2px solid #2b2b2b; background: linear-gradient(#e53935 0 44%, #2b2b2b 44% 56%, #fff 56%);
}
.ball::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; transform: translate(-50%, -50%);
  background: #fff; border: 1.5px solid #2b2b2b; border-radius: 50%;
}
.ball.great-ball { background: linear-gradient(#2f6fdf 0 44%, #2b2b2b 44% 56%, #fff 56%); }
.ball.ultra-ball { background: linear-gradient(#2b2b2b 0 16%, #f5c400 16% 30%, #2b2b2b 30% 56%, #fff 56%); }

/* Badges */
.m-badges { display: flex; gap: 7px; flex: none; padding-right: 2px; }
.gym-badge {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  font-style: normal; font-weight: 800; font-size: 12px; color: #fff; border-radius: 6px;
  transform: rotate(45deg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), 0 1px 2px rgba(0,0,0,.25);
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
}
.gym-badge.missing { filter: grayscale(1); opacity: .28; }

/* Trainer card sheet (memberSheet.js). The sheet body scrolls so the ✕ stays put. */
.modal.ms-modal { display: flex; flex-direction: column; overflow: hidden; max-height: 92vh; max-height: 92dvh; padding: 0; }
.modal.ms-modal .modal-close { z-index: 2; background: var(--card); }
.modal.ms-modal .modal-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding: 16px;
}
.ms-head { display: flex; align-items: center; gap: 12px; padding-right: 44px; margin-bottom: 4px; }
.ms-head .sprite.lg { width: 84px; height: 84px; }
.ms-head-text { min-width: 0; flex: 1; }
.ms-head h2 { margin: 0 0 4px; font-size: 22px; overflow-wrap: anywhere; }
.ms-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 15px; }
.ms-sec { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 12px; }
.ms-sec h3 { margin: 0 0 8px; font-size: 17px; }
.ms-sec h3 .muted { font-weight: 600; margin-left: 4px; }
.ms-sec h4 { margin: 12px 0 4px; font-size: 14px; color: var(--muted); }
.ms-sec .hpbar { height: 10px; margin-top: 4px; }

.ms-mons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ms-mon {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  background: var(--bg); border-radius: 10px; padding: 6px 8px 6px 4px;
}
.ms-mon .sprite.sm { width: 44px; height: 44px; }
.ms-mon-text { flex: 1; min-width: 0; }
.ms-mon-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-mon .hpbar { height: 7px; margin-top: 3px; }
.ms-mon .hptext { font-size: 11px; margin-top: 1px; }
.ms-mon .tag.fainted { margin: 3px 0 0; }
.ms-mon.is-fainted .sprite { filter: grayscale(1) opacity(.5); }

.ms-bag { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ms-item { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; padding: 3px 0; }
.ms-item span:not(.ms-ico) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-item strong { flex: none; }
.ms-item.none { color: #9aa1ad; }
.ms-item.none .ball { opacity: .45; }
.ms-ico { flex: none; width: 20px; text-align: center; font-size: 17px; }

.ms-badges { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ms-badges li { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 6px; min-width: 0; }
.ms-badges .gym-badge { width: 28px; height: 28px; font-size: 13px; }
.ms-badges span { font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.ms-badges li.missing span { color: #9aa1ad; }

.ms-total { display: flex; gap: 10px; margin-bottom: 8px; }
.ms-big { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 6px; border-radius: 10px; padding: 8px; }
.ms-big strong { font-size: 28px; line-height: 1; }
.ms-big.win { background: #e6f7ed; color: #146c3a; }
.ms-big.loss { background: #fdecea; color: #a8231a; }
.ms-kinds { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); font-size: 14px; }
.ms-kinds li { display: flex; justify-content: space-between; gap: 6px; }
.ms-kinds li.none { color: #9aa1ad; }
.ms-recent { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.ms-recent li { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); }
.ms-recent li:first-child { border-top: none; }
.ms-wl { flex: none; font-weight: 800; width: 34px; }
.ms-recent .won .ms-wl { color: var(--ok); }
.ms-recent .lost .ms-wl { color: var(--low); }
.ms-rline { min-width: 0; }

.ms-actions { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 4px; }
.ms-actions button.big { margin-top: 10px; }

/* "Where is your team?" list (locations.js) */
.where-sheet h2 { padding-right: 40px; }
.where-group { margin: 16px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.where-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.where-place { padding: 12px; }
.where-place .row { align-items: center; }
.where-text { min-width: 0; }

/* Camera scanner (locations.js): above modal sheets (40), below toasts (50) */
.scan-sheet {
  position: fixed; inset: 0; z-index: 45; background: rgba(10,12,20,.92); color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.scan-panel {
  position: relative; background: var(--card); color: var(--text); border-radius: var(--radius);
  padding: 18px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
}
.scan-panel h2 { padding-right: 40px; }
.scan-panel .scan-cancel { position: absolute; top: 10px; right: 10px; }
.scan-panel .scan-cancel-btn { margin-top: 8px; }
.scan-live { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: relative; width: min(70vw, 60vh, 320px); aspect-ratio: 1; border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); border: 4px solid #fff;
}
.scan-hint {
  position: relative; margin-top: 18px; background: rgba(0,0,0,.6); padding: 8px 14px; border-radius: 999px;
  font-weight: 600; text-align: center;
}
.scan-live .scan-cancel-btn { position: absolute; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: auto; }

/* Catch (wild.js) */
.place-bar { padding: 10px 14px; }
.place-bar .row { flex-wrap: nowrap; }
.place-bar .place-text { flex: 1; min-width: 0; }
.checkin-card h2 { display: flex; align-items: center; gap: 8px; }
.checkin-card .row button { flex: 1; min-width: 150px; }

/* Arriving at a place (arrive.js) */
.arrive-card { text-align: center; max-width: 520px; margin: 12px auto; }
.arrive-card p, .arrive-card .arrive-info { text-align: left; }
.arrive-icon { font-size: 56px; line-height: 1.1; margin-bottom: 6px; }
.arrive-place { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 17px; }
.arrive-card.arrived h1 { font-size: 28px; }
.arrive-card.arrived { border-top: 8px solid #9ca3af; }
.arrive-card.arrived.at-wild { border-top-color: #e53935; }
.arrive-card.arrived.at-town { border-top-color: #8e44ad; }
.arrive-card.arrived.at-gym { border-top-color: #f5c400; }
.arrive-list { margin: 0 0 12px; padding-left: 4px; list-style: none; text-align: left; }
.arrive-list li { padding: 4px 0; }
.arrive-card .btn.big, .arrive-buttons .btn {
  display: block; width: 100%; text-align: center; padding: 16px; font-size: 18px; margin-top: 10px;
}
.arrive-card .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.arrive-card .row .btn { flex: 1; }
