:root {
  --bg-1: #09091f;
  --bg-2: #16103a;
  --card-bg: rgba(12, 18, 45, 0.92);
  --card-border: rgba(135, 148, 255, 0.22);
  --text-main: #f6f8ff;
  --text-soft: #c8cdf0;
  --text-strong: #ffffff;
  --accent-1: #8b5cf6;
  --accent-2: #19d7f0;
  --accent-3: #f7e70b;
  --ok: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 20px 48px rgba(5, 9, 25, 0.5);
  --radius: 24px;
  --gap: 1rem;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body.trivia-body {
  min-height: 100vh;
  color: var(--text-main);
  background:
    radial-gradient(circle at 15% 3%, rgba(139, 92, 246, 0.38), transparent 34%),
    radial-gradient(circle at 92% 18%, rgba(25, 215, 240, 0.26), transparent 30%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2) 52%, #09091f);
}

.trivia-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: start;
  gap: 0;
  animation: fadeIn 300ms ease;
}

.trivia-hero {
  position: relative;
  min-height: clamp(340px, 62vh, 600px);
  overflow: hidden;
  isolation: isolate;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 7.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.trivia-hero__image,
.trivia-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.trivia-hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% center;
}

.trivia-hero__scrim {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7, 9, 24, 0.18), rgba(7, 9, 24, 0.52) 48%, rgba(9, 9, 31, 0.96)),
    linear-gradient(90deg, rgba(9, 9, 31, 0.5), rgba(9, 9, 31, 0.08) 54%, rgba(9, 9, 31, 0.56));
}

.trivia-hero__content {
  display: grid;
  gap: 0.8rem;
  width: min(520px, 100%);
  margin-top: auto;
}

.trivia-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  width: max-content;
  max-width: 100%;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  font-size: clamp(2.3rem, 14vw, 5.2rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.trivia-logo__mark {
  width: clamp(58px, 17vw, 96px);
  aspect-ratio: 1;
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(25, 215, 240, 0.3);
}

.trivia-subtitle {
  margin: 0;
  width: min(340px, 100%);
  color: #eef2ff;
  font-size: clamp(1.02rem, 4.3vw, 1.3rem);
  line-height: 1.25;
  font-weight: 800;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.52);
}

.trivia-auth-links {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.trivia-login-link,
.trivia-logout {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(12px);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.trivia-main {
  display: grid;
  gap: var(--gap);
  width: min(1120px, 100%);
  margin: -5.7rem auto 0;
  padding: 0 1rem max(2rem, env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.trivia-grid {
  display: grid;
  gap: var(--gap);
  align-items: start;
}

.trivia-card {
  border-radius: var(--radius);
  padding: 1.05rem;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.trivia-card--join {
  position: relative;
  overflow: hidden;
  border: 0;
  padding: 1.15rem;
  background:
    linear-gradient(155deg, rgba(18, 24, 58, 0.98), rgba(13, 19, 43, 0.96)),
    radial-gradient(circle at 90% 10%, rgba(25, 215, 240, 0.3), transparent 36%);
}

.trivia-card--join::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, #8b5cf6, #19d7f0, #f7e70b);
  height: 5px;
}

.trivia-card--host {
  background: rgba(13, 18, 42, 0.72);
}

.trivia-card__title {
  margin: 0;
  font-size: clamp(1.32rem, 7vw, 2.1rem);
  line-height: 1.05;
  color: var(--text-strong);
}

.trivia-card--host .trivia-card__title {
  font-size: clamp(1.1rem, 4.5vw, 1.35rem);
}

.trivia-card__copy,
.trivia-mini,
.trivia-feedback {
  margin: 0.5rem 0;
  color: var(--text-soft);
  line-height: 1.45;
}

.trivia-feedback {
  min-height: 1.2em;
}

.trivia-feedback--info {
  display: grid;
  gap: 0.65rem;
  color: #c7d2fe;
  min-height: 0;
}

.trivia-feedback--info a {
  width: max-content;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  color: #07111f;
  background: #f7e70b;
  text-decoration: none;
  font-weight: 900;
}

.trivia-feedback--error {
  color: var(--danger);
}

.trivia-feedback--ok {
  color: var(--ok);
}

.trivia-feedback--warning {
  color: var(--warning);
}

.trivia-form {
  display: grid;
  gap: 0.82rem;
}

.trivia-field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.trivia-field > span {
  color: #f3f6ff;
  font-weight: 900;
  font-size: 0.95rem;
}

.trivia-field input,
.trivia-field select {
  border: 1px solid rgba(173, 186, 255, 0.2);
  background: rgba(8, 14, 34, 0.76);
  color: #f8fafc;
  border-radius: 18px;
  min-height: 58px;
  padding: 0.88rem 1rem;
  font-size: 1.05rem;
  font-family: inherit;
  width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.trivia-card--join .trivia-field input {
  min-height: 62px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.96);
  color: #141525;
  font-weight: 900;
}

.trivia-card--join .trivia-field input::placeholder {
  color: #7f8497;
  font-weight: 800;
}

.trivia-field input:focus,
.trivia-field select:focus,
.trivia-answer-option:focus {
  outline: 2px solid rgba(126, 196, 255, 0.7);
  outline-offset: 2px;
}

.trivia-questions {
  display: grid;
  gap: 0.8rem;
}

.trivia-question-card {
  border: 1px dashed rgba(146, 166, 233, 0.45);
  border-radius: 14px;
  padding: 0.75rem;
  display: grid;
  gap: 0.65rem;
  animation: popIn 180ms ease;
}

.trivia-question-top {
  display: grid;
  gap: 0.65rem;
}

.trivia-options {
  display: grid;
  gap: 0.45rem;
}

.trivia-option-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.trivia-option-row input[type="text"] {
  flex: 1;
}

.trivia-option-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 95px;
  color: #dbeafe;
}

.trivia-question-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.trivia-question-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.trivia-button {
  border: 0;
  font-family: inherit;
  border-radius: 18px;
  min-height: 52px;
  padding: 0.82rem 1rem;
  font-weight: 900;
  font-size: 1.03rem;
  cursor: pointer;
  transition: transform 120ms ease;
  background: linear-gradient(120deg, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 12px 24px rgba(25, 215, 240, 0.18);
}

.trivia-button:hover {
  transform: translateY(-1px);
}

.trivia-button:active {
  transform: translateY(0);
}

.trivia-button--ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: none;
}

.trivia-room-head {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.trivia-share-panel {
  display: grid;
  gap: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  padding: 0.8rem;
  margin-bottom: 0.85rem;
  background: rgba(15, 23, 42, 0.68);
}

.trivia-pin {
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin: 0;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.trivia-qr {
  width: 130px;
  height: 130px;
  justify-self: start;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: #f8fafc;
}

.trivia-share-actions {
  display: grid;
  gap: 0.55rem;
}

.trivia-share-label {
  margin: 0;
  color: #9db1ff;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.trivia-timer-wrap {
  margin-bottom: 0.8rem;
}

.trivia-timer-bar {
  position: relative;
  border-radius: 999px;
  height: 10px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.trivia-timer-bar span {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-1));
  transition: width 120ms linear;
}

.trivia-question-area {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.5rem;
}

.trivia-question-text {
  margin: 0;
  line-height: 1.35;
  color: #e2e8f0;
}

.trivia-answer-options {
  display: grid;
  gap: 0.55rem;
}

.trivia-answer-option {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid rgba(124, 58, 237, 0.6);
  border-radius: 12px;
  min-height: 52px;
  background: rgba(30, 41, 59, 0.7);
  color: #fff;
  padding: 0.6rem 0.75rem;
  text-align: left;
  cursor: pointer;
}

.trivia-answer-option__label {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
}

.trivia-answer-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(148, 163, 184, 0.28);
  z-index: 0;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.trivia-answer-count {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  font-weight: 800;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  min-width: 1.6rem;
  text-align: center;
}

.trivia-answer-mark {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  font-weight: 900;
  color: #34d399;
}

.trivia-answer-option--correct {
  border-color: rgba(34, 197, 94, 0.85);
  background: rgba(16, 185, 129, 0.18);
}

.trivia-answer-option--correct .trivia-answer-bar {
  background: rgba(16, 185, 129, 0.3);
}

.trivia-answer-option--wrong {
  border-color: rgba(244, 63, 94, 0.8);
  background: rgba(244, 63, 94, 0.16);
}

.trivia-answer-option--wrong .trivia-answer-bar {
  background: rgba(244, 63, 94, 0.28);
}

.trivia-answer-option--yours {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.85) inset;
}

.trivia-answer-option[disabled] {
  opacity: 0.92;
  cursor: not-allowed;
}

.trivia-answer-options--reveal .trivia-answer-option {
  cursor: default;
}

.trivia-host-actions,
.trivia-ranking {
  margin-top: 0.8rem;
}

.trivia-subtitle-block {
  margin: 0.4rem 0;
  color: #e2e8f0;
}

.trivia-ranking {
  display: grid;
  gap: 0.5rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.45);
  padding-top: 0.7rem;
}

.trivia-ranking-item {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: rgba(30, 41, 59, 0.58);
}

.trivia-ranking-item strong {
  color: #f8fafc;
  font-size: 1rem;
}

.trivia-ranking-item span {
  color: #9ca3af;
}

.trivia-active-games {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.45);
}

.trivia-active-games__list {
  display: grid;
  gap: 0.5rem;
}

.trivia-active-game {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: rgba(30, 41, 59, 0.58);
}

.trivia-active-game__info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.trivia-active-game__info strong {
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trivia-active-game .trivia-button {
  flex: 0 0 auto;
  width: auto;
}

.trivia-podium {
  margin-top: 1rem;
  padding: 0.6rem 0.4rem 0.2rem;
  animation: fadeIn 0.4s ease both;
}

.trivia-podium__row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.7rem;
  min-height: 200px;
  margin-top: 0.6rem;
}

.trivia-podium__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 0;
  max-width: 130px;
  gap: 0.35rem;
}

.trivia-podium__name {
  color: #f8fafc;
  font-size: 0.9rem;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trivia-podium__bar {
  position: relative;
  width: 100%;
  height: 0;
  min-height: 28px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.95), rgba(79, 70, 229, 0.75));
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0.4rem;
  transition: height 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.trivia-podium__col--1 .trivia-podium__bar {
  background: linear-gradient(180deg, #fde047, #f59e0b);
}

.trivia-podium__col--2 .trivia-podium__bar {
  background: linear-gradient(180deg, #e5e7eb, #94a3b8);
}

.trivia-podium__col--3 .trivia-podium__bar {
  background: linear-gradient(180deg, #fdba74, #c2722f);
}

.trivia-podium__place {
  font-weight: 900;
  font-size: 1.4rem;
  color: rgba(15, 23, 42, 0.85);
}

.trivia-podium__score {
  font-weight: 800;
  color: #e2e8f0;
}

.trivia-presets {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.45);
}

.trivia-presets__themes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.trivia-theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(124, 58, 237, 0.5);
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  padding: 0.5rem 0.7rem;
  min-height: 44px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
}

.trivia-theme-chip__icon {
  font-size: 1.2rem;
  line-height: 1;
}

.trivia-theme-chip__count {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.78rem;
  color: #cbd5f5;
}

.trivia-theme-chip--active {
  border-color: rgba(167, 139, 250, 0.95);
  background: rgba(124, 58, 237, 0.35);
  color: #fff;
}

.trivia-presets__quizzes {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.trivia-preset-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: rgba(30, 41, 59, 0.58);
}

.trivia-preset-card__info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.trivia-preset-card__info strong {
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trivia-preset-card .trivia-button {
  flex: 0 0 auto;
  width: auto;
}

.trivia-presets__own {
  margin-top: 0.8rem;
  width: 100%;
}

.trivia-auth {
  width: min(460px, 100%);
  margin: 0 auto;
}

.trivia-auth-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  margin: 0.25rem 0 0.5rem;
}

.trivia-auth-row a,
.trivia-link {
  color: #93c5fd;
  text-decoration: none;
}

.trivia-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.4;
}

.trivia-check input {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.is-error {
  color: var(--danger);
}

.is-success {
  color: var(--ok);
}

.trivia-button--big {
  min-height: 64px;
  font-size: 1.16rem;
  font-weight: 800;
}

.trivia-card--join .trivia-button--big {
  margin-top: 0.2rem;
  color: #0b1024;
  background: linear-gradient(120deg, #f7e70b, #32f1c8 45%, #19d7f0);
  box-shadow: 0 18px 32px rgba(25, 215, 240, 0.28);
}

.trivia-button--danger {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.7);
  color: #fecaca;
}

/* ===== Escenario full-screen del jugador (estilo Kahoot) ===== */
.pstage {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: max(0.7rem, env(safe-area-inset-top)) 0.7rem max(0.7rem, env(safe-area-inset-bottom));
  gap: 0.6rem;
  background:
    radial-gradient(circle at 15% 0%, rgba(124, 58, 237, 0.35), transparent 55%),
    radial-gradient(circle at 85% 10%, rgba(34, 211, 238, 0.22), transparent 45%),
    linear-gradient(160deg, #0b1024, #1b1140 70%, #2a1150);
  overflow-y: auto;
}

.pstage__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex: 0 0 auto;
}

.pstage__tag {
  font-weight: 800;
  color: #cbd5f5;
  font-size: 0.95rem;
}

.pstage__timer {
  font-weight: 900;
  font-size: 1.4rem;
  color: #fff;
  min-width: 2.4rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 999px;
  padding: 0.1rem 0.7rem;
}

.pstage__bar {
  flex: 0 0 auto;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.pstage__bar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #7c3aed);
  transition: width 0.5s linear;
}

.pstage__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  min-height: 0;
}

/* --- Espera --- */
.pwait {
  text-align: center;
  display: grid;
  gap: 0.5rem;
  animation: fadeIn 0.4s ease both;
}

.pwait__emoji {
  font-size: clamp(3rem, 16vw, 5rem);
  line-height: 1;
}

.pwait h2 {
  margin: 0;
  font-size: clamp(1.5rem, 7vw, 2.4rem);
  color: #fff;
}

.pwait__name {
  font-size: 1.2rem;
  color: #facc15;
  font-weight: 800;
}

.pwait__sub {
  color: #cbd5f5;
  margin: 0;
}

.pwait__dots span {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 4px;
  border-radius: 50%;
  background: #a78bfa;
  animation: pulseDot 1.2s infinite ease-in-out;
}

.pwait__dots span:nth-child(2) { animation-delay: 0.2s; }
.pwait__dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulseDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

.pwait__hint {
  color: #a5b4fc;
  font-weight: 700;
  margin: 0.3rem 0 0;
}

.pphone {
  width: 84px;
  height: 150px;
  margin: 0 auto 0.5rem;
  border-radius: 20px;
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border: 3px solid #a78bfa;
  position: relative;
  box-shadow: 0 12px 34px rgba(124, 58, 237, 0.45);
  animation: phoneBob 1.8s ease-in-out infinite;
}

.pphone__screen {
  position: absolute;
  inset: 12px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 38%, rgba(34, 211, 238, 0.55), rgba(124, 58, 237, 0.22));
  animation: screenPulse 1.8s ease-in-out infinite;
}

.pphone__home {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: #a78bfa;
}

@keyframes phoneBob {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-14px) rotate(5deg); }
}

@keyframes screenPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.pavatar--big {
  font-size: clamp(3.5rem, 18vw, 5.5rem);
  line-height: 1;
  margin: 0 auto 0.3rem;
  filter: drop-shadow(0 10px 22px rgba(124, 58, 237, 0.45));
  animation: phoneBob 1.9s ease-in-out infinite;
}

.plobby {
  margin-top: 1.1rem;
}

.plobby__title {
  color: #cbd5f5;
  text-align: center;
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.plobby__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.plobby__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 999px;
  padding: 0.32rem 0.7rem 0.32rem 0.45rem;
  animation: popIn 0.35s ease both;
}

.plobby__animal { font-size: 1.3rem; line-height: 1; }

.plobby__name {
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plobby__chip--me { outline: 2px solid rgba(250, 204, 21, 0.85); }

.plead__animal { font-size: 1.1rem; flex: 0 0 auto; }

/* --- Pregunta --- */
.pq {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  height: 100%;
}

.pq__text {
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: clamp(1.3rem, 5.5vw, 2.2rem);
  font-weight: 800;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 16px;
  padding: 1rem;
  flex: 0 0 auto;
}

.pq__grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  min-height: 0;
}

.pq__grid--two {
  grid-template-columns: 1fr;
}

.ptile {
  border: none;
  border-radius: 14px;
  color: #fff;
  font-weight: 800;
  font-size: clamp(1rem, 4.2vw, 1.4rem);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  text-align: left;
  min-height: 88px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.08s ease, filter 0.15s ease;
}

.ptile:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}

.ptile__shape {
  font-size: 1.6rem;
  line-height: 1;
  flex: 0 0 auto;
}

.ptile--c0 { background: #e21b3c; }
.ptile--c1 { background: #1368ce; }
.ptile--c2 { background: #d89e00; }
.ptile--c3 { background: #26890c; }

.ptile[disabled] {
  cursor: default;
  opacity: 0.45;
}

.ptile--picked {
  outline: 4px solid #fff;
  opacity: 1 !important;
}

.ptile--correct {
  outline: 4px solid #fff;
  opacity: 1 !important;
}

.ptile--dim {
  opacity: 0.3;
}

/* --- Respuesta enviada / espera de resultado --- */
.psent {
  text-align: center;
  display: grid;
  gap: 0.6rem;
  animation: popIn 0.3s ease both;
}

.psent__emoji { font-size: clamp(3rem, 15vw, 4.5rem); }
.psent h2 { margin: 0; color: #fff; font-size: clamp(1.4rem, 6vw, 2rem); }
.psent p { margin: 0; color: #cbd5f5; }

/* --- Reveal del jugador --- */
.preveal {
  text-align: center;
  display: grid;
  gap: 0.7rem;
  border-radius: 20px;
  padding: 1.5rem 1rem;
  animation: popIn 0.35s ease both;
}

.preveal--ok { background: linear-gradient(160deg, rgba(16,185,129,0.30), rgba(16,185,129,0.12)); }
.preveal--bad { background: linear-gradient(160deg, rgba(244,63,94,0.30), rgba(244,63,94,0.12)); }
.preveal--none { background: linear-gradient(160deg, rgba(148,163,184,0.25), rgba(148,163,184,0.1)); }

.preveal__icon { font-size: clamp(3.5rem, 18vw, 6rem); line-height: 1; }
.preveal h2 { margin: 0; color: #fff; font-size: clamp(1.6rem, 7vw, 2.6rem); }
.preveal__points { font-size: 1.5rem; font-weight: 900; color: #facc15; }
.preveal__correct { color: #e2e8f0; }
.preveal__score { color: #cbd5f5; margin: 0; }

.pstage .trivia-podium {
  border: none;
}

/* --- Cuenta regresiva --- */
.pcount {
  text-align: center;
  display: grid;
  gap: 0.6rem;
}

.pcount__num {
  font-size: clamp(5rem, 30vw, 11rem);
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 6px 34px rgba(124, 58, 237, 0.6);
  animation: countPop 1s infinite ease-in-out;
}

.pcount__sub {
  color: #cbd5f5;
  font-size: 1.2rem;
  margin: 0;
}

@keyframes countPop {
  0% { transform: scale(0.7); opacity: 0.4; }
  35% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.65; }
}

/* --- Ranking entre preguntas --- */
.plead {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.4rem;
}

.plead__title {
  margin: 0 0 0.2rem;
  color: #e2e8f0;
  text-align: center;
}

.plead__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
}

.plead__pos { font-size: 1.3rem; flex: 0 0 auto; }

.plead__name {
  flex: 1 1 auto;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plead__pts { color: #facc15; font-weight: 800; flex: 0 0 auto; }

.plead__row--me { outline: 2px solid rgba(250, 204, 21, 0.7); }

.plead__you { text-align: center; color: #cbd5f5; margin: 0.3rem 0 0; }

/* --- Podio final dramático --- */
.pfinish {
  text-align: center;
  display: grid;
  gap: 0.9rem;
}

.pfinish__title {
  margin: 0;
  color: #fff;
  font-size: clamp(1.4rem, 6vw, 2.2rem);
}

.pfinish__col--in { animation: popIn 0.5s ease both; }

@media (min-width: 760px) {
  .pstage { padding: 1.2rem 1.4rem; }
  .pstage__body { max-width: 900px; width: 100%; margin: 0 auto; }
  .ptile { min-height: 120px; }
}

/* ===== Equipos: editor (host) ===== */
.trivia-teams-editor {
  display: grid;
  gap: 0.5rem;
  margin: 0.2rem 0 0.4rem;
  padding: 0.7rem;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.45);
}

.trivia-teams-list {
  display: grid;
  gap: 0.45rem;
}

.trivia-team-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.trivia-team-row__animal {
  font-size: 1.4rem;
  flex: 0 0 auto;
}

.trivia-team-row__name {
  flex: 1 1 auto;
  border: 1px solid #28304f;
  background: rgba(15, 23, 42, 0.68);
  color: #f8fafc;
  border-radius: 10px;
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  font-family: inherit;
}

.trivia-team-row__remove {
  flex: 0 0 auto;
  border: none;
  background: rgba(244, 63, 94, 0.18);
  color: #fecaca;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-weight: 800;
}

/* ===== Equipos: selección (jugador) ===== */
.trivia-teams-pick {
  display: grid;
  gap: 0.4rem;
}

.trivia-teams-pick__label {
  color: #d9e2ff;
  font-weight: 700;
  font-size: 0.95rem;
}

.trivia-teams-pick__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.trivia-team-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 2px solid rgba(124, 58, 237, 0.5);
  background: rgba(30, 41, 59, 0.7);
  color: #fff;
  border-radius: 14px;
  padding: 0.55rem 0.8rem;
  min-height: 52px;
  cursor: pointer;
  font-weight: 700;
}

.trivia-team-opt__animal { font-size: 1.5rem; }

.trivia-team-opt--active {
  border-color: rgba(250, 204, 21, 0.95);
  background: rgba(124, 58, 237, 0.35);
}

/* ===== Equipos: lobby (jugador) ===== */
.plobby__teams {
  display: grid;
  gap: 0.55rem;
}

.plobby-team {
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.plobby-team--me { border-color: rgba(250, 204, 21, 0.8); }

.plobby-team__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
}

.plobby-team__animal { font-size: 1.5rem; }

.plobby-team__head strong { flex: 1 1 auto; }

.plobby-team__count {
  background: rgba(124, 58, 237, 0.4);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-weight: 800;
}

.plobby-team__members {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.plobby__chip--static { animation: none; }

.hidden {
  display: none !important;
}

@media (min-width: 880px) {
  .trivia-hero {
    min-height: 560px;
    padding-inline: max(1.5rem, calc((100vw - 1120px) / 2));
    padding-bottom: 9rem;
  }

  .trivia-hero__content {
    margin-bottom: 1.4rem;
  }

  .trivia-main {
    margin-top: -7rem;
    padding-inline: 1.5rem;
  }

  .trivia-grid {
    grid-template-columns: minmax(340px, 0.88fr) minmax(440px, 1.12fr);
  }

  .trivia-room-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .trivia-share-panel {
    grid-template-columns: 1fr 130px auto;
    align-items: center;
  }

  .trivia-share-actions {
    justify-self: end;
    width: min(220px, 100%);
  }
}

@media (min-width: 1100px) {
  .trivia-shell {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .trivia-hero {
    min-height: 330px;
    padding: max(0.72rem, env(safe-area-inset-top)) 0.82rem 5.4rem;
  }

  .trivia-hero__content {
    gap: 0.45rem;
  }

  .trivia-login-link,
  .trivia-logout {
    min-height: 38px;
    padding: 0.46rem 0.75rem;
  }

  .trivia-main {
    margin-top: -4.8rem;
    padding-inline: 0.8rem;
  }

  .trivia-card {
    border-radius: 26px;
  }

  .trivia-logo {
    font-size: clamp(2rem, 13vw, 2.75rem);
  }

  .trivia-logo__mark {
    width: 54px;
    border-radius: 16px;
  }

  .trivia-subtitle {
    font-size: 1rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
