/* Retro Nostalgic Nexia UI Theme Tokens & Styles */
:root {
  --bg-page: #0e0d0b;
  --bg-panel: #181512;
  --bg-card: #201c18;
  --bg-hover: #2c2721;
  --bg-input: #12100d;
  
  --border-gold: #9c7a38;
  --border-gold-light: #d4ab53;
  --border-bronze: #4e3a19;
  --border-dim: #2f2719;

  --text-main: #e8e2d4;
  --text-gold: #f7ca65;
  --text-dim: #a69c89;
  --text-cyan: #72cfb6;
  --text-red: #ff6b6b;
  --text-green: #69db7c;

  --badge-origin: #d9480f;
  --job-warrior: #e03131;
  --job-rogue: #1971c2;
  --job-mage: #9c36b5;
  --job-poet: #2f9e44;

  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

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

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: var(--border-bronze); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-gold); }

/* Retro Header */
.retro-header {
  background: var(--bg-panel);
  border-bottom: 2px solid var(--border-gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-gold);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 2px #000;
}

.brand-link:hover {
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  overflow-x: auto;
  padding-bottom: 2px;
}

.nav-links a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
  background: var(--bg-card);
  border-color: var(--border-gold);
  color: var(--text-gold);
}

/* Container */
.main-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  flex: 1;
}

/* Google-Style Hero Homepage */
.hero-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 50px auto 30px;
  text-align: center;
}

.hero-title {
  font-size: 36px;
  color: var(--text-gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 28px;
}

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 680px;
}

.search-input-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 2px solid var(--border-gold);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.8), 0 0 10px rgba(156, 122, 56, 0.2);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.search-input-box:focus-within {
  border-color: var(--border-gold-light);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.8), 0 0 16px rgba(212, 171, 83, 0.4);
}

.search-input-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 16px;
  font-size: 16px;
  color: #fff;
  font-family: inherit;
}

.search-btn {
  background: linear-gradient(180deg, #443419 0%, #291e0a 100%);
  border: 1px solid var(--border-gold);
  color: var(--text-gold);
  font-weight: 600;
  padding: 10px 18px;
  margin-right: 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-btn:hover {
  background: linear-gradient(180deg, #59441f 0%, #3a2b0e 100%);
  color: #fff;
  box-shadow: 0 0 8px rgba(212, 171, 83, 0.4);
}

/* Quick Tags */
.quick-tags {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.tag-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-bronze);
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-btn:hover {
  border-color: var(--border-gold);
  color: var(--text-gold);
  background: var(--bg-hover);
}

/* Instant Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-panel);
  border: 2px solid var(--border-gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  border-radius: 6px;
  overflow: hidden;
  display: none;
  z-index: 200;
}

.autocomplete-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-dim);
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.1s;
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background: var(--bg-hover);
  color: var(--text-gold);
}

.autocomplete-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.autocomplete-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-bronze);
  background: var(--bg-card);
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Rich Knowledge Card */
.knowledge-card {
  background: var(--bg-panel);
  border: 2px solid var(--border-gold);
  box-shadow: 0 0 12px rgba(156, 122, 56, 0.15), inset 0 0 0 1px var(--border-bronze);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 28px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid var(--border-bronze);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.card-avatar {
  width: 64px;
  height: 64px;
  background: var(--bg-input);
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.card-avatar img {
  max-width: 56px;
  max-height: 56px;
  image-rendering: pixelated;
}

.card-title-group h2 {
  font-size: 22px;
  color: var(--text-gold);
  margin-bottom: 4px;
}

.card-badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.badge-origin {
  background: var(--badge-origin);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.badge-category {
  background: var(--bg-card);
  border: 1px solid var(--border-bronze);
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}

.card-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  background: var(--bg-card);
  padding: 12px 14px;
  border-radius: 4px;
  border: 1px solid var(--border-dim);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-cyan);
  font-weight: 600;
}

.card-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.card-table th {
  background: var(--bg-card);
  color: var(--text-gold);
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border-dim);
  font-weight: 600;
}

.card-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-dim);
  vertical-align: middle;
}

.card-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

/* SERP Organic Results */
.serp-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 8px;
  overflow-x: auto;
}

.serp-filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
}

.serp-filter-btn:hover, .serp-filter-btn.active {
  background: var(--bg-card);
  border-color: var(--border-gold);
  color: var(--text-gold);
}

.serp-item {
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 14px;
  transition: border-color 0.15s ease;
}

.serp-item:hover {
  border-color: var(--border-gold);
}

.serp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.serp-title {
  font-size: 17px;
  color: var(--text-gold);
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.serp-title:hover {
  text-decoration: underline;
  color: #fff;
}

.serp-snippet {
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
}

.serp-snippet mark {
  background: rgba(247, 202, 101, 0.25);
  color: var(--text-gold);
  padding: 1px 3px;
  border-radius: 2px;
}

/* Footer */
.retro-footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-dim);
  background: var(--bg-panel);
  margin-top: auto;
}

/* Responsive */
@media (max-width: 600px) {
  .hero-title { font-size: 26px; }
  .card-header { flex-direction: column; align-items: center; text-align: center; }
  .card-badge-row { justify-content: center; }
  .search-input-box input { font-size: 14px; padding: 10px 12px; }
}

/* ========================================================

/* ========================================================
   WORLD MAP & INTERCONNECTED KINGDOM
   ======================================================== */
.map-viewport-container {
  width: 100%;
  height: 70vh;
  max-height: 700px;
  min-height: 480px;
  overflow: hidden;
  position: relative;
  background: #0c0a08;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  box-sizing: border-box;
}
.map-viewport-container.scroll-mode {
  overflow: auto;
  display: block;
  cursor: grab;
}
.map-viewport-container.scroll-mode:active {
  cursor: grabbing;
}
.map-inner-canvas {
  position: relative;
  display: inline-block;
  line-height: 0;
  transition: transform 0.15s ease-out;
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
}
.map-base-image {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.map-viewport-container.scroll-mode .map-base-image {
  max-width: none;
  max-height: none;
}
.map-overlays-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-decoration: none;
}
.map-marker:hover {
  z-index: 60;
  transform: translate(-50%, -50%) scale(1.3);
}
.marker-warp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe066 10%, #d4af37 60%, rgba(212,175,55,0.4) 100%);
  border: 1px solid #ffd700;
  box-shadow: 0 0 6px #ffd700, 0 0 12px rgba(255, 215, 0, 0.6);
}
.marker-npc {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00bcd4;
  border: 1px solid #80deea;
  box-shadow: 0 0 6px #00bcd4;
}
.marker-mob {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f44336;
  border: 1px solid #ff8a80;
  box-shadow: 0 0 6px #f44336;
}
.map-marker .marker-tooltip {
  display: none !important;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 11, 8, 0.96);
  border: 1px solid #ffd700;
  border-radius: 4px;
  padding: 6px 10px;
  white-space: nowrap;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  flex-direction: column;
  gap: 2px;
}
.map-marker:hover .marker-tooltip {
  display: flex !important;
}
.warp-card, .npc-card, .mob-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(25, 20, 15, 0.6);
  border: 1px solid var(--border-dim);
  padding: 8px 12px;
  border-radius: 4px;
  transition: border-color 0.15s ease;
}
.warp-card:hover, .npc-card:hover, .mob-card:hover {
  border-color: var(--border-gold);
}
.warp-info, .npc-details, .mob-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.warp-dest-name, .npc-name, .mob-name {
  color: var(--text-gold);
  font-weight: 600;
  font-size: 13px;
}
.warp-coords, .npc-coord-badge, .mob-coord-badge {
  color: var(--text-cyan);
  font-size: 11px;
}
.warp-enter-btn {
  background: linear-gradient(180deg, #443419 0%, #291e0a 100%);
  border: 1px solid var(--border-gold);
  color: var(--text-gold);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
}
.warp-enter-btn:hover {
  background: linear-gradient(180deg, #59441f 0%, #3a2b0e 100%);
  color: #fff;
}
.npc-avatar-wrap, .mob-avatar-wrap {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  flex-shrink: 0;
}
.npc-avatar-img, .mob-avatar-img {
  max-width: 36px;
  max-height: 36px;
  image-rendering: pixelated;
}

/* ========================================================
   MONSTERS DIRECTORY (CAVES & REGIONS)
   ======================================================== */
.monsters-dir-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.dir-header-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-bronze);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.region-pills-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-dim);
  flex-wrap: wrap;
}
.region-pills-scroll {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.region-filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.region-filter-pill:hover {
  background: var(--bg-hover);
  border-color: var(--border-gold);
  color: #fff;
}
.region-filter-pill.active {
  background: linear-gradient(180deg, #3d2c14 0%, #221808 100%);
  border-color: var(--border-gold);
  color: var(--text-gold);
  font-weight: 700;
}
.caves-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cave-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-bronze);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.cave-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.cave-name-title {
  color: var(--text-gold);
  font-size: 17px;
  font-weight: 700;
}
.cave-floors-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cave-floor-block {
  background: rgba(20, 16, 12, 0.7);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 10px 14px;
}
.cave-floor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.floor-name-badge {
  color: var(--text-gold);
  font-weight: 600;
  font-size: 13px;
}
.cave-floor-mobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.cave-mob-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-dim);
  padding: 6px 10px;
  border-radius: 4px;
}
.cave-mob-item:hover {
  border-color: var(--border-gold);
}
.btn-cave-map {
  background: linear-gradient(180deg, #443419 0%, #291e0a 100%);
  border: 1px solid var(--border-gold);
  color: var(--text-gold);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  text-decoration: none;
}
.btn-cave-map:hover {
  background: linear-gradient(180deg, #59441f 0%, #3a2b0e 100%);
  color: #fff;
}
