/* DBO Wiki - Main Styles */
:root {
  --bg-primary: #1c1917;
  --bg-secondary: #231f1b;
  --bg-card: #2a2520;
  --bg-infobox: #2a2520;
  --text-primary: #e8e0d6;
  --text-secondary: #a89f94;
  --text-heading: #faf5ef;
  --accent: #e8442e;
  --accent-hover: #ff6347;
  --link: #d4a040;
  --link-hover: #e8b850;
  --border: #3a332b;
  --badge-bg: #3a332b;
  --nav-bg: #141110;
  --success: #2ecc71;
  --warning: #f39c12;
}

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

/* Image protection overlay */
.spawn-map, .entity-icon, .mob-tt-portrait, .card-icon, .tool-icon {
  -webkit-user-drag: none;
  user-select: none;
}
.spawn-map::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 4;
}

/* Skeleton loader */
.skeleton-wrap { padding: 1rem 0; animation: shimmer 1.5s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Skeleton shared bar */
.skeleton-wrap::before, .skeleton-wrap::after {
  content: '';
  display: block;
  border-radius: 4px;
  background: var(--bg-card);
}

/* Detail page skeleton: title bar + sidebar/content grid */
.skeleton-detail::before { height: 28px; width: 50%; margin-bottom: 1rem; }
.skeleton-detail::after { height: 14px; width: 35%; margin-bottom: 1.5rem; }
.skeleton-detail {
  background:
    linear-gradient(var(--bg-card) 100%, transparent 0) 0 80px / 240px 300px no-repeat,
    linear-gradient(var(--border) 14px, transparent 0) 270px 80px / calc(100% - 270px) 14px no-repeat,
    linear-gradient(var(--border) 14px, transparent 0) 270px 108px / calc(100% - 310px) 14px no-repeat,
    linear-gradient(var(--border) 14px, transparent 0) 270px 136px / calc(100% - 340px) 14px no-repeat,
    linear-gradient(var(--border) 14px, transparent 0) 270px 180px / calc(100% - 290px) 14px no-repeat,
    linear-gradient(var(--border) 14px, transparent 0) 270px 208px / calc(100% - 350px) 14px no-repeat,
    linear-gradient(var(--border) 14px, transparent 0) 270px 236px / calc(100% - 300px) 14px no-repeat;
  min-height: 400px;
  border-radius: 6px;
}

/* Index/overview skeleton: title + table rows */
.skeleton-index::before { height: 28px; width: 30%; margin-bottom: 0.5rem; }
.skeleton-index::after { height: 14px; width: 20%; margin-bottom: 1rem; }
.skeleton-index {
  background:
    linear-gradient(var(--border) 1px, transparent 0) 0 0 / 100% 44px repeat-y,
    linear-gradient(var(--bg-card) 30px, transparent 0) 0 7px / 100% 44px repeat-y;
  min-height: 500px;
  border-radius: 6px;
}

/* Home skeleton: centered cards */
.skeleton-home::before { height: 36px; width: 200px; margin: 2rem auto 0.5rem; }
.skeleton-home::after { height: 14px; width: 350px; margin: 0 auto 2rem; }
.skeleton-home {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  background: none;
}

@media (max-width: 768px) {
  .skeleton-detail {
    background:
      linear-gradient(var(--bg-card) 100%, transparent 0) 0 80px / 100% 200px no-repeat,
      linear-gradient(var(--border) 14px, transparent 0) 0 300px / 80% 14px no-repeat,
      linear-gradient(var(--border) 14px, transparent 0) 0 328px / 60% 14px no-repeat,
      linear-gradient(var(--border) 14px, transparent 0) 0 356px / 70% 14px no-repeat;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3, h4 { color: var(--text-heading); margin-bottom: 0.5em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; border-bottom: 2px solid; border-image: linear-gradient(90deg, #e8442e, #f5bc00, #e87a20) 1; padding-bottom: 0.3em; margin-top: 1.5em; }

/* Navigation */
.topnav {
  background: var(--nav-bg);
  border-bottom: 2px solid;
  border-image: linear-gradient(90deg, #e8442e, #f5bc00, #e87a20) 1;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  height: 56px;
}
.nav-logo {
  text-decoration: none !important;
  flex-shrink: 0;
}
.nav-logo-img {
  height: 40px;
  width: auto;
  display: block;
}
.nav-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: 3rem;
}
.nav-links a {
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: background 0.2s;
}
.nav-links a:hover {
  background: var(--bg-card);
  text-decoration: none;
  color: var(--accent);
}
.nav-tools {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
}
.nav-tools a {
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  transition: background 0.2s;
}
.nav-tools a:hover {
  background: var(--bg-card);
  text-decoration: none;
}
.nav-search {
  position: relative;
}
.nav-search input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  width: 220px;
  font-size: 0.9rem;
}
.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
}
/* Language selector */
.lang-selector {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}
.lang-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  line-height: 1;
  color: #888;
  font-weight: 600;
  transition: color 0.2s, border-color 0.2s;
}
.lang-btn:hover { color: #fff; }
.lang-btn.active {
  color: #fff;
  border-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Theme Picker */
.theme-picker {
  position: relative;
  margin-left: 6px;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  z-index: 300;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.theme-dropdown.active { display: block; }
.theme-dropdown { max-height: 400px; overflow-y: auto; }
.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.theme-btn:hover { background: var(--bg-secondary); }
.theme-btn.active { background: var(--bg-secondary); color: var(--accent); font-weight: 600; }
.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 350px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: none;
  z-index: 200;
}
.search-dropdown.active { display: block; }
.search-result-item {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.search-result-item:hover { background: var(--bg-secondary); }
.search-result-item a { color: var(--text-primary); display: block; }
.search-result-type { font-size: 0.75rem; color: var(--text-secondary); }
.search-loading {
  padding: 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.search-spinner {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 6px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Breadcrumb */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.breadcrumb .sep { margin: 0 0.4rem; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--link); }

/* Content */
.content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  flex: 1;
  width: 100%;
}

/* Entity Pages */
.entity-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0;
  margin-bottom: 0.75rem;
}
.entity-header h1 {
  margin-bottom: 0;
  line-height: 1.2;
}
.entity-icon {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}
.entity-portrait {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  border: 2px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}
.entity-mob-type {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  image-rendering: pixelated;
}
.entity-subtitle {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0;
  line-height: 1.2;
}
.entity-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1.5rem;
}
.entity-layout > .entity-content > section:first-child > h2 {
  margin-top: 0;
}
.entity-layout > .infobox > .game-tooltip {
  margin-top: 0;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--text-primary);
}
/* Rank badge colors from Logic_GetItemRankColor in DboLogic.cpp */
.badge-common { background: #555; color: #fefefe; }
.badge-uncommon { background: #1a3a5c; color: #94bfea; }
.badge-excellent { background: #4a3a10; color: #ffda4b; }
.badge-rare { background: #4a1a24; color: #f36a7c; }
.badge-unique { background: #4a1a24; color: #f36a7c; }
.badge-legendary { background: #3a1a3a; color: #e779d2; }
.badge-source { background: var(--accent); color: #fff; text-transform: uppercase; font-size: 0.7rem; }
.badge-grade-0 { background: #555; }
.badge-grade-1 { background: #2e7d32; }
.badge-grade-2 { background: #1565c0; }
.badge-grade-3 { background: #e65100; }
.badge-grade-4 { background: #6a1b9a; }

/* Spawn maps */
/* NPC sections masonry layout */
.npc-sections-masonry {
  columns: 2;
  column-gap: 1.5rem;
}
.npc-section-item {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}
.npc-section-item h2 { margin-top: 0.3rem; }
@media (max-width: 900px) {
  .npc-sections-masonry { columns: 1; }
}

.spawn-map-container {
  margin-bottom: 1.5rem;
}
.spawn-map-label {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  color: #fff; font-size: 0.85rem; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.5);
  pointer-events: none;
}
.spawn-map {
  max-width: 100%;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.spawn-map-img {
  display: block;
  width: 100%;
  max-width: 512px;
  height: auto;
}
.spawn-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #e94560;
  border: 1px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(233,69,96,0.8);
}
.spawn-dot-npc {
  background: #269eff;
  box-shadow: 0 0 4px rgba(38,158,255,0.8);
}

/* Rank tabs for Best Stats */
.rank-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0.75rem;
}
.rank-tab {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.rank-tab:hover { opacity: 0.8; }
.rank-tab.active { opacity: 1; border-bottom-color: transparent; }
.rank-panel { display: none; }
.rank-panel.active { display: block; }
/* Mob tooltip header */
.mob-tooltip-header {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 6px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.mob-tt-icons {
  display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0;
}
.mob-tt-icon {
  width: 28px; height: 28px; image-rendering: pixelated;
}
.mob-tt-portrait {
  width: 48px; height: 48px; border-radius: 6px; border: 1px solid rgba(214,214,214,0.4);
  object-fit: cover;
}
.mob-tt-name {
  font-size: 1.3rem; font-weight: 700; color: var(--text-heading);
  margin: 0; line-height: 1.2;
}
.mob-tt-sub {
  display: flex; gap: 4px; align-items: center; margin-top: 3px;
}

/* Mob detail 3-column layout */
.mob-layout-3col {
  display: grid; grid-template-columns: 220px 1fr; gap: 1rem;
  align-items: start; margin-top: 1.5rem;
}
.mob-stats-col { min-width: 0; }
.mob-right-col { min-width: 0; }
.mob-right-col h2 { margin-top: 0.3rem; }
.mob-right-col { min-width: 0; }
.mob-spawn-drops {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start;
}
.mob-spawn-col { min-width: 0; }
.mob-drops-col { min-width: 0; }
.mob-level-panel { display: none; }
.mob-level-panel.active { display: block; }
@media (max-width: 1100px) {
  .mob-spawn-drops { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .mob-layout-3col { grid-template-columns: 1fr; }
}

/* Collapsible sections */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.collapsible-header::before {
  content: '\25B6';
  font-size: 0.7em;
  transition: transform 0.2s;
  display: inline-block;
}
.collapsible-header.open::before {
  transform: rotate(90deg);
}
.collapsible-body {
  display: none;
  margin-top: 0.5rem;
}
.collapsible-body.open {
  display: block;
}

/* Interactive Map Tool */
.map-tool { margin-top: 0.5rem; display: flex; flex-direction: column; align-items: center; }
.map-planets {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.map-planet-btn {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
  font-size: 0.85rem; font-weight: 600; transition: all 0.15s;
}
.map-planet-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.map-planet-btn.active { border-color: var(--accent); background: rgba(245,188,0,0.15); color: var(--text-heading); }

.map-zones {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.map-zone-btn {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-secondary); color: var(--text-secondary); cursor: pointer;
  font-size: 0.78rem; transition: all 0.15s;
}
.map-zone-btn:hover { border-color: var(--link); color: var(--text-primary); }
.map-zone-btn.active { border-color: var(--link); background: rgba(212,165,32,0.15); color: var(--link); }

.map-filters {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 0.75rem; font-size: 0.82rem;
}
.map-filter { display: flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text-secondary); }
.map-filter input { cursor: pointer; }
.dot-npc-legend, .dot-merchant-legend, .dot-teleporter-legend, .dot-skill-legend, .dot-mob-legend {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.5);
}
.dot-npc-legend { background: #269eff; }
.dot-merchant-legend { background: #2ecc71; }
.dot-teleporter-legend { background: #e779d2; }
.dot-skill-legend { background: #ffda4b; }
.dot-mob-legend { background: #e94560; }

.map-container {
  display: block;
}
.map-viewport {
  position: relative; overflow: hidden; cursor: grab;
  width: 806px; height: 605px;
  user-select: none; border-radius: 6px;
}
.map-viewport canvas {
  display: block;
}
#map-markers {
  position: absolute; top: 0; left: 0; width: 806px; height: 605px; pointer-events: none;
}
.map-dot {
  position: absolute; width: 8px; height: 8px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.7);
  transform: translate(-50%, -50%); cursor: pointer; pointer-events: all; z-index: 2;
  transition: transform 0.1s;
  text-decoration: none;
}
.map-dot:hover { transform: translate(-50%, -50%) scale(2); z-index: 10; }
.map-dot-npc { background: #269eff; box-shadow: 0 0 4px rgba(38,158,255,0.6); }
.map-dot-merchant { background: #2ecc71; box-shadow: 0 0 4px rgba(46,204,113,0.6); }
.map-dot-teleporter { background: #e779d2; box-shadow: 0 0 4px rgba(231,121,210,0.6); }
.map-dot-skill_master { background: #ffda4b; box-shadow: 0 0 4px rgba(255,218,75,0.6); }
.map-dot-mob { background: #e94560; box-shadow: 0 0 4px rgba(233,69,96,0.6); }

.map-tooltip {
  position: absolute; z-index: 1000; padding: 4px 8px;
  background: rgba(0,0,0,0.9); border: 1px solid rgba(214,214,214,0.5);
  border-radius: 4px; color: #fff; font-size: 0.78rem; white-space: nowrap;
  pointer-events: none; display: none;
}

.map-hint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; padding: 8px 16px;
  background: rgba(0, 0, 0, 0.75); border: 1px solid rgba(214, 214, 214, 0.4);
  border-radius: 20px; z-index: 30; pointer-events: none;
}
.map-hint-item {
  color: rgba(255, 255, 255, 0.9); font-size: 0.78rem; white-space: nowrap;
}

.map-pin {
  position: absolute; font-size: 24px; transform: translate(-50%, -100%);
  pointer-events: none; z-index: 20; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
  animation: pin-drop 0.3s ease-out;
}
@keyframes pin-drop { from { transform: translate(-50%, -200%); opacity: 0; } to { transform: translate(-50%, -100%); opacity: 1; } }

.map-share {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.82rem; flex-wrap: wrap; width: 806px; margin-top: 6px;
}
.map-share span { color: var(--text-secondary); white-space: nowrap; }
.map-share input {
  flex: 1; min-width: 200px; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 3px; background: var(--bg-secondary); color: var(--text-primary);
  font-size: 0.8rem;
}
.map-share button {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 3px;
  background: var(--bg-secondary); color: var(--text-primary); cursor: pointer;
  font-size: 0.8rem;
}
.map-share button:hover { border-color: var(--link); }

/* Skill Calculator embed */
.skill-calc-embed {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Footer */
.footer-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 4px;
  opacity: 0.7;
}
.site-footer {
  background: var(--nav-bg);
  border-top: 2px solid;
  border-image: linear-gradient(90deg, #e8442e, #f5bc00, #e87a20) 1;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Index Pages */
.index-page h1 { margin-bottom: 0.3em; display: flex; align-items: center; gap: 0.5rem; }
.index-page-icon { width: 40px; height: 40px; flex-shrink: 0; }
.index-count { color: var(--text-secondary); margin-bottom: 0.75rem; }

/* Category filter bar */
.cat-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 6px 0;
}
.cat-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.cat-btn img {
  width: 22px; height: 22px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.cat-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.cat-btn.active {
  border-color: var(--accent);
  background: rgba(245,188,0,0.15);
  color: var(--text-heading);
}
.cat-label {
  white-space: nowrap;
}

/* Sub-type chips */
.subtype-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.subtype-chip {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s;
}
.subtype-chip:hover {
  border-color: var(--link);
  color: var(--text-primary);
}
.subtype-chip.active {
  border-color: var(--link);
  background: rgba(212,165,32,0.15);
  color: var(--link);
}
.index-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filter-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
.filter-input:focus { outline: none; border-color: var(--accent); }
.filter-small { width: 100px; }

/* Source toggle filters */
.source-toggle {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 0.8rem; color: var(--text-secondary); transition: all 0.15s;
}
.page-filter-notice {
  padding: 6px 12px; margin-bottom: 0.5rem; border-radius: 4px;
  background: rgba(245,188,0,0.1); border: 1px solid rgba(245,188,0,0.3);
  color: var(--text-secondary); font-size: 0.78rem;
}
.source-toggle:has(input:checked) {
  border-color: var(--link); background: rgba(212,165,32,0.15); color: var(--link);
}
.source-toggle input { display: none; }
.reset-link {
  color: var(--accent); font-size: 0.8rem; margin-left: 8px; text-decoration: none;
}
.reset-link:hover { text-decoration: underline; }

/* Pagination */
.pagination {
  display: flex; justify-content: center; align-items: center; gap: 4px;
  margin-top: 1rem; padding: 0.5rem 0; flex-wrap: wrap;
}
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-card); color: var(--text-primary);
  font-size: 0.85rem; text-decoration: none; transition: all 0.15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-current {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.page-dots { color: var(--text-secondary); padding: 0 4px; }

/* Level range slider */
.level-slider-wrap {
  display: flex; align-items: center; gap: 4px;
}
.level-label {
  font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap;
}
.level-slider {
  position: relative; width: 120px; height: 20px;
}
.level-slider input[type=range] {
  position: absolute; width: 100%; top: 50%; left: 0;
  transform: translateY(-50%);
  -webkit-appearance: none; appearance: none; background: transparent;
  pointer-events: none; height: 20px; margin: 0; z-index: 1;
}
.level-slider input.range-min { z-index: 2; }
.level-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--link); border: 2px solid #fff;
  cursor: pointer; pointer-events: all;
}
.level-slider input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--link); border: 2px solid #fff;
  cursor: pointer; pointer-events: all;
}
.level-slider input[type=range]::-webkit-slider-runnable-track {
  height: 4px; background: var(--border); border-radius: 2px;
}
.level-slider input.range-min::-webkit-slider-runnable-track {
  background: transparent;
}
.level-slider input[type=range]::-moz-range-track {
  height: 4px; background: var(--border); border-radius: 2px;
}
.level-slider input.range-min::-moz-range-track {
  background: transparent;
}

/* Home Page */
.home-hero {
  text-align: center;
  padding: 3rem 1rem;
}
.home-hero h1 {
  font-size: 2.5rem;
  background: linear-gradient(90deg, #e8442e, #f5bc00, #e87a20);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.home-hero p { color: var(--text-secondary); font-size: 1.1rem; margin-top: 0.5rem; }
.home-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 2rem auto;
}
.home-card {
  width: 200px;
  flex-shrink: 0;
}
.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}
.home-card:hover {
  border-color: #e87a20;
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(232,122,32,0.15);
}
.home-card .card-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 0.5rem;
}
.home-card .card-count {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.home-card .card-label {
  font-size: 1rem;
  color: var(--text-primary);
  margin-top: 0.3rem;
}

/* Home Tools */
.home-tools {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.home-tool-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.5rem;
  border: 2px solid #e87a20;
  border-radius: 8px;
  background: rgba(232,122,32,0.08);
  color: var(--text-heading);
  font-size: 1rem;
  font-weight: 700;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.home-tool-btn:hover {
  background: rgba(232,122,32,0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(232,68,46,0.25);
  text-decoration: none;
  color: var(--text-heading);
}
.home-tool-btn .tool-icon {
  width: 36px;
  height: 32px;
  image-rendering: pixelated;
}

/* Responsive */
@media (max-width: 768px) {
  .entity-layout {
    grid-template-columns: 1fr;
  }
  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0.5rem 1rem;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 10;
    gap: 0;
    margin-left: 0;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
  }
  .nav-links a {
    padding: 0.5rem 0.6rem;
  }
  .nav-tools {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 11;
    gap: 0;
    margin-left: 0;
  }
  .nav-tools a {
    padding: 0.5rem 0.6rem;
  }
  .nav-toggle { display: block; }
  .nav-search { margin-left: auto; }
  .nav-search input { width: 120px; }
  .home-hero h1 { font-size: 1.8rem; }
  .home-cards { gap: 0.75rem; }
  .home-card { width: 150px; }
  .home-card .card-icon { width: 48px; height: 48px; }
  .home-tools { flex-direction: column; align-items: center; }
  .npc-sections-masonry { columns: 1; }
  .content { padding: 0 0.5rem 1rem; }
  .index-filters { flex-direction: column; }
  .data-table { font-size: 0.8rem; }
  .theme-picker { margin-left: 4px; }
  .lang-selector { gap: 1px; margin-left: 4px; }
  .lang-btn { padding: 2px 4px; font-size: 0.7rem; }

  /* Map tool mobile */
  .map-viewport { width: 100% !important; height: auto !important; aspect-ratio: 806/605; }
  #map-markers { width: 100% !important; height: 100% !important; }
  .map-share { width: 100% !important; }
  .map-tool { display: flex; flex-direction: column; align-items: center; }
}
