.lobby-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: auto;
  background: var(--bg);
  color: var(--text);
  padding: 24px 16px 48px;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
  word-spacing: normal;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}
/* Dense UI rhythm; never let heading tracking leak into copy/numbers/buttons. */
.lobby-root * {
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
}
.lobby-root h2,
.lobby-root h3,
.lobby-root .lobby-log-title,
.lobby-root .tavern-panel-label,
.lobby-root .sect-title {
  text-transform: none;
}
.lobby-root .lobby-modal-head > button {
  font-size: var(--text-2xl) !important;
  font-weight: 400 !important;
  line-height: 1 !important;
}
.lobby-root[hidden] {
  display: none !important;
}
.lobby-panel {
  max-width: 820px;
  margin: 0 auto;
  font-family: var(--font-ui);
}
/* Pre-match lobby list / create form: extra line spacing for comfort. */
.lobby-panel:not(.lobby-panel-wide) {
  line-height: 1.7 !important;
}
.lobby-panel:not(.lobby-panel-wide) h2 {
  margin-bottom: 16px;
}
.lobby-panel:not(.lobby-panel-wide) section {
  margin: 22px 0;
}
.lobby-panel:not(.lobby-panel-wide) h3 {
  margin: 0 0 12px;
}
.lobby-panel:not(.lobby-panel-wide) .lobby-lead,
.lobby-panel:not(.lobby-panel-wide) .lobby-empty,
.lobby-panel:not(.lobby-panel-wide) .lobby-note {
  margin: 10px 0 16px;
  line-height: 1.75 !important;
}
.lobby-panel:not(.lobby-panel-wide) .lobby-create label {
  margin: 14px 0;
  line-height: 1.75 !important;
}
.lobby-panel:not(.lobby-panel-wide) .lobby-card {
  margin: 16px 0;
  padding: 16px 18px;
}
.lobby-panel:not(.lobby-panel-wide) .lobby-card h3 {
  margin: 0 0 12px;
}
.lobby-panel:not(.lobby-panel-wide) .lobby-color-row,
.lobby-panel:not(.lobby-panel-wide) .lobby-slot {
  margin: 10px 0;
}
.lobby-panel:not(.lobby-panel-wide) .lobby-card-actions {
  margin-top: 14px;
  gap: 10px;
}
.lobby-panel:not(.lobby-panel-wide) details {
  margin: 14px 0;
}
.lobby-panel:not(.lobby-panel-wide) details summary {
  margin-bottom: 10px;
  line-height: 1.7 !important;
}
.lobby-panel-wide {
  width: 100%;
  max-width: 100%;
}
.lobby-panel h2 {
  margin: 0 0 8px;
  color: var(--text-heading, var(--text));
  font-family: var(--font-hud);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: 0.02em !important;
}
.lobby-lead, .lobby-meta, .lobby-empty, .lobby-note { color: var(--text-muted); font-size: var(--text-base); }
.lobby-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 10px 0;
  background: var(--surface);
}
.lobby-card h3 {
  margin: 0 0 6px;
  color: var(--text-heading, var(--text));
  font-family: var(--font-hud);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em !important;
}
.lobby-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: var(--text-sm);
}
.lobby-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid var(--border-strong);
}
.lobby-create label {
  display: block;
  margin: 8px 0;
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
}
.lobby-create input, .lobby-create select, .lobby-slot select {
  margin-left: 8px;
  vertical-align: middle;
}
.lobby-create input:not([type="number"]),
.lobby-create select,
.lobby-slot select {
  max-width: 220px;
}
.lobby-root input,
.lobby-root select,
.lobby-root textarea {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  padding: 3px 6px;
}
.lobby-root input[type="number"] {
  width: 64px;
  font-variant-numeric: tabular-nums lining-nums;
}
.lobby-slot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}
.lobby-card-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.lobby-match > .lobby-card-actions button {
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: var(--weight-medium);
  padding: 4px 8px;
  letter-spacing: normal !important;
}
.lobby-started {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.lobby-eco {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums lining-nums;
}
.lobby-eco-row { margin: 4px 0; color: var(--text); }
.lobby-eco-row--res,
.lobby-eco-row--army,
.type-army {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: var(--weight-medium);
}
.lobby-eco-row--stocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}
.lobby-eco-res { white-space: nowrap; }
.lobby-eco button,
.lobby-eco select,
.lobby-eco .lobby-admin-link {
  font-family: var(--font-ui);
}
.lobby-castle-card button[data-build],
.lobby-castle-card button[data-open-b] {
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: var(--weight-medium);
  padding: 4px 8px;
}
.lobby-eco input[type="number"] {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: normal !important;
}
.lobby-eco-actions { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lobby-unit-cost { opacity: 0.88; white-space: nowrap; }
.lobby-unit-art,
.lobby-unit-chip { display: none; }
.lobby-unit-text { display: inline; }
.lobby-unit-pair { display: inline; }
.lobby-map-tip { display: none; }
.lobby-hire-all { font-weight: 600; }
.lobby-hire-all-msg {
  color: var(--danger, #c43c3c);
  font-weight: 500;
  min-height: 1.2em;
}
.war-house-hire {
  margin-bottom: 4px;
}
.war-house-unit {
  vertical-align: bottom;
}
.war-house-unit[data-cost],
.war-house-unit[data-tier],
[data-build][data-cost] {
  cursor: help;
}
.war-house-hire input:disabled {
  opacity: 0.45;
}
.war-house-avail {
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  color: var(--accent, var(--text));
  margin-top: 2px;
}
#warHouseUnitInfo {
  min-height: 1.15em;
  white-space: normal;
}
.lobby-modal--compact {
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
}
.lobby-modal--compact .lobby-modal-head strong,
.lobby-modal--compact #lobbyNeighborsOpen,
.lobby-modal--compact .lobby-eco-row,
.lobby-modal--compact .lobby-eco-actions,
.lobby-modal--compact .lobby-hire-all,
.lobby-modal--compact .lobby-hire-all-msg,
.lobby-modal--compact .fight-calc-bar,
.lobby-modal--compact .fight-calc-inputs,
.lobby-modal--compact .fight-calc-inputs th,
.lobby-modal--compact .fight-calc-inputs td,
.lobby-modal--compact .fight-calc-inputs tbody th,
.lobby-modal--compact .fight-calc-inputs thead th,
.lobby-modal--compact .fight-calc-inputs button,
.lobby-modal--compact .war-house-mini,
.lobby-modal--compact .lobby-eco-actions button,
.lobby-modal--compact .fight-calc-arts,
.lobby-modal--compact .fight-calc-arts th,
.lobby-modal--compact .fight-calc-arts td,
.lobby-modal--compact .lobby-admin-block__title,
.lobby-modal--compact .lobby-admin-block__hint,
.lobby-modal--compact .lobby-admin-block button,
.lobby-modal--compact label,
.lobby-modal--compact input,
.lobby-modal--compact select,
.lobby-modal--compact .lobby-admin-link,
.lobby-modal--compact .lobby-mage-ability,
.lobby-modal--compact .lobby-mage-ability strong,
.lobby-modal--compact .lobby-mage-cd,
.lobby-modal--compact .lobby-unit-cost,
.lobby-modal--compact .lobby-b-off,
.lobby-modal--compact .lobby-unit-chip-name,
.lobby-modal--compact .lobby-unit-chip-qty,
.lobby-modal--compact .lobby-eco-row--army,
.lobby-modal--compact .type-army {
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
}
.lobby-modal--compact input[type="number"],
.lobby-modal--compact .fight-calc-inputs input[type="number"],
.lobby-modal--compact .fight-calc-bar input[type="number"] {
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  padding: 3px 6px;
}
.lobby-modal--compact .lobby-mage-ability {
  margin: 4px 0;
  padding: 3px 5px;
}
.lobby-modal--compact .war-house-mini,
.lobby-modal--compact .fight-calc-bar .war-house-mini,
.lobby-modal--compact .lobby-eco-actions button,
.lobby-modal--compact .fight-calc-inputs button,
.lobby-modal--compact .fight-calc-bar button,
.lobby-modal--compact .fight-calc-bar .primary,
.lobby-modal--compact .lobby-admin-block button,
.lobby-modal--compact #lobbyNeighborsOpen {
  padding: 3px 8px;
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  width: auto;
  min-height: 0;
  box-shadow: none;
  border-radius: 2px;
}
#lobbyHireTip,
#lobbyMapTip {
  position: fixed;
  z-index: 92;
  margin: 0;
  padding: 6px 8px;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  pointer-events: none;
  box-shadow: none;
  color: var(--text);
}
#lobbyHireTip {
  background: var(--modal-bg, var(--surface-raised));
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 2px;
}
#lobbyMapTip {
  background: transparent;
  border: none;
  border-radius: 0;
}
#lobbyHireTip[hidden],
#lobbyMapTip[hidden] {
  display: none !important;
}
#lobbyHireTip:not([hidden]),
#lobbyMapTip:not([hidden]) {
  display: block;
}
#lobbyHireTip,
#lobbyHireTip .lobby-map-tip-line,
#lobbyHireTip .lobby-map-tip-line:first-child,
#lobbyHireTip .lobby-map-tip-label,
#lobbyMapTip,
#lobbyMapTip .lobby-map-tip-line,
#lobbyMapTip .lobby-map-tip-line:first-child,
#lobbyMapTip .lobby-map-tip-label {
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
  font-style: normal;
  color: var(--text);
}
#lobbyHireTip .lobby-map-tip-line,
#lobbyMapTip .lobby-map-tip-line {
  margin: 0 0 2px;
  white-space: normal;
  color: var(--text);
}
#lobbyHireTip .lobby-map-tip-line:last-child,
#lobbyMapTip .lobby-map-tip-line:last-child {
  margin-bottom: 0;
}
#lobbyMapTip .lobby-map-tip-line--strike {
  margin-top: 6px;
}
#lobbyMapTip .lobby-map-tip-line--siege {
  color: var(--danger, #a04838);
}
.lobby-castle-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 8px 0;
  background: var(--surface-raised);
}
.lobby-match-over { font-size: var(--text-xl); font-family: var(--font-display); font-weight: var(--weight-semibold); }
.lobby-map-wrap { margin-top: 12px; }
.lobby-map-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  padding: 12px 16px 16px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
  box-sizing: border-box;
}
/* World map type: IBM Plex Sans, tight tracking — do not force 16px on every child. */
.lobby-map-overlay {
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
}
.lobby-map-overlay *,
.lobby-map-grid-toggle,
.lobby-map-grid-toggle-text,
.lobby-map-legend,
.lobby-map-legend-item,
.lobby-map-ico-lvl {
  font-family: var(--font-ui) !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  font-style: normal !important;
  text-transform: none;
}
/* Legend labels already name the object; a 16px level digit covers the 16px mark. */
.lobby-map-legend-item .lobby-map-ico-lvl {
  display: none;
}
.lobby-map-overlay-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-right: 12px;
  position: relative;
  z-index: 6;
}
.lobby-map-overlay-sticky {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 12px 6px 0;
  position: relative;
  z-index: 7;
}
.lobby-map-sticky-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
  width: 100%;
}
.lobby-map-overlay-sticky #lobbyWorldMapClose {
  flex-shrink: 0;
}
.lobby-map-overlay-sticky .lobby-map-turn {
  flex: 0 1 auto;
  min-width: 0;
  width: 100%;
}
.lobby-map-overlay-scroll {
  flex: 1;
  min-height: 0;
  height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
}
.lobby-map-overlay-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.lobby-map-grid-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
  margin: 0;
  padding: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.lobby-map-grid-toggle:hover {
  color: var(--text);
}
.lobby-map-grid-toggle-text {
  line-height: 1;
}
.lobby-map-grid-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  appearance: none;
}
.lobby-map-grid-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: none;
}
.lobby-map-grid-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.15s ease, background 0.15s ease;
}
.lobby-map-grid-toggle input:checked + .lobby-map-grid-switch {
  background: var(--accent);
  border-color: var(--accent);
}
.lobby-map-grid-toggle input:checked + .lobby-map-grid-switch::after {
  transform: translateX(16px);
  background: #fff;
}
.lobby-map-grid-toggle input:focus-visible + .lobby-map-grid-switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lobby-map-turn {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  font-size: var(--text-ui);
  font-weight: 400;
  background: none;
  border: 0;
}
.lobby-map-turn-who,
.lobby-map-turn-time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lobby-map-turn-label {
  color: var(--text-muted);
  font-weight: 400;
}
.lobby-map-turn-name {
  font-weight: 400;
}
.lobby-map-turn-mine-mark {
  color: var(--info, var(--accent));
  font-style: normal;
  font-weight: 400;
}
.lobby-map-overlay .lobby-map-wrap {
  flex: 0 0 100%;
  height: 100%;
  min-height: 100%;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
}
.lobby-map-overlay .lobby-map-wrap::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.lobby-map-overlay .lobby-map-legends,
.lobby-map-overlay .lobby-map-legend {
  flex-shrink: 0;
}
.lobby-map-overlay .lobby-map-legends {
  margin-bottom: 6px;
}
.lobby-map-legends-fold {
  margin: 0 0 6px;
}
.lobby-map-legends-fold > summary {
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
  color: var(--text-muted);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.lobby-map-legends-fold > summary::-webkit-details-marker {
  display: none;
}
.lobby-map-legends-fold > summary::before {
  content: '▸ ';
}
.lobby-map-legends-fold[open] > summary::before {
  content: '▾ ';
}
.lobby-map-legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}
.lobby-map-legend--squads {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}
.lobby-map-squad-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent, #2a6fdb);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.lobby-map-squad-link-name {
  text-decoration: underline;
}
.lobby-map-squad-link:hover,
.lobby-map-squad-link:focus {
  color: var(--accent-strong, var(--accent, #1a4fa8));
}
.lobby-map-squad-link--sel {
  font-weight: 600 !important;
  background: var(--accent-muted);
  border-radius: var(--radius);
  padding: 1px 4px;
}
.lobby-map-squad-link--sel .lobby-map-squad-link-name {
  text-decoration: none;
}
.lobby-map-squad-moves {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  line-height: 1.4 !important;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.lobby-map-squad-moves--ready {
  background: color-mix(in srgb, var(--success, #4a7a38) 18%, transparent);
  color: var(--success, #4a7a38);
}
.lobby-map-squad-moves--low {
  background: var(--warning-bg, rgba(216, 184, 112, 0.35));
  color: var(--warning-text, #6b5010);
}
.lobby-map-squad-moves--spent {
  background: color-mix(in srgb, var(--text-muted, #888) 16%, transparent);
  color: var(--text-muted, #888);
}
.lobby-map-overlay .lobby-map-viewport {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  contain: layout style;
}
.lobby-map-overlay .lobby-map {
  max-height: none;
  max-width: none;
  overflow: visible;
  grid-auto-rows: var(--lobby-cell, 60px);
  cursor: grab;
}
.lobby-map-overlay .lobby-cell {
  cursor: grab;
  -webkit-touch-callout: none;
}
.lobby-map-overlay .lobby-map--scout-pick .lobby-cell,
.lobby-map-overlay .lobby-map--strike-pick .lobby-cell {
  cursor: crosshair;
}
.lobby-map-overlay .lobby-map-wrap.lobby-map-wrap--dragging,
.lobby-map-overlay .lobby-map-wrap.lobby-map-wrap--dragging .lobby-map-viewport,
.lobby-map-overlay .lobby-map-wrap.lobby-map-wrap--dragging .lobby-map-stage,
.lobby-map-overlay .lobby-map-wrap.lobby-map-wrap--dragging .lobby-map {
  cursor: grabbing;
}
.lobby-map-overlay .lobby-map-wrap.lobby-map-wrap--dragging .lobby-map {
  pointer-events: none;
}
/* While panning: drop heavy SVG filters/masks so the stage can translate as textures.
   Hide wash / fog veil instead of unfiltering them — otherwise scalloped biome,
   cream, and faction-colored blobs become sharp light spots (especially on wheel
   ticks that briefly enter/exit --panning, and on mobile finger-pan). */
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-rift {
  mix-blend-mode: normal !important;
  isolation: auto !important;
}
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-wash-biomes,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-wash-shore,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-wash-light,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-wash-owner,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-fog-veil {
  opacity: 0 !important;
  visibility: hidden !important;
}
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-water-paint,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-rift-edge,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-rift-core {
  filter: none !important;
}
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-ico svg,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-ico-obj,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map-ico-hero,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-cell.reach,
.lobby-map-wrap.lobby-map-wrap--panning .lobby-cell.selected {
  filter: none !important;
}
.lobby-map-wrap.lobby-map-wrap--panning .lobby-map--tessera-smooth {
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
body .lobby-map-overlay .lobby-map-stage {
  max-width: none;
  width: max-content;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: layout style;
}
.lobby-map-overlay .lobby-map-wash,
.lobby-map-overlay .lobby-map-water,
.lobby-map-overlay .lobby-map-rift,
.lobby-map-overlay .lobby-map-inks,
.lobby-map-overlay .lobby-map-fog-veil {
  backface-visibility: hidden;
}
.lobby-map-stage {
  position: relative;
  width: max-content;
  max-width: 100%;
}
.lobby-map-sector-grid {
  display: none;
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
}
.lobby-map-stage--show-grid .lobby-map-sector-grid {
  display: block;
}
.lobby-map-sector-grid path {
  fill: none;
  stroke: #888888;
  stroke-width: 1;
  stroke-dasharray: 4 3;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  opacity: 0.65;
}
.lobby-map {
  --lobby-cell: 60px;
  display: grid;
  grid-template-columns: repeat(var(--lobby-cols, 10), var(--lobby-cell));
  grid-auto-rows: var(--lobby-cell);
  gap: 3px;
  max-height: 480px;
  overflow: auto;
  padding: 8px;
  background-color: #05060c;
  background-image: url("/img/fog-of-war.png");
  background-repeat: repeat;
  border-radius: var(--radius);
  border: 1px solid #1a1c28;
  width: max-content;
  max-width: 100%;
}
.lobby-cell {
  width: var(--lobby-cell, 60px);
  height: var(--lobby-cell, 60px);
  min-width: 0;
  min-height: 0;
  max-width: var(--lobby-cell, 60px);
  max-height: var(--lobby-cell, 60px);
  box-sizing: border-box;
  padding: 0;
  border: 1px solid var(--map-cell-border);
  background: var(--map-cell-bg);
  color: var(--text);
  font-size: var(--text-md);
  line-height: var(--leading-tight);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.lobby-cell-roads {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
.lobby-cell-roads svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.lobby-cell-art {
  position: absolute;
  inset: 0;
  z-index: 2;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
  overflow: visible;
}
.lobby-cell:has(.lobby-map-ico) {
  z-index: 2;
}
.lobby-map-ico {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  overflow: hidden;
}
.lobby-map-ico--map_label {
  width: auto;
  height: auto;
  max-width: none;
  overflow: visible;
  z-index: 3;
}
.lobby-map-label {
  display: block;
  max-width: 140px;
  padding: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-weight: var(--weight-semibold, 600);
  letter-spacing: 0.01em;
  pointer-events: none;
  user-select: none;
  transform: rotate(var(--lobby-label-rotate, 0deg));
  transform-origin: center center;
}
.lobby-map-label--font-ui { font-family: var(--font-ui); }
.lobby-map-label--font-display { font-family: var(--font-display, var(--font-ui)); }
.lobby-map-label--font-hud { font-family: var(--font-hud, var(--font-ui)); }
.lobby-map-label--font-mono { font-family: var(--font-mono, monospace); }
.lobby-map-label--size-sm { font-size: 9px; }
.lobby-map-label--size-md { font-size: 11px; }
.lobby-map-label--size-lg { font-size: 14px; }
.lobby-map-label--style-ink {
  color: var(--text, #2a241c);
}
.lobby-map-label--style-outline {
  color: var(--text, #1a1510);
  text-shadow:
    0 0 2px var(--surface, #f5ebd4),
    0 1px 0 var(--surface, #f5ebd4),
    1px 0 0 var(--surface, #f5ebd4),
    -1px 0 0 var(--surface, #f5ebd4),
    0 -1px 0 var(--surface, #f5ebd4);
}
.lobby-map-label--style-banner {
  color: var(--text, #2a241c);
  background: color-mix(in srgb, var(--surface, #faf3e4) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--border, #c9b896) 70%, transparent);
  border-radius: 3px;
  padding: 1px 5px;
}
.lobby-map-label--style-muted {
  color: var(--text-muted, #7a6f5d);
  font-weight: var(--weight-medium, 500);
}
.lobby-map-ico--squad,
.lobby-map-ico--wandering_squad,
.lobby-map-ico--castle {
  width: 36px;
  height: 36px;
}
.lobby-map-ico--squad,
.lobby-map-ico--wandering_squad,
.lobby-map-ico--castle,
.lobby-map-ico--siege {
  overflow: visible;
}
/* Heroes overlay the cell; keep them out of object flex flow so objects stay put. */
.lobby-cell-pips {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 0;
  pointer-events: none;
}
.lobby-cell .lobby-map-ico--squad {
  z-index: 4;
}
.lobby-map-ico-siege {
  position: absolute;
  right: -18%;
  top: -18%;
  width: 58%;
  height: 58%;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 0 1px #fff8e0) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}
.lobby-map-ico .lobby-map-ico-siege svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  overflow: visible;
}
.lobby-map-ico-siege-blade {
  transform-box: view-box;
  transform-origin: 50% 50%;
}
.lobby-map-ico-siege-blade--a {
  transform: rotate(-42deg);
  animation: lobby-siege-fence-a 1.7s ease-in-out infinite;
}
.lobby-map-ico-siege-blade--b {
  transform: rotate(42deg);
  animation: lobby-siege-fence-b 1.7s ease-in-out infinite;
}
@keyframes lobby-siege-fence-a {
  0%, 100% { transform: rotate(-42deg); }
  18% { transform: rotate(-30deg); }
  34% { transform: rotate(-52deg); }
  52% { transform: rotate(-38deg); }
  70% { transform: rotate(-50deg); }
  84% { transform: rotate(-34deg); }
}
@keyframes lobby-siege-fence-b {
  0%, 100% { transform: rotate(42deg); }
  18% { transform: rotate(52deg); }
  34% { transform: rotate(28deg); }
  52% { transform: rotate(46deg); }
  70% { transform: rotate(32deg); }
  84% { transform: rotate(50deg); }
}
/* HoMM/eye hero art faces left; mirror when the squad last moved right. */
.lobby-map-ico--face-right > .lobby-map-ico-hero-stack,
.lobby-map-ico--face-right > svg {
  transform: scaleX(-1);
  transform-origin: center center;
}
.lobby-ico {
  width: 24px;
  height: 24px;
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.lobby-map-ico svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.lobby-cell .lobby-map-ico--artifact-blue {
  overflow: visible;
  transform-origin: 50% 50%;
  animation: lobby-art-blue-pulse 2.8s ease-in-out infinite;
}
@keyframes lobby-art-blue-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 0 transparent);
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 3px rgba(80, 160, 220, 0.85));
    transform: scale(1.08);
  }
}
/* Selected squad: golden glow around the hero miniature. */
.lobby-cell .lobby-map-ico--squad-sel {
  overflow: visible;
  z-index: 5;
}
.lobby-cell .lobby-map-ico--squad-sel > .lobby-map-ico-hero-stack,
.lobby-cell .lobby-map-ico--squad-sel > svg {
  filter:
    drop-shadow(0 0 2px #fff6c8)
    drop-shadow(0 0 7px rgba(255, 196, 40, 0.85));
}
/* Hunt-mode kill target: gold miniature + the same class of glow. */
.lobby-cell .lobby-map-ico--hunt {
  overflow: visible;
  z-index: 5;
}
.lobby-cell .lobby-map-ico--hunt > .lobby-map-ico-hero-stack,
.lobby-cell .lobby-map-ico--hunt > svg {
  filter:
    drop-shadow(0 0 2px #fff6c8)
    drop-shadow(0 0 7px rgba(212, 175, 55, 0.9));
}
.lobby-map-ico-hero-gold {
  position: absolute;
  inset: 0;
  pointer-events: none;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-mode: alpha;
  mask-mode: alpha;
  mix-blend-mode: color;
}
.lobby-pip--sel {
  box-shadow:
    0 0 0 2px #fff8c8,
    0 0 8px 3px rgba(255, 210, 40, 0.95);
  animation: lobby-pip-sel-pulse 1.15s ease-in-out infinite;
}
@keyframes lobby-pip-sel-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px #fff8c8,
      0 0 6px 2px rgba(255, 210, 40, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 3px #fffef0,
      0 0 12px 5px rgba(255, 200, 40, 1);
    transform: scale(1.35);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lobby-cell .lobby-map-ico--artifact-blue,
  body.theme-parchment .lobby-cell .lobby-map-ico--artifact-blue,
  body.theme-dark .lobby-cell .lobby-map-ico--artifact-blue,
  body.theme-wap .lobby-cell .lobby-map-ico--artifact-blue {
    animation: none;
  }
  .lobby-pip--sel {
    animation: none;
  }
  .lobby-map-ico-siege-blade--a,
  .lobby-map-ico-siege-blade--b {
    animation: none;
  }
}
.lobby-cell.fog {
  color: transparent;
  border-color: rgba(12, 14, 24, 0.65);
  background: transparent;
  box-shadow: none;
}
.lobby-cell.fog .lobby-pip,
.lobby-cell.fog .lobby-map-ico--squad { display: none; }
.lobby-cell.owned {
  background: color-mix(in srgb, var(--lobby-owner, var(--chip-bg, #555555)) var(--lobby-cell-owned-mix, 28%), var(--map-cell-bg));
  box-shadow: inset 0 -2px 0 var(--lobby-owner, transparent);
}
.lobby-cell.reach { outline: 1px solid var(--map-focus-border, var(--accent)); }
.lobby-cell.selected { outline: 2px solid var(--map-focus-border, var(--accent)); }
.lobby-map--scout-pick .lobby-cell { cursor: crosshair; }
.lobby-map--strike-pick .lobby-cell { cursor: crosshair; }
.lobby-cell--strike-range { outline: 1px dashed var(--accent, #f1c40f); }
.lobby-cell--strike-target { outline: 2px solid var(--accent, #c9a227); z-index: 1; }
.lobby-mage-ability {
  font-size: 13px;
  line-height: 1.35;
  margin: 6px 0 10px;
  padding: 6px 8px;
  border-radius: var(--radius, 6px);
  background: var(--accent-muted, rgba(241, 196, 15, 0.12));
}
.lobby-mage-ability--locked { opacity: 0.8; }
.lobby-mage-cd { opacity: 0.75; font-size: 12px; }
.lobby-cell.scout-preview {
  outline: 2px solid var(--accent, #f1c40f);
  outline-offset: -1px;
  z-index: 2;
}
.lobby-cell.fog.scout-preview {
  box-shadow: inset 0 0 0 2px var(--accent, #f1c40f);
}
.tavern-scout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.tavern-scout-hint {
  font-size: var(--text-sm);
  color: var(--text-subtle, var(--text-muted));
}
.lobby-cell-terrain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.lobby-cell--blocked { cursor: not-allowed; }
.lobby-cell.fog .lobby-cell-terrain { display: none; }
.lobby-map--eye-art:not(.lobby-map--seamless) .lobby-cell {
  background-color: #0d1b2a;
  background-image: linear-gradient(180deg, rgba(30, 58, 95, 0.32), rgba(13, 27, 42, 0.12));
  border-color: #1e3a5f;
  color: #e0e0f0;
}
.lobby-map--eye-art:not(.lobby-map--seamless) .lobby-cell.owned {
  background-image: none;
  background-color: color-mix(
    in srgb,
    var(--lobby-owner, #555555) var(--lobby-cell-owned-mix, 22%),
    #0d1b2a
  );
}
.lobby-map--eye-art .lobby-cell.fog {
  background: transparent;
  box-shadow: none;
  color: transparent;
}
.lobby-map-legend--terrain {
  margin-top: 4px;
}
.lobby-map-legend-item--terrain .lobby-cell-terrain,
.lobby-legend-empty {
  position: relative;
  inset: auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border, #888);
  flex-shrink: 0;
  box-sizing: border-box;
}
.lobby-legend-empty {
  display: block;
  background-color: transparent;
  background-image: url("/img/fog-of-war.png");
  background-repeat: repeat;
}
.lobby-pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  margin: 0 1px;
}
.lobby-squad-sel { background: var(--accent-muted); border-radius: var(--radius); padding: 2px 4px; }
/* Единая оболочка матча: один блок, разделы отделены сплиттерами */
.lobby-match-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5px minmax(160px, 280px);
  grid-template-rows: minmax(0, 1fr) 5px minmax(120px, 240px);
  grid-template-areas:
    "main vsplit side"
    "hsplit hsplit hsplit"
    "tavern tavern tavern";
  gap: 0;
  align-items: stretch;
  width: min(100%, 1100px);
  height: min(72vh, 820px);
  min-width: 520px;
  min-height: 380px;
  max-width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-sizing: border-box;
}
.lobby-match-layout.is-resizing,
body.lobby-layout-dragging {
  user-select: none;
}
body.lobby-layout-dragging iframe {
  pointer-events: none;
}
.lobby-split {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  z-index: 4;
  touch-action: none;
}
.lobby-split::after {
  content: '';
  position: absolute;
  background: color-mix(in srgb, var(--border, #888) 55%, transparent);
  pointer-events: none;
}
.lobby-split--v {
  cursor: col-resize;
  width: 100%;
  min-height: 100%;
}
.lobby-split--v::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
}
.lobby-split--h {
  cursor: row-resize;
  height: 100%;
  width: 100%;
}
.lobby-split--h::after {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
}
.lobby-split[data-split="side"] { grid-area: vsplit; }
.lobby-split[data-split="tavern"] { grid-area: hsplit; }
.lobby-split:hover::after,
.lobby-match-layout.is-resizing .lobby-split:active::after {
  background: color-mix(in srgb, var(--border, #888) 80%, transparent);
}
.lobby-match-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  z-index: 6;
  cursor: nwse-resize;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 0 46%, var(--border-strong, var(--border)) 46% 54%, transparent 54% 62%, var(--border-strong, var(--border)) 62% 70%, transparent 70%);
}
.lobby-match-resize:hover {
  background:
    linear-gradient(135deg, transparent 0 46%, var(--accent, #c9a227) 46% 54%, transparent 54% 62%, var(--accent, #c9a227) 62% 70%, transparent 70%);
}
.lobby-match-main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  align-self: stretch;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  margin-top: 0;
  overflow: auto;
}
.lobby-match-main .lobby-started {
  flex: 1 1 auto;
  min-height: 100%;
  box-sizing: border-box;
  margin: 0;
  width: 100%;
  max-width: none;
  background: transparent;
  border: none;
  border-radius: 0;
}
.lobby-match-side {
  grid-area: side;
  position: relative;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
}
.lobby-match-log {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
  margin-top: 0;
  background: var(--log-bg, transparent);
  border: none;
  border-radius: 0;
  padding: 10px 12px;
}
.lobby-log-title {
  display: block;
  flex: 0 0 auto;
  font-family: var(--font-hud);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em !important;
  margin-bottom: 8px;
  color: var(--text-heading, var(--text));
}
.lobby-log-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  letter-spacing: normal;
  word-spacing: normal;
}
.lobby-match-layout .tavern-box.lobby-tavern,
.lobby-tavern {
  grid-area: tavern;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tavern-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5px minmax(160px, 280px);
  gap: 0;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  height: 100%;
}
.tavern-section {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  box-sizing: border-box;
  overflow: auto;
}
.tavern-section-quiz {
  padding-left: 12px;
}
.lobby-tavern .tavern-panel-label {
  font-size: var(--text-sm);
  color: var(--text-subtle, var(--text-muted));
  margin-bottom: 6px;
}
.lobby-tavern .tavern-chat-log {
  max-height: none;
  min-height: 80px;
  flex: 1;
}
.lobby-tavern .tavern-chat-to {
  max-width: 160px;
  flex: 0 1 140px;
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--input-border, var(--border));
  color: var(--text);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  padding: 3px 6px;
}
.lobby-tavern .tavern-chat-msg--priv {
  padding: 2px 4px;
  margin-left: -4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent, #f1c40f) 8%, transparent);
}
.lobby-tavern .qty-input {
  flex: 1;
  width: auto;
  min-width: 0;
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--input-border, var(--border));
  color: var(--text);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: 1.3;
  padding: 3px 6px;
}
.lobby-log-container .log-entry {
  padding: 4px 0;
  border-bottom: 1px solid var(--log-entry-border);
  color: var(--text);
  letter-spacing: normal !important;
  word-spacing: normal !important;
  overflow-wrap: break-word;
  word-break: normal;
}
.lobby-log-container .log-turn {
  color: var(--text-muted);
  margin-right: 4px;
  font-family: var(--font-ui) !important;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: normal !important;
  white-space: nowrap;
}
.lobby-log-container .victory { color: var(--success); font-weight: 600; }
.lobby-log-container .loss { color: var(--danger); font-weight: 600; }
.lobby-modal-back {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lobby-modal-back[hidden] { display: none; }
.lobby-modal {
  background: var(--modal-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-modal, var(--radius));
  padding: 14px 16px;
  min-width: min(520px, 96vw);
  max-width: 640px;
  max-height: 86vh;
  overflow: auto;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
}
.lobby-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}
.lobby-modal-head-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
.lobby-modal-head strong {
  font-family: var(--font-hud);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em !important;
  color: var(--text-heading, var(--text));
  line-height: var(--leading-tight);
}
.lobby-modal-head > button {
  font-family: inherit;
  font-size: var(--text-2xl);
  font-weight: var(--weight-medium);
  line-height: 1;
  background: transparent;
  border: 0;
  color: var(--close);
  cursor: pointer;
}
#lobbyNeighborsOpen {
  text-decoration: none;
}
.lobby-modal-wide { max-width: min(960px, 96vw); min-width: min(640px, 96vw); }
.lobby-retreat-body p { margin: 0 0 10px; }
.lobby-retreat-body button { margin-top: 4px; }
.lobby-fight-preview { z-index: 95; }
.lobby-build-workers-preview { z-index: 97; }
.lobby-build-workers-preview .lobby-modal { min-width: min(360px, 96vw); max-width: 420px; }
.lobby-fight-verdict {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}
.lobby-fight-band {
  display: inline;
  padding: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: var(--font-ui);
  font-size: inherit;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-normal);
}
.lobby-fight-band--crush,
.lobby-fight-band--likely,
.lobby-fight-band--even,
.lobby-fight-band--risky,
.lobby-fight-band--suicide,
.lobby-fight-band--unknown {
  background: none;
  color: inherit;
}
.lobby-fight-row {
  margin: 6px 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
}
.lobby-fight-note,
.lobby-fight-risk {
  margin: 8px 0 0;
  color: var(--text-muted, #8b90a0);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.lobby-fight-risk {
  margin: 6px 0 0;
}
.lobby-fight-preview .lobby-card-actions { margin-top: 14px; }
.lobby-fight-preview .lobby-card-actions button {
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: var(--weight-medium);
  padding: 4px 8px;
}
.lobby-match-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
#lobbyTurnRemain,
#lobbyMapTurnRemain,
.type-timer {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: var(--weight-semibold);
  letter-spacing: normal !important;
  white-space: nowrap;
}
.lobby-admin-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent, #4a7cff);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}
.lobby-admin-link:hover { color: var(--text-heading, var(--text)); }
.lobby-neighbors-preview { z-index: 96; }
.lobby-neighbor-row {
  margin: 10px 0;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.lobby-neighbor-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lobby-neighbor-meta { color: var(--text-muted, var(--text)); font-size: var(--text-sm, 13px); }
.lobby-modal .fight-calc {
  margin: 0;
  max-width: none;
  border: 0;
  background: transparent;
}
.lobby-admin-blocks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lobby-admin-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.lobby-admin-block__title {
  margin: 0;
  padding: 6px 10px;
  font-size: inherit;
  font-weight: var(--weight-semibold);
  background: var(--surface-raised, var(--surface));
  border-bottom: 1px solid var(--border);
}
.lobby-admin-block__body {
  padding: 8px 10px;
}
.lobby-admin-block__hint {
  margin: 0 0 8px;
  color: var(--text-muted, var(--text));
}
.lobby-admin-map-templates {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  max-height: 220px;
  overflow: auto;
}
.lobby-admin-template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised, var(--surface));
}
.lobby-admin-template-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lobby-admin-template-meta span {
  color: var(--text-muted, var(--text));
  font-size: 0.92em;
}
.lobby-admin-template-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.lobby-admin-map-template-actions {
  display: flex;
  gap: 8px;
}
.lobby-map-editor-overlay {
  z-index: 80;
}
.lobby-map-editor-sticky {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.lobby-map-editor-title {
  margin-right: auto;
}
.lobby-map-editor-meta {
  color: var(--text-muted, var(--text));
  font-size: 0.92em;
}
.lobby-map-editor-brushes {
  margin: 0 0 10px;
}
.lobby-map-editor-brushes-title {
  font-weight: var(--weight-semibold);
  margin: 0 0 6px;
  padding: 0 2px;
}
.lobby-map-editor-brushes .lobby-map-legend,
.lobby-map-editor-brushes .lobby-map-legend-row {
  margin: 0;
}
.lobby-map-editor-brush {
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
}
.lobby-map-editor-brush.is-active {
  outline: 2px solid var(--accent, #c9a227);
  outline-offset: 1px;
  border-radius: 4px;
}
.lobby-map-editor-erase-ico {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.lobby-map-editor-pan-ico {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.lobby-map-editor-pan-ico svg {
  display: block;
}
.lobby-map-editor-sector-ico {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.lobby-map-editor-sector-ico svg {
  display: block;
}
.lobby-map-editor-cursor-sector {
  width: 28px;
  height: 28px;
}
.lobby-map-editor-cursor {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
}
.lobby-map-editor-cursor .lobby-map-ico,
.lobby-map-editor-cursor .lobby-map-legend-swatch {
  width: 28px;
  height: 28px;
}
.lobby-map-editor-cursor-erase {
  font-size: 22px;
  line-height: 1;
}
.lobby-map-editor-wrap .lobby-map {
  cursor: crosshair;
}
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan .lobby-map-viewport,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan .lobby-map-stage,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan .lobby-map,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan .lobby-cell {
  cursor: grab;
}
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan.lobby-map-wrap--dragging,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan.lobby-map-wrap--dragging .lobby-map-viewport,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan.lobby-map-wrap--dragging .lobby-map-stage,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan.lobby-map-wrap--dragging .lobby-map,
.lobby-map-editor-wrap.lobby-map-editor-wrap--pan.lobby-map-wrap--dragging .lobby-cell {
  cursor: grabbing;
}
.lobby-map-editor-spawn {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.lobby-map-editor-spawn-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--spawn, #888);
  border: 2px solid #1a1510;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
}
.lobby-cell-art .lobby-map-editor-spawn {
  width: 18px;
  height: 18px;
}
.lobby-cell-art .lobby-map-editor-spawn-dot {
  width: 12px;
  height: 12px;
}
.lobby-map-editor-dialog {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  padding: 16px;
}
.lobby-map-editor-dialog[hidden] {
  display: none !important;
}
.lobby-map-editor-dialog-card {
  width: min(420px, 100%);
  max-height: 90%;
  overflow: auto;
  background: var(--surface, #1e1a16);
  color: var(--text, #eee);
  border: 1px solid var(--border, #444);
  border-radius: var(--radius, 8px);
  padding: 10px 12px;
}
.lobby-map-editor-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.lobby-map-editor-dialog-body label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}
.lobby-map-editor-dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-bottom: 8px;
}
.lobby-map-editor-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.lobby-map-editor-overlay .lobby-map-legends {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface, rgba(20, 18, 14, 0.92));
  padding: 6px 0 8px;
}
.lobby-b-off { opacity: 0.5; font-size: var(--text-base); }
.lobby-match-tabs {
  display: none;
}
.lobby-map-dpad {
  display: none;
}
@media (max-width: 900px) {
  .lobby-root {
    padding: 10px 8px 16px;
    padding-top: max(40px, calc(env(safe-area-inset-top, 0px) + 32px));
    font-size: 14px;
    overflow-x: hidden;
  }
  .lobby-panel,
  .lobby-panel-wide {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .lobby-root button:not(.lobby-cell):not(.lobby-map-dpad-btn):not(.lobby-map-draw-btn):not(.lobby-map-draw-who):not(.lobby-map-draw-swatch):not(.lobby-map-draw-stroke):not(.lobby-match-tab) {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 13px !important;
    font-family: var(--font-ui) !important;
    letter-spacing: normal !important;
  }
  .lobby-root button.primary {
    min-height: 34px;
    padding: 5px 12px;
    font-size: 13px !important;
  }
  .lobby-root input,
  .lobby-root select,
  .lobby-root textarea {
    min-height: 32px;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 13px;
  }
  .lobby-root select {
    text-overflow: ellipsis;
  }
  .lobby-panel-wide { width: 100%; max-width: 100%; }
  .lobby-match-tabs {
    grid-area: tabs;
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    padding: 6px 56px 0 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--bg);
  }
  .lobby-match-tabs::-webkit-scrollbar { display: none; }
  .lobby-match-tab {
    flex: 1 0 auto;
    min-width: max-content;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid var(--border-strong, var(--border));
    border-radius: var(--radius, 6px);
    background: var(--surface, var(--bg));
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
  }
  .lobby-match-tab.is-active {
    background: var(--accent-muted, color-mix(in srgb, var(--accent, #c9a227) 22%, transparent));
    border-color: var(--accent, #c9a227);
    color: var(--text-heading, var(--text));
  }
  .lobby-match-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .lobby-match-top .lobby-map-turn {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .lobby-map-turn-who,
  .lobby-map-turn-time {
    flex-wrap: wrap;
    min-width: 0;
    width: auto;
    max-width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .lobby-map-turn-label,
  .lobby-map-turn-name,
  .lobby-map-turn-mine-mark {
    white-space: nowrap;
  }
  .lobby-started.lobby-match {
    width: 100%;
    max-width: 100%;
  }
  .lobby-card-actions {
    width: 100%;
  }
  .lobby-eco-row--stocks {
    gap: 8px 12px;
  }
  .lobby-eco-res {
    font-variant-numeric: tabular-nums lining-nums;
    letter-spacing: normal !important;
  }
  .lobby-leaders-overlay .lobby-leaders-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .lobby-leaders-row {
    grid-template-columns: 1.5em 14px minmax(0, 1fr);
    gap: 4px 8px;
  }
  .lobby-leaders-value {
    grid-column: 3;
    justify-self: start;
    text-align: left;
    white-space: normal;
  }
  .lobby-leaders-value .lobby-leaders-sub {
    display: inline;
    margin-left: 6px;
  }
  .lobby-castle-card .lobby-eco-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .lobby-castle-card button[data-build],
  .lobby-castle-card button[data-open-b] {
    min-height: 32px;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    touch-action: manipulation;
  }
  .lobby-match-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "tabs"
      "main";
    width: 100%;
    height: calc(100dvh - 64px);
    max-height: none;
    min-width: 0;
    min-height: 280px;
  }
  .lobby-match-layout[data-mobile-tab="log"] {
    grid-template-areas:
      "tabs"
      "side";
  }
  .lobby-match-layout[data-mobile-tab="chat"],
  .lobby-match-layout[data-mobile-tab="quiz"] {
    grid-template-areas:
      "tabs"
      "tavern";
  }
  .lobby-match-layout[data-mobile-tab="play"] .lobby-match-side,
  .lobby-match-layout[data-mobile-tab="play"] .lobby-tavern,
  .lobby-match-layout[data-mobile-tab="log"] .lobby-match-main,
  .lobby-match-layout[data-mobile-tab="log"] .lobby-tavern,
  .lobby-match-layout[data-mobile-tab="chat"] .lobby-match-main,
  .lobby-match-layout[data-mobile-tab="chat"] .lobby-match-side,
  .lobby-match-layout[data-mobile-tab="quiz"] .lobby-match-main,
  .lobby-match-layout[data-mobile-tab="quiz"] .lobby-match-side {
    display: none;
  }
  .lobby-match-layout[data-mobile-tab="chat"] .tavern-section-quiz,
  .lobby-match-layout[data-mobile-tab="quiz"] .tavern-section-chat,
  .lobby-match-layout[data-mobile-tab="chat"] .lobby-split[data-split="quiz"],
  .lobby-match-layout[data-mobile-tab="quiz"] .lobby-split[data-split="quiz"] {
    display: none;
  }
  .lobby-match-layout[data-mobile-tab="chat"] .tavern-sections,
  .lobby-match-layout[data-mobile-tab="quiz"] .tavern-sections {
    grid-template-columns: minmax(0, 1fr);
  }
  .lobby-split,
  .lobby-match-resize {
    display: none;
  }
  .lobby-match-side {
    position: static;
    min-height: 0;
    overflow: auto;
    border-top: none;
  }
  .lobby-match-log {
    position: static;
    min-height: 100%;
  }
  .lobby-match-layout .tavern-box.lobby-tavern,
  .lobby-tavern {
    min-height: 0;
    overflow: auto;
  }
  .tavern-sections {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }
  .tavern-section-quiz {
    border-top: 1px solid color-mix(in srgb, var(--tavern-divider, var(--border, #888)) 55%, transparent);
  }
  .lobby-log-container { max-height: none; flex: 1 1 auto; }
  .lobby-tavern .tavern-chat-log { max-height: none; flex: 1 1 auto; }
  .lobby-tavern .tavern-chat-input-row {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .lobby-tavern .tavern-chat-input-row input,
  .lobby-tavern .tavern-chat-input-row select {
    min-width: 0;
    flex: 1 1 auto;
  }
  .lobby-match-tabs {
    padding-right: 56px;
  }
  .lobby-map-overlay {
    padding: 4px 6px 6px;
    padding-top: max(4px, env(safe-area-inset-top, 0px));
    padding-right: max(6px, env(safe-area-inset-right, 0px));
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
    padding-left: max(6px, env(safe-area-inset-left, 0px));
  }
  /* Map-first: thin chrome, map fills the rest of the screen */
  .lobby-map-overlay {
    font-size: 13px;
  }
  .lobby-map-overlay:not(.lobby-map-editor-overlay) .lobby-map-overlay-sticky {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    padding: 0 4px 4px 0;
    margin-bottom: 2px;
  }
  .lobby-map-sticky-bar {
    gap: 6px 10px;
    padding-right: 44px; /* room for theme switcher */
  }
  .lobby-map-overlay-head {
    padding-right: 4px;
    gap: 6px;
    margin-bottom: 4px;
  }
  .lobby-map-overlay:not(.lobby-map-editor-overlay) .lobby-map-overlay-sticky .lobby-map-turn {
    flex: 0 1 auto;
    width: 100%;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    font-size: 13px !important;
  }
  .lobby-map-overlay .lobby-map-turn-label {
    display: none;
  }
  .lobby-map-overlay .lobby-map-turn-who,
  .lobby-map-overlay .lobby-map-turn-time {
    gap: 4px;
    flex-wrap: wrap;
    width: auto;
  }
  .lobby-map-overlay .lobby-map-turn-mine-mark {
    margin-left: 0;
  }
  .lobby-map-overlay:not(.lobby-map-editor-overlay) .lobby-map-overlay-scroll {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    height: 0;
  }
  .lobby-map-overlay:not(.lobby-map-editor-overlay) .lobby-map-legends {
    flex: 0 0 auto;
    margin-bottom: 2px;
    max-width: 100%;
  }
  .lobby-map-overlay:not(.lobby-map-editor-overlay) .lobby-map-wrap {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    margin-top: 0;
  }
  .lobby-map-overlay .lobby-map-legends-fold {
    margin: 0;
  }
  .lobby-map-overlay .lobby-map-legends-fold > summary {
    padding: 2px 0;
    font-size: 12px !important;
  }
  .lobby-map-overlay .lobby-map-legends-fold[open] {
    max-height: 22vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .lobby-map-overlay .lobby-map-legend--squads {
    gap: 4px 8px;
    margin-top: 2px;
    width: 100%;
  }
  .lobby-map-overlay .lobby-map-squad-link {
    font-size: 12px !important;
    gap: 4px;
    max-width: 100%;
  }
  .lobby-map-overlay .lobby-map-squad-link-name {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .lobby-map-overlay .lobby-cell .lobby-map-ico {
    width: calc(var(--lobby-cell, 52px) * 0.82);
    height: calc(var(--lobby-cell, 52px) * 0.82);
    max-width: 92%;
    max-height: 92%;
  }
  .lobby-map-overlay .lobby-cell-art--multi {
    transform: scale(0.9);
    transform-origin: center center;
  }
  .lobby-map-editor-overlay .lobby-map-overlay-sticky {
    padding: 2px 0 4px;
    flex-wrap: wrap;
  }
  .lobby-map-turn {
    margin-left: 0;
  }
  .lobby-map-dpad {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(3, 36px);
    gap: 3px;
    position: absolute;
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    z-index: 14;
    pointer-events: none;
  }
  .lobby-map-dpad-btn {
    pointer-events: auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-strong, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface-raised, #222) 72%, transparent);
    color: var(--text);
    font-size: 14px !important;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }
  .lobby-map-dpad-btn:active {
    background: var(--accent-muted, color-mix(in srgb, var(--accent, #c9a227) 28%, transparent));
  }
  .lobby-map-dpad-btn[data-dpad="n"] { grid-column: 2; grid-row: 1; }
  .lobby-map-dpad-btn[data-dpad="w"] { grid-column: 1; grid-row: 2; }
  .lobby-map-dpad-btn[data-dpad="e"] { grid-column: 3; grid-row: 2; }
  .lobby-map-dpad-btn[data-dpad="s"] { grid-column: 2; grid-row: 3; }
  .lobby-map-draw-rail {
    top: auto !important;
    bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
    left: max(6px, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    align-content: flex-start;
    width: auto;
    max-width: calc(100vw - 130px);
    max-height: none;
    height: auto;
    padding: 4px 6px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
    z-index: 15;
    background: color-mix(in srgb, var(--surface-raised, #f3ead7) 92%, transparent);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md, 0 1px 4px rgba(0, 0, 0, 0.18));
  }
  .lobby-map-draw-rail .lobby-map-draw-group {
    flex-direction: row;
    flex-wrap: nowrap;
    width: auto;
    padding-bottom: 0;
    padding-right: 4px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }
  .lobby-map-draw-rail .lobby-map-draw-group:last-of-type {
    border-right: 0;
    padding-right: 0;
  }
  .lobby-map-draw-rail .lobby-map-draw-hint {
    display: none;
  }
  .lobby-map-draw-rail .lobby-map-draw-btn,
  .lobby-map-draw-rail .lobby-map-draw-who,
  .lobby-map-draw-rail .lobby-map-draw-swatch,
  .lobby-map-draw-rail .lobby-map-draw-stroke {
    width: 36px;
    height: 36px;
  }
  #lobbyMapTip {
    max-width: min(320px, calc(100vw - 20px));
    pointer-events: none;
  }
  .lobby-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .lobby-card-actions button {
    min-height: 32px;
    touch-action: manipulation;
  }
  .lobby-create label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    margin: 6px 0;
  }
  .lobby-create input,
  .lobby-create select {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    min-height: 32px;
    padding: 4px 8px;
    box-sizing: border-box;
  }
  .lobby-create .lobby-slot {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    align-items: center;
  }
  .lobby-create .lobby-slot select {
    width: auto;
    flex: 1 1 40%;
    min-width: 0;
    max-width: 100%;
  }
  .lobby-map-grid-toggle {
    gap: 4px;
  }
  .lobby-map-grid-switch {
    width: 28px;
    height: 16px;
  }
  .lobby-map-grid-switch::after {
    width: 10px;
    height: 10px;
    top: 2px;
    left: 2px;
  }
  .lobby-map-grid-toggle input:checked + .lobby-map-grid-switch::after {
    transform: translateX(12px);
  }
  .lobby-map-squad-link {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (min-width: 901px) {
  .lobby-map-overlay-head {
    padding-right: 280px;
  }
  .lobby-map-overlay-sticky {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 4px 280px 6px 0;
  }
  .lobby-map-sticky-bar {
    width: auto;
    flex: 0 0 auto;
  }
  .lobby-map-overlay-sticky .lobby-map-turn {
    flex: 1 1 auto;
    width: auto;
  }
}

.fight-calc {
  max-width: 820px;
  margin: 0 auto 24px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-base);
}
.fight-calc > summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 10px;
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  user-select: none;
}
.fight-calc > summary::-webkit-details-marker { display: none; }
.fight-calc > summary::before {
  content: '+ ';
  color: var(--text-muted);
}
.fight-calc[open] > summary::before { content: '− '; }
.fight-calc-body {
  padding: 0 8px 8px;
  border-top: 1px solid var(--border);
}
.fight-calc-inputs {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}
.fight-calc-inputs th,
.fight-calc-inputs td {
  padding: 2px 3px;
  text-align: center;
  font-weight: var(--weight-normal);
  white-space: nowrap;
}
.fight-calc-inputs thead th {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.fight-calc-inputs tbody th {
  text-align: left;
  padding-right: 6px;
}
.fight-calc-opts {
  width: auto;
}
.fight-calc-opts th,
.fight-calc-opts td {
  font-family: inherit;
  font-size: inherit;
  font-weight: var(--weight-normal);
}
.fight-calc-opts input[type="checkbox"] {
  width: auto;
  margin: 0;
  vertical-align: middle;
}
.fight-calc-opts button {
  margin: 0;
  padding: 2px 8px;
  font-family: inherit;
  font-size: inherit;
  font-weight: var(--weight-normal);
  line-height: 1.2;
  width: auto;
  min-height: 0;
  box-shadow: none;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: var(--radius);
}
.fight-calc-inputs input[type="number"] {
  width: 52px;
  box-sizing: border-box;
  padding: 2px 4px;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
}
.fight-calc-arts {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.fight-calc-arts th,
.fight-calc-arts td {
  padding: 2px 3px;
  text-align: center;
  font-weight: var(--weight-normal);
  white-space: nowrap;
}
.fight-calc-arts thead th {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.fight-calc-arts tbody th {
  text-align: left;
  padding-right: 6px;
}
.fight-calc-arts select {
  max-width: 108px;
  box-sizing: border-box;
  padding: 2px 2px;
  font-size: var(--text-sm);
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
}
.fight-calc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.fight-calc-bar label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.fight-calc-bar .primary {
  margin: 0;
  padding: 4px 10px;
  font-size: var(--text-base);
  width: auto;
}
.fight-calc-out {
  margin-top: 6px;
  font-size: var(--text-base);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
  overflow-x: auto;
}
.fight-calc-verdict { margin: 0 0 4px; }
.fight-calc-table {
  width: 100%;
  border-collapse: collapse;
}
.fight-calc-table th,
.fight-calc-table td {
  border: 1px solid var(--border);
  padding: 3px 5px;
  text-align: left;
  vertical-align: top;
}
.fight-calc-table th { background: var(--surface-raised, var(--surface)); }

.lobby-leaders-overlay .lobby-leaders-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-content: start;
}
.lobby-leaders-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
}
.lobby-leaders-col h3 {
  margin: 0 0 2px;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-heading, var(--text));
}
.lobby-leaders-hint {
  margin-bottom: 8px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.lobby-leaders-list {
  margin: 0;
  padding: 0;
}
.lobby-leaders-row {
  display: grid;
  grid-template-columns: 1.5em 14px minmax(3.25rem, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text);
}
.lobby-leaders-rank {
  color: var(--text-faint, var(--text-muted));
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.lobby-leaders-row--self {
  background: var(--strip-bg, rgba(255, 255, 255, 0.04));
  font-weight: 600;
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 6px;
  border-radius: 4px;
}
.lobby-leaders-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.lobby-leaders-name em {
  font-style: normal;
  opacity: 0.75;
  font-weight: 400;
}
.lobby-leaders-value {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}
.lobby-leaders-value .lobby-leaders-sub {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  opacity: 0.8;
}
.lobby-energy-bolt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9b59b6;
  vertical-align: -2px;
  line-height: 0;
}
.lobby-energy-bolt svg {
  width: 14px;
  height: 14px;
  fill: #9b59b6;
  color: #9b59b6;
}
body.theme-dark .lobby-energy-bolt {
  color: #9b59b6;
  background: #2a2a2e;
  border-radius: 2px;
  padding: 1px;
}

.lobby-map-draw-rail {
  position: absolute;
  top: 58px;
  right: 6px;
  bottom: 12px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 44px;
  padding: 6px 4px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  color: var(--text);
}
.lobby-map-draw-rail::-webkit-scrollbar { display: none; }
.lobby-map-draw-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.lobby-map-draw-group:last-of-type,
.lobby-map-draw-hint {
  border-bottom: 0;
  padding-bottom: 0;
}
.lobby-map-draw-btn,
.lobby-map-draw-who,
.lobby-map-draw-swatch,
.lobby-map-draw-stroke {
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  box-shadow: none;
  text-decoration: none !important;
  cursor: pointer;
}
.lobby-map-draw-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.lobby-map-draw-btn:hover,
.lobby-map-draw-who:hover,
.lobby-map-draw-swatch:hover,
.lobby-map-draw-stroke:hover {
  background: var(--btn-ghost-hover-bg);
  color: var(--btn-ghost-hover-text, var(--text));
}
.lobby-map-draw-btn.is-on,
.lobby-map-draw-who.is-on,
.lobby-map-draw-stroke.is-on {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted, transparent);
}
.lobby-map-draw-who--dot span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--who, #888);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.lobby-map-draw-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--swatch, #888);
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.lobby-map-draw-swatch.is-on {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.lobby-map-draw-colors {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  padding-left: 1px;
  padding-right: 1px;
}
.lobby-map-draw-strokes {
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.lobby-map-draw-stroke {
  width: 34px;
  height: 22px;
}
.lobby-map-draw-stroke span {
  display: block;
  width: 18px;
  border-radius: 999px;
  background: currentColor;
  min-height: 1.5px;
}
.lobby-map-draw-hint {
  margin-top: auto;
  padding-top: 6px;
  font-size: 11px !important;
  line-height: 1.2 !important;
  text-align: center;
  color: var(--text-muted);
  white-space: pre-line;
  max-width: 100%;
  overflow: hidden;
  word-break: break-word;
}
.lobby-map-draw-svg {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  overflow: visible;
  pointer-events: none;
}
.lobby-map-draw-item {
  pointer-events: auto;
  cursor: pointer;
}
.lobby-map-draw-hit {
  stroke: rgba(0, 0, 0, 0);
  stroke-width: 18;
  pointer-events: stroke;
}
.lobby-map-draw-hit-dot {
  fill: rgba(0, 0, 0, 0);
  pointer-events: all;
}
.lobby-map-draw-handle {
  fill: var(--surface-raised, #fff);
  stroke: var(--accent, #c0392b);
  stroke-width: 1.5;
  pointer-events: auto;
  cursor: nwse-resize;
}
.lobby-map-draw-texts {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: visible;
}
.lobby-map-draw-note-wrap {
  position: absolute;
  transform: translate(-4px, -4px);
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 132px;
  max-width: 220px;
  pointer-events: auto;
  z-index: 9;
}
.lobby-map-draw-note-grip {
  width: 14px;
  min-height: 100%;
  margin: 0;
  padding: 0 !important;
  border: 1px solid var(--note, var(--accent));
  border-right: 0;
  border-radius: 4px 0 0 4px;
  background: var(--note, var(--accent));
  cursor: grab;
  box-shadow: none;
  text-decoration: none !important;
}
.lobby-map-draw-note-grip:hover {
  filter: brightness(1.08);
}
.lobby-map-draw-note {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 4px 6px;
  resize: both;
  border: 1px solid var(--note, var(--accent));
  border-radius: 0 4px 4px 0;
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-ui) !important;
  font-size: var(--text-ui) !important;
  line-height: 1.25 !important;
  font-weight: 400 !important;
}
.lobby-map-draw-note-wrap.is-priv .lobby-map-draw-note {
  border-style: dashed;
}
.lobby-map-draw-note-wrap.is-sel .lobby-map-draw-note {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.lobby-map-overlay--draw .lobby-map-wrap,
.lobby-map-overlay--draw .lobby-map,
.lobby-map-overlay--draw .lobby-cell,
.lobby-map-overlay--erase .lobby-map-wrap,
.lobby-map-overlay--erase .lobby-map,
.lobby-map-overlay--erase .lobby-cell {
  cursor: crosshair;
}
/* Let the draw SVG capture all map touches (cells otherwise steal pointerdown). */
.lobby-map-overlay--draw .lobby-map,
.lobby-map-overlay--draw .lobby-cell,
.lobby-map-overlay--erase .lobby-map,
.lobby-map-overlay--erase .lobby-cell {
  pointer-events: none;
}
.lobby-map-overlay--draw .lobby-map-draw-svg,
.lobby-map-overlay--erase .lobby-map-draw-svg {
  pointer-events: auto;
  touch-action: none;
}
.lobby-map-draw-pad {
  fill: rgba(0, 0, 0, 0);
  pointer-events: all;
}
