.back-btn {
  background: rgba(0,0,0,.35); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font-display); font-size: 16px; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 14px;
}
.back-btn:hover { background: rgba(255,255,255,.1); }

.lobby-title { display: flex; align-items: baseline; gap: 10px; }
.lobby-mode {
  font-family: var(--font-display); font-size: 30px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: #fff;
}
.lobby-sub { font-family: var(--font-display); font-size: 16px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 2px; }

.lobby-body {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  width: min(1400px, 100%);
  margin: 18px auto 0;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; min-height: 0;
  backdrop-filter: blur(6px);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.card-head h3 {
  margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
}
.card-actions { display: flex; gap: 6px; }
#playerList, #settingsPanel { overflow-y: auto; padding: 10px 12px 14px; flex: 1; min-height: 0; }

/* ---------- Игроки ---------- */
.player-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin: 4px 0; border-radius: 8px;
  background: rgba(255,255,255,.04);
  border-left: 4px solid transparent;
  min-height: 42px;
}
.player-row.me { background: rgba(232,135,30,.12); }
.player-row.empty { color: #5b6072; }
.player-row .name-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-weight: 600; }
.player-row .meta { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.rating-badge { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.team-head {
  margin: 10px 2px 4px; font-family: var(--font-display); font-size: 15px;
  letter-spacing: 1px; text-transform: uppercase;
}
.team-cols { display: grid; grid-template-columns: 1fr; gap: 4px; }
#playerList { overflow-x: hidden; }
.player-row .spec-badge, .player-row .host-badge, .rating-badge { white-space: nowrap; }
.spec-list { margin-top: 10px; }

/* ---------- Настройки ---------- */
.set-group { margin-bottom: 14px; }
.set-group-title {
  font-family: var(--font-display); font-size: 13px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent-2); margin: 4px 2px 6px;
}
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 10px; border-radius: 8px;
  background: rgba(255,255,255,.035); margin-bottom: 4px;
}
.set-label { font-size: 13.5px; }
.set-label small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }

.seg { display: inline-flex; background: #0f1220; border-radius: 7px; padding: 2px; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.seg button {
  background: transparent; color: var(--muted); border: none;
  padding: 5px 10px; border-radius: 5px; font-size: 12.5px; font-weight: 600;
}
.seg button.on { background: var(--accent); color: #fff; }
.seg button:not(.on):not(:disabled):hover { color: #fff; background: rgba(255,255,255,.07); }

.set-select {
  background: #0f1220; color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 8px; font-size: 13px;
}

.stepper { display: inline-flex; align-items: center; background: #0f1220; border-radius: 7px; }
.stepper button {
  width: 28px; height: 28px; border: none; background: transparent; color: var(--text);
  font-size: 16px; font-weight: 700; border-radius: 6px;
}
.stepper button:not(:disabled):hover { background: rgba(255,255,255,.08); }
.stepper button:disabled { color: #444a5c; }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.switch {
  position: relative; width: 40px; height: 22px; border-radius: 999px; border: none;
  background: #3a3f52; transition: background .15s; flex-shrink: 0;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.readonly .seg button, .readonly .stepper button, .readonly .switch, .readonly .set-select { cursor: default; }

.lobby-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  width: min(1400px, 100%); margin: 14px auto 0;
}
.lobby-msg { color: var(--muted); font-size: 13px; margin-right: auto; }
.lobby-msg.error { color: var(--bad); }
#startBtn { min-width: 260px; font-size: 22px; padding: 14px 30px; }

@media (max-width: 900px) {
  #lobby { overflow-y: auto; }
  .lobby-body { grid-template-columns: 1fr; }
}

/* Телефон горизонтально: две колонки, всё помещается в один экран */
@media (max-height: 520px) and (orientation: landscape) {
  #lobby {
    overflow: hidden;
    padding: calc(6px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(12px + env(safe-area-inset-left));
  }
  #lobby .topbar { min-height: 38px; }
  .back-btn { font-size: 14px; padding: 5px 10px; }
  .lobby-mode { font-size: 22px; }
  .lobby-sub { font-size: 12px; letter-spacing: 1px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #lobby .profile { padding: 3px 6px 3px 9px; }
  #lobby .profile-name { font-size: 14px; max-width: 90px; }
  .lobby-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px; margin-top: 6px; }
  .card { border-radius: 10px; }
  .card-head { padding: 7px 10px 6px; }
  .card-head h3 { font-size: 15px; }
  #settingsHint { display: none; }
  .chip-btn { font-size: 11px; padding: 4px 9px; }
  #playerList, #settingsPanel { padding: 4px 8px 8px; }
  .player-row { min-height: 34px; padding: 3px 8px; margin: 3px 0; gap: 6px; }
  .player-row .name-txt { max-width: 96px; font-size: 13px; }
  .set-group { margin-bottom: 8px; }
  .set-row { padding: 5px 8px; }
  .set-label { font-size: 12.5px; }
  .seg button { padding: 5px 8px; font-size: 12px; }
  .lobby-footer { margin-top: 6px; gap: 10px; }
  .lobby-msg { font-size: 12px; }
  #startBtn { min-width: 170px; font-size: 18px; padding: 9px 22px; }
}

.rule-row { justify-content: flex-start; font-size: 14px; line-height: 1.4; }

/* ---------- Эффекты матча плитками-иконками: горит — включено, тёмная — выключено ---------- */
.fx-sub { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 6px 0 6px; }
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.fx-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border-radius: 10px; cursor: pointer;
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.08); color: #8a8fa0;
  font-size: 11.5px; font-weight: 600; line-height: 1.15; text-align: center; transition: transform .12s, border-color .15s, background .15s;
}
.fx-tile canvas { width: 44px; height: 44px; filter: grayscale(1) brightness(.4); opacity: .7; transition: filter .15s, opacity .15s; }
.fx-tile.on { color: #f3eaff; background: rgba(177,77,255,.14); border-color: rgba(177,77,255,.55); box-shadow: 0 0 14px rgba(177,77,255,.25); }
.fx-tile.on canvas { filter: none; opacity: 1; }
.fx-tile.seasonal.on { background: rgba(31,209,193,.12); border-color: rgba(31,209,193,.6); box-shadow: 0 0 14px rgba(31,209,193,.25); color: #d6fffb; }
.fx-tile:not(:disabled):hover { transform: translateY(-2px); border-color: rgba(255,255,255,.35); }
.fx-tile:disabled { cursor: default; }
.fx-grid.all-off { opacity: .6; }
.fx-warn { font-size: 12px; font-weight: 600; color: #ffcf6b; background: rgba(255,170,60,.1); border: 1px solid rgba(255,170,60,.35); border-radius: 8px; padding: 8px 10px; margin: 2px 0 10px; }

/* карточка-подсказка эффекта — в стиле окна монеток и билетов */
.fx-pop {
  position: fixed; z-index: 2000; width: 250px; padding: 14px 16px 14px; border-radius: 14px; text-align: center; pointer-events: none;
  background: radial-gradient(circle at 50% 0%, #3a1e64, #14101f 75%); color: #e9e3d7;
  box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(196,123,255,.35); animation: fxPopIn .14s ease-out;
}
.fx-pop.seasonal { background: radial-gradient(circle at 50% 0%, #10464a, #0e1618 75%); box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(31,209,193,.4); }
@keyframes fxPopIn { from { transform: translateY(6px); opacity: 0; } }
.fx-pop-ico { display: flex; justify-content: center; margin: -42px 0 4px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.5)); }
.fx-pop-ico.off canvas { filter: grayscale(1) brightness(.5); }
.fx-pop b { display: block; font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; text-transform: uppercase; color: #fff; }
.fx-pop-tag { display: inline-block; margin: 4px 4px 0; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; background: rgba(177,77,255,.25); color: #e3c8ff; }
.fx-pop.seasonal .fx-pop-tag { background: rgba(31,209,193,.2); color: #b8fff6; }
.fx-pop-state { display: inline-block; margin: 4px 4px 0; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(255,255,255,.08); color: #9aa0b4; }
.fx-pop-state.on { background: #c6ff3d; color: #1a0f2a; }
.fx-pop p { margin: 10px 0 0; font-size: 13px; line-height: 1.45; }
.fx-pop small { display: block; margin-top: 8px; font-size: 11.5px; color: #ffcf6b; }

/* ================= Лобби в стиле HUD: уголки-скобки, тонкие светящиеся рамки, скошенные углы ================= */
#lobby .card, .hud-card {
  position: relative; border-radius: 4px; background: linear-gradient(180deg, rgba(14,26,38,.88), rgba(10,16,26,.92));
  border: 1px solid rgba(94,224,255,.22);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
#lobby .card::before, #lobby .card::after, .hud-card::before, .hud-card::after {
  content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none; border: 2px solid #5ee0ff; opacity: .8;
}
#lobby .card::before, .hud-card::before { left: 4px; top: 4px; border-right: none; border-bottom: none; }
#lobby .card::after, .hud-card::after { right: 4px; bottom: 4px; border-left: none; border-top: none; }
#lobby .card-head, .hud-card .card-head { border-bottom: 1px solid rgba(94,224,255,.18); background: linear-gradient(90deg, rgba(94,224,255,.1), transparent 70%); }
#lobby .card-head h3, .hud-card .card-head h3 { color: #dff8ff; letter-spacing: 2px; }
#lobby .card-head h3::before, .hud-card .card-head h3::before { content: '◆ '; color: #5ee0ff; font-size: 12px; vertical-align: 2px; }
#lobby .player-row { border-radius: 2px; background: linear-gradient(90deg, rgba(94,224,255,.07), rgba(255,255,255,.02)); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%); }
#lobby .player-row.me { background: linear-gradient(90deg, rgba(232,135,30,.22), rgba(232,135,30,.04)); }
/* .set-row есть и в окне «Настройки» (pages.css) — в лобби задаём свои отступы явно */
#lobby .set-row { border-radius: 2px; background: rgba(94,224,255,.05); padding: 9px 14px; gap: 12px; margin-bottom: 5px; border-bottom: none; }
#lobby .set-group-title { margin: 6px 4px 8px; }

/* монстры в настройках — рисунок как на арене */
.set-label.with-monster { display: flex; align-items: center; gap: 10px; }
.set-monster { flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
/* формат боя — картинки вместо текста, описание при наведении */
.seg.icon-seg { gap: 6px; padding: 4px; }
.seg.icon-seg button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 8px 6px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; color: #9fb4cc; background: rgba(94,224,255,.05); border: 1px solid rgba(94,224,255,.18);
}
.seg.icon-seg button.on { color: #fff; background: rgba(94,224,255,.16); border-color: #5ee0ff; box-shadow: inset 0 0 14px rgba(94,224,255,.25), 0 0 12px rgba(94,224,255,.25); }
.seg.icon-seg button:not(.on) .fmt-art { filter: grayscale(.9) brightness(.6); }
.seg.icon-seg button:not(.on):not(:disabled):hover .fmt-art { filter: grayscale(.3) brightness(.9); }
.fmt-art { display: block; }
.fx-pop-art canvas { display: block; margin: 0 auto; }
.ico-badge { display: inline-flex; align-items: center; gap: 4px; }
.small-btn { display: inline-flex; align-items: center; gap: 3px; }
.rule-row { display: flex; align-items: center; gap: 10px; }
.rule-ico { display: inline-flex; color: #5ee0ff; flex-shrink: 0; }

/* центр: витрина персонажа + эффекты */
.lobby-stage { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.stage-hero {
  position: relative; flex: 1 1 52%; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  background: radial-gradient(ellipse at 50% 75%, rgba(94,224,255,.16), transparent 65%);
}
.stage-hero::before { /* сканирующая сетка на фоне */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .25;
  background: repeating-linear-gradient(0deg, rgba(94,224,255,.12) 0 1px, transparent 1px 22px), repeating-linear-gradient(90deg, rgba(94,224,255,.08) 0 1px, transparent 1px 22px);
  -webkit-mask: radial-gradient(ellipse at 50% 70%, #000 30%, transparent 70%); mask: radial-gradient(ellipse at 50% 70%, #000 30%, transparent 70%);
}
.stage-hero canvas { position: absolute; left: 0; top: 0; }
.stage-name { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; height: 34px; }
.stage-name b { font-family: var(--font-display); font-size: 24px; letter-spacing: 2px; text-transform: uppercase; color: #fff; text-shadow: 0 0 14px rgba(94,224,255,.6); }
.fx-card { flex: 0 0 auto; }
#effectsPanel { padding: 10px 12px 12px; }
#effectsPanel .fx-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
#effectsPanel .fx-tile { border-radius: 2px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
.fx-empty { color: var(--muted); font-size: 13px; padding: 10px 4px; }

/* кнопка «Играть» — скошенная, с шевронами */
.fight-btn {
  position: relative; min-width: 300px !important; font-size: 26px !important; letter-spacing: 3px; text-transform: uppercase;
  background: linear-gradient(90deg, #c6ff3d, #7ed321) !important; color: #0e1a08 !important; box-shadow: 0 0 24px rgba(198,255,61,.35) !important;
  clip-path: polygon(18px 0, 100% 0, calc(100% - 18px) 100%, 0 100%); border-radius: 0 !important;
}
.fight-btn::after { content: '›››'; margin-left: 12px; letter-spacing: -2px; }
.fight-btn:disabled { background: #3a4150 !important; color: #8a90a0 !important; box-shadow: none !important; }
.fight-btn:disabled::after { content: ''; margin: 0; }

@media (max-width: 1100px) {
  .lobby-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lobby-stage { grid-column: 1 / -1; order: -1; flex-direction: row; }
  .stage-hero { min-height: 200px; flex: 0 0 38%; }
  .fx-card { flex: 1; }
}
@media (max-width: 900px) {
  .lobby-body { grid-template-columns: 1fr; }
  .lobby-stage { flex-direction: column; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .lobby-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.1fr); }
  .stage-hero { min-height: 110px; }
  .stage-name b { font-size: 16px; }
  #effectsPanel .fx-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 5px; }
  #effectsPanel .fx-tile { font-size: 10px; padding: 5px 2px; }
  #effectsPanel .fx-tile canvas { width: 32px; height: 32px; }
  .fight-btn { min-width: 190px !important; font-size: 18px !important; }
  #lobby .set-row { padding: 5px 10px; }
}