/* Página de invitados de Pachanga. Colores tomados de Theme.swift. */
:root {
  --night: #12062e;
  --night-deep: #07031a;
  --surface: #1e1240;
  --surface-high: #2a1a55;
  --stroke: rgba(255, 255, 255, 0.08);
  --magenta: #ff3d9a;
  --cyan: #22e4ff;
  --yellow: #ffd23f;
  --lime: #7cf06b;
  --red: #ef5350;
  --text: #fff;
  --text-2: rgba(255, 255, 255, 0.7);
  --radius: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: radial-gradient(120% 80% at 50% 0%, var(--surface-high) 0%, var(--night) 55%, var(--night-deep) 100%) fixed;
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screen { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.center { align-items: center; text-align: center; justify-content: center; }
.grow { flex: 1; }

h1, h2 { font-weight: 900; margin: 0; line-height: 1.1; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
p { margin: 0; }
.muted { color: var(--text-2); font-size: 15px; }
.small { font-size: 13px; }

.icon { width: 84px; height: 84px; object-fit: contain; }
.icon.md { width: 44px; height: 44px; }
.icon.sm { width: 32px; height: 32px; }
.icon.xs { width: 24px; height: 24px; vertical-align: middle; }

.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px;
}
.card.high { background: var(--surface-high); }
.card.secret { background: color-mix(in srgb, var(--magenta) 55%, var(--surface)); }
.card.big { font-size: 22px; font-weight: 800; text-align: center; padding: 22px; white-space: pre-line; }
.lobby-game { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0; }
.lobby-game img { width: 64px; height: 64px; }
.lobby-game h2 { margin: 0; }
.lobby-game p { margin: 0; font-size: 15px; font-weight: 600; opacity: 0.92; }

button, .button {
  appearance: none;
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  font: inherit;
  font-weight: 800;
  color: var(--ink, #1a0b3d);
  background: var(--yellow);
  cursor: pointer;
  width: 100%;
  min-height: 54px;
  transition: transform 0.08s ease, opacity 0.2s;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; }
button.green { background: var(--lime); }
button.ghost { background: var(--surface-high); color: var(--text); border: 1px solid var(--stroke); }
.option { background: var(--surface-high); color: var(--text); text-align: left; font-weight: 700; border: 2px solid transparent; }
.option.chosen { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 22%, var(--surface-high)); }
.option.correct { border-color: var(--lime); background: color-mix(in srgb, var(--lime) 25%, var(--surface-high)); }
.option.wrong { border-color: var(--red); }

input, textarea {
  width: 100%;
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--surface-high);
  border: 2px solid var(--stroke);
  border-radius: 16px;
  padding: 14px 16px;
}
input:focus, textarea:focus { outline: none; border-color: var(--cyan); }
textarea { min-height: 120px; resize: none; }
label { font-weight: 700; font-size: 15px; color: var(--text-2); }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 900; font-size: 28px; text-align: center; }

.avatars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatars button { background: var(--surface-high); padding: 8px; min-height: 0; border: 2px solid transparent; }
.avatars button.chosen { border-color: var(--yellow); }
.avatars img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; display: block; }

.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.player { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 16px; font-weight: 700; min-width: 0; }
.player span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player.me { border-color: var(--yellow); }
.player.off { opacity: 0.45; }

.code-badge { font-size: 13px; font-weight: 800; letter-spacing: 0.2em; color: var(--text-2); }
.countdown { align-self: center; font-weight: 900; font-variant-numeric: tabular-nums; background: var(--surface-high); border-radius: 999px; padding: 6px 14px; font-size: 15px; }
.countdown.low { background: var(--red); }

.pending { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pending span { font-size: 13px; background: var(--surface); border-radius: 999px; padding: 4px 10px; color: var(--text-2); }

.entry { display: flex; flex-direction: column; gap: 6px; }
.entry-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.entry .text { font-weight: 800; font-size: 19px; overflow-wrap: anywhere; }
.points { color: var(--yellow); font-weight: 900; white-space: nowrap; }
.badge { align-self: flex-start; font-size: 12px; font-weight: 900; background: var(--magenta); border-radius: 999px; padding: 3px 9px; }

.scores { display: flex; flex-direction: column; gap: 8px; }
.score { display: flex; align-items: center; gap: 10px; }
.score .name { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .rank { width: 28px; text-align: center; font-weight: 900; color: var(--text-2); }

.lives { font-size: 20px; letter-spacing: 2px; }

.wheel-result { font-size: 26px; font-weight: 900; }
.spin { animation: spin 1.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes spin { from { transform: rotate(-720deg) scale(0.6); opacity: 0; } to { transform: rotate(0) scale(1); opacity: 1; } }

.now { font-size: 64px; font-weight: 900; color: var(--yellow); animation: pulse 0.6s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }

/* El Colado: animaciones de la instrucción (PartyGameVisuals.swift) */
.visual { position: relative; align-self: center; width: 100%; max-width: 300px; height: 190px; }
.visual .spy { position: absolute; top: -6px; right: -6px; width: 52px; height: 52px; transform: rotate(12deg); }
.v-point { position: absolute; inset: 0; }
.v-point .av { position: absolute; width: 36px; height: 36px; transform: translate(-50%, -50%); border-radius: 50%; transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1), box-shadow 0.2s; }
.v-point .av.on { transform: translate(-50%, -50%) scale(1.4); box-shadow: 0 0 0 3px var(--yellow); }
.v-point .finger { position: absolute; left: 50%; top: 50%; font-size: 66px; line-height: 1; transform: translate(-50%, -50%) rotate(var(--a, -90deg)); transition: transform 0.55s cubic-bezier(0.3, 1.5, 0.5, 1); }
.v-hands { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 14px; padding-bottom: 20px; }
.v-hands .col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.v-hands .hand { font-size: 34px; opacity: 0.25; transform: translateY(14px); transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), opacity 0.2s; }
.v-hands .col.up .hand { opacity: 1; transform: translateY(-18px) rotate(-8deg); }
.v-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.v-num .big { display: flex; align-items: center; gap: 18px; font-size: 84px; line-height: 1; transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
.v-num .big.bump { transform: scale(1.06); }
.v-num .digit { color: var(--yellow); font-weight: 900; font-variant-numeric: tabular-nums; }
.v-num .dots { display: flex; gap: 6px; }
.v-num .dots span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 900; background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.6); }
.v-num .dots span.on { background: var(--yellow); color: #1a0b3d; }
.v-face { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle, rgba(255, 210, 63, 0.35), transparent 55%); }
.v-face span { font-size: 110px; line-height: 1; transform: rotate(-8deg); }
.v-face span.tilt { transform: rotate(8deg); }
.v-face span.pop { animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { from { scale: 0.5; opacity: 0; } to { scale: 1; opacity: 1; } }
.v-burst { position: relative; align-self: center; width: 180px; height: 180px; display: grid; place-items: center; }
.v-burst i { position: absolute; inset: 0; border: 6px solid rgba(255, 61, 154, 0.6); border-radius: 50%; animation: ring 1.4s ease-out infinite; }
.v-burst i:nth-child(2) { animation-delay: 0.45s; }
.v-burst i:nth-child(3) { animation-delay: 0.9s; }
.v-burst b { font-size: 80px; animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes ring { from { transform: scale(0.4); opacity: 0.9; } to { transform: scale(1.6); opacity: 0; } }

/* Paridad con la app: reglas, hueco de Respuestazo, duelo, trivia, ruleta, castigo y marcador */
.rules { text-align: left; margin: 0; padding: 18px 18px 18px 46px; display: flex; flex-direction: column; gap: 10px; align-self: stretch; }
.rules li { font-weight: 600; }
.rules li::marker { color: var(--game); font-weight: 900; }
.fill { background: linear-gradient(135deg, var(--game), color-mix(in srgb, var(--game) 70%, var(--night))); }
.fill .blank { color: var(--yellow); text-decoration: underline; text-underline-offset: 4px; overflow-wrap: anywhere; }
.duel-pair { display: flex; flex-direction: column; align-items: center; }
button.duel { font-size: 22px; font-weight: 900; color: #fff; min-height: 120px; padding: 26px 20px; border-radius: 24px; border: 4px solid transparent; transition: transform 0.15s, opacity 0.2s; overflow-wrap: anywhere; }
button.duel.a { background: linear-gradient(135deg, #22B8E8, #1060C8); }
button.duel.b { background: linear-gradient(135deg, var(--magenta), #B0186E); }
button.duel.chosen { border-color: #fff; transform: scale(1.02); }
button.duel.dim { opacity: 0.6; }
.vs { width: 58px; height: 58px; margin: -14px 0; z-index: 1; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: #1a0b3d; font-weight: 900; font-size: 20px; border: 5px solid var(--night-deep); }
.category { align-self: center; font-size: 12px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: #1a0b3d; background: var(--yellow); border-radius: 999px; padding: 4px 12px; }
.marquee { border: 3px dashed color-mix(in srgb, var(--yellow) 60%, transparent); }
.option.answer { display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--answer) 30%, var(--surface-high)); border-color: color-mix(in srgb, var(--answer) 70%, transparent); }
.option.answer .letter { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--answer); color: #fff; font-weight: 900; }
button.option.answer.chosen { border-color: #fff; }
button.option.dim { opacity: 0.45; }
.appear { animation: appear 0.5s cubic-bezier(0.3, 1.3, 0.5, 1) both; }
@keyframes appear { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.score.compact { padding: 8px 12px; font-size: 15px; }
.score.loser { border-color: var(--magenta); }
.option.reveal { padding: 14px 16px; border-radius: 18px; border: 2px solid transparent; }
.option.reveal.correct { background: color-mix(in srgb, var(--lime) 30%, var(--surface-high)); border-color: var(--lime); }
.option.reveal.correct .letter { background: var(--lime); color: #1a0b3d; }
.option.reveal.wrong { opacity: 0.55; }
.option.reveal.wrong.mine { opacity: 1; border-color: var(--red); }
.targets { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.targets span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; font-weight: 800; }
.wheel-wrap { margin-top: 18px; position: relative; width: min(82vw, 320px); aspect-ratio: 1; align-self: center; }
.wheel { position: absolute; inset: 0; border-radius: 50%; border: 6px solid #fff; box-shadow: 0 0 0 4px var(--yellow), 0 12px 40px rgba(0, 0, 0, 0.45); animation: wheelspin 6.5s cubic-bezier(0.12, 0.8, 0.18, 1) both; }
@keyframes wheelspin { from { transform: rotate(0deg); } to { transform: rotate(var(--end)); } }
.wheel .slice { position: absolute; left: 50%; top: 0; height: 50%; width: 0; transform-origin: bottom center; display: flex; flex-direction: column; align-items: center; padding-top: 14px; gap: 2px; }
.wheel .slice img { width: 36px; height: 36px; }
.wheel .slice span { font-size: 10px; font-weight: 900; text-transform: uppercase; white-space: nowrap; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.pointer { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid var(--yellow); z-index: 2; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)); }
.wheel-result[hidden] { display: none; }
.wheel-result { animation: appear 0.5s cubic-bezier(0.3, 1.3, 0.5, 1) both; }
.bounce { animation: bounce 0.6s cubic-bezier(0.3, 1.8, 0.5, 1) both; }
@keyframes bounce { from { transform: scale(0.5); } to { transform: scale(1); } }
.category-title { font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--yellow); }
.sound-toggle { width: auto; min-height: 0; padding: 2px 6px; background: none; font-size: 18px; line-height: 1; }

.cta { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text); }
.cta img { width: 44px; height: 44px; border-radius: 10px; }

#banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 496px;
  margin: 0 auto;
  background: var(--magenta);
  color: #fff;
  font-weight: 800;
  text-align: center;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .spin, .now, .v-burst i, .v-burst b, .v-face span.pop, .appear, .bounce, .wheel-result { animation: none; }
  .wheel { animation-duration: 0.01s; }
  .v-point .av, .v-point .finger, .v-hands .hand, .v-num .big { transition: none; }
}
button.duel:disabled { opacity: 0.85; }

/* El Impostor: palabra, categoría y turnos de pistas. */
.caption { margin: 0; font-size: 13px; font-weight: 900; letter-spacing: 0.15em; color: var(--text-2); }
.word-card { align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 18px;
  border-radius: var(--radius); background: color-mix(in srgb, var(--magenta) 35%, var(--surface)); }
.word-card.large { gap: 14px; padding: 28px 18px; background: color-mix(in srgb, var(--magenta) 55%, var(--surface)); }
.word-card .word { font-size: 26px; font-weight: 900; text-align: center; line-height: 1.1; overflow-wrap: anywhere; }
.word-card.large .word { font-size: 44px; }
.word-card .word.unknown { color: var(--text-2); }
.word-card .category { background: var(--yellow); color: #1a0b3d; border-radius: 999px; padding: 5px 12px; font-size: 15px; font-weight: 600; letter-spacing: normal; text-transform: none; }
.word-card .category b { font-weight: 900; }
.speaker { align-self: center; border-radius: 50%; padding: 8px; background: rgba(255, 255, 255, 0.08); box-shadow: 0 0 0 4px var(--cyan); }
.speaker.mine { box-shadow: 0 0 0 4px var(--yellow); }
.speaker .icon { width: 72px; height: 72px; }
.turns { display: flex; gap: 10px; overflow-x: auto; align-self: stretch; justify-content: center; padding: 4px 0; }
.turn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; font-size: 12px; font-weight: 700; }
.turn span { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn.done { opacity: 0.4; }
.turn.now span { color: var(--yellow); }
