/* ============================================================
   Экран участника
   ============================================================ */

.play-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(14px, 4vw, 24px);
  flex: none;
}

.play-brand {
  font-size: 14px;
  gap: 0.6em;
}

.play-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: rgba(124, 92, 255, 0.12);
  font-size: 12px;
  font-weight: 700;
  color: #c8bbff;
}

.score-chip b {
  font-size: 17px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.conn-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 206, 92, 0.12);
  border: 1px solid rgba(255, 206, 92, 0.3);
  color: #ffe3a3;
  font-size: 11px;
  font-weight: 700;
  animation: pulseDot 1.6s infinite;
}

.play-main {
  flex: 1;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 8px clamp(14px, 4vw, 24px) 22px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.play-footer {
  flex: none;
  text-align: center;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  color: var(--dim);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.footer-dot {
  opacity: 0.5;
}

.play-loading {
  flex: 1;
  display: grid;
  place-items: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* ---------- Общие карточки ---------- */

.play-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: fadeUp 0.35s ease both;
}

.join-view,
.wait-view,
.final-view {
  justify-content: center;
  gap: 20px;
}

.play-card {
  padding: clamp(20px, 5vw, 30px);
  border-radius: 26px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(14, 20, 36, 0.88), rgba(8, 13, 25, 0.92));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

/* ---------- Вход ---------- */

.join-card {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.join-card::before {
  content: "";
  position: absolute;
  inset: -50% -20% auto;
  height: 70%;
  background: radial-gradient(ellipse at 50% 0%, rgba(124, 92, 255, 0.3), transparent 70%);
  pointer-events: none;
}

.join-mark {
  display: flex;
  justify-content: center;
  font-size: 52px;
  margin-bottom: 14px;
  position: relative;
}

.join-card h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 8vw, 38px);
  letter-spacing: -0.03em;
}

.join-sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  position: relative;
}

.name-field .input {
  height: 58px;
  font-size: 18px;
  text-align: center;
  border-radius: 16px;
  font-weight: 700;
}

.join-form .btn {
  height: 58px;
  font-size: 17px;
}

.join-error {
  margin: 0;
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(255, 84, 112, 0.12);
  border: 1px solid rgba(255, 84, 112, 0.32);
  color: #ffb3c1;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
}

.join-meta {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--dim);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.join-meta .pill {
  font-size: 11.5px;
  padding: 5px 10px;
}

.join-legal {
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 11.5px;
  text-align: center;
}

/* ---------- Ожидание ---------- */

.player-badge {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  align-self: center;
}

.avatar-big {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 19px;
  color: #0a1020;
  flex: none;
}

.player-badge .eyebrow {
  font-size: 10px;
  color: var(--accent-2);
}

.player-badge b {
  display: block;
  font-size: 16px;
  margin-top: 2px;
}

.wait-orbit {
  align-self: center;
  position: relative;
  width: 78px;
  height: 78px;
  margin: 8px 0;
  display: grid;
  place-items: center;
}

.wait-orbit::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 30px rgba(124, 92, 255, 0.8);
}

.wait-orbit span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 92, 255, 0.4);
  animation: orbitPulse 2.4s ease-out infinite;
}

.wait-orbit span:nth-child(2) {
  animation-delay: 0.8s;
}

.wait-orbit span:nth-child(3) {
  animation-delay: 1.6s;
}

@keyframes orbitPulse {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
  }
  80%,
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.wait-title {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 7vw, 34px);
  letter-spacing: -0.02em;
}

.wait-sub {
  margin: -8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.wait-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.wait-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
}

.wait-stats b {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.wait-stats span {
  font-size: 10.5px;
  color: var(--dim);
  font-weight: 600;
  text-align: center;
}

/* ---------- Вопрос ---------- */

.question-view {
  gap: 12px;
  height: 100%;
}

.pq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}

.pq-num {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent-2);
  text-transform: uppercase;
}

.pq-timer {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color 0.2s ease;
}

.pq-timer.urgent {
  color: #ff7d94;
  animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.pq-timer-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex: none;
}

.pq-timer-track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c5cff, #37d0ff);
  transform-origin: left;
  transition: width 0.12s linear;
}

.pq-timer-track.urgent i {
  background: linear-gradient(90deg, #ff5470, #ff9caf);
}

.pq-media {
  flex: none;
  max-height: min(24vh, 220px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #05080f;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pq-media img {
  width: 100%;
  max-height: min(24vh, 220px);
  object-fit: contain;
}

.pq-media[hidden] {
  display: none;
}

.pq-text {
  margin: 0;
  font-size: clamp(20px, 5.4vw, 28px);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.vote-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
  margin-top: auto;
}

.vote-btn {
  position: relative;
  width: 100%;
  min-height: clamp(74px, 11vh, 100px);
  border-radius: 22px;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 900;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.vote-btn.is-true {
  color: #042b1d;
  background: linear-gradient(145deg, #55f0bd 0%, #21ce93 55%, #10a877 100%);
  box-shadow: 0 14px 40px rgba(33, 206, 147, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.vote-btn.is-false {
  color: #fff;
  background: linear-gradient(145deg, #ff718c 0%, #f03b60 55%, #d12348 100%);
  box-shadow: 0 14px 40px rgba(255, 84, 112, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.vote-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.28), transparent 62%);
  pointer-events: none;
}

.vote-btn:not(:disabled):active {
  transform: scale(0.975);
}

.vote-btn:disabled {
  cursor: default;
}

.vote-btn.dimmed {
  filter: grayscale(0.35) brightness(0.72);
  opacity: 0.55;
  box-shadow: none;
}

.vote-btn.selected {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.75), 0 0 40px rgba(255, 255, 255, 0.18);
}

.vote-btn .vb-check {
  position: absolute;
  right: 18px;
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.16);
  color: inherit;
}

.vote-btn.selected .vb-check {
  display: flex;
}

.vote-hint {
  margin: 2px 0 0;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.4;
  flex: none;
}

.vote-hint.answered {
  color: #9bf7d7;
  font-weight: 600;
}

.vote-hint.closed {
  color: #ffb3c1;
  font-weight: 600;
}

/* ---------- Результаты ---------- */

.result-view {
  gap: 14px;
  justify-content: center;
}

.result-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: popIn 0.4s ease both;
}

.result-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 900;
  margin-bottom: 4px;
}

.outcome-correct .result-icon {
  background: radial-gradient(circle at 35% 30%, #7dffd0, #19b982);
  color: #04291d;
  box-shadow: 0 0 60px rgba(47, 227, 164, 0.4);
}

.outcome-wrong .result-icon {
  background: radial-gradient(circle at 35% 30%, #ff9caf, #e2274c);
  color: #fff;
  box-shadow: 0 0 60px rgba(255, 84, 112, 0.35);
}

.outcome-missed .result-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}

.result-hero h1 {
  margin: 0;
  font-size: clamp(27px, 7.4vw, 36px);
  letter-spacing: -0.025em;
}

.outcome-correct .result-hero h1 {
  color: #7dffd0;
}

.outcome-wrong .result-hero h1 {
  color: #ff9caf;
}

.result-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.result-hero p b {
  color: var(--text);
}

.points-badge {
  align-self: center;
  padding: 9px 22px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.outcome-correct .points-badge {
  color: #04291d;
  background: linear-gradient(135deg, #5af0bf, #22cf95);
  box-shadow: 0 8px 30px rgba(47, 227, 164, 0.3);
}

.outcome-wrong .points-badge,
.outcome-missed .points-badge {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.result-answer {
  padding: 15px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.result-answer .ra-value {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.result-answer .ra-value.is-true {
  color: var(--true);
}

.result-answer .ra-value.is-false {
  color: #ff8fa5;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-grid > div {
  padding: 13px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-grid b {
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-grid span {
  font-size: 10.5px;
  color: var(--dim);
  font-weight: 600;
}

.mini-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-board-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 2px;
}

.mini-board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}

.mini-board-row.self {
  background: rgba(124, 92, 255, 0.13);
  border: 1px solid rgba(124, 92, 255, 0.25);
}

.mini-board-row .m-place {
  width: 20px;
  font-weight: 800;
  color: var(--dim);
  font-size: 12px;
}

.mini-board-row .m-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-board-row .m-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- Финал ---------- */

.final-view {
  gap: 16px;
}

.final-head {
  text-align: center;
}

.final-head .trophy {
  font-size: 54px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 10px 30px rgba(255, 206, 92, 0.32));
}

.final-head h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 38px);
  letter-spacing: -0.03em;
}

.final-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.final-self {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: linear-gradient(140deg, rgba(124, 92, 255, 0.2), rgba(55, 208, 255, 0.06));
  text-align: center;
}

.final-self .fs-place {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8bbff;
}

.final-self .fs-score {
  font-size: 42px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 4px 0 3px;
}

.final-self .fs-score span {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0;
}

.final-self .fs-name {
  color: var(--muted);
  font-size: 13px;
}

.final-table {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.final-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.final-table-body {
  max-height: 42vh;
  overflow-y: auto;
}

.final-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  font-size: 13.5px;
}

.final-row:last-child {
  border-bottom: none;
}

.final-row.self {
  background: rgba(124, 92, 255, 0.15);
  box-shadow: inset 3px 0 0 var(--accent);
}

.final-row .fr-place {
  font-weight: 800;
  color: var(--dim);
  font-size: 12px;
}

.final-row.self .fr-place {
  color: #c8bbff;
}

.final-row .fr-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.final-row .fr-score {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.final-row .fr-score span {
  font-size: 10px;
  color: var(--dim);
  font-weight: 600;
  margin-left: 2px;
}

.final-wait {
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  padding: 6px 0;
}

.play-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

/* ---------- Адаптив ---------- */

@media (min-width: 720px) {
  .play-main {
    width: min(600px, 100%);
    padding-top: 20px;
  }

  .play-brand {
    font-size: 17px;
  }

  .pq-text {
    font-size: 30px;
  }

  .pq-media {
    max-height: 30vh;
  }

  .pq-media img {
    max-height: 30vh;
  }
}

@media (max-height: 700px) {
  .play-header {
    padding: 9px 14px;
  }

  .play-footer {
    display: none;
  }

  .wait-orbit {
    width: 54px;
    height: 54px;
    margin: 0;
  }

  .wait-stats > div {
    padding: 10px 6px;
  }

  .result-icon {
    width: 62px;
    height: 62px;
    font-size: 30px;
  }

  .pq-text {
    font-size: 20px;
  }
}
