/* Compact Top Bar, Hero Axis, Scene Hotspots, Bottom RPG HUD, Top-Layer Modals & Swipeable Drawer */

/* 1. Compact Single Top Bar (<12% viewport height) */
.launcher-topbar {
  position: relative;
  z-index: 10;
  min-height: var(--topbar-height);
  padding: 6px clamp(14px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, rgba(15, 19, 26, 0.94) 0%, rgba(15, 19, 26, 0.72) 100%);
  border-bottom: 1px solid rgba(51, 61, 77, 0.45);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  text-decoration: none;
  color: var(--text-primary);
}

.topbar-brand img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--hud-border-gold);
}

.topbar-name {
  font-family: var(--font-display);
  font-size: clamp(0.76rem, 0.55rem + 0.9vw, 0.95rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  min-width: 0;
  white-space: nowrap;
}

.version-pill {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-gold);
  background: var(--accent-gold-soft);
  border: 1px solid var(--hud-border-gold);
  padding: 2px 8px;
  border-radius: 999px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--hud-surface);
  border: 1px solid var(--hud-border);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.icon-pill-btn:hover {
  border-color: var(--accent-gold);
  background: rgba(34, 41, 54, 0.96);
}

/* 2. Upper-Center Hero Axis */
.launcher-hero {
  position: relative;
  z-index: 5;
  margin: clamp(14px, 4svh, 44px) auto auto;
  padding: 0 18px;
  max-width: 680px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: rgba(217, 93, 57, 0.16);
  border: 1px solid rgba(217, 93, 57, 0.45);
  color: #FFB499;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-play-badge {
  min-height: 36px;
  gap: 8px;
  padding: 6px 15px;
  background: rgba(24, 29, 38, 0.88);
  border-color: var(--hud-border-gold);
  color: var(--text-primary);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.15s ease;
}

.hero-play-badge i {
  color: var(--accent-gold);
  font-size: 0.88rem;
}

.hero-play-badge:hover {
  background: rgba(34, 41, 54, 0.96);
  border-color: var(--accent-gold);
  color: #fff;
  transform: translateY(-1px);
}

.hero-play-badge:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.hero-heading {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.4vw, 3.1rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.85);
}

.hero-heading .accent {
  color: var(--accent-gold);
  display: block;
}

.hero-tagline {
  margin: 10px auto 20px;
  max-width: 520px;
  font-size: clamp(0.88rem, 1.5vw, 1.02rem);
  color: var(--text-muted);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.hero-cta-row {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.cta-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-ember) 100%);
  color: #0F131A;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(217, 93, 57, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cta-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(229, 169, 60, 0.42);
}

.cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(24, 29, 38, 0.95);
  border: 1px solid var(--hud-border);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.18s ease;
}

.cta-secondary:hover {
  border-color: var(--accent-gold);
}

/* 3. Interactive Scene Hotspots */
.hotspot {
  position: absolute;
  z-index: 6;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: rgba(15, 19, 26, 0.92);
  border: 1px solid var(--hud-border-gold);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.hotspot:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: var(--accent-gold);
}

.hotspot-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 0 4px rgba(229, 169, 60, 0.28);
  animation: hotspot-pulse 2.2s ease-in-out infinite;
}

@keyframes hotspot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(229, 169, 60, 0.28); }
  50% { box-shadow: 0 0 0 8px rgba(229, 169, 60, 0.08); }
}

.hotspot-heroes { left: clamp(6%, 14vw, 20%); bottom: calc(var(--hud-height) + 195px); }
.hotspot-gameplay { left: 50%; transform: translateX(-50%); bottom: calc(var(--hud-height) + 115px); }
.hotspot-gameplay:hover { transform: translateX(-50%) translateY(-2px) scale(1.03); }
.hotspot-bosses { right: clamp(6%, 13vw, 19%); bottom: calc(var(--hud-height) + 215px); }

/* 4. Bottom 4-Tab RPG HUD Bar */
.hud-bar {
  position: relative;
  z-index: 10;
  margin: 0 auto 14px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 148px));
  gap: 6px;
  background: rgba(20, 25, 34, 0.96);
  border: 1px solid var(--hud-border);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

.hud-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 10px;
  border-radius: 11px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.hud-tab i {
  font-size: 1rem;
  color: var(--accent-gold);
}

.hud-tab:hover,
.hud-tab[aria-expanded="true"] {
  background: rgba(229, 169, 60, 0.14);
  color: var(--text-primary);
}

/* 5. Native Top-Layer <dialog> Info Modal (GPU-Friendly, Zero Backdrop-Blur) */
.hud-dialog {
  margin: auto 4vw auto auto;
  width: min(560px, 92vw);
  max-height: 80svh;
  padding: 0;
  border: 1px solid var(--hud-border);
  border-top: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  background: #161B24;
  color: var(--text-primary);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.82);
  overflow: hidden;
  contain: layout paint;
  will-change: transform, opacity;

  /* Exit / closed base state */
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.18s;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  .hud-dialog {
    transform: translateY(10px) scale(0.98);
  }
}

.hud-dialog[open]:where(:not([data-closing])) {
  opacity: 1;
  display: flex;
  flex-direction: column;

  @starting-style {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(0) scale(1);

    @starting-style {
      transform: translateY(10px) scale(0.98);
    }
  }
}

.hud-dialog::backdrop {
  background-color: rgba(8, 11, 16, 0);
  transition-property: background-color, display, overlay;
  transition-duration: 0.18s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

.hud-dialog[open]:where(:not([data-closing]))::backdrop {
  background-color: rgba(8, 11, 16, 0.78);

  @starting-style {
    background-color: rgba(8, 11, 16, 0);
  }
}

.hud-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hud-border);
  background: #10141C;
}

.hud-dialog-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.hud-dialog-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hud-border);
  color: var(--text-primary);
  font-size: 1.1rem;
}

.hud-dialog-close:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.hud-dialog-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  contain: content;
}

/* 6. Native <dialog> Swipeable Navigation Drawer */
.Drawer {
  --drawer-width: min(21em, 82dvw, 100dvw - 24px);
  --drawer-backdrop: 0;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.Drawer::backdrop {
  background: #000;
  opacity: calc(var(--drawer-backdrop) * 0.68);
}

.Drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

@media (prefers-reduced-motion: no-preference) {
  .Drawer-scroller {
    scroll-behavior: smooth;
  }
}

.Drawer-scroller::after {
  content: '';
  scroll-snap-align: end;
  scroll-initial-target: nearest;
}

.Drawer-sheet {
  display: flex;
  flex-direction: column;
  height: 100svh;
  padding: 18px 16px;
  background: #0F131A; /* Solid opaque background — prevents text bleed-through */
  border-right: 1px solid var(--hud-border);
  color: var(--text-primary);
  overflow-y: auto;
  scroll-snap-align: start;
  scrollbar-width: none;
}

@supports (animation-timeline: scroll()) {
  .Drawer {
    timeline-scope: --drawer-fade;
    animation: fade-drawer-backdrop linear both;
    animation-timeline: --drawer-fade;
  }

  .Drawer-scroller {
    scroll-timeline: --drawer-fade x;
  }

  @property --drawer-backdrop {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
  }

  @keyframes fade-drawer-backdrop {
    0% { --drawer-backdrop: 1; }
    100% { --drawer-backdrop: 0; }
  }

  @keyframes fade-drawer-backdrop-right {
    0% { --drawer-backdrop: 0; }
    100% { --drawer-backdrop: 1; }
  }

  @media (min-width: 769px) {
    .Drawer {
      animation-name: fade-drawer-backdrop-right;
    }
  }
}

/* Desktop / Wide Screens: align drawer to the right near the Menu button */
@media (min-width: 769px) {
  .Drawer-scroller {
    grid-template-columns: 100% var(--drawer-width);
  }

  .Drawer-scroller::after {
    grid-column: 1;
    grid-row: 1;
    scroll-snap-align: start;
  }

  .Drawer-sheet {
    grid-column: 2;
    grid-row: 1;
    scroll-snap-align: end;
    border-right: 0;
    border-left: 1px solid var(--hud-border);
  }
}

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--hud-border);
}

.drawer-nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.drawer-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 4px 4px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(24, 29, 38, 0.78);
  border: 1px solid rgba(51, 61, 77, 0.72);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.drawer-link i {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(229, 169, 60, 0.1);
  border: 1px solid rgba(229, 169, 60, 0.22);
  color: var(--accent-gold);
  font-size: 0.85rem;
}

.drawer-link:hover:not([aria-current="page"]) {
  background: rgba(34, 41, 54, 0.94);
  border-color: rgba(229, 169, 60, 0.45);
  color: #fff;
}

.drawer-link:active {
  transform: scale(0.99);
}

.drawer-link:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

.drawer-link[aria-current="page"] {
  background: rgba(229, 169, 60, 0.15);
  border-color: rgba(229, 169, 60, 0.55);
  border-left: 3px solid var(--accent-gold);
  color: var(--accent-gold);
  font-weight: 700;
}

.drawer-link[aria-current="page"] i {
  background: rgba(229, 169, 60, 0.22);
  border-color: rgba(229, 169, 60, 0.5);
}

/* Mobile Layout Overrides (max-width: 768px) */
@media (max-width: 768px) {
  .topbar-name {
    font-size: clamp(0.76rem, 0.56rem + 0.9vw, 0.86rem);
  }

  .version-pill {
    display: none;
  }

  .launcher-hero {
    margin-top: 16px;
  }

  .hero-cta-row {
    width: 100%;
  }

  .cta-play,
  .cta-secondary {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.86rem;
  }

  .hotspot {
    padding: 5px 10px 5px 7px;
    font-size: 0.72rem;
  }

  .hotspot-heroes { left: 4%; bottom: calc(var(--hud-height) + 150px); }
  .hotspot-gameplay { left: 50%; bottom: calc(var(--hud-height) + 92px); }
  .hotspot-bosses { right: 4%; bottom: calc(var(--hud-height) + 158px); }

  .hud-bar {
    width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    border-left: 0;
    border-right: 0;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  .hud-tab {
    font-size: 0.72rem;
    padding: 6px 4px;
  }

  /* Bottom-up sheet modal on mobile */
  .hud-dialog {
    margin: auto auto 0 auto;
    width: 100%;
    max-width: 100%;
    max-height: 82svh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    border-left: 0;
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .launcher-topbar {
    padding: 6px 10px;
    gap: 8px;
  }

  .topbar-brand {
    gap: 8px;
    overflow: hidden;
  }

  .topbar-brand img {
    width: 28px;
    height: 28px;
  }

  .topbar-name {
    font-size: clamp(0.7rem, 0.52rem + 1.1vw, 0.82rem);
    line-height: 1.14;
    letter-spacing: 0.02em;
    white-space: normal;
    text-wrap: balance;
  }

  .topbar-actions {
    gap: 6px;
  }

  .icon-pill-btn {
    min-height: 34px;
    padding: 6px 9px;
    font-size: 0.76rem;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud-dialog,
  .hud-dialog::backdrop {
    transition-duration: 0.1s;
  }
  .drawer-link,
  .hero-play-badge {
    transition: none;
  }
  .hotspot-dot {
    animation: none;
  }
}
