/* GM map picker (Jenny, 30 Oct). Full-screen wheel. Colours are the mockup's dark ground and gold. */
@font-face {
  font-family: "Gmp Gelasio";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../fonts/gelasio-700-normal-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Gmp Roboto";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../fonts/roboto-400-normal-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Gmp Roboto";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../../fonts/roboto-500-normal-latin.woff2") format("woff2");
}

.gmp {
  --gmp-gold: var(--c-gold-65);
  --gmp-ink: var(--c-paper-87);
  --gmp-mut: var(--c-gold-62-f); /* was #a8977a (31 Oct colour sweep) */
  --gmp-line: rgb(from var(--c-gold-65) r g b / 0.28);
  position: absolute;
  /* (11 Nov, Tom's Chromebook photo) stop above the Android bottom inset: the native shell paints an opaque band
     there (hearth-native.js), which hid Use map and cut the thumbnail strip. 0 in a browser. */
  inset: 0 0 var(--hearth-safe-bottom, 0px) 0;
  z-index: 40;
  /* Header, preview (the rest of the height), chips, then a short carousel strip.
     A fixed tall wheel was what collapsed the preview on a landscape Fold. */
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-columns: minmax(0, 1fr);
  background: var(--c-night-05);
  color: var(--gmp-ink);
  font: 15px/1.35 "Gmp Roboto", Roboto, "Segoe UI", sans-serif;
  overflow: hidden;
}
.gmp button, .gmp input { font: inherit; color: inherit; }
.gmp button { cursor: pointer; }
.gmp svg { display: block; }

.gmp-top {
  flex: 0 0 60px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: linear-gradient(180deg, var(--c-night-08), var(--c-night-06));
  border-bottom: 1px solid var(--gmp-line);
}
.gmp-flame { width: 30px; height: 30px; flex: none; }
.gmp-title { flex: 1; min-width: 0; }
.gmp-title b {
  display: block;
  font: 700 21px/1.1 "Gmp Gelasio", Gelasio, Georgia, serif;
  color: var(--gmp-gold);
}
.gmp-title span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--gmp-mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gmp-chip {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--gmp-line);
  background: rgb(from var(--c-white) r g b / 0.03);
  color: var(--gmp-ink);
  font: 500 14px/1 "Gmp Roboto", Roboto, "Segoe UI", sans-serif;
  white-space: nowrap;
  flex: none;
}
.gmp-chip svg { width: 17px; height: 17px; }
.gmp-chip.gmp-x { width: 40px; padding: 0; }
.gmp-search {
  flex: 1;
  min-width: 0;
  height: 40px;
  border-radius: 20px;
  border: 1px solid rgb(from var(--c-gold-65) r g b / 0.45);
  background: rgb(from var(--c-black) r g b / 0.35);
  color: var(--gmp-ink);
  padding: 0 14px;
  font: 500 15px/1 "Gmp Roboto", Roboto, "Segoe UI", sans-serif;
}

.gmp-stage {
  min-height: 0;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  padding: 6px 12px 2px;
  gap: 6px;
}
.gmp-fit {
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gmp-pv {
  --gmp-cols: 20;
  --gmp-rows: 15;
  position: relative;
  flex: none;
  /* Pixel size is set in JS to the board's columns/rows, the largest that fits. */
  aspect-ratio: var(--gmp-cols) / var(--gmp-rows);
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgb(from var(--c-black) r g b / 0.55), 0 0 0 1px rgb(from var(--c-gold-65) r g b / 0.35);
  background: var(--c-night-07);
}
/* The board paints the art at 100% by 100% of the grid, so the preview does too: no crop, no extra zoom. */
.gmp-pv img { width: 100%; height: 100%; object-fit: fill; display: block; }
.gmp-pv .gmp-empty { width: 100%; height: 100%; display: block; }
.gmp-pv .gmp-empty, .gmp-card .gmp-empty {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--c-night-07);
  color: var(--c-white);
  font: 600 13px/1.2 "Gmp Roboto", Roboto, sans-serif;
  text-align: center;
  padding: 8px;
}
.gmp-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Same thin black grid the GM battle board draws, one line a square. */
  background-image:
    linear-gradient(rgb(from var(--c-black) r g b / 0.6) 1px, transparent 1px),
    linear-gradient(90deg, rgb(from var(--c-black) r g b / 0.6) 1px, transparent 1px);
  background-size:
    calc(100% / var(--gmp-cols, 20)) calc(100% / var(--gmp-rows, 15)),
    calc(100% / var(--gmp-cols, 20)) calc(100% / var(--gmp-rows, 15));
}
.gmp-cap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  max-width: 100%;
}
.gmp-cap b {
  font: 700 22px/1.15 "Gmp Gelasio", Gelasio, Georgia, serif;
  color: var(--gmp-ink);
}
.gmp-cap span { color: var(--gmp-mut); font-size: 13px; white-space: nowrap; }

.gmp-cats {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap; /* (19 Nov update) wrap: "Water", "Hazard" were cut at the edge on phones */
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 8px 12px 4px;
  overflow: hidden;
}
.gmp-cats button {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--gmp-line);
  background: rgb(from var(--c-white) r g b / 0.03);
  color: var(--gmp-ink);
  font: 500 14px/1 "Gmp Roboto", Roboto, sans-serif;
  white-space: nowrap;
  flex: none;
}
.gmp-cats button i { font-style: normal; color: var(--gmp-mut); font-size: 12px; font-weight: 500; }
.gmp-cats button.on {
  background: linear-gradient(180deg, var(--c-gold-72-c), var(--c-gold-56));
  color: var(--c-umber-10);
  border-color: var(--c-gold-76-d);
  font-weight: 700;
}
.gmp-cats button.on i { color: var(--c-umber-10); }

.gmp-wheel {
  position: relative;
  /* (19 Nov update) tall enough that "Use map" sits under the cards, not over their names (it covered "Crypt") */
  height: 172px;
  max-height: 28%;
  min-height: 166px;
  overflow: hidden;
  background: radial-gradient(120% 100% at 50% 100%, var(--c-night-12) 0%, var(--c-night-06) 70%);
  border-top: 1px solid var(--gmp-line);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.gmp-wheel:focus { outline: none; }
.gmp-wheel:focus-visible { outline: 2px solid rgb(from var(--c-gold-65) r g b / 0.55); outline-offset: -2px; }
.gmp-rim {
  position: absolute;
  left: 50%;
  width: 2800px;
  height: 2800px;
  margin-left: -1400px;
  top: 28px;
  border-radius: 50%;
  border: 1px dashed rgb(from var(--c-gold-65) r g b / 0.22);
  pointer-events: none;
}
.gmp-notch {
  position: absolute;
  left: 50%;
  top: 6px;
  margin-left: -10px;
  z-index: 6;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid var(--gmp-gold);
  pointer-events: none;
}
.gmp-track {
  position: absolute;
  left: 0;
  top: 6px;
  display: flex;
  align-items: flex-start;
  width: max-content;
  column-gap: 8px;
  will-change: transform;
}
.gmp-card {
  position: relative;
  width: 148px;
  height: 96px;
  min-width: 44px;
  min-height: 44px;
  flex: none;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgb(from var(--c-gold-65) r g b / 0.35);
  background: var(--c-black);
  box-shadow: 0 6px 14px rgb(from var(--c-black) r g b / 0.5);
  transform-origin: 50% 70%;
  transform: translateY(calc(var(--off, 0) * var(--off, 0) * 6px)) rotate(calc(var(--off, 0) * 4deg)) scale(calc(1.02 - min(0.18, abs(var(--off, 0)) * 0.06)));
  z-index: var(--z, 1);
}
.gmp-card img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.gmp-card .nm {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 6px 3px;
  font: 600 11px/1.15 "Gmp Roboto", Roboto, sans-serif;
  text-align: center;
  color: var(--c-white);
  background: linear-gradient(transparent, rgb(from var(--c-black) r g b / 0.72));
  text-shadow: 0 1px 2px var(--c-black);
  pointer-events: none;
}
.gmp:not(.is-browsing) .gmp-card.is-on {
  border: 3px solid var(--gmp-gold);
  box-shadow: 0 0 0 4px rgb(from var(--c-gold-65) r g b / 0.25), 0 0 34px rgb(from var(--c-gold-65) r g b / 0.45), 0 12px 26px rgb(from var(--c-black) r g b / 0.6);
}
.gmp-use, .gmp-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 8;
}
.gmp-use {
  height: 44px;
  min-width: 148px;
  min-height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 2px solid var(--c-gold-82-b);
  background: linear-gradient(180deg, var(--c-gold-75), var(--c-gold-54-b));
  color: var(--c-umber-10);
  font: 700 16px/1 "Gmp Gelasio", Gelasio, Georgia, serif;
  box-shadow: 0 0 0 6px rgb(from var(--c-gold-65) r g b / 0.18), 0 10px 26px rgb(from var(--c-black) r g b / 0.6);
}
.gmp-use svg { width: 20px; height: 20px; }
.gmp.is-browsing .gmp-use { visibility: hidden; }
.gmp-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gmp-mut);
  font-size: 12px;
  white-space: nowrap;
  visibility: hidden;
  pointer-events: none;
}
.gmp.is-browsing .gmp-hint { visibility: visible; }
.gmp-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  display: flex;
  justify-content: center;
  gap: 5px;
  z-index: 6;
}
.gmp-dots i {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgb(from var(--c-gold-65) r g b / 0.3);
  display: block;
}
.gmp-dots i.on { width: 18px; background: var(--gmp-gold); }
.gmp-emptywheel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--gmp-mut);
}

@media (max-width: 599px) {
  .gmp-title b { font-size: 20px; }
  .gmp-chip .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .gmp-chip { width: 40px; padding: 0; position: relative; }
  .gmp-cats { justify-content: center; overflow: visible; } /* (19 Nov update) wrap, never cut */
  .gmp-cats::-webkit-scrollbar { display: none; }
  .gmp-card { width: 112px; height: 72px; }
  .gmp-track { column-gap: 6px; top: 4px; }
  .gmp-rim { width: 1800px; height: 1800px; margin-left: -900px; top: 22px; }
  .gmp-use { min-width: 132px; height: 44px; font-size: 15px; bottom: 16px; }
  .gmp-cap b { font-size: 18px; }
  .gmp-wheel { height: 144px; min-height: 128px; }
}
@media (min-width: 1000px) {
  .gmp-card { width: 120px; height: 72px; }
  .gmp-rim { width: 3200px; height: 3200px; margin-left: -1600px; top: 18px; }
  .gmp-wheel { height: 148px; }
}
/* Short landscape (Galaxy Fold): the strip stays a strip so the preview keeps the height. */
@media (max-height: 820px) {
  .gmp-top { height: 52px; flex-basis: 52px; }
  .gmp-wheel { height: 132px; min-height: 120px; max-height: 26%; }
  .gmp-card { width: 108px; height: 64px; }
  .gmp-track { top: 2px; }
  .gmp-use { bottom: 14px; }
  .gmp-cap b { font-size: 18px; }
  .gmp-stage { padding-top: 4px; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .gmp-card { transition: none; }
}
/* (1 Nov) audit M8: on a phone "Use map" sat on top of the thumbnails. The strip is taller so the button sits under
   the cards (the preview above has room to spare). */
@media (max-width: 599px) and (min-height: 821px) {
  .gmp-wheel { height: 176px; min-height: 176px; max-height: 32%; flex-shrink: 0; }
  .gmp-use { bottom: 14px; }
}
/* (v2d add-on, Tom 13 Nov 19:04) "No map", the first choice in the picker */
.gmp .gmp-nomapbox { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px 20px; text-align: center; }
.gmp .gmp-nomapbox p { margin: 0; max-width: 420px; color: var(--c-paper-78); font: 14px/1.4 Roboto, system-ui, sans-serif; }
.gmp .gmp-nomapbox .gmp-use { position: static; transform: none; left: auto; bottom: auto; }
/* Tom 13 Nov 20:46: "Use map" / "Remove the map" read as greyed out (the theme's pale button text on gold). Dark text. */
html:root[data-palette][data-palette][data-palette][data-palette] body .gmp-use[class], html:root[data-palette][data-palette][data-palette][data-palette] body .gmp-use[class] svg { color: var(--c-umber-07) !important; -webkit-text-fill-color: var(--c-umber-07) !important; }
/* (19 Nov update) short screens (Fold open, laptop, Fold cover): the strip was too short, so "Use map" covered the
   bottom of the picked card and its neighbours. A little taller so the button sits under them. */
@media (max-height: 820px) {
  .gmp .gmp-wheel { height: 156px; min-height: 150px; max-height: 32%; }
  .gmp .gmp-use { bottom: 8px; }
}
