/* shiny1um live map.
 * Minecraft's own look on a dark map: pixel type, square blocks with a light
 * top-left and dark bottom-right edge, stone buttons, one diamond accent,
 * gold only for ratings, red only for hearts and errors. */

:root {
  color-scheme: dark;

  --bg: #07090c;
  --surface: #15191e;
  --surface-2: #1f252c;
  --surface-3: #2c343d;
  --edge: #000;
  --hi: rgba(255, 255, 255, .13);
  --lo: rgba(0, 0, 0, .55);
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .24);

  --text: #f2f5f6;
  --text-2: #b6c0c6;
  --text-3: #818d95;

  /* Diamond. */
  --accent: #4aedd9;
  --accent-hi: #a8fbee;
  --accent-lo: #1b9d92;
  --accent-ink: #04302b;
  --accent-soft: rgba(74, 237, 217, .14);
  --accent-line: rgba(74, 237, 217, .55);

  /* Stone, for buttons. */
  --stone: #6b7078;
  --stone-hi: #9da3ab;
  --stone-lo: #41454b;

  --gold: #fcc93c;
  --star-off: rgba(255, 255, 255, .2);
  --danger: #ff6257;
  --danger-soft: rgba(255, 98, 87, .14);
  --heart: #ee3a32;
  --heart-off: #3b2b2e;

  /* Dimension identity colours (validated for colour-blind separation). */
  --overworld: #27a877;
  --nether: #e4572e;
  --end: #9374ee;

  /* Pixel type, always at a whole multiple of each face's grid so it stays crisp:
     text 20px, headings 30px, titles 40px, the big rating number 50px. */
  --f: 400 20px/22px "Jersey 10", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-head: 400 30px/30px "Jersey 15", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-title: 400 40px/38px "Jersey 20", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-number: 400 50px/42px "Jersey 25", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --shadow: 0 5px 0 rgba(0, 0, 0, .4), 0 18px 40px -14px rgba(0, 0, 0, .8);
  --bevel: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo);
  --slot: inset 2px 2px 0 rgba(0, 0, 0, .5), inset -2px -2px 0 rgba(255, 255, 255, .07);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --gap: 14px;
  --left-w: 352px;
  --drawer-w: 440px;
  --peek: 126px;

  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-.5 0 10 9' shape-rendering='crispEdges'%3E%3Cpath d='M4 0h1v2H4zM3 2h3v1H3zM0 3h9v1H0zM1 4h7v1H1zM2 5h5v2H2zM1 7h3v1H1zM5 7h3v1H5zM1 8h2v1H1zM6 8h2v1H6z'/%3E%3C/svg%3E");
  --heart-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 8' shape-rendering='crispEdges'%3E%3Cpath d='M2 0h2v1H2zM5 0h2v1H5zM1 1h7v3H1zM2 4h5v1H2zM3 5h3v1H3zM4 6h1v1H4z'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: var(--f);
  font-synthesis: none; /* these faces have one weight; never fake a bold */
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

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

* { scrollbar-width: thin; scrollbar-color: var(--stone-lo) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--stone-lo); }

svg.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
svg.icon.solid { fill: currentColor; stroke: none; }

/* ----------------------------------------------------------- surfaces --- */
.panel {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 2px solid var(--edge);
  box-shadow: var(--bevel), var(--shadow);
}

/* ------------------------------------------------------------ buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px 2px;
  border: 2px solid var(--edge);
  background: var(--stone);
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .42);
  white-space: nowrap;
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -4px 0 var(--stone-lo);
}
.btn:hover { border-color: #fff; filter: brightness(1.1); }
.btn:active { padding: 2px 14px 0; box-shadow: inset 2px 4px 0 var(--stone-lo), inset -2px -2px 0 var(--stone-hi); }
.btn[disabled] { opacity: .55; cursor: default; pointer-events: none; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, .4);
  box-shadow: inset 2px 2px 0 var(--accent-hi), inset -2px -4px 0 var(--accent-lo);
}
.btn-primary:active { box-shadow: inset 2px 4px 0 var(--accent-lo), inset -2px -2px 0 var(--accent-hi); }
.btn-ghost {
  background: var(--surface-3);
  color: var(--text);
  text-shadow: none;
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -3px 0 var(--lo);
}
.btn-ghost:active { box-shadow: inset 2px 3px 0 var(--lo), inset -2px -2px 0 var(--hi); }
.btn-danger {
  background: #8f3029;
  box-shadow: inset 2px 2px 0 #c4574e, inset -2px -4px 0 #5c1b16;
}
.btn-danger:active { box-shadow: inset 2px 4px 0 #5c1b16, inset -2px -2px 0 #c4574e; }
.btn-sm { min-height: 32px; padding: 0 10px 2px; }
.btn-sm:active { padding: 2px 10px 0; }
.btn-sm svg.icon { width: 15px; height: 15px; }
.btn-lg { min-height: 46px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  background: transparent;
  color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); border-color: #fff; color: #fff; }

.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px 2px;
  background: rgba(255, 255, 255, .12);
  color: var(--text-2);
 
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px 1px 5px;
  border: 2px solid var(--edge);
  background: var(--surface-2);
  box-shadow: inset 1px 1px 0 var(--hi);
  color: var(--text-2);
}
.chip.plain { padding: 0 10px 1px; }
.dim-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: var(--dim, var(--text-3));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6);
}

/* Minecraft faces: 8x8 pixel art, always shown at a whole multiple, never rounded. */
.face {
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--surface-3);
  background-repeat: no-repeat;
  image-rendering: pixelated;
}
.avatar {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--edge);
}
.avatar.sm { width: 24px; height: 24px; }
.avatar.xs { width: 16px; height: 16px; box-shadow: 0 0 0 1px var(--edge); }

/* Fractional star display: gold up to --rating, masked into five pixel stars. */
.stars {
  --s: 18px; /* a 9-unit star at two screen pixels per unit, like the text */
  display: inline-block;
  width: calc(var(--s) * 50 / 9);
  height: var(--s);
  flex: 0 0 auto;
  background: linear-gradient(90deg, var(--gold) calc(var(--rating, 0) * 20%), var(--star-off) 0);
  -webkit-mask: var(--star) 0 0 / calc(var(--s) * 10 / 9) var(--s) repeat-x;
  mask: var(--star) 0 0 / calc(var(--s) * 10 / 9) var(--s) repeat-x;
}

/* ---------------------------------------------------------------- map --- */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}
.leaflet-container {
  background: var(--bg);
  font: var(--f);
  outline-offset: -2px;
}
.map-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(3, 5, 7, .55) 100%);
}
.terrain-tile {
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity .4s;
}
.terrain-tile.loaded { opacity: 1; }

/* Player marker: a square head, a facing wedge and a name tag. */
.player-marker, .banner-marker { background: none; border: 0; }
.leaflet-container.glide .player-marker { transition: transform 1.9s linear; }
.pm {
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
}
.pm-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--edge), 0 6px 0 4px rgba(0, 0, 0, .35);
}
.pm-dir {
  position: absolute;
  inset: -16px;
  transform: rotate(var(--yaw, 0deg));
  transition: transform .6s var(--ease);
  pointer-events: none;
}
.pm-dir::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 0;
  margin-left: -7px;
  border: 7px solid transparent;
  border-top: 0;
  border-bottom: 10px solid #fff;
  filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000);
}
/* Name tags, as they float over heads in game. */
.pm-name, .pin-label {
  position: absolute;
  padding: 1px 7px 3px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
 
  white-space: nowrap;
}
.pm-name {
  top: calc(100% + 19px);
  left: 50%;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%);
}
.pm.following .pm-face { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--edge), 0 6px 0 4px rgba(0, 0, 0, .35); }
.pm.following .pm-dir::before { border-bottom-color: var(--accent); }
.pm.following .pm-name { color: var(--accent-hi); }
.pm.stale { filter: grayscale(.9) opacity(.65); }

/* Banner pin: the banner itself, standing on its spot. */
.pin {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  cursor: pointer;
}
.pin-art {
  width: 20px;
  height: 40px;
  max-width: none; /* the marker box is 0x0, so a percentage limit would hide it */
  image-rendering: pixelated;
  box-shadow: 0 0 0 2px var(--edge);
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, .4));
  transform-origin: 50% 100%;
  transition: transform .15s steps(3);
}
.pin:hover .pin-art, .pin.active .pin-art { transform: scale(1.2); }
.pin.active .pin-art { box-shadow: 0 0 0 2px var(--accent); }
.pin-label {
  left: calc(100% + 8px);
  top: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 230px;
}
.pin-label span:first-child { overflow: hidden; text-overflow: ellipsis; }
.pin.active .pin-label { color: var(--accent-hi); box-shadow: 0 0 0 2px var(--accent); }
/* Zoomed far out, names would pile up: keep just the banners. */
.leaflet-container[data-zoom="0"] .pin-label,
.leaflet-container[data-zoom="1"] .pin-label { display: none; }

/* The game's item tooltip: near-black with a purple frame. */
.leaflet-tooltip {
  padding: 6px 9px 8px;
  border: 2px solid #2a0a6b;
  border-radius: 0;
  background: rgba(16, 0, 16, .95);
  color: #c9c3d6;
 
  box-shadow: 0 0 0 2px #100010;
}
.leaflet-tooltip::before { display: none; }
.tip-title { color: #fff; }
.tip-coords { color: var(--accent); }

/* ------------------------------------------------------------ top left --- */
.hud-left {
  position: fixed;
  z-index: 20;
  top: var(--gap);
  left: var(--gap);
  bottom: var(--gap);
  width: var(--left-w);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.hud-left > * { pointer-events: auto; }

.topbar { position: relative; z-index: 2; padding: 12px; display: flex; flex-direction: column; gap: 12px; flex: 0 0 auto; }
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}
.brand-mark { width: 36px; height: 36px; flex: 0 0 auto; box-shadow: 0 0 0 2px var(--edge); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font: var(--f-head); text-shadow: 2px 2px 0 #000; }
.brand-sub {
  color: var(--accent);
 
  letter-spacing: 2px;
  text-transform: uppercase;
}

.search { position: relative; }
.search > svg.icon {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--text-3);
  pointer-events: none;
}
/* Text fields the way the game draws them: black, with a grey frame. */
#search-input, .field input, .review-form textarea {
  width: 100%;
  border: 2px solid #5b6168;
  border-radius: 0;
  outline: none;
  background: #000;
  color: #fff;
}
#search-input::placeholder, .field input::placeholder, .review-form textarea::placeholder { color: var(--text-3); }
#search-input:focus, .field input:focus, .review-form textarea:focus { border-color: #fff; }
#search-input {
  height: 42px;
  padding: 0 40px 2px 38px;
}
#search-input::-webkit-search-cancel-button { display: none; }
.search-kbd {
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding-bottom: 2px;
  background: var(--stone-lo);
  box-shadow: inset 1px 1px 0 var(--stone), inset -1px -2px 0 #000;
  color: var(--text-2);
 
  pointer-events: none;
}
#search-input:focus ~ .search-kbd, #search-input:not(:placeholder-shown) ~ .search-kbd { display: none; }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 5;
  max-height: min(360px, 60vh);
  overflow-y: auto;
  padding: 6px;
  border: 2px solid var(--edge);
  background: var(--surface);
  box-shadow: var(--bevel), var(--shadow);
}
.result-empty { padding: 14px 10px; color: var(--text-3); }

/* ------------------------------------------------------------- sidebar --- */
.sidebar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0 1 auto;
  padding: 12px 12px 10px;
}
.sheet-handle { display: none; }

.world-switch { display: flex; gap: 4px; }
.world-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0 5px 2px;
  border: 2px solid var(--edge);
  background: var(--surface-3);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -3px 0 var(--lo);
  color: var(--text-2);
}
.world-btn > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-btn:hover { border-color: #fff; color: #fff; }
.world-btn[aria-selected="true"] {
  background: var(--stone);
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -3px 0 var(--stone-lo);
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .42);
}
.world-btn .count { min-width: 20px; height: 20px; padding: 0 4px 2px; background: rgba(0, 0, 0, .35); text-shadow: none; }
.world-btn .count:empty { display: none; }

.list-tabs {
  display: flex;
  gap: 18px;
  margin: 14px 4px 0;
  border-bottom: 2px solid var(--line);
}
.list-tabs button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 0 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: var(--text-3);
}
.list-tabs button:hover { color: var(--text-2); }
.list-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--accent); }

.list-scroll { min-height: 0; overflow-y: auto; margin: 8px -6px 0; padding: 0 6px; }
.list { display: flex; flex-direction: column; gap: 2px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px;
  border: 2px solid transparent;
  background: none;
  text-align: left;
}
/* Hover like an inventory slot; the selected one gets the hotbar frame. */
.row:hover, .row.cursor { background: rgba(255, 255, 255, .1); }
.row.active { background: var(--accent-soft); border-color: var(--accent); }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title mark { background: none; color: var(--accent); }
.row-sub { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; color: var(--text-3); }

/* Health as the game shows it: ten hearts, filled left to right in half-heart steps. */
.hearts {
  display: block;
  width: 90px;
  height: 8px;
  background: linear-gradient(90deg, var(--heart) var(--hp, 100%), var(--heart-off) 0);
  -webkit-mask: var(--heart-shape) 0 0 / 9px 8px repeat-x;
  mask: var(--heart-shape) 0 0 / 9px 8px repeat-x;
}
.follow-tag { display: none; color: var(--accent); letter-spacing: 2px; text-transform: uppercase; }
.row.active .follow-tag { display: block; }

.banner-thumb { display: grid; place-items: center; width: 32px; height: 40px; flex: 0 0 auto; }
.banner-thumb img { width: 18px; height: 36px; image-rendering: pixelated; box-shadow: 0 0 0 2px var(--edge); }
.rating-chip { display: inline-flex; align-items: center; gap: 5px; color: #fff; }
.rating-chip::before { content: ""; width: 20px; height: 18px; background: var(--gold); -webkit-mask: var(--star) center / contain no-repeat; mask: var(--star) center / contain no-repeat; }
.photo-chip { display: inline-flex; align-items: center; gap: 4px; }
.photo-chip svg.icon { width: 12px; height: 12px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px 22px;
  color: var(--text-3);
  text-align: center;
}
.empty svg.icon { width: 26px; height: 26px; margin-bottom: 4px; opacity: .7; }
.empty strong { color: var(--text-2); }

.sidebar-foot { margin: 10px 4px 0; padding-top: 9px; border-top: 2px solid var(--line); color: var(--text-3); }

/* ----------------------------------------------------------- top right --- */
.hud-right {
  position: fixed;
  z-index: 20;
  top: var(--gap);
  right: var(--gap);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: right .35s var(--ease);
}
.status {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 14px 2px;
  color: var(--text-2);
  white-space: nowrap;
}
.status-dot { position: relative; width: 8px; height: 8px; background: var(--text-3); }
.status[data-kind="live"] .status-dot { background: var(--accent); }
.status[data-kind="live"] .status-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid var(--accent);
  animation: ping 2.4s steps(6) infinite;
}
.status[data-kind="stale"] .status-dot { background: var(--gold); }
.status[data-kind="error"] .status-dot { background: var(--danger); }
.status[data-kind="error"] { color: var(--danger); }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }

.account { position: relative; }
.account-btn { height: 40px; box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -4px 0 var(--stone-lo), var(--shadow); }
.account-btn.signed-in { padding-left: 8px; }
.account-btn .avatar { width: 24px; height: 24px; }
.account-btn .name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  min-width: 200px;
  padding: 6px;
  border: 2px solid var(--edge);
  background: var(--surface);
  box-shadow: var(--bevel), var(--shadow);
}
.menu-head { padding: 8px 10px 10px; color: var(--text-3); border-bottom: 2px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; color: #fff; }
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px 2px;
  border: 2px solid transparent;
  background: none;
  color: var(--text-2);
  text-align: left;
}
.menu button:hover { background: rgba(255, 255, 255, .1); border-color: #fff; color: #fff; }

/* -------------------------------------------------------- map controls --- */
.map-controls {
  position: fixed;
  z-index: 20;
  right: var(--gap);
  bottom: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: right .35s var(--ease);
}
.ctl-group { display: flex; flex-direction: column; overflow: hidden; }
.ctl {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-2);
}
.ctl + .ctl { border-top: 2px solid var(--edge); }
.ctl:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.ctl[aria-pressed="true"] { color: var(--accent); }
.ctl[aria-pressed="false"] { color: var(--text-3); }

.map-readout {
  position: fixed;
  z-index: 15;
  left: 50%;
  bottom: var(--gap);
  display: flex;
  align-items: center;
  gap: 14px;
  height: 32px;
  padding: 0 14px 2px;
  transform: translateX(-50%);
  color: var(--text-2);
 
  white-space: nowrap;
  pointer-events: none;
}
.scale { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.scale-bar { display: block; height: 6px; border: 2px solid var(--text-3); border-top: 0; }
#cursor-coords { min-width: 132px; }

.map-empty {
  position: fixed;
  z-index: 10;
  left: 50%;
  top: 50%;
  max-width: 330px;
  padding: 18px 20px;
  transform: translate(-50%, -50%);
  color: var(--text-2);
  text-align: center;
  pointer-events: none;
}
.map-empty strong { display: block; margin-bottom: 6px; color: #fff; font: var(--f-head); }

body.drawer-open .hud-right, body.drawer-open .map-controls { right: calc(var(--drawer-w) + var(--gap) * 2); }

/* ------------------------------------------------------- special modes --- */
body.map-only > :not(#map, #screenshot-hint),
body.map-only #map :is(.leaflet-grid-pane, .leaflet-control-container, .leaflet-tooltip-pane),
body.terrain-editing #map :is(.leaflet-players-pane, .leaflet-pins-pane, .leaflet-tooltip-pane) {
  display: none !important;
}
body.map-only #map:focus { outline: none; }
.screenshot-hint {
  position: fixed;
  z-index: 20;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  text-align: center;
  pointer-events: none;
}
.terrain-surface { position: absolute; inset: 0; z-index: 800; cursor: crosshair; touch-action: none; }
.terrain-tools {
  position: fixed;
  z-index: 26;
  bottom: var(--gap);
  left: calc(var(--left-w) + var(--gap) * 2);
  max-width: calc(100% - var(--left-w) - 120px);
  padding: 10px 12px;
}
.terrain-tools p { margin: 2px 0 7px; color: var(--text-2); }
.terrain-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.terrain-actions select { color: var(--text); background: var(--surface); padding: 4px; }
.terrain-actions [aria-pressed="true"] { color: var(--accent); }
body.terrain-editing .map-readout { display: none; }
@media (max-width: 760px) {
  .terrain-tools { left: var(--gap); max-width: calc(100% - 76px); bottom: calc(var(--peek) + 10px); }
}

/* -------------------------------------------------------------- drawer --- */
.drawer {
  position: fixed;
  z-index: 30;
  top: var(--gap);
  right: var(--gap);
  bottom: var(--gap);
  width: var(--drawer-w);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  transform: translateX(calc(100% + var(--gap) * 2));
  visibility: hidden;
  transition: transform .4s var(--ease), visibility 0s .4s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .4s var(--ease); }
.drawer-bar {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 10px 12px;
  border-bottom: 2px solid transparent;
  pointer-events: none;
}
.drawer-bar > * { pointer-events: auto; }
.drawer.scrolled .drawer-bar { background: var(--surface); border-bottom-color: var(--edge); pointer-events: auto; }
.drawer-bar-title {
  flex: 1;
  min-width: 0;
  margin: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
}
.drawer.scrolled .drawer-bar-title { opacity: 1; }
.drawer-bar .icon-btn, .eyebrow-pill { background: rgba(0, 0, 0, .7); color: #fff; }
.drawer-bar .icon-btn { border-color: var(--edge); }
.drawer-bar .icon-btn:hover { background: var(--stone-lo); border-color: #fff; }
.drawer-actions { display: flex; gap: 6px; }
.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px 2px;
  border: 2px solid var(--edge);
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.eyebrow-pill svg.icon { width: 13px; height: 13px; }
.drawer-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.drawer-pad { padding: 0 20px 28px; }

.hero {
  position: relative;
  height: 188px;
  border-bottom: 2px solid var(--edge);
  background:
    radial-gradient(120% 90% at 20% 0%, color-mix(in srgb, var(--hero, var(--accent)) 34%, transparent), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 16px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 16px),
    var(--surface-2);
}
.hero-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .4) 0%, transparent 35%, rgba(0, 0, 0, .55) 100%);
}
.hero-art {
  position: absolute;
  z-index: 1;
  left: 20px;
  bottom: -20px;
}
.banner-art {
  width: 60px;
  height: 120px;
  image-rendering: pixelated;
  box-shadow: 0 0 0 2px var(--edge), 0 6px 0 2px rgba(0, 0, 0, .4);
}

.place-head { padding: 32px 0 4px; }
.place-head h2 { font: var(--f-title); text-shadow: 2px 2px 0 #000; overflow-wrap: anywhere; }
.place-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.coord-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.coord {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 32px;
  padding: 0 12px 2px;
  border: 2px solid var(--edge);
  background: #000;
  color: #fff;
 
}
.coord b { color: var(--accent); margin-right: 5px; }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.section-head h3 { font: var(--f-head); text-shadow: 2px 2px 0 #000; }
.section-head .spacer { flex: 1; }

/* Sunken, like an inventory slot. */
.card {
  border: 2px solid var(--edge);
  background: rgba(0, 0, 0, .3);
  box-shadow: var(--slot);
}

/* Rating summary: headline number, then the five-row breakdown. */
.rating-card { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-top: 20px; padding: 16px 18px; }
.rating-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 104px; }
.rating-number { font: var(--f-number); text-shadow: 2px 2px 0 #000; }
.rating-hero .muted { }
.rating-bars { display: grid; gap: 2px; }
.rating-bar-row {
  display: grid;
  grid-template-columns: 12px 1fr 24px;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
 
}
.rating-bar-row span:last-child { text-align: right; }
.rating-bar { height: 8px; background: #000; overflow: hidden; }
.rating-bar i { display: block; height: 100%; min-width: 0; background: var(--gold); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -2px 0 rgba(0, 0, 0, .25); transition: width .5s var(--ease); }
.rating-none { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 14px 16px; color: var(--text-2); }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo {
  position: relative;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--edge);
  background: var(--surface-2);
}
.photo:first-child:nth-last-child(n + 4), .photo.wide { grid-column: span 2; grid-row: span 2; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo:hover, .photo:focus-visible { border-color: #fff; }
.photo-by {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 6px 4px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
}
.photo:hover .photo-by, .photo:focus-visible .photo-by { opacity: 1; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 20px 16px;
  border: 2px dashed #5b6168;
  background: rgba(0, 0, 0, .3);
  color: var(--text-3);
  text-align: center;
  cursor: pointer;
}
.dropzone svg.icon { width: 26px; height: 26px; margin-bottom: 4px; color: var(--accent); }
.dropzone strong { color: #fff; }
.dropzone u { color: var(--accent); text-decoration: none; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text-2);
}
.drop-veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 4px dashed var(--accent);
  background: rgba(2, 24, 22, .9);
  color: var(--accent);
  font: var(--f-head);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
}
.drop-veil svg.icon { width: 36px; height: 36px; }
.drawer.dragging .drop-veil { display: grid; }

.uploads { list-style: none; display: grid; gap: 6px; margin: 10px 0 0; padding: 0; }
.upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 2px solid var(--edge);
  background: var(--surface-2);
  box-shadow: var(--bevel);
}
.upload-thumb { width: 44px; height: 34px; flex: 0 0 auto; object-fit: cover; background: var(--surface-3); box-shadow: 0 0 0 2px var(--edge); }
.upload-main { display: grid; gap: 4px; min-width: 0; flex: 1; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { color: var(--text-3); }
.upload.error .upload-status { color: var(--danger); }
.upload.done .upload-status { color: var(--accent); }
/* The XP bar. */
.progress { height: 6px; background: #000; overflow: hidden; }
.progress i { display: block; width: 0; height: 100%; background: #80ff20; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), inset 0 -2px 0 rgba(0, 0, 0, .3); transition: width .2s; }
.upload.done .progress, .upload.error .progress { display: none; }

.signin-card { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 14px; color: var(--text-2); }
.signin-card p { flex: 1; }

/* Review form */
.review-form { display: grid; gap: 12px; padding: 16px; }
.star-input { display: flex; align-items: center; gap: 2px; }
.star-input button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid transparent;
  background: none;
  color: var(--star-off);
}
.star-input button svg { width: 36px; height: 36px; fill: currentColor; }
.star-input button.on { color: var(--gold); filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .6)); }
.star-input button:hover { border-color: #fff; }
.star-hint { margin-left: 10px; color: var(--text-2); }

.field { display: grid; gap: 6px; color: var(--text-2); }
.field input { min-height: 44px; padding: 8px 12px 10px; }
.review-form textarea { min-height: 96px; padding: 8px 12px; resize: vertical; }
.form-row { display: flex; align-items: center; gap: 8px; }
.form-row .spacer { flex: 1; }
.char-count { color: var(--text-3); }
.form-msg { min-height: 0; color: var(--danger); }
.form-msg:empty { display: none; }

.reviews { display: grid; gap: 4px; }
.review { display: flex; gap: 12px; padding: 12px 0; border-top: 2px solid var(--line); }
.review:first-child { border-top: 0; padding-top: 2px; }
.review-body { min-width: 0; flex: 1; }
.review-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; }
.review-top strong { }
.review-top time { margin-left: auto; color: var(--text-3); }
.review p { margin-top: 4px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.tag { padding: 0 6px 2px; background: var(--accent); color: var(--accent-ink); letter-spacing: 2px; text-transform: uppercase; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s steps(12) infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* --------------------------------------------------------------- modal --- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-card {
  position: relative;
  width: min(430px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 28px;
  border: 2px solid var(--edge);
  background: var(--surface);
  box-shadow: var(--bevel), var(--shadow);
  animation: pop .22s steps(4);
}
.terrain-confirm { width: min(430px, calc(100% - 32px)); margin: auto; color: var(--text); }
.terrain-confirm::backdrop { background: rgba(0, 0, 0, .72); }
#terrain-form { display: grid; gap: 12px; }
#terrain-form .terrain-actions { justify-content: flex-end; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal-head h2 { font: var(--f-head); text-shadow: 2px 2px 0 #000; }
.modal-head p { margin-top: 8px; color: var(--text-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px); } }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 20px 0 18px; }
.segmented button {
  min-height: 38px;
  padding-bottom: 2px;
  border: 2px solid var(--edge);
  background: var(--surface-3);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -3px 0 var(--lo);
  color: var(--text-2);
}
.segmented button:hover { border-color: #fff; color: #fff; }
.segmented button[aria-selected="true"] {
  background: var(--stone);
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -3px 0 var(--stone-lo);
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .42);
}

#auth-form { display: grid; gap: 14px; }
.steps { display: grid; gap: 8px; padding: 12px; border: 2px solid var(--edge); background: rgba(0, 0, 0, .3); box-shadow: var(--slot); color: var(--text-2); }
.step { display: flex; align-items: center; gap: 10px; }
.step-n { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto; padding-bottom: 2px; background: var(--accent); color: var(--accent-ink); }
.step code { padding: 0 6px 2px; background: #000; color: var(--accent); font: inherit; }
.code-input { font: var(--f-head) !important; letter-spacing: 6px; text-transform: uppercase; text-align: center; }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 46px; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }

/* ------------------------------------------------------------ lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  background: rgba(0, 0, 0, .93);
  animation: fade .2s;
}
.lightbox figure { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0; min-width: 0; max-height: 100dvh; padding: 56px 0 20px; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 130px); object-fit: contain; box-shadow: 0 0 0 2px var(--edge), 0 0 0 4px rgba(255, 255, 255, .25); }
.lightbox figcaption { display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.lightbox .icon-btn { width: 44px; height: 44px; margin: 0 auto; border-color: var(--edge); background: var(--stone); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -3px 0 var(--stone-lo); color: #fff; }
.lightbox .icon-btn:hover { border-color: #fff; }
.lb-close { position: absolute; top: 14px; right: 14px; }
.lb-prev { grid-column: 1; grid-row: 1; }
.lb-next { grid-column: 3; grid-row: 1; }
.lb-count { color: var(--text-3); }

/* -------------------------------------------------------------- toasts --- */
.toasts { position: fixed; z-index: 70; left: 50%; bottom: 60px; display: grid; gap: 8px; justify-items: center; transform: translateX(-50%); pointer-events: none; }
/* Like an advancement pop-up. */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, 90vw);
  padding: 9px 16px 11px 12px;
  border: 2px solid var(--edge);
  background: #212428;
  box-shadow: inset 2px 2px 0 #5a6068, inset -2px -2px 0 #0d0f11, var(--shadow);
  animation: toast-in .25s steps(4);
}
.toast svg.icon { color: var(--accent); }
.toast.error svg.icon { color: var(--danger); }
.toast.leaving { opacity: 0; transition: opacity .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* -------------------------------------------------------------- mobile --- */
@media (max-width: 760px) {
  :root { --gap: 8px; }

  .hud-left { top: var(--gap); left: var(--gap); right: calc(var(--gap) + 52px); bottom: auto; width: auto; }
  .topbar { flex-direction: row; align-items: center; padding: 6px; gap: 8px; }
  .brand-text, .search-kbd { display: none; }
  .search { flex: 1; min-width: 0; }

  .hud-right { top: var(--gap); right: var(--gap); flex-direction: column-reverse; align-items: flex-end; }
  .status { height: 30px; padding: 0 10px 2px; }
  .account-btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .account-btn .name, .account-btn .label { display: none; }
  .account-btn.signed-in { padding: 0; }
  .account-btn .avatar { width: 32px; height: 32px; }

  /* The sidebar becomes a bottom sheet that peeks above the map. */
  .sidebar {
    position: fixed;
    z-index: 25;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(64dvh, 520px);
    padding: 0 12px calc(10px + env(safe-area-inset-bottom));
    border-width: 2px 0 0;
    transform: translateY(calc(100% - var(--peek)));
    transition: transform .4s var(--ease);
  }
  .sidebar.expanded { transform: none; }
  .sheet-handle { display: grid; place-items: center; width: 100%; height: 26px; flex: 0 0 auto; padding: 0; border: 0; background: none; }
  .sheet-handle span { width: 40px; height: 4px; background: var(--line-strong); }
  .sidebar-foot { display: none; }

  .map-controls { bottom: calc(var(--peek) + 10px); }
  .map-readout { display: none; }
  .toasts { bottom: calc(var(--peek) + 14px); }

  body.drawer-open .hud-right, body.drawer-open .map-controls { right: var(--gap); }
  .drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 92dvh;
    border-width: 2px 0 0;
    transform: translateY(105%);
  }
  .drawer-pad { padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
  .hero-art { left: 16px; }

  .lightbox { grid-template-columns: 8px 1fr 8px; }
  .lightbox .lb-prev, .lightbox .lb-next { position: absolute; bottom: 18px; }
  .lightbox .lb-prev { left: 18px; }
  .lightbox .lb-next { right: 18px; }
  .modal { padding: 10px; align-items: end; }
  .modal-card { padding: 24px 20px; }
}

@media (hover: none) {
  .map-readout .coords { display: none; }
  .photo-by { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
