/* Self-hosted (public/fonts/) rather than a Google Fonts <link> - no third-party dependency for
   a font the whole site's typography rests on, and one less external request in the critical
   render path. Oswald carries headers/labels/nav (condensed, stencil-adjacent - the "field
   manual" register); IBM Plex Sans carries body/data text. */
@font-face {
  font-family: "Oswald";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/oswald600.woff2") format("woff2");
}
@font-face {
  font-family: "Oswald";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/oswald700.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/plex400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/plex600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/plex700.woff2") format("woff2");
}

:root {
  --bg: #12140f;
  --surface: #1a1d15;
  --surface-raised: #21251a;
  --surface-hover: #2a2f20;
  --border: #3a3f2c;
  --border-soft: #262a1c;
  --text: #eae6d5;
  --text-muted: #a8a487;
  --text-faint: #6f6d56;
  --accent: #d97a34;
  --accent-strong: #f0934a;
  --accent-ink: #241205;
  --ok: #7fb069;
  --warn: #e0b04a;
  --error: #d9534f;
  --radius-sm: 3px;
  --radius: 6px;
  --radius-lg: 9px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --font-display: "Oswald", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* Faint diagonal hatch, not a literal hazard-stripe reproduction - just enough grain that
     large flat panels don't read as plain flat-color divs. Practically invisible at normal
     viewing distance/zoom; deliberately subtle rather than a visible decorative pattern. */
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 7px
  );
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
}

/* Scrollbars */
.sidebar-scroll::-webkit-scrollbar,
.quest-list::-webkit-scrollbar,
.debug-panel-scroll::-webkit-scrollbar {
  width: 9px;
}
.sidebar-scroll::-webkit-scrollbar-track,
.quest-list::-webkit-scrollbar-track,
.debug-panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb,
.quest-list::-webkit-scrollbar-thumb,
.debug-panel-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover,
.quest-list::-webkit-scrollbar-thumb:hover,
.debug-panel-scroll::-webkit-scrollbar-thumb:hover {
  background: #454b34;
}

/* ---------- Header ---------- */

header {
  padding: 0.6rem 1.1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  background: linear-gradient(to bottom, var(--surface-raised), var(--surface));
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 5;
}

/* Thin gradient strip along the very top edge - the one deliberate accent flourish on the page,
   kept to a hairline so it reads as a considered detail rather than a decorative banner. */
header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 55%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-right: 0.75rem;
  border-right: 1px solid var(--border-soft);
  margin-right: 0.25rem;
}

/* A small rotated-square "reticle" mark rather than a plain dot - reads as a targeting/waypoint
   glyph without being a literal crosshair icon. */
.brand-mark {
  width: 9px;
  height: 9px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(217, 122, 52, 0.65);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.brand-name strong {
  color: var(--text);
  font-weight: 700;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.site-nav a {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  white-space: nowrap;
}

.site-nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.site-nav a.active {
  color: var(--accent-strong);
  background: var(--surface-hover);
}

/* ---------- Nav dropdown (Progression, matching tarkov.dev's own top-nav grouping) ---------- */

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-dropdown-toggle::after {
  content: "▾";
  margin-left: 0.3rem;
  font-size: 0.65rem;
  opacity: 0.7;
}

.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown-toggle:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-dropdown-toggle.active {
  color: var(--accent-strong);
  background: var(--surface-hover);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  padding: 0.35rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 40;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a,
.nav-dropdown-disabled {
  display: block;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.nav-dropdown-menu a {
  color: var(--text);
  text-decoration: none;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  background: var(--surface-hover);
  color: var(--accent-strong);
}

.nav-dropdown-disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.field label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

header select {
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

header select:hover {
  border-color: #4a5138;
}

header select:focus-visible,
.btn:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.marker-toggle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

input[type="range"] {
  accent-color: var(--accent);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}

.btn:hover {
  background: #343a25;
  border-color: var(--accent);
  color: var(--accent-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn-icon {
  padding: 0.45rem 0.55rem;
  font-size: 0.7rem;
}

.btn-toggle.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.status-ok .status-dot {
  background: var(--ok);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

.status-warn .status-dot {
  background: var(--warn);
  box-shadow: 0 0 6px rgba(234, 182, 84, 0.6);
}

.status-error .status-dot {
  background: var(--error);
  box-shadow: 0 0 6px rgba(241, 101, 101, 0.6);
}

/* ---------- Markers ---------- */

#markers,
#labels,
#hazard-zones {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --marker-scale: 1;
}

#hazard-zones {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hazard-zone {
  fill: rgba(180, 30, 30, 0.3);
  stroke: #e03c3c;
  stroke-width: 2;
  stroke-dasharray: 6, 4;
  vector-effect: non-scaling-stroke;
}

.marker {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: calc(0.65rem * var(--marker-scale));
  white-space: nowrap;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 3px;
}

.marker .marker-icon {
  width: calc(18px * var(--marker-scale));
  height: calc(18px * var(--marker-scale));
  flex-shrink: 0;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}

.marker.container .marker-icon,
.marker.looseLoot .marker-icon {
  width: calc(10px * var(--marker-scale));
  height: calc(10px * var(--marker-scale));
}

.marker .marker-label {
  text-shadow: 0 0 3px #000, 0 0 3px #000;
  color: #fff;
}

.marker.container .marker-label,
.marker.looseLoot .marker-label {
  display: none;
}

.map-label {
  position: absolute;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 0 4px #000, 0 0 4px #000, 0 0 4px #000;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- Layout ---------- */

.main-layout {
  display: flex;
  align-items: stretch;
}

.quest-sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 75vh;
  transition: width 0.18s var(--ease);
  overflow: hidden;
}

.quest-sidebar.collapsed {
  width: 0;
  border-right: none;
}

.sidebar-scroll {
  overflow-y: auto;
  height: 100%;
}

.quest-sidebar details {
  border-bottom: 1px solid var(--border-soft);
}

.quest-sidebar summary {
  font-family: var(--font-display);
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  background: var(--surface-raised);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  list-style: none;
}

.quest-sidebar summary::-webkit-details-marker {
  display: none;
}

.quest-sidebar summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--accent);
  transition: transform 0.15s var(--ease);
  font-size: 0.7rem;
}

.quest-sidebar details[open] summary::before {
  transform: rotate(90deg);
}

.quest-sidebar summary:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.quest-sidebar details > label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.85rem 0.4rem 1.6rem;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s var(--ease);
}

.quest-sidebar details > label:hover {
  background: var(--surface-hover);
}

.option-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  order: -1;
}

.quest-list .quest-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.quest-sidebar-actions {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
}

.quest-sidebar-actions button {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.2rem 0.5rem;
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.quest-sidebar-actions button:hover {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.quest-list {
  overflow-y: auto;
  max-height: 40vh;
  padding: 0.1rem 0 0.5rem;
  font-size: 0.75rem;
}

.quest-list-group-heading {
  padding: 0.4rem 0.85rem 0.15rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.quest-list label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.3rem 0.85rem 0.3rem 1.6rem;
  cursor: pointer;
  transition: background 0.1s var(--ease);
}

.quest-list label:hover {
  background: var(--surface-hover);
}

#marker-size {
  width: 90px;
}

@media (max-width: 700px) {
  .main-layout {
    flex-direction: column;
  }
  .quest-sidebar {
    width: 100%;
    height: 160px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .map-viewport {
    height: 60vh;
  }
  .brand-name {
    display: none;
  }
}

/* ---------- Map viewport ---------- */

.map-viewport {
  position: relative;
  width: 100%;
  flex: 1;
  height: 75vh;
  overflow: hidden;
  /* Map SVGs leave undeveloped terrain transparent rather than painting every square meter.
     A near-black page background turns those gaps into what looks like broken empty space;
     a neutral mid-gray (matching tarkov.dev's own page background) reads as plausible ground
     instead. No vignette here for the same reason -- it would darken exactly the edges/corners
     where transparent gaps are most likely to show. */
  background: #2d2d2f;
  cursor: grab;
  touch-action: none;
}

.map-viewport.dragging {
  cursor: grabbing;
}

.map-wrap {
  position: relative;
  width: 100%;
  line-height: 0;
  transform-origin: 0 0;
}

.map-wrap img {
  width: 100%;
  display: block;
  user-select: none;
}

.player-marker {
  position: absolute;
  display: none;
}

.dot {
  position: absolute;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 50%;
  background: #ff4d4d;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.25), 0 0 10px rgba(255, 77, 77, 0.8);
  animation: pulse 2s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.25), 0 0 10px rgba(255, 77, 77, 0.8);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 77, 77, 0.12), 0 0 14px rgba(255, 77, 77, 0.9);
  }
}

/* A brief expanding ring fired on every new screenshot, distinct from the constant subtle
   pulse above — meant to catch your eye at the moment a fresh position lands, not just mark
   where the dot generally is. */
.player-ping {
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 50%;
  border: 3px solid #ff4d4d;
  pointer-events: none;
  opacity: 0;
}

.player-ping.firing {
  animation: ping-flash 0.8s ease-out;
}

@keyframes ping-flash {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  100% {
    transform: scale(4.5);
    opacity: 0;
  }
}

/* Facing direction, from the screenshot's rotation quaternion — see CLAUDE.md
   "Facing direction". 0deg points up; rotated clockwise by computeHeadingDegrees(). */
.facing-arrow {
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
  transform: rotate(0deg);
}

.facing-arrow polygon {
  fill: #ffd24d;
  stroke: #000;
  stroke-width: 0.5;
}

.sidebar-hint {
  margin: 0;
  padding: 0.4rem 0.85rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--text-faint);
}

.nearest-extract-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 4;
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  background: rgba(23, 26, 31, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  color: var(--text);
  pointer-events: none;
}

.nearest-extract-arrow {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
}

.nearest-extract-arrow polygon {
  fill: #4ade80;
  stroke: #000;
  stroke-width: 0.5;
}

.cursor-coords-badge {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  z-index: 4;
  padding: 0.4rem 0.7rem;
  background: rgba(23, 26, 31, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  font-family: "Consolas", "SF Mono", monospace;
  color: var(--text);
  pointer-events: none;
}

/* ---------- Debug panel ---------- */

.debug-panel {
  padding: 0.85rem 1.1rem 1.1rem;
  font-size: 0.8rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.debug-panel h3 {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.debug-panel-scroll {
  max-height: 40vh;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.debug-panel table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.75rem;
}

.debug-panel th,
.debug-panel td {
  text-align: left;
  padding: 0.4rem 0.65rem;
  white-space: nowrap;
}

.debug-panel tbody tr {
  border-top: 1px solid var(--border-soft);
  transition: background 0.1s var(--ease);
}

.debug-panel tbody tr:hover {
  background: var(--surface-hover);
}

.debug-panel tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.debug-panel th {
  color: var(--text-muted);
  font-weight: 600;
  font-family: "Segoe UI", system-ui, sans-serif;
  position: sticky;
  top: 0;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

.no-calibration {
  color: var(--warn);
}

/* ---------- Trading page ---------- */

.trading-search input {
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 220px;
}

.trading-panel {
  padding: 1rem 1.25rem;
}

.trading-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 70ch;
  margin: 0 0 1rem;
}

.trading-table-scroll {
  overflow: auto;
  max-height: calc(100vh - 160px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

#trading-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#trading-table th,
#trading-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

#trading-table th {
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

#trading-table th:hover {
  color: var(--text);
  background: var(--surface-hover);
}

#trading-table tbody tr {
  border-top: 1px solid var(--border-soft);
  transition: background 0.1s var(--ease);
}

#trading-table tbody tr:hover {
  background: var(--surface-hover);
}

.item-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.positive {
  color: var(--ok);
}

.negative {
  color: var(--error);
}

/* ---------- Catalog pages (Items / Traders / Bosses) ---------- */

.catalog-sidebar {
  height: calc(100vh - 61px);
}

.catalog-main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.85rem 0.4rem 1.6rem;
  font-size: 0.8rem;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s var(--ease);
}

.category-item:hover {
  background: var(--surface-hover);
}

.category-item.active {
  background: var(--surface-hover);
  color: var(--accent-strong);
}

.category-count {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.7rem;
}

.item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.7rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  text-align: center;
  transition: background 0.1s var(--ease), border-color 0.1s var(--ease);
}

.item-card:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.item-card-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.item-card-name {
  font-size: 0.76rem;
  line-height: 1.25;
}

.item-card-price {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ---------- Modal (item / trader detail) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-panel {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--accent-strong);
  background: #343a25;
}

.item-modal-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.item-modal-image {
  width: 90px;
  height: 90px;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.item-modal-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.item-modal-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.item-modal-header a {
  font-size: 0.78rem;
  color: var(--accent-strong);
}

.item-modal-description {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: pre-line;
  margin: 0 0 0.9rem;
}

.modal-panel h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 1rem 0 0.4rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.3rem 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.stat-row span:first-child {
  color: var(--text-muted);
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.modal-table td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--border-soft);
}

/* ---------- Traders page ---------- */

.trader-page {
  padding: 1.25rem;
}

.trader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.8rem;
}

.trader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  text-align: center;
  transition: background 0.1s var(--ease), border-color 0.1s var(--ease);
}

.trader-card:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.trader-card-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.trader-card-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.trader-card-countdown {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.trader-assortment-search {
  margin-bottom: 0.5rem;
}

.trader-assortment-search input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.trader-assortment-scroll {
  max-height: 40vh;
  overflow-y: auto;
}

/* ---------- Bosses page ---------- */

.boss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.8rem;
}

.boss-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.boss-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.boss-card-icon {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  flex-shrink: 0;
}

.boss-card-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.boss-map-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border-soft);
}

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

.boss-map-chance {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Calculators page ---------- */

#calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

#calc-table th,
#calc-table td {
  text-align: left;
  padding: 0.45rem 0.7rem;
  vertical-align: top;
}

#calc-table th {
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#calc-table tbody tr {
  border-top: 1px solid var(--border-soft);
  transition: background 0.1s var(--ease);
}

#calc-table tbody tr:hover {
  background: var(--surface-hover);
}

.converter-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.converter-row input,
.converter-row select {
  padding: 0.5rem 0.7rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.converter-row input {
  width: 120px;
}

.converter-result {
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 100px;
}

/* ---------- Tasks page ---------- */

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

.task-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  text-align: left;
  transition: background 0.1s var(--ease), border-color 0.1s var(--ease);
}

.task-card:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.task-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.task-card-icon {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  flex-shrink: 0;
}

.task-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}

.task-card-trader {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.task-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-kappa {
  background: var(--accent);
  color: var(--accent-ink);
}

.badge-lightkeeper {
  background: #3a4a63;
  color: #cfe0f5;
}

.task-modal-rewards {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Fixed Type column, flowing Description, fixed right-aligned Count - same responsive shape as
   #calc-table, just scoped to this table via column widths below instead of an id. */
.task-objectives-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.task-objectives-table th,
.task-objectives-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  vertical-align: top;
}

.task-objectives-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

.task-objectives-table tbody tr {
  border-top: 1px solid var(--border-soft);
}

.task-objectives-table tr.optional {
  color: var(--text-muted);
  font-style: italic;
}

.task-objective-type {
  width: 110px;
  white-space: nowrap;
  color: var(--text-faint);
}

.task-objective-count {
  width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.objective-link {
  color: var(--accent-strong);
  text-decoration: underline dotted;
}

.objective-link:hover {
  color: var(--accent);
}

/* ---------- Achievements page (UI scaffold - see achievements.js for the mock data note) ---------- */

.achievements-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.achievements-table th,
.achievements-table td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  vertical-align: middle;
}

.achievements-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

.achievements-table tbody tr {
  border-top: 1px solid var(--border-soft);
  transition: background 0.1s var(--ease);
}

.achievements-table tbody tr:hover {
  background: var(--surface-hover);
}

.achievement-name-cell {
  width: 260px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  white-space: nowrap;
}

.achievement-icon {
  font-size: 1.1rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Real artwork path (data-provided `icon` starting with "/") - same footprint as .achievement-icon
   so swapping between the emoji placeholder and a real image doesn't shift row height/alignment. */
.achievement-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.achievement-rarity-cell {
  width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- Prestige page (UI scaffold - see prestige.js for the mock data note) ---------- */

.prestige-section {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.prestige-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}

.prestige-section-icon {
  color: var(--accent-strong);
}

.prestige-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.prestige-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s var(--ease);
}

.prestige-card:hover {
  background: var(--surface-hover);
}

/* Generic numbered rank badge - a plain shield silhouette (CSS clip-path pentagon) with a tier
   color progression, not a reproduction of any specific game's insignia artwork or texture. */
.prestige-badge {
  width: 56px;
  height: 60px;
  clip-path: polygon(50% 0%, 100% 22%, 100% 70%, 50% 100%, 0% 70%, 0% 22%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.prestige-badge-lg {
  width: 72px;
  height: 78px;
  font-size: 1.6rem;
}

/* Tier progression, purely a color choice - bronze/silver/gold/platinum bands as level increases. */
.prestige-tier-bronze {
  background: linear-gradient(160deg, #c98a4b, #8a5a2e);
  color: #2c1a0c;
}

.prestige-tier-silver {
  background: linear-gradient(160deg, #d9dee3, #8b939c);
  color: #262a2e;
}

.prestige-tier-gold {
  background: linear-gradient(160deg, #f0d27a, #b6862f);
  color: #2c2005;
}

.prestige-tier-platinum {
  background: linear-gradient(160deg, #cdeaff, #6fa8c9);
  color: #0d2430;
}

/* Real artwork path (data-provided `icon`) - same footprint as .prestige-badge so swapping
   between the two per-entry doesn't shift the grid/modal layout. */
.prestige-icon-img {
  width: 56px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}

.prestige-icon-img.prestige-badge-lg {
  width: 72px;
  height: 78px;
}

.prestige-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.task-reward-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.task-reward-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.task-required-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.task-required-chip {
  font-size: 0.76rem;
  padding: 0.25rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-muted);
}

/* ---------- Loot tiers page ---------- */

.loot-tier-note {
  margin-bottom: 1rem;
}

.loot-tier-group {
  margin-bottom: 1.1rem;
}

.loot-tier-heading {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.loot-tier-heading .tier-letter {
  font-size: 1.3rem;
  font-weight: 700;
}

.loot-tier-heading .tier-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tier-S .tier-letter { color: #f16565; }
.tier-A .tier-letter { color: var(--accent-strong); }
.tier-B .tier-letter { color: #4ade80; }
.tier-C .tier-letter { color: #6fa8dc; }
.tier-D .tier-letter { color: var(--text-faint); }

/* ---------- Wipe length page ---------- */

.wipe-summary-figure {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.wipe-summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ---------- Deep-link marker flash (Tasks objective -> map jump) ---------- */

@keyframes marker-flash-pulse {
  0%, 100% { filter: none; transform: translate(-50%, -50%) scale(1); }
  50% { filter: drop-shadow(0 0 8px var(--accent-strong)); transform: translate(-50%, -50%) scale(1.6); }
}

.marker-flash {
  animation: marker-flash-pulse 0.6s ease-in-out 4;
  z-index: 30;
}

/* ---------- Auth gate (Google Sign-In) ---------- */

.auth-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.auth-gate.open {
  display: flex;
}

.auth-gate-panel {
  position: relative;
  text-align: center;
  max-width: 360px;
  padding: 2.25rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Corner-bracket framing, the one HUD-coded flourish on the sign-in card - a nod to a targeting
   reticle/viewfinder without reproducing any actual crosshair or game icon. */
.auth-gate-panel::before,
.auth-gate-panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  opacity: 0.7;
}

.auth-gate-panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.auth-gate-panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

.auth-gate-panel h1 {
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.auth-gate-panel p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.auth-gate-field {
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  margin-bottom: 0.75rem;
}

.auth-gate-field label {
  margin-bottom: 0.3rem;
}

.auth-gate-field input {
  padding: 0.55rem 0.7rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.auth-gate-error {
  color: var(--error);
  font-size: 0.8rem;
  min-height: 1.2em;
  margin: 0.25rem 0 0.75rem;
}

#auth-gate-submit {
  width: 100%;
}
