/* Gameficate cartridge — Map area: keyboard cross, checklist, coordinates, zoom, projection switch, gesture hint, toast and fact card. */
#map-host:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: -4px;
}
/* ---------- Keyboard crosshair (shown while playing with the keyboard) ---------- */
/* It sits in the centre; when the map can't move, Shift + arrows move it (--kx, --ky from KeyboardControls). */
.kbd-cross {
  position: absolute;
  left: calc(50% + var(--kx, 0px));
  top: calc(50% + var(--ky, 0px));
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  z-index: 2;
  pointer-events: none;
  display: none;
}
.kbd-cross::before,
.kbd-cross::after {
  content: '';
  position: absolute;
  background: var(--navy);
  box-shadow: 0 0 0 2px #fff;
}
.kbd-cross::before {
  left: 21px;
  top: 0;
  width: 2px;
  height: 44px;
}
.kbd-cross::after {
  top: 21px;
  left: 0;
  height: 2px;
  width: 44px;
}
#mapPanel.kbd .kbd-cross {
  display: block;
}

#mapPanel {
  flex: 0 0 var(--map-w, 1520px);
  width: var(--map-w, 1520px);
  height: var(--map-h, 930px);
  position: relative;
  background: var(--sea-deep);
  overflow: hidden;
}
/* ---------- The map canvas and its floating overlays ---------- */
#map-host,
#map-host canvas {
  position: absolute;
  inset: 0;
  width: var(--map-w, 1520px);
  height: var(--map-h, 930px);
  display: block;
  touch-action: none;
}
#map-host canvas {
  cursor: crosshair;
}
#map-host.classic canvas {
  cursor: default;
}
#map-host.pointing canvas {
  cursor: pointer;
}
#map-host.grabbing canvas {
  cursor: grabbing;
}
.map-overlay {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}
.map-overlay > * {
  pointer-events: auto;
}
.glass {
  background: rgba(255, 255, 255, 0.93);
  border: 2px solid rgba(23, 50, 77, 0.08);
  box-shadow: 0 6px 18px rgba(23, 50, 77, 0.16);
  backdrop-filter: blur(6px);
}
/* ---------- "Show on map" checklist ---------- */
.layerbar {
  left: 16px;
  right: 16px;
  top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: calc(16px * var(--rs, 1));
  pointer-events: auto;
}
.layerbar .lb-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 6px 0 4px;
  white-space: nowrap;
}
.layer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 7px;
  border-radius: calc(12px * var(--rs, 1));
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
  background: var(--soft);
  border: 2px solid var(--line);
  white-space: nowrap;
  flex: 0 0 auto;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.layer-chip .box {
  width: 20px;
  height: 20px;
  border-radius: calc(6px * var(--rs, 1));
  border: 2px solid var(--edge);
  background: var(--card);
  display: grid;
  place-items: center;
}
.layer-chip .box svg {
  opacity: 0;
}
.layer-chip[aria-pressed='true'] {
  background: color-mix(in srgb, var(--teal) 12%, var(--card));
  border-color: color-mix(in srgb, var(--teal) 45%, var(--card));
}
.layer-chip[aria-pressed='true'] .box {
  background: var(--teal);
  border-color: var(--teal);
}
.layer-chip[aria-pressed='true'] .box svg {
  opacity: 1;
}
.layer-chip img {
  width: 20px;
  height: 20px;
}
/* ---------- Coordinates read-out and zoom buttons ---------- */
.coords {
  left: 20px;
  bottom: 20px;
  padding: 10px 16px;
  border-radius: calc(14px * var(--rs, 1));
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  min-width: 260px;
}
.coords .lbl {
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}
.zoombar {
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: calc(18px * var(--rs, 1));
  overflow: hidden;
}
.zoombar button {
  width: 64px;
  height: 60px;
  display: grid;
  place-items: center;
  color: var(--navy);
  transition: background 0.12s;
}
.zoombar button:hover {
  background: var(--soft);
}
.zoombar .zpct {
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  color: var(--muted);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.zoombar .zreset {
  border-top: 2px solid var(--line);
}
/* Player projection switch (only when the author allows it). */
.projbox {
  right: 20px;
  bottom: 262px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.projbtn {
  height: 52px;
  padding: 0 16px 0 12px;
  border-radius: calc(16px * var(--rs, 1));
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 900;
  color: var(--navy);
}
.projbtn .pi {
  font-size: 22px;
}
.projbtn small {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 900;
  line-height: 1;
}
.projbtn span.pn {
  display: block;
  line-height: 1.15;
}
.projmenu {
  order: -1;
  min-width: 230px;
  padding: 6px;
  border-radius: calc(16px * var(--rs, 1));
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.projmenu button {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px;
  border-radius: calc(11px * var(--rs, 1));
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  text-align: start;
}
.projmenu button:hover {
  background: var(--soft);
}
.projmenu button.on {
  background: color-mix(in srgb, var(--teal) 12%, var(--card));
}
.projmenu button .ck {
  width: 20px;
  color: var(--teal);
  font-weight: 900;
}
.projbusy {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(168, 216, 236, 0.55);
  font-size: 20px;
  font-weight: 900;
  color: var(--navy);
  pointer-events: none;
}
/* ---------- Gesture hint, toast and map tooltip ---------- */
.gesture-hint {
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: calc(999px * var(--rs, 1));
  background: rgba(23, 50, 77, 0.88);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  transition: opacity 0.5s;
}
.gesture-hint.hide {
  opacity: 0;
  pointer-events: none;
}
.toast {
  left: 50%;
  top: 84px;
  transform: translate(-50%, -16px);
  padding: 12px 22px;
  border-radius: calc(999px * var(--rs, 1));
  background: var(--navy);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  opacity: 0;
  transition:
    opacity 0.25s,
    transform 0.25s;
  pointer-events: none !important;
  max-width: 1300px;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.tip {
  position: absolute;
  z-index: 4;
  width: 300px;
  padding: 12px 14px;
  border-radius: calc(16px * var(--rs, 1));
  background: var(--card);
  box-shadow: 0 12px 30px rgba(10, 25, 40, 0.28);
  border: 2px solid rgba(23, 50, 77, 0.08);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.15s,
    transform 0.15s;
}
.tip.show {
  opacity: 1;
  transform: none;
}
.tip .tp-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tip .tp-head img {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}
.tip .tp-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}
.tip .tp-kind {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
#layerBar.empty .layer-chip {
  display: none;
}
.layer-chip[hidden] {
  display: none !important;
}
.tip .tp-img {
  margin: -4px -4px 10px;
  border-radius: calc(12px * var(--rs, 1));
  overflow: hidden;
  background: var(--soft);
}
.tip .tp-img img {
  display: block;
  width: 100%;
  max-height: 170px;
  object-fit: cover;
}
.tip .tp-info {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
  margin-top: 8px;
}
.tip .tp-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: calc(999px * var(--rs, 1));
  font-size: 13px;
  font-weight: 900;
  background: color-mix(in srgb, var(--green) 12%, var(--card));
  color: color-mix(in srgb, var(--green) 70%, #000);
}
.tip .tp-badge.locked {
  background: var(--soft);
  color: var(--muted);
}

/* The "Show on map" checklist folds away from its title so it doesn't cover the map. */
.layerbar .lb-title {
  cursor: pointer;
  border-radius: calc(8px * var(--rs, 1));
}
.layerbar .lb-title::after {
  content: ' ▴';
}
.layerbar.folded {
  right: auto;
}
.layerbar.folded .lb-title::after {
  content: ' ▾';
}
.layerbar.folded .layer-chip {
  display: none !important;
}

/* Answer feedback: a pop-up card over the bottom of the map that folds into a pill (js/ui/FeedbackPopup.js). */
.fbpop {
  left: 50%;
  bottom: calc(var(--inset-b, 0px) + 22px);
  transform: translate(-50%, 14px);
  width: min(620px, calc(100% - 360px));
  display: flex;
  flex-direction: column;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.25s,
    visibility 0s 0.25s;
  z-index: 3;
}
.fbpop.show {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
  transition:
    opacity 0.2s,
    transform 0.25s;
}
.fbp-card {
  position: relative;
  width: 100%;
  padding: 6px;
  border-radius: calc(24px * var(--rs, 1));
  background: var(--card);
  box-shadow: 0 18px 50px rgba(10, 25, 40, 0.32);
}
.fbp-card .feedback {
  margin: 0;
  padding: 14px 52px 16px;
}
.fbp-min {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--navy);
  background: color-mix(in srgb, var(--card) 70%, transparent);
}
.fbp-min:hover {
  background: var(--soft);
}
.fbp-pill {
  display: none;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 20px 0 14px;
  border-radius: calc(999px * var(--rs, 1));
  background: var(--card);
  box-shadow: 0 10px 28px rgba(10, 25, 40, 0.28);
  font-size: 17px;
  font-weight: 900;
  color: var(--navy);
  border: 2px solid var(--line);
}
.fbp-pill .ic {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--navy);
  font-size: 16px;
}
.fbp-pill .ar {
  color: var(--muted);
}
.fbpop[data-kind='perfect'] .fbp-pill .ic,
.fbpop[data-kind='correct'] .fbp-pill .ic {
  background: var(--green);
}
.fbpop[data-kind='close'] .fbp-pill .ic,
.fbpop[data-kind='retry'] .fbp-pill .ic {
  background: var(--amber);
}
.fbpop[data-kind='miss'] .fbp-pill .ic {
  background: var(--red);
}
.fbpop.min {
  width: auto;
}
.fbpop.min .fbp-card {
  display: none;
}
.fbpop.min .fbp-pill {
  display: inline-flex;
  animation: pop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}

/* The question bar over the map while the question panel is folded away (js/ui/MiniQuestion.js). */
.miniq {
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  width: min(1240px, calc(100% - 150px));
  min-height: var(--mini-h, 78px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 8px 16px;
  border-radius: calc(20px * var(--rs, 1));
  pointer-events: auto;
  z-index: 3;
}
.miniq .mq-num {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: calc(999px * var(--rs, 1));
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.miniq .mq-prompt {
  flex: 1;
  min-width: 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.miniq.full .mq-prompt {
  white-space: normal;
}
.miniq .mq-act {
  flex: 0 0 auto;
  height: 54px;
  padding: 0 24px;
  border-radius: calc(16px * var(--rs, 1));
  background: linear-gradient(180deg, color-mix(in srgb, var(--orange) 72%, #fff), var(--orange));
  color: #fff;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  box-shadow: inset 0 -4px 0 var(--orange-d);
  white-space: nowrap;
}
.miniq .mq-act.teal {
  background: linear-gradient(180deg, color-mix(in srgb, var(--teal) 80%, #fff), var(--teal));
  box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--teal) 80%, #000);
}
.miniq .mq-act:disabled {
  opacity: 0.45;
  filter: grayscale(0.4);
}
.miniq .mq-open {
  flex: 0 0 auto;
  height: 54px;
  padding: 0 16px;
  border-radius: calc(16px * var(--rs, 1));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--soft);
  border: 2px solid var(--line);
  color: var(--navy);
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
}
.miniq .mq-open:hover {
  background: var(--soft3);
}
