/* Trustelya Virtual Expo — walkable hall (full-screen). Evidence Desk glass UI over Three.js. */

.xp-body {
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  overscroll-behavior: none;
}
.xp {
  position: fixed;
  inset: 0;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
}
.xp-canvas,
.xp-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.xp kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.05em 0.4em;
  margin: 0 0.1em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--white);
  font: 600 0.78em/1.4 var(--font-body);
  text-align: center;
  color: var(--ink);
}

/* glass surface */
.xp-hud,
.xp-panel,
.xp-prompt,
.xp-toast,
.xp-where,
.xp-btn,
.xp-minimap {
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(154, 171, 163, 0.55);
  box-shadow: 0 8px 28px rgba(18, 24, 22, 0.1);
}

/* HUD */
.xp-hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-radius: 12px;
  z-index: 5;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.is-playing .xp-hud {
  opacity: 1;
  transform: none;
}
.xp-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font: 600 1.15rem/1 var(--font-display);
}
.xp-brand em {
  color: var(--teal);
  font-style: normal;
}
.xp-brand small {
  font: 600 0.7rem/1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-left: 4px;
}
.xp-where {
  margin: 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--teal);
  box-shadow: none;
}
.xp-where.pulse {
  animation: xpPulse 0.6s var(--ease);
}
@keyframes xpPulse {
  0% {
    transform: scale(0.94);
    background: rgba(20, 122, 102, 0.18);
  }
  100% {
    transform: none;
  }
}
.xp-hud-actions {
  display: flex;
  gap: 8px;
}
.xp-btn {
  font: 600 0.88rem/1 var(--font-body);
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
}
.xp-btn:hover {
  border-color: var(--teal);
}
.xp-btn--solid {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}
.xp-btn--solid:hover {
  background: var(--teal-bright);
}
.xp-btn kbd {
  font-size: 0.7em;
  margin-left: 4px;
}

.xp-minimap {
  position: absolute;
  right: 12px;
  top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  width: 168px;
  height: 132px;
  border-radius: 10px;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.4s;
  padding: 0;
}
.is-playing .xp-minimap {
  opacity: 1;
}

/* prompt + toast */
.xp-prompt {
  position: absolute;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 11px 18px;
  border-radius: 999px;
  font: 600 0.98rem/1.2 var(--font-body);
  color: var(--ink);
  cursor: pointer;
  z-index: 5;
  animation: xpRise 0.25s var(--ease);
}
.xp-prompt kbd {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  margin-right: 6px;
}
.xp-toast {
  position: absolute;
  left: 50%;
  top: calc(max(12px, env(safe-area-inset-top)) + 70px);
  transform: translate(-50%, -6px);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--teal);
  z-index: 6;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s var(--ease);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.xp-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
@keyframes xpRise {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* panel */
.xp-panel {
  --booth-accent: var(--teal);
  position: absolute;
  right: 12px;
  top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  bottom: 12px;
  width: min(400px, calc(100vw - 24px));
  border-radius: 14px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 4px solid var(--booth-accent);
  animation: xpSlide 0.3s var(--ease);
  -webkit-user-select: text;
  user-select: text;
}
.xp-panel[hidden] {
  display: none;
}
@keyframes xpSlide {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
.xp-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.xp-panel-head h2 {
  font: 600 1.35rem/1.2 var(--font-display);
  margin: 2px 0 0;
}
.xp-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--booth-accent, var(--teal));
}
.xp-close {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}
.xp-close:hover {
  border-color: var(--ink-soft);
}
.xp-panel-body {
  padding: 14px 18px 20px;
  overflow-y: auto;
  font-size: 0.97rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.xp-panel-body p {
  margin: 0 0 0.9em;
}
.xp-bubble {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 13px;
  margin: 0 0 10px;
  color: var(--ink);
  animation: xpRise2 0.3s var(--ease);
}
.xp-bubble--me {
  margin-left: 28px;
  border-radius: 14px 4px 14px 14px;
  background: var(--booth-accent);
  border-color: transparent;
  color: #fff;
}
@keyframes xpRise2 {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.xp-label {
  font-size: 0.78rem !important;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 16px 0 8px !important;
}
.xp-chips {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.xp-chip {
  text-align: left;
  font: 500 0.93rem/1.35 var(--font-body);
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}
.xp-chip:hover,
.xp-chip.is-active {
  border-color: var(--booth-accent);
  box-shadow: inset 3px 0 0 var(--booth-accent);
}
.xp-action {
  margin: 2px 0 6px;
}
.xp-note {
  margin-top: 14px !important;
  font-size: 0.82rem;
  color: var(--amber);
}
.xp-dirs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.xp-dir {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  text-align: left;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--c);
  background: var(--white);
  cursor: pointer;
  font-family: var(--font-body);
}
.xp-dir strong {
  font-size: 1.02rem;
  color: var(--ink);
}
.xp-dir span {
  grid-column: 1;
  font-size: 0.85rem;
  color: var(--ink-mute);
}
.xp-dir em {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  font-style: normal;
  font-weight: 700;
  color: var(--c);
}
.xp-dir:hover {
  box-shadow: 0 4px 16px rgba(18, 24, 22, 0.1);
}
.xp-keys {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

/* joystick (touch only) */
.xp-joystick {
  display: none;
  position: absolute;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(26px, env(safe-area-inset-bottom));
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: 2px solid rgba(12, 83, 70, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 5;
  touch-action: none;
}
.xp-joystick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 4px 14px rgba(12, 83, 70, 0.35);
}
@media (pointer: coarse) {
  .is-playing .xp-joystick {
    display: block;
  }
}

/* start screen */
.xp-start {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, rgba(242, 245, 243, 0.35), rgba(242, 245, 243, 0.75));
  z-index: 8;
}
.xp-start[hidden] {
  display: none;
}
.xp-start-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-top: 5px solid var(--teal);
  border-radius: 16px;
  padding: 26px 26px 22px;
  box-shadow: 0 24px 60px rgba(18, 24, 22, 0.16);
  animation: xpRise2 0.5s var(--ease);
}
.xp-start h1 {
  font: 600 clamp(1.7rem, 4vw, 2.3rem) / 1.1 var(--font-display);
  margin: 6px 0 10px;
}
.xp-lede {
  color: var(--ink-soft);
  margin: 0 0 6px;
  line-height: 1.55;
}
.xp-avatars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.xp-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--white);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
}
.xp-avatar span {
  font-size: 0.82rem;
  color: var(--ink-mute);
}
.xp-avatar .xp-avatar-icon {
  font-size: 2rem;
  line-height: 1.2;
}
.xp-avatar[aria-pressed="true"] {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 122, 102, 0.15);
}
.xp-enter {
  width: 100%;
  margin: 18px 0 12px;
  justify-content: center;
  font-size: 1.05rem;
  padding: 0.9rem 1rem;
}
.xp-small {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 6px 0 0;
  line-height: 1.6;
}
.xp-muted {
  color: var(--ink-mute);
}

/* loader + no-webgl */
.xp-loader,
.xp-nogl {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  z-index: 9;
  text-align: center;
  padding: 24px;
  transition: opacity 0.6s var(--ease);
}
.xp-loader.is-done {
  opacity: 0;
  pointer-events: none;
}
.xp-loader p {
  font: 500 1.05rem/1.4 var(--font-display);
  color: var(--ink-soft);
}
.xp-loader-track {
  width: 220px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin: 0 auto;
}
.xp-loader-bar {
  height: 100%;
  width: 5%;
  background: var(--teal);
  transition: width 0.3s var(--ease);
}
.xp-nogl h2 {
  font: 600 1.5rem/1.2 var(--font-display);
}
.xp-nogl p {
  max-width: 30rem;
  color: var(--ink-soft);
}
.xp-nogl[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .xp-brand span small,
  .xp-btn kbd {
    display: none;
  }
  .xp-where {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    font-size: 0.8rem;
  }
  .xp-minimap {
    width: 120px;
    height: 94px;
    top: calc(max(12px, env(safe-area-inset-top)) + 60px);
  }
  .xp-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 62vh;
  }
  .xp-hud-actions .xp-btn--solid {
    display: none;
  }
  .xp-avatars {
    grid-template-columns: 1fr 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .xp *,
  .xp *::before {
    animation: none !important;
    transition: none !important;
  }
}
