/* The live world map (/world, pages/world.html, static/world.js): the game's own world map, its spots, a glow where players
   are now, and a card of who's there. The stage is the map at the game's own size (636 × 466), scaled by --s to fit; what
   must keep its size on screen (the counts, the tap areas) is scaled back by 1 / --s. */
.wm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin-bottom: 18px; }
.wm-head .page-sub { max-width: 62ch; }
.wm-now { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-16, 16px); color: var(--f-text-2); }
.wm-now b { font-size: var(--fs-24, 24px); color: var(--f-head); font-variant-numeric: tabular-nums; }
.wm-now .fh-live { animation: wm-live 2s ease-in-out infinite; }
@keyframes wm-live { 50% { box-shadow: 0 0 0 7px rgba(47, 158, 42, .08); } }

.wm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.wm-card .window-title { gap: 8px 14px; }

/* the islands, as the game's world map buttons: words, the number on each */
.wm-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.wm-tab { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .1); color: inherit; font-weight: 700; font-size: var(--fs-14, 14px); cursor: var(--cursor-hand, auto);
  transition: background-color .15s, border-color .15s; }
.wm-tab:hover { background: rgba(255, 255, 255, .2); }
.wm-tab[aria-selected="true"] { background: var(--f-yellow); border-color: var(--f-yellow-line); color: var(--f-yellow-ink); }
.wm-tab.part .bi { font-size: .8em; opacity: .7; }
.wm-tab b { min-width: 20px; padding: 0 6px; border-radius: 999px; background: rgba(0, 0, 0, .22); font-size: var(--fs-12, 12px); line-height: 18px; text-align: center; }
.wm-tab[aria-selected="true"] b { background: rgba(35, 27, 0, .14); }

/* the map */
.wm-mapbox { position: relative; background: #a9d8ef; }
.wm-viewport { --s: 1; --cf: 12px; position: relative; width: 100%; overflow: hidden; aspect-ratio: 636 / 466; }
.wm-stage { position: absolute; left: 0; top: 0; transform: scale(var(--s)); transform-origin: 0 0; }
.wm-stage.in { animation: wm-fade .35s ease-out; }
@keyframes wm-fade { from { opacity: 0; } }
.wm-picture { display: block; width: 100%; height: 100%; user-select: none; }
.wm-wait { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--f-text-2); font-size: var(--fs-14, 14px); }

/* a spot: the game's own picture at its own place; a bigger tap area than the picture, kept the same size on screen */
.wm-spot { position: absolute; width: 0; height: 0; padding: 0; border: 0; background: none; cursor: var(--cursor-hand, auto); }
.wm-spot::after { content: ""; position: absolute; left: calc(-14px / var(--s)); top: calc(-14px / var(--s)); width: calc(28px / var(--s)); height: calc(28px / var(--s)); border-radius: 50%; }
.wm-spot > img { position: absolute; z-index: 2; image-rendering: pixelated; pointer-events: none; transition: transform .15s ease-out; }
.wm-spot:hover > img, .wm-spot.open > img { transform: scale(1.3); }
.wm-spot:focus-visible { outline: none; }
.wm-spot:focus-visible::after { outline: calc(3px / var(--s)) solid var(--f-link); outline-offset: calc(2px / var(--s)); }
/* where players are now: the game's glow (its frames, one after another), a ring in the colour of the highest level
   there, and how many */
.wm-spot.on::before { content: ""; position: absolute; z-index: 1; left: -13px; top: -13px; width: 26px; height: 26px; transform: scale(1.7);
  background: url("/static/maps/world/glow.png") 0 0 / 182px 26px no-repeat; image-rendering: pixelated; pointer-events: none;
  animation: wm-glow .9s steps(7) infinite alternate; }
.wm-spot.busy::before { transform: scale(2.3); }
@keyframes wm-glow { to { background-position: -182px 0; } }
.wm-spot.on > img { filter: drop-shadow(0 0 1.5px var(--d)) drop-shadow(0 0 1.5px var(--d)); }
.wm-count { position: absolute; z-index: 3; left: calc(6px / var(--s)); top: calc(-22px / var(--s)); min-width: calc(20px / var(--s));
  padding: 0 calc(5px / var(--s)); border-radius: 999px; background: #10203a; color: #fff; border: calc(2px / var(--s)) solid var(--d);
  font: 800 calc(var(--cf) / var(--s)) / calc((var(--cf) + 5px) / var(--s)) var(--font-display, inherit); text-align: center; pointer-events: none;
  box-shadow: 0 calc(2px / var(--s)) calc(6px / var(--s)) rgba(0, 0, 0, .35); }
/* someone just arrived: a ring goes out once */
.wm-spot.ping::after { animation: wm-ping 1.2s ease-out; }
@keyframes wm-ping { from { box-shadow: 0 0 0 0 var(--d); } to { box-shadow: 0 0 0 calc(26px / var(--s)) transparent; } }
/* a spot that opens a map of its own (Sleepywood): a ring of dashes turning around it */
.wm-spot.has-part > img { outline: none; }
.wm-spot.has-part::before { content: ""; position: absolute; z-index: 1; left: -17px; top: -17px; width: 34px; height: 34px; border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(11, 42, 64, .35); pointer-events: none; animation: wm-turn 9s linear infinite; }
.wm-spot.has-part.on::before { left: -13px; top: -13px; width: 26px; height: 26px; border: 0; box-shadow: none; transform: scale(2.3); animation: wm-glow .9s steps(7) infinite alternate; }
@keyframes wm-turn { to { transform: rotate(1turn); } }
/* the game's "you are here" arrow, bobbing on your spot */
.wm-here { position: absolute; z-index: 4; width: 18px; height: 42px; margin: -42px 0 0 -9px; transform: scale(calc(.8 / var(--s)));
  transform-origin: 50% 100%; background: url("/static/maps/world/here.png") 0 0 / 72px 42px no-repeat; image-rendering: pixelated;
  pointer-events: none; animation: wm-bob .72s steps(4) infinite; }
@keyframes wm-bob { to { background-position: -72px 0; } }

/* who's there: a card like the game's own tooltips */
.wm-tip { --ax: 50%; position: absolute; z-index: 10; width: min(300px, calc(100% - 16px)); max-height: 360px; overflow: auto; padding: 12px 14px;
  border-radius: 10px; background: rgba(13, 24, 44, .95); color: #eef3fb; border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 12px 30px rgba(6, 18, 36, .35); font-size: var(--fs-13, 13px); line-height: 1.35; scrollbar-width: thin; }
.wm-tip.in { animation: wm-tip .14s ease-out; }
@keyframes wm-tip { from { opacity: 0; transform: translateY(6px); } }
.wm-tip.below.in { animation-name: wm-tip-down; }
@keyframes wm-tip-down { from { opacity: 0; transform: translateY(-6px); } }
.wm-tip.docked { position: relative; width: auto; max-height: none; margin: 0; border-radius: 0; border-width: 1px 0 0; box-shadow: none; }
.wm-tip-h { display: flex; flex-direction: column; gap: 1px; }
.wm-tip-h b { color: #ffd25a; font-size: var(--fs-16, 16px); font-family: var(--font-display, inherit); }
.wm-tip-h span { color: #b9c6da; }
.wm-tip-map { margin-top: 10px; padding-top: 9px; border-top: 1px solid rgba(255, 255, 255, .12); }
.wm-tip-name { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; color: #fff; }
.wm-tip :is(b, strong, p, li, span) { --bs-body-color: #eef3fb; }
.wm-tip-name small { color: #b9c6da; font-weight: 700; }
.wm-mobs { display: block; color: #9fb0c8; font-size: var(--fs-12, 12px); }
.wm-tip-part { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; color: #ffd25a; font-weight: 700; font-size: var(--fs-12, 12px); }
/* the map's main monsters, walking: their own walk from the game, to and fro on a strip of ground */
.wm-mobstrip { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 7px; }
.wm-mobstrip figure { display: flex; flex-direction: column; align-items: center; gap: 3px; margin: 0; min-width: 0; }
.wm-mobstrip figcaption { max-width: 100%; color: #fff; font-size: var(--fs-12, 12px); font-weight: 600; line-height: 1.25; text-align: center; }
.wm-mobstrip figcaption b { display: block; color: #b9c6da; font-weight: 600; }
.wm-walk { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 62px; overflow: hidden;
  border-bottom: 2px solid rgba(255, 255, 255, .14); background: radial-gradient(60% 18px at 50% 100%, rgba(255, 255, 255, .08), transparent); }
.wm-walk img { width: auto; height: auto; max-height: 56px; max-width: 110px; image-rendering: auto;
  animation: wm-walk 7s linear infinite; animation-delay: calc(var(--i, 0) * -2.3s); }
/* (the game's monsters face left: walk left, turn, walk back) */
@keyframes wm-walk {
  0% { transform: translateX(18px); }
  46% { transform: translateX(-18px); }
  50% { transform: translateX(-18px) scaleX(-1); }
  96% { transform: translateX(18px) scaleX(-1); }
  100% { transform: translateX(18px); }
}
.wm-quiet { color: #b9c6da !important; font-weight: 600 !important; }
.wm-mobs b { color: #d6deea; font-weight: 600; }
.wm-people { list-style: none; margin: 7px 0 0; padding: 0; display: grid; gap: 5px; }
.wm-people.anon { display: flex; flex-wrap: wrap; gap: 5px; }
.wm-people li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.wm-people li.me { margin: 0 -6px; padding: 3px 6px; border-radius: 6px; background: rgba(255, 210, 90, .12); }
.wm-lv { min-width: 30px; padding: 1px 5px; border-radius: 6px; background: var(--d); color: #fff; font-weight: 800; font-size: var(--fs-12, 12px);
  text-align: center; text-shadow: 0 1px 1px rgba(0, 0, 0, .45); font-variant-numeric: tabular-nums; }
.wm-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; min-width: 0; }
.wm-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: #fff; }  /* (a panel's own colours are for light panels) */
.wm-who em { font-style: normal; font-size: var(--fs-11, 11px); font-weight: 800; color: #231b00; background: #ffd25a; padding: 0 5px; border-radius: 4px; }
.wm-who small { flex-basis: 100%; color: #9fb0c8; font-size: var(--fs-12, 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-rate { color: #b8ec4a; font-weight: 800; font-variant-numeric: tabular-nums; }
.wm-rate small { color: #9fb0c8; font-weight: 600; }
.wm-more, .wm-tip-foot { margin: 6px 0 0; color: #9fb0c8; font-size: var(--fs-12, 12px); }
.wm-tip-foot { margin-top: 10px; }

.wm-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 10px 14px;
  font-size: var(--fs-13, 13px); color: var(--f-text-2); border-top: 1px solid var(--f-line); }
.wm-key { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.wm-credit { flex-basis: 100%; font-size: var(--fs-12, 12px); }
.wm-key span { display: inline-flex; align-items: center; gap: 6px; }
.wm-key i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--d); box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, .25); }

/* the busiest maps, next to it */
.wm-side-body { padding: 10px; }
.wm-busy { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wm-busy button { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: none; color: inherit; text-align: left; cursor: var(--cursor-hand, auto); transition: background-color .15s; }
.wm-busy button:hover { background: rgba(10, 104, 173, .07); }
.wm-busy-n { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 999px; background: #10203a; color: #fff;
  border: 2px solid var(--d); font-weight: 800; font-variant-numeric: tabular-nums; }
.wm-busy-t { display: flex; flex-direction: column; min-width: 0; }
.wm-busy-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--f-head); font-weight: 700; }
.wm-busy-t small { color: var(--f-text-2); font-size: var(--fs-12, 12px); }
.wm-you { font-style: normal; font-size: var(--fs-11, 11px); font-weight: 800; color: var(--f-yellow-ink); background: var(--f-yellow); padding: 1px 6px; border-radius: 4px; }
.wm-empty { padding: 8px 10px; color: var(--f-text-2); font-size: var(--fs-14, 14px); }
.wm-note { margin: 8px 10px 4px; color: var(--f-text-2); font-size: var(--fs-13, 13px); }
.wm-note:empty { display: none; }

@media (max-width: 1100px) {
  .wm-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .wm-viewport { --cf: 10px; }  /* (a small map: smaller counts, or they cover each other) */
  .wm-count { left: calc(3px / var(--s)); top: calc(-17px / var(--s)); min-width: calc(16px / var(--s)); padding: 0 calc(3px / var(--s)); }
}
@media (prefers-reduced-motion: reduce) {
  .wm-spot.on::before, .wm-spot.has-part::before, .wm-spot.ping::after, .wm-here, .wm-now .fh-live, .wm-walk img { animation: none; }
  .wm-spot > img { transition: none; }
}
