/* Wrapped Party. Builds on styles.css (tokens, .btn, .input, .landing-card,
   .slide/.rise/.pop animations); everything here is prefixed .pt-. */

/* ---------- Home ---------- */
.pt-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 16px;
  border-radius: 999px; background: rgba(253, 251, 244, 0.1);
}
.pt-tab {
  border: 0; border-radius: 999px; padding: 10px 12px; cursor: pointer;
  background: transparent; color: var(--paper); font-weight: 800; font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.pt-tab[aria-selected="true"] { background: var(--paper); color: var(--ink); }
.pt-tab:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.pt-code-input { text-transform: uppercase; letter-spacing: 0.3em; font-size: 1.5rem; font-weight: 900; }
.pt-code-input::placeholder { letter-spacing: normal; font-size: 1.1rem; font-weight: 700; text-transform: none; }
.fine a { font-weight: 700; }

/* ---------- Lobby ---------- */
.pt-lobby { overflow-y: auto; overflow-x: hidden; padding: 16px; place-items: start center; }
.pt-lobby-card {
  position: relative; width: min(480px, 100%); margin: auto 0; padding: 20px 22px 24px;
  border-radius: 28px; background: rgba(18, 15, 43, 0.86); backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); text-align: center;
}
.pt-lobby-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.pt-back { font-weight: 800; font-size: 0.85rem; text-decoration: none; opacity: 0.75; }
.pt-back::before { content: "← "; }
.pt-back:hover { opacity: 1; }
.pt-link-btn { border: 0; background: none; color: inherit; font-weight: 800; font-size: 0.85rem; opacity: 0.75; cursor: pointer; padding: 6px 2px; }
.pt-link-btn:hover { opacity: 1; text-decoration: underline; }
.pt-room-code {
  margin: 2px 0 0; font-size: clamp(3.6rem, 19vw, 5.6rem); font-weight: 900; letter-spacing: 0.08em; line-height: 1;
  background: linear-gradient(100deg, var(--lime), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pt-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.pt-period {
  display: inline-block; margin: 10px 0 16px; padding: 5px 12px; border-radius: 999px;
  background: var(--pink); color: var(--ink); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.pt-share { display: flex; gap: 8px; }
.pt-share-link {
  flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; border: 2px solid rgba(253, 251, 244, 0.18);
  background: rgba(253, 251, 244, 0.06); color: var(--paper); font-weight: 600; font-size: 0.9rem; outline: none;
}
.pt-share-link:focus { border-color: var(--lime); }
.pt-copy { padding: 12px 18px; font-size: 0.95rem; white-space: nowrap; }
.pt-members-title { margin: 22px 0 10px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.7; font-weight: 800; }
.pt-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.pt-member {
  display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 18px; background: rgba(253, 251, 244, 0.07);
  animation: pt-in 0.5s cubic-bezier(0.2, 1.2, 0.4, 1);
  transition: opacity 0.3s;
}
.pt-member.pt-offline { opacity: 0.5; }
.pt-member .pt-avatar { width: 52px; height: 52px; }
.pt-member-text { min-width: 0; line-height: 1.35; }
.pt-member-text b { font-size: 1.1rem; font-weight: 800; overflow-wrap: anywhere; }
.pt-badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; vertical-align: 2px;
  background: var(--yellow); color: var(--ink); font-size: 0.68rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em;
}
.pt-badge.pt-you { background: var(--cyan); }
.pt-status { font-size: 0.85rem; font-weight: 700; opacity: 0.75; }
.pt-ready { color: var(--lime); opacity: 1; }
.pt-ready::before { content: "✓ "; }
.pt-building i {
  display: inline-block; width: 4px; height: 12px; margin-right: 2px; border-radius: 2px; vertical-align: -1px;
  background: var(--pink); animation: pt-eq 0.8s ease-in-out infinite alternate;
}
.pt-building i:nth-child(2) { background: var(--cyan); animation-delay: -0.3s; }
.pt-building i:nth-child(3) { background: var(--yellow); animation-delay: -0.55s; margin-right: 6px; }
@keyframes pt-eq { from { transform: scaleY(0.3); } to { transform: scaleY(1); } }
.pt-lobby-foot { display: grid; gap: 10px; margin-top: 20px; }
.pt-lobby-foot .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.pt-wait { margin: 0; font-weight: 700; opacity: 0.8; line-height: 1.4; }

/* Avatars and lettered tiles */
.pt-avatar { display: block; border-radius: 50%; object-fit: cover; background: rgba(0, 0, 0, 0.2); flex: none; }
.pt-tile {
  display: grid; place-items: center; font-weight: 900; color: var(--ink); background: var(--c, var(--lime));
  font-size: 1.3rem; line-height: 1;
}

/* ---------- Reveal stage ---------- */
.pt-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }
@media (min-width: 600px) and (min-height: 600px) {
  .pt-stage {
    height: min(94vh, 920px); width: auto; aspect-ratio: 9 / 16;
    border-radius: 24px; box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  }
}
.pt-progress { pointer-events: none; }
.pt-seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.pt-seg span { display: block; height: 100%; width: 0; background: #fff; transition: width 0.5s ease; }
.pt-seg.on span { width: 100%; }
.pt-card-wrap { position: absolute; inset: 0; }
.pt-card {
  padding: 56px 24px 112px; justify-content: safe center; overflow-y: auto; overflow-x: hidden;
  animation: pt-card-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pt-card-in { from { transform: scale(1.06); opacity: 0; } }
@keyframes pt-in { from { transform: scale(0.85); opacity: 0; } }
.pt-controls {
  position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; padding: 16px 20px max(18px, env(safe-area-inset-bottom));
  display: grid; justify-items: center; gap: 6px; pointer-events: none;
}
.pt-next { pointer-events: auto; min-width: 200px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); font-size: 1.15rem; }
.pt-host-note { margin: 0; font-size: 0.8rem; font-weight: 700; opacity: 0.85; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }

/* Decorative shapes, coloured per card */
.pt-shape-a { width: 70cqi; aspect-ratio: 1; right: -24cqi; top: -18cqi; background: var(--c); opacity: 0.55; }
.pt-shape-b { width: 90cqi; aspect-ratio: 1; left: -40cqi; bottom: -30cqi; border-radius: 50%; }
.pt-hi { background: var(--fg); color: var(--bg); padding: 0 6px; border-radius: 6px; }

/* Ranking (countdown) */
.pt-rank { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.pt-row {
  position: relative; display: grid; grid-template-columns: 1.6ch 44px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 12px 8px 10px; border-radius: 16px; overflow: hidden; background: rgba(0, 0, 0, 0.14);
}
.pt-row > :not(.pt-bar) { position: relative; }
.pt-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, 0.14); transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.slide.active .pt-row .pt-bar { animation: pt-bar 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; animation-delay: calc(var(--d, 0s) + 0.2s); }
@keyframes pt-bar { to { width: var(--w); } }
.pt-row .pt-avatar { width: 44px; height: 44px; font-size: 1.1rem; }
.pt-n { font-weight: 900; font-size: 1.3rem; }
.pt-who { min-width: 0; }
.pt-who b, .pt-who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-who b { font-weight: 800; font-size: 1.05rem; }
.pt-who small { font-weight: 600; font-size: 0.8rem; opacity: 0.75; }
.pt-val { font-weight: 900; font-size: 1.25rem; font-variant-numeric: tabular-nums; text-align: right; letter-spacing: -0.02em; }
.pt-val small { display: block; font-size: 0.7rem; font-weight: 700; opacity: 0.7; letter-spacing: 0.04em; text-transform: uppercase; }
.pt-win { background: var(--fg); color: var(--bg); transform-origin: 30% 50%; }
.pt-win .pt-bar { background: rgba(255, 255, 255, 0.12); }
.pt-verdict { font-weight: 800; }

/* Biggest fan */
.pt-fan-art { position: relative; align-self: center; margin: 14px 0 18px; }
.pt-fan-img { display: block; width: min(56cqi, 250px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); background: rgba(0, 0, 0, 0.15); }
.pt-fan-img.pt-tile { font-size: min(24cqi, 110px); background: var(--fg); color: var(--bg); }
.pt-fan-face { position: absolute; right: -6px; bottom: -6px; width: 30%; height: 30%; border: 4px solid var(--bg); }
.pt-mini { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 4px; font-weight: 600; opacity: 0.85; font-size: 0.95rem; }
.pt-mini b { font-weight: 900; }

/* Taste match */
.pt-duo { display: flex; justify-content: center; margin: 10px 0 6px; }
.pt-duo > span + span { margin-left: -18px; }
.pt-duo-face { width: min(30cqi, 120px); height: min(30cqi, 120px); border: 5px solid var(--bg); font-size: 2.6rem; }
.pt-score { text-align: center; }
.pt-names { text-align: center; font-size: clamp(1.6rem, 9cqi, 3rem); }
.pt-kind-match .sub { text-align: center; }
.pt-kind-match .pt-mini { text-align: center; }

/* Everyone's #1 */
.pt-grid-title { font-size: clamp(2rem, 11cqi, 3.6rem); }
.pt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.pt-grid-1 { grid-template-columns: 1fr; }
.pt-grid-3 .pt-tile-card:first-child, .pt-grid-5 .pt-tile-card:first-child, .pt-grid-7 .pt-tile-card:first-child { grid-column: span 2; }
.pt-grid-3 .pt-tile-card:first-child .pt-grid-img, .pt-grid-5 .pt-tile-card:first-child .pt-grid-img, .pt-grid-7 .pt-tile-card:first-child .pt-grid-img { aspect-ratio: 2; }
.pt-tile-card { margin: 0; min-width: 0; }
.pt-grid-img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: rgba(0, 0, 0, 0.15); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
.pt-grid-img.pt-tile { font-size: 2.4rem; background: var(--fg); color: var(--bg); }
.pt-tile-card figcaption { margin-top: 6px; min-width: 0; }
.pt-tile-card b { display: block; font-weight: 900; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-tile-card small { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.82rem; opacity: 0.8; min-width: 0; }
.pt-mini-face { width: 22px; height: 22px; font-size: 0.7rem; }

/* Finale */
.pt-finale-tag { background: var(--lime); color: var(--ink); }
.pt-finale-num { color: var(--lime); font-size: clamp(2.8rem, 20cqi, 6.5rem); font-variant-numeric: tabular-nums; }
.pt-kind-finale .kicker { margin: 8px 0 0; }
.pt-finale-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pt-finale-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pt-finale-list .pt-mini-face { width: 34px; height: 34px; font-size: 0.95rem; }
.pt-finale-list span { min-width: 0; }
.pt-finale-list b, .pt-finale-list small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-finale-list b { font-weight: 800; }
.pt-finale-list small { font-size: 0.78rem; opacity: 0.7; font-weight: 600; }
.pt-finale-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; position: relative; z-index: 15; }
.pt-finale-actions .btn { flex: 1 1 auto; padding: 13px 18px; font-size: 0.95rem; text-decoration: none; }

/* Toast */
.pt-toast {
  position: fixed; z-index: 60; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  margin: 0; padding: 10px 18px; border-radius: 999px; background: var(--paper); color: var(--ink);
  font-weight: 800; font-size: 0.9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); max-width: calc(100% - 32px); text-align: center;
}
