:root {
  color-scheme: dark;
  --bg: #050b10;
  --bg-elev: #0d1923;
  --bg-card: rgba(17, 33, 46, 0.88);
  --line: rgba(132, 193, 220, 0.24);
  --text: #ecf7ff;
  --muted: #9eb8c9;
  --brand: #4dd4ff;
  --brand-2: #ffb347;
  --danger: #ff6f61;
  --success: #73df98;
  --critical: #ff835b;
  --high: #ffc46b;
  --medium: #a7dbff;
  --low: #82e0c4;
  --radius: 14px;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Space Grotesk', sans-serif;
  background: radial-gradient(circle at 20% 10%, #13334a 0%, var(--bg) 42%),
    linear-gradient(145deg, #050b10 10%, #0b1a24 65%, #08131b 100%);
  color: var(--text);
}

body {
  position: relative;
  overflow-x: hidden;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 75% 18%, rgba(77, 212, 255, 0.12), transparent 42%),
    radial-gradient(circle at 22% 78%, rgba(255, 179, 71, 0.09), transparent 38%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--brand);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  background: rgba(5, 11, 16, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.06em;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.top-nav {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-btn,
.action-btn,
.tab-btn,
.inline-link,
.chip-remove {
  font: inherit;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(16, 30, 42, 0.86);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.nav-btn:hover,
.action-btn:hover,
.tab-btn:hover,
.inline-link:hover,
.chip-remove:hover {
  border-color: rgba(132, 193, 220, 0.55);
  background: rgba(28, 51, 68, 0.95);
  transform: translateY(-1px);
}

.nav-btn.is-active {
  background: linear-gradient(140deg, rgba(77, 212, 255, 0.28), rgba(255, 179, 71, 0.2));
  border-color: rgba(77, 212, 255, 0.45);
}

.layout {
  width: min(1400px, 95vw);
  margin: 0 auto;
  padding: 1rem 0 4rem;
}

.status {
  margin: 0.5rem 0 0.8rem;
  color: var(--muted);
}

.route-section {
  display: none;
  gap: 1rem;
}

.route-section.is-active {
  display: grid;
  animation: sectionIn 280ms ease;
}

@keyframes sectionIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head h1,
.section-head h2,
.section-head h3 {
  margin: 0;
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-head p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  max-width: 80ch;
}

.meta-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.meta-card,
.panel,
.item-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.meta-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.meta-value {
  margin: 0.2rem 0;
  font-family: 'Rajdhani', sans-serif;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.meta-subtitle {
  margin: 0;
  color: var(--muted);
}

.highlights-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.compact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.compact-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  border-bottom: 1px solid rgba(132, 193, 220, 0.12);
  padding-bottom: 0.35rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.filter-grid label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.87rem;
  color: var(--muted);
}

.filter-grid input,
.filter-grid select,
.inline-input {
  font: inherit;
  border: 1px solid rgba(132, 193, 220, 0.25);
  background: rgba(9, 20, 30, 0.82);
  color: var(--text);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}

.inline-input {
  width: 90px;
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.card-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.item-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}

.item-card h3 {
  margin: 0;
  font-size: 1.1rem;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.03em;
}

.item-card p {
  margin: 0.55rem 0;
  color: var(--muted);
}

.entity-media {
  margin: 0 0 0.8rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(132, 193, 220, 0.22);
  background: rgba(10, 22, 32, 0.9);
  aspect-ratio: 16 / 9;
}

.entity-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.arc-media {
  aspect-ratio: 4 / 3;
}

.map-media {
  aspect-ratio: 21 / 9;
}

.item-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  font-size: 0.88rem;
}

.stats-row {
  display: grid;
  gap: 0.2rem;
  font-size: 0.83rem;
}

.inline-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inline-row.wrap {
  flex-wrap: wrap;
}

.space-between {
  justify-content: space-between;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.5rem;
}

.tab-btn {
  display: grid;
  justify-items: start;
  text-align: left;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
}

.tab-btn.is-active {
  background: linear-gradient(140deg, rgba(77, 212, 255, 0.28), rgba(255, 179, 71, 0.18));
}

.tiny {
  font-size: 0.74rem;
  color: var(--muted);
}

.map-canvas {
  position: relative;
  min-height: 360px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: linear-gradient(145deg, #102638, #1b3b52 35%, #0f2534 68%, #21384b);
}

.map-base-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.08) brightness(0.72);
  z-index: 0;
}

.map-backdrop {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 70% 20%, rgba(77, 212, 255, 0.18), transparent 42%);
  background-size: 40px 40px, 40px 40px, auto;
  opacity: 0.86;
  z-index: 1;
}

.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border: none;
  color: #06131b;
  font-weight: 700;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  max-width: 180px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  z-index: 2;
}

.marker-poi {
  background: #66f0dc;
}

.marker-loot {
  background: #ffd08a;
}

.marker-extract {
  background: #a4d3ff;
}

.marker-arc_spawn {
  background: #ff9f8c;
}

.map-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.map-columns h4 {
  margin-bottom: 0.4rem;
}

.map-columns ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.chip-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chip,
.pill,
.rarity {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.35;
}

.rarity-common {
  background: rgba(130, 200, 190, 0.12);
}

.rarity-uncommon {
  background: rgba(146, 208, 255, 0.16);
}

.rarity-rare {
  background: rgba(255, 207, 129, 0.17);
}

.rarity-epic,
.rarity-legendary {
  background: rgba(255, 150, 127, 0.18);
}

.priority-critical {
  background: rgba(255, 131, 91, 0.18);
  border-color: rgba(255, 131, 91, 0.6);
}

.priority-high {
  background: rgba(255, 196, 107, 0.18);
  border-color: rgba(255, 196, 107, 0.54);
}

.priority-medium {
  background: rgba(167, 219, 255, 0.18);
  border-color: rgba(167, 219, 255, 0.54);
}

.priority-low {
  background: rgba(130, 224, 196, 0.18);
  border-color: rgba(130, 224, 196, 0.5);
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.44rem 0.72rem;
  width: fit-content;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 0.56rem 0.6rem;
  border-bottom: 1px solid rgba(132, 193, 220, 0.14);
  text-align: left;
  vertical-align: top;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(8, 18, 27, 0.95);
  z-index: 1;
}

.table-title {
  font-weight: 700;
}

.table-meta {
  margin-top: 0.25rem;
}

.compare-table th:first-child,
.compare-table td:first-child {
  position: sticky;
  left: 0;
  background: rgba(8, 18, 27, 0.95);
  min-width: 120px;
}

.inline-link {
  background: transparent;
  border-radius: 8px;
  padding: 0.22rem 0.5rem;
}

.chip-remove {
  border: none;
  padding: 0;
  margin-left: 0.35rem;
  background: transparent;
}

.muted {
  color: var(--muted);
}

.site-footer {
  width: min(1400px, 95vw);
  margin: 0 auto 2rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  font-size: 0.9rem;
}

.fade-up {
  animation: fadeUp 340ms ease both;
}

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

@media (max-width: 980px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .results-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .item-facts {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 300px;
  }
}

@media (max-width: 640px) {
  .layout {
    width: min(95vw, 95vw);
  }

  .map-marker {
    max-width: 120px;
    font-size: 0.64rem;
  }

  .nav-btn,
  .action-btn {
    padding: 0.44rem 0.65rem;
  }
}
