/**
 * Lotto + room UI — Aurora / glass (BLVCK RVDIO).
 */

.lobby-view .lobby-lead {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.lobby-selected-label {
  font-size: 13px;
  color: var(--accent-color);
  margin-right: auto;
}

.game-card-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.lotto-room-count {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--text);
}

.btn-primary {
  background: linear-gradient(135deg, var(--aurora-from), var(--aurora-to)) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
}

.btn-danger-outline {
  border-color: rgba(248, 113, 113, 0.5) !important;
  color: #fca5a5 !important;
  background: rgba(248, 113, 113, 0.08) !important;
}

.lucide-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  stroke-width: 2;
}

.balance-pill .lucide-icon {
  margin-right: 2px;
  color: var(--ok);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.room-list.room-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.room-card-glass {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
  animation: roomCardIn 0.35s ease both;
}

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

.room-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.room-card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-card-meta span {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

.room-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

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

.room-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  gap: 10px;
}

.room-col-left {
  overflow: auto;
}

.room-col-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.room-col-chat {
  min-height: 0;
}

.room-col-chat.rightPane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.room-title-label {
  font-size: 13px;
  color: var(--accent-color);
  margin-right: auto;
  font-weight: 600;
}

.room-center-toolbar {
  flex-shrink: 0;
}

.room-game-board {
  flex: 1;
  min-height: 140px;
  overflow: auto;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.room-footer-ctrl {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 4px 4px;
  border-top: 1px solid var(--line);
  margin-top: auto;
  align-items: center;
  justify-content: center;
}

.room-footer-ctrl .btn {
  min-width: 52px;
  min-height: 52px;
  border-radius: 999px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.room-footer-ctrl .btn:hover {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}

.room-footer-ctrl .btn:active {
  transform: scale(0.97);
}

.room-footer-ctrl .btn-danger-outline {
  border-radius: 999px;
  min-width: 52px;
}

.video-area {
  flex: 0 0 auto;
  min-height: 140px;
  max-height: 42vh;
  display: grid;
  gap: 8px;
  padding: 8px 0;
  overflow: auto;
}

/* Больше места под центральную колонку с билетами лото */
#roomView:has(#lottoBoard:not([hidden])) .video-area {
  max-height: 32vh;
  min-height: 120px;
}

#videoArea[data-count='1'] {
  grid-template-columns: 1fr;
}
#videoArea[data-count='2'] {
  grid-template-columns: 1fr 1fr;
}

.tile {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0c0c10;
  aspect-ratio: 16/9;
  transition: box-shadow 0.2s ease;
}

.tile-self.tile-mic-on {
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35);
}

.tile-self.tile-speaking {
  box-shadow:
    0 0 0 2px rgba(52, 211, 153, 0.45),
    0 0 28px rgba(52, 211, 153, 0.25);
}

.tile .tile-avatar-wrap {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(167, 139, 250, 0.5);
  background: rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.tile .tile-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile .tile-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.tile .tile-ready {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
  z-index: 2;
  opacity: 0.85;
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  font-size: 11px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  z-index: 1;
}

.room-players-panel {
  padding: 0;
  flex-shrink: 0;
}

.room-players-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.room-players-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.room-players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 28px;
}

.room-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.player-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.player-tile:hover {
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.player-tile:active {
  transform: scale(0.98);
}

.player-tile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.5), rgba(24, 24, 32, 0.95));
  overflow: hidden;
}

.player-tile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.player-tile-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.player-tile-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.player-tile-ready {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.player-tile-ready.is-on {
  background: #34d399;
  box-shadow:
    0 0 12px rgba(52, 211, 153, 0.85),
    0 0 0 1px rgba(167, 250, 200, 0.5);
}

.player-tile-status--active {
  color: #6ee7b7;
}

.player-tile-status--active .player-tile-ready-label {
  color: #a7f3d0;
}

.room-player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
  color: var(--text);
  max-width: 100%;
}

.room-player-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(24, 24, 32, 0.95));
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.room-player-chip .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-player-chip .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.games-gameboard {
  position: relative;
}

.lotto-board-root {
  padding: 4px 0 8px;
}

/* Одноэкранная колонка лото */
#roomView:has(#lottoBoard:not([hidden])) .room-col-center {
  position: relative;
  min-height: 0;
  isolation: isolate;
}

#roomView:has(#lottoBoard:not([hidden])) #gameBoard.games-gameboard,
#roomView:has(#lottoBoard:not([hidden])) #gameBoard.room-game-board {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#roomView:has(#lottoBoard:not([hidden])) .lotto-board-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 0 4px;
}

/* Aurora за центральной панелью по фазе */
#roomView:has(#lottoBoard[data-phase='waiting']) .room-col-center {
  --lotto-aurora-bg: radial-gradient(ellipse 80% 60% at 50% 30%, rgba(59, 130, 246, 0.42), transparent 65%);
}

#roomView:has(#lottoBoard[data-phase='playing']) .room-col-center {
  --lotto-aurora-bg: radial-gradient(ellipse 85% 65% at 50% 25%, rgba(139, 92, 246, 0.48), transparent 68%);
}

#roomView:has(#lottoBoard[data-phase='done']) .room-col-center {
  --lotto-aurora-bg: radial-gradient(ellipse 90% 70% at 50% 20%, rgba(250, 204, 21, 0.35), transparent 70%);
}

#roomView:has(#lottoBoard:not([hidden])) .room-col-center::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius) + 2px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  filter: blur(48px);
  background: var(
    --lotto-aurora-bg,
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(99, 102, 241, 0.4), transparent 65%)
  );
  transition:
    background 0.95s ease,
    opacity 0.55s ease,
    filter 0.7s ease;
}

#roomView:has(#lottoBoard:not([hidden])) .room-col-center > * {
  position: relative;
  z-index: 1;
}

.lotto-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.lotto-banner {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(0, 0, 0, 0.4));
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

.lotto-banner--compact {
  flex-shrink: 0;
  padding: 8px 12px;
}

.lotto-banner--compact .lotto-sub {
  margin-top: 4px;
  font-size: 11px;
}

.lotto-banner .lotto-phase {
  color: var(--accent-color);
  font-weight: 600;
}

.lotto-banner .lotto-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* Узкий dashboard-header: история | последний | таймер */
.lotto-game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  flex-shrink: 0;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.2);
  background: rgba(0, 0, 0, 0.28);
}

.lotto-game-header__hist {
  min-width: 0;
  display: flex;
  align-items: center;
}

.lotto-hist-chips {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lotto-hist-chips::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.lotto-hist-chip {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.lotto-hist-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 4px;
}

.lotto-game-header__main {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.lotto-game-header__main .lotto-last-visual--mega {
  gap: 8px;
}

.lotto-game-header__main .lotto-barrel-icon {
  width: 44px;
  height: 52px;
}

.lotto-game-header__main .lotto-last-circle {
  width: 88px;
  height: 88px;
}

.lotto-game-header__main .lotto-last-circle .num {
  font-size: 30px;
}

.lotto-game-header__timer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 52px;
}

.lotto-timer-ring-wrap {
  position: relative;
  width: 48px;
  height: 48px;
}

.lotto-timer-svg {
  width: 48px;
  height: 48px;
  transform: rotate(-90deg);
}

.lotto-timer-track {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 3;
}

.lotto-timer-progress {
  stroke: var(--accent-color);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.08s linear;
}

.lotto-timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  pointer-events: none;
}

.lotto-timer-placeholder {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  padding-right: 4px;
}

/* Play zone: сетка — «мой билет» всегда получает основную высоту, соперники — нижняя полоса с лимитом */
.lotto-play-zone {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(200px, 1fr) minmax(0, min(34vh, 280px));
  gap: 8px;
  overflow: hidden;
}

.lotto-my-zone {
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  padding: 2px 0;
}

.lotto-my-ticket {
  width: 100%;
  max-width: min(100%, 560px);
  margin: 0 auto;
  padding: 12px 14px;
}

.lotto-my-ticket .lotto-grid[data-cols='9'] {
  max-width: min(100%, 720px);
  gap: 8px;
}

.lotto-my-ticket .lotto-grid[data-cols='9'] .lotto-cell-num {
  font-size: clamp(14px, 2.8vw, 26px);
}

.lotto-opponents-wrap {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.lotto-opponents-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.lotto-opponents {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.lotto-ticket--opponent {
  flex: 0 0 auto;
  width: min(260px, 48vw);
  max-width: 280px;
  padding: 10px 12px;
  border-color: rgba(167, 139, 250, 0.12);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

.lotto-ticket--opponent .lotto-ticket-head {
  margin-bottom: 4px;
}

.lotto-ticket--opponent .lotto-ticket-player-name {
  font-size: 11px;
}

.lotto-ticket--opponent .lotto-grid[data-cols='9'] {
  gap: 4px;
  max-width: 100%;
}

.lotto-ticket--opponent .lotto-grid[data-cols='9'] .lotto-cell-num {
  font-size: clamp(11px, 2.2vw, 16px);
}

.lotto-ticket--opponent .lotto-cell-empty {
  border-radius: 4px;
}

.lotto-ticket--opponent .lotto-cell {
  border-radius: 6px;
}

/* Пульс до клика по выпавшему числу */
.lotto-cell.lotto-cell--pulse-until-stamp {
  animation: lottoCellNeonPulse 1.1s ease-in-out infinite;
  border-color: rgba(52, 211, 153, 0.85) !important;
  box-shadow:
    0 0 18px rgba(52, 211, 153, 0.55),
    0 0 36px rgba(167, 243, 208, 0.25),
    inset 0 0 20px rgba(52, 211, 153, 0.15);
}

.lotto-cell.lotto-cell--pulse-until-stamp .lotto-cell-server-glow {
  opacity: 1;
}

@keyframes lottoCellNeonPulse {
  0%,
  100% {
    filter: brightness(1) saturate(1.05);
    box-shadow:
      0 0 16px rgba(52, 211, 153, 0.5),
      0 0 32px rgba(99, 102, 241, 0.28),
      inset 0 0 18px rgba(52, 211, 153, 0.12);
  }
  50% {
    filter: brightness(1.14) saturate(1.12);
    box-shadow:
      0 0 26px rgba(52, 211, 153, 0.85),
      0 0 48px rgba(167, 243, 208, 0.42),
      inset 0 0 26px rgba(52, 211, 153, 0.22);
  }
}

.lotto-last-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.lotto-last-visual {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lotto-last-visual--mega .lotto-barrel-icon {
  width: 56px;
  height: 66px;
  filter: drop-shadow(0 6px 18px rgba(99, 102, 241, 0.45));
}

.lotto-last-visual--mega .lotto-last-circle {
  width: 120px;
  height: 120px;
  border-width: 3px;
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, 0.55),
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(167, 139, 250, 0.15);
}

.lotto-last-visual--mega .lotto-last-circle .num {
  font-size: 42px;
}

.lotto-barrel-icon {
  width: 44px;
  height: 52px;
  flex-shrink: 0;
  opacity: 0.95;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.35));
}

.lotto-last-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), transparent 45%),
    linear-gradient(145deg, rgba(99, 102, 241, 0.45), rgba(10, 8, 20, 0.95));
  border: 2px solid rgba(167, 139, 250, 0.5);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.5), 0 8px 32px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease;
}

.lotto-last-circle.is-pulsing {
  animation: lottoBallPulse 1.6s ease-in-out infinite;
}

@keyframes lottoBallPulse {
  0%,
  100% {
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(167, 139, 250, 0.45);
    transform: scale(1);
  }
  50% {
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35), 0 0 28px 6px rgba(129, 140, 248, 0.35);
    transform: scale(1.03);
  }
}

.lotto-last-circle .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 2px;
}

.lotto-last-circle .num {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.lotto-last-circle.empty .num {
  font-size: 18px;
  font-weight: 600;
  color: var(--muted);
}

.lotto-strip-wrap {
  flex: 1;
  min-width: 0;
}

.lotto-strip-wrap--compact .lotto-strip-label {
  margin-bottom: 6px;
}

.lotto-strip-wrap--compact .lotto-strip {
  max-height: 44px;
  overflow: hidden;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.lotto-strip-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lotto-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.lotto-strip-empty {
  font-size: 12px;
  color: var(--muted);
}

.lotto-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  --t: calc(var(--strip-i, 0) / var(--strip-n, 1));
  background: linear-gradient(
    145deg,
    rgba(99, 102, 241, calc(0.12 + var(--t) * 0.18)),
    rgba(24, 24, 32, calc(0.65 + var(--t) * 0.1))
  );
  border: 1px solid rgba(167, 139, 250, calc(0.25 + var(--t) * 0.25));
  color: var(--text);
}

.lotto-chip.is-latest {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.2);
}

/* Лента последних бочонков в шапке: объём + блик поверх базового .lotto-chip */
.lotto-game-header .lotto-hist-chip.lotto-chip {
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.14),
    inset 0 -3px 6px rgba(0, 0, 0, 0.48),
    0 2px 6px rgba(0, 0, 0, 0.35);
  background-image:
    linear-gradient(155deg, rgba(255, 255, 255, 0.16) 0%, transparent 45%),
    linear-gradient(
      145deg,
      rgba(99, 102, 241, calc(0.12 + var(--t) * 0.18)),
      rgba(24, 24, 32, calc(0.65 + var(--t) * 0.1))
    );
}

.lotto-game-header .lotto-hist-chip.lotto-chip.is-latest {
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.12),
    inset 0 -3px 6px rgba(0, 0, 0, 0.4),
    0 0 14px rgba(52, 211, 153, 0.35);
}

.lotto-ticket {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(167, 139, 250, 0.15);
  background: rgba(20, 20, 25, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.lotto-ticket-title {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lotto-ticket-hint {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  margin-bottom: 14px;
  max-width: 42em;
}

.lotto-grid {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: min(100%, 560px);
}

.lotto-grid[data-cols='4'] {
  max-width: min(100%, 480px);
}

.lotto-grid[data-cols='9'] {
  max-width: min(100%, 720px);
  gap: 6px;
}

.lotto-grid[data-cols='9'] .lotto-cell-num {
  font-size: clamp(12px, 2.4vw, 20px);
}

.lotto-cell-empty {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.lotto-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(28, 28, 36, 0.95), rgba(12, 10, 18, 0.98));
  color: var(--text);
  position: relative;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.15s ease,
    box-shadow 0.28s ease,
    border-color 0.22s ease;
}

.lotto-cell-num {
  position: relative;
  z-index: 2;
  font-size: clamp(22px, 5.2vw, 36px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.lotto-cell-server-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: radial-gradient(
    circle at 50% 35%,
    rgba(167, 243, 208, 0.55) 0%,
    rgba(16, 185, 129, 0.42) 38%,
    rgba(5, 46, 22, 0.85) 100%
  );
  pointer-events: none;
}

.lotto-cell.marked .lotto-cell-server-glow {
  opacity: 1;
}

.lotto-cell.marked .lotto-cell-num {
  color: #f0fdf4;
  text-shadow:
    0 0 12px rgba(167, 243, 208, 0.45),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

.lotto-cell-user-ring {
  position: absolute;
  inset: 3px;
  z-index: 3;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  box-shadow:
    inset 0 0 0 2px rgba(244, 114, 182, 0.95),
    0 0 0 1px rgba(167, 139, 250, 0.4),
    0 0 22px rgba(236, 72, 153, 0.45);
}

.lotto-cell.stamped .lotto-cell-user-ring {
  opacity: 1;
}

.lotto-cell.stamped:not(.marked) {
  border-color: rgba(244, 114, 182, 0.55);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.25);
}

.lotto-cell.marked.stamped .lotto-cell-user-ring {
  box-shadow:
    inset 0 0 0 2px rgba(253, 224, 71, 0.9),
    0 0 0 1px rgba(250, 204, 21, 0.35),
    0 0 18px rgba(250, 204, 21, 0.35);
}

.lotto-cell:hover:not(:disabled) {
  border-color: rgba(167, 139, 250, 0.65);
  box-shadow:
    0 0 28px rgba(139, 92, 246, 0.35),
    0 0 48px rgba(99, 102, 241, 0.18),
    inset 0 0 24px rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.lotto-cell:hover:not(:disabled):not(.marked) .lotto-cell-num {
  text-shadow:
    0 0 16px rgba(167, 139, 250, 0.55),
    0 0 28px rgba(99, 102, 241, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

.lotto-cell.marked:hover:not(:disabled) {
  box-shadow:
    0 0 26px rgba(52, 211, 153, 0.4),
    0 0 40px rgba(16, 185, 129, 0.15),
    inset 0 0 20px rgba(167, 243, 208, 0.12);
}

.lotto-cell:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(10, 10, 12, 0.95),
    0 0 0 4px rgba(167, 139, 250, 0.65);
}

.lotto-cell:active {
  transform: scale(0.97);
}

.lotto-cell.marked {
  border-color: rgba(52, 211, 153, 0.65);
}

.lotto-cell.marked::after {
  content: '';
  position: absolute;
  inset: 7px;
  z-index: 1;
  border-radius: 8px;
  border: 2px solid rgba(240, 253, 250, 0.35);
  pointer-events: none;
  opacity: 0.85;
}

.btn-lotto-claim {
  animation: claimPulse 1.2s ease-in-out infinite;
}

@keyframes claimPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.5);
  }
  50% {
    box-shadow: 0 0 20px 4px rgba(250, 204, 21, 0.35);
  }
}

.games-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(8px);
}

.games-overlay[hidden] {
  display: none !important;
}

.games-overlay-text {
  margin-top: 20px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.aurora-loader {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, var(--aurora-from), var(--aurora-to), #22d3ee, var(--aurora-from));
  animation: spinLoader 1.2s linear infinite;
  mask: radial-gradient(farthest-side, transparent 55%, #000 56%);
  -webkit-mask: radial-gradient(farthest-side, transparent 55%, #000 56%);
}

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

.lotto-overlay-countdown .countdown-num {
  font-size: min(28vw, 120px);
  font-weight: 800;
  background: linear-gradient(180deg, #fff, var(--aurora-to));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 180;
  pointer-events: none;
  display: none;
}

.lotto-endgame-box .lotto-endgame-body {
  font-size: 14px;
  color: var(--muted);
  margin: 12px 0 8px;
  line-height: 1.5;
}

.lotto-endgame-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.lotto-endgame-box .lotto-endgame-btn-lobby {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.lotto-endgame-box .lotto-endgame-btn-lobby:hover {
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(99, 102, 241, 0.12);
}

#lottoEndgameModal.show {
  display: flex;
  z-index: 220;
}

/* Центральный футер лото: FAB «ЛОТО!» поверх колонки */
.lotto-center-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0;
  margin-top: auto;
  border-top: none;
  background: transparent;
  min-height: 0;
}

#roomView:has(#lottoBoard:not([hidden])) .lotto-center-footer--active.lotto-center-footer--fab {
  position: absolute;
  left: 50%;
  bottom: calc(10px + var(--games-safe-bottom));
  transform: translateX(-50%);
  z-index: 24;
  margin-top: 0;
  pointer-events: none;
}

#roomView:has(#lottoBoard:not([hidden])) .lotto-center-footer--active.lotto-center-footer--fab .lotto-fab-claim {
  pointer-events: auto;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.12);
}

.lotto-center-footer--active .lotto-footer-claim,
.lotto-fab-claim {
  min-height: 52px;
  min-width: 52px;
  padding: 0 24px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#roomView:has(.lotto-center-footer--fab) #gameBoard.room-game-board {
  padding-bottom: calc(72px + var(--games-safe-bottom));
}

/* Левая колонка: компактные игроки + скролл, футер внизу */
#roomView:has(#lottoBoard:not([hidden])) .room-col-left {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#roomView:has(#lottoBoard:not([hidden])) .room-players-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#roomView:has(#lottoBoard:not([hidden])) .room-players-hint {
  display: none;
}

#roomView:has(#lottoBoard:not([hidden])) .room-players-grid {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

#roomView:has(#lottoBoard:not([hidden])) .player-tile {
  padding: 6px 10px;
  border-radius: 12px;
}

#roomView:has(#lottoBoard:not([hidden])) .player-tile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

#roomView:has(#lottoBoard:not([hidden])) .player-tile-body {
  gap: 4px;
}

#roomView:has(#lottoBoard:not([hidden])) .player-tile-name {
  font-size: 12px;
}

#roomView:has(#lottoBoard:not([hidden])) .room-footer-ctrl {
  flex-shrink: 0;
  margin-top: auto;
}

#roomView:has(#lottoBoard:not([hidden])) #videoArea.video-area {
  max-height: min(28vh, 220px);
  min-height: 100px;
}

/* Чат лото: легче */
#roomView:has(#lottoBoard:not([hidden])) .chat-pane {
  background: rgba(255, 255, 255, 0.02);
}

#roomView:has(#lottoBoard:not([hidden])) .chat-heading {
  font-size: 12px;
  padding: 8px 10px;
}

#roomView:has(#lottoBoard:not([hidden])) .chat-messages-scroll {
  padding: 6px 8px;
}

#roomView:has(#lottoBoard:not([hidden])) .chat-bubble {
  padding: 7px 10px;
  background: rgba(0, 0, 0, 0.22);
  border-color: rgba(255, 255, 255, 0.06);
}

#roomView:has(#lottoBoard:not([hidden])) .chat-bubble-text {
  font-size: 11px;
  line-height: 1.35;
}

#roomView:has(#lottoBoard:not([hidden])) .chat-bubble-author {
  font-size: 10px;
}

#roomView:has(#lottoBoard:not([hidden])) .chat-input-neon {
  font-size: 12px;
  padding: 7px 10px;
}

/* Планшет: лото — две колонки (совпадает с окном games.ejs max-width:1100px, где иначе одна колонка) */
@media (min-width: 700px) and (max-width: 1100px) {
  #roomView.active:has(#lottoBoard:not([hidden])) .layout-main {
    display: grid !important;
    grid-template-columns: minmax(200px, 38%) minmax(0, 1fr) !important;
    /* Верхняя строка — игра и билеты; чат снизу, жёстко ограничен по высоте */
    grid-template-rows: minmax(0, 1fr) minmax(120px, min(25vh, 300px)) !important;
    grid-auto-flow: row !important;
    gap: 10px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-col-left {
    grid-column: 1 !important;
    grid-row: 1 / -1 !important;
    order: initial !important;
    min-height: 0;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-col-center {
    grid-column: 2 !important;
    grid-row: 1 !important;
    order: initial !important;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-col-chat {
    grid-column: 2 !important;
    grid-row: 2 !important;
    order: initial !important;
    min-height: 120px !important;
    max-height: min(25vh, 320px);
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-col-chat.rightPane {
    flex: 0 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  /* Планшет: больше места под свой билет, полоса соперников не выше 180px */
  #roomView:has(#lottoBoard:not([hidden])) .lotto-play-zone {
    grid-template-rows: minmax(260px, 1fr) minmax(0, min(18vh, 180px));
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-my-zone {
    align-items: stretch;
    min-height: 260px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-opponents-wrap {
    max-height: 180px;
  }

  /* Компактный «Розыгрыш», чтобы сетка билетов не уезжала под чат */
  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header {
    padding: 4px 6px;
    gap: 6px 8px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-barrel-icon {
    width: 34px;
    height: 42px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-last-circle {
    width: 68px;
    height: 68px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-last-circle .num {
    font-size: 22px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-last-circle .lbl {
    font-size: 8px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__timer {
    min-height: 44px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-ticket--opponent {
    width: min(220px, 42vw);
    padding: 8px 10px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-ticket--opponent .lotto-grid[data-cols='9'] {
    gap: 3px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-ticket--opponent .lotto-grid[data-cols='9'] .lotto-cell-num {
    font-size: clamp(10px, 2vw, 14px);
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-title-label {
    font-size: 15px;
  }

  #roomView:has(#lottoBoard:not([hidden])) #btnStartGame {
    font-size: 15px;
    padding: 11px 18px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-banner {
    font-size: 14px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-banner--compact .lotto-sub {
    font-size: 12px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .chat-heading {
    font-size: 14px;
    padding: 10px 12px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .chat-messages-scroll {
    padding: 8px 10px;
    min-height: 48px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .chat-bubble-text {
    font-size: 13px;
    line-height: 1.45;
  }

  #roomView:has(#lottoBoard:not([hidden])) .chat-bubble-author {
    font-size: 12px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .chat-input-neon {
    font-size: 14px;
    padding: 10px 12px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-grid[data-cols='9'] .lotto-cell-num {
    font-size: clamp(14px, 2.6vw, 22px);
  }

  #roomView:has(#lottoBoard:not([hidden])) .player-tile-name {
    font-size: 13px;
  }
}

.lotto-next-draw {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  margin-top: 4px;
  border-radius: 10px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: rgba(0, 0, 0, 0.2);
}

.lotto-next-draw-num {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-color);
  margin: 0 2px;
}

.lotto-all-tickets-wrap {
  margin-top: 16px;
  width: 100%;
}

.lotto-all-tickets-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.lotto-all-tickets {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 16px;
  width: 100%;
  overflow-x: visible;
  overflow-y: visible;
  padding: 4px 0 8px;
}

.lotto-ticket--compact {
  flex: 0 0 auto;
  width: 100%;
  max-width: min(100%, 520px);
  margin-left: auto;
  margin-right: auto;
}

.lotto-ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.lotto-ticket-player-name {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lotto-ticket-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.14);
  color: var(--accent-color);
  border: 1px solid rgba(167, 139, 250, 0.38);
}

.lotto-ticket--mine {
  border-color: rgba(167, 139, 250, 0.38);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 28px rgba(99, 102, 241, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.lotto-ticket-hint--compact {
  margin-bottom: 8px;
  font-size: 10px;
}

.lotto-cell--readonly {
  cursor: default;
  pointer-events: none;
}

.lotto-cell--readonly:active {
  transform: none;
}

.lotto-cell--readonly .lotto-cell-num {
  pointer-events: none;
}

.game-controls-bar {
  flex-shrink: 0;
}

/* Телефон: стол лото на весь экран; игроки и чат — off-canvas (FAB в тулбаре) */
@media (max-width: 699px) {
  #roomView:has(#lottoBoard:not([hidden])) {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  #roomView:has(#lottoBoard:not([hidden])) .layout-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0;
    grid-template-columns: unset;
    grid-template-rows: unset;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-col-center {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    order: 0;
    width: 100%;
    overflow: hidden;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-center-toolbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-mobile-quick {
    display: flex;
    margin-left: auto;
    margin-right: 4px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-col-left {
    position: fixed;
    left: calc(var(--games-shell-pad-left) + var(--games-safe-left));
    top: var(--games-top-offset);
    bottom: var(--games-bottom-offset);
    width: min(88vw, 380px);
    max-width: 100%;
    z-index: 500;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: auto;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-col-chat {
    position: fixed;
    right: calc(var(--games-shell-pad-right) + var(--games-safe-right));
    top: var(--games-top-offset);
    bottom: var(--games-bottom-offset);
    width: min(88vw, 380px);
    max-width: 100%;
    z-index: 500;
    transform: translateX(105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: auto;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
  }

  #roomView.room-mobile-panel-left:has(#lottoBoard:not([hidden])) .room-col-left {
    transform: translateX(0);
  }

  #roomView.room-mobile-panel-right:has(#lottoBoard:not([hidden])) .room-col-chat {
    transform: translateX(0);
  }

  #roomView:has(#lottoBoard:not([hidden])) #gameBoard.games-gameboard,
  #roomView:has(#lottoBoard:not([hidden])) #gameBoard.room-game-board {
    overflow: auto;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-board-root {
    overflow: visible;
  }

  /* Ультракомпактная шапка розыгрыша */
  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    justify-items: stretch;
    text-align: left;
    padding: 4px 6px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__hist {
    grid-column: 1 / -1;
    justify-content: flex-start;
    width: 100%;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-hist-chips {
    gap: 4px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-hist-chip {
    width: 24px;
    height: 24px;
    font-size: 9px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main {
    justify-content: flex-start;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-barrel-icon {
    width: 24px;
    height: 30px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-last-circle {
    width: 48px;
    height: 48px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-last-circle .num {
    font-size: 16px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__main .lotto-last-circle .lbl {
    font-size: 7px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header__timer {
    justify-content: flex-end;
    width: auto;
    min-height: 32px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-play-zone {
    grid-template-rows: minmax(0, 1fr) minmax(88px, min(20vh, 132px));
    gap: 6px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-my-zone {
    align-items: stretch;
    padding: 0;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-my-ticket {
    padding: 10px 10px 12px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-my-ticket .lotto-grid[data-cols='9'] {
    gap: 2px;
    max-width: 100%;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-my-ticket .lotto-grid[data-cols='9'] .lotto-cell-num {
    font-size: clamp(11px, 2.8vw, 18px);
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-opponents-wrap {
    max-height: min(20vh, 132px);
  }

  .room-col {
    padding: 8px;
    gap: 8px;
  }

  .lotto-wrap {
    gap: 8px;
  }

  .lotto-center-footer {
    padding: 10px 10px 12px;
  }

  .room-game-board,
  .games-gameboard {
    min-height: 100px;
    padding: 8px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .room-game-board,
  #roomView:has(#lottoBoard:not([hidden])) .games-gameboard {
    min-height: 80px;
    padding-bottom: calc(8px + var(--games-safe-bottom));
  }

  .lotto-grid[data-cols='9'] {
    gap: 4px;
    max-width: 100%;
  }

  .lotto-grid[data-cols='9'] .lotto-cell-num {
    font-size: clamp(10px, 2.2vw, 16px);
  }

  .lotto-all-tickets {
    gap: 10px;
    padding-bottom: 10px;
  }

  .room-footer-ctrl {
    gap: 10px;
    padding: 10px 2px 4px;
  }

  .room-footer-ctrl .btn {
    min-height: 48px;
    min-width: 48px;
  }
}

@media (max-width: 430px) {
  #roomView:has(#lottoBoard:not([hidden])) .lotto-game-header {
    gap: 6px 8px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-play-zone {
    grid-template-rows: minmax(0, 1fr) minmax(82px, min(18vh, 120px));
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-opponents-wrap {
    max-height: min(18vh, 120px);
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-my-ticket {
    padding: 8px 8px 10px;
  }

  #roomView:has(#lottoBoard:not([hidden])) .lotto-my-ticket .lotto-grid[data-cols='9'] .lotto-cell-num {
    font-size: clamp(10px, 2.7vw, 15px);
  }
}

/* Чат: пузыри */
.chat-messages-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble-row {
  display: flex;
  justify-content: flex-start;
}

.chat-bubble-row--mine {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.chat-bubble--other {
  border-radius: 14px 14px 14px 4px;
}

.chat-bubble--mine {
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(168, 85, 247, 0.28));
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.2);
}

.chat-bubble-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.chat-bubble-text {
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  color: var(--text);
}

/* Дурак: крупные системные уведомления в чате (раскрытие details) */
.chat-bubble-row--durak-system {
  justify-content: center;
  width: 100%;
}

.chat-durak-notice {
  width: 100%;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(165deg, rgba(15, 12, 24, 0.92), rgba(8, 6, 16, 0.88));
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: chatDurakNoticeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chat-durak-notice--bito {
  border-color: rgba(52, 211, 153, 0.42);
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.12),
    0 12px 40px rgba(16, 185, 129, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.chat-durak-notice--take {
  border-color: rgba(251, 146, 60, 0.45);
  box-shadow:
    0 0 0 1px rgba(251, 146, 60, 0.14),
    0 12px 40px rgba(234, 88, 12, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat-durak-notice__summary {
  list-style: none;
  cursor: pointer;
  font-size: clamp(1.05rem, 3.8vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: #f1f5f9;
  padding: 4px 0 2px;
}

.chat-durak-notice__summary::-webkit-details-marker {
  display: none;
}

.chat-durak-notice__summary::after {
  content: ' ▼';
  font-size: 0.72em;
  opacity: 0.65;
  font-weight: 600;
}

.chat-durak-notice[open] .chat-durak-notice__summary::after {
  content: ' ▲';
}

.chat-durak-notice--bito .chat-durak-notice__summary {
  color: #a7f3d0;
  text-shadow: 0 0 28px rgba(52, 211, 153, 0.25);
}

.chat-durak-notice--take .chat-durak-notice__summary {
  color: #fed7aa;
  text-shadow: 0 0 28px rgba(251, 146, 60, 0.22);
}

.chat-durak-notice__body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: clamp(1rem, 3.4vw, 1.15rem);
  line-height: 1.5;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.95);
}

.chat-durak-notice[open] {
  padding-bottom: 18px;
}

.chat-durak-notice[open] .chat-durak-notice__body {
  font-size: clamp(1.05rem, 3.6vw, 1.22rem);
}

@keyframes chatDurakNoticeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-input-neon {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.chat-input-neon:focus {
  border-color: rgba(167, 139, 250, 0.65);
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.35),
    0 0 24px rgba(168, 85, 247, 0.25);
}

.chat-input-wrap {
  flex-shrink: 0;
  padding-top: 4px;
}

.chat-pane {
  border-color: rgba(167, 139, 250, 0.12);
}

.games-overlay {
  z-index: 160;
}

.confetti-canvas {
  z-index: 190;
}
