@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;800&display=swap");

/* =====================================================
   FLOOR HUD / SITE HUD (Single Source of Truth)
   - Includes: layout, panels, map, tooltip, link polish,
     and STABLE dropdown nav (no hover-closing)
   - Background upgrade:
     ✅ Pinned background (does not scroll)
     ✅ More consistent rendering than background-attachment: fixed
     ✅ 1080p-friendly image size (use a ~1920px wide export)
===================================================== */

:root {
  --bg1: rgba(5, 15, 25, 0.88);
  --panel: rgba(10, 30, 40, 0.78);
  --line: rgba(0, 255, 255, 0.25);
  --line2: rgba(0, 255, 255, 0.16);
  --cyan: #00eaff;
  --text: #e6f7ff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base page */
body {
  font-family: "Montserrat", sans-serif;
  color: var(--text);
  min-height: 100vh;

  /* Let the fixed ::before layer own the background */
  background: none;
}

/* ✅ Pinned + prettier background layer (doesn't scroll) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;

  background:
    radial-gradient(1200px 600px at 30% 10%, rgba(0, 234, 255, 0.18), transparent 60%),
    linear-gradient(var(--bg1), var(--bg1)),
    url("/css/background2.jpg") center / cover no-repeat;

  /* Subtle polish to improve perceived detail/contrast */
  filter: saturate(1.06) contrast(1.06);

  /* Helps some browsers keep it steady/crisp */
  transform: translateZ(0);
  will-change: transform;
}

/* =====================================================
   TOP HUD
===================================================== */

.hud-top {
  position: sticky;
  top: 0;
  z-index: 1000;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;

  padding: 18px 24px;
  background: rgba(10, 30, 40, 0.86);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 0 24px rgba(0, 234, 255, 0.14);
  backdrop-filter: blur(8px);
}

.hud-kicker {
  font-size: 12px;
  letter-spacing: 2px;
  opacity: 0.85;
}

.hud-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(0, 234, 255, 0.28);
  line-height: 1.05;
}

.hud-subtitle {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.9;
}

.hud-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.hud-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;

  padding: 8px 10px;
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.06);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.1);
}

.hud-link:hover {
  box-shadow: 0 0 16px rgba(0, 234, 255, 0.18);
}

.hud-link.active {
  border-color: var(--line);
  box-shadow: 0 0 18px rgba(0, 234, 255, 0.22);
}

.hud-right {
  display: flex;
  gap: 10px;
  justify-content: end;
  flex-wrap: wrap;
}

.hud-chip {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--cyan);

  padding: 6px 10px;
  border: 1px solid var(--line);
  background: rgba(0, 234, 255, 0.05);
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.12);
}

.hud-chip-soft {
  color: var(--text);
  border-color: var(--line2);
  opacity: 0.95;
}

/* =====================================================
   GRID
===================================================== */

.floor-grid {
  padding: 22px 24px 90px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.col-left {
  display: grid;
  gap: 18px;
}

/* =====================================================
   PANELS
===================================================== */

.hud-panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow:
    0 0 18px rgba(0, 234, 255, 0.14),
    inset 0 0 18px rgba(0, 234, 255, 0.08);
  backdrop-filter: blur(8px);
  padding: 16px;
}

.hud-panel::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0, 234, 255, 0.1), transparent);
  opacity: 0.25;
  transform: translateX(-40%);
}

.hud-panel:hover::before {
  transform: translateX(40%);
  transition: transform 0.9s ease;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;

  color: var(--cyan);
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 13px;
}

.panel-head.slim {
  margin-bottom: 10px;
}

.panel-chip {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 5px 9px;
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.05);
  color: var(--text);
}

/* =====================================================
   LISTS
===================================================== */

.hud-list {
  list-style: none;
  display: grid;
  gap: 10px;
}

.hud-list li {
  opacity: 0.95;
  line-height: 1.4;
  padding: 10px 10px;
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.04);
}

.hud-list.bullets li {
  padding-left: 34px;
  position: relative;
}

.hud-list.bullets li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.45);
}

.hud-list.chevrons li {
  padding-left: 34px;
  position: relative;
}

.hud-list.chevrons li::before {
  content: "»";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-52%);
  color: var(--cyan);
  font-weight: 800;
  opacity: 0.95;
}

/* =====================================================
   LORE
===================================================== */

.hud-lore {
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.04);
  padding: 12px 12px;
  line-height: 1.6;
  opacity: 0.95;
  display: grid;
  gap: 10px;
}

.hud-lore p {
  margin: 0;
}

/* =====================================================
   TABLES (Mobs/Bosses/Quests)
===================================================== */

.hud-table-wrap {
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.03);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.hud-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px; /* allows horizontal scroll on small screens */
}

.hud-table th,
.hud-table td {
  border-bottom: 1px solid rgba(0, 255, 255, 0.12);
  padding: 10px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
  line-height: 1.45;
}

.hud-table th {
  color: var(--cyan);
  font-weight: 800;
  letter-spacing: 1px;
  background: rgba(10, 30, 40, 0.72);
  border-bottom: 1px solid var(--line2);
  position: sticky;
  top: 0; /* works inside the scroll container */
  z-index: 1;
}

.hud-table tr:hover td {
  background: rgba(0, 234, 255, 0.05);
}

.hud-td-muted {
  opacity: 0.85;
  letter-spacing: 0.8px;
}

/* =====================================================
   MAP PANEL
===================================================== */

.panel-map {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.map-frame {
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.04);
  overflow: hidden;
  position: relative;
}

.map-img {
  display: block;
  width: 100%;
  height: auto;
}

.map-placeholder {
  position: relative;
  height: 360px;
  background:
    radial-gradient(900px 320px at 35% 45%, rgba(0, 234, 255, 0.12), transparent 60%),
    rgba(0, 234, 255, 0.03);
}

.map-image-wrap {
  position: relative;
}

/* overlay must accept interaction (tooltips/callouts) */
.map-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 234, 255, 0.08), transparent);
  animation: scan 3.6s linear infinite;
  opacity: 0.75;
}

@keyframes scan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* key points subpanel inside map */
.subpanel {
  border-color: var(--line2);
}

/* =====================================================
   SYSTEM NOTE
===================================================== */

.floor-note {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(420px, calc(100vw - 48px));
  padding: 14px;

  background: rgba(10, 30, 40, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 0 22px rgba(0, 234, 255, 0.18);
  backdrop-filter: blur(8px);
}

.floor-note-title {
  color: var(--cyan);
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.floor-note-body {
  opacity: 0.92;
  line-height: 1.5;
}

/* =====================================================
   CALLOUTS (SAO buttons)
===================================================== */

.callout {
  position: absolute;
  padding: 6px 10px;
  font-size: 12px;

  border: 1px solid var(--line2);
  background: rgba(10, 30, 40, 0.7);
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.12);

  pointer-events: auto;
  cursor: pointer;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  color: var(--text);

  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.callout:hover,
.callout:focus-visible {
  transform: translateY(-1px) scale(1.02);
  border-color: var(--line);
  box-shadow: 0 0 18px rgba(0, 234, 255, 0.22);
  outline: none;
}

.callout::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 8px;
  background: rgba(0, 234, 255, 0.85);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.55);
  vertical-align: middle;
}

/* Optional preset positions (if you still use .a/.b/etc somewhere) */
.callout.a { top: 38%; left: 12%; }
.callout.b { top: 22%; right: 10%; }
.callout.c { top: 52%; right: 18%; }
.callout.d { bottom: 16%; right: 12%; }
.callout.e { bottom: 22%; left: 10%; }

/* =====================================================
   TOOLTIP
===================================================== */

.map-tooltip {
  position: absolute;
  z-index: 50;
  width: min(360px, calc(100% - 20px));
  padding: 12px;

  background: rgba(10, 30, 40, 0.94);
  border: 1px solid var(--line);
  box-shadow:
    0 0 24px rgba(0, 234, 255, 0.18),
    inset 0 0 18px rgba(0, 234, 255, 0.1);
  backdrop-filter: blur(10px);

  border-radius: 14px;
  overflow: hidden;

  opacity: 0;
  transform: translateY(6px) scale(0.99);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.map-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.map-tooltip-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0, 234, 255, 0.08), transparent);
  animation: scan 3.6s linear infinite;
  opacity: 0.55;
  pointer-events: none;
}

.map-tooltip-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.map-tooltip-title {
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(0, 234, 255, 0.25);
  font-size: 13px;
}

.map-tooltip-close {
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.12);
}

.map-tooltip-close:hover {
  box-shadow: 0 0 16px rgba(0, 234, 255, 0.18);
  border-color: var(--line);
}

.map-tooltip-system {
  position: relative;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.3px;
  opacity: 0.95;

  padding: 7px 10px;
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.05);
  margin-bottom: 10px;
}

.map-tooltip-body {
  position: relative;
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.95;

  padding: 10px;
  border: 1px solid var(--line2);
  background: rgba(0, 234, 255, 0.04);
}

/* Danger state */
.map-tooltip.danger {
  border-color: rgba(255, 80, 80, 0.55);
  box-shadow:
    0 0 26px rgba(255, 80, 80, 0.22),
    inset 0 0 18px rgba(0, 234, 255, 0.08);
}

.map-tooltip.danger .map-tooltip-title {
  color: #ffb3b3;
  text-shadow: 0 0 14px rgba(255, 80, 80, 0.25);
}

/* =====================================================
   LINK POLISH
===================================================== */

a {
  color: #7beeff;
  text-decoration: none;
  position: relative;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0%;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 234, 255, 0.5);
  transition: width 0.18s ease;
}

a:hover {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 234, 255, 0.35);
}

a:hover::after {
  width: 100%;
}

.hud-panel a {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hud-list a {
  display: inline-block;
  padding: 2px 2px;
}

/* HUD buttons shouldn't get underline sweep */
.hud-link::after {
  display: none;
}

a[target="_blank"] {
  color: #9ff5ff;
}

a[target="_blank"]:hover {
  color: #00ffff;
}

/* =====================================================
   HUD NAV DROPDOWNS (STABLE HOVER)
   Fixes: menu closing when moving mouse to dropdown
===================================================== */

.hud-drop {
  position: relative;
  display: inline-block;
}

.hud-drop-btn {
  cursor: pointer;
}

/* IMPORTANT: keep menu "present" using opacity/visibility (not display none) */
.hud-menu {
  position: absolute;
  top: 100%;
  left: 0;

  margin-top: 6px; /* small spacing (no hover gap) */
  min-width: 200px;
  padding: 10px;

  background: rgba(10, 30, 40, 0.94);
  border: 1px solid var(--line);
  box-shadow:
    0 0 18px rgba(0, 234, 255, 0.14),
    inset 0 0 18px rgba(0, 234, 255, 0.08);
  backdrop-filter: blur(10px);
  border-radius: 12px;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 2000;
}

.hud-menu a {
  display: block;
  padding: 10px 12px;

  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;

  border-radius: 10px;
  margin: 6px 0;
  text-decoration: none;
  background: rgba(0, 234, 255, 0.04);
  border: 1px solid rgba(0, 255, 255, 0.12);
}

.hud-menu a:hover {
  border-color: var(--line);
  box-shadow: 0 0 14px rgba(0, 234, 255, 0.18);
  background: rgba(0, 234, 255, 0.08);
  color: var(--cyan);
}

/* Keep open while hovering wrapper OR keyboard focus */
.hud-drop:hover .hud-menu,
.hud-drop:focus-within .hud-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hud-drop-btn:focus-visible {
  outline: none;
  border-color: var(--line);
  box-shadow: 0 0 18px rgba(0, 234, 255, 0.22);
}

/* =====================================================
   RESPONSIVE + ACCESSIBILITY
===================================================== */

@media (max-width: 980px) {
  .hud-top {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hud-right {
    justify-content: center;
  }

  .floor-grid {
    grid-template-columns: 1fr;
  }

  .map-placeholder {
    height: 320px;
  }
}

@media (max-width: 520px) {
  .hud-title {
    font-size: 22px;
  }

  .hud-panel {
    padding: 14px;
  }

  .map-placeholder {
    height: 280px;
  }

  /* Sticky HUD: reduce footprint */
  .hud-top {
    padding: 14px;
    gap: 10px;
  }

  .hud-kicker {
    font-size: 11px;
    letter-spacing: 1.5px;
  }

  .hud-subtitle {
    font-size: 12px;
    letter-spacing: 1.5px;
  }

  /* Tags/chips: smaller + wrap nicely */
  .hud-right {
    gap: 8px;
  }

  .hud-chip {
    font-size: 10px;
    padding: 5px 8px;
  }

  /* Callouts: shrink so they don’t stomp the map */
  .callout {
    font-size: 10px;
    padding: 5px 8px;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Dropdown: easier to tap */
  .hud-menu {
    left: 0;
    width: min(320px, calc(100vw - 28px));
  }

  /* SYSTEM NOTE: don’t block the bottom of the page */
  .floor-note {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-height: 38vh;
    overflow: auto;
  }

  /* Mobile tooltip becomes pinned bottom sheet */
  .map-tooltip {
    position: fixed;
    left: 14px !important;
    right: 14px !important;
    top: auto !important;
    bottom: 14px !important;
    width: auto;
    max-height: 44vh;
    overflow: auto;
  }

  .map-tooltip.pinned {
    box-shadow: 0 0 28px rgba(0, 234, 255, 0.22);
  }
}

/* Even better UX: on tiny screens, put note in-flow */
@media (max-width: 420px) {
  .floor-note {
    position: static;
    margin: 14px;
    max-height: none;
  }

  .floor-grid {
    padding-bottom: 24px;
  }
}

/* Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
  .scanline {
    animation: none;
  }

  .map-tooltip-scan {
    animation: none;
  }

  .hud-panel:hover::before {
    transition: none;
  }
}
