/* Explore 3D (/explore): the first-person platform city. Loaded only by explore.php. */

.xp-main { gap: 26px; }

.xp-stage {
  --xp-ink: #0b1533;
  --xp-blue: #1463ff;
  --xp-mint: #6ff0bc;
  --xp-mint-d: #0e9f6e;
  --xp-amber: #ffb547;
  --xp-violet: #8b5cf6;
  position: relative;
  width: 100%;
  height: 78vh;
  min-height: 460px;
  max-height: 980px;
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  background-color: #0b1533;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 22px 22px;
  color: #fff;
  box-shadow: 0 30px 70px -30px rgba(11, 21, 51, .55);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.xp-stage:fullscreen { border-radius: 0; height: 100vh; max-height: none; }

.xp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

/* ---- Start / pause overlay ---- */
.xp-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 15% 0%, rgba(20, 99, 255, .38), transparent 65%),
    radial-gradient(700px 380px at 100% 100%, rgba(14, 159, 110, .30), transparent 60%),
    rgba(11, 21, 51, .62);
  backdrop-filter: blur(2px);
  transition: opacity .25s ease;
}
.xp-overlay.is-hidden { opacity: 0; pointer-events: none; }
.xp-overlay-box { max-width: 620px; text-align: center; }
.xp-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--xp-mint);
}
.xp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--xp-mint); box-shadow: 0 0 0 4px rgba(111, 240, 188, .22); }
.xp-overlay h1 {
  margin: 16px 0 10px;
  font-family: var(--display, Inter, sans-serif);
  font-size: clamp(30px, 4.6vw, 54px); line-height: 1.02; letter-spacing: -0.03em; color: #fff;
}
.xp-overlay h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #8fb6ff, var(--xp-mint));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.xp-lede { margin: 0 auto 22px; max-width: 520px; color: #c9d3ea; font-size: 16.5px; line-height: 1.55; }
.xp-start {
  appearance: none; border: 0; cursor: pointer;
  min-width: 230px; height: 56px; padding: 0 30px; border-radius: 16px;
  font: 800 17px/1 var(--display, Inter, sans-serif); letter-spacing: -0.01em;
  color: #fff; background: linear-gradient(120deg, #1463ff 0%, #2f7bff 40%, #13b88b 100%);
  box-shadow: 0 14px 34px rgba(19, 184, 139, .35), 0 2px 6px rgba(20, 99, 255, .3);
  transition: transform .15s ease, filter .15s ease;
}
.xp-start:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
.xp-start:disabled { cursor: progress; opacity: .7; }
.xp-status { min-height: 1.4em; margin: 12px 0 0; color: #ffd28a; font-size: 14px; }
.xp-status a { color: var(--xp-mint); }
.xp-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 18px; color: #c9d3ea; font-size: 13px; }
.xp-keys[hidden] { display: none; }
.xp-stage kbd {
  display: inline-block; min-width: 22px; padding: 2px 6px; margin-right: 3px;
  border-radius: 6px; border: 1px solid rgba(255, 255, 255, .25); border-bottom-width: 2px;
  background: rgba(255, 255, 255, .08); color: #fff;
  font: 700 11.5px/1.4 Inter, ui-sans-serif, system-ui, sans-serif; text-align: center;
}

/* ---- HUD ---- */
/* No z-index here: the HUD must not form a stacking context, so the tools can sit above the pause overlay. */
.xp-hud { position: absolute; inset: 0; pointer-events: none; }
.xp-cross, .xp-where, .xp-map, .xp-stats { z-index: 3; }
.xp-tools, .xp-fs, .xp-tbtn { z-index: 6; }
.xp-hud[hidden] { display: none; }
.xp-cross {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 1px rgba(11, 21, 51, .35), inset 0 0 0 1px rgba(11, 21, 51, .35);
  transition: transform .12s ease, border-color .12s ease;
}
.xp-cross::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #fff; }
.xp-stage.is-aiming .xp-cross { transform: scale(1.3); border-color: var(--xp-mint); }
.xp-stage.is-touch .xp-cross { display: none; }

.xp-where, .xp-tools, .xp-map, .xp-card, .xp-fs, .xp-tbtn, .xp-stats {
  background-color: rgba(11, 21, 51, .78);
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.xp-where {
  position: absolute; left: 16px; top: 16px; max-width: min(60%, 420px);
  padding: 10px 16px 11px; border-radius: 18px;
}
.xp-where-k { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--xp-mint); }
.xp-where strong { display: block; font: 800 19px/1.15 var(--display, Inter, sans-serif); letter-spacing: -0.01em; }

.xp-map { position: absolute; left: 16px; bottom: 16px; width: 150px; height: 150px; border-radius: 22px; }

.xp-tools {
  position: absolute; right: 16px; top: 16px; width: 260px;
  display: grid; gap: 10px; padding: 14px; border-radius: 22px;
  pointer-events: auto;
}
.xp-stage.is-locked .xp-tools { opacity: .55; }
.xp-field { display: grid; gap: 5px; margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #9fb0d6; }
.xp-field select, .xp-field input {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff;
  font: 600 14px Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: 0; text-transform: none;
}
.xp-field select option { color: #0b1533; }
.xp-field input::placeholder { color: rgba(255, 255, 255, .45); }
.xp-find-row { display: flex; gap: 6px; }
.xp-find-row button {
  flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--xp-blue); color: #fff; font: 800 14px Inter, ui-sans-serif, system-ui, sans-serif;
}
.xp-find-msg { min-height: 0; font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; color: #ffd28a; }
.xp-find-msg:empty { display: none; }

.xp-fs {
  position: absolute; right: 16px; bottom: 16px; width: 42px; height: 42px;
  display: grid; place-items: center; border-radius: 14px; color: #fff; cursor: pointer; pointer-events: auto;
}
.xp-fs svg, .xp-tbtn svg { width: 20px; height: 20px; }
.xp-tbtn { display: none; position: absolute; right: 60px; top: 10px; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: #fff; cursor: pointer; pointer-events: auto; }
.xp-stats { position: absolute; left: 180px; bottom: 16px; padding: 6px 10px; border-radius: 10px; font: 600 12px ui-monospace, Consolas, monospace; }

/* ---- Info card ---- */
.xp-card {
  position: absolute; z-index: 4; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: min(360px, calc(100% - 32px)); padding: 16px 18px 14px; border-radius: 24px;
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, .55);
  animation: xp-in .18s ease-out;
}
.xp-card[hidden] { display: none; }
@keyframes xp-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.xp-card::before { content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--xp-tier, linear-gradient(90deg, var(--xp-blue), var(--xp-mint))); }
.xp-card-top { display: flex; gap: 12px; align-items: center; }
.xp-card-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; background: #fff; padding: 5px; object-fit: contain; }
.xp-card-type { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--xp-mint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 270px; }
.xp-card-name { margin: 2px 0 0; font: 800 21px/1.1 var(--display, Inter, sans-serif); letter-spacing: -0.015em; color: #fff; }
.xp-card-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 13px 0 12px; }
.xp-card-facts div { padding: 7px 9px; border-radius: 12px; background: rgba(255, 255, 255, .07); min-width: 0; }
.xp-card-facts dt { font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #9fb0d6; }
.xp-card-facts dd { margin: 2px 0 0; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-stars { color: var(--xp-amber); letter-spacing: 1px; font-size: 12px; }
.xp-card-go {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border-radius: 13px;
  background: linear-gradient(120deg, #1463ff 0%, #2f7bff 40%, #13b88b 100%);
  color: #fff; font-weight: 800; text-decoration: none; pointer-events: auto;
}
.xp-card-go:hover { filter: brightness(1.08); }
.xp-card-hint { margin: 8px 0 0; text-align: center; font-size: 12px; color: #9fb0d6; }
.xp-stage.is-touch .xp-card-hint { display: none; }

.xp-tier { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 800; font-size: 12.5px; color: #0b1533; }
.xp-tier--platinum { background: linear-gradient(120deg, #e9efff, #b6c7ff); }
.xp-tier--gold { background: linear-gradient(120deg, #ffe08a, #ffb547); }
.xp-tier--silver { background: linear-gradient(120deg, #eef1f6, #c3cbd9); }
.xp-tier--bronze { background: linear-gradient(120deg, #f2c49c, #d08a52); }
.xp-tier--none { background: rgba(255, 255, 255, .14); color: #c9d3ea; }

/* ---- Touch joystick ---- */
.xp-joy {
  position: absolute; z-index: 3; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); background: rgba(11, 21, 51, .35);
  pointer-events: none; display: none;
}
.xp-joy.is-on { display: block; }
.xp-joy span {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px;
  border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
}

/* ---- Crawlable district list ---- */
.xp-list {
  padding: 26px; border-radius: 28px;
  background: rgba(255, 255, 255, .86); border: 1px solid #dbe2ee;
}
.xp-list h2 { margin: 0 0 6px; font-family: var(--display, Inter, sans-serif); font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; color: #0b1533; }
.xp-list-head p { margin: 0 0 18px; max-width: 760px; color: #4b5874; line-height: 1.6; }
.xp-dgrid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.xp-d {
  position: relative; display: grid; gap: 4px; padding: 14px 16px 14px 20px; border-radius: 18px;
  background: #fff; border: 1px solid #e3e9f3; overflow: hidden;
}
.xp-d::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: hsl(var(--h) 70% 55%); }
.xp-d-name { font-weight: 800; color: #0b1533; text-decoration: none; line-height: 1.25; }
.xp-d-name:hover { color: #1463ff; text-decoration: underline; }
.xp-d-count { font-size: 12.5px; font-weight: 700; color: hsl(var(--h) 55% 38%); }
.xp-d-top { font-size: 13px; color: #657086; line-height: 1.45; }
.xp-d-top a { color: #34405a; }

@media (max-width: 720px) {
  .xp-stage { height: 74vh; min-height: 460px; border-radius: 22px; }
  .xp-where { left: 10px; top: 10px; padding: 8px 12px; border-radius: 14px; max-width: calc(100% - 70px); }
  .xp-where strong { font-size: 15px; }
  .xp-tools { display: none; }
  .xp-stage.show-tools .xp-tools { display: grid; left: 10px; right: 10px; top: 66px; width: auto; }
  .xp-map { width: 96px; height: 96px; left: 10px; bottom: auto; top: 70px; border-radius: 16px; }
  .xp-stage.show-tools .xp-map { display: none; }
  .xp-fs { right: 10px; top: 10px; bottom: auto; }
  .xp-tbtn { display: grid; }
  .xp-stage.show-tools .xp-tbtn { background-color: #1463ff; }
  .xp-card { bottom: 12px; padding: 14px; }
  .xp-stats { left: 10px; bottom: auto; top: 172px; }
  .xp-list { padding: 18px; border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .xp-card { animation: none; }
  .xp-overlay { transition: none; }
}
