:root {
  --green: #58cc02;
  --green-d: #46a302;
  --green-l: #d7ffb8;
  --blue: #1cb0f6;
  --blue-d: #1899d6;
  --blue-l: #ddf4ff;
  --yellow: #ffc800;
  --yellow-d: #e0a800;
  --yellow-l: #fff5d1;
  --red: #ff4b4b;
  --red-d: #ea2b2b;
  --red-l: #ffdfe0;
  --purple: #ce82ff;
  --purple-d: #a568cc;
  --text: #3c3c3c;
  --muted: #777;
  --soft: #afafaf;
  --line: #e5e5e5;
  --bg: #fff;
  --bg-2: #f7f7f7;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.screen { display: none; height: 100%; }
.screen.active { display: flex; }

.i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Объёмные кнопки ---------- */
.btn {
  --shade: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--blue);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--shade);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.04); background-color: var(--bg-2); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--shade); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { --shade: var(--green-d); background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #61e002; }
.btn.ghost { --shade: transparent; border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg-2); }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 12px; }
.btn.big { width: 100%; padding: 15px 20px; font-size: 17px; border-radius: 16px; }

.icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--blue);
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.icon-btn.off { color: var(--soft); }
.icon-btn.off::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 3px;
  border-radius: 3px;
  background: var(--red);
  transform: rotate(-45deg);
}

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field-label { font-size: 14px; font-weight: 800; color: var(--muted); }
.field-label em { font-style: normal; font-weight: 700; color: var(--soft); }
input {
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 13px 16px;
  outline: none;
  transition: border-color .15s, background .15s;
}
input::placeholder { color: var(--soft); }
input:focus { border-color: var(--blue); background: var(--bg); }
#codeInput { text-transform: uppercase; letter-spacing: .4em; font-weight: 900; font-size: 22px; text-align: center; }

.segmented { display: flex; gap: 8px; }
.segmented button {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.segmented button:active { transform: translateY(3px); box-shadow: none; }
.segmented button.selected { border-color: #84d8ff; background: var(--blue-l); color: var(--blue); box-shadow: 0 3px 0 #84d8ff; }

.error { color: var(--red); min-height: 1.2em; margin: 12px 0 0; font-size: 15px; text-align: center; }
.hint { min-height: 1.2em; font-size: 14px; color: var(--muted); margin: 12px 0 0; text-align: center; }

.wordmark { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 22px; color: var(--green); letter-spacing: -.02em; }
.wordmark-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--green); box-shadow: 0 3px 0 var(--green-d); }

/* ---------- Меню ---------- */
#menu { overflow-y: auto; padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
.menu { width: 100%; display: flex; flex-direction: column; min-height: 100%; }
.menu-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
}
.menu-grid { width: min(520px, 100%); margin: 0 auto; padding: 28px 20px 40px; }

.intro { text-align: center; }
.logo-wrap {
  width: 128px;
  height: 128px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow-l);
  border: 3px solid #ffe58a;
}
.logo { font-size: 76px; line-height: 1; height: 1em; display: inline-block; animation: hold-laugh 4s ease-in-out infinite; transform-origin: 50% 70%; }
.logo::before { content: '😐'; animation: hold-laugh-face 4s steps(1) infinite; }
@keyframes hold-laugh-face {
  0% { content: '😐'; }
  35% { content: '😬'; }
  55% { content: '🤭'; }
  75% { content: '😂'; }
  92% { content: '😐'; }
}
@keyframes hold-laugh {
  0%, 34% { transform: rotate(0); }
  38% { transform: rotate(-4deg); }
  42% { transform: rotate(4deg); }
  46% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
  55% { transform: rotate(-6deg); }
  60% { transform: rotate(6deg); }
  75% { transform: scale(1.15) rotate(-10deg); }
  80% { transform: scale(1.1) rotate(10deg); }
  85% { transform: scale(1.15) rotate(-8deg); }
  92%, 100% { transform: rotate(0); }
}

h1 { margin: 0; font-size: clamp(38px, 8vw, 52px); font-weight: 900; line-height: 1.05; letter-spacing: -.02em; }
.tagline { margin: 8px 0 24px; font-size: 18px; color: var(--muted); }

.panel > .field-label { display: block; margin-bottom: 10px; }

.modes { display: flex; flex-direction: column; gap: 10px; }
.mode {
  --c: var(--blue);
  --cd: var(--blue-d);
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--bg);
  text-align: left;
  box-shadow: 0 4px 0 var(--line);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .15s, border-color .15s;
}
.mode:hover { background: var(--bg-2); }
.mode:active { transform: translateY(4px); box-shadow: none; }
.mode-group { --c: var(--purple); --cd: var(--purple-d); }
.mode-private { --c: var(--yellow); --cd: var(--yellow-d); }
.mode-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--c);
  color: #fff;
  box-shadow: 0 3px 0 var(--cd);
}
.mode-icon .i { width: 24px; height: 24px; }
.mode-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mode-title { font-size: 18px; font-weight: 900; }
.mode-sub { font-size: 14px; color: var(--muted); }
.mode-check {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  color: transparent;
}
.mode-check .i { width: 16px; height: 16px; stroke-width: 3.5; }
.mode.selected { border-color: #84d8ff; background: var(--blue-l); box-shadow: 0 4px 0 #84d8ff; }
.mode.selected .mode-check { background: var(--blue); border-color: var(--blue); color: #fff; }

.ranked-note { margin: 14px 0 20px; padding: 10px 14px; border-radius: 12px; background: var(--bg-2); font-size: 14px; color: var(--muted); text-align: center; }
.ranked-note:empty { display: none; }
.ranked-note b { color: var(--yellow-d); }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 800; cursor: pointer; }

.steps { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.steps li {
  --c: var(--blue);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px;
  border-radius: 16px;
  border: 2px solid var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.3;
}
.steps li span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-weight: 900;
  font-size: 17px;
}
.steps li b { color: var(--text); font-size: 15px; font-weight: 900; }
.steps .step-yellow { --c: var(--yellow); }
.steps .step-red { --c: var(--red); }

/* ---------- Аккаунт ---------- */
.account-bar { display: flex; align-items: center; gap: 8px; }
.account-user { display: flex; align-items: center; gap: 10px; }
.avatar-sm, .lb-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  background: var(--purple);
  box-shadow: 0 3px 0 var(--purple-d);
}
.account-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.account-info b { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
#accountRating { font-size: 13px; color: var(--yellow-d); }

/* ---------- Игра ---------- */
#game { flex-direction: column; background: var(--bg-2); padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }

.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg); border-bottom: 2px solid var(--line); }
.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 12px;
  border: 2px solid #ffe58a;
  background: var(--yellow-l);
  box-shadow: 0 3px 0 #ffe58a;
  font-size: 14px;
  cursor: pointer;
}
.room-chip:active { transform: translateY(3px); box-shadow: none; }
.room-chip b { letter-spacing: .2em; font-weight: 900; color: var(--text); }
.room-chip-label { color: var(--yellow-d); font-weight: 800; }
.room-chip .i { width: 16px; height: 16px; color: var(--yellow-d); }
.ranked-chip { font-size: 13px; font-weight: 900; color: #fff; padding: 5px 10px; border-radius: 10px; background: var(--yellow); box-shadow: 0 3px 0 var(--yellow-d); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.stage { flex: 1; min-height: 0; padding: 14px 16px 0; }
.grid {
  height: 100%;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}
.grid[data-count="1"] { --cols: 1; }
.grid[data-count="2"], .grid[data-count="3"], .grid[data-count="4"] { --cols: 2; }
.grid[data-count="5"], .grid[data-count="6"] { --cols: 3; }
.grid[data-count="7"], .grid[data-count="8"] { --cols: 4; }
.grid[data-count="3"] .tile:first-child { grid-column: span 2; }

.tile {
  position: relative;
  min-height: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #2b2b2b;
  box-shadow: 0 4px 0 var(--line);
  isolation: isolate;
}
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 4;
  transition: box-shadow .2s;
}
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #2b2b2b; transition: filter .3s; }
.tile.me video { transform: scaleX(-1); }
.tile.joker::after { box-shadow: inset 0 0 0 5px var(--yellow); }
.tile.danger::after { box-shadow: inset 0 0 0 5px var(--red); }
.tile.danger { animation: shake .22s linear infinite; }
@keyframes shake {
  25% { transform: translateX(-2px) rotate(-.3deg); }
  75% { transform: translateX(2px) rotate(.3deg); }
}
.tile.out video { filter: grayscale(1) brightness(.5); }

.tile-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--blue-l);
  color: var(--blue-d);
  font-size: 15px;
}
.tile.ready .tile-placeholder { display: none; }
.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 900;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 5px 0 var(--blue-d);
  animation: bounce 1.2s ease-in-out infinite;
}
@keyframes bounce { 50% { transform: translateY(-8px); } }

.out-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  padding: 8px 22px;
  border-radius: 16px;
  background: var(--red);
  color: #fff;
  font-size: clamp(20px, 3.4vw, 34px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  box-shadow: 0 5px 0 var(--red-d);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-8deg) scale(2);
  transition: opacity .2s, transform .35s cubic-bezier(.2, 1.6, .4, 1);
}
.tile.out .out-stamp { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }

.role, .score {
  position: absolute;
  top: 12px;
  z-index: 2;
  padding: 5px 11px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  background: #fff;
  color: var(--text);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}
.role { left: 12px; }
.role:empty { display: none; }
.tile.joker .role { background: var(--yellow); color: #fff; box-shadow: 0 3px 0 var(--yellow-d); }
.tile.out .role { background: var(--red); color: #fff; box-shadow: 0 3px 0 var(--red-d); }
.score { right: 12px; display: flex; align-items: center; gap: 5px; }
.score .i { width: 16px; height: 16px; color: var(--yellow-d); }

.tile-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 30px 14px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
  color: #fff;
}
.nameplate { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 900; font-size: 16px; min-width: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.nameplate .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nameplate .crown { width: 18px; height: 18px; color: var(--yellow); fill: var(--yellow); }
.tile-rating { font-size: 12px; padding: 2px 8px; border-radius: 8px; background: var(--yellow); color: #fff; text-shadow: none; }

.noface {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--red-d);
}

.meter { position: relative; height: 12px; border-radius: 12px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.meter-fill { position: relative; height: 100%; width: 0; border-radius: inherit; background: var(--green); transition: width .12s linear, background .15s; }
.meter-fill::after, .timer-fill::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 3px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .35);
}
.tile.danger .meter-fill, .tile.out .meter-fill { background: var(--red); }
.meter-threshold { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; }

/* ---------- Нижняя панель ---------- */
.banner { margin: 14px 16px 16px; padding: 16px 18px; border-radius: 20px; background: var(--bg); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.banner-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.banner-text { flex: 1; min-width: 0; }
.banner-title { font-size: clamp(18px, 2.6vw, 24px); font-weight: 900; }
.banner-sub { margin-top: 2px; font-size: 15px; color: var(--muted); min-height: 1.2em; }
.timer { height: 16px; border-radius: 16px; background: var(--line); overflow: hidden; }
.timer-fill { position: relative; height: 100%; width: 0; border-radius: inherit; background: var(--green); transition: background .2s; }
.timer-fill.urgent { background: var(--red); }

/* ---------- Оверлеи ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(80px + var(--safe-top));
  z-index: 20;
  transform: translateX(-50%);
  max-width: min(480px, 92vw);
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 4px 0 var(--blue-d);
  animation: toast-in .3s cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -16px) scale(.9); } }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background: rgba(0, 0, 0, .45);
}

#countdown { background: rgba(255, 255, 255, .85); }
.countdown-num {
  width: min(56vw, 240px);
  height: min(56vw, 240px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: min(32vw, 140px);
  font-weight: 900;
  box-shadow: 0 10px 0 var(--green-d);
  animation: pop 1s ease-out infinite;
}
@keyframes pop {
  0% { transform: scale(.5); }
  20% { transform: scale(1.08); }
  35%, 100% { transform: scale(1); }
}

.overlay.flash { background: var(--red); pointer-events: none; }
.out-flash-text {
  color: #fff;
  font-size: min(20vw, 150px);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 8px 0 var(--red-d);
  animation: slam .45s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes slam { from { transform: scale(2) rotate(-10deg); opacity: 0; } }

.result-card, .modal {
  position: relative;
  width: min(500px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 28px 24px 24px;
  border-radius: 24px;
  background: var(--bg);
  text-align: center;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .15);
  animation: card-in .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes card-in { from { transform: translateY(30px) scale(.95); opacity: 0; } }

.result-kicker {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 3px 0 var(--blue-d);
}
.result-kicker[data-tone="win"] { background: var(--green); box-shadow: 0 3px 0 var(--green-d); }
.result-kicker[data-tone="lose"] { background: var(--red); box-shadow: 0 3px 0 var(--red-d); }
.result-card h2 { margin: 16px 0 6px; font-size: 38px; font-weight: 900; line-height: 1.05; }
.result-kicker[data-tone="win"] + h2 { color: var(--green); }
.result-kicker[data-tone="lose"] + h2 { color: var(--red); }
.result-kicker[data-tone="draw"] + h2 { color: var(--blue); }
.result-card > p { margin: 0; line-height: 1.4; }
.result-card h3 { margin: 22px 0 10px; font-size: 18px; font-weight: 900; text-align: left; }

.leaderboard { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.leaderboard li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; border: 2px solid var(--line); }
.leaderboard li.winner { border-color: #ffe58a; background: var(--yellow-l); }
.leaderboard li.winner .lb-avatar { background: var(--yellow); box-shadow: 0 3px 0 var(--yellow-d); }
.leaderboard li.me { border-color: #84d8ff; }
.leaderboard li.me .lb-name::after { content: ' (ты)'; color: var(--muted); }
.lb-name { flex: 1; min-width: 0; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-status { font-size: 14px; color: var(--muted); white-space: nowrap; }
.lb-score { font-size: 14px; color: var(--yellow-d); font-weight: 900; white-space: nowrap; }
.lb-delta { min-width: 44px; text-align: right; font-weight: 900; }
.lb-delta.up { color: var(--green); }
.lb-delta.down { color: var(--red); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.gallery figure { position: relative; margin: 0; border-radius: 16px; overflow: hidden; border: 3px solid var(--red); transform: rotate(-1.5deg); }
.gallery figure:nth-child(even) { transform: rotate(1.5deg); }
.gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 13px; font-weight: 900; color: #fff; background: var(--red); }

.result-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.result-actions .btn { flex: 1; padding: 14px 16px; }

.modal { width: min(420px, 100%); }
.modal.wide { width: min(540px, 100%); }
.modal-title { margin: 0 0 6px; font-size: 30px; font-weight: 900; }
.modal-sub { margin: 0 0 20px; color: var(--muted); line-height: 1.4; font-size: 15px; }
.modal .segmented { margin-bottom: 20px; }
.modal .field { text-align: left; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
}
.modal-close:hover { background: var(--bg-2); color: var(--muted); }

.my-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 6px; }
.stat { padding: 14px 10px; border-radius: 16px; border: 2px solid var(--line); }
.stat b { display: block; font-size: 26px; font-weight: 900; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.accent { border-color: #ffe58a; background: var(--yellow-l); }
.stat.accent b { color: var(--yellow-d); }

.rating-list { margin-top: 16px; }
.lb-rank { width: 30px; flex-shrink: 0; text-align: center; font-weight: 900; color: var(--soft); }
.rating-list li:nth-child(1) .lb-rank { color: var(--yellow-d); }
.rating-list li:nth-child(2) .lb-rank { color: #9aa5b1; }
.rating-list li:nth-child(3) .lb-rank { color: #cd7f32; }
.lb-rating { font-weight: 900; color: var(--yellow-d); }

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

/* ---------- Адаптив ---------- */
@media (max-width: 760px) {
  .menu-top { padding: 10px 14px; }
  .menu-top .wordmark { font-size: 19px; }
  .menu-grid { padding: 20px 16px 32px; }
  .logo-wrap { width: 104px; height: 104px; }
  .logo { font-size: 60px; }
  .tagline { font-size: 16px; }
  .steps { grid-template-columns: 1fr; }
  .steps li { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 0; align-items: center; justify-items: start; text-align: left; padding: 12px 14px; }
  .steps li span { margin: 0; grid-row: span 2; }

  .brand-text, .room-chip-label, .ranked-chip, .next-label, .topbar .wordmark { display: none; }
  #unmuteBtn { padding: 8px 10px; font-size: 12px; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .top-actions { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .stage { padding: 10px 10px 0; }
  .grid { gap: 8px; }
  .grid[data-count="2"] { --cols: 1; }
  .grid[data-count="5"], .grid[data-count="6"], .grid[data-count="7"], .grid[data-count="8"] { --cols: 2; }
  .grid[data-count="5"] .tile:first-child, .grid[data-count="7"] .tile:first-child { grid-column: span 2; }
  .tile { border-radius: 16px; }
  .banner { margin: 10px; padding: 12px 14px; }
  .banner-row { flex-wrap: wrap; margin-bottom: 10px; }
  #startBtn { width: 100%; }
  .tile-bottom { padding: 24px 10px 10px; }
  .nameplate { font-size: 13px; margin-bottom: 6px; }
  .meter { height: 8px; }
  .role, .score { top: 8px; font-size: 11px; padding: 4px 8px; }
  .role { left: 8px; }
  .score { right: 8px; }
  .lb-status { display: none; }
  .account-info b { max-width: 90px; }
  .result-card, .modal { padding: 24px 18px 20px; }
}

@media (max-width: 420px) {
  .account-bar .btn-label, .menu-top .wordmark-dot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
