/* ========================================================================== PAGES.CSS ========================================================================== */

/* ========================================================================== PAGE TOKENS,
LAYOUT & INFO SIDEBAR ========================================================================== */

:root {
  --z-topbar-h: 40px;
  --z-info-side-w: 200px;
  --z-page-max: 1400px;
  --z-title-sand: rgb(var(--rgb-gold-400));
  --z-mode-card-fixed-w: clamp(280px, 30vw, 360px);
  --z-mode-card-fixed-h: clamp(200px, 32vh, 280px);
  --z-lobby-card-fixed-w: clamp(300px, 32vw, 520px);
}

html.dark {
  --z-title-sand: rgb(var(--rgb-gold-700));
}

body.z-page-body {
  margin: 0;
}

body.z-has-topbar {
  padding-top: var(--z-topbar-h);
}

html[dir="ltr"] .z-footer-wrap {
  padding-left: calc(var(--z-info-side-w) + 12px);
  padding-right: 12px;
}

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

.z-page-inner {
  max-width: 980px;
  margin: 0 auto;
}

/* ========================================================================== TOPBAR,
NAVIGATION & ACCOUNT MENUS ========================================================================== */

html.dark .z-nav a.active {
  background: rgb(var(--rgb-primary-400) / .16);
}

html.dark .z-topbar {
  background: rgb(var(--rgb-primary-900) / .82);
}

html.dark .z-topbar-title {
  background: linear-gradient(135deg, rgb(var(--rgb-primary-400) / .18), rgb(var(--rgb-secondary-600) / .2));
  border-color: rgb(var(--rgb-primary-400) / .2);
  box-shadow: inset 0 1px 0 rgb(var(--rgb-white) / .04);
}

.z-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--z-topbar-h);
  z-index: 9999;
  background: rgb(var(--rgb-white) / .78);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.z-topbar img {
  width: 20px;
  height: 20px;
  display: block;
}

.z-topbar-inner {
  max-width: var(--z-page-max);
  margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 8px;
  padding-inline: 6px;
  gap: 6px;
}

.z-topbar-nav {
  justify-self: start;
  min-width: 0;
}

.z-topbar-lang {
  justify-self: end;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.z-topbar-title {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: clamp(180px, 24vw, 320px);
  height: 30px;
  padding-inline: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgb(var(--rgb-primary-500) / .14), rgb(var(--rgb-secondary-500) / .16));
  border: 1px solid rgb(var(--rgb-primary-500) / .16);
  box-shadow: inset 0 1px 0 rgb(var(--rgb-white) / .6);
}

.z-topbar-title-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.2px;
  font-size: var(--fs-body);
}

.z-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  gap: 4px;
}

.z-nav a {
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
  padding: 6px 8px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1.3px;
  text-underline-offset: 3px;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
  font-size: var(--fs-body);
  border-radius: 12px;
}

.z-nav a.active {
  background: rgb(var(--rgb-primary-500) / .12);
  border-color: rgb(var(--rgb-primary-500) / .16);
  color: var(--text-strong);
}

.z-nav a:hover,
.z-acc-menu-btn:hover,
.z-acc-item:hover {
  background: rgb(var(--rgb-primary-500) / .08) !important;
  border-color: rgb(var(--rgb-primary-500) / .16) !important;
}

html.dark .z-nav a:hover,
html.dark .z-acc-menu-btn:hover,
html.dark .z-acc-item:hover {
  background: rgb(var(--rgb-primary-400) / .12) !important;
  border-color: rgb(var(--rgb-primary-400) / .22) !important;
}

.z-lang-select {
  display: inline-block;
  padding: 4px 7px;
  color: var(--text);
  font-size: var(--fs-body);
  border-radius: 12px;
}

.z-nav-toggle {
  display: none;
  width: 32px;
  height: 32px;
  padding: 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 12px;
}

.z-hamburger {
  width: 16px;
  height: 12px;
  display: block;
  position: relative;
}

.z-hamburger::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  opacity: 0.95;
  top: 0;
}

.z-hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  opacity: 0.95;
  bottom: 0;
}

.z-hamburger span {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  opacity: 0.95;
  top: 5px;
}

.z-topbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.z-topbar-account {
  position: relative;
}

.z-nav-toggle:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 2px;
}

.z-topbar .z-lang-select {
  display: inline-block;
  min-width: 120px;
  height: 32px;
  padding: 4px 10px;
  border-radius: 12px;
}

.z-acc-desktop {
  display: block;
}

.z-acc-menu-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  color: var(--text) !important;
  line-height: 1;
  padding: 5px 7px;
  font-weight: 600;
  font-size: var(--fs-body);
  border-radius: 12px;
  border-color: var(--border);
}

.z-acc-menu-btn .z-acc-ico {
  display: none;
  margin-inline-end: 0;
}

.z-acc-menu-btn .z-acc-text {
  display: inline;
}

.z-acc-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 180px;
  padding: 6px;
  z-index: 10000;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.z-acc-item {
  width: 100%;
  display: block;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  text-align: start;
  line-height: 1.2;
  font-size: var(--fs-body);
  border-radius: 14px;
}

.z-acc-item.danger {
  color: rgb(var(--rgb-danger-400));
}

/* ========================================================================== SHARED CARDS,
TYPOGRAPHY & CTA ========================================================================== */

body.z-page-body.z-info-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.z-page-body.z-info-page main.z-page {
  flex: 1 0 auto;
}

body.z-page-body.z-info-page .z-footer-wrap {
  margin-top: auto;
}

body.z-page-body.z-info-page main.z-page.z-vcenter > .z-page-inner {
  margin-block: auto;
}

/* ========================================================================== HOME PAGE LAYOUT ========================================================================== */

body.z-home-page {
  overflow: hidden;
}

body.z-home-page .app {
  height: calc(100dvh - var(--z-topbar-h));
  gap: 4px !important;
}

body.z-spectator .ai-level-box,
body.z-spectator #onlinePresence,
body.z-spectator .timer-row,
body.z-spectator #btnEndKill,
body.z-spectator #btnEndOnline,
body.z-spectator #btnSync,
body.z-spectator #pvpVoiceBar,
body.mode-pvp #btnEndLocalMatch,
body.z-home-page .side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

body.z-home-page .side > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body.z-home-page .board-wrap {
  padding: 2px !important;
}

/* ========================================================================== SPECTATOR VISIBILITY ========================================================================== */

body.z-spectator #specBar {
  display: grid !important;
}

/* ========================================================================== DASHBOARD & ACCOUNT PANELS ========================================================================== */

html.dark .z-dash-profile-card {
  background: linear-gradient(180deg, rgb(var(--rgb-primary-900) / .94), rgb(var(--rgb-primary-900) / .96));
}

html.dark .z-dash-summary-table th,
html.dark .z-dash-details-table thead th,
html.dark .z-dash-details-table tbody th {
  background: rgb(var(--rgb-primary-400) / .12);
}

.z-dashboard .z-page-title {
  text-align: center;
  margin: 0;
}

.z-dashboard {
  padding-bottom: 12px;
}

.z-dashboard .z-page-inner {
  max-width: min(1160px, 100%);
}

.z-dashboard .z-dashboard-inner {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.z-dashboard .z-dash-main-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
}

.z-dashboard .z-page-head {
  text-align: center;
}

.z-dash-summary-table-rank {
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid rgb(var(--rgb-primary-500) / .6);
  border-radius: 10px;
  background: var(--panel-weak);
  font: inherit;
  line-height: 1.15;
  font-weight: 900;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.z-dash-summary-table-rank:hover,
.z-dash-summary-table-rank:focus-visible {
  border-color: rgb(var(--rgb-primary-500) / .48);
  box-shadow: 0 0 0 2px rgb(var(--rgb-primary-500) / .12);
  outline: none;
}

.z-dash-upper-row {
  display: grid;
  grid-template-columns: minmax(300px, 35%) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.z-dash-side-panel {
  min-height: 0;
}

.z-dash-side-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  align-content: start;
}

.z-dash-profile-card {
  box-sizing: border-box;
  display: flex;
  direction: ltr;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: start;
  border: none;
  padding: 0;
  border-radius: 24px;
  min-height: 104px;
}

.z-dash-profile-text {
  order: 1;
  min-width: 0;
  flex: 0 1 auto;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-weight: 900;
  direction: rtl;
  text-align: right;
}

.z-dash-profile-label,
.z-dash-profile-sep {
  color: var(--text-strong);
  font-size: var(--fs-body);
  font-weight: 900;
  white-space: nowrap;
}

.z-dash-summary,
.z-dash-details {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 24px;
}

.z-dash-actions-panel {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 24px;
}

.z-dash-summary-table,
.z-dash-details-table {
  align-self: center;
  margin-block: auto;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.z-dash-profile-icon {
  order: 2;
  display: block;
  object-fit: contain;
  width: auto;
  height: 100%;
  flex: 0 0 auto;
  min-width: 72px;
  max-width: min(40%, 140px);
  max-height: none;
  align-self: stretch;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.z-dash-profile-name {
  line-height: 1.2;
  word-break: break-word;
  font-size: var(--fs-body);
  font-weight: 900;
  color: var(--text-strong);
  min-width: 0;
}

.z-dash-summary-table th {
  border: 1px solid var(--border);
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.2;
  border-color: var(--border);
  font-weight: 900;
  background: rgb(var(--rgb-primary-500) / .08);
  color: var(--text-strong);
  font-size: var(--fs-body);
}

.z-dash-summary-table td,
.z-dash-details-table th,
.z-dash-details-table td {
  border: 1px solid var(--border);
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.2;
  border-color: var(--border);
  font-size: var(--fs-body);
}

.z-dash-details-table thead th {
  font-weight: 900;
  background: rgb(var(--rgb-primary-500) / .08);
  color: var(--text-strong);
  padding-top: 12px;
  padding-bottom: 12px;
}

.z-dash-details-table tbody th {
  font-weight: 900;
  background: rgb(var(--rgb-primary-500) / .08);
  color: var(--text-strong);
  white-space: nowrap;
  padding-top: 12px;
  padding-bottom: 12px;
}

.z-dash-details-table col.z-dash-match-col {
  width: 32%;
}

.z-dash-details-table tbody td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.z-dash-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: 10px;
}

.z-dash-actions-tail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-column: 1 / span 2;
  gap: 10px;
}

.z-dash-actions-grid .btn,
.z-dash-actions-tail .btn {
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  font-size: var(--fs-body);
  line-height: 1.2;
  white-space: normal;
}

.z-dash-play-btn.btn {
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  line-height: 1.2;
  white-space: normal;
  font-size: var(--fs-body);
}

.z-dash-play-btn {
  grid-column: 3;
  justify-content: center;
  text-decoration: none;
}

.z-dash-play-btn .btn-ico {
  width: 15px;
  height: 15px;
}

#btnDashLogout.btn,
#btnDashLogout.btn span,
#btnDashLogout.btn strong {
  color: rgb(var(--rgb-white)) !important;
}

#btnDashLogout.btn {
  background: linear-gradient(135deg, rgb(var(--rgb-danger-500)), rgb(var(--rgb-danger-400))) !important;
  border-color: rgb(var(--rgb-danger-400) / .28) !important;
}

#btnDashLogout.btn:hover,
#btnDashLogout.btn:focus-visible {
  background: rgb(var(--rgb-danger-600));
  border-color: rgb(var(--rgb-danger-600));
  color: rgb(var(--rgb-white)) !important;
  filter: brightness(1.03);
}

.z-icon-picker,
.z-leaderboard-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.z-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 10px;
  padding: 4px;
}

.z-icon-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  padding: 12px 10px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
}

.z-icon-item img {
  width: 38px;
  height: 38px;
}

.z-icon-item.active {
  border-color: rgb(var(--rgb-success-700) / .65);
}

.modal.z-edit-icon-modal .z-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  padding: 0;
}

.modal.z-edit-icon-modal .z-icon-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  background: rgb(var(--rgb-white) / .72);
}

.modal.z-edit-icon-modal .z-icon-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ========================================================================== LEADERBOARD COMPONENTS ========================================================================== */

.z-leaderboard-loading {
  text-align: center;
  padding: 10px 4px;
}

.z-leaderboard-list {
  max-height: min(60vh, 520px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgb(var(--rgb-white) / .12);
  background: rgb(var(--rgb-black) / .12);
}

.z-leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgb(var(--rgb-white) / .08);
}

.z-leaderboard-row:last-child {
  border-bottom: none;
}

.z-leaderboard-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.z-leaderboard-rank {
  width: 2.2em;
  text-align: right;
  opacity: 0.75;
  flex: 0 0 auto;
}

.z-leaderboard-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: var(--shadow-sm);
}

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

.z-leaderboard-points {
  font-weight: 700;
  opacity: 0.95;
}

.z-leaderboard-empty {
  text-align: center;
  padding: 14px 10px;
  opacity: 0.8;
}

.z-leaderboard-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.z-leaderboard-wl {
  opacity: .8;
  font-size: var(--fs-body);
  color: var(--muted);
}

/* ========================================================================== MODE SELECTION PAGE ========================================================================== */

html.dark .z-mode-card {
  background: radial-gradient(120% 120% at 0% 0%, rgb(var(--rgb-primary-400) / .18), rgb(var(--rgb-primary-400) / 0) 54%), radial-gradient(120% 120% at 100% 100%, rgb(var(--rgb-secondary-500) / .12), rgb(var(--rgb-secondary-500) / 0) 52%), linear-gradient(180deg, rgb(var(--rgb-primary-900) / .96), rgb(var(--rgb-primary-900) / .98));
  border-color: rgb(var(--rgb-primary-400) / .2);
}

html.dark .z-mode-card::after,
html.dark .z-lobby-panel::after {
  background: linear-gradient(180deg, rgb(var(--rgb-white) / .04), rgb(var(--rgb-white) / 0));
}

.z-mode-sub {
  margin: 6px 0 0;
  opacity: .85;
  text-align: center;
  font-size: var(--fs-body);
  color: var(--muted);
}

.z-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, var(--z-mode-card-fixed-w)));
  grid-auto-rows: var(--z-mode-card-fixed-h);
  gap: clamp(10px, 2.2vw, 16px);
  margin: clamp(12px, 2.4vw, 20px) auto 0;
  max-width: none;
  justify-content: center;
  justify-items: stretch;
}

.z-mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--z-mode-card-fixed-h);
  max-height: var(--z-mode-card-fixed-h);
  padding: 14px 12px;
  box-sizing: border-box;
  overflow: hidden;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.z-mode-card::before {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .16;
  pointer-events: none;
  filter: saturate(.9);
  content: none;
}

.z-mode-card.pvc::before,
.z-mode-card.pvp::before {
  background-image: none;
}

.z-mode-card > * {
  position: relative;
  z-index: 1;
}

.z-mode-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgb(var(--rgb-primary-500) / .24);
}




/* Mode-card icons retain the original artwork without an added tile. */
.z-mode-ico {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border: 1px solid var(--mode-icon-border);
  border-radius: 18px;
  background: var(--mode-icon-bg);
  box-shadow: none;
}

.z-mode-ico img {
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
  filter: var(--mode-icon-filter);
  opacity: 1;
}

.z-mode-text {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.z-mode-text h2 {
  margin: 0;
  color: var(--text-strong);
}

.z-mode-text p {
  margin: 0;
  opacity: .85;
  line-height: 1.5;
  font-size: var(--fs-body);
}

.z-mode-page,
.z-lobby-page {
  min-height: calc(100dvh - var(--z-topbar-h));
  display: flex;
}

.z-mode-page > .z-page-inner {
  width: 100%;
  min-height: calc(100dvh - var(--z-topbar-h) - 24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.z-mode-back-row {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

/* ========================================================================== LOBBY PAGE ========================================================================== */

html.dark .z-row {
  background: linear-gradient(180deg, rgb(var(--rgb-primary-800) / .98), rgb(var(--rgb-primary-900) / .98));
  border-color: rgb(var(--rgb-primary-300) / .36);
  box-shadow: 0 12px 28px rgb(var(--rgb-black) / .36);
}

.z-mode-page .z-page-title,
.z-lobby-head-center .z-page-title {
  margin: 0;
  text-align: center;
}

.z-mode-card::after,
.z-lobby-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(var(--rgb-white) / .2), rgb(var(--rgb-white) / 0));
}

html.dark .z-lobby-panel {
  background: radial-gradient(120% 100% at 0% 0%, rgb(var(--rgb-primary-400) / .18), rgb(var(--rgb-primary-400) / 0) 54%), radial-gradient(120% 100% at 100% 100%, rgb(var(--rgb-secondary-500) / .12), rgb(var(--rgb-secondary-500) / 0) 50%), linear-gradient(180deg, rgb(var(--rgb-primary-900) / .98), rgb(var(--rgb-primary-900) / .98));
}

.z-lobby-page > .z-page-inner {
  width: 100%;
  min-height: calc(100dvh - var(--z-topbar-h) - 24px);
}

.z-lobby-page .z-lobby-inner {
  width: 100%;
  min-height: calc(100dvh - var(--z-topbar-h) - 24px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.2vw, 16px);
}

.z-lobby-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.z-lobby-head .z-lobby-back {
  justify-self: start;
}

.z-lobby-head-center {
  text-align: center;
  min-width: 0;
}

.z-lobby-subtitle {
  margin: 6px 0 0;
  opacity: 0.85;
  font-size: var(--fs-body);
  color: var(--muted);
}

.z-lobby-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, var(--z-lobby-card-fixed-w)));
  gap: clamp(10px, 2.2vw, 14px);
  align-items: stretch;
  justify-content: center;
  height: calc((100dvh - var(--z-topbar-h) - 140px) * 0.96);
}

.z-lobby-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.z-lobby-bottom .z-lobby-back {
  justify-self: auto;
}

.z-invite-receive-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  white-space: nowrap;
}

.z-lobby-invite-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.z-invite-receive-label {
  font-weight: 800;
  font-size: var(--fs-body);
}

.z-invite-receive-toggle {
  border: 0;
  border-radius: 999px;
  min-width: 62px;
  padding: 7px 12px;
  font-weight: 900;
  cursor: pointer;
  color: rgb(var(--rgb-white));
  background: linear-gradient(180deg, rgb(var(--rgb-success-600)), rgb(var(--rgb-success-700)));
  box-shadow: 0 5px 14px rgb(var(--rgb-success-700) / .24);
}

.z-invite-receive-toggle.is-disabled {
  background: linear-gradient(180deg, rgb(var(--rgb-danger-400)), rgb(var(--rgb-danger-600)));
  box-shadow: 0 5px 14px rgb(var(--rgb-danger-600) / .24);
}

.z-invite-receive-toggle:disabled {
  opacity: 0.7;
  cursor: wait;
}

.z-lobby-refresh-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
  white-space: nowrap;
}

.z-lobby-refresh-btn .btn-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.z-lobby-refresh-text {
  line-height: 1;
}

.z-lobby-refresh-btn:disabled {
  opacity: 0.62;
  cursor: wait;
}

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

html.dark .z-invite-receive-row {
  background: rgb(var(--rgb-primary-900) / .72);
  border-color: rgb(var(--rgb-primary-400) / .32);
}

.z-lobby-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: var(--z-lobby-card-fixed-w);
  min-width: var(--z-lobby-card-fixed-w);
  max-width: var(--z-lobby-card-fixed-w);
  height: 100%;
  padding: 14px;
  box-sizing: border-box;
  overflow: hidden;
  justify-self: center;
  border: 1px solid var(--border);
  border-radius: 24px;
}

.z-lobby-h2 {
  margin: 0 0 10px;
  text-align: center;
  color: var(--text-strong);
}

.z-lobby-list.rooms {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 2px 6px;
  justify-content: flex-start;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.z-lobby-list.rooms::-webkit-scrollbar {
  width: 8px;
}

.z-lobby-list.players {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-items: center;
  padding-inline: 2px;
}

.z-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  box-sizing: border-box;
  border: 1px solid var(--surface-stroke-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, rgb(var(--rgb-white) / .94), rgb(var(--rgb-primary-200) / .92));
  box-shadow: 0 8px 22px rgb(var(--rgb-primary-900) / .08);
}

.z-lobby-list.rooms .z-row {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.z-lobby-list.players .z-row {
  width: min(520px, 100%);
}

.z-room-row {
  flex-wrap: nowrap;
}

.z-room-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.z-room-title span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.z-row-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.z-row-title {
  line-height: 1.16;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: calc(var(--fs-body) - 1px);
  font-weight: 900;
  color: var(--text-strong);
}

.z-avatar {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgb(var(--rgb-white)), rgb(var(--rgb-primary-200)));
  border-color: rgb(var(--rgb-primary-400) / .36);
}

.z-row-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  align-items: center;
}

.z-row-actions .btn {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  font-size: .86rem;
}

.z-row-actions .btn .btn-ico {
  width: 15px;
  height: 15px;
}

.z-player-row .z-row-actions .btn {
  min-width: 82px;
  justify-content: center;
}

/* ========================================================================== FOOTER ========================================================================== */

.z-footer-wrap {
  max-width: var(--z-page-max);
  margin: 0 auto;
  padding: 8px 12px 14px 12px;
  padding-right: calc(var(--z-info-side-w) + 12px);
  box-sizing: border-box;
}

.z-footer {
  text-align: center;
  color: var(--muted);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgb(var(--rgb-white) / .88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  font-size: var(--fs-footer);
  unicode-bidi: plaintext;
}

html.dark .z-footer {
  background: rgb(var(--rgb-primary-900) / .88);
}

.z-page {
  padding: 14px 12px 24px;
  box-sizing: border-box;
}

.z-ico {
  width: 18px;
  height: 18px;
  display: block;
}

.z-empty {
  padding: 12px;
  text-align: center;
  opacity: 0.78;
  font-size: var(--fs-body);
  color: var(--muted);
}

.z-start-play-wrap .z-start-play-btn {
  width: 100%;
  justify-content: center;
  text-decoration: none;
}

.z-dashboard-page .z-acc-btn {
  color: rgb(var(--rgb-white)) !important;
}

.z-dash-summary-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 96px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgb(var(--rgb-white) / .66);
  box-shadow: var(--shadow-sm);
}

html.dark .z-dash-summary-card {
  background: rgb(var(--rgb-primary-900) / .74);
}

.z-dash-summary-card.is-action {
  cursor: pointer;
}

.z-dash-summary-card.is-action:hover,
.z-dash-summary-card.is-action:focus-visible {
  border-color: rgb(var(--rgb-primary-500) / .48);
  box-shadow: 0 0 0 3px rgb(var(--rgb-primary-500) / .14), var(--shadow-sm);
  outline: none;
}

.z-icon-grid {
  max-height: none;
  overflow: visible;
}

.modal.z-edit-icon-modal {
  width: min(1120px, 96vw) !important;
  height: min(88vh, 880px);
  max-height: 88vh;
}

.modal.z-edit-icon-modal .modal-body {
  padding: 10px !important;
  overflow-y: auto;
}

.modal.z-edit-icon-modal .z-icon-grid {
  max-height: none;
  overflow: visible;
}

.modal.z-leaderboard-modal .modal-body {
  overflow-y: auto;
}

.modal.z-leaderboard-modal .z-leaderboard-list {
  max-height: none;
  overflow: visible;
}

body.z-spectator #btnEndKill,
body.z-spectator #btnUndo,
body.z-spectator #btnSoufla,
body.z-spectator #btnSync,
body.z-spectator #btnEndOnline,
body.z-spectator #btnEndLocalMatch,
body.z-spectator #btnNew,
body.z-spectator #btnSave,
body.z-spectator #btnResume,
body.z-spectator #btnSpk,
body.z-spectator #btnMic {
  display: none !important;
}

/* ========================================================================== FORM CONTROLS ========================================================================== */

.z-form-row {
  display: grid;
  gap: 6px;
}

.z-form-row label {
  font-weight: 900;
  color: var(--text-strong);
}

.z-form-row input,
.z-form-row textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 11px 12px;
  color: var(--text);
  background: rgb(var(--rgb-white) / .86);
  font: inherit;
  line-height: 1.5;
  outline: none;
}

html.dark .z-form-row input,
html.dark .z-form-row textarea {
  background: rgb(var(--rgb-primary-900) / .86);
  border-color: rgb(var(--rgb-primary-400) / .22);
}

.z-form-row input:focus,
.z-form-row textarea:focus {
  border-color: rgb(var(--rgb-primary-500) / .55);
  box-shadow: 0 0 0 3px rgb(var(--rgb-primary-500) / .12);
}

.z-form-row textarea {
  resize: vertical;
  min-height: 160px;
}

.z-auth-seo-card a {
  color: rgb(var(--rgb-primary-700));
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

html.dark .z-auth-seo-card a {
  color: rgb(var(--rgb-primary-300));
}

.z-lobby-list.players .z-row,
.z-lobby-list.rooms .z-row {
  align-items: center;
}

.z-player-row,
.z-room-row {
  min-height: 44px;
}

.z-player-row .z-row-main,
.z-room-row .z-row-main {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-direction: row;
  gap: 0;
}

.z-player-row .z-row-title,
.z-room-row .z-row-title {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.z-row-inline-sub {
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: .86em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.z-row-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--color-secondary);
  box-shadow: 0 0 0 4px var(--color-secondary-soft);
}

.z-row-status-dot.is-available,
.z-player-row.is-available .z-row-status-dot,
.z-room-row.is-live .z-row-status-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 4px var(--color-success-soft);
}

.z-row-status-dot.is-busy,
.z-player-row.is-busy .z-row-status-dot,
.z-room-row.is-reconnecting .z-row-status-dot {
  background: var(--color-danger);
  box-shadow: 0 0 0 4px var(--color-danger-soft);
}

.z-row-status-dot.is-private,
.z-room-row.is-private .z-row-status-dot {
  background: var(--color-warning);
  box-shadow: 0 0 0 4px var(--color-warning-soft);
}

.z-row-status-dot.is-self,
.z-player-row.is-self .z-row-status-dot {
  background: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}

.z-room-row .z-row-actions .btn,
.z-player-row .z-row-actions .btn {
  min-width: 72px;
}

.z-empty,
.z-loading {
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgb(var(--rgb-white) / .98), rgb(var(--rgb-light-primary-200) / .72));
  color: var(--color-text) !important;
  opacity: 1;
  font-weight: 700;
}

html.dark .z-empty,
html.dark .z-loading {
  background: linear-gradient(180deg, rgb(var(--rgb-primary-800) / .96), rgb(var(--rgb-primary-700) / .88));
  color: var(--color-text) !important;
}
