/* ========================================================
   LOOPHOLE ARCADE // PARTY BOX
   The party pill in the header, its dropdown, the invite sheet
   and the "party is heading to…" card. Uses the shared theme tokens.
   ======================================================== */

/* The hub's theme tokens, repeated here so the party box looks the same inside games
   that have their own stylesheet. */
.party, .pp-sheet, .pp-launch {
  --tc-bg-canvas: #1b1c1f;
  --tc-bg-surface: #232428;
  --tc-bg-card: #2a2b30;
  --tc-bg-card-hover: #313238;
  --tc-bg-pill: #34353b;
  --tc-bg-input: #202125;
  --tc-border-subtle: rgba(255, 255, 255, 0.07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.3), 0 24px 56px rgba(0, 0, 0, 0.38);
  --tc-accent-mint: #4fc9a8;
  --tc-accent-yellow: #f0b54d;
  --tc-text-main: #ececee;
  --tc-text-muted: #a4a6ae;
  --tc-text-dim: #74767f;
  --tc-text-dark: #17181b;
  --font-mono: 'JetBrains Mono', monospace;
  font-family: 'Manrope', 'Inter', system-ui, sans-serif;
  text-align: left;
  user-select: text;
}

/* Smaller pill for a game's top bar. */
.party-compact .pp-pill { height: 36px; padding: 0 12px 0 10px; font-size: 13px; }

.site-header .lf-nav-deck { margin-left: auto; }

.party {
  position: relative;
  flex-shrink: 0;
}

.party[hidden] { display: none; }

/* ---------- Pill ---------- */
.pp-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 12px;
  border: none;
  border-radius: 999px;
  background: var(--tc-bg-surface);
  color: var(--tc-text-main);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.pp-pill:hover,
.pp-pill.open {
  background: var(--tc-bg-card-hover);
  box-shadow: var(--shadow-md);
}

.pp-pill > svg { color: var(--tc-text-muted); }

.pp-pill-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--tc-text-muted);
  background: var(--tc-bg-pill);
  border-radius: 999px;
  padding: 2px 8px;
}

.pp-stackwrap {
  display: inline-flex;
  padding-left: 6px;
}

.pp-stack {
  margin-left: -6px;
  box-shadow: 0 0 0 2px var(--tc-bg-surface);
}

.pp-pill:hover .pp-stack,
.pp-pill.open .pp-stack { box-shadow: 0 0 0 2px var(--tc-bg-card-hover); }

.pp-ping {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc-accent-yellow);
  box-shadow: 0 0 0 2px var(--tc-bg-surface);
  animation: ppPulse 1.6s ease-in-out infinite;
}

@keyframes ppPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

/* ---------- Avatars ---------- */
.pp-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--tc-bg-pill);
  color: #fff;
  font-weight: 800;
  line-height: 1;
}

.pp-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pp-avatar-wrap {
  position: relative;
  display: inline-flex;
}

.pp-presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tc-text-dim);
  box-shadow: 0 0 0 2px var(--tc-bg-card);
}

.pp-presence.on { background: var(--tc-accent-mint); }

/* ---------- Dropdown ---------- */
.pp-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: 330px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  border-radius: 16px;
  background: var(--tc-bg-card);
  border: 1px solid var(--tc-border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform-origin: top right;
}

.pp-pop-enter { animation: ppPop 0.18s ease-out; }

@keyframes ppPop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.pp-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pp-title {
  font-size: 15px;
  font-weight: 800;
}

.pp-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--tc-accent-yellow);
}

.pp-code {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 5px 9px;
  background: var(--tc-bg-pill);
  color: var(--tc-text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.pp-code:hover { color: var(--tc-text-main); background: #3c3d44; }

.pp-text {
  font-size: 13.5px;
  color: var(--tc-text-muted);
  line-height: 1.5;
}

.pp-text strong { color: var(--tc-text-main); }

.pp-hint {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--tc-bg-surface);
  font-size: 13px;
}

.pp-loading { padding: 6px 0; }

.pp-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tc-text-dim);
}

.pp-note {
  font-size: 12.5px;
  color: var(--tc-text-dim);
  text-align: center;
}

.pp-error {
  margin-top: -6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #f19a9a;
}

/* Who you are */
.pp-me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--tc-bg-surface);
}

.pp-me-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.pp-me-text strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-discord-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5865f2;
}

.pp-name-input {
  width: 100%;
  border: none;
  border-radius: 7px;
  padding: 3px 7px;
  margin-left: -7px;
  background: transparent;
  color: var(--tc-text-main);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  transition: background-color 0.2s ease;
}

.pp-name-input:hover,
.pp-name-input:focus { background: var(--tc-bg-input); outline: none; }

/* Buttons */
.pp-actions,
.pp-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.pp-btn:disabled { opacity: 0.55; cursor: default; }

.pp-btn-primary {
  background: var(--tc-accent-yellow);
  color: var(--tc-text-dark);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 8px 20px rgba(240, 181, 77, 0.16);
}

.pp-btn-primary:hover:not(:disabled) { background: #f5c265; }

.pp-btn-discord {
  background: #5865f2;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 8px 20px rgba(88, 101, 242, 0.2);
}

.pp-btn-discord:hover { background: #4752c4; }

.pp-btn-quiet {
  background: var(--tc-bg-pill);
  color: var(--tc-text-main);
}

.pp-btn-quiet:hover { background: #3c3d44; }

.pp-btn-ghost {
  background: transparent;
  color: var(--tc-text-muted);
}

.pp-btn-ghost:hover { color: var(--tc-text-main); background: var(--tc-bg-surface); }

.pp-btn-sm { padding: 7px 12px; font-size: 13px; }

.pp-link {
  border: none;
  background: none;
  padding: 4px 2px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tc-text-dim);
  cursor: pointer;
  transition: color 0.2s ease;
}

.pp-link:hover { color: var(--tc-text-main); }
.pp-link-danger:hover { color: #f19a9a; }

/* Join with a code */
.pp-join {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--tc-border-subtle);
}

.pp-code-input,
.pp-link-input {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 12px;
  background: var(--tc-bg-input);
  color: var(--tc-text-main);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.pp-code-input {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pp-code-input::placeholder {
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--tc-text-dim);
}

.pp-code-input:focus,
.pp-link-input:focus { outline: none; border-color: rgba(240, 181, 77, 0.55); }

/* Members */
.pp-members {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 -6px;
}

.pp-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 10px;
  transition: background-color 0.2s ease;
}

.pp-member:hover { background: var(--tc-bg-surface); }
.pp-member.away .pp-avatar { opacity: 0.55; }

.pp-member-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-name-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-you { color: var(--tc-text-dim); font-weight: 600; }

.pp-crown { display: inline-flex; color: var(--tc-accent-yellow); }

.pp-tools {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.pp-member:hover .pp-tools,
.pp-member:focus-within .pp-tools { opacity: 1; }

@media (hover: none) { .pp-tools { opacity: 1; } }

.pp-tool {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tc-text-dim);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.pp-tool:hover { background: var(--tc-bg-pill); color: var(--tc-accent-yellow); }
.pp-tool-danger:hover { color: #f19a9a; }

.pp-invite-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: transparent;
  color: var(--tc-text-muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.pp-invite-row:hover {
  border-color: rgba(240, 181, 77, 0.6);
  color: var(--tc-accent-yellow);
  background: rgba(240, 181, 77, 0.05);
}

.pp-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.pp-foot .pp-link { align-self: center; }

/* Invite prompt */
.pp-invite-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(240, 181, 77, 0.08);
  box-shadow: inset 0 0 0 1px rgba(240, 181, 77, 0.22);
  font-size: 14px;
  line-height: 1.4;
}

.pp-invite-card strong { color: var(--tc-accent-yellow); }

.pp-invite-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(240, 181, 77, 0.16);
  color: var(--tc-accent-yellow);
}

/* ---------- Invite sheet ---------- */
.pp-sheet {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pp-sheet.show { opacity: 1; }

.pp-sheet-card {
  position: relative;
  width: 420px;
  max-width: 100%;
  padding: 24px;
  border-radius: 18px;
  background: var(--tc-bg-card);
  border: 1px solid var(--tc-border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.pp-sheet.show .pp-sheet-card { transform: none; }

.pp-sheet-title { font-size: 19px; font-weight: 800; }

.pp-sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--tc-bg-pill);
  color: var(--tc-text-muted);
  cursor: pointer;
}

.pp-sheet-close:hover { color: var(--tc-text-main); }

/* A look-alike of the card Discord shows for the link */
.pp-embed {
  display: flex;
  gap: 14px;
  padding: 12px 14px 14px 12px;
  border-radius: 6px;
  border-left: 4px solid var(--tc-accent-yellow);
  background: #2b2d31;
  font-family: 'gg sans', 'Noto Sans', system-ui, sans-serif;
}

.pp-embed-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.pp-embed-site { font-size: 12px; color: #b5bac1; }
.pp-embed-title { font-size: 15px; font-weight: 700; color: #00a8fc; line-height: 1.3; }
.pp-embed-desc { font-size: 13.5px; color: #dbdee1; line-height: 1.4; }

.pp-embed-thumb {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: cover;
}

.pp-link-row { display: flex; gap: 8px; }

.pp-link-input {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--tc-text-muted);
}

/* ---------- "The party is heading to…" ---------- */
.pp-launch {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 1600;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 460px;
  max-width: calc(100vw - 32px);
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  background: var(--tc-bg-card-hover);
  border: 1px solid var(--tc-border-subtle);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -12px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.pp-launch.show { transform: translate(-50%, 0); opacity: 1; }

.pp-launch-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
  font-size: 14px;
  line-height: 1.35;
}

.pp-launch-bar {
  display: block;
  height: 3px;
  margin-top: 4px;
  border-radius: 3px;
  background: var(--tc-bg-pill);
  overflow: hidden;
}

.pp-launch-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--tc-accent-yellow);
  transform-origin: left;
  animation: ppCountdown 3s linear forwards;
}

@keyframes ppCountdown {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.pp-launch-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Party tag on game cards */
.card-party-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(23, 24, 27, 0.82);
  color: var(--tc-accent-yellow);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

/* ---------- Phones ---------- */
@media (max-width: 680px) {
  .party { order: 2; margin-left: auto; }
  .site-header .lf-nav-deck { order: 3; margin-left: 0; }
  .pp-pill { height: 40px; padding: 0 12px 0 10px; }
  .pp-pop { position: fixed; top: 70px; left: 16px; right: 16px; width: auto; max-width: none; }
  .pp-launch { flex-wrap: wrap; }
  .pp-launch-actions { flex-direction: row; margin-left: 46px; }
}
