/* ===== DU$TINAL DOGS — The Dustinal District ===================================
   Brand tokens borrowed from the dogesoft.io family (DM Sans / DM Mono / Space
   Grotesk, --gold/--orange accents) but pushed into a permanent dark, neon-in-
   the-scrapyard palette — this page never runs a light theme. */

:root {
  --ink: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.64);
  --dim: rgba(244, 241, 234, 0.4);
  --bg: #0a0e0c;
  --card: rgba(18, 26, 21, 0.92);
  --card-soft: rgba(22, 30, 25, 0.7);
  --line: rgba(255, 255, 255, 0.12);
  --gold: #ffcf40;
  --orange: #ff7138;
  --rust: #c4661f;
  --cyan: #3fe0ff;
  --magenta: #ff4fb8;
  --green: #4bd58b;
  --danger: #ff5a5a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

/* Several elements below (panels, dialogue box, overlays, interact prompt)
   set their own unconditional `display` value AND use the HTML `hidden`
   attribute. Author CSS beats the UA stylesheet's `[hidden]{display:none}`
   at equal specificity, so without this rule those elements would stay
   visible — and JS setting `.hidden = true` would silently do nothing. */
[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

img {
  max-width: 100%;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
}

/* ---------- Intro overlay (welcome video gate) ---------- */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  /* See the district loading behind — not a solid blackout */
  background: rgba(4, 4, 6, 0.82);
  backdrop-filter: blur(2px);
  transition: opacity 0.85s ease, visibility 0.85s ease;
}

#intro-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: min(920px, 92vw);
}

.intro-video {
  display: block;
  width: 100%;
  max-height: min(72vh, 560px);
  object-fit: contain;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 207, 64, 0.22);
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.45);
}

.intro-sound {
  appearance: none;
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 3;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 207, 64, 0.55);
  background: rgba(8, 6, 4, 0.78);
  color: #ffe8a8;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  cursor: pointer;
  animation: intro-sound-pulse 1.6s ease-in-out infinite;
}

.intro-sound:hover {
  background: rgba(255, 207, 64, 0.2);
  border-color: rgba(255, 207, 64, 0.85);
}

@keyframes intro-sound-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 207, 64, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 207, 64, 0);
  }
}

.intro-enter {
  appearance: none;
  border: 1px solid rgba(255, 207, 64, 0.5);
  background: rgba(12, 10, 8, 0.82);
  color: #ffe8a8;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  padding: 14px 28px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.35s ease, background 0.2s ease, border-color 0.2s ease;
}

/* Same slot as Enter — big soft timer while the welcome plays */
.intro-countdown {
  display: grid;
  place-items: center;
  min-height: 52px;
  min-width: 4.5ch;
  padding: 6px 18px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(2.8rem, 9vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0.04em;
  color: rgba(255, 232, 168, 0.42);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  user-select: none;
  pointer-events: none;
}

.intro-countdown[hidden] {
  display: none;
}

.intro-enter.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.intro-enter:not(:disabled):hover {
  background: rgba(255, 207, 64, 0.18);
  border-color: rgba(255, 207, 64, 0.8);
}

.intro-enter:disabled {
  cursor: wait;
  filter: saturate(0.7);
}

/* ---------- Loading screen ---------- */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 207, 64, 0.12), transparent 45%),
    radial-gradient(circle at 75% 75%, rgba(255, 79, 184, 0.1), transparent 45%),
    var(--bg);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-mark {
  border-radius: 16px;
  animation: loading-pulse 1.8s ease-in-out infinite;
}

.loading-title {
  margin: 6px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.loading-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.loading-bar {
  width: 200px;
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.loading-bar i {
  display: block;
  width: 10%;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--gold));
  transition: width 0.25s ease;
}

@keyframes loading-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.8; }
}

/* ---------- Canvas ---------- */
#canvas-root {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#canvas-root canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- Brand chip ---------- */
.brand-chip {
  position: fixed;
  z-index: 45;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-soft);
  backdrop-filter: blur(14px);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.brand-chip img {
  border-radius: 8px;
}

.brand-chip b {
  color: var(--orange);
  font-weight: 800;
}

.brand-chip:hover,
.brand-chip:focus-visible {
  border-color: rgba(255, 113, 56, 0.5);
  transform: translateY(-1px);
}

/* ---------- HUD shell ---------- */
#hud {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.hud-cluster {
  position: fixed;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.hud-top-left {
  top: 60px;
  left: 14px;
}

.hud-top-right {
  top: 14px;
  right: 14px;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-soft);
  backdrop-filter: blur(14px);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.hud-btn:hover,
.hud-btn:focus-visible {
  border-color: rgba(255, 207, 64, 0.5);
  transform: translateY(-1px);
}

.hud-btn-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.hud-btn-label b,
.hud-btn-label {
  font-family: "DM Mono", monospace;
}

.hud-btn-wallet.is-connected {
  border-color: rgba(75, 213, 139, 0.55);
  background: rgba(75, 213, 139, 0.14);
}

.hud-btn-wallet.is-holder {
  border-color: rgba(255, 207, 64, 0.6);
  background: rgba(255, 207, 64, 0.14);
  box-shadow: 0 0 0 3px rgba(255, 207, 64, 0.1);
}

.hud-mute-btn {
  position: fixed;
  z-index: 40;
  bottom: 64px;
  left: 14px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  pointer-events: auto;
}

.hud-mute-btn.is-muted {
  opacity: 0.55;
}

.hud-help-btn {
  position: fixed;
  z-index: 40;
  bottom: 18px;
  left: 14px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  pointer-events: auto;
}

/* ---------- Interact prompt ---------- */
.interact-prompt {
  position: fixed;
  z-index: 40;
  bottom: 34px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 10px;
  border: 1px solid rgba(255, 207, 64, 0.4);
  border-radius: 999px;
  background: rgba(10, 14, 12, 0.86);
  backdrop-filter: blur(10px);
  font-weight: 700;
  font-size: 0.86rem;
  transform: translate(-50%, 0);
  animation: prompt-bob 1.6s ease-in-out infinite;
}

@keyframes prompt-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -4px); }
}

/* ---------- Touch controls ---------- */
.touch-controls {
  display: none;
}

body.is-touch .touch-controls {
  display: block;
}

.touch-joystick {
  position: fixed;
  z-index: 42;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 120px;
  height: 120px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.touch-joystick.is-boosting {
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(255, 207, 64, 0.5), inset 0 0 12px rgba(255, 207, 64, 0.15);
}

.touch-joystick-nub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 207, 64, 0.85);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: background 0.2s;
}

.touch-joystick.is-boosting .touch-joystick-nub {
  background: rgba(255, 160, 30, 1);
  box-shadow: 0 0 10px rgba(255, 160, 30, 0.7);
}

.touch-interact {
  position: fixed;
  z-index: 42;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: none;
  min-width: 72px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 207, 64, 0.5);
  border-radius: 28px;
  background: rgba(255, 207, 64, 0.18);
  backdrop-filter: blur(10px);
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--gold);
  letter-spacing: 0.02em;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  animation: action-pulse 2s ease-in-out infinite;
}

@keyframes action-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 207, 64, 0.3); }
  50% { box-shadow: 0 0 16px 4px rgba(255, 207, 64, 0.2); }
}

@media (max-width: 480px) {
  .touch-joystick {
    width: 112px;
    height: 112px;
  }
  .touch-interact {
    padding: 14px 16px;
    font-size: 0.76rem;
  }
}


/* ---------- Dialogue box ---------- */
.dialogue-box {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: min(560px, calc(100vw - 32px));
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transform: translate(-50%, 0);
  animation: dialogue-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes dialogue-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.dialogue-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--orange), var(--gold));
}

.dialogue-body {
  flex: 1 1 auto;
  min-width: 0;
}

.dialogue-name {
  margin: 2px 0 4px;
  color: var(--gold);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
}

.dialogue-line {
  margin: 0;
  line-height: 1.5;
  font-size: 0.94rem;
}

.dialogue-link {
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dialogue-link:hover,
.dialogue-link:focus-visible {
  color: var(--gold);
}

.dialogue-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.dialogue-choice-btn {
  padding: 8px 14px;
  border: 1px solid rgba(255, 207, 64, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 650;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.dialogue-choice-btn:hover,
.dialogue-choice-btn:focus-visible {
  background: rgba(255, 207, 64, 0.14);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.dialogue-choice-btn.is-decline {
  border-color: rgba(244, 241, 234, 0.2);
  color: var(--muted);
}

.dialogue-choice-btn.is-decline:hover,
.dialogue-choice-btn.is-decline:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--muted);
  color: var(--ink);
}

.dialogue-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

/* ---------- Speech bubble (world-anchored) ---------- */
#speech-bubble {
  position: fixed;
  z-index: 56;
  max-width: min(280px, 70vw);
  padding: 10px 14px;
  border: 1px solid rgba(255, 180, 90, 0.55);
  border-radius: 16px 16px 16px 4px;
  background: rgba(18, 12, 8, 0.92);
  color: #ffe8c8;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.92rem;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

#speech-bubble::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: rgba(18, 12, 8, 0.92);
  border-right: 1px solid rgba(255, 180, 90, 0.55);
  border-bottom: 1px solid rgba(255, 180, 90, 0.55);
  transform: rotate(45deg);
}

#speech-bubble p {
  margin: 0;
}

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  z-index: 55;
  top: 78px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 9px 16px;
  border: 1px solid rgba(255, 207, 64, 0.35);
  border-radius: 14px;
  background: rgba(10, 14, 12, 0.9);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
  font-weight: 650;
  max-width: min(86vw, 480px);
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  /* Duration/delay set inline per-toast in showToast() — long lines get more
     time before this fade-out kicks in instead of a fixed 2.6s for everyone. */
  animation: toast-in 0.25s ease, toast-out 0.4s ease 2.6s forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------- Side panels ---------- */
.panel {
  position: fixed;
  z-index: 60;
  top: 0;
  bottom: 0;
  width: min(400px, 100vw);
  display: flex;
  flex-direction: column;
  padding: 22px 20px 28px;
  background:
    radial-gradient(120% 70% at 0% -10%, rgba(255, 207, 64, 0.12), transparent 50%),
    radial-gradient(90% 60% at 100% 0%, rgba(255, 113, 56, 0.08), transparent 48%),
    var(--card);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  overflow-y: auto;
  animation: panel-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.panel-left {
  left: 0;
  border-right: 1px solid var(--line);
}

.panel-right {
  right: 0;
  border-left: 1px solid var(--line);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateX(var(--panel-from, -16px)); }
  to { opacity: 1; transform: translateX(0); }
}

.panel-right {
  --panel-from: 16px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.quest-panel .panel-head h2 em {
  position: relative;
  display: inline-block;
  color: var(--orange);
  font-style: normal;
}

.quest-panel .panel-head h2 em::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 4%;
  height: 6px;
  content: "";
  border: solid var(--gold);
  border-width: 2px 0 0;
  border-radius: 50%;
  transform: rotate(-2deg);
}

.quest-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-family: "DM Mono", monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.quest-kicker::before {
  width: 18px;
  height: 2px;
  content: "";
  background: var(--orange);
}

.panel-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
}

.panel-close:hover {
  border-color: rgba(255, 207, 64, 0.4);
  color: var(--gold);
}

.panel-lead {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Power meter (quest panel) */
.power-meter {
  margin-bottom: 18px;
}

.power-meter-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.power-meter-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rust), var(--gold), var(--orange));
  box-shadow: 0 0 14px rgba(255, 207, 64, 0.45);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.power-meter-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

#power-meter-label {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.quest-status-text {
  font-size: 0.76rem;
  color: var(--gold);
  font-style: italic;
  text-align: right;
}

.quest-status-text.is-complete {
  color: var(--gold);
}

.quest-panel .guide-section-label {
  margin: 0 0 10px;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quest-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s, background 0.2s;
}

.quest-row:hover {
  border-color: rgba(255, 207, 64, 0.28);
  background: rgba(255, 207, 64, 0.04);
}

.quest-row.is-done {
  border-color: rgba(255, 207, 64, 0.22);
  background: rgba(255, 207, 64, 0.05);
}

.quest-index {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.quest-row.is-done .quest-index {
  border-color: rgba(255, 207, 64, 0.45);
  background: rgba(255, 207, 64, 0.15);
  color: var(--gold);
  font-size: 0.72rem;
}

.quest-copy {
  min-width: 0;
}

.quest-title {
  margin: 0 0 3px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.quest-row.is-done .quest-title {
  color: var(--gold);
}

.quest-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* ---------- Collection panel ---------- */
.panel-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.panel-tab {
  flex: 1 1 0;
  padding: 7px 4px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.panel-tab.is-active {
  background: rgba(255, 207, 64, 0.14);
  color: var(--gold);
}

.panel-tab-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-badge.is-live {
  color: var(--green);
  background: rgba(75, 213, 139, 0.14);
}

.data-badge.is-cached {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-tile {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.stat-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-tile b {
  display: block;
  margin-top: 3px;
  font-family: "DM Mono", monospace;
  font-size: 1rem;
}

.trait-group {
  margin-bottom: 4px;
}

.trait-group h4 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trait-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.78rem;
}

.trait-row-name {
  flex: 0 0 84px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.trait-row-track {
  flex: 1 1 auto;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
}

.trait-row-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
}

.trait-row-pct {
  flex: 0 0 auto;
  width: 40px;
  text-align: right;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.72rem;
}

.holder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}

.holder-row:last-child {
  border-bottom: none;
}

.holder-rank {
  flex: 0 0 auto;
  width: 22px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
}

.holder-addr {
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: "DM Mono", monospace;
}

.holder-row.is-you {
  padding-left: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 207, 64, 0.1);
}

.holder-count {
  flex: 0 0 auto;
  color: var(--gold);
  font-weight: 700;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-thumb {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  object-fit: cover;
}

.activity-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.activity-meta b {
  display: block;
  font-size: 0.8rem;
}

.activity-meta span {
  color: var(--muted);
  font-size: 0.7rem;
}

.activity-price {
  flex: 0 0 auto;
  font-family: "DM Mono", monospace;
  font-size: 0.8rem;
  color: var(--gold);
}

.panel-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- Help / how-to-play guide ---------- */
.help-overlay,
.finale-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(6, 9, 8, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  animation: guide-fade-in 0.45s ease;
}

.help-overlay {
  z-index: 210;
  animation: guide-fade-in 0.35s ease;
}

@keyframes guide-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.guide-card {
  width: min(440px, 100%);
  margin: auto;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 10% -10%, rgba(255, 207, 64, 0.12), transparent 55%),
    radial-gradient(90% 70% at 100% 0%, rgba(255, 113, 56, 0.1), transparent 50%),
    var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  animation: guide-rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes guide-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.guide-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.guide-mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255, 207, 64, 0.25);
  background: rgba(0, 0, 0, 0.25);
}

.guide-eyebrow {
  margin: 0 0 2px;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.guide-eyebrow a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}

.guide-eyebrow a:hover {
  text-decoration: underline;
}

.guide-tagline {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.guide-hero {
  margin-bottom: 18px;
}

.guide-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.guide-kicker::before {
  width: 22px;
  height: 2px;
  content: "";
  background: var(--orange);
}

.guide-hero h2 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.55rem, 5vw, 1.95rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.guide-hero h2 em {
  position: relative;
  display: inline-block;
  color: var(--orange);
  font-style: normal;
}

.guide-hero h2 em::after {
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 4%;
  height: 7px;
  content: "";
  border: solid var(--gold);
  border-width: 2px 0 0;
  border-radius: 50%;
  transform: rotate(-2deg);
}

.guide-lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.guide-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.guide-trust li::before {
  margin-right: 6px;
  color: var(--green);
  content: "●";
  font-size: 0.55rem;
}

.guide-feature {
  margin: 0 0 16px;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.guide-feature-label {
  margin: 0 0 4px;
  font-family: "DM Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 600;
}

.guide-feature h3 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.guide-feature p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.guide-section-label {
  margin: 4px 0 10px;
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.guide-controls {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.guide-controls li {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.guide-controls strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.82rem;
  font-weight: 700;
}

.guide-controls span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

.guide-controls kbd {
  margin-right: 3px;
}

.guide-mobile {
  display: none;
}

body.is-touch .guide-desktop {
  display: none;
}

body.is-touch .guide-mobile {
  display: block;
}

.guide-cta {
  width: 100%;
}

/* ---------- Tip overlay ---------- */

.tip-address-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.tip-address {
  flex: 1;
  min-width: 0;
  font-family: "DM Mono", monospace;
  font-size: 0.74rem;
  word-break: break-all;
  color: var(--gold);
  user-select: all;
}

.tip-copy-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}

.tip-copy-btn:hover {
  border-color: rgba(255, 207, 64, 0.4);
  background: rgba(255, 207, 64, 0.12);
}

.tip-footer {
  margin: 0 0 16px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.help-card,
.finale-card {
  width: min(420px, 100%);
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 10% -10%, rgba(255, 207, 64, 0.12), transparent 55%),
    radial-gradient(90% 70% at 100% 0%, rgba(255, 113, 56, 0.1), transparent 50%),
    var(--card);
  box-shadow: var(--shadow);
  text-align: center;
  animation: guide-rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 22px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #17110a;
  font-weight: 800;
  font-size: 0.92rem;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease;
}

.button-primary:hover,
.button-primary:focus-visible {
  transform: translateY(-2px);
}


.finale-eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.finale-card h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 8vw, 2.8rem);
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--gold), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.finale-sub {
  margin: 6px 0 16px;
  font-family: "DM Mono", monospace;
  letter-spacing: 0.08em;
  color: var(--cyan);
}

.finale-body {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .brand-chip span {
    display: none;
  }

  .hud-btn-label {
    display: none;
  }

  .hud-btn {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .hud-top-left {
    top: 60px;
  }

  .panel {
    width: 100vw;
  }

  .dialogue-box {
    bottom: 116px;
  }

  .interact-prompt {
    bottom: 128px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-mark,
  .interact-prompt {
    animation: none !important;
  }
}

/* ---------- World editor (?editor=1) ---------- */
.editor-panel {
  position: fixed;
  z-index: 70;
  top: 14px;
  right: 14px;
  width: min(300px, calc(100vw - 28px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 207, 64, 0.4);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
}

.editor-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: "Space Grotesk", sans-serif;
}

.editor-status {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.editor-picker {
  width: 100%;
  margin-bottom: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 12, 0.9);
  color: var(--ink);
  font-family: "DM Mono", monospace;
  font-size: 0.76rem;
}

.editor-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 6px;
  margin: 0 0 10px;
}

.editor-fields div {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.editor-fields dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.editor-fields dd {
  margin: 2px 0 0;
  font-family: "DM Mono", monospace;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.editor-actions .hud-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 0.74rem;
}

.editor-help {
  margin: 0;
  color: var(--dim);
  font-size: 0.68rem;
  line-height: 1.5;
}

/* ---------- Portal warp flash (full-screen) ---------- */
.portal-flash {
  position: fixed;
  inset: 0;
  z-index: 240;
  pointer-events: none;
  overflow: hidden;
}

.portal-flash[hidden] {
  display: none !important;
}

.portal-flash-white {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  transition: none;
}

.portal-flash-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  mix-blend-mode: screen;
}

.portal-flash-rings .portal-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12vmin;
  height: 12vmin;
  margin: -6vmin 0 0 -6vmin;
  border-radius: 50%;
  border: 3px solid rgba(255, 200, 80, 0.95);
  box-shadow:
    0 0 24px rgba(255, 140, 40, 0.85),
    inset 0 0 18px rgba(255, 255, 255, 0.55);
  opacity: 0;
  transform: scale(0.15);
  will-change: transform, opacity;
}
