/* Multi-companion floating team bar + checkout sheet — Meow Cuijiao style */

.mcj-team-toast {
  position: fixed;
  left: 50%;
  /* Default: above profile/hall CTA + team bar. JS toast() may override bottom
     with a live measurement so 390px never covers「咨询客服」「立即下单」. */
  bottom: calc(
    var(--mcj-bottom-actions-h, 64px) + var(--mcj-team-bar-h, 64px) + 12px + env(safe-area-inset-bottom, 0px)
  );
  transform: translateX(-50%) translateY(12px);
  /* Below interactive CTAs / team bar actions (9000+) — visual only, no clicks. */
  z-index: 8990;
  max-width: min(88vw, 320px);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(28, 18, 34, 0.96);
  border: 1px solid rgba(243, 168, 203, 0.35);
  color: #ffe6f2;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}
.mcj-team-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mcj-team-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  /* Sit fully above the real bottom action bar (measured via --mcj-bottom-actions-h). */
  bottom: calc(var(--mcj-bottom-actions-h, 64px) + 8px);
  z-index: 9000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(243, 168, 203, 0.32);
  background: linear-gradient(180deg, rgba(36, 24, 42, 0.98), rgba(12, 8, 16, 0.98));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  pointer-events: auto;
}

/* Page room for stacked bars (team + profile CTAs / tabbar). */
html.mcj-team-bar-on body.profile-detail-page,
html.mcj-team-bar-on.profile-detail-page body,
body.profile-detail-page:has(.mcj-team-bar) {
  padding-bottom: calc(
    var(--mcj-bottom-actions-h, 72px) + var(--mcj-team-bar-h, 72px) + 28px + env(safe-area-inset-bottom, 0px)
  ) !important;
}

/* Hall: team bar sits above the app tabbar — keep last-card actions scrollable.
   companion-hall.css uses padding-bottom !important on .companion-hall-page;
   this selector must be more specific so 加入一起下单 is not covered at 390px. */
html.mcj-team-bar-on main.companion-hall-page,
body:has(.mcj-team-bar) main.companion-hall-page {
  padding-bottom: calc(
    var(--mcj-bottom-actions-h, 64px) + var(--mcj-team-bar-h, 88px) + 36px + env(safe-area-inset-bottom, 0px)
  ) !important;
}
html.mcj-team-bar-on #playerList.companion-hall-grid,
body:has(.mcj-team-bar) #playerList.companion-hall-grid {
  padding-bottom: 24px;
}
@media (max-width: 430px) {
  html.mcj-team-bar-on main.companion-hall-page,
  body:has(.mcj-team-bar) main.companion-hall-page {
    padding-bottom: calc(
      var(--mcj-bottom-actions-h, 64px) + var(--mcj-team-bar-h, 96px) + 48px + env(safe-area-inset-bottom, 0px)
    ) !important;
  }
}

.mcj-team-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.mcj-team-secondary {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(243, 168, 203, 0.28);
  background: transparent;
  color: #ffd6e8;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.mcj-team-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.mcj-team-meta strong {
  display: block;
  font-size: 14px;
  color: #ffeaf4;
}
.mcj-team-meta span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: rgba(255, 214, 235, 0.7);
}

.mcj-team-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(243, 168, 203, 0.2);
  background: rgba(255, 143, 197, 0.06);
}
.mcj-team-summary-row {
  display: grid;
  gap: 2px;
  font-size: 13px;
  color: #ffdceb;
}
.mcj-team-summary-row strong {
  color: #fff;
}

.mcj-team-bar-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.mcj-team-avatars {
  display: flex;
  align-items: center;
  cursor: pointer;
}
.mcj-team-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 214, 235, 0.55);
  margin-left: -8px;
  background: #2a1a30;
}
.mcj-team-avatar:first-child {
  margin-left: 0;
}
.mcj-team-avatar-more {
  width: 32px;
  height: 32px;
  margin-left: -8px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #ffd6e8;
  background: rgba(243, 168, 203, 0.22);
  border: 2px solid rgba(255, 214, 235, 0.4);
}

.mcj-team-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.mcj-team-meta strong {
  font-size: 13px;
  color: #fff;
}
.mcj-team-meta span {
  font-size: 12px;
  color: rgba(255, 214, 235, 0.72);
}
.mcj-team-chevron {
  color: rgba(255, 214, 235, 0.55);
  font-size: 12px;
}

.mcj-team-checkout {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 143, 197, 0.55);
  background: rgba(255, 143, 197, 0.2);
  color: #ffe6f2;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.mcj-team-bar-panel {
  flex: 1 1 100%;
  display: grid;
  gap: 6px;
  max-height: 132px;
  overflow: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(243, 168, 203, 0.16);
}
.mcj-team-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #ffdceb;
}
.mcj-team-bar-row img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}
.mcj-team-bar-row span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mcj-team-bar-row em {
  font-style: normal;
  color: #fff;
  font-weight: 700;
}
.mcj-team-bar-row button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffd6e8;
  cursor: pointer;
}

/* Sheet */
.mcj-team-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(2, 1, 4, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding-top: env(safe-area-inset-top, 0px);
}
.mcj-team-sheet {
  width: 100%;
  max-width: 560px;
  max-height: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
  display: flex;
  flex-direction: column;
  border-radius: 28px 28px 0 0;
  border: 1px solid rgba(243, 168, 203, 0.28);
  border-bottom: 0;
  background: linear-gradient(180deg, rgba(30, 24, 36, 0.99), rgba(9, 8, 13, 0.99));
  color: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.mcj-team-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(243, 168, 203, 0.18);
}
.mcj-team-sheet-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}
.mcj-team-sheet-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #ffd6e8;
  font-size: 22px;
  cursor: pointer;
}
.mcj-team-sheet-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 24px;
  display: grid;
  gap: 12px;
}
.mcj-team-line {
  border: 1px solid rgba(243, 168, 203, 0.2);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 10px;
}
.mcj-team-line-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mcj-team-line-head img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.mcj-team-line-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin: 0;
}
.mcj-team-line-meta div {
  min-width: 0;
}
.mcj-team-line-meta dt {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 214, 235, 0.55);
}
.mcj-team-line-meta dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  overflow-wrap: anywhere;
}
.mcj-team-line-head strong {
  display: block;
  font-size: 14px;
}
.mcj-team-line-head span {
  font-size: 12px;
  color: rgba(255, 214, 235, 0.7);
}
.mcj-team-line-head em {
  font-style: normal;
  color: #fff;
  font-weight: 800;
}
.mcj-team-remove {
  margin-left: auto;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #ffd6e8;
  font-size: 12px;
  cursor: pointer;
}
.mcj-team-field {
  display: grid;
  gap: 6px;
}
.mcj-team-field > span {
  font-size: 12px;
  color: rgba(255, 214, 235, 0.65);
}
.mcj-team-field input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(243, 168, 203, 0.22);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  padding: 0 12px;
  /* Avoid iOS focus zoom (<16px). */
  font-size: 16px;
}
.mcj-team-id-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: rgba(255, 214, 235, 0.62);
}
.mcj-team-schedule-field .mcj-team-time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.mcj-team-time-start,
.mcj-team-time-end,
.mcj-team-time-col {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.mcj-team-time-cap {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 214, 231, 0.48);
}
.mcj-team-time-start .mcj-po-time-card,
.mcj-team-time-end .mcj-po-time-card {
  width: 100%;
}
.mcj-team-time-hint {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  color: rgba(255, 214, 231, 0.42);
}
@media (max-width: 520px) {
  .mcj-team-schedule-field .mcj-team-time-row {
    grid-template-columns: 1fr;
  }
}
.mcj-team-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mcj-team-chip {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(243, 168, 203, 0.22);
  background: rgba(255, 255, 255, 0.045);
  color: #ffdceb;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mcj-team-chip.active {
  border-color: rgba(255, 214, 235, 0.68);
  background: rgba(243, 168, 203, 0.16);
}
.mcj-team-chip-empty {
  font-size: 12px;
  color: rgba(255, 214, 231, 0.55);
}
.mcj-team-sheet-error {
  margin: 0 16px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 140, 0.45);
  background: rgba(80, 16, 28, 0.55);
  color: #ffd0d8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.mcj-team-pay-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 214, 235, 0.72);
  font-weight: 700;
}
.mcj-team-sheet-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: rgba(9, 8, 13, 0.98);
  /* 16px + safe-area so sticky CTA never sits under the home indicator. */
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(243, 168, 203, 0.18);
}
.mcj-team-sheet-total {
  flex: 1;
  font-size: 13px;
  color: rgba(255, 214, 235, 0.75);
}
.mcj-team-sheet-total strong {
  color: #fff;
  font-size: 16px;
}
.mcj-team-submit {
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 143, 197, 0.55);
  background: rgba(255, 143, 197, 0.22);
  color: #ffe6f2;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.mcj-team-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Hall secondary CTA */
.companion-card-action.team-add {
  background: transparent !important;
  border-color: rgba(255, 143, 197, 0.28) !important;
  color: #ffd6e8 !important;
  font-size: 12px !important;
}

@media (max-width: 430px) {
  .mcj-team-bar {
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 10px;
    gap: 6px;
  }
  .mcj-team-meta {
    min-width: 0;
    flex: 1 1 40%;
  }
  .mcj-team-meta strong,
  .mcj-team-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mcj-team-bar-actions {
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: stretch;
  }
  .mcj-team-secondary {
    flex: 0 0 auto;
  }
  .mcj-team-checkout {
    flex: 1 1 auto;
    min-width: 0;
  }
  .mcj-team-checkout,
  .mcj-team-secondary {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  /* Legacy row actions only — shared hot-card hall keeps column stack compact */
  .companion-card-actions:not(.mcj-hall-card-actions) {
    flex-wrap: wrap;
  }
  .companion-card-actions:not(.mcj-hall-card-actions) .companion-card-action.team-add {
    flex: 1 1 100%;
  }
}

/* Orders multi-group */
.order-multi-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(243, 168, 203, 0.35);
  background: rgba(243, 168, 203, 0.12);
  color: #ffd6e8;
  font-size: 12px;
  font-weight: 760;
}
.od-children {
  display: grid;
  gap: 10px;
}
.od-child-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(243, 168, 203, 0.2);
  background: rgba(255, 255, 255, 0.03);
}
.od-child-row strong {
  font-size: 14px;
}
.od-child-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 12px;
  color: rgba(255, 214, 235, 0.72);
}
.od-child-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mcj-team-voice-grid{display:grid;grid-template-columns:1fr;gap:8px}
.mcj-team-voice-card{
  display:grid;
  grid-template-columns:28px minmax(0,1fr);
  column-gap:10px;
  row-gap:2px;
  align-items:start;
  min-height:56px;
  text-align:left;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.1);
  background:rgba(255,255,255,.035);
  color:#ffdceb;
  cursor:pointer;
}
.mcj-team-voice-icon{
  grid-row:1 / span 2;
  align-self:center;
  width:28px;height:28px;
  display:inline-flex;align-items:center;justify-content:center;
  border-radius:8px;
  background:rgba(255,255,255,.05);
  font-size:14px;line-height:1;
}
.mcj-team-voice-title{font-size:14px;font-weight:650;line-height:1.3;color:rgba(255,248,252,.96)}
.mcj-team-voice-desc{font-size:12px;font-weight:400;line-height:1.4;color:rgba(255,214,231,.45)}
.mcj-team-voice-card.active{border-color:rgba(243,168,203,.45);background:rgba(243,168,203,.12)}
.mcj-team-voice-card.active .mcj-team-voice-icon{background:rgba(243,168,203,.18)}
/* legacy class kept for safety */
.mcj-team-voice{height:40px;border-radius:12px;border:1px solid rgba(243,168,203,.22);background:rgba(255,255,255,.045);color:#ffdceb;font-size:12px;font-weight:800;cursor:pointer}
.mcj-team-voice.active{border-color:rgba(243,168,203,.7);background:rgba(243,168,203,.16)}
