:root {
  color-scheme: dark;
  --bg: #111217;
  --surface: #1b1c22;
  --surface-2: #24252d;
  --surface-3: #2d2f38;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f6f1e8;
  --muted: #b9b4aa;
  --dim: #87837c;
  --gold: #e2bd6d;
  --red: #b44949;
  --green: #6dcf95;
  --vk: #5d8bd7;
  --glass: rgba(16, 9, 22, 0.68);
  --gold-line: rgba(226, 189, 109, 0.42);
  --neon-cyan: #35d7ef;
  --neon-pink: #ff668b;
}

* {
  box-sizing: border-box;
}

* {
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

html,
body {
  min-height: 100%;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  overflow-y: scroll;
  background:
    radial-gradient(circle at 50% 14%, rgba(226, 189, 109, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(5, 6, 12, 0.46), rgba(5, 6, 12, 0.76) 52%, #06070c),
    url("./assets/game/texture/mafia/backgrounds/bg_miniapp_lobby.webp") center top / cover no-repeat fixed;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 6, 12, 0.9), rgba(5, 6, 12, 0.18) 22%, rgba(5, 6, 12, 0.24) 70%, rgba(5, 6, 12, 0.9)),
    linear-gradient(180deg, rgba(5, 6, 12, 0.18), rgba(5, 6, 12, 0.72));
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

button:hover:not(:disabled),
.list-item:hover,
.shop-card:hover,
.lobby-room-card:hover,
.create-section:hover,
.settings-card:hover {
  transform: translateY(-1px);
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.boot-icon {
  width: 86px;
  height: 86px;
  border-radius: 22px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0 14px;
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.38);
}

.brand-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.ok {
  color: #101513;
  background: var(--green);
}

.status-pill.warn {
  color: #211609;
  background: var(--gold);
}

.sound-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(226, 189, 109, 0.28);
  border-radius: 8px;
  padding: 0;
  background: rgba(36, 37, 45, 0.92);
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.sound-toggle.active {
  background: var(--gold);
  color: #17130b;
  border-color: transparent;
}

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

.sound-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(82px, 1fr);
  gap: 6px;
  padding: 8px 0 12px;
  overflow-x: auto;
  background: linear-gradient(180deg, rgba(7, 8, 16, 0.96), rgba(7, 8, 16, 0.64));
  backdrop-filter: blur(12px);
}

.tab-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 12, 25, 0.66);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--gold);
  color: #17130b;
  border-color: transparent;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  align-items: start;
  width: 100%;
}

.main-view,
.side-view {
  min-width: 0;
}

.panel {
  min-width: 0;
  border: 1px solid var(--gold-line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 12, 26, 0.78), rgba(9, 8, 13, 0.78));
  backdrop-filter: blur(10px);
  overflow: hidden;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
}

.inner-panel {
  margin-top: 12px;
}

.panel-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  margin: 0;
  font-size: 17px;
}

.panel-body {
  padding: 14px;
}

.hero {
  min-height: clamp(360px, 52vh, 560px);
  display: grid;
  align-content: end;
  gap: 12px;
  padding: clamp(18px, 3vw, 34px);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(9, 10, 14, 0.04), rgba(9, 10, 14, 0.36) 38%, rgba(9, 10, 14, 0.94)),
    linear-gradient(90deg, rgba(9, 10, 14, 0.78), rgba(9, 10, 14, 0.08) 64%),
    url("./assets/game/texture/mafia/backgrounds/bg_miniapp_lobby.webp") center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 28px 70px rgba(0, 0, 0, 0.42);
}

.lobby-hero {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid var(--gold-line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(17, 7, 23, 0.34), rgba(7, 8, 14, 0.82)),
    url("./assets/game/texture/mafia/backgrounds/bg_miniapp_lobby.webp") center 32% / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 24px 70px rgba(0, 0, 0, 0.42);
}

.lobby-title-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.lobby-mark {
  width: 96px;
  height: 96px;
  border: 2px solid rgba(226, 189, 109, 0.58);
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.055);
  color: #fff;
  box-shadow: 0 0 32px rgba(226, 189, 109, 0.12);
}

.lobby-mark svg {
  width: 48px;
  height: 48px;
}

.lobby-title-card h2 {
  margin: 0;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
}

.lobby-title-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 3vw, 28px);
}

.lobby-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.lobby-stat {
  min-height: 106px;
  padding: 16px;
  border: 1px solid rgba(226, 189, 109, 0.48);
  border-radius: 22px;
  display: grid;
  align-content: center;
  gap: 4px;
  background: rgba(8, 8, 12, 0.48);
}

.lobby-stat svg {
  width: 22px;
  height: 22px;
  color: var(--gold);
}

.lobby-stat strong {
  font-size: 28px;
}

.lobby-stat span {
  color: var(--muted);
}

.lobby-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(226, 189, 109, 0.4);
  border-radius: 20px;
  background: rgba(8, 6, 12, 0.56);
}

.lobby-shortcut {
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(28, 19, 33, 0.7);
  color: var(--muted);
  cursor: pointer;
}

.lobby-shortcut.active,
.lobby-shortcut:hover {
  border-color: rgba(226, 189, 109, 0.78);
  color: var(--gold);
  background: rgba(226, 189, 109, 0.18);
}

.lobby-shortcut svg {
  width: 30px;
  height: 30px;
}

.lobby-mark svg,
.lobby-stat svg,
.lobby-shortcut svg,
.room-card-icon svg,
.setup-icon svg,
.settings-icon svg,
.create-submit svg,
.settings-logout svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero h2 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1.05;
}

.game-hero {
  min-height: 300px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.game-hero h2 {
  margin: 4px 0 6px;
  font-size: 30px;
  line-height: 1.05;
}

.game-hero p {
  margin: 0;
  color: var(--muted);
}

.announcement-card {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid rgba(226, 189, 109, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(34, 35, 43, 0.96), rgba(18, 19, 25, 0.96));
}

.announcement-card > img {
  width: 100%;
  height: 100%;
  min-height: 118px;
  object-fit: cover;
  border-radius: 7px;
}

.announcement-card h3 {
  margin: 3px 0 6px;
  font-size: 22px;
  line-height: 1.1;
}

.announcement-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.announcement-card.news {
  display: block;
}

.news-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.news-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.news-item img {
  width: 82px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 7px;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.role-mini-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.44);
  display: grid;
  gap: 6px;
}

.role-mini-card.wide {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
}

.role-mini-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 7px;
}

.role-mini-card.wide img {
  grid-row: span 2;
}

.role-mini-card strong,
.role-mini-card span {
  display: block;
}

.role-mini-card span {
  color: var(--muted);
  font-size: 12px;
}

.hero p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric,
.list-item,
.role-card,
.shop-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.metric {
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 22px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.grid {
  display: grid;
  gap: 10px;
}

.room-grid,
.role-grid,
.shop-grid,
.player-grid,
.player-action-grid,
.chat-compose {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.player-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.room-list-scroll {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.room-card {
  border: 1px solid rgba(226, 189, 109, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(226, 189, 109, 0.09), rgba(255, 255, 255, 0.035)),
    rgba(22, 22, 29, 0.94);
}

.room-rules-summary {
  min-height: 34px;
}

.create-room-panel {
  background:
    linear-gradient(180deg, rgba(30, 21, 37, 0.96), rgba(18, 18, 24, 0.96)),
    url("./assets/game/texture/mafia/backgrounds/bg_room_waiting.webp") center / cover no-repeat;
}

.create-room-screen,
.settings-screen {
  display: grid;
  gap: 16px;
  animation: softRise 260ms ease both;
}

.create-intro,
.settings-hero {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 190px;
  padding: 24px;
  border: 1px solid var(--gold-line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(10, 7, 16, 0.58), rgba(10, 7, 16, 0.86)),
    url("./assets/game/texture/mafia/backgrounds/bg_miniapp_lobby.webp") center 32% / cover no-repeat;
}

.create-intro h2,
.settings-hero h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.02;
}

.create-intro p,
.settings-hero p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 3vw, 28px);
  line-height: 1.28;
}

.create-intro-icon,
.settings-icon {
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 46px;
}

.settings-icon svg {
  width: 50px;
  height: 50px;
}

.create-section,
.settings-card {
  padding: 20px;
  border: 1px solid var(--gold-line);
  border-radius: 24px;
  background: rgba(16, 8, 22, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

.create-section summary {
  list-style: none;
  cursor: pointer;
}

.create-section summary::-webkit-details-marker {
  display: none;
}

.create-section-head,
.create-section summary {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  font-size: 28px;
  font-weight: 900;
}

.setup-icon {
  color: var(--gold);
  display: grid;
  place-items: center;
}

.setup-icon svg {
  width: 34px;
  height: 34px;
}

.floating-field {
  margin-top: 20px;
  display: grid;
  gap: 8px;
}

.floating-field > span {
  padding-left: 26px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.floating-field > div {
  min-height: 82px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 0 22px;
  border: 1px solid rgba(226, 189, 109, 0.44);
  border-radius: 20px;
  background: rgba(7, 6, 10, 0.5);
}

.floating-field svg {
  color: var(--gold);
}

.floating-field input {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(22px, 4vw, 34px);
  outline: none;
}

.floating-field small {
  justify-self: end;
  color: var(--dim);
}

.floating-field.small {
  margin-top: 0;
}

.range-block {
  margin-top: 24px;
  display: grid;
  gap: 24px;
}

.range-block .row strong {
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 24px;
}

.range-block input {
  width: 100%;
  accent-color: var(--gold);
}

.setup-grid.two {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.create-submit,
.settings-logout {
  min-height: 86px;
  border: 0;
  border-radius: 22px;
  display: inline-flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  background: #a7191d;
  color: #fff;
  font-size: 26px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 18px 42px rgba(167, 25, 29, 0.32);
}

.create-submit svg,
.settings-logout svg {
  width: 28px;
  height: 28px;
}

.player-count-grid,
.room-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.player-count-grid button,
.role-rule {
  min-height: 42px;
  border: 1px solid rgba(226, 189, 109, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.player-count-grid button {
  cursor: pointer;
  font-weight: 900;
}

.player-count-grid button.active {
  background: var(--gold);
  color: #18130a;
  border-color: transparent;
}

.role-rule {
  padding: 9px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.role-rule.optional {
  border-color: rgba(180, 73, 73, 0.38);
}

.role-rule input {
  accent-color: var(--gold);
}

.room-rules-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.role-reveal-panel {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.role-reveal-panel img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
}

.role-reveal-panel h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.role-reveal-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.player-card,
.player-action {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.player-card {
  padding: 10px;
  display: grid;
  gap: 5px;
}

.player-card.dead {
  opacity: 0.56;
}

.player-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
}

.player-card strong,
.player-card span,
.player-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-card span,
.player-card small {
  color: var(--muted);
  font-size: 12px;
}

.player-action {
  min-height: 68px;
  padding: 10px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.player-action span,
.player-action small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-action small {
  color: var(--muted);
  margin-top: 4px;
}

.player-action:disabled {
  opacity: 0.42;
  cursor: default;
}

.list-item {
  padding: 12px;
}

.user-row,
.thread-row,
.toggle-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.thread-row {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.thread-row:disabled {
  opacity: 0.54;
  cursor: default;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  object-fit: cover;
  background: rgba(226, 189, 109, 0.18);
  color: var(--gold);
  font-weight: 900;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-title {
  margin: 2px 0 0;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.settings-section {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

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

.item-title {
  font-weight: 850;
  margin: 0;
}

.item-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.badge {
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(226, 189, 109, 0.15);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
}

.segmented button.active {
  background: var(--gold);
  color: #18130a;
}

.wide-segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toggle-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.toggle-row.glass {
  border-color: rgba(226, 189, 109, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 4px;
  color: var(--muted);
}

.toggle-row input {
  width: 24px;
  height: 24px;
  accent-color: var(--gold);
}

.btn {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.support-input {
  min-height: 132px;
  border-radius: 18px;
  background: rgba(8, 6, 12, 0.58);
}

.btn.primary {
  background: var(--gold);
  color: #18130a;
}

.btn.danger {
  background: var(--red);
  color: #fff;
}

.btn.vk {
  background: var(--vk);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.icon-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
}

.icon-btn.primary {
  background: var(--gold);
  color: #18130a;
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.icon-btn svg,
.btn svg,
.emoji-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.field,
.message-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 11px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
}

.message-input {
  min-height: 76px;
  padding-top: 10px;
  resize: vertical;
}

.chat-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.game-chat {
  max-height: 520px;
}

.message {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.message small {
  display: block;
  color: var(--dim);
  margin-bottom: 3px;
}

.message.mine {
  background: rgba(226, 189, 109, 0.12);
  border: 1px solid rgba(226, 189, 109, 0.2);
}

.lobby-chat-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(226, 189, 109, 0.44);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(8, 6, 12, 0.58), rgba(8, 6, 12, 0.86)),
    url("./assets/game/texture/mafia/backgrounds/bg_miniapp_lobby.webp") center 38% / cover no-repeat;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

.lobby-chat-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
}

.online-strip {
  min-width: 0;
  display: flex;
  gap: 7px;
  align-items: center;
  overflow-x: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(24, 13, 31, 0.72);
}

.online-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
}

.online-chip {
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 2px 9px 2px 2px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.online-chip .avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.online-chip span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.lobby-message-list {
  max-height: 520px;
  overflow: auto;
  display: grid;
  gap: 9px;
  padding: 12px 2px;
}

.lobby-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: softRise 260ms ease both;
}

.lobby-message.mine {
  justify-content: flex-end;
}

.lobby-bubble {
  max-width: min(82%, 680px);
  padding: 10px 16px;
  border-radius: 6px 20px 20px;
  background: rgba(22, 10, 22, 0.72);
  border: 2px solid rgba(255, 102, 139, 0.8);
  box-shadow: 0 0 18px rgba(255, 102, 139, 0.14);
}

.lobby-message.mine .lobby-bubble {
  border-radius: 20px 6px 20px 20px;
  background: rgba(36, 50, 92, 0.7);
  border-color: rgba(138, 93, 255, 0.78);
  box-shadow: 0 0 18px rgba(138, 93, 255, 0.18);
}

.lobby-bubble-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
}

.lobby-bubble-meta strong {
  color: var(--neon-cyan);
  font-size: 14px;
}

.lobby-bubble-meta span {
  color: var(--dim);
  font-size: 10px;
}

.lobby-bubble-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.lobby-compose {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: end;
  padding-top: 8px;
  border-top: 1px solid rgba(226, 189, 109, 0.2);
}

.emoji-box {
  position: relative;
}

.emoji-btn,
.send-round {
  min-height: 54px;
  border: 0;
  border-radius: 50%;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.emoji-picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  width: 252px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  border: 1px solid rgba(226, 189, 109, 0.34);
  border-radius: 8px;
  background: rgba(20, 20, 26, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.44);
}

.emoji-picker button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.send-round {
  width: 64px;
  min-width: 64px;
  background: #a7161b;
  color: #fff;
  box-shadow: 0 12px 28px rgba(167, 22, 27, 0.34);
}

.lobby-input {
  min-height: 58px;
  max-height: 86px;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(23, 13, 27, 0.9);
  border-color: transparent;
}

.lobby-room-panel {
  margin-top: 22px;
}

.section-line-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: var(--gold);
  font-size: 22px;
  font-weight: 900;
}

.section-line-title span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.lobby-room-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.lobby-room-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(226, 189, 109, 0.46);
  border-radius: 24px;
  background: rgba(12, 7, 15, 0.82);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
  animation: softRise 320ms ease both;
}

.room-card-icon {
  width: 62px;
  height: 62px;
  border: 1px solid rgba(226, 189, 109, 0.45);
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: rgba(226, 189, 109, 0.1);
}

.room-card-icon svg {
  width: 30px;
  height: 30px;
}

.room-card-main h3 {
  margin: 0;
  font-size: 24px;
}

.state-badge {
  padding: 8px 14px;
  border: 1px solid rgba(109, 207, 149, 0.45);
  border-radius: 999px;
  color: #26d19a;
  background: rgba(21, 122, 88, 0.18);
  font-weight: 850;
}

.room-owner,
.room-card-foot {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.room-owner strong {
  margin-left: auto;
  color: var(--text);
  font-size: 18px;
}

.room-progress {
  height: 9px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.room-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1ecf9a, #78f0c3);
}

.room-card-foot {
  justify-content: space-between;
}

.role-card,
.shop-card {
  padding: 12px;
}

.room-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 9px;
}

.room-seat {
  min-height: 118px;
  padding: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  align-content: center;
  justify-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
}

.room-seat.filled {
  border-style: solid;
  border-color: rgba(226, 189, 109, 0.28);
  background: rgba(226, 189, 109, 0.09);
  color: var(--text);
}

.room-seat .avatar {
  width: 42px;
  height: 42px;
}

.room-seat strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.room-seat span {
  font-size: 11px;
}

.seat-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 900;
}

.phase-track {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 7px;
  overflow-x: auto;
}

.phase-step {
  min-height: 72px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  align-content: center;
  background: rgba(27, 28, 34, 0.9);
  color: var(--muted);
}

.phase-step span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.phase-step strong {
  font-size: 12px;
  line-height: 1.15;
}

.phase-step.done {
  color: var(--text);
  border-color: rgba(109, 207, 149, 0.28);
}

.phase-step.active {
  color: #17130b;
  background: var(--gold);
  border-color: transparent;
}

.ready-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 9px;
}

.ready-player {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(226, 189, 109, 0.22);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  justify-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.055);
}

.ready-player.ok {
  border-color: rgba(109, 207, 149, 0.55);
}

.ready-player.bad {
  border-color: rgba(180, 73, 73, 0.65);
}

.ready-player .avatar {
  width: 42px;
  height: 42px;
}

.ready-player strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.ready-player span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.auction-grid,
.table-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.auction-card,
.table-role-card {
  min-width: 0;
  border: 1px solid rgba(226, 189, 109, 0.22);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 7px;
  align-content: start;
  text-align: left;
  background: rgba(13, 13, 18, 0.9);
  color: var(--text);
  cursor: pointer;
}

.auction-card:disabled,
.table-role-card:disabled {
  cursor: default;
  opacity: 0.64;
}

.auction-card.selected,
.table-role-card.mine {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(226, 189, 109, 0.24);
}

.auction-card.outbid {
  border-color: rgba(180, 73, 73, 0.75);
}

.auction-card img,
.table-role-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.3);
}

.auction-card strong,
.table-role-card strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.auction-card span,
.table-role-card span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.auction-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.shop-card {
  display: grid;
  gap: 9px;
  align-content: start;
  padding: 14px;
  border-color: rgba(226, 189, 109, 0.32);
  border-radius: 18px;
  background: rgba(13, 8, 18, 0.72);
}

.shop-art {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(226, 189, 109, 0.22);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

.cosmetic-card {
  background:
    linear-gradient(145deg, rgba(226, 189, 109, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.055);
}

.inventory-section {
  display: grid;
  gap: 8px;
}

.inventory-section h4 {
  margin: 0;
  font-size: 15px;
}

.role-card {
  display: grid;
  gap: 8px;
  align-content: start;
}

.role-art {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
}

.role-card strong,
.shop-card strong {
  display: block;
  margin-bottom: 5px;
}

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

.event-summary {
  margin-top: 12px;
}

.mini-metrics {
  grid-template-columns: repeat(3, 1fr);
}

.mini-metrics div {
  min-width: 0;
  padding: 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
}

.mini-metrics strong,
.mini-metrics span {
  display: block;
}

.mini-metrics span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.audio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.event-feed {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.subhead-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.subhead-row strong {
  font-size: 13px;
}

.subhead-row span {
  color: var(--muted);
  font-size: 11px;
}

.game-items {
  display: grid;
  gap: 9px;
}

.game-items-grid {
  display: grid;
  gap: 7px;
}

.game-item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 34px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.game-item-card strong,
.game-item-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-item-card small,
.game-item-card span {
  color: var(--muted);
  font-size: 11px;
}

.icon-btn.compact {
  width: 34px;
  min-width: 34px;
  height: 34px;
  font-size: 20px;
  font-weight: 900;
}

.event-item {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
}

.cash-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.cash-hero,
.cash-topup,
.cash-info {
  border: 1px solid rgba(226, 189, 109, 0.2);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.cash-hero {
  min-height: 260px;
  display: grid;
  align-content: end;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(9, 10, 14, 0.16), rgba(9, 10, 14, 0.9)),
    url("./assets/game/texture/mafia/results/victory_mafia.webp") center / cover no-repeat;
}

.cash-hero h3 {
  margin: 0;
  font-size: 28px;
}

.cash-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.cash-topup {
  display: grid;
  gap: 12px;
}

.coin-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.coin-pack {
  min-height: 86px;
  border: 1px solid rgba(226, 189, 109, 0.28);
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  background: linear-gradient(160deg, rgba(226, 189, 109, 0.18), rgba(255, 255, 255, 0.055));
  color: var(--text);
  cursor: pointer;
}

.coin-pack strong {
  font-size: 24px;
  color: var(--gold);
}

.coin-pack span {
  color: var(--muted);
  font-size: 12px;
}

.cash-info {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cash-info div {
  padding: 10px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.2);
}

.cash-info strong,
.cash-info span {
  display: block;
}

.cash-info span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.profile-avatar-panel {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid rgba(226, 189, 109, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.avatar-preview-ring {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 3px solid var(--gold);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

.avatar-preview-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
}

.avatar-preview-ring .avatar {
  width: 100%;
  height: 100%;
  font-size: 54px;
}

.avatar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.crop-slider {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.crop-slider input {
  accent-color: var(--gold);
}

.avatar-preset-grid {
  grid-column: 1 / -1;
  max-height: 260px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 8px;
}

.avatar-preset {
  border: 1px solid rgba(226, 189, 109, 0.22);
  border-radius: 50%;
  padding: 0;
  aspect-ratio: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

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

.event-item strong {
  color: var(--gold);
  font-size: 11px;
}

.event-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.empty {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.legal-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legal-links a {
  color: var(--gold);
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 16px;
  z-index: 30;
  max-width: 620px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: #2b2115;
  border: 1px solid rgba(226, 189, 109, 0.45);
  color: var(--text);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.36);
}

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

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .sound-toggle {
    justify-self: end;
  }

  .status-pill {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .layout,
  .cash-layout,
  .cash-info,
  .profile-avatar-panel,
  .room-grid,
  .role-grid,
  .shop-grid,
  .segmented,
  .player-grid,
  .player-action-grid,
  .chat-compose,
  .audio-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .user-row,
  .thread-row,
  .toggle-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .row-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .row-actions .btn {
    flex: 1;
  }

  .game-hero {
    grid-template-columns: 1fr;
  }

  .lobby-title-card,
  .create-intro,
  .settings-hero,
  .lobby-room-card {
    grid-template-columns: 1fr;
  }

  .lobby-stats,
  .lobby-shortcuts,
  .setup-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lobby-title-card h2 {
    font-size: 46px;
  }

  .create-section-head,
  .create-section summary {
    font-size: 22px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .announcement-card,
  .role-reveal-panel {
    grid-template-columns: 1fr;
  }

  .announcement-card > img {
    max-height: 190px;
  }

  .news-item {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .news-item img {
    width: 72px;
  }

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

  .lobby-compose {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .send-round {
    grid-column: 1 / -1;
  }

  .mini-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero {
    min-height: 420px;
  }

  .hero h2 {
    font-size: 34px;
  }
}
