/* Guest window / staff card and the "Alles ophalen" coin button (M5 view, ui/guest-window.js).
   Phone: a bottom sheet over the bar (like the ride window); desktop (>= 900 px): a panel on the right.
   Tap targets >= 44 px, body text 16 px. Colours from the theme custom properties (game.css). */

/* ---------------------------------------------------------------- guest window */
.cp-guestwin {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  max-height: min(64vh, 520px);
  padding: 10px 12px calc(var(--cp-safe-b) + 10px);
  border-radius: 20px 20px 0 0;
  background: var(--cp-panel);
  box-shadow: 0 -4px 18px color-mix(in srgb, var(--cp-ink) 22%, transparent);
  pointer-events: auto;
}
.cp-guestwin[hidden] { display: none; }
.cp-guestwin__head { display: flex; align-items: center; gap: 10px; }
.cp-guestwin__avatar { flex: none; width: 48px; height: 48px; }
.cp-guestwin__avatar[hidden] { display: none; }
.cp-guestwin__roleicon {
  flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--cp-ice); color: var(--cp-ink);
}
.cp-guestwin__roleicon[hidden] { display: none; }
.cp-guestwin__titles { flex: 1 1 auto; min-width: 0; }
.cp-guestwin__name { margin: 0; font-size: 21px; font-weight: 900; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-guestwin__activity { margin: 2px 0 0; font-size: 16px; font-weight: 700; color: var(--cp-slate); line-height: 1.25; }
.cp-guestwin.is-gone .cp-guestwin__activity { color: var(--cp-bad); }
.cp-guestwin__close { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--cp-ice); display: grid; place-items: center; align-self: flex-start; }
.cp-guestwin__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 4px; }
.cp-guestwin__guest[hidden], .cp-guestwin__staff[hidden] { display: none; }
.cp-guestwin__thought {
  margin: 0 0 8px; padding: 6px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--cp-ice) 60%, var(--cp-white));
  font-size: 16px; font-weight: 700; line-height: 1.3;
}
.cp-guestwin__thought.is-none { font-weight: 600; color: var(--cp-slate); }

/* Needs and mood: two columns on phones, label above a thick bar. */
.cp-guestwin__meters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 8px; }
.cp-meter { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cp-meter__label { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-meter__track { position: relative; height: 12px; border-radius: 999px; background: var(--cp-ice); overflow: hidden; }
.cp-meter__fill {
  position: absolute; inset: 0; border-radius: 999px; transform-origin: 0 50%; transform: scaleX(0);
  background: var(--cp-ok); transition: transform 0.25s linear;
}
.cp-meter[data-tone="warn"] .cp-meter__fill { background: var(--cp-amber); }
.cp-meter[data-tone="bad"] .cp-meter__fill { background: var(--cp-bad); }

/* Facts: two label/value pairs per row on phones (keeps the sheet low), one per row on desktop. */
.cp-guestwin__facts { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 3px 10px; margin: 0; font-size: 16px; }
.cp-guestwin__facts dt { color: var(--cp-slate); }
.cp-guestwin__facts dt[hidden], .cp-guestwin__facts dd[hidden] { display: none; }
.cp-guestwin__facts dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
/* Staff card: longer values ("€ 0,65 per minuut"): one fact per row, also on phones. */
.cp-guestwin__staff .cp-guestwin__facts { grid-template-columns: auto 1fr; gap: 3px 12px; }
.cp-guestwin__actions { display: flex; gap: 8px; padding-top: 8px; }
.cp-guestwin__actions .cp-btn { flex: 1 1 auto; min-height: 44px; }
.cp-guestwin__actions .cp-btn[hidden] { display: none; }
.cp-guestwin__follow.is-on { background: var(--cp-accent2); color: var(--cp-white); }

/* ---------------------------------------------------------------- "Alles ophalen (n)" */
/* A HUD item (hud.addItem) that floats under the HUD row on the right, so it never squeezes the
   money pill or the other HUD items on a narrow phone. */
.cp-collect {
  position: absolute;
  top: calc(var(--cp-safe-t) + 60px);
  right: calc(var(--cp-safe-r) + 8px);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(#ffe27a, #ffc23a);
  color: #4a3200;
  box-shadow: var(--cp-shadow);
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: auto;
  animation: cp-collect-in 0.25s ease-out;
}
.cp-collect[hidden] { display: none; }
.cp-collect:active { transform: translateY(1px); }
@keyframes cp-collect-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------------------------------------------------------- desktop */
@media (min-width: 900px) {
  .cp-guestwin {
    left: auto;
    right: 12px;
    top: calc(var(--cp-safe-t) + 64px);
    bottom: auto;
    width: 360px;
    max-height: calc(100vh - 160px);
    border-radius: 20px;
    padding-bottom: 12px;
    box-shadow: var(--cp-shadow);
  }
  .cp-guestwin__facts { grid-template-columns: auto 1fr; gap: 3px 12px; }
  /* Desktop: room enough in the HUD row itself (between the money pill and the menu). */
  .cp-collect { position: static; flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-meter__fill { transition: none; }
  .cp-collect { animation: none; }
}
