/* ==========================================================================
   КВИЗ-ПАТИ — телефон игрока (play.css).
   Стили экранов поверх base.css. Ориентир: 360×640 и 390×844, 100dvh без скролла.
   Владелец файла — player-ui-dev.
   ========================================================================== */

/* ---------- каркас ---------- */
.play-body {
  overflow: hidden;
  overscroll-behavior: none;
}

.play-app {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.play__blobs {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.play__blobs .blob {
  filter: blur(56px);
  opacity: 0.38;
}

.play__blobs .blob--pink { width: 56vmin; height: 56vmin; }
.play__blobs .blob--cyan { width: 48vmin; height: 48vmin; }
.play__blobs .blob--violet { width: 44vmin; height: 44vmin; opacity: 0.22; }

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

/* ---------- верхняя панель (игровые фазы) ---------- */
.topbar {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 6px) calc(env(safe-area-inset-right) + 12px) 6px
    calc(env(safe-area-inset-left) + 12px);
}

.topbar__code {
  font-family: var(--font-mono);
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: 14px;
  color: var(--cyan);
  background: rgba(53, 224, 255, 0.1);
  border-color: rgba(53, 224, 255, 0.25);
}

.topbar__label {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emoji-fab {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--stroke-strong);
  font-size: 23px;
  line-height: 1;
  transition: transform 0.12s ease, background 0.18s ease;
}

.emoji-fab:active { transform: scale(0.92); background: var(--surface-3); }

/* ---------- экраны ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 6px calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 10px)
    calc(env(safe-area-inset-left) + 14px);
  overflow: hidden;
  animation: screen-in 0.24s ease both;
}

.screen.is-active { display: flex; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen--landing,
.screen--join,
.screen--closed {
  padding-top: calc(env(safe-area-inset-top) + 16px);
}

/* общие мелочи */
.wait-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.wait-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pink);
  animation: dot-blink 1.2s ease-in-out infinite;
}

.wait-dots i:nth-child(2) { animation-delay: 0.18s; background: var(--amber); }
.wait-dots i:nth-child(3) { animation-delay: 0.36s; background: var(--cyan); }

@keyframes dot-blink {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   1. LANDING
   ========================================================================== */
.landing {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  text-align: center;
}

.landing__top {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.4vh, 20px);
}

.landing__emoji-row {
  font-size: clamp(24px, 6.4vmin, 40px);
  letter-spacing: 0.18em;
  filter: drop-shadow(0 6px 18px rgba(255, 62, 138, 0.35));
}

.landing__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 0.84;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.landing__logo-kw {
  font-size: clamp(62px, 19vmin, 104px);
  color: var(--text);
  text-shadow: 0 0 46px rgba(167, 139, 250, 0.55);
}

.landing__logo-party {
  font-size: clamp(62px, 19vmin, 104px);
  padding-right: 0.06em;
}

.landing__tagline {
  color: var(--muted);
  font-size: clamp(12px, 2.1vmin, 17px);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.landing__bottom {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.landing__how {
  color: var(--muted);
  font-size: clamp(13px, 2.2vmin, 16px);
  line-height: 1.35;
}

.landing__cta {
  animation: cta-pulse 2.6s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(255, 62, 138, 0.35); }
  50% { box-shadow: 0 12px 46px rgba(255, 62, 138, 0.6); }
}

.landing__host-link {
  align-self: center;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.landing__host-link:active { color: var(--cyan); }

/* ==========================================================================
   2. JOIN
   ========================================================================== */
.join {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.join__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--stroke);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.back-btn:active { background: var(--surface-3); }

.join__form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(12px, 2.4vh, 20px);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__hint {
  font-size: 12px;
  color: var(--dim);
  text-align: center;
}

.code-input {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}

.code-input__cell {
  width: 100%;
  min-height: 76px;
  padding: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: clamp(30px, 9vmin, 42px);
  line-height: 1;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--stroke);
  border-radius: var(--r-md);
  caret-color: var(--cyan);
  text-transform: uppercase;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.code-input__cell:focus {
  outline: none;
  border-color: var(--pink);
  background: rgba(255, 62, 138, 0.12);
  box-shadow: 0 0 0 4px rgba(255, 62, 138, 0.16);
}

.code-input__cell.is-filled {
  border-color: rgba(255, 62, 138, 0.6);
  background: rgba(255, 62, 138, 0.1);
}

.code-input__cell.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 84, 112, 0.16);
}

.code-input.shake,
.form-error.shake,
.numeric__field.shake {
  animation: shake 0.45s ease both;
}

.text-input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--stroke);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input::placeholder { color: var(--dim); font-weight: 600; }

.text-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(53, 224, 255, 0.14);
}

.form-error {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 84, 112, 0.14);
  border: 1px solid rgba(255, 84, 112, 0.42);
  color: #ffb3c1;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.join__submit { min-height: 64px; }

.join__foot {
  flex: 0 0 auto;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.35;
}

.btn.is-busy { pointer-events: none; opacity: 0.75; }

.btn.is-busy::before {
  content: "";
  width: 0.9em;
  height: 0.9em;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* ==========================================================================
   3. LOBBY
   ========================================================================== */
.lobby {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 14px);
}

.lobby__top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lobby__room-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.lobby__me {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.avatar-btn {
  position: relative;
  width: clamp(84px, 21vmin, 116px);
  height: clamp(84px, 21vmin, 116px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.22), transparent 55%),
    linear-gradient(150deg, rgba(255, 62, 138, 0.5), rgba(167, 139, 250, 0.4));
  border: 2px solid var(--stroke-strong);
  box-shadow: var(--glow-pink), inset 0 0 34px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease;
}

.avatar-btn:active { transform: scale(0.94); }
.avatar-btn.is-bump { animation: avatar-bump 0.32s cubic-bezier(0.2, 1.5, 0.4, 1) both; }

@keyframes avatar-bump {
  0% { transform: scale(0.9); }
  65% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

.avatar-btn__emoji {
  font-size: clamp(46px, 12vmin, 66px);
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.3));
}

.avatar-btn__edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--stroke-strong);
  font-size: 15px;
}

.lobby__name {
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(22px, 5.6vmin, 30px);
  line-height: 1.05;
  text-transform: uppercase;
  text-align: center;
  overflow-wrap: anywhere;
}

.lobby__hint {
  font-size: 11.5px;
}

.lobby__score { font-size: 13px; }

.lobby__players {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lobby__players-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.lobby__count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  letter-spacing: 0;
  font-family: var(--font-mono);
}

.players-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 7px;
  align-content: start;
  padding-bottom: 2px;
}

.player-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: 7px 4px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--stroke);
}

.player-chip.is-me {
  border-color: rgba(255, 62, 138, 0.55);
  background: rgba(255, 62, 138, 0.13);
  box-shadow: 0 0 18px rgba(255, 62, 138, 0.18);
}

.player-chip.is-offline { opacity: 0.45; }

.player-chip__avatar {
  font-size: 25px;
  line-height: 1.15;
}

.player-chip__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.player-chip.is-me .player-chip__name { color: var(--text); }

.lobby__wait {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(53, 224, 255, 0.07);
  border: 1px solid rgba(53, 224, 255, 0.18);
  font-size: 12.5px;
  font-weight: 700;
  color: #a7ecff;
  text-align: center;
}

.lobby__tip {
  flex: 0 0 auto;
  min-height: 2.6em;
  font-size: 11.5px;
  line-height: 1.3;
  text-align: center;
  color: var(--dim);
}

.lobby__tip.is-swap { animation: screen-in 0.3s ease both; }

/* ==========================================================================
   4. ROUND INTRO
   ========================================================================== */
.intro {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.8vh, 14px);
  text-align: center;
}

.intro__kicker {
  font-size: clamp(12px, 2.3vmin, 16px);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
}

.intro__emoji {
  font-size: clamp(62px, 17vmin, 104px);
  line-height: 1;
  filter: drop-shadow(0 14px 34px rgba(255, 62, 138, 0.35));
  animation: intro-emoji 1.4s ease-in-out infinite alternate;
}

@keyframes intro-emoji {
  from { transform: translateY(0) rotate(-3deg) scale(1); }
  to { transform: translateY(-8px) rotate(3deg) scale(1.04); }
}

.intro__title {
  font-size: clamp(34px, 9.4vmin, 56px);
  line-height: 0.96;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.intro__tagline {
  font-size: clamp(14px, 2.5vmin, 19px);
  color: var(--muted);
  font-weight: 600;
}

.intro__ready {
  margin-top: 4px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(19px, 4.4vmin, 28px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
  text-shadow: 0 0 26px rgba(255, 197, 62, 0.4);
}

.intro__meta {
  font-size: 12px;
  line-height: 1.35;
}

/* ==========================================================================
   5/6. QUESTION
   ========================================================================== */
.qhead {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.qhead__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.qhead__round {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qhead__index { flex: 0 0 auto; color: var(--dim); }

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

.timer__num {
  flex: 0 0 auto;
  min-width: 2.4em;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: clamp(24px, 5.6vmin, 34px);
  line-height: 1;
  color: var(--cyan);
}

.timer__progress {
  flex: 1 1 auto;
  height: 9px;
}

.timer__progress .progress__bar {
  transition: none;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
}

.timer--low .timer__num { color: var(--amber); }
.timer--low .timer__progress .progress__bar { background: linear-gradient(90deg, var(--amber), var(--pink)); }

.timer--critical .timer__num {
  color: var(--red);
  animation: tick-pulse 0.9s ease-in-out infinite;
}

.timer--critical .timer__progress .progress__bar { background: linear-gradient(90deg, var(--red), #ff8966); }

.qbody {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 46%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 2px 2px 4px;
}

.qtext {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 4.6vmin, 30px);
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.qunit {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
}

.answers {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(64px, 1fr) minmax(64px, 1fr);
  gap: 9px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 8px 9px;
  text-align: left;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 2px solid var(--stroke);
  color: var(--text);
  font-weight: 800;
  font-size: clamp(15px, 2.7vmin, 19px);
  line-height: 1.14;
  overflow: hidden;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.answer:active:not(:disabled) {
  transform: scale(0.97);
  background: var(--surface-3);
}

.answer:disabled { opacity: 0.62; cursor: default; }

.answer__key {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 15px;
  color: var(--text);
}

.answer:nth-child(1) .answer__key { background: rgba(255, 62, 138, 0.24); color: #ff9cc2; }
.answer:nth-child(2) .answer__key { background: rgba(53, 224, 255, 0.2); color: #9beeff; }
.answer:nth-child(3) .answer__key { background: rgba(182, 255, 62, 0.2); color: #dcff9e; }
.answer:nth-child(4) .answer__key { background: rgba(255, 197, 62, 0.2); color: #ffe1a0; }

.answer__text {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.answer.is-picked {
  border-color: var(--cyan);
  background: rgba(53, 224, 255, 0.16);
  box-shadow: 0 0 26px rgba(53, 224, 255, 0.22);
  opacity: 1;
}

.answer.is-picked .answer__key {
  background: var(--cyan);
  color: #04141a;
}

.numeric {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.numeric__field {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 2px solid var(--stroke);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.numeric__field:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(53, 224, 255, 0.14);
}

.numeric__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 0;
  background: none;
  border: none;
  outline: none;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: clamp(30px, 8vmin, 42px);
  line-height: 1.15;
  color: var(--text);
}

.numeric__input::placeholder { color: rgba(255, 255, 255, 0.18); }

.numeric__unit {
  flex: 0 0 auto;
  max-width: 40%;
  font-size: clamp(13px, 2.4vmin, 18px);
  font-weight: 800;
  color: var(--amber);
  text-align: right;
}

.numeric__hint {
  text-align: center;
  font-size: 11.5px;
  color: var(--dim);
}

.numeric.is-locked { opacity: 0.85; }
.numeric.is-locked .numeric__input { color: var(--muted); }
.numeric.is-locked .btn { pointer-events: none; }

.qstatus {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: clamp(14px, 2.5vmin, 17px);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  animation: pop-in 0.28s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.qstatus--ok {
  background: rgba(62, 242, 155, 0.13);
  border: 1px solid rgba(62, 242, 155, 0.42);
  color: #9dffcc;
}

.qstatus--bad {
  background: rgba(255, 84, 112, 0.13);
  border: 1px solid rgba(255, 84, 112, 0.42);
  color: #ffb3c1;
}

.qwait {
  flex: 0 0 auto;
  min-height: 15px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--dim);
}

/* ==========================================================================
   7. WAGER
   ========================================================================== */
.wager {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: clamp(8px, 1.6vh, 14px);
  text-align: center;
  padding: 2px 2px 4px;
}

.wager__head { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.wager__title { font-size: clamp(30px, 7.6vmin, 44px); }

.wager__sub { font-size: clamp(12.5px, 2.2vmin, 15px); line-height: 1.3; }

.wager__amount {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: clamp(46px, 12.6vmin, 74px);
  line-height: 1;
  color: var(--amber);
  text-shadow: 0 0 34px rgba(255, 197, 62, 0.4);
  font-variant-numeric: tabular-nums;
}

.wager__scoreline { font-size: 12.5px; }
.wager__scoreline b { color: var(--text); }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  touch-action: pan-y;
}

.range::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--amber));
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -11px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--amber);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.range::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--amber));
}

.range::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--amber);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.range:disabled { opacity: 0.5; }

.wager__quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.wager__quick .btn {
  min-height: 52px;
  padding: 0 4px;
  border-radius: 14px;
  font-size: clamp(14px, 2.4vmin, 17px);
  letter-spacing: 0;
}

.wager__quick .btn.is-active {
  background: rgba(255, 197, 62, 0.2);
  border-color: var(--amber);
  color: #ffe1a0;
}

.wager__hint {
  font-size: 11.5px;
  line-height: 1.35;
}

.wager__status {
  padding: 9px 12px;
  border-radius: 13px;
  background: rgba(62, 242, 155, 0.13);
  border: 1px solid rgba(62, 242, 155, 0.42);
  color: #9dffcc;
  font-size: 13px;
  font-weight: 800;
  animation: pop-in 0.28s ease both;
}

/* ==========================================================================
   8. REVEAL
   ========================================================================== */
.reveal {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.5vh, 12px);
  text-align: center;
  padding: 2px 2px 4px;
}

.reveal__verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.reveal__icon {
  font-size: clamp(56px, 15vmin, 88px);
  line-height: 1;
  animation: pop-in 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

.reveal__word {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 7.6vmin, 46px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.reveal--correct .reveal__word {
  color: var(--green);
  text-shadow: 0 0 32px rgba(62, 242, 155, 0.45);
}

.reveal--wrong .reveal__word {
  color: var(--red);
  text-shadow: 0 0 30px rgba(255, 84, 112, 0.4);
}

.reveal--none .reveal__word { color: var(--muted); }

.reveal__delta {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: clamp(36px, 10.4vmin, 60px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.reveal--correct .reveal__delta { color: var(--green); text-shadow: 0 0 30px rgba(62, 242, 155, 0.35); }
.reveal--wrong .reveal__delta { color: var(--dim); }
.reveal--none .reveal__delta { display: none; }

.reveal__correct {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
}

.reveal__correct-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--dim);
  text-transform: uppercase;
}

.reveal__correct-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(18px, 3.7vmin, 25px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.reveal__mine {
  font-size: clamp(12.5px, 2.2vmin, 15px);
  font-weight: 700;
  color: var(--muted);
  line-height: 1.3;
}

.reveal__explain {
  font-size: clamp(11.5px, 2vmin, 14px);
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reveal__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.reveal__foot .chip { font-size: 12.5px; }

/* ==========================================================================
   9. ROUND LEADERBOARD
   ========================================================================== */
.board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board__head {
  flex: 0 0 auto;
  text-align: center;
}

.board__title { font-size: clamp(24px, 6.2vmin, 36px); }

.board__sub {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.3;
}

.board__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 2px 2px 0;
}

.brow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--stroke);
}

.brow.is-me {
  background: rgba(255, 62, 138, 0.14);
  border-color: rgba(255, 62, 138, 0.55);
  box-shadow: 0 0 22px rgba(255, 62, 138, 0.16);
}

.brow__rank {
  flex: 0 0 auto;
  width: 24px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 16px;
  color: var(--dim);
}

.brow.is-me .brow__rank { color: var(--pink); }

.brow__avatar {
  flex: 0 0 auto;
  width: 26px;
  text-align: center;
  font-size: 21px;
  line-height: 1;
}

.brow__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(13px, 2.3vmin, 15px);
  font-weight: 800;
}

.brow__move {
  flex: 0 0 auto;
  width: 16px;
  text-align: center;
  font-size: 10px;
  font-weight: 900;
}

.brow__move--up { color: var(--green); }
.brow__move--down { color: var(--red); }
.brow__move--same { color: transparent; }

.brow__delta {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--green);
}

.brow__delta--zero { color: var(--dim); }
.brow__delta--neg { color: var(--red); }

.brow__score {
  flex: 0 0 auto;
  min-width: 3.4em;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: clamp(14px, 2.5vmin, 17px);
  font-variant-numeric: tabular-nums;
}

.board__me {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  text-align: center;
}

.board__me-text {
  font-size: 13px;
  font-weight: 800;
}

/* ==========================================================================
   10. FINAL RESULTS
   ========================================================================== */
.final {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.4vh, 12px);
  text-align: center;
  padding: 2px 2px 4px;
}

.final__head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.final__title {
  font-size: clamp(30px, 7.8vmin, 46px);
  line-height: 0.98;
}

.final__winner {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 14px;
}

.final__winner-emoji {
  font-size: clamp(38px, 9vmin, 52px);
  line-height: 1;
  animation: intro-emoji 1.8s ease-in-out infinite alternate;
}

.final__winner-name {
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 4.6vmin, 28px);
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.final__winner-score {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  color: var(--amber);
}

.final__podium {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
}

.podium-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 5px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--stroke);
}

.podium-card--first {
  padding-top: 12px;
  padding-bottom: 12px;
  background: rgba(255, 197, 62, 0.12);
  border-color: rgba(255, 197, 62, 0.42);
  box-shadow: 0 0 26px rgba(255, 197, 62, 0.18);
}

.podium-card.is-me { box-shadow: 0 0 0 2px rgba(255, 62, 138, 0.55) inset; }

.podium__medal { font-size: 19px; line-height: 1; }
.podium__avatar { font-size: 24px; line-height: 1.15; }

.podium__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.podium-card--first .podium__name { color: var(--text); }

.podium__score {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 12px;
}

.final__me {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
}

.final__me-text {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.final__wait {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 11.5px;
  line-height: 1.3;
  margin-top: auto;
  padding-top: 2px;
}

/* ==========================================================================
   ROOM CLOSED
   ========================================================================== */
.closed {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.closed__emoji {
  font-size: clamp(60px, 16vmin, 92px);
  line-height: 1;
  animation: intro-emoji 2.2s ease-in-out infinite alternate;
}

.closed__title { max-width: 100%; }

.closed__text {
  font-size: clamp(13px, 2.3vmin, 16px);
  line-height: 1.4;
  max-width: 30ch;
}

/* ==========================================================================
   EMOJI
   ========================================================================== */
.emoji-sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
}

.emoji-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 15, 0.6);
  animation: fade-in 0.18s ease both;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.emoji-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px calc(env(safe-area-inset-right) + 14px) calc(env(safe-area-inset-bottom) + 14px)
    calc(env(safe-area-inset-left) + 14px);
  background: linear-gradient(180deg, rgba(36, 26, 77, 0.97), rgba(13, 8, 32, 0.99));
  border-top: 1px solid var(--stroke-strong);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55);
  animation: sheet-in 0.22s cubic-bezier(0.2, 1, 0.4, 1) both;
}

@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }

.emoji-sheet__title {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.emoji-sheet__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-height: 56px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  font-size: clamp(27px, 7vmin, 34px);
  line-height: 1;
  transition: transform 0.1s ease, background 0.15s ease;
}

.emoji-btn:active { transform: scale(0.92); background: var(--surface-3); }

.emoji-sheet__close {
  align-self: center;
  min-height: 44px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--stroke-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.emoji-sheet__close:active { background: var(--surface-3); }

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 65;
  overflow: hidden;
  pointer-events: none;
}

.emoji-float {
  position: absolute;
  bottom: 84px;
  font-size: 42px;
  line-height: 1;
  animation: emoji-up 2.4s ease-out forwards;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
}

@keyframes emoji-up {
  0% { opacity: 0; transform: translateY(16px) scale(0.7) rotate(-8deg); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-62vh) scale(1.35) rotate(10deg); }
}

/* ==========================================================================
   OVERLAYS / TOAST
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 24px);
  background: rgba(8, 4, 20, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-in 0.18s ease both;
}

.overlay__card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  text-align: center;
  border-radius: var(--r-lg);
  background: var(--bg-1);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow-2);
}

.overlay__spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--pink);
  animation: spin 0.8s linear infinite;
}

.overlay__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overlay__text {
  font-size: 13.5px;
  line-height: 1.38;
}

.toast {
  position: fixed;
  left: calc(env(safe-area-inset-left) + 14px);
  right: calc(env(safe-area-inset-right) + 14px);
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 70;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(26, 17, 56, 0.97);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  animation: toast-in 0.22s ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   DEMO BAR
   ========================================================================== */
.demo-bar {
  position: fixed;
  left: 8px;
  bottom: calc(env(safe-area-inset-bottom) + 8px);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid var(--stroke-strong);
  font-size: 10.5px;
  color: var(--muted);
}

.demo-bar__btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}

.demo-bar__btn:active { background: var(--surface-3); }

.demo-bar__label {
  min-width: 62px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--amber);
}

/* ==========================================================================
   МЕЛКИЕ ЭКРАНЫ / ВЫСОТА
   ========================================================================== */
@media (max-height: 700px) {
  .landing__emoji-row { font-size: clamp(20px, 5.4vmin, 32px); }
  .landing__logo-kw,
  .landing__logo-party { font-size: clamp(54px, 16.4vmin, 84px); }
  .landing__how { font-size: 12px; }
  .landing__bottom { gap: 8px; }
  .landing__cta { min-height: 64px; font-size: 20px; }
  .code-input__cell { min-height: 66px; }
  .join__form { gap: 12px; }
  .text-input { min-height: 52px; }
  .join__submit { min-height: 56px; }
  .join__foot { display: none; }
  .intro__emoji { font-size: clamp(52px, 14vmin, 82px); }
  .intro__title { font-size: clamp(28px, 8vmin, 44px); }
  .avatar-btn { width: clamp(72px, 18vmin, 96px); height: clamp(72px, 18vmin, 96px); }
  .avatar-btn__emoji { font-size: clamp(40px, 10vmin, 56px); }
  .wager__amount { font-size: clamp(40px, 11vmin, 60px); }
  .wager__title { font-size: clamp(26px, 6.6vmin, 36px); }
  .reveal__icon { font-size: clamp(46px, 12.5vmin, 72px); }
  .reveal__word { font-size: clamp(24px, 6.6vmin, 36px); }
  .reveal__delta { font-size: clamp(32px, 8.8vmin, 48px); }
  .final__title { font-size: clamp(26px, 6.6vmin, 36px); }
  .lobby__tip { min-height: 2.2em; }
}

@media (max-height: 600px) {
  .qbody { max-height: 38%; }
  .answers { grid-template-rows: minmax(56px, 1fr) minmax(56px, 1fr); gap: 7px; }
  .answer { min-height: 56px; padding: 6px 8px; }
  .landing__how { display: none; }
  .lobby__hint { display: none; }
  .lobby__tip { display: none; }
  .wager__hint { display: none; }
}

/* ==========================================================================
   A11Y
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .landing__cta,
  .intro__emoji,
  .final__winner-emoji,
  .closed__emoji,
  .wait-dots i { animation: none !important; }
}

/* ---------- уточнения состояний (добавлено после интеграции с сервером) ---------- */
.reveal--close .reveal__word {
  color: var(--amber);
  text-shadow: 0 0 30px rgba(255, 197, 62, 0.4);
}

.reveal--close .reveal__delta { color: var(--amber); }

.reveal--none .reveal__mine { color: var(--muted); }

.btn.is-done {
  background: rgba(62, 242, 155, 0.16);
  border-color: rgba(62, 242, 155, 0.5);
  color: #9dffcc;
  box-shadow: none;
}

.wager__quick .btn:disabled { opacity: 0.5; }

/* ==========================================================================
   v2: выход из лобби, текстовый финал, фаза judge
   ========================================================================== */
.lobby__leave {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: transparent;
  border: 1px solid var(--stroke-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lobby__leave:active {
  background: rgba(255, 84, 112, 0.14);
  border-color: rgba(255, 84, 112, 0.5);
  color: #ffb3c1;
}

.lobby__leave.is-confirming {
  background: rgba(255, 84, 112, 0.16);
  border-color: rgba(255, 84, 112, 0.55);
  color: #ffb3c1;
}

.lobby__leave:disabled { opacity: 0.5; }

/* ---------- финальный текстовый ответ ---------- */
.text-answer {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.text-answer__input {
  width: 100%;
  min-height: 96px;
  max-height: 34vh;
  padding: 12px 14px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--stroke);
  border-radius: var(--r-md);
  resize: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-answer__input::placeholder { color: var(--dim); font-weight: 600; }

.text-answer__input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 197, 62, 0.16);
}

.text-answer__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--dim);
}

.text-answer__hint { min-width: 0; }

.text-answer__counter.is-full { color: var(--amber); }

.text-answer__counter {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--muted);
}

.text-answer.is-locked { opacity: 0.85; }

.text-answer.is-locked .text-answer__input {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.text-answer.is-locked .btn { pointer-events: none; }

/* ---------- фаза judge ---------- */
.judge {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vh, 18px);
  padding: 2px 2px 6px;
  text-align: center;
}

.judge__spinner {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--pink);
  animation: spin 0.8s linear infinite;
}

.judge__title {
  max-width: 100%;
  font-size: clamp(22px, 5.4vmin, 32px);
}

.judge__answer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
}

.judge__answer-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--dim);
  text-transform: uppercase;
}

.judge__answer-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(18px, 4vmin, 26px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.judge__wager { min-height: 1.2em; font-size: 12.5px; }

.judge__hint {
  max-width: 32ch;
  font-size: 12.5px;
  line-height: 1.35;
}

@media (max-height: 700px) {
  .judge__spinner { width: 44px; height: 44px; }
  .text-answer__input { min-height: 84px; }
}

@media (max-height: 600px) {
  .text-answer__hint { display: none; }
  .text-answer__input { min-height: 72px; }
  .judge__title { font-size: clamp(18px, 5vmin, 26px); }
}
