/* =========================================================
   Игротека — общий стиль
   ========================================================= */

:root {
  --bg: #070b16;
  --bg-deep: #04060d;
  --bg-soft: #0d1424;
  --panel: rgba(17, 25, 44, 0.82);
  --panel-solid: #111a2c;
  --panel-2: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f5f7ff;
  --muted: #96a3c2;
  --muted-2: #6f7c9b;
  --pink: #ff4d8d;
  --pink-soft: rgba(255, 77, 141, 0.16);
  --gold: #ffc247;
  --gold-soft: rgba(255, 194, 71, 0.16);
  --teal: #2ee6b0;
  --teal-soft: rgba(46, 230, 176, 0.14);
  --blue: #4aa8ff;
  --violet: #b06bff;
  --danger: #ff5a6e;
  --success: #2ee6b0;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Arial Black", "Segoe UI Black", "Segoe UI", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
  line-height: 1.45;
}

.tiny {
  font-size: 0.76rem;
  line-height: 1.4;
}

.center {
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Фон ---------- */

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 77, 141, 0.13), transparent 45%),
    radial-gradient(ellipse at 90% 12%, rgba(255, 194, 71, 0.09), transparent 42%),
    radial-gradient(ellipse at 50% 110%, rgba(46, 230, 176, 0.08), transparent 55%),
    linear-gradient(160deg, #070b16 0%, #0a1020 48%, #060911 100%);
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.5;
  animation: orbFloat 18s ease-in-out infinite alternate;
}

.orb-pink {
  width: 42vw;
  height: 42vw;
  left: -12vw;
  top: -16vw;
  background: rgba(255, 77, 141, 0.24);
}

.orb-gold {
  width: 32vw;
  height: 32vw;
  right: -8vw;
  top: 16vh;
  background: rgba(255, 194, 71, 0.14);
  animation-delay: -6s;
}

.orb-teal {
  width: 36vw;
  height: 36vw;
  left: 30vw;
  bottom: -24vw;
  background: rgba(46, 230, 176, 0.13);
  animation-delay: -11s;
}

.grid-glow {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(ellipse at 50% 35%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 0%, transparent 78%);
}

@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3vw, 4vh, 0) scale(1.12); }
}

/* ---------- Базовые элементы ---------- */

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.grad-text {
  background: linear-gradient(100deg, var(--pink), #ff8a5c 40%, var(--gold) 77%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  user-select: none;
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  width: 38px;
  height: 38px;
  padding: 7px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 77, 141, 0.22), rgba(255, 194, 71, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.brand-mark span {
  flex: 1;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, var(--gold), var(--pink));
  animation: brandBars 1.1s ease-in-out infinite alternate;
}

.brand-mark span:nth-child(1) { height: 42%; animation-delay: -0.2s; }
.brand-mark span:nth-child(2) { height: 100%; animation-delay: -0.6s; }
.brand-mark span:nth-child(3) { height: 64%; animation-delay: -0.35s; }

@keyframes brandBars {
  to { transform: scaleY(0.55); opacity: 0.75; }
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-size: 1.08rem;
  letter-spacing: 0.14em;
  line-height: 1.05;
}

.brand-text small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: none;
}

.brand-small .brand-mark {
  width: 32px;
  height: 32px;
  padding: 6px;
  border-radius: 10px;
}

.brand-small .brand-text {
  font-size: 0.92rem;
}

.brand-small .brand-text small {
  display: none;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(46, 230, 176, 0.12);
  animation: livePulse 1.7s ease-in-out infinite;
}

.live-dot-danger {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 90, 110, 0.12);
}

@keyframes livePulse {
  50% { opacity: 0.45; transform: scale(0.82); }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pill-game {
  color: #160a12;
  background: linear-gradient(120deg, var(--gold), #ff9a55);
  box-shadow: 0 6px 20px rgba(255, 194, 71, 0.22);
}

.pill-soft {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid rgba(46, 230, 176, 0.22);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.78rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.1;
  text-align: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  color: #130912;
  background: linear-gradient(120deg, var(--pink), #ff7d69 52%, var(--gold));
  box-shadow: 0 12px 34px rgba(255, 77, 141, 0.25);
}

.btn-gold {
  color: #1b1203;
  background: linear-gradient(120deg, #ffd76a, var(--gold) 55%, #ff9e3d);
  box-shadow: 0 12px 34px rgba(255, 194, 71, 0.22);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--line-strong);
}

.btn-danger {
  background: rgba(255, 90, 110, 0.14);
  border-color: rgba(255, 90, 110, 0.35);
  color: #ffb5bd;
}

.btn-success {
  background: rgba(46, 230, 176, 0.14);
  border-color: rgba(46, 230, 176, 0.35);
  color: #9fffe2;
}

.btn-wide {
  width: 100%;
}

.btn-xl {
  min-height: 58px;
  padding: 1rem 1.7rem;
  border-radius: 17px;
  font-size: 1.05rem;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.36rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.mini-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.link-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-input,
.code-input,
.select {
  width: 100%;
  min-height: 50px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(5, 8, 16, 0.55);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.text-input::placeholder,
.code-input::placeholder {
  color: var(--muted-2);
}

.text-input:focus,
.code-input:focus,
.select:focus {
  border-color: rgba(255, 194, 71, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 194, 71, 0.09);
}

.text-input-lg {
  min-height: 58px;
  font-size: 1.15rem;
  font-weight: 700;
}

.code-input {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.form-error {
  min-height: 1.2em;
  margin: 0.5rem 0 0;
  color: #ff9aa5;
  font-size: 0.84rem;
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* =========================================================
   Главная
   ========================================================= */

.page-index .site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1240px, 92vw);
  margin: 0 auto;
  padding: 1.5rem 0;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.index-main {
  width: min(1240px, 92vw);
  margin: 0 auto;
  padding-bottom: 4rem;
}

.hero {
  position: relative;
  display: grid;
  justify-items: start;
  max-width: 900px;
  padding: 5.5rem 0 4.5rem;
}

.hero h1 {
  margin: 0;
  padding-top: 0.07em;
  font-family: var(--font-display);
  font-size: clamp(3.1rem, 8.5vw, 7.4rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.hero-lead {
  max-width: 660px;
  margin: 1.6rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.8rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 3rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.hero-stats div {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.hero-stats strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.hero-stats span {
  color: var(--muted);
  font-size: 0.82rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  scroll-margin-top: 2rem;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 560px;
  padding: clamp(1.4rem, 3vw, 2.4rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 36%),
    rgba(13, 20, 36, 0.8);
  box-shadow: var(--shadow);
  isolation: isolate;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}

.game-card-glow {
  position: absolute;
  z-index: -1;
  width: 30rem;
  height: 30rem;
  right: -12rem;
  top: -12rem;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.38;
}

.game-card-melody .game-card-glow { background: radial-gradient(circle, var(--pink), transparent 65%); }
.game-card-wheel .game-card-glow { background: radial-gradient(circle, var(--gold), transparent 65%); }

.game-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  font-family: var(--font-display);
  font-size: 2rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.game-card-melody .game-icon {
  color: #ffd4e4;
  background: linear-gradient(145deg, rgba(255, 77, 141, 0.32), rgba(255, 77, 141, 0.06));
}

.game-card-wheel .game-icon {
  color: #ffe3a1;
  background: linear-gradient(145deg, rgba(255, 194, 71, 0.3), rgba(255, 194, 71, 0.05));
}

.game-kicker {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.game-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.game-desc {
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.feature-list {
  display: grid;
  gap: 0.55rem;
  padding: 0;
  margin: 0.2rem 0 1.6rem;
  list-style: none;
}

.feature-list li {
  position: relative;
  padding-left: 1.35rem;
  color: #c9d2e9;
  font-size: 0.88rem;
  line-height: 1.5;
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.48em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--pink);
  transform: rotate(45deg);
}

.game-card-wheel .feature-list li::before {
  background: var(--gold);
}

.game-card-footer {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: auto;
}

.game-note {
  color: var(--muted-2);
  font-size: 0.75rem;
  text-align: center;
}

.join-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 2rem;
  margin: 1.25rem 0 5rem;
  padding: clamp(1.5rem, 3vw, 2.6rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.035);
  scroll-margin-top: 2rem;
}

.join-card h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 2.6vw, 2.4rem);
  letter-spacing: -0.03em;
}

.join-card p {
  margin: 0;
  line-height: 1.55;
}

.join-form {
  display: flex;
  gap: 0.7rem;
}

.join-form .code-input {
  flex: 1;
  min-width: 0;
}

.join-form .btn {
  flex: 0 0 auto;
}

.join-card .form-error {
  grid-column: 2;
  margin-top: -1.2rem;
}

.how-section {
  padding-bottom: 2rem;
}

.how-section h2 {
  margin: 0 0 1.4rem;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  letter-spacing: -0.035em;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.step-card {
  position: relative;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
}

.step-number {
  display: block;
  margin-bottom: 1rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
}

.step-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.step-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1240px, 92vw);
  margin: 0 auto;
  padding: 1.6rem 0 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.78rem;
}

.network-hint code {
  margin-left: 0.25rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--gold);
  font-size: 0.78rem;
}

.footer-credit {
  margin-top: 0.28rem;
  color: var(--muted-2);
  font-size: 0.7rem;
}

.footer-credit a,
.side-panel a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 13, 0.72);
  backdrop-filter: blur(10px);
}

.busy-card {
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  padding: 2rem 3rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-solid);
}

/* =========================================================
   Экран ведущего — каркас
   ========================================================= */

.page-host {
  height: 100dvh;
  overflow: hidden;
}

.host-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.host-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: 0.65rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.82);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.host-topbar-center {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.host-room-label {
  color: var(--muted-2);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.host-room-code {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.2em;
}

.host-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.icon-btn-danger:hover {
  background: rgba(255, 90, 110, 0.12);
  color: #ffadb6;
}

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

.connection-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 90, 110, 0.12);
  border-bottom: 1px solid rgba(255, 90, 110, 0.24);
  color: #ffc4ca;
  font-size: 0.82rem;
  font-weight: 700;
}

.host-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.host-view {
  width: min(1600px, 100%);
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(0.8rem, 1.6vw, 1.4rem);
}

.host-view-center {
  display: grid;
  place-items: center;
}

.loading-card,
.error-card {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  max-width: 540px;
  padding: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  text-align: center;
}

.loading-card h1,
.error-card h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  letter-spacing: -0.03em;
}

.loading-card p,
.error-card p {
  margin: 0;
  line-height: 1.55;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.055), transparent 38%),
    var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* ---------- Лобби ---------- */

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(0.9rem, 1.6vw, 1.5rem);
  align-items: start;
}

.lobby-qr-card {
  position: sticky;
  top: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.1rem, 2vw, 1.8rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 194, 71, 0.1), transparent 45%),
    var(--panel);
  box-shadow: var(--shadow);
}

.qr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
  margin-bottom: 1rem;
}

.qr-head .eyebrow {
  margin: 0;
}

.qr-frame {
  position: relative;
  width: min(100%, 390px);
  padding: 0.85rem;
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
}

.qr-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
}

.qr-scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 14%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--pink), transparent);
  box-shadow: 0 0 18px var(--pink);
  animation: qrScan 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes qrScan {
  0%, 100% { top: 14%; opacity: 0; }
  15% { opacity: 1; }
  50% { top: 84%; opacity: 1; }
  85% { opacity: 0; }
}

.qr-code-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-top: 1rem;
}

.join-code-big {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  letter-spacing: 0.28em;
  line-height: 1;
  color: var(--gold);
  text-indent: 0.28em;
}

.join-url-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin-top: 0.8rem;
}

.join-url-row code {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  margin-top: 0.7rem;
}

.network-select-wrap label {
  flex: 0 0 auto;
}

.network-select-wrap .select {
  min-height: 38px;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
}

.qr-hint {
  max-width: 390px;
  margin: 1rem 0 0;
  color: var(--muted-2);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.net-check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.72rem;
}

.net-check code {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.7rem;
}

.net-check-hint {
  max-width: 390px;
  margin: 0.35rem 0 0;
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.4;
  text-align: center;
}

.lobby-info {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.lobby-title-block {
  padding: 0.35rem 0.25rem 0.1rem;
}

.lobby-title-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 4.5vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.lobby-title-block .muted {
  max-width: 760px;
  margin: 0.7rem 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.players-panel {
  padding: 1rem 1.1rem;
}

.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 56px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.45rem 0.5rem 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.84rem;
  font-weight: 700;
}

.player-chip .chip-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 230, 176, 0.1);
}

.player-chip.offline {
  opacity: 0.5;
}

.player-chip.offline .chip-dot {
  background: var(--muted-2);
  box-shadow: none;
}

.player-chip.bot {
  border-color: rgba(46, 230, 176, 0.25);
  background: rgba(46, 230, 176, 0.06);
}

.bot-badge {
  padding: 0.08rem 0.3rem;
  border-radius: 999px;
  background: rgba(46, 230, 176, 0.14);
  color: #9fffe2;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.test-badge {
  background: rgba(255, 194, 71, 0.16);
  color: #ffe1a4;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.test-panel {
  position: fixed;
  z-index: 80;
  left: 1rem;
  bottom: 1rem;
  width: min(330px, calc(100vw - 2rem));
  max-height: min(62vh, 520px);
  overflow: auto;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(46, 230, 176, 0.32);
  border-radius: 14px;
  background: rgba(7, 11, 22, 0.95);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.test-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  color: #9fffe2;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.test-checks {
  display: grid;
  gap: 0.3rem;
}

.test-check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.test-check.done {
  color: #9fffe2;
}

.test-check-icon {
  width: 0.9rem;
  flex: 0 0 auto;
  color: var(--muted-2);
  text-align: center;
}

.test-check.done .test-check-icon {
  color: var(--teal);
}

.test-status {
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.72rem;
  line-height: 1.35;
}

.test-controls {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.test-controls .btn {
  min-height: 2rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.74rem;
}

.test-controls-row {
  display: flex;
  gap: 0.35rem;
}

.test-controls-row .btn {
  flex: 1;
}

.test-input {
  width: 100%;
  min-height: 2rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
}

.test-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.test-cells button {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 194, 71, 0.3);
  border-radius: 7px;
  background: rgba(255, 194, 71, 0.08);
  color: var(--gold);
  font-weight: 800;
  cursor: pointer;
}

.test-controls .muted {
  font-size: 0.7rem;
  line-height: 1.3;
}

.player-chip .kick {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-left: 0.1rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted-2);
  font-size: 0.72rem;
  line-height: 1;
}

.player-chip .kick:hover {
  background: rgba(255, 90, 110, 0.16);
  color: #ffaab3;
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.5rem 0;
  color: var(--muted-2);
}

.empty-state p {
  margin: 0;
  font-size: 0.84rem;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  font-size: 1.1rem;
}

.settings-panel {
  padding: 1.1rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
}

.settings-row + .settings-row {
  border-top: 1px solid var(--line);
}

.settings-row h3 {
  margin: 0 0 0.18rem;
  font-size: 0.95rem;
}

.settings-row p {
  margin: 0;
}

.settings-row-column {
  display: block;
}

.settings-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.difficulty-select {
  width: 170px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.22);
}

.segmented button {
  min-width: 42px;
  min-height: 34px;
  padding: 0.25rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented button.active {
  background: linear-gradient(120deg, var(--pink), var(--gold));
  color: #180b10;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.theme-list {
  max-height: 132px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.check-chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.check-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.check-chip input:checked + span {
  border-color: rgba(255, 194, 71, 0.45);
  background: var(--gold-soft);
  color: #ffe0a0;
}

.custom-music {
  margin-top: 0.7rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.custom-music summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  list-style: none;
}

.custom-music summary::-webkit-details-marker {
  display: none;
}

.custom-music summary::after {
  content: "+";
  color: var(--muted);
  font-size: 1.1rem;
}

.custom-music[open] summary::after {
  content: "−";
}

.custom-music[open] summary {
  margin-bottom: 0.6rem;
}

.file-drop {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.7rem;
  padding: 0.8rem;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover {
  border-color: rgba(255, 194, 71, 0.45);
  background: rgba(255, 194, 71, 0.05);
}

.file-drop-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 1.2rem;
}

.file-drop strong {
  font-size: 0.82rem;
}

.file-drop small {
  color: var(--muted-2);
  font-size: 0.72rem;
}

.custom-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.custom-track {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.16);
  font-size: 0.78rem;
}

.custom-track .track-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-track .track-artist {
  color: var(--muted-2);
  font-size: 0.72rem;
}

.custom-track button {
  border: 0;
  background: none;
  color: var(--muted-2);
  font-size: 0.9rem;
}

.custom-track button:hover {
  color: #ffaab3;
}

.info-strip {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.4rem;
  padding: 0.8rem;
  border: 1px solid rgba(255, 194, 71, 0.18);
  border-radius: 12px;
  background: rgba(255, 194, 71, 0.055);
}

.info-strip-icon {
  color: var(--gold);
  font-size: 1.2rem;
  line-height: 1.2;
}

.info-strip p {
  margin: 0;
  color: #d9c9a6;
  font-size: 0.8rem;
  line-height: 1.5;
}

.lobby-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.2rem;
}

.lobby-actions .btn-xl {
  flex: 1;
}

/* ---------- Мелодия ---------- */

.melody-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(0.8rem, 1.4vw, 1.2rem);
  min-height: 100%;
}

@media (min-width: 981px) {
  .melody-layout {
    min-height: calc(100dvh - 100px);
  }

  .melody-stage {
    min-height: calc(100dvh - 100px);
  }
}

.melody-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(0.9rem, 1.5vw, 1.4rem);
  overflow: hidden;
}

.stage-topline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stage-topline .phase-badge {
  margin-left: auto;
}

.pill-stage {
  border: 1px solid rgba(46, 230, 176, 0.4);
  background: rgba(46, 230, 176, 0.11);
  color: #9fffe2;
}

.melody-stage-rule {
  max-width: 980px;
  margin: 0.45rem 0 0;
  line-height: 1.35;
}

.melody-surrender-list {
  margin-top: 0.45rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(255, 90, 110, 0.28);
  border-radius: 9px;
  background: rgba(255, 90, 110, 0.08);
  color: #ffb5bd;
  font-size: 0.78rem;
  font-weight: 700;
}

.melody-ready-list {
  margin: 0.7rem 0 0;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(46, 230, 176, 0.24);
  border-radius: 10px;
  background: rgba(46, 230, 176, 0.07);
  color: #9fffe2;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.melody-ready-list.all-ready {
  border-color: rgba(46, 230, 176, 0.55);
  background: rgba(46, 230, 176, 0.14);
}

.melody-player-rule {
  margin: -0.35rem 0 0.7rem;
  line-height: 1.35;
}

.melody-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
}

.melody-quick-actions .btn {
  flex: 1 1 40%;
  min-height: 2.1rem;
  padding: 0.42rem 0.5rem;
  font-size: 0.76rem;
}

.melody-surrender-line {
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(255, 90, 110, 0.28);
  border-radius: 8px;
  background: rgba(255, 90, 110, 0.08);
  color: #ffb5bd;
  font-size: 0.72rem;
  font-weight: 700;
}

.melody-surrender-self {
  margin: 0 0 0.6rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(255, 90, 110, 0.28);
  border-radius: 8px;
  background: rgba(255, 90, 110, 0.08);
  color: #ffb5bd;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.melody-ready-box {
  display: grid;
  gap: 0.45rem;
  margin: 0.8rem 0 0;
  padding: 0.7rem;
  border: 1px solid rgba(46, 230, 176, 0.25);
  border-radius: 12px;
  background: rgba(46, 230, 176, 0.06);
}

.melody-ready-box p {
  margin: 0;
  text-align: center;
}

.melody-ready-box .btn {
  min-height: 2.45rem;
}

.melody-ready-box.all-ready {
  border-color: rgba(46, 230, 176, 0.55);
  background: rgba(46, 230, 176, 0.13);
}

.bet-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.8rem 0;
}

.bet-option {
  padding: 0.85rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.35rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.bet-option.selected {
  border-color: rgba(255, 194, 71, 0.55);
  background: var(--gold-soft);
  color: #ffe1a4;
}

.bet-option:active {
  transform: scale(0.98);
}

.melody-final-results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.7rem;
}

@media (max-width: 420px) {
  .bet-option {
    font-size: 1.1rem;
  }
}

.melody-final-results span {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.8rem;
}

.melody-final-results span.correct {
  border-color: rgba(46, 230, 176, 0.4);
  background: rgba(46, 230, 176, 0.1);
  color: #9fffe2;
}

.melody-visual {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 360px;
  margin: 0.8rem 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 77, 141, 0.14), transparent 58%),
    radial-gradient(ellipse at 50% 120%, rgba(255, 194, 71, 0.09), transparent 50%),
    rgba(4, 7, 14, 0.4);
}

.melody-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000, transparent 75%);
  pointer-events: none;
}

.visualizer {
  position: absolute;
  bottom: 8%;
  left: 50%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(5px, 0.8vw, 10px);
  width: min(72%, 720px);
  height: 34%;
  transform: translateX(-50%);
  opacity: 0.55;
}

.visualizer span {
  flex: 1;
  height: 20%;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--gold), var(--pink) 55%, rgba(255, 77, 141, 0.08));
  transform-origin: bottom;
  animation: eqIdle 1.8s ease-in-out infinite alternate;
  animation-delay: calc(var(--d, 0) * -0.11s);
}

.melody-visual.playing .visualizer span {
  animation: eqPlay 0.62s ease-in-out infinite alternate;
  animation-delay: calc(var(--d, 0) * -0.07s);
}

.visualizer span:nth-child(1) { --d: 1; }
.visualizer span:nth-child(2) { --d: 3; }
.visualizer span:nth-child(3) { --d: 5; }
.visualizer span:nth-child(4) { --d: 7; }
.visualizer span:nth-child(5) { --d: 2; }
.visualizer span:nth-child(6) { --d: 4; }
.visualizer span:nth-child(7) { --d: 6; }
.visualizer span:nth-child(8) { --d: 8; }
.visualizer span:nth-child(9) { --d: 3; }
.visualizer span:nth-child(10) { --d: 5; }
.visualizer span:nth-child(11) { --d: 2; }
.visualizer span:nth-child(12) { --d: 7; }
.visualizer span:nth-child(13) { --d: 4; }
.visualizer span:nth-child(14) { --d: 6; }
.visualizer span:nth-child(15) { --d: 1; }

@keyframes eqIdle {
  to { transform: scaleY(0.45); opacity: 0.6; }
}

@keyframes eqPlay {
  from { transform: scaleY(0.18); }
  to { transform: scaleY(1); }
}

.melody-center {
  position: relative;
  z-index: 2;
  max-width: 780px;
  padding: 1rem 1.4rem;
  text-align: center;
}

.melody-center h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.melody-center p {
  margin: 0.8rem 0 0;
  font-size: clamp(0.9rem, 1.3vw, 1.1rem);
}

.melody-countdown {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(255, 194, 71, 0.35);
  border-radius: 50%;
  background: rgba(7, 11, 22, 0.7);
  box-shadow: 0 0 80px rgba(255, 194, 71, 0.2);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 6rem;
  line-height: 1;
  animation: countdownPop 0.9s ease-out infinite;
}

@keyframes countdownPop {
  from { transform: scale(1.14); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

.melody-winner {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  max-width: min(86%, 760px);
  padding: 1.3rem 1.8rem;
  border: 1px solid rgba(255, 194, 71, 0.36);
  border-radius: 22px;
  background: rgba(8, 12, 24, 0.9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 50px rgba(255, 194, 71, 0.12);
  backdrop-filter: blur(14px);
  animation: winnerPop 0.35s cubic-bezier(0.2, 1.2, 0.3, 1);
}

@keyframes winnerPop {
  from { transform: scale(0.86) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.melody-winner h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.melody-winner p {
  margin: 0.35rem 0 0;
}

.big-avatar {
  display: grid;
  place-items: center;
  width: clamp(54px, 7vw, 78px);
  height: clamp(54px, 7vw, 78px);
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--pink), var(--violet));
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.2vw, 1.9rem);
  text-transform: uppercase;
}

.melody-reveal {
  position: relative;
  z-index: 4;
  max-width: min(90%, 900px);
  padding: 1.5rem 2rem;
  text-align: center;
  animation: winnerPop 0.4s cubic-bezier(0.2, 1.2, 0.3, 1);
}

.melody-reveal h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.6vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.reveal-points {
  display: inline-flex;
  margin-top: 1rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid rgba(255, 194, 71, 0.4);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.melody-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 0.8rem;
  min-height: 0;
}

.scoreboard {
  display: grid;
  align-content: start;
  gap: 0.38rem;
}

.score-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.52rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.score-row.active {
  border-color: rgba(255, 194, 71, 0.34);
  background: rgba(255, 194, 71, 0.08);
}

.score-row.me {
  border-color: rgba(46, 230, 176, 0.3);
  background: rgba(46, 230, 176, 0.07);
}

.score-rank {
  color: var(--muted-2);
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-align: center;
}

.score-name {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-name .dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.score-name .waiting-tag {
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-2);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
}

.score-points {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.round-history {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.history-item strong {
  flex: 0 0 auto;
  color: var(--text);
}

.history-item .history-points {
  margin-left: auto;
  color: var(--gold);
  font-weight: 800;
  white-space: nowrap;
}

.host-side {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 0;
}

.side-panel {
  padding: 1rem;
}

.side-panel h2,
.side-panel h3 {
  margin: 0 0 0.55rem;
  font-size: 0.98rem;
}

.side-panel h2:only-child,
.side-panel h3:only-child {
  margin-bottom: 0;
}

.control-group {
  display: grid;
  gap: 0.45rem;
}

.judge-box {
  margin-top: 0.6rem;
  padding: 0.7rem;
  border: 1px solid rgba(255, 194, 71, 0.22);
  border-radius: 12px;
  background: rgba(255, 194, 71, 0.05);
}

.judge-box p {
  margin: 0 0 0.5rem;
}

.judge-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.judge-actions .btn {
  min-height: 42px;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
}

.judge-box > .btn {
  margin-top: 0.4rem;
}

.side-tips p {
  margin: 0 0 0.7rem;
}

.shortcut-list {
  display: grid;
  gap: 0.3rem;
  color: var(--muted-2);
  font-size: 0.72rem;
}

kbd {
  display: inline-block;
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.66rem;
}

/* ---------- Поле чудес ---------- */

.wheel-layout {
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 1.2vw, 1rem);
  min-height: 100%;
}

@media (min-width: 981px) {
  .wheel-layout {
    height: calc(100dvh - 110px);
  }

  .wheel-main {
    min-height: 0;
  }

  .wheel-side {
    max-height: 100%;
    overflow-y: auto;
  }
}

.wheel-top {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.8rem 1.2rem;
}

.wheel-question {
  flex: 1 1 38%;
  min-width: 240px;
}

.wheel-question-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.wheel-question h2 {
  margin: 0;
  font-size: clamp(1rem, 1.55vw, 1.35rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.word-board {
  display: flex;
  flex: 1 1 62%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.55vw, 8px);
  min-height: 64px;
}

.word-tile {
  display: grid;
  place-items: center;
  width: clamp(30px, 3.15vw, 56px);
  aspect-ratio: 0.82;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.9vw, 1.8rem);
  line-height: 1;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.word-tile::after {
  content: "•";
  color: rgba(255, 255, 255, 0.18);
  font-family: var(--font);
  font-size: 0.8em;
}

.word-tile.revealed {
  border-color: rgba(255, 194, 71, 0.48);
  background: linear-gradient(180deg, rgba(255, 194, 71, 0.24), rgba(255, 194, 71, 0.08));
  color: var(--text);
  box-shadow: 0 0 22px rgba(255, 194, 71, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: tileFlip 0.35s ease-out;
}

.word-tile.revealed::after {
  content: none;
}

.word-board.long-word .word-tile {
  width: clamp(26px, 2.65vw, 46px);
}

@keyframes tileFlip {
  from { transform: rotateX(80deg) scale(0.8); }
  to { transform: rotateX(0) scale(1); }
}

.wheel-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: clamp(0.8rem, 1.4vw, 1.2rem);
  flex: 1;
  min-height: 0;
}

.wheel-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

.wheel-wrap {
  position: relative;
  width: min(54vh, 46vw, 580px);
  aspect-ratio: 1;
  margin: auto;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.5));
}

.wheel-svg {
  width: 100%;
  height: 100%;
  will-change: transform;
}

.wheel-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wheel-pointer {
  position: absolute;
  z-index: 5;
  top: -10px;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 38px solid var(--gold);
  transform: translateX(-50%);
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.55));
}

.wheel-pointer::after {
  content: "";
  position: absolute;
  top: -38px;
  left: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
}

.wheel-hub {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 23%;
  aspect-ratio: 1;
  border: 5px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.18), transparent 35%),
    linear-gradient(145deg, #221226, #0d1020);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), inset 0 0 0 8px rgba(255, 255, 255, 0.035);
  transform: translate(-50%, -50%);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(0.55rem, 1.1vw, 0.95rem);
  letter-spacing: 0.12em;
  line-height: 1.15;
  text-align: center;
  pointer-events: none;
}

.wheel-hub strong {
  color: var(--text);
  font-size: 1.1em;
}

.sector-card {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  min-width: 190px;
  padding: 1rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: rgba(7, 11, 22, 0.93);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  animation: winnerPop 0.35s cubic-bezier(0.2, 1.2, 0.3, 1);
}

.sector-card span {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
}

.sector-card small {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sector-card.bankrupt span { color: #ff7c8a; }
.sector-card.pass span { color: var(--blue); }
.sector-card.open2 span { color: var(--teal); }
.sector-card.prize span { color: var(--gold); }
.sector-card.double span { color: var(--violet); }
.sector-card.points span { color: var(--gold); }

.wheel-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.active-player {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.active-player > div {
  display: grid;
  min-width: 0;
}

.active-player strong {
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--violet), var(--blue));
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.wheel-status {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: right;
}

.wheel-announcer {
  margin-top: 0.45rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(255, 194, 71, 0.38);
  border-radius: 10px;
  background: rgba(255, 194, 71, 0.12);
  color: #ffe1a4;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
}

.letter-reveal {
  position: absolute;
  z-index: 12;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  min-width: min(340px, 76%);
  padding: 0.6rem 2.4rem 1.2rem;
  border: 1px solid rgba(255, 194, 71, 0.45);
  border-radius: 28px;
  background: rgba(7, 11, 22, 0.94);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.7), 0 0 60px rgba(255, 194, 71, 0.12);
  transform: translate(-50%, -50%);
  animation: letterPop 0.28s cubic-bezier(0.2, 1.2, 0.3, 1);
  pointer-events: none;
}

.letter-reveal span {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(7rem, 17vw, 14rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.letter-reveal .letter-verdict {
  margin-bottom: 0.2rem;
  color: var(--teal);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.2vw, 2.8rem);
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.letter-reveal .letter-points {
  margin-top: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(46, 230, 176, 0.12);
  color: var(--teal);
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.letter-reveal.miss .letter-verdict {
  color: var(--danger);
}

.letter-reveal.miss .letter-points {
  display: none;
}

.letter-reveal.miss {
  animation: letterShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.letter-reveal.miss span {
  color: var(--danger);
}

.letter-reveal p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

@keyframes letterShake {
  10%, 90% { transform: translate(calc(-50% - 2px), -50%); }
  20%, 80% { transform: translate(calc(-50% + 4px), -50%); }
  30%, 50%, 70% { transform: translate(calc(-50% - 7px), -50%); }
  40%, 60% { transform: translate(calc(-50% + 7px), -50%); }
}

.letter-status {
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(46, 230, 176, 0.35);
  border-radius: 10px;
  background: rgba(46, 230, 176, 0.09);
  color: #9fffe2;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.letter-status.miss {
  border-color: rgba(255, 90, 110, 0.4);
  background: rgba(255, 90, 110, 0.1);
  color: #ffb5bd;
}

.open2-panel {
  position: absolute;
  z-index: 11;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(780px, 90%);
  max-height: 92%;
  padding: 1.1rem 1.35rem 1.2rem;
  border: 1px solid rgba(46, 230, 176, 0.4);
  border-radius: 22px;
  background: rgba(7, 11, 22, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72), 0 0 70px rgba(46, 230, 176, 0.1);
  transform: translate(-50%, -50%);
  animation: letterPop 0.28s cubic-bezier(0.2, 1.2, 0.3, 1);
  overflow-y: auto;
}

.open2-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.4rem);
  line-height: 1.05;
}

.open2-board {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0.2rem 0;
}

.open2-board .word-tile {
  width: clamp(28px, 3.2vw, 52px);
  font-size: clamp(1.1rem, 2vw, 2rem);
}

.open2-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.open2-result {
  min-height: 2.4rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

.open2-result.hit {
  border-color: rgba(46, 230, 176, 0.4);
  background: rgba(46, 230, 176, 0.1);
  color: #9fffe2;
}

.open2-result.miss {
  border-color: rgba(255, 90, 110, 0.4);
  background: rgba(255, 90, 110, 0.1);
  color: #ffb5bd;
}

.open2-picked {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  min-height: 0;
}

.open2-picked span {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.open2-hint {
  margin: 0;
  text-align: center;
}

.letter-reveal.miss {
  border-color: rgba(255, 90, 110, 0.45);
}

.letter-reveal.miss span {
  color: var(--danger);
}

@keyframes letterPop {
  from { transform: translate(-50%, -50%) scale(0.85); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.wheel-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.9rem;
  width: 100%;
  margin-top: 0.55rem;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.wheel-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  white-space: nowrap;
}

.wheel-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.turn-order-title {
  margin: 0.75rem 0 0.35rem;
  color: var(--muted-2);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.turn-order {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.turn-order-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.turn-order-item .order-number {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-2);
  font-size: 0.6rem;
}

.turn-order-item.active {
  border-color: rgba(255, 194, 71, 0.5);
  background: var(--gold-soft);
  color: #ffe1a4;
}

.turn-order-item.active .order-number {
  background: var(--gold);
  color: #1b1203;
}

.turn-order-item.offline {
  opacity: 0.45;
}

.wheel-side {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 2px;
}

.scoreboard-compact .score-row {
  padding: 0.45rem 0.55rem;
}

.manual-controls {
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.manual-controls summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.letter-keyboard {
  display: grid;
  gap: 4px;
  margin-top: 0.55rem;
}

.letter-keyboard .keyboard-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 11), minmax(0, 1fr));
  gap: 4px;
}

.letter-keyboard .key {
  min-height: 30px;
  padding: 0.1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
}

.letter-keyboard .key.used {
  opacity: 0.28;
  text-decoration: line-through;
}

.letter-keyboard .key:hover:not(:disabled) {
  background: rgba(255, 194, 71, 0.14);
}

.letter-keyboard.compact {
  margin-bottom: 0.5rem;
}

.manual-word-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.manual-word-row .text-input {
  min-height: 38px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}

/* =========================================================
   Модалки, тосты, конфетти
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3, 5, 11, 0.78);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  width: min(460px, 100%);
  padding: 1.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-card h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.qr-modal-img {
  width: min(320px, 76vw);
  margin: 0 auto 1rem;
  padding: 0.7rem;
  border-radius: 18px;
  background: #fff;
}

.qr-modal-code {
  margin-bottom: 0.4rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 2.1rem;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
}

.qr-modal-card #qr-modal-url {
  margin: 0.3rem 0 0.7rem;
  overflow-wrap: anywhere;
}

.sound-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 77, 141, 0.18), transparent 55%),
    rgba(4, 6, 13, 0.86);
  backdrop-filter: blur(14px);
}

.sound-gate-card {
  display: grid;
  justify-items: center;
  width: min(520px, 100%);
  padding: clamp(1.8rem, 4vw, 3rem);
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  text-align: center;
}

.sound-gate-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin-bottom: 1rem;
  border-radius: 22px;
  background: var(--gold-soft);
  border: 1px solid rgba(255, 194, 71, 0.28);
  font-size: 2rem;
}

.sound-gate-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.sound-gate-card p {
  margin: 0.8rem 0 1.2rem;
  line-height: 1.55;
}

.sound-gate-card .link-btn {
  margin-top: 0.8rem;
}

.toast-stack {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.45rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(10, 15, 28, 0.95);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.4;
  animation: toastIn 0.25s ease-out;
}

.toast::before {
  content: "●";
  color: var(--muted);
  font-size: 0.6rem;
  line-height: 1.9;
}

.toast.success::before { color: var(--success); }
.toast.error::before { color: var(--danger); }
.toast.warning::before { color: var(--gold); }
.toast.buzz::before { color: var(--pink); }

.toast.out {
  animation: toastOut 0.25s ease-in forwards;
}

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

@keyframes toastOut {
  to { transform: translateY(8px); opacity: 0; }
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 75;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* =========================================================
   Телефон игрока
   ========================================================= */

.page-play {
  min-height: 100dvh;
  overflow-x: hidden;
  background: #070b16;
}

.join-screen {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.join-panel {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  padding: clamp(1.2rem, 5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 77, 141, 0.13), transparent 55%),
    var(--panel);
  box-shadow: var(--shadow);
}

.join-game-badge {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.4rem 0 0.9rem;
}

.join-game-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 194, 71, 0.3);
  border-radius: 16px;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.join-game-badge .eyebrow {
  margin: 0 0 0.2rem;
  color: var(--muted);
}

.join-game-badge .eyebrow strong {
  color: var(--gold);
  letter-spacing: 0.15em;
}

.join-game-badge h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.join-panel > .muted {
  margin: 0 0 1.2rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.join-player-form {
  display: grid;
  gap: 0.5rem;
}

.join-player-form label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.join-player-form .btn {
  margin-top: 0.35rem;
}

.join-panel > .small {
  margin: 1rem 0 0;
  text-align: center;
}

.text-link {
  color: var(--gold);
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.player-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: max(0.65rem, env(safe-area-inset-top)) 0.85rem max(0.65rem, env(safe-area-inset-bottom));
}

.player-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.35rem 0 0.6rem;
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.player-identity-text {
  display: grid;
  min-width: 0;
}

.player-identity-text strong {
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-top-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.score-pill {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0.34rem 0.65rem;
  border: 1px solid rgba(255, 194, 71, 0.28);
  border-radius: 10px;
  background: var(--gold-soft);
}

.score-pill span {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.score-pill small {
  color: var(--muted);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.connection-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(46, 230, 176, 0.1);
}

.connection-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 90, 110, 0.1);
}

.player-banner {
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 194, 71, 0.25);
  border-radius: 10px;
  background: var(--gold-soft);
  color: #ffe1a4;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.player-content {
  flex: 1;
  min-height: 0;
}

.player-loading {
  display: grid;
  place-items: center;
  gap: 0.7rem;
  padding: 3rem 0;
  color: var(--muted);
}

.player-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 0 0.2rem;
  color: var(--muted-2);
  font-size: 0.7rem;
}

.player-footer-dots {
  opacity: 0.5;
}

.player-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.melody-player,
.wheel-player {
  display: grid;
  gap: 0.65rem;
}

.player-round-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.player-round-line .pill {
  font-size: 0.68rem;
}

.hint-card,
.turn-card,
.wait-card,
.role-card,
.answer-card,
.round-result,
.spectator-card,
.notice-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.notice-card {
  border-color: rgba(255, 194, 71, 0.24);
  background: var(--gold-soft);
  color: #ffe1a4;
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Мелодия на телефоне */

.buzzer-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(52vh, 380px);
  padding: 1rem 0;
}

.buzzer-ring {
  position: absolute;
  width: min(78vw, 330px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 77, 141, 0.25);
  border-radius: 50%;
  animation: buzzRing 2.4s ease-out infinite;
}

.buzzer-ring.delay {
  animation-delay: 1.2s;
}

@keyframes buzzRing {
  from { transform: scale(0.86); opacity: 0.7; }
  to { transform: scale(1.12); opacity: 0; }
}

.buzzer {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.45), transparent 16%),
    radial-gradient(circle at 50% 55%, #ff7a7f, #ff4d8d 42%, #c81c68 100%);
  box-shadow:
    0 24px 60px rgba(255, 77, 141, 0.35),
    inset 0 -10px 24px rgba(0, 0, 0, 0.24),
    inset 0 4px 10px rgba(255, 255, 255, 0.3);
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5.4vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: normal;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.1s ease, filter 0.2s ease;
  animation: buzzerPulse 1.8s ease-in-out infinite;
}

.buzzer:active,
.buzzer.pressed {
  transform: scale(0.95);
}

.buzzer:disabled,
.buzzer.locked {
  filter: grayscale(0.55) brightness(0.6);
  animation: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.buzzer.cooling {
  filter: saturate(0.7);
  animation: none;
}

@keyframes buzzerPulse {
  0%, 100% { box-shadow: 0 24px 60px rgba(255, 77, 141, 0.32), inset 0 -10px 24px rgba(0, 0, 0, 0.24), inset 0 4px 10px rgba(255, 255, 255, 0.3); }
  50% { box-shadow: 0 26px 80px rgba(255, 77, 141, 0.5), inset 0 -10px 24px rgba(0, 0, 0, 0.24), inset 0 4px 10px rgba(255, 255, 255, 0.3); }
}

.buzzer-sub {
  margin-top: 1.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

.buzz-state {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  text-align: center;
}

.buzz-state h2 {
  margin: 0;
  font-size: 1.15rem;
}

.buzz-state p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.answer-card {
  display: grid;
  gap: 0.55rem;
  border-color: rgba(255, 194, 71, 0.3);
  background: rgba(255, 194, 71, 0.06);
}

.answer-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.answer-card .text-input {
  min-height: 52px;
  font-size: 1rem;
}

.answer-timer {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
}

.round-result {
  display: grid;
  gap: 0.3rem;
  text-align: center;
}

.round-result h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 7vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.round-result p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.result-points {
  justify-self: center;
  margin-top: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-family: var(--font-display);
  font-size: 1rem;
}

.leaderboard {
  display: grid;
  gap: 0.35rem;
}

.leader-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 0.55rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.8rem;
}

.leader-row.me {
  border: 1px solid rgba(46, 230, 176, 0.28);
  background: rgba(46, 230, 176, 0.07);
}

.leader-rank {
  color: var(--muted-2);
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-align: center;
}

.leader-row.rank-1 .leader-rank { color: var(--gold); }
.leader-row.rank-2 .leader-rank { color: #cfd7ee; }
.leader-row.rank-3 .leader-rank { color: #d69a6a; }

.leader-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-points {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

/* Поле чудес на телефоне */

.mini-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 0.7rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.mini-tile {
  display: grid;
  place-items: center;
  width: clamp(22px, 6.3vw, 32px);
  aspect-ratio: 0.82;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 2.8vw, 0.95rem);
  text-transform: uppercase;
}

.mini-tile::after {
  content: "•";
  color: rgba(255, 255, 255, 0.2);
  font-family: var(--font);
}

.mini-tile.revealed {
  border-color: rgba(255, 194, 71, 0.4);
  background: rgba(255, 194, 71, 0.16);
  color: var(--text);
}

.mini-tile.revealed::after {
  content: none;
}

.mini-board.long-word .mini-tile {
  width: clamp(19px, 5.4vw, 28px);
}

.open2-word {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
  margin: 0.2rem 0;
}

.open2-word-tile {
  display: grid;
  place-items: center;
  width: clamp(20px, 6vw, 30px);
  aspect-ratio: 0.82;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 3.2vw, 1.25rem);
  line-height: 1;
  text-transform: uppercase;
}

.open2-word-tile::after {
  content: "•";
  color: rgba(255, 255, 255, 0.2);
  font-family: var(--font);
  font-size: 0.72em;
}

.open2-word-tile.revealed {
  border-color: rgba(46, 230, 176, 0.45);
  background: rgba(46, 230, 176, 0.12);
  color: var(--text);
}

.open2-word-tile.revealed::after {
  content: none;
}

.open2-word-tile.pickable {
  color: var(--gold);
  cursor: pointer;
  background: rgba(255, 194, 71, 0.08);
  border-color: rgba(255, 194, 71, 0.28);
}

.open2-word-tile.pickable::after {
  content: none;
}

.open2-word-tile.pickable:active {
  transform: scale(0.94);
}

.open2-word-tile.pickable:disabled {
  opacity: 0.45;
  cursor: default;
}

.open2-tile-number {
  font-family: var(--font);
  font-size: clamp(0.6rem, 2.2vw, 0.78rem);
  font-weight: 800;
}

.open2-word.long-word .open2-word-tile {
  width: clamp(17px, 5.2vw, 26px);
}

.open2-turn-hint {
  margin: 0;
  line-height: 1.35;
  text-align: center;
}

.open2-pending,
.open2-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.open2-pending {
  border: 1px solid rgba(255, 194, 71, 0.35);
  background: var(--gold-soft);
  color: #ffe1a4;
}

.open2-waiting {
  border: 1px solid rgba(46, 230, 176, 0.35);
  background: rgba(46, 230, 176, 0.08);
  color: #9fffe2;
}

.open2-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 194, 71, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: open2spin 0.7s linear infinite;
}

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

.turn-order-line {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scrollbar-width: none;
}

.turn-order-line::-webkit-scrollbar {
  display: none;
}

.turn-order-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  flex: 0 0 auto;
  padding: 0.24rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.turn-order-chip b {
  color: var(--muted-2);
  font-size: 0.6rem;
}

.turn-order-chip.active {
  border-color: rgba(255, 194, 71, 0.5);
  background: var(--gold-soft);
  color: #ffe1a4;
}

.turn-order-chip.active b {
  color: var(--gold);
}

.turn-order-chip.offline {
  opacity: 0.4;
}

.letter-callout {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(255, 194, 71, 0.35);
  border-radius: 13px;
  background: var(--gold-soft);
  animation: letterCalloutIn 0.25s ease-out;
}

.letter-callout-mark {
  color: var(--teal);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.letter-callout-char {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 0.9;
  text-transform: uppercase;
}

.letter-callout-text {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.letter-callout-text strong {
  color: #ffe1a4;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.letter-callout-text p {
  margin: 0;
  color: #ffe1a4;
  font-size: 0.72rem;
  line-height: 1.3;
}

.letter-callout.miss {
  border-color: rgba(255, 90, 110, 0.35);
  background: rgba(255, 90, 110, 0.1);
  animation: letterCalloutShake 0.35s ease-in-out;
}

.letter-callout.miss .letter-callout-mark,
.letter-callout.miss .letter-callout-char,
.letter-callout.miss .letter-callout-text strong {
  color: var(--danger);
}

.letter-callout.miss .letter-callout-text p {
  color: #ffb5bd;
}

@keyframes letterCalloutIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes letterCalloutShake {
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

.hint-card {
  display: grid;
  gap: 0.25rem;
}

.hint-card .hint-label {
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hint-card p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
}

.turn-card {
  display: grid;
  gap: 0.55rem;
}

.turn-card.active-turn {
  border-color: rgba(255, 194, 71, 0.45);
  background: linear-gradient(180deg, rgba(255, 194, 71, 0.12), rgba(255, 194, 71, 0.035));
  box-shadow: 0 0 40px rgba(255, 194, 71, 0.08);
}

.turn-card h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.turn-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.spin-btn {
  min-height: 64px;
  border-radius: 18px;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.spin-btn .spin-icon {
  display: inline-block;
  font-size: 1.25rem;
  animation: spin 6s linear infinite;
}

.spin-anim {
  display: grid;
  place-items: center;
  gap: 0.6rem;
  padding: 1.1rem;
  text-align: center;
}

.spin-anim .disc {
  position: relative;
  width: 92px;
  height: 92px;
  border: 5px solid rgba(255, 194, 71, 0.45);
  border-radius: 50%;
  background: conic-gradient(var(--gold) 0 20%, var(--pink) 20% 40%, var(--teal) 40% 60%, var(--blue) 60% 80%, var(--violet) 80% 100%);
  animation: spin 0.8s linear infinite;
}

.spin-anim .disc::after {
  content: "";
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: var(--bg);
}

.spin-anim p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.sector-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 194, 71, 0.3);
  border-radius: 11px;
  background: var(--gold-soft);
}

.sector-badge strong {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.sector-badge span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.timer-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.timer-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.3s linear;
}

.keyboard {
  display: grid;
  gap: 4px;
}

.keyboard-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 11), minmax(0, 1fr));
  gap: 4px;
}

.key {
  min-height: 42px;
  padding: 0.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  touch-action: manipulation;
  transition: background 0.12s ease, transform 0.12s ease;
}

.key:active:not(:disabled) {
  transform: scale(0.94);
  background: var(--gold-soft);
}

.key.used {
  opacity: 0.25;
  text-decoration: line-through;
}

.key:disabled {
  opacity: 0.25;
}

.keyboard-hint {
  color: var(--muted-2);
  font-size: 0.7rem;
  text-align: center;
}

.word-guess-btn {
  min-height: 44px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.word-guess-btn:hover {
  color: var(--text);
  border-color: rgba(255, 194, 71, 0.4);
}

.spectator-card {
  text-align: center;
}

.spectator-card .spectator-icon {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 1.6rem;
}

.spectator-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.spectator-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.first-player-card {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding: 1.1rem;
  border: 1px solid rgba(255, 194, 71, 0.42);
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 0%, rgba(255, 194, 71, 0.18), transparent 45%),
    rgba(255, 194, 71, 0.07);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.first-player-card h2 {
  margin: 0;
  font-size: clamp(1.2rem, 5vw, 1.5rem);
}

.first-player-card p {
  margin: 0;
  line-height: 1.4;
}

.catalog-host-state {
  display: grid;
  gap: 0.7rem;
  margin: 0.2rem 0 0.4rem;
}

.catalog-host-games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.catalog-host-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
}

.catalog-host-card strong {
  color: var(--gold);
  font-size: 0.95rem;
}

.catalog-host-card small {
  color: var(--muted);
  font-size: 0.72rem;
}

.catalog-host-icon {
  font-size: 1.2rem;
}

.catalog-host-status {
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  background: rgba(255, 194, 71, 0.09);
  color: #ffe1a4;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 560px) {
  .catalog-host-games {
    grid-template-columns: 1fr;
  }
}

.catalog-choices {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.3rem;
}

.catalog-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.8rem;
  border: 1px solid rgba(255, 194, 71, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
  font: inherit;
}

.catalog-choice:not(.disabled) {
  cursor: pointer;
}

.catalog-choice:not(.disabled):hover,
.catalog-choice:not(.disabled):focus {
  border-color: var(--gold);
  background: rgba(255, 194, 71, 0.1);
  outline: none;
}

.catalog-choice.disabled {
  opacity: 0.65;
}

.catalog-choice-icon {
  grid-row: 1 / 3;
  font-size: 1.5rem;
}

.catalog-choice strong {
  font-size: 1rem;
}

.catalog-choice > span:last-child {
  color: var(--muted);
  font-size: 0.74rem;
}

.first-player-count {
  padding: 0.4rem 0.6rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.first-settings {
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.first-settings summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 800;
}

.first-game-controls {
  margin-top: 0.8rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(255, 194, 71, 0.22);
  border-radius: 11px;
  background: rgba(255, 194, 71, 0.05);
}

.first-game-controls summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 800;
}

.first-game-controls .btn {
  margin-top: 0.45rem;
}

.first-bot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.74rem;
}

.first-bot-row strong {
  color: var(--gold);
}

.first-bot-row .btn {
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.72rem;
}

.first-field {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.first-field select {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
}

.first-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.first-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 0.7rem;
  line-height: 1.2;
}

.first-check input {
  accent-color: var(--gold);
}

.wait-card {
  text-align: center;
}

.wait-card h2 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
}

.wait-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.wait-dots {
  display: inline-flex;
  gap: 5px;
  margin-top: 0.6rem;
}

.wait-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: waitDot 1.2s ease-in-out infinite;
}

.wait-dots span:nth-child(2) { animation-delay: 0.15s; }
.wait-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes waitDot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.6rem;
  background: rgba(3, 5, 11, 0.7);
  backdrop-filter: blur(8px);
}

.sheet-card {
  position: relative;
  width: min(520px, 100%);
  padding: 1.4rem 1.2rem max(1.2rem, env(safe-area-inset-bottom));
  border: 1px solid var(--line-strong);
  border-radius: 24px 24px 18px 18px;
  background: var(--panel-solid);
  box-shadow: 0 -20px 70px rgba(0, 0, 0, 0.5);
  animation: sheetUp 0.24s ease-out;
}

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

.sheet-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.confirm-letter {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0.8rem auto;
  border: 1px solid rgba(255, 194, 71, 0.45);
  border-radius: 20px;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 3rem;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}

.sheet-card .text-input {
  margin-top: 0.4rem;
}

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

@media (max-width: 1180px) {
  .melody-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .wheel-main {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .host-topbar .icon-label {
    display: none;
  }

  .icon-btn {
    padding: 0.35rem 0.55rem;
  }
}

@media (max-width: 980px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .lobby-qr-card {
    position: static;
  }

  .qr-frame {
    width: min(100%, 300px);
  }

  .melody-layout,
  .wheel-main {
    grid-template-columns: 1fr;
  }

  .host-side,
  .wheel-side {
    max-height: none;
    overflow: visible;
  }

  .melody-visual {
    min-height: 300px;
  }

  .wheel-wrap {
    width: min(62vh, 76vw, 540px);
  }

  .wheel-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .wheel-side .side-panel:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .games-grid,
  .steps-grid {
    grid-template-columns: 1fr;
  }

  .game-card {
    min-height: 0;
  }

  .join-card {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .join-card .form-error {
    grid-column: 1;
    margin-top: 0;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-index .site-header {
    padding: 1.1rem 0;
  }

  .header-badge {
    display: none;
  }

  .hero {
    padding: 3.6rem 0 3rem;
  }
}

@media (max-width: 720px) {
  .page-host {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .host-app {
    min-height: 100dvh;
    height: auto;
  }

  .host-main {
    overflow: visible;
  }

  .host-topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
  }

  .host-topbar-center {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 0.35rem;
    border-top: 1px solid var(--line);
  }

  .brand-text {
    font-size: 0.9rem;
  }

  .host-view {
    padding: 0.7rem;
  }

  .lobby-title-block h1 {
    font-size: clamp(2rem, 9vw, 3.2rem);
  }

  .lobby-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .lobby-actions .btn-xl {
    width: 100%;
  }

  .wheel-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }

  .wheel-question {
    min-width: 0;
  }

  .wheel-side {
    display: flex;
  }

  .wheel-stage-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .wheel-status {
    text-align: left;
  }

  .word-tile {
    width: clamp(26px, 7vw, 44px);
  }

  .melody-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: clamp(2.6rem, 15vw, 4.2rem);
  }

  .hero-stats {
    gap: 1.2rem;
  }

  .game-card {
    padding: 1.2rem;
    border-radius: 24px;
  }

  .join-form {
    flex-direction: column;
  }

  .join-form .btn {
    width: 100%;
  }

  .join-code-big {
    font-size: 1.9rem;
  }

  .host-topbar-actions .icon-btn {
    padding: 0.3rem 0.45rem;
  }

  .host-topbar-actions .icon-label {
    display: none;
  }

  .host-room-code {
    font-size: 1.05rem;
  }

  .top-players {
    display: none;
  }

  .player-screen {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .key {
    min-height: 39px;
    font-size: 0.76rem;
  }

  .difficulty-select {
    width: 100%;
  }

  .sheet-card {
    border-radius: 20px 20px 14px 14px;
  }
}

@media (max-width: 380px) {
  .keyboard-row {
    gap: 3px;
  }

  .key {
    min-height: 36px;
    font-size: 0.7rem;
  }

  .score-pill small {
    display: none;
  }

  .player-identity-text .muted {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}


/* Режим смарт-ТВ: экран только показывает игру, все действия — на телефонах. */
body.tv .controls-panel,
body.tv .settings-panel,
body.tv .lobby-actions,
body.tv .manual-controls,
body.tv .side-tips,
body.tv #network-select-wrap,
body.tv .control-group {
  display: none !important;
}

body.tv .host-topbar-actions #qr-btn {
  display: none;
}


/* QR-старт и каталог на большом экране */
.join-url-row,
#network-select-wrap,
.net-check,
.net-check-hint {
  display: none !important;
}

.start-stage {
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  width: min(760px, 94vw);
  text-align: center;
}

.start-stage h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 4.4rem);
  line-height: 1;
}

.start-lead {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.25rem);
  line-height: 1.5;
}

.start-qr-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(430px, 58vh, 76vw);
  aspect-ratio: 1;
  margin: 0.4rem auto;
  padding: 1rem;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 194, 71, 0.35), 0 26px 80px rgba(0, 0, 0, 0.5), 0 0 70px rgba(255, 194, 71, 0.18);
}

.start-qr-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.start-qr-glow {
  position: absolute;
  inset: -10px;
  border-radius: 34px;
  border: 2px solid rgba(255, 194, 71, 0.45);
  animation: startQrPulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes startQrPulse {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.025); opacity: 0.85; }
}

.start-code {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.start-code strong {
  margin-left: 0.3rem;
  color: var(--gold);
  font-size: 1.5rem;
  letter-spacing: 0.12em;
}

.start-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.catalog-stage {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  width: min(1280px, 94vw);
  text-align: center;
}

.catalog-stage h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1;
}

.catalog-screen-subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.35vw, 1.2rem);
  line-height: 1.5;
}

.catalog-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  width: 100%;
  margin-top: 0.6rem;
}

.catalog-showcase-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.6rem;
  padding: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  text-align: left;
  animation: showcaseFloat 7s ease-in-out infinite;
}

.catalog-showcase-card.showcase-wheel {
  box-shadow: inset 0 0 0 1px rgba(255, 194, 71, 0.14), 0 20px 60px rgba(255, 174, 0, 0.08);
}

.catalog-showcase-card.showcase-melody {
  box-shadow: inset 0 0 0 1px rgba(255, 107, 180, 0.14), 0 20px 60px rgba(255, 107, 180, 0.08);
  animation-delay: -3.5s;
}

.catalog-showcase-card h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 2rem);
}

.catalog-showcase-card p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.78rem, 1vw, 0.95rem);
  line-height: 1.45;
}

.showcase-art {
  display: grid;
  place-items: center;
  min-height: 170px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 194, 71, 0.16), transparent 62%);
}

.showcase-wheel-ring {
  display: grid;
  place-items: center;
  align-content: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, #ffb020 0deg 8deg, #ff4d8d 8deg 16deg, #4aa8ff 16deg 24deg, #33d69f 24deg 32deg);
  box-shadow: 0 0 0 9px #141d31, 0 0 0 11px rgba(255, 194, 71, 0.65), 0 18px 42px rgba(0, 0, 0, 0.38);
  animation: wheelShowcaseSpin 18s linear infinite;
}

.showcase-wheel-ring span {
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.showcase-eq {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  height: 130px;
}

.showcase-eq span {
  width: 15px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #ff8fc4, #ff4d8d);
  animation: eqShowcase 1.15s ease-in-out infinite alternate;
}

.showcase-eq span:nth-child(1) { height: 44%; animation-delay: -0.2s; }
.showcase-eq span:nth-child(2) { height: 86%; animation-delay: -0.65s; }
.showcase-eq span:nth-child(3) { height: 58%; animation-delay: -0.35s; }
.showcase-eq span:nth-child(4) { height: 96%; animation-delay: -0.85s; }
.showcase-eq span:nth-child(5) { height: 70%; animation-delay: -0.5s; }

.showcase-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.showcase-chips span {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.7rem;
}

.catalog-screen-first {
  margin: 0.2rem 0 0;
  padding: 0.55rem 0.9rem;
  border-radius: 9px;
  background: rgba(255, 194, 71, 0.1);
  color: #ffe1a4;
  font-size: 0.9rem;
  font-weight: 700;
}

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

@keyframes eqShowcase {
  from { transform: scaleY(0.45); }
  to { transform: scaleY(1); }
}

@keyframes showcaseFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 760px) {
  .catalog-showcase { grid-template-columns: 1fr; }
  .showcase-art { min-height: 130px; }
}
