:root{--bg:#0e0f14;--panel:#161823;--muted:#9297ad;--accent:#4da3ff;--pill:#1f2230;--text:#e7ebff;}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial}

/* Topbar & Menú */
.topbar{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0a0b10;border-bottom:1px solid #1b1f2e;position:sticky;top:0;z-index:10;flex-wrap:wrap}
.brand{font-weight:900;font-size:20px;letter-spacing:.2px}
.menus{display:flex;gap:10px;flex-wrap:wrap}
.menu-btn,.dd-toggle{cursor:pointer;padding:6px 10px;border-radius:8px;background:#121423;border:1px solid #262b3e}
.menu-btn.active{background:var(--accent);color:#001129;border-color:transparent}

.dd{position:relative}
.dd-toggle{display:flex;align-items:center;gap:6px}

/* Menú por HOVER + clase .open (JS) */
.dd-menu{
  position:absolute; top:100%; left:0;
  background:#101321; border:1px solid #2a2f42; border-radius:10px;
  padding:6px; margin-top:4px; min-width:220px;
  display:none; z-index:20;
}
.dd:hover > .dd-menu{ display:block; }

.dd-item{padding:8px 10px;border-radius:8px;cursor:pointer;white-space:nowrap;position:relative}
.dd-item:hover{background:#1c2130}
.dd-item.has-sub{position:relative}

/* Submenú pegado, sin “hueco” al costado */
.has-sub > .submenu{
  display:none;
  position:absolute; top:0; left:100%;
  background:#101321; border:1px solid #2a2f42; border-radius:10px;
  padding:6px; min-width:220px; z-index:30;
  margin-left:-2px;
}
.has-sub:hover > .submenu,
.has-sub.open  > .submenu{ display:block; }
.has-sub > .label:after{content:"›";position:absolute;right:10px;opacity:.5}

/* Layout */
h1{font-size:28px;margin:16px 16px 8px}
.wrap{display:grid;grid-template-columns:360px 1fr;gap:16px;padding:16px}
.card{background:var(--panel);border-radius:14px;padding:14px;box-shadow:0 0 0 1px rgba(255,255,255,.04) inset}
.tabs{display:flex;gap:8px;margin-bottom:10px}
.tab{padding:6px 10px;border-radius:10px;background:var(--pill);cursor:pointer;font-weight:600;opacity:.8}
.tab.active{background:var(--accent);color:#001129;opacity:1}
.search{width:100%;padding:10px 12px;border-radius:10px;border:1px solid #2a2f42;background:#0f111a;color:var(--text);outline:none}
.paneHeader{display:none;margin:8px 0 0 0;font-weight:700}
.list{margin-top:12px;max-height:70vh;overflow:auto}
.row{padding:10px;border-radius:10px;cursor:pointer;display:flex;justify-content:space-between;align-items:center}
.row:hover{background:#1c2130}
.row .title{font-weight:700;display:flex;align-items:center;gap:6px}
.row-inner{display:flex;gap:10px;align-items:center}
.pill{font-size:12px;background:#222538;border:1px solid #31364d;color:var(--muted);padding:2px 8px;border-radius:999px;margin-left:6px}
.muted{color:var(--muted)}
.detail h2{margin:0 0 6px 0;font-size:28px;display:flex;align-items:center;gap:8px}
.grid{display:grid;grid-template-columns:180px 1fr;gap:8px;margin-top:12px}
.empty{opacity:.7}
footer{opacity:.7;font-size:12px;text-align:center;margin:8px 0 20px}

/* Íconos */
.ico{width:32px;height:32px;object-fit:contain;border-radius:6px;background:#0f111a}
.ico-lg{width:48px;height:48px;object-fit:contain;border-radius:8px;background:#0f111a}
.npcico{width:40px;height:40px;object-fit:cover;border-radius:8px;background:#0f111a}
.table .npcico{width:32px;height:32px}
.npc-lg{width:96px;height:96px;object-fit:cover;border-radius:10px;background:#0f111a;cursor:zoom-in} /* vuelve a tamaño anterior */

/* Grado (11x11 gif) */
.grade-ico{width:11px;height:11px;image-rendering:auto;display:inline-block;vertical-align:middle}
.inline-meta{display:inline-flex;align-items:center;gap:6px}

ul{margin:6px 0 10px 0;padding-left:0}
li{list-style:none}
.li-row{display:flex;align-items:center;gap:8px;padding:6px 0;flex-wrap:wrap}
.btn{font-size:12px;padding:6px 10px;border-radius:8px;border:1px solid #2a2f42;background:#0f111a;color:var(--text);cursor:pointer}
.btn:hover{background:#1c2130;border-color:#3a4262}

/* ======= TABLAS (fuentes de ítems) ======= */
.table-wrap{overflow:auto}
.table{width:100%;min-width:600px;border-collapse:collapse;background:#0f111a;border:1px solid #2a2f42;border-radius:10px;overflow:hidden}
.table thead tr{background:#12162a}
.table th,.table td{padding:8px 10px;border-bottom:1px solid #2a2f42}
.table th{font-weight:700;color:#9aa2c0;font-size:13px;text-align:left;white-space:nowrap}
.table th.sortable{cursor:pointer}
.table th.sortable:hover{color:#e7ebff}
.table td.num,.table th.num{text-align:right}
.table td.actions{white-space:nowrap}
.table th.icon-col{width:36px}
.table td.icon{width:36px}

/* Modal alto y angosto */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;z-index:50}
.modal.show{display:flex}
.backdrop{position:absolute;inset:0;background:rgba(0,0,0,.6)}
.modal-card{position:relative;background:#111525;border:1px solid #2a2f42;border-radius:14px;width:92%;max-width:540px;padding:14px 14px 18px;box-shadow:0 10px 40px rgba(0,0,0,.5)}
.modal-close{position:absolute;top:6px;right:10px;cursor:pointer;font-weight:700}
.modal-body{max-height:74vh;overflow:auto}
.npc-xl{width:100%;height:420px;object-fit:contain;border-radius:12px;background:#0f111a}

/* ======= MAPA ======= */
.modal-card.map{width:96%;max-width:980px}
.map-toolbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;gap:10px;flex-wrap:wrap}
.map-title{font-weight:700}
.map-zoom{
  position: absolute;
  bottom: 8px;
  left: 840px;   /* anclado a la izquierda */
  right: auto;  /* importante para que no herede el 'right' anterior */
  z-index: 5;
}
.map-btn{font-size:14px;padding:4px 10px;border-radius:8px;border:1px solid #2a2f42;background:#0f111a;color:var(--text);cursor:pointer}
.map-btn:hover{background:#1c2130;border-color:#3a4262}
.zoom-label{min-width:48px;display:inline-block;text-align:center;color:#9aa2c0}

.modal-card.map .modal-body{max-height:74vh}
.map-stage{position:relative;width:100%;max-height:62vh;overflow:hidden;border-radius:12px;border:1px solid #2a2f42;background:#0f111a}
.map-canvas{transform-origin:0 0; cursor:grab}
.map-canvas.dragging{cursor:grabbing}
.map-img{display:block;width:100%;height:auto}
.map-markers{position:absolute;inset:0;pointer-events:none}
.map-marker{
  position:absolute; width:12px; height:12px; border-radius:50%;
  background:#ff5252; border:2px solid #fff; transform:translate(-50%,-50%);
  box-shadow:0 0 0 1px rgba(0,0,0,.6), 0 0 8px rgba(255,0,0,.6);
  pointer-events:auto; cursor:help;
}
.map-marker.random{ background:#46d; box-shadow:0 0 0 1px rgba(0,0,0,.6), 0 0 8px rgba(64,96,255,.6);}
.map-legend{display:flex;gap:12px;align-items:center;margin-top:10px;color:#9aa2c0;font-size:13px;flex-wrap:wrap}
.map-legend .dot{width:12px;height:12px;border-radius:50%;display:inline-block;border:2px solid #fff;transform:translateY(2px)}
.map-legend .fixed{background:#ff5252}
.map-legend .rnd{background:#46d}

/* Scrollbar (Chromium/Edge/Safari) */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:#0d0f1a}
::-webkit-scrollbar-thumb{background:#2d3350;border-radius:8px;border:2px solid #0d0f1a}
::-webkit-scrollbar-thumb:hover{background:#3b426b}

/* ======= RESPONSIVE ======= */
@media (max-width: 1100px){
  .wrap{grid-template-columns:1fr}
  .list{max-height:40vh}
  .grid{grid-template-columns:1fr}
  .modal-card.map{width:98%}
  .table{min-width:520px}
}
@media (max-width: 640px){
  .brand{font-size:18px}
  .row{gap:8px}
  .detail h2{font-size:22px}
  .search{font-size:14px}
  .map-stage{max-height:56vh}
  .npc-lg{width:80px;height:80px}
}
