/* PanMap web UI.
   Deepslate panels over the map, one amethyst accent for interaction, faction colors for everything territorial.
   Two type roles: system UI sans for panels, DIN-style "map signage" for anything drawn on the map. */

:root {
  --ink-0: #1d212a;
  --ink-1: #252a34;
  --ink-2: #2f3541;
  --ink-3: #3a4150;
  --field: #161920;
  --panel: rgba(29, 33, 42, 0.9);
  --rule: rgba(214, 220, 240, 0.09);
  --rule-2: rgba(214, 220, 240, 0.16);
  --text: #ebe8f3;
  --text-2: #b3b0c3;
  --text-3: #858397;
  --amethyst: #b391ff;
  --amethyst-hi: #c9b0ff;
  --amethyst-lo: #8d68f0;
  --amethyst-ink: #1b1233;
  --amethyst-wash: rgba(179, 145, 255, 0.14);
  --ok: #5fd49a;
  --warn: #f2b14c;
  --bad: #f06a6a;
  --gold: #f2c45a;
  --env-normal: #79c26b;
  --env-nether: #ff7a4d;
  --env-end: #e2da9a;
  --env-custom: #8fb3d9;
  --void-normal: #11151b;
  --void-nether: #1b0f10;
  --void-end: #0f0d17;

  --font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Noto Sans", Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-map: "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Alternate", "DIN 2014", "Roboto Condensed", "Arial Narrow", "Noto Sans", system-ui, sans-serif;
  --font-code: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;

  --fs-xs: 11.5px;
  --fs-s: 12.5px;
  --fs-m: 14px;
  --fs-l: 16px;
  --fs-xl: 21px;

  --gap: 12px;
  --bar-h: 46px;
  --dock-w: 348px;
  --r-panel: 14px;
  --r-ctl: 10px;
  --r-row: 9px;
  --shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --hit: 36px;
  --ctl: 40px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  touch-action: pan-x pan-y; /* no page pinch-zoom; the map handles its own gestures */
  background: var(--void-normal);
  color: var(--text);
  font: 400 var(--fs-m)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
.pm-i { width: 20px; height: 20px; display: block; flex: none; }

:focus-visible { outline: 2px solid var(--amethyst); outline-offset: 2px; }
.leaflet-container :focus-visible { outline-offset: 0; }

.pm-app { position: fixed; inset: 0; overflow: hidden; }

/* ================================================================ map views */

.pm-view { position: absolute; inset: 0; touch-action: none; }
.pm-view.is-hidden { visibility: hidden; pointer-events: none; }
.pm-view-3d { background: var(--void-normal); z-index: 1; }

.leaflet-container.pm-view-2d {
  background: var(--void-normal);
  font-family: var(--font);
  transition: background-color 0.3s;
}
.pm-view-2d.env-nether { background: var(--void-nether); }
.pm-view-2d.env-end { background: var(--void-end); }
.pm-view-2d.pm-over-claim, .pm-view-2d.pm-over-claim.leaflet-grab { cursor: pointer; }
.pm-view-2d.leaflet-dragging .leaflet-grab { cursor: grabbing; }

.pm-tiles img, .pm-tiles .leaflet-tile { image-rendering: pixelated; image-rendering: crisp-edges; }
/* empty / not-yet-requested tiles have no src; never let the browser draw a placeholder frame */
.leaflet-container .pm-tiles img.pm-tile-empty, .leaflet-container .pm-tiles img:not([src]) { visibility: hidden !important; }
@supports (image-rendering: pixelated) { .pm-tiles img { image-rendering: pixelated; } }
.pm-claims { pointer-events: none; position: absolute; left: 0; top: 0; }
.pm-border { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)); }

/* ---------------------------------------------------------------- player markers */

.pm-pl-wrap { background: none; border: 0; }
.pm-pl { position: relative; width: 34px; height: 34px; --fc: rgba(235, 232, 243, 0.92); cursor: pointer; }
.pm-pl-head {
  position: absolute; inset: 4px;
  border-radius: 7px;
  background: #101318;
  box-shadow: 0 0 0 2px var(--fc), 0 0 0 3.5px rgba(10, 12, 16, 0.65), 0 4px 10px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition: transform 0.15s var(--ease);
}
.pm-pl:hover .pm-pl-head { transform: scale(1.12); }
.pm-pl-face { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.pm-pl-dir { position: absolute; inset: 0; pointer-events: none; transition: transform 0.4s var(--ease); }
.pm-pl-dir::before {
  content: ""; position: absolute; left: 50%; top: -6px; margin-left: -5px;
  border: 5px solid transparent; border-bottom: 7px solid var(--fc); border-top: 0;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.8));
}
.pm-pl-tag {
  position: absolute; left: 50%; top: calc(100% + 3px); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 1px 6px 2px;
  border-radius: 6px;
  background: rgba(14, 16, 22, 0.78);
  font: 600 12.5px/1.25 var(--font-map);
  letter-spacing: 0.01em;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
}
.pm-pl-tag b { font-weight: 600; text-align: center; }
.pm-pl-hp { display: block; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.pm-pl-hp i { display: block; height: 100%; background: var(--ok); border-radius: 2px; transform-origin: left center; transition: transform 0.4s; }
.pm-pl-hp.is-low i { background: var(--bad); }
.pm-pl.is-me .pm-pl-head { box-shadow: 0 0 0 2px var(--fc), 0 0 0 4px var(--amethyst), 0 4px 12px rgba(0, 0, 0, 0.55); }
.pm-pl.is-followed .pm-pl-head::after {
  content: ""; position: absolute; inset: 0; border-radius: 7px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}
.pm-pl.is-followed::after {
  content: ""; position: absolute; inset: -2px; border-radius: 12px;
  border: 2px solid var(--amethyst);
  animation: pm-ring 1.8s var(--ease) infinite;
  pointer-events: none;
}
@keyframes pm-ring { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.7); opacity: 0; } }

/* ---------------------------------------------------------------- map markers */

.pm-mk-wrap { background: none; border: 0; }
.pm-mk { position: relative; width: 26px; height: 26px; --mc: #ebe8f3; }
.pm-mk-gem {
  position: absolute; left: 50%; top: 50%; width: 19px; height: 19px; margin: -9.5px 0 0 -9.5px;
  transform: rotate(45deg);
  border-radius: 4px;
  background: #1a1e26;
  box-shadow: inset 0 0 0 2px var(--mc), 0 3px 8px rgba(0, 0, 0, 0.6);
  display: grid; place-items: center;
}
.pm-mk-glyph { transform: rotate(-45deg); color: var(--mc); display: grid; place-items: center; }
.pm-mk-glyph .pm-i { width: 12px; height: 12px; }
.pm-mk-spawn .pm-mk-gem { width: 23px; height: 23px; margin: -11.5px 0 0 -11.5px; background: var(--mc); box-shadow: 0 0 0 2px rgba(14, 16, 22, 0.8), 0 3px 10px rgba(0, 0, 0, 0.6); }
.pm-mk-spawn .pm-mk-glyph { color: #15181f; }
.pm-mk-spawn .pm-mk-glyph .pm-i { width: 14px; height: 14px; }
.pm-mk-label {
  position: absolute; left: 50%; top: calc(100% + 1px); transform: translateX(-50%);
  font: 600 12px/1.2 var(--font-map); color: #fff; white-space: nowrap;
  text-shadow: 0 0 3px #000, 0 0 2px #000, 0 1px 2px #000;
  pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
}
.pm-mk-wrap:hover .pm-mk-label, .pm-zoom-near .pm-mk-label, .pm-mk-spawn .pm-mk-label { opacity: 1; }
@media (hover: none) { .pm-zoom-mid .pm-mk-label { opacity: 1; } }
.pm-zoom-far .pm-mk-std { transform: scale(0.8); }

/* ================================================================ shared surfaces + controls */

.pm-top > *, .pm-dock, .pm-ctl-group, .pm-readout, .pm-pill, .pm-pop, .pm-toast {
  background: var(--panel);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.pm-iconbtn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  cursor: pointer;
}
.pm-iconbtn:hover { background: var(--ink-2); color: var(--text); }

.pm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--rule-2); border-radius: var(--r-ctl);
  background: var(--ink-2); color: var(--text);
  font-weight: 600; font-size: var(--fs-m);
  cursor: pointer; white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, transform 0.08s;
}
.pm-btn:hover { background: var(--ink-3); }
.pm-btn:active { transform: translateY(1px); }
.pm-btn:disabled { opacity: 0.55; cursor: default; }
.pm-btn .pm-i { width: 18px; height: 18px; }
.pm-btn-primary { background: var(--amethyst); border-color: transparent; color: var(--amethyst-ink); }
.pm-btn-primary:hover { background: var(--amethyst-hi); }
.pm-btn-ghost { background: transparent; }
.pm-btn-ghost:hover { background: var(--ink-1); }
.pm-btn-danger { background: rgba(240, 106, 106, 0.16); border-color: rgba(240, 106, 106, 0.45); color: #ffc2c2; }
.pm-btn-danger:hover { background: rgba(240, 106, 106, 0.26); }
.pm-btn-small { height: 32px; padding: 0 12px; font-size: var(--fs-s); }
.pm-btn-block { width: 100%; }
.pm-btn.is-busy { position: relative; color: transparent; }
.pm-btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--amethyst-ink); border-right-color: transparent;
  animation: pm-spin 0.7s linear infinite;
}
.pm-linklike {
  border: 0; background: none; padding: 0; color: var(--amethyst-hi); cursor: pointer;
  font-weight: 600; text-decoration: underline; text-decoration-color: rgba(201, 176, 255, 0.35); text-underline-offset: 3px;
}
.pm-linklike:hover { text-decoration-color: currentColor; }

.pm-input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--rule-2); border-radius: var(--r-ctl);
  background: var(--field); color: var(--text);
  font: inherit; font-size: 15px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.pm-input::placeholder { color: var(--text-3); }
.pm-input:focus { outline: none; border-color: var(--amethyst); box-shadow: 0 0 0 3px rgba(179, 145, 255, 0.22); }
.pm-input:disabled { opacity: 0.6; }

.pm-face { image-rendering: pixelated; display: block; border-radius: 5px; background: #101318; flex: none; object-fit: cover; }
.pm-face-xs { width: 20px; height: 20px; border-radius: 4px; }
.pm-face-s { width: 22px; height: 22px; border-radius: 4px; }

.pm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); flex: none; }
.pm-dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px rgba(95, 212, 154, 0.16); }

.pm-ftag {
  --fc: #9a98a8; --fct: #c9c7d6;
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font-size: var(--fs-xs); font-weight: 600; color: var(--fct);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-ftag::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--fc); flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }

.pm-dim { display: inline-grid; place-items: center; color: var(--env-custom); }
.pm-dim .pm-i { width: 13px; height: 13px; }
.pm-dim-NORMAL { color: var(--env-normal); }
.pm-dim-NETHER { color: var(--env-nether); }
.pm-dim-THE_END { color: var(--env-end); }

/* banner silhouette, filled with the faction color */
.pm-banner {
  position: relative; flex: none; width: 18px; height: 26px; margin-top: 3px;
  background: linear-gradient(180deg, var(--fc, #9a98a8), color-mix(in srgb, var(--fc, #9a98a8) 70%, #000));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
.pm-banner .pm-i { display: none; }
.pm-banner::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(0, 0, 0, 0.35); }
.pm-banner-l { width: 34px; height: 50px; margin-top: 0; }
.pm-banner-l::after { height: 5px; }

.pm-muted { color: var(--text-3); font-size: var(--fs-s); }
.pm-center { text-align: center; }
.pm-center-block { display: block; margin: 10px auto 0; }

/* ================================================================ top bar */

.pm-top {
  position: absolute; top: calc(var(--gap) + var(--safe-t)); left: calc(var(--gap) + var(--safe-l)); right: calc(var(--gap) + var(--safe-r)); z-index: 500;
  display: flex; align-items: flex-start; gap: 8px;
  pointer-events: none;
}
.pm-top > * { pointer-events: auto; border-radius: 12px; }
.pm-top-fill { flex: 1; background: none !important; border: 0 !important; box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; pointer-events: none !important; }

.pm-cluster-main { display: flex; align-items: center; height: var(--bar-h); padding: 0 5px 0 11px; gap: 10px; min-width: 0; }
.pm-brand { display: flex; align-items: center; gap: 8px; padding-right: 10px; border-right: 1px solid var(--rule); height: 26px; }
.pm-brand-mark-wrap { display: grid; }
.pm-brand-mark { width: 22px; height: 22px; display: block; }
.pm-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

.pm-worlds { display: flex; gap: 2px; }
.pm-world {
  --env: var(--env-custom);
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 11px 0 9px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}
.pm-world[data-env="NORMAL"] { --env: var(--env-normal); }
.pm-world[data-env="NETHER"] { --env: var(--env-nether); }
.pm-world[data-env="THE_END"] { --env: var(--env-end); }
.pm-world-ic { color: var(--text-3); display: grid; transition: color 0.12s; }
.pm-world-ic .pm-i { width: 18px; height: 18px; }
.pm-world:hover { background: var(--ink-1); color: var(--text); }
.pm-world:hover .pm-world-ic { color: var(--env); }
.pm-world.is-on { background: color-mix(in srgb, var(--env) 15%, transparent); color: color-mix(in srgb, var(--env) 35%, #fff); }
.pm-world.is-on .pm-world-ic { color: var(--env); }

.pm-mode { display: flex; height: var(--bar-h); padding: 5px; gap: 2px; }
.pm-mode button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 100%; padding: 0 12px 0 9px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-weight: 650; font-size: 13.5px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.pm-mode button .pm-i { width: 17px; height: 17px; }
.pm-mode button:hover { background: var(--ink-1); color: var(--text); }
.pm-mode button.is-on { background: var(--amethyst); color: var(--amethyst-ink); }
.pm-mode button.is-loading .pm-i { animation: pm-spin 0.9s linear infinite; }

.pm-account {
  display: inline-flex; align-items: center; gap: 9px;
  height: var(--bar-h); padding: 0 14px 0 10px;
  color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer;
  position: relative;
  transition: background-color 0.12s;
}
.pm-account:hover { background: rgba(47, 53, 65, 0.95); }
.pm-acct-ic { display: grid; color: var(--text-2); }
.pm-acct-face { width: 26px; height: 26px; border-radius: 6px; box-shadow: 0 0 0 1.5px var(--rule-2); }
.pm-acct-label { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amethyst); box-shadow: 0 0 0 3px rgba(179, 145, 255, 0.22); }

/* ================================================================ dock */

.pm-dock {
  position: absolute; z-index: 450;
  top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 10px); right: calc(var(--gap) + var(--safe-r));
  max-height: calc(100% - var(--gap) * 2 - var(--bar-h) - 10px - var(--safe-t) - var(--safe-b));
  width: var(--dock-w);
  border-radius: var(--r-panel);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pm-dock-bar { display: flex; align-items: center; gap: 4px; padding: 6px; flex: none; }
.pm-dock[data-open="true"] .pm-dock-bar { border-bottom: 1px solid var(--rule); }
.pm-grip { display: none; }
.pm-tabs { display: flex; gap: 2px; flex: 1; min-width: 0; }
.pm-tab {
  flex: 1 1 auto; min-width: 0; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 8px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
.pm-tab .pm-i { width: 18px; height: 18px; }
.pm-tab:hover { background: var(--ink-1); color: var(--text); }
.pm-tab[aria-selected="true"] { background: var(--amethyst-wash); color: #efe8ff; }
.pm-tab[aria-selected="true"] .pm-tab-ic { color: var(--amethyst); }
.pm-tab-ic { display: grid; }
.pm-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.08); color: var(--text-2);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.pm-badge.is-alert { background: var(--amethyst); color: var(--amethyst-ink); }
.pm-dock-toggle { flex: none; }

.pm-dock-panels { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pm-panel-chat { height: min(600px, calc(100vh - 150px)); flex: none; }
.pm-dock[data-open="false"] .pm-dock-panels { display: none; }
.pm-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pm-fview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pm-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px 8px; flex: none; }
.pm-panel-title { font-size: var(--fs-l); font-weight: 700; letter-spacing: -0.005em; }
.pm-panel-meta { color: var(--text-3); font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
.pm-panel-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 8px 10px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.pm-plist, .pm-flist, .pm-members, .pm-caps, .pm-feed { list-style: none; margin: 0; padding: 0; }

/* empty states */
.pm-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 18px 20px; }
.pm-empty-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--ink-1); color: var(--text-3); margin-bottom: 6px; box-shadow: inset 0 0 0 1px var(--rule); }
.pm-empty-ic .pm-i { width: 22px; height: 22px; }
.pm-empty-title { font-size: 15px; font-weight: 650; }
.pm-empty-body { color: var(--text-2); font-size: 13.5px; max-width: 32ch; text-wrap: pretty; }
.pm-empty .pm-btn { margin-top: 10px; }

/* ---------------------------------------------------------------- players panel */

.pm-prow {
  width: 100%; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px;
  padding: 7px 8px; border: 0; border-radius: var(--r-row); background: transparent; text-align: left; cursor: pointer;
  transition: background-color 0.1s;
}
.pm-prow:hover { background: var(--ink-1); }
.pm-prow.is-followed { background: var(--amethyst-wash); box-shadow: inset 2px 0 0 var(--amethyst); }
.pm-prow-face .pm-face { width: 36px; height: 36px; border-radius: 7px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 5px rgba(0, 0, 0, 0.35); }
.pm-prow-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pm-prow-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pm-prow-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-you { font-size: 10.5px; font-weight: 750; padding: 1px 6px; border-radius: 5px; background: var(--amethyst-wash); color: var(--amethyst-hi); }
.pm-prow-sub { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-3); font-size: var(--fs-xs); }
.pm-prow-sub .pm-ftag { min-width: 0; flex-shrink: 1; }
.pm-prow-world { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex: none; }
.pm-prow-hp { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: var(--fs-xs); font-weight: 650; font-variant-numeric: tabular-nums; }
.pm-hp-ic { color: #ff6b7a; display: grid; }
.pm-hp-ic .pm-i { width: 13px; height: 13px; }
.pm-hp-bar { width: 34px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.pm-hp-bar i { display: block; height: 100%; background: #ff6b7a; border-radius: 2px; transition: width 0.4s; }
.pm-hp-num { min-width: 2ch; text-align: right; }
.pm-prow-hp.is-low .pm-hp-num { color: var(--bad); }

/* ---------------------------------------------------------------- factions panel */

.pm-frow {
  --fc: #9a98a8;
  width: 100%; display: grid; grid-template-columns: 18px 1fr auto; align-items: start; gap: 12px;
  padding: 9px 10px 9px 12px; border: 0; border-radius: var(--r-row); background: transparent; text-align: left; cursor: pointer;
}
.pm-frow:hover { background: var(--ink-1); }
.pm-frow.is-open { background: var(--ink-1); box-shadow: inset 2px 0 0 var(--fc); }
.pm-frow-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pm-frow-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-frow-sub { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: var(--fs-xs); }
.pm-online-n { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.pm-online-n .pm-dot { width: 6px; height: 6px; box-shadow: none; }
.pm-frow-claims { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; padding-top: 1px; }
.pm-frow-claims b { font: 650 16px/1.15 var(--font-map); font-variant-numeric: tabular-nums; }
.pm-frow-claims span { color: var(--text-3); font-size: 11px; }
.pm-war { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; margin-top: 3px; color: var(--text-2); min-width: 0; }
.pm-war b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-war-ic { display: grid; flex: none; }
.pm-war-ic .pm-i { width: 14px; height: 14px; }
.pm-war-active .pm-war-ic { color: var(--bad); }
.pm-war-prep .pm-war-ic { color: var(--warn); }

.pm-fd-top { padding: 8px 8px 0; flex: none; }
.pm-back {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px 0 4px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.pm-back .pm-i { width: 18px; height: 18px; }
.pm-back:hover { background: var(--ink-1); color: var(--text); }
.pm-fd-body { padding: 6px 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.pm-fd-head { display: flex; gap: 14px; align-items: flex-start; }
.pm-fd-name { font-size: var(--fs-xl); font-weight: 750; letter-spacing: -0.015em; line-height: 1.15; overflow-wrap: anywhere; }
.pm-fd-leader { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; margin-top: 4px; }
.pm-fd-leader .pm-i { width: 14px; height: 14px; color: var(--gold); }
.pm-fd-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.5; max-width: 60ch; text-wrap: pretty; overflow-wrap: anywhere; }
.pm-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid var(--rule); border-radius: 11px; overflow: hidden; }
.pm-stats > div { padding: 9px 12px 10px; }
.pm-stats > div + div { border-left: 1px solid var(--rule); }
.pm-stats dt { color: var(--text-3); font-size: 11.5px; font-weight: 600; }
.pm-stats dd { margin: 2px 0 0; font: 650 19px/1.2 var(--font-map); font-variant-numeric: tabular-nums; }
.pm-stats small { font: 500 12px var(--font); color: var(--text-3); }
.pm-sub-h { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.pm-fd-founded { color: var(--text-3); font-size: var(--fs-xs); }

/* invasion card: the two factions' colors, hatched */
.pm-inv {
  --a: #f06a6a; --b: #6a9af0;
  position: relative; border-radius: 12px; padding: 12px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--a) 55%, transparent);
  background:
    linear-gradient(180deg, rgba(22, 25, 32, 0.78), rgba(22, 25, 32, 0.92)),
    repeating-linear-gradient(135deg, var(--a) 0 9px, var(--b) 9px 18px);
  background-size: auto, 25.456px 25.456px;
  display: flex; flex-direction: column; gap: 12px;
}
.pm-inv.is-active { animation: pm-hatch 1.6s linear infinite; }
@keyframes pm-hatch { to { background-position: 0 0, 25.456px 0; } }
.pm-inv-head { display: flex; gap: 10px; align-items: flex-start; }
.pm-inv-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--a) 24%, transparent); color: color-mix(in srgb, var(--a) 40%, #fff); }
.pm-inv-ic .pm-i { width: 18px; height: 18px; }
.pm-inv-title { font-weight: 700; font-size: 14.5px; }
.pm-inv-state { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.pm-inv.is-active .pm-inv-state { color: #ffc2c2; }
.pm-inv-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.pm-inv.is-active .pm-inv-state::before { background: var(--bad); animation: pm-blink 1.2s steps(2, jump-none) infinite; }
@keyframes pm-blink { 50% { opacity: 0.3; } }
.pm-inv-when { color: var(--text-2); font-variant-numeric: tabular-nums; }
.pm-inv .pm-sub-h { margin-bottom: 4px; }
.pm-caps { display: flex; flex-direction: column; gap: 2px; }
.pm-cap {
  width: 100%; display: grid; grid-template-columns: 1fr 70px 38px; gap: 10px; align-items: center;
  padding: 6px 8px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, 0.22); cursor: pointer; text-align: left; font-size: 12.5px;
}
.pm-cap:hover { background: rgba(0, 0, 0, 0.36); }
.pm-cap-where { display: inline-flex; gap: 6px; align-items: center; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pm-cap-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.pm-cap-bar i { display: block; height: 100%; background: var(--ac); border-radius: 3px; transition: width 0.6s var(--ease); }
.pm-cap-pct { text-align: right; font: 650 13px var(--font-map); font-variant-numeric: tabular-nums; }

.pm-members { display: flex; flex-direction: column; }
.pm-member { display: grid; grid-template-columns: 8px 22px 1fr auto; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.pm-member:last-child { border-bottom: 0; }
.pm-member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.pm-role { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; }
.pm-role.is-leader { color: var(--gold); font-weight: 650; }
.pm-role-ic .pm-i { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- chat panel */

.pm-chat-body { padding: 0 6px 8px; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px); mask-image: linear-gradient(to bottom, transparent 0, #000 14px); }
.pm-feed { display: flex; flex-direction: column; gap: 1px; padding-bottom: 4px; }
.pm-ln { display: grid; grid-template-columns: 38px 1fr; gap: 6px; padding: 4px 8px; border-radius: 7px; font-size: 13.5px; line-height: 1.45; }
.pm-ln:hover { background: rgba(255, 255, 255, 0.03); }
.pm-ln-t { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; padding-top: 2.5px; }
.pm-ln-text { overflow-wrap: anywhere; min-width: 0; }
.pm-ln-name { font-weight: 650; color: #fff; margin-right: 7px; }
.pm-ln-msg { color: var(--text); }
.pm-ln-ic { display: none; }
.pm-ln-join, .pm-ln-quit, .pm-ln-death, .pm-ln-system { grid-template-columns: 38px 16px 1fr; align-items: start; }
.pm-ln-join .pm-ln-ic, .pm-ln-quit .pm-ln-ic, .pm-ln-death .pm-ln-ic, .pm-ln-system .pm-ln-ic { display: grid; padding-top: 2px; }
.pm-ln-ic .pm-i { width: 15px; height: 15px; }
.pm-ln-join, .pm-ln-quit { color: var(--text-3); font-size: 13px; }
.pm-ln-join .pm-ln-name, .pm-ln-quit .pm-ln-name { color: var(--text-2); margin-right: 0; }
.pm-ln-join .pm-ln-ic { color: var(--ok); }
.pm-ln-quit .pm-ln-ic { color: var(--text-3); }
.pm-ln-death { color: #f5b8b8; }
.pm-ln-death .pm-ln-ic { color: var(--bad); }
.pm-ln-system { color: var(--text-2); font-style: italic; }
.pm-ln-system .pm-ln-ic { color: var(--amethyst); }
.pm-ln-web .pm-ln-name { color: var(--amethyst-hi); }
.pm-ln-via { display: inline-grid; vertical-align: -2px; margin-right: 5px; color: var(--amethyst); }
.pm-ln-via .pm-i { width: 14px; height: 14px; }

.pm-chat-foot { flex: none; padding: 10px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; }
.pm-chat-form { display: flex; gap: 6px; }
.pm-chat-form .pm-input { height: 38px; font-size: 14px; }
.pm-send { width: 38px; height: 38px; background: var(--amethyst); color: var(--amethyst-ink); border-radius: var(--r-ctl); }
.pm-send:hover { background: var(--amethyst-hi); color: var(--amethyst-ink); }
.pm-send .pm-i { width: 18px; height: 18px; }
.pm-chat-hint { color: var(--text-2); font-size: var(--fs-s); }
.pm-chat-rename { align-self: flex-start; font-size: var(--fs-xs); }
.pm-chat-gate { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-2); font-size: 13px; }
.pm-chat-gate .pm-btn { flex: none; }

/* ================================================================ map controls, readout, pills, toasts */

.pm-controls {
  position: absolute; z-index: 440; right: calc(var(--gap) + var(--safe-r)); bottom: calc(var(--gap) + var(--safe-b));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  transition: right 0.2s var(--ease), bottom 0.2s var(--ease);
}
.pm-app[data-dock="open"]:not([data-dock-short]) .pm-controls { right: calc(var(--gap) * 2 + var(--dock-w) + var(--safe-r)); }
.pm-ctl-group { display: flex; flex-direction: column; border-radius: 11px; position: relative; }
.pm-ctl {
  width: var(--ctl); height: var(--ctl); display: grid; place-items: center;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.pm-ctl:first-child { border-radius: 10px 10px 0 0; }
.pm-ctl:last-child { border-radius: 0 0 10px 10px; }
.pm-ctl:only-child { border-radius: 10px; }
.pm-ctl + .pm-ctl { border-top: 1px solid var(--rule); }
.pm-ctl:hover { background: var(--ink-2); color: var(--text); }
.pm-ctl:disabled { opacity: 0.35; cursor: default; background: transparent; }
.pm-ctl.is-on { color: var(--amethyst); background: var(--amethyst-wash); }
body[data-mode="3d"] .pm-zoom-group { display: none; }

.pm-pop {
  position: absolute; right: calc(100% + 8px); bottom: calc(-8px - var(--ctl)); width: 216px;
  max-height: calc(100vh - var(--bar-h) - var(--gap) * 3 - var(--safe-t) - var(--safe-b));
  overflow-y: auto; overscroll-behavior: contain;
  border-radius: 12px; padding: 10px 6px 6px;
}
.pm-controls:has(.pm-pop:not([hidden])) { z-index: 470; }
.pm-pop-title { font-size: 12px; font-weight: 650; color: var(--text-3); padding: 0 8px 6px; }
.pm-switch { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 550; }
.pm-switch:hover { background: var(--ink-1); }
.pm-switch input { position: absolute; opacity: 0; pointer-events: none; }
.pm-switch-track { position: relative; width: 30px; height: 18px; border-radius: 9px; background: var(--ink-3); transition: background-color 0.15s; flex: none; }
.pm-switch-track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #d8d5e3; transition: transform 0.15s var(--ease); }
.pm-switch input:checked + .pm-switch-track { background: var(--amethyst); }
.pm-switch input:checked + .pm-switch-track::after { transform: translateX(12px); background: #fff; }
.pm-switch input:focus-visible + .pm-switch-track { outline: 2px solid var(--amethyst); outline-offset: 2px; }
.pm-pop-title-2 { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--rule); }
.pm-qual { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 4px; padding: 3px; border-radius: 9px; background: var(--field); border: 1px solid var(--rule); }
.pm-qual button { height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 650; cursor: pointer; }
.pm-qual button:hover { color: var(--text); }
.pm-qual button.is-on { background: var(--ink-2); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.pm-pop-hint { color: var(--text-3); font-size: 11.5px; line-height: 1.4; padding: 8px 8px 4px; text-wrap: pretty; }

.pm-readout {
  position: absolute; z-index: 440; left: calc(var(--gap) + var(--safe-l)); bottom: calc(var(--gap) + var(--safe-b));
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 12px; border-radius: 10px;
  pointer-events: none;
  font-family: var(--font-map);
}
.pm-ro-coords { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.pm-ro-k { color: var(--text-3); font-size: 12px; font-weight: 650; }
.pm-ro-v { color: var(--text); font-size: 15px; font-weight: 600; min-width: 6.5ch; letter-spacing: 0.01em; }
.pm-ro-v:last-child { min-width: 5ch; }
.pm-ro-coords.is-center .pm-ro-v { color: var(--text-2); }
.pm-ro-fac { --fc: #888; --fct: #ccc; display: inline-flex; align-items: center; gap: 6px; padding-left: 10px; border-left: 1px solid var(--rule); color: var(--fct); font: 650 13px var(--font); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.pm-ro-fac::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--fc); flex: none; }

.pm-pills {
  position: absolute; z-index: 460; top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 10px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.pm-app[data-dock="open"] .pm-pills { left: calc((100% - var(--dock-w) - var(--gap)) / 2); }
.pm-pill {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 14px; border-radius: 18px; font-size: 13.5px; font-weight: 550; white-space: nowrap;
  animation: pm-drop 0.22s var(--ease);
}
@keyframes pm-drop { from { opacity: 0; transform: translateY(-6px); } }
.pm-pill-sub { color: var(--text-3); font-variant-numeric: tabular-nums; }
.pm-pill-bad { background: rgba(52, 22, 27, 0.94); border-color: rgba(240, 106, 106, 0.45); }
.pm-pill-bad .pm-pill-sub { color: #e7a9a9; }
.pm-pill-ok { border-color: rgba(95, 212, 154, 0.4); }
.pm-pill-follow { padding: 0 5px 0 8px; border-color: rgba(179, 145, 255, 0.45); }
.pm-pill-follow b { font-weight: 700; }
.pm-pill-x { width: 28px; height: 28px; border: 0; border-radius: 14px; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.pm-pill-x:hover { background: var(--ink-2); color: var(--text); }
.pm-pill-x .pm-i { width: 16px; height: 16px; }
.pm-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(240, 106, 106, 0.35); border-top-color: #ff9b9b; animation: pm-spin 0.8s linear infinite; flex: none; }
@keyframes pm-spin { to { transform: rotate(360deg); } }

.pm-toasts {
  position: absolute; z-index: 1200; left: 50%; bottom: calc(var(--gap) + 52px); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.pm-app[data-dock="open"] .pm-toasts { left: calc((100% - var(--dock-w) - var(--gap)) / 2); }
.pm-toast {
  max-width: 420px; padding: 10px 14px 10px 13px; border-radius: 11px;
  font-size: 13.5px; font-weight: 550; text-wrap: pretty;
  border-left: 3px solid var(--amethyst);
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s var(--ease);
}
.pm-toast.is-in { opacity: 1; transform: none; }
.pm-toast.is-out { opacity: 0; transform: translateY(4px); }
.pm-toast-ok { border-left-color: var(--ok); }
.pm-toast-warn { border-left-color: var(--warn); }
.pm-toast-bad { border-left-color: var(--bad); }

/* ================================================================ account sheet */

.pm-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; }
.pm-scrim { position: absolute; inset: 0; background: rgba(8, 9, 13, 0.56); opacity: 0; transition: opacity 0.2s; }
.pm-modal.is-in .pm-scrim { opacity: 1; }
.pm-sheet {
  position: relative; width: min(410px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  background: #1f232c; border: 1px solid var(--rule-2); border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.4);
  padding: 26px 24px 22px;
  opacity: 0; transform: translateY(10px) scale(0.99); transition: opacity 0.2s, transform 0.22s var(--ease);
  scrollbar-width: thin;
}
.pm-modal.is-in .pm-sheet { opacity: 1; transform: none; }
.pm-sheet-close { position: absolute; top: 12px; right: 12px; }
.pm-sheet-body { display: flex; flex-direction: column; gap: 18px; }
.pm-sheet-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-right: 30px; }
.pm-hero-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--amethyst-wash); color: var(--amethyst); margin-bottom: 6px; }
.pm-hero-ic .pm-i { width: 22px; height: 22px; }
.pm-sheet-title { font-size: var(--fs-xl); font-weight: 750; letter-spacing: -0.015em; line-height: 1.2; }
.pm-sheet-lede { color: var(--text-2); font-size: 14px; line-height: 1.5; max-width: 40ch; text-wrap: pretty; }

.pm-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; border-radius: 11px; background: var(--field); border: 1px solid var(--rule); }
.pm-seg button { height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.pm-seg button:hover { color: var(--text); }
.pm-seg button.is-on { background: var(--ink-2); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }

.pm-form { display: flex; flex-direction: column; gap: 14px; }
.pm-form .pm-btn-primary { margin-top: 4px; height: 42px; }
.pm-field { display: flex; flex-direction: column; gap: 6px; }
.pm-field-label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.pm-field-hint { font-size: 12px; color: var(--text-3); }
.pm-form-error { font-size: 13px; color: #ffb4b4; background: rgba(240, 106, 106, 0.1); border: 1px solid rgba(240, 106, 106, 0.3); border-radius: 9px; padding: 8px 11px; }
.pm-form-inline { padding: 14px; border-radius: 12px; background: var(--field); border: 1px solid var(--rule); gap: 12px; }
.pm-form-inline .pm-btn-primary { align-self: flex-start; height: 34px; margin-top: 0; }

.pm-acct-head { display: flex; gap: 14px; align-items: center; padding-right: 30px; }
.pm-acct-head > div { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.pm-face-xl { width: 56px; height: 56px; border-radius: 11px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.45); }
.pm-avatar-blank { width: 56px; height: 56px; border-radius: 11px; display: grid; place-items: center; background: var(--ink-2); color: var(--text-3); flex: none; }
.pm-avatar-blank .pm-i { width: 26px; height: 26px; }
.pm-acct-sub { color: var(--text-2); font-size: 13px; }
.pm-acct-head .pm-ftag { margin-top: 3px; font-size: 12.5px; }
.pm-acct-note { display: flex; gap: 9px; align-items: flex-start; color: var(--text-2); font-size: 13.5px; padding: 11px 12px; border-radius: 11px; background: var(--ink-1); }
.pm-acct-note .pm-i { width: 17px; height: 17px; color: var(--amethyst); margin-top: 1px; }

.pm-callout { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 13px; background: linear-gradient(180deg, rgba(179, 145, 255, 0.12), rgba(179, 145, 255, 0.05)); border: 1px solid rgba(179, 145, 255, 0.3); }
.pm-callout-title { font-weight: 700; font-size: 15px; }
.pm-callout p:not(.pm-callout-title) { color: var(--text-2); font-size: 13.5px; text-wrap: pretty; }
.pm-callout .pm-btn { margin-top: 6px; }

.pm-menu { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.pm-menu-item { display: flex; align-items: center; gap: 11px; height: 46px; padding: 0 14px; border: 0; background: transparent; color: var(--text); font-weight: 550; font-size: 14px; text-align: left; cursor: pointer; }
.pm-menu-item + .pm-menu-item { border-top: 1px solid var(--rule); }
.pm-menu-item:hover { background: var(--ink-1); }
.pm-menu-item .pm-i { width: 18px; height: 18px; color: var(--text-2); }
.pm-menu-item[aria-expanded="true"] { background: var(--ink-1); }
.pm-confirm { padding: 14px; border-radius: 12px; border: 1px solid rgba(240, 106, 106, 0.35); background: rgba(240, 106, 106, 0.07); display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; color: var(--text-2); }
.pm-confirm-row { display: flex; gap: 8px; }

/* link code: six inventory slots */
.pm-link { display: flex; flex-direction: column; gap: 18px; }
.pm-slots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.pm-slot {
  aspect-ratio: 5 / 6; display: grid; place-items: center;
  border-radius: 6px;
  background: #2a2f3a;
  box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.42), inset -3px -3px 0 rgba(255, 255, 255, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.35);
  font: 700 clamp(22px, 7vw, 30px)/1 var(--font-code); color: #f1ebff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
  animation: pm-slot-in 0.42s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms);
}
.pm-slots-loading .pm-slot { animation: pm-slot-wait 1.2s ease-in-out infinite; }
.pm-slots-loading .pm-slot:nth-child(2) { animation-delay: 0.1s; }
.pm-slots-loading .pm-slot:nth-child(3) { animation-delay: 0.2s; }
.pm-slots-loading .pm-slot:nth-child(4) { animation-delay: 0.3s; }
.pm-slots-loading .pm-slot:nth-child(5) { animation-delay: 0.4s; }
.pm-slots-loading .pm-slot:nth-child(6) { animation-delay: 0.5s; }
@keyframes pm-slot-in { from { opacity: 0; transform: translateY(8px) scale(0.9); } }
@keyframes pm-slot-wait { 50% { background: #333947; } }
.pm-slots:not(.pm-slots-loading) .pm-slot { box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.42), inset -3px -3px 0 rgba(255, 255, 255, 0.07), 0 0 0 1px rgba(179, 145, 255, 0.35), 0 0 18px -4px rgba(179, 145, 255, 0.45); }
.pm-slots.is-expired .pm-slot { color: var(--text-3); box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.42), inset -3px -3px 0 rgba(255, 255, 255, 0.05); text-decoration: line-through; text-decoration-thickness: 2px; }
.pm-cmd { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 11px; background: var(--field); border: 1px solid var(--rule-2); }
.pm-cmd-text { flex: 1; min-width: 0; font: 600 14.5px/1.3 var(--font-code); color: var(--text); overflow-wrap: anywhere; user-select: all; }
.pm-copy { flex: none; }
.pm-copy.is-done { color: var(--ok); border-color: rgba(95, 212, 154, 0.45); }
.pm-link-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text-2); font-size: 13.5px; }
.pm-link-wait.is-expired { color: #ffb4b4; }
.pm-link-exp { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12.5px; margin-left: auto; }
.pm-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--amethyst); position: relative; flex: none; }
.pm-pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--amethyst); animation: pm-pulse 1.6s var(--ease) infinite; }
@keyframes pm-pulse { to { transform: scale(2.8); opacity: 0; } }

.pm-linked { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }
.pm-linked .pm-sheet-title { text-align: center; }
.pm-linked .pm-btn { margin-top: 10px; }
.pm-linked-art { position: relative; width: 120px; height: 104px; display: grid; place-items: center; }
.pm-face-hero { width: 76px; height: 76px; border-radius: 13px; box-shadow: 0 0 0 3px var(--amethyst), 0 12px 30px rgba(0, 0, 0, 0.55); animation: pm-pop 0.5s var(--ease) both; }
@keyframes pm-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } }
.pm-burst { position: absolute; inset: 0; pointer-events: none; }
.pm-burst i {
  position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; background: var(--c);
  transform: rotate(var(--a)) translateY(0); opacity: 0;
  animation: pm-burst 0.9s 0.15s var(--ease) forwards;
}
@keyframes pm-burst {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(-20px) scale(1); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(0.6); }
}

/* ================================================================ fatal / noscript */

.pm-fatal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px; background: var(--void-normal); }
.pm-fatal-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 380px; }
.pm-fatal-mark .pm-brand-mark { width: 44px; height: 44px; margin-bottom: 8px; }
.pm-fatal-title { font-size: 19px; font-weight: 700; }
.pm-fatal-detail { color: var(--text-2); font-size: 14px; }
.pm-fatal .pm-btn { margin-top: 10px; }
.pm-noscript { position: fixed; inset: 0; display: grid; place-items: center; color: var(--text-2); }

/* ================================================================ phone: bottom sheet layout */

@media (max-width: 720px) {
  :root { --gap: 8px; --bar-h: 48px; --peek: calc(62px + var(--safe-b)); }

  .pm-top { gap: 6px; }
  .pm-cluster-main { padding: 0 2px 0 9px; gap: 4px; flex: 1 1 auto; }
  .pm-brand { padding-right: 6px; }
  .pm-title { display: none; }
  .pm-worlds { flex: 1; justify-content: space-around; }
  .pm-world { padding: 0; width: 44px; height: 44px; justify-content: center; }
  .pm-world-name { display: none; }
  .pm-world-ic .pm-i { width: 21px; height: 21px; }
  .pm-mode { padding: 2px; }
  .pm-mode button { padding: 0; width: 44px; justify-content: center; }
  .pm-mode button .pm-i { display: none; }
  .pm-top-fill { display: none; }
  .pm-account { padding: 0; width: var(--bar-h); justify-content: center; flex: none; }
  .pm-acct-face { width: 28px; height: 28px; }
  .pm-acct-label { display: none; }
  .pm-account .pm-acct-dot { position: absolute; top: 9px; right: 9px; }

  .pm-dock {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: calc(62dvh + var(--safe-b)); max-height: none;
    border-radius: 18px 18px 0 0; border-bottom: 0;
    transform: translateY(var(--drag, 0px));
    transition: height 0.26s var(--ease), transform 0.2s;
    padding-bottom: var(--safe-b);
  }
  .pm-dock[data-open="false"] { bottom: 0; height: var(--peek); }
  .pm-dock-bar { padding: 12px calc(6px + var(--safe-r)) 4px calc(6px + var(--safe-l)); position: relative; touch-action: none; }
  .pm-grip { display: block; position: absolute; top: 5px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--rule-2); }
  .pm-dock[data-open="false"] .pm-dock-bar { padding-bottom: 6px; }
  .pm-tab { height: 44px; font-size: 13px; gap: 6px; padding: 0 4px; }
  .pm-panel-chat { height: auto; flex: 1 1 auto; }

  .pm-controls, .pm-app[data-dock="open"] .pm-controls { right: var(--gap); bottom: calc(var(--peek) + var(--gap)); }
  .pm-app[data-dock="open"] .pm-controls, .pm-app[data-dock="open"] .pm-readout { opacity: 0; pointer-events: none; }
  :root { --ctl: 44px; }
  .pm-readout { bottom: calc(var(--peek) + var(--gap)); height: 36px; padding: 0 10px; }
  .pm-ro-v { font-size: 14px; min-width: 5.5ch; }
  .pm-ro-fac { display: none; }

  .pm-pills, .pm-app[data-dock="open"] .pm-pills { left: 50%; top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 8px); }
  .pm-toasts, .pm-app[data-dock="open"] .pm-toasts { left: 50%; bottom: calc(var(--peek) + 62px); }
  .pm-app[data-dock="open"] .pm-toasts { bottom: calc(62dvh + 16px); }

  .pm-modal { place-items: end stretch; padding: 0; }
  .pm-sheet {
    width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; border-bottom: 0;
    padding: 24px 18px calc(20px + var(--safe-b));
    transform: translateY(24px);
  }
  .pm-slots { gap: 6px; }
}

@media (max-width: 380px) {
  .pm-brand { display: none; }
  .pm-cluster-main { padding-left: 2px; }
  .pm-tab-label { font-size: 12.5px; }
}

/* ================================================================ landscape phones: side panel, compact bar */

@media (max-height: 520px) and (min-width: 721px) {
  :root { --gap: 8px; --bar-h: 48px; --dock-w: 320px; }
  .pm-title { display: none; }
  .pm-brand { border-right: 0; padding-right: 0; }
  .pm-world-name { display: none; }
  .pm-world { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .pm-mode button .pm-i { display: none; }
  .pm-mode { padding: 2px; }
  .pm-mode button { width: 44px; padding: 0; justify-content: center; }
  .pm-acct-label { display: none; }
  .pm-account { width: var(--bar-h); padding: 0; justify-content: center; }
  .pm-account .pm-acct-dot { position: absolute; top: 9px; right: 9px; }
  .pm-dock { top: calc(var(--gap) + var(--safe-t)); max-height: calc(100% - var(--gap) * 2 - var(--safe-t) - var(--safe-b)); right: calc(var(--gap) + var(--safe-r) + var(--bar-h) + 8px); }
  .pm-panel-chat { height: calc(100vh - 120px); }
  .pm-panel-head { padding: 10px 14px 6px; }
  .pm-tab { padding: 0 6px; gap: 6px; }
  .pm-tab-ic { display: none; }
  .pm-pills { top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 8px); }
  .pm-app[data-dock="open"]:not([data-dock-short]) .pm-controls { right: calc(var(--gap) * 3 + var(--dock-w) + var(--bar-h) + var(--safe-r)); }
  .pm-app[data-dock="open"] .pm-pills, .pm-app[data-dock="open"] .pm-toasts { left: calc((100% - var(--dock-w) - var(--bar-h) - 24px) / 2); }
  .pm-sheet { max-height: calc(100dvh - 16px); padding: 18px 20px 16px; }
  .pm-sheet-body { gap: 12px; }
  .pm-hero-ic { display: none; }
}

/* ================================================================ touch: 44px targets, no hover-only UI, 16px inputs */

@media (pointer: coarse) {
  :root { --hit: 44px; --ctl: 44px; }
  .pm-iconbtn, .pm-sheet-close, .pm-dock-toggle { width: 44px; height: 44px; }
  .pm-tab { height: 44px; }
  .pm-btn { min-height: 44px; }
  .pm-btn-small { min-height: 40px; }
  .pm-back { height: 44px; padding-right: 14px; }
  .pm-seg button, .pm-qual button { height: 40px; }
  .pm-cap { min-height: 44px; }
  .pm-switch { min-height: 44px; }
  .pm-menu-item { height: 48px; }
  .pm-input { height: 44px; font-size: 16px; }
  .pm-chat-form .pm-input { height: 44px; font-size: 16px; }
  .pm-send { width: 44px; height: 44px; }
  .pm-pill-x { position: relative; }
  .pm-pill-x::before { content: ""; position: absolute; inset: -8px; }
  .pm-linklike { padding: 10px 4px; }
  .pm-prow { min-height: 52px; }
}

@media (hover: none) {
  .pm-prow:hover, .pm-frow:hover, .pm-world:hover, .pm-tab:hover, .pm-ctl:hover { background: transparent; }
  .pm-world.is-on:hover { background: color-mix(in srgb, var(--env) 15%, transparent); }
  .pm-tab[aria-selected="true"]:hover { background: var(--amethyst-wash); }
}

/* ================================================================ low quality tier: solid panels, no effects */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --panel: #1d212a; }
}
html[data-quality="low"] { --panel: #1d212a; --shadow: 0 2px 6px rgba(0, 0, 0, 0.45); }
html[data-quality="low"] .pm-top > *, html[data-quality="low"] .pm-dock, html[data-quality="low"] .pm-ctl-group,
html[data-quality="low"] .pm-readout, html[data-quality="low"] .pm-pill, html[data-quality="low"] .pm-pop, html[data-quality="low"] .pm-toast {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: var(--shadow);
}
html[data-quality="low"] .pm-sheet { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6); }
html[data-quality="low"] .pm-pl-head { box-shadow: 0 0 0 2px var(--fc), 0 0 0 3.5px rgba(10, 12, 16, 0.65); }
html[data-quality="low"] .pm-slot { box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.42), inset -3px -3px 0 rgba(255, 255, 255, 0.07); }
html[data-quality="low"] [class*="pm-"]:not(.leaflet-zoom-animated),
html[data-quality="low"] [class*="pm-"]:not(.leaflet-zoom-animated)::before,
html[data-quality="low"] [class*="pm-"]:not(.leaflet-zoom-animated)::after {
  animation: none !important;
  transition: none !important;
}
html[data-quality="low"] .pm-pl.is-followed::after { transform: scale(1.25); opacity: 0.8; }
html[data-quality="low"] .pm-toast.is-in { opacity: 1; transform: none; }
html[data-quality="low"] .pm-modal .pm-sheet, html[data-quality="low"] .pm-modal .pm-scrim { transition: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .pm-pl.is-followed::after { animation: none; transform: scale(1.25); opacity: 0.8; }
}
