:root {
  --bg: #121317;
  --panel: #1b1d23;
  --panel-2: #23262e;
  --line: #343844;
  --text: #e8e4d9;
  --muted: #9a978f;
  --gold: #c9a45c;
  --gold-2: #e0c07e;
  --danger: #d0574a;
  --ok: #4caf7a;
  --warn: #e0a23c;
  --discord: #5865f2;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --serif: Georgia, 'Palatino Linotype', 'Book Antiqua', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
}
#app {
  height: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
a {
  color: var(--gold-2);
}
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: normal;
  letter-spacing: 0.02em;
  margin: 0 0 0.5em;
}
.muted {
  color: var(--muted);
}
.help {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
}
.warn {
  color: var(--warn);
  font-size: 13px;
}
[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover:not(:disabled) {
  border-color: var(--gold);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #1b1607;
  font-weight: 600;
}
.btn.primary:hover:not(:disabled) {
  background: var(--gold-2);
}
.btn.danger {
  border-color: rgba(208, 87, 74, 0.6);
  color: #f0a39a;
}
.btn.danger:hover:not(:disabled) {
  background: rgba(208, 87, 74, 0.18);
  border-color: var(--danger);
}
.btn.active {
  background: rgba(201, 164, 92, 0.18);
  border-color: var(--gold);
}
.btn.small {
  padding: 4px 9px;
  font-size: 12.5px;
}
.btn.discord {
  background: var(--discord);
  border-color: var(--discord);
  color: #fff;
  font-weight: 600;
  padding: 10px 20px;
  font-size: 15px;
}
.btn.discord:hover {
  filter: brightness(1.1);
}
.icon-btn {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  flex: none;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--panel-2);
}

/* ---------------------------------------------------------------- screens */
.splash {
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 32px;
  color: var(--gold);
}
.screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at top, rgba(201, 164, 92, 0.12), transparent 60%),
    var(--bg);
}
.card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
.card h1 {
  font-size: 26px;
}
.card p {
  margin: 0 0 18px;
}
.card-icon {
  font-size: 34px;
  color: var(--gold);
  margin-bottom: 10px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
  flex: none;
}
.avatar.large {
  width: 72px;
  height: 72px;
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------- shell */
.shell {
  position: relative;
  height: 100%;
  overflow: hidden;
  overflow: clip; /* hidden still lets focus() scroll the off-screen drawer into view */
}
.map {
  position: absolute;
  inset: 0;
  background: #0d0e11;
}
.map.placing,
.map.placing .leaflet-interactive,
.map.fog-editing {
  cursor: crosshair !important;
}
.map.loading::after {
  content: '';
  position: absolute;
  top: 64px;
  left: 50%;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  border: 3px solid rgba(201, 164, 92, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 500;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.leaflet-container {
  background: #0d0e11;
  font: inherit;
}
.base-map {
  image-rendering: auto;
}
.empty-state {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  padding: 16px;
}
.empty-state .fa-3x {
  color: var(--gold);
  margin-bottom: 12px;
}

.topbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.topbar > * {
  pointer-events: auto;
}
.brand,
.tools,
.user-chip {
  background: rgba(27, 29, 35, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--gold-2);
  min-width: 0;
}
.brand-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tools {
  display: flex;
  gap: 2px;
  padding: 4px;
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: none;
  padding: 7px 11px;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
}
.tool:hover {
  background: var(--panel-2);
}
.tool.active {
  background: rgba(201, 164, 92, 0.2);
  color: var(--gold-2);
}
.tool.accent {
  color: var(--gold-2);
}
.hidden-badge {
  display: none;
}
.hidden-badge.show {
  display: inline-block;
}
.badge {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  font-weight: 700;
}
.user-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 6px;
}
.user-chip-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-banner {
  position: absolute;
  left: 50%;
  top: 66px;
  transform: translate(-50%, -12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100% - 32px);
  padding: 8px 10px 8px 14px;
  background: rgba(27, 29, 35, 0.95);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.mode-banner.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.mode-banner > .fa-solid {
  color: var(--gold);
}

.render-chip {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 80px);
  padding: 7px 12px;
  font-size: 13px;
  background: rgba(27, 29, 35, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.render-chip.visible {
  display: flex;
}
.render-chip .fa-solid {
  color: var(--gold);
}

/* ---------------------------------------------------------------- drawer */
.drawer {
  position: absolute;
  top: 66px;
  right: 10px;
  bottom: 10px;
  width: 380px;
  max-width: calc(100% - 20px);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  background: rgba(27, 29, 35, 0.97);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 20px));
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
  visibility: hidden;
  overflow: hidden;
}
.drawer.open {
  transform: none;
  visibility: visible;
  transition: transform 0.2s ease;
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px 16px;
}
.drawer-header h2 {
  margin: 0;
  font-size: 20px;
}
.drawer .leaflet-control-zoom {
  display: none;
}
.shell.drawer-open .leaflet-bottom.leaflet-right {
  right: 400px;
}

.pin-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 16px 10px;
}
.pin-filters input[type='search'] {
  flex: 1;
}
.pin-list {
  overflow-y: auto;
  padding: 0 8px 12px;
}
.pin-list > .muted {
  padding: 0 8px;
}
.pin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.pin-item:hover {
  background: var(--panel-2);
}
.pin-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.pin-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pin-item .muted {
  font-size: 12px;
}

/* ---------------------------------------------------------------- admin */
.admin-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.tab.active {
  color: var(--gold-2);
  border-bottom-color: var(--gold);
}
.tab-body {
  overflow-y: auto;
  padding: 14px 16px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.region-list {
  flex: 1;
}
.region-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 6px;
}
.region-row:hover {
  background: var(--panel-2);
}
.region-row.province {
  padding-left: 40px;
}
.region-row .region-name {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}
.region-row button.region-name {
  cursor: pointer;
}
.region-row button.region-name:hover {
  text-decoration: underline;
  text-decoration-color: rgba(255, 59, 48, 0.7);
}
.region-row:hover {
  box-shadow: inset 3px 0 0 #ff3b30;
}
.region-row.state .region-name {
  font-weight: 600;
}
.region-row small {
  color: var(--muted);
  font-weight: normal;
}
.region-row.hidden .region-name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.25);
}
.region-row.hidden .vis,
.region-row.partial .vis {
  color: var(--warn);
}
.expand-spacer {
  width: 30px;
  flex: none;
}
.swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.swatch-dot.neutral {
  background: repeating-linear-gradient(45deg, #666 0 3px, #333 3px 6px);
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 14px;
  margin-top: 8px;
  background: linear-gradient(transparent, rgba(27, 29, 35, 1) 30%);
}
.sticky-actions .muted {
  flex: 1;
  font-size: 12.5px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
}
.user-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.user-card.pending {
  border-color: var(--warn);
}
.user-card.rejected {
  opacity: 0.6;
}
.user-card .avatar {
  width: 36px;
  height: 36px;
}
.user-info {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-weight: 600;
  display: flex;
  gap: 6px;
  align-items: center;
}
.user-info .muted {
  font-size: 12px;
}
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: normal;
  white-space: nowrap;
}
.tag.owner,
.tag.admin {
  color: var(--gold-2);
  border-color: rgba(201, 164, 92, 0.5);
}
.tag.dm {
  color: #b9a7ff;
  border-color: rgba(185, 167, 255, 0.4);
}
.tag.fog {
  color: #9ec3ff;
  border-color: rgba(158, 195, 255, 0.4);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 18px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.settings-form h3 {
  margin: 0;
  font-size: 17px;
}
.settings-form p {
  margin: 0;
}

/* ---------------------------------------------------------------- forms */
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
label > span,
.field > .label {
  font-size: 12.5px;
  color: var(--muted);
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
label.check > span {
  font-size: 13px;
  color: var(--text);
}
input[type='text'],
input[type='search'],
textarea {
  width: 100%;
  background: #121317;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}
input[type='file'] {
  font-size: 13px;
}
input:focus,
textarea:focus {
  border-color: var(--gold);
}
input[type='checkbox'] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
.form-error {
  color: #f0a39a;
  min-height: 1em;
  font-size: 13px;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------------------------------------------------------------- modal */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal {
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.modal.wide {
  width: min(560px, 100%);
}
.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 6px 20px;
}
.modal header h2 {
  margin: 0;
  font-size: 20px;
}
.modal-body {
  padding: 8px 20px 18px;
  overflow-y: auto;
}
.modal-body > p {
  margin-top: 0;
}
.pin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.grow {
  flex: 1;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  padding: 0;
}
.swatch.selected {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}
.swatch.custom {
  display: grid;
  place-items: center;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  color: #fff;
  position: relative;
  overflow: hidden;
  font-size: 12px;
  text-shadow: 0 0 3px #000;
}
.swatch.custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.icon-grid {
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #121317;
}
.icon-group-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 6px 2px 4px;
}
.icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 3px;
}
.icon-choice {
  height: 36px;
  border: 1px solid transparent;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}
.icon-choice:hover {
  background: var(--panel-2);
}
.icon-choice.selected {
  border-color: var(--gold);
  background: rgba(201, 164, 92, 0.15);
  color: var(--gold-2);
}
.pin-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  flex: none;
}
.pin-dot.big {
  width: 40px;
  height: 40px;
  font-size: 18px;
  margin-bottom: 1px;
}

/* ---------------------------------------------------------------- pins on the map */
.pin-marker {
  background: none;
  border: 0;
}
.pin {
  position: relative;
  width: 32px;
  height: 44px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
  transition: transform 0.12s;
  transform-origin: 50% 100%;
}
.pin-marker:hover .pin,
.pin-marker:focus .pin {
  transform: scale(1.15);
}
.pin svg {
  position: absolute;
  z-index: 0 !important; /* leaflet.css gives SVGs z-index 200 */
  inset: 0;
  width: 100%;
  height: 100%;
}
.pin svg path {
  fill: var(--pin);
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1.5;
}
.pin > i {
  position: absolute;
  z-index: 1;
  top: 7px;
  left: 0;
  width: 32px;
  text-align: center;
  font-size: 14px;
  line-height: 18px;
  color: var(--glyph);
}
.pin-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #2a2340;
  color: #b9a7ff;
  font-size: 9px;
  display: grid;
  place-items: center;
  border: 1px solid #b9a7ff;
}
.pin.in-fog {
  opacity: 0.6;
}
.pin.in-fog svg path {
  stroke: #9ec3ff;
  stroke-dasharray: 3 2;
}
.moving .pin {
  transform: scale(1.25);
  cursor: grabbing;
}
.leaflet-tooltip.pin-tooltip {
  background: rgba(27, 29, 35, 0.95);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-weight: 600;
}
.leaflet-tooltip-top.pin-tooltip::before {
  border-top-color: rgba(27, 29, 35, 0.95);
}
.pin-popup-wrap .leaflet-popup-content-wrapper,
.pin-popup-wrap .leaflet-popup-tip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.pin-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 12px;
}
.pin-popup-wrap .leaflet-popup-content {
  margin: 14px 16px;
  font: inherit;
}
.pin-popup-wrap a.leaflet-popup-close-button {
  color: var(--muted);
}
.pin-popup h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  margin: 0 18px 8px 0;
  line-height: 1.2;
}
.pin-popup .desc {
  margin-bottom: 8px;
  max-height: 260px;
  overflow-y: auto;
  overflow-wrap: anywhere;
}
.pin-popup .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.pin-popup .meta {
  color: var(--muted);
  font-size: 12px;
}
.popup-actions {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- leaflet controls */
.leaflet-bar a,
.leaflet-bar a:hover {
  background: rgba(27, 29, 35, 0.92);
  color: var(--text);
  border-bottom-color: var(--line);
}
.leaflet-bar {
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow) !important;
}

/* ---------------------------------------------------------------- toasts */
#toasts {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 32px);
}
.toast {
  background: rgba(27, 29, 35, 0.97);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
  transition: opacity 0.35s, transform 0.35s;
}
.toast.success {
  border-left-color: var(--ok);
}
.toast.error {
  border-left-color: var(--danger);
}
.toast.warn {
  border-left-color: var(--warn);
}
.toast.out {
  opacity: 0;
  transform: translateY(8px);
}

/* ---------------------------------------------------------------- small screens */
@media (max-width: 700px) {
  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .brand {
    font-size: 16px;
    padding: 7px 10px;
    flex: 1;
  }
  .tool span:not(.badge) {
    display: none;
  }
  .user-chip-name {
    display: none;
  }
  .tools {
    order: 3;
  }
  .drawer {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    height: 62%;
    transform: translateY(calc(100% + 20px));
  }
  .shell.drawer-open .leaflet-bottom.leaflet-right {
    right: 0;
  }
  .mode-banner {
    top: auto;
    bottom: 70px;
  }
}

/* ---------------------------------------------------------------- region list: continents */
.region-row.continent {
  margin-top: 10px;
  padding-top: 6px;
  padding-bottom: 6px;
  border-top: 1px solid var(--line);
}
.region-list > .region-row.continent:first-child {
  margin-top: 0;
  border-top: 0;
}
.region-row.continent .region-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
}
.continent-title {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--gold-2);
}
.continent-sub {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
}
.region-row.continent small {
  flex-basis: 100%;
}
.region-list.grouped .region-row.state {
  padding-left: 18px;
}
.region-list.grouped .region-row.province {
  padding-left: 58px;
}
.region-group-label {
  margin: 12px 4px 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- search */
.search {
  position: relative;
  margin-left: auto;
  flex: 0 1 280px;
  min-width: 0;
}
.search + .user-chip {
  margin-left: 0;
}
.search input[type='search'] {
  height: 42px;
  padding-left: 34px;
  background: rgba(27, 29, 35, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding: 4px;
  background: rgba(27, 29, 35, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search.open .search-results {
  display: block;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.search-item.active {
  background: var(--panel-2);
}
.search-type {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(201, 164, 92, 0.15);
  color: var(--gold-2);
  font-size: 12px;
}
.search-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.search-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-name mark {
  background: none;
  color: var(--gold-2);
  font-weight: 700;
}
.search-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-empty,
.search-more {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12.5px;
}
.search-pulse {
  pointer-events: none;
}
.search-pulse span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid #ff3b30;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
  animation: search-pulse 0.85s ease-out 3;
  pointer-events: none;
}
@keyframes search-pulse {
  from {
    transform: scale(0.3);
    opacity: 1;
  }
  to {
    transform: scale(1.6);
    opacity: 0;
  }
}
@media (max-width: 700px) {
  .search {
    order: 4;
    flex: 1 1 100%;
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------- user names */
.user-card .nick {
  margin-top: 8px;
}
.user-card .nick input {
  padding: 6px 9px;
  font-size: 13px;
}
