/* ==========================================================================
   VFRO Item Lookup — UI styles
   Inherits palette from extra.css (purple/gold).
   ========================================================================== */

/* CSS variables for both the search SPA root AND the detail modal
   (modal is lazy-injected into <body>, so it does not inherit from .itemdb-app). */
.md-typeset .itemdb-app,
.itemdb-detail {
  --idb-bg: rgba(255, 255, 255, 0.025);
  --idb-bg-strong: rgba(255, 255, 255, 0.05);
  --idb-border: rgba(240, 191, 66, 0.32);
  --idb-border-strong: rgba(240, 191, 66, 0.55);
  --idb-text-mute: rgba(255, 255, 255, 0.62);
  /* Accent color used for headings, labels, bullets — high contrast on its bg. */
  --idb-accent: var(--vfro-gold);
  --idb-accent-dot: var(--vfro-gold);
}
.md-typeset .itemdb-app { margin: 0.5rem 0 2rem; }

[data-md-color-scheme="default"] .md-typeset .itemdb-app,
[data-md-color-scheme="default"] .itemdb-detail {
  --idb-bg: rgba(0, 0, 0, 0.025);
  --idb-bg-strong: rgba(0, 0, 0, 0.05);
  --idb-border: rgba(90, 25, 34, 0.28);
  --idb-border-strong: rgba(90, 25, 34, 0.55);
  --idb-text-mute: rgba(0, 0, 0, 0.6);
  /* Light mode: gold is too pale on white; use a deep amber for readable headings.
     Dot bullets keep the bright gold so the brand color stays visible. */
  --idb-accent: #7a5616;
  --idb-accent-dot: var(--vfro-gold);
}

/* ============ Toolbar (search + status) ============ */
.itemdb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.itemdb-search {
  position: relative;
  flex: 1 1 360px;
  display: flex;
  align-items: center;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 12px;
  padding: 0.1rem 0.4rem 0.1rem 0.7rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  /* The wrapper is a <label for="itemdb-q">. Cursor + click-through icon
     ensures clicking anywhere inside (padding/icon) focuses the input,
     so Material's keyboard shortcut (f / s / /) doesn't steal focus to
     the header search the moment the user starts typing. */
  cursor: text;
  margin: 0;
}
.itemdb-search:focus-within {
  border-color: var(--idb-accent);
  box-shadow: 0 0 0 3px rgba(240, 191, 66, 0.12);
}
.itemdb-search__icon {
  font-size: 1rem;
  opacity: 0.7;
  margin-right: 0.4rem;
  pointer-events: none;
}
.itemdb-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.55rem 0.2rem;
  min-width: 0;
}
.itemdb-search input::-webkit-search-cancel-button { display: none; }
.itemdb-clear {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--idb-text-mute);
  font-size: 0.9rem;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
}
.itemdb-clear:hover { background: rgba(255, 255, 255, 0.06); color: inherit; }
.itemdb-meta {
  font-size: 0.78rem;
  color: var(--idb-text-mute);
  white-space: nowrap;
}

/* ============ Filter toolbar (replaces sidebar) ============ */
.itemdb-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: 100%;
}
.itemdb-fbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 10px;
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}
.itemdb-fbtn:hover { border-color: var(--idb-accent); }
.itemdb-fbtn.is-active {
  background: linear-gradient(135deg, rgba(214, 58, 68, 0.16), rgba(240, 191, 66, 0.08));
  border-color: var(--idb-accent);
}
.itemdb-fbtn__cnt {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--idb-accent);
  background: rgba(240, 191, 66, 0.14);
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.itemdb-fbtn__cnt:empty { display: none; }
.itemdb-fbtn--reset {
  margin-left: auto;
  background: transparent;
  color: var(--idb-text-mute);
  font-weight: 500;
}
.itemdb-fbtn--reset:hover { color: var(--idb-accent); }

/* ============ Filter popup (modal) ============ */
.itemdb-pop {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: flex;
}
.itemdb-pop[hidden] { display: none; }
.itemdb-pop__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 16, 0.55);
  backdrop-filter: blur(3px);
}
.itemdb-pop__panel {
  position: relative;
  margin: auto;
  width: min(560px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  background: var(--md-default-bg-color);
  border: 1px solid var(--idb-border-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}
.itemdb-pop__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--idb-border);
}
.itemdb-pop__header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--idb-accent);
}
.itemdb-pop__header h3::after { display: none !important; }
.itemdb-pop__close {
  background: transparent; border: 0; color: inherit;
  font-size: 1rem; cursor: pointer;
  padding: 0.3rem 0.55rem; border-radius: 8px;
}
.itemdb-pop__close:hover { background: rgba(255, 255, 255, 0.08); }
.itemdb-pop__body {
  padding: 0.9rem 1rem 1rem;
  overflow-y: auto;
}

.itemdb-sortlist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.4rem;
}
.itemdb-sortopt {
  padding: 0.5rem 0.7rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 8px;
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}
.itemdb-sortopt:hover { border-color: var(--idb-accent); }
.itemdb-sortopt.is-active {
  background: linear-gradient(135deg, var(--vfro-red), var(--vfro-red-deep));
  border-color: var(--idb-accent);
  color: #fff;
}

.itemdb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.itemdb-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  line-height: 1.2;
}
.itemdb-chip:hover { border-color: var(--idb-border-strong); }
.itemdb-chip.is-active {
  background: linear-gradient(135deg, var(--vfro-red), var(--vfro-red-deep));
  border-color: var(--idb-accent);
  color: #fff;
}
.itemdb-chip__cnt {
  font-size: 0.66rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.itemdb-chip.is-active .itemdb-chip__cnt { opacity: 1; }
/* Sub-section header inside the type modal: separates standard Type
   facets ("Card", "Armor", …) from the synthetic gem-family chips. */
.itemdb-chips__divider {
  margin: 0.85rem 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed var(--idb-border);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--idb-text-mute);
}
/* Special-category chip variant: dashed outline + accent color so it
   reads as "synthetic" / different scope from the regular Type chips. */
.itemdb-chip--special {
  border-style: dashed;
}
.itemdb-chip--special.is-active {
  border-style: solid;
}

.itemdb-range {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.itemdb-range input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--idb-border);
  border-radius: 8px;
  background: var(--idb-bg-strong);
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
}
.itemdb-range span { color: var(--idb-text-mute); }
.itemdb-select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--idb-border);
  border-radius: 8px;
  background: var(--idb-bg-strong);
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
}
.itemdb-reset {
  display: block;
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.5rem;
  background: transparent;
  border: 1px dashed var(--idb-border-strong);
  border-radius: 8px;
  color: var(--idb-accent);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
}
.itemdb-reset:hover { background: rgba(240, 191, 66, 0.08); }

/* ============ Results ============ */
.itemdb-results__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.7rem;
  font-size: 0.82rem;
  color: var(--idb-text-mute);
}
.itemdb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 0.6rem;
}
.itemdb-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--idb-text-mute);
  font-size: 0.9rem;
  background: var(--idb-bg);
  border: 1px dashed var(--idb-border);
  border-radius: 12px;
  grid-column: 1 / -1;
}

/* ============ Result row ============ */
.itemdb-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.65rem 0.8rem;
  background: var(--idb-bg);
  border: 1px solid var(--idb-border);
  border-radius: 12px;
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
}
.itemdb-row:hover {
  border-color: var(--idb-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(214, 58, 68, 0.15);
}
.itemdb-row__icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 2px;
}
.itemdb-row__icon.is-fallback {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04) 4px, transparent 4px, transparent 8px),
    rgba(0, 0, 0, 0.15);
}
.itemdb-row__main { min-width: 0; }
.itemdb-row__title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.15rem;
  word-break: break-word;
}
.itemdb-row__name { color: inherit; }
.itemdb-row__slots {
  color: var(--idb-accent);
  font-weight: 700;
}
.itemdb-row__en {
  font-weight: 400;
  color: var(--idb-text-mute);
  font-size: 0.82rem;
}
.itemdb-row__sub {
  font-size: 0.74rem;
  color: var(--idb-text-mute);
  margin-bottom: 0.3rem;
  line-height: 1.4;
  word-break: break-word;
}
.itemdb-row__id {
  color: var(--idb-accent);
  font-variant-numeric: tabular-nums;
}
.itemdb-row__aegis {
  font-size: 0.7rem;
  background: rgba(214, 58, 68, 0.12);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}
.itemdb-row__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.itemdb-row__stat {
  font-size: 0.7rem;
  padding: 0.12rem 0.45rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

/* ============ View-mode toggle (panel ↔ list) ============ */
.itemdb-viewtoggle {
  display: inline-flex;
  border: 1px solid var(--idb-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--idb-bg-strong);
  /* Reset button right after us already has margin-left:auto, so it pushes
     itself + this toggle to the right edge of the filterbar together. */
}
.itemdb-vbtn {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}
.itemdb-vbtn + .itemdb-vbtn { border-left: 1px solid var(--idb-border); }
.itemdb-vbtn:hover { background: rgba(255, 255, 255, 0.06); }
[data-md-color-scheme="default"] .itemdb-vbtn:hover { background: rgba(0, 0, 0, 0.05); }
.itemdb-vbtn.is-active {
  background: linear-gradient(135deg, var(--vfro-red), var(--vfro-red-deep));
  color: #fff;
}

/* ============ List-view layout ============ */
/* Panel mode keeps the existing 360px-min grid (already in .itemdb-list).
   List mode forces a single full-width column with richer rows. */
.itemdb-list--list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.itemdb-list--list .itemdb-row {
  grid-template-columns: 64px 1fr;
  padding: 0.75rem 0.95rem;
}
.itemdb-list--list .itemdb-row__icon {
  width: 64px;
  height: 64px;
}
.itemdb-row__desc {
  margin-top: 0.4rem;
  color: var(--idb-text-mute);
  font-size: 0.82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.itemdb-row__extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.78rem;
}
.itemdb-row__extra-lbl {
  color: var(--idb-text-mute);
  font-weight: 600;
  margin-right: 0.15rem;
}
.itemdb-row__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
  max-width: 100%;
}
.itemdb-row__chip code {
  background: transparent !important;
  padding: 0 !important;
  font-size: 0.78rem;
}
.itemdb-row__chip-rate {
  color: var(--idb-accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Chip icons: hard-clamp dimensions so a tall mob sprite (e.g. Tao Gunka,
   Garm) can never inflate the row height. width+height+max-* together with
   `display: block` defeat any intrinsic-aspect or inline-baseline quirks. */
.itemdb-row__chip-icon {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px;
  max-height: 20px;
  flex: 0 0 auto;
  display: block;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  object-fit: contain;
}
/* Mob sprites are pixel art — keep crisp at small sizes. Item icons are
   smooth PNGs from iRO collection so leave the default smoothing. */
.itemdb-row__chip-icon--mob {
  object-fit: cover;
  image-rendering: pixelated;
}
.itemdb-row__chip-icon--map { object-fit: cover; }
.itemdb-row__chip-icon.is-broken,
.itemdb-row__chip-icon.is-fallback {
  background: linear-gradient(135deg, rgba(240,191,66,.22), rgba(240,191,66,.08));
}
/* Keep all chips on a single consistent row height regardless of icon
   presence / image load state. */
.itemdb-row__chip {
  min-height: 26px;
  line-height: 1.15;
}
.itemdb-row__chip--clickable {
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.itemdb-row__chip--clickable:hover {
  border-color: var(--idb-accent);
  background: rgba(240, 191, 66, 0.12);
  color: var(--idb-accent);
}
[data-md-color-scheme="default"] .itemdb-row__chip--clickable:hover {
  background: rgba(122, 86, 22, 0.08);
}

/* ============ Pager ============ */
.itemdb-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}
.itemdb-pager--bottom {
  justify-content: center;
  margin-top: 1rem;
}
.itemdb-pg {
  min-width: 2rem;
  padding: 0.3rem 0.55rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 6px;
  color: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.itemdb-pg:hover:not(:disabled) { border-color: var(--idb-accent); }
.itemdb-pg.is-active {
  background: linear-gradient(135deg, var(--vfro-red), var(--vfro-red-deep));
  border-color: var(--idb-accent);
  color: #fff;
}
.itemdb-pg:disabled { opacity: 0.4; cursor: not-allowed; }
.itemdb-pg__gap { padding: 0 0.25rem; color: var(--idb-text-mute); }

/* ============ Detail modal ============ */
.itemdb-detail {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.itemdb-detail.is-open { display: block; }
.itemdb-detail__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 16, 0.65);
  backdrop-filter: blur(4px);
}
.itemdb-detail__panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  background: var(--md-default-bg-color);
  border: 1px solid var(--idb-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 80px -20px rgba(5, 3, 16, 0.6),
    0 8px 24px -8px rgba(5, 3, 16, 0.35);
}
/* Header now hosts the TAB STRIP + close button only.
   Per-tab header (icon + title + subtitle) lives inside the body
   as .itemdb-tabhead, so each tab can have its own metadata. */
.itemdb-detail__header {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem 0;
  background:
    radial-gradient(800px 200px at 0% 0%, rgba(240, 191, 66, 0.08), transparent 65%),
    var(--idb-bg);
  border-bottom: 1px solid var(--idb-border);
  position: relative;
}
.itemdb-detail__header::before {
  content: "";
  position: absolute;
  left: 0.6rem; right: 0.6rem; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--vfro-gold), var(--vfro-red) 70%, transparent);
  opacity: 0.55;
  border-radius: 2px;
  pointer-events: none;
}

/* ---- Tab strip ---- */
.itemdb-tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 0;
}
.itemdb-tabs::-webkit-scrollbar { height: 4px; }
.itemdb-tabs::-webkit-scrollbar-thumb { background: var(--idb-border-strong); border-radius: 2px; }
.itemdb-tab {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  max-width: 220px;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.itemdb-tab:hover { background: var(--idb-bg); }
.itemdb-tab.is-active {
  background: var(--md-default-bg-color);
  border-color: var(--idb-border-strong);
  z-index: 2;
}
.itemdb-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--md-default-bg-color);
}
.itemdb-tab__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.2rem 0.35rem 0.5rem;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  min-width: 0;
}
.itemdb-tab__icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.04);
}
.itemdb-tab__icon--mob {
  image-rendering: pixelated;
  background: transparent;
}
.itemdb-tab__icon.is-fallback {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05) 3px, transparent 3px, transparent 6px),
    rgba(0, 0, 0, 0.18);
}
.itemdb-tab__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.itemdb-tab.is-active .itemdb-tab__name { color: var(--idb-accent); }
.itemdb-tab__close {
  background: transparent;
  border: 0;
  color: var(--idb-text-mute);
  cursor: pointer;
  padding: 0.45rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  align-self: center;
  margin-right: 0.2rem;
}
.itemdb-tab__close:hover { background: var(--idb-bg-strong); color: inherit; }

/* ---- Per-tab head (icon + title) inside the body ---- */
.itemdb-tabhead {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed var(--idb-border);
}
.itemdb-tabhead__icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 14px;
  padding: 4px;
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.3);
}
.itemdb-tabhead__icon--mob {
  image-rendering: pixelated;
  background: var(--idb-bg);
}
[data-md-color-scheme="default"] .itemdb-tabhead__icon { background: rgba(0, 0, 0, 0.04); }
.itemdb-tabhead__icon.is-fallback {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05) 4px, transparent 4px, transparent 8px),
    rgba(0, 0, 0, 0.2);
}
.itemdb-tabhead__title-wrap { min-width: 0; }
.itemdb-tabhead__title-wrap h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  word-break: break-word;
}
.itemdb-tabhead__title-wrap h2::after { display: none !important; }
.itemdb-tabhead__title-wrap p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--idb-text-mute);
  line-height: 1.4;
}
.itemdb-detail__id { color: var(--idb-accent); font-weight: 600; }
.itemdb-detail__en { font-style: italic; }

/* ---- Tag pills shared by mob/MVP/boss flags ---- */
.itemdb-tag {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  vertical-align: middle;
}
.itemdb-tag--mvp {
  background: linear-gradient(135deg, var(--vfro-gold), var(--vfro-gold-soft));
  color: #1a1235;
}
.itemdb-tag--boss {
  background: rgba(214, 58, 68, 0.85);
  color: #fff;
}

/* ---- Monster spec sheet — element resistance grid + spawn list ---- */
.itemdb-mobstat {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  margin-right: 0.25rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 6px;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
/* Inner panel wrapping the resistance grid so it doesn't sit flush
   against the section's outer border. */
.itemdb-elemtable-wrap {
  margin: 0.7rem;
  border: 1px solid var(--idb-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--idb-bg);
}
.itemdb-elemtable {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
}
.itemdb-elemtable__cell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.7rem;
  border-bottom: 1px solid var(--idb-border);
  border-right: 1px solid var(--idb-border);
  font-size: 0.78rem;
  background: var(--md-default-bg-color);
}
.itemdb-elemtable__lbl {
  color: var(--idb-text-mute);
  font-weight: 600;
  white-space: nowrap;
}
.itemdb-elemtable__val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.itemdb-elemtable__val.is-resist { color: #4caf50; }
.itemdb-elemtable__val.is-weak { color: var(--vfro-red); }
.itemdb-elemtable__val.is-immune { color: var(--idb-accent); }

.itemdb-mobskills {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.itemdb-mobskills th, .itemdb-mobskills td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--idb-border);
  vertical-align: top;
}
.itemdb-mobskills th {
  background: var(--idb-bg-strong);
  color: var(--idb-text-mute);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.itemdb-mobskills tbody tr:hover { background: var(--idb-bg-strong); }

.itemdb-spawns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.4rem;
  padding: 0.7rem;
}
.itemdb-spawn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--md-default-bg-color);
  border: 1px solid var(--idb-border);
  border-radius: 8px;
  font-size: 0.8rem;
}
.itemdb-spawn__map {
  flex: 1 1 auto;
  font-family: var(--md-code-font, monospace);
  font-size: 0.76rem;
  color: var(--idb-accent);
}
.itemdb-spawn__inst { flex: 1 1 auto; font-weight: 600; }
.itemdb-spawn__amt {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--idb-accent);
}
.itemdb-spawn__delay {
  font-size: 0.7rem;
  color: var(--idb-text-mute);
  font-variant-numeric: tabular-nums;
}
.itemdb-detail__close {
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  align-self: start;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.itemdb-detail__close:hover {
  background: var(--idb-bg-strong);
  border-color: var(--idb-border);
  transform: rotate(90deg);
}
.itemdb-detail__body {
  padding: 1rem 1.2rem 1.4rem;
  overflow-y: auto;
}
.itemdb-detail__loading {
  text-align: center;
  padding: 2rem;
  color: var(--idb-text-mute);
}
.itemdb-no-scroll { overflow: hidden; }

/* ============================================================
   Recipe / craft cards (Wings Quest Shop, future crafting pages)
   ============================================================ */
.vfro-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 1.4rem;
}
.vfro-recipe {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.9rem 1rem 0.95rem;
  background: var(--idb-bg);
  border: 1px solid var(--idb-border);
  border-radius: 12px;
  position: relative;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.vfro-recipe:hover {
  border-color: var(--idb-accent);
  box-shadow: 0 6px 18px rgba(214, 58, 68, 0.1);
}
.vfro-recipe--final {
  background: linear-gradient(135deg, rgba(214, 58, 68, 0.08), rgba(240, 191, 66, 0.05));
  border-color: var(--idb-accent);
}
.vfro-recipe__title {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  border: 0 !important;
}
.vfro-recipe__title::after { display: none !important; }
.vfro-recipe__title a {
  color: var(--idb-accent) !important;
  text-decoration: none !important;
  border-bottom: 1px dashed transparent;
}
.vfro-recipe__title a:hover { border-bottom-color: var(--idb-accent); }
.vfro-recipe__id {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--idb-text-mute);
  font-variant-numeric: tabular-nums;
}
.vfro-recipe__cost {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  font-size: 0.78rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--idb-border);
}
.vfro-recipe__zeny {
  font-weight: 700;
  color: inherit;
  font-variant-numeric: tabular-nums;
}
.vfro-recipe__zeny::after { content: ""; }
.vfro-recipe__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.55rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 999px;
  font-size: 0.74rem;
}
.vfro-recipe__tag--coin {
  background: rgba(240, 191, 66, 0.12);
  border-color: var(--idb-accent);
  color: var(--idb-accent);
  font-weight: 600;
}
.vfro-recipe__tag--prereq {
  background: rgba(214, 58, 68, 0.1);
  border-color: var(--vfro-red);
}
.vfro-recipe__tag a {
  color: inherit !important;
  text-decoration: none !important;
}
.vfro-recipe__group h4 {
  margin: 0.3rem 0 0.3rem !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--idb-text-mute);
}
.vfro-recipe__mats {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.18rem 0.6rem;
  font-size: 0.83rem;
}
.vfro-recipe__mats li {
  margin: 0 !important;
  padding-left: 0 !important;
  font-variant-numeric: tabular-nums;
}
.vfro-recipe__mats li::before { content: ""; display: none; }
.vfro-recipe__mats a {
  color: inherit !important;
  text-decoration: none !important;
  border-bottom: 1px dashed var(--idb-border);
  transition: border-color 0.1s, color 0.1s;
}
.vfro-recipe__mats a:hover {
  color: var(--idb-accent) !important;
  border-bottom-color: var(--idb-accent);
}

/* ============================================================
   Inline item link: icon + name, opens detail popup on click.
   Auto-applied by enhanceItemLinks() in itemdb.js to every
   <a data-itemdb-id="N">. Use class `itemdb-link--noicon` to
   opt out (kept text-only for cases where icon would clutter).
   ============================================================ */
.md-typeset .itemdb-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: -0.35em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  /* Subtle chip frame so the icon+name reads as a single interactive unit
     even when surrounded by prose / list bullets. Padding stays tight so
     consecutive links in a sentence don't break the line rhythm. */
  padding: 1px 6px 1px 3px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none !important;
  background: transparent;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.md-typeset .itemdb-link:hover,
.md-typeset .itemdb-link:focus-visible {
  background: rgba(240, 191, 66, 0.12);
  border-color: var(--idb-accent);
  color: var(--idb-accent);
  outline: none;
}
.md-typeset .itemdb-link__icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
}
.md-typeset .itemdb-link__icon.is-fallback {
  background: linear-gradient(135deg, var(--idb-bg-strong), var(--idb-bg));
  border: 1px dashed var(--idb-border);
}
/* Icon-only variant: bigger sprite, no text label expected.
   Use as <a data-itemdb-id="N" class="itemdb-link--icon-only" aria-label="…"></a> */
.md-typeset .itemdb-link.itemdb-link--icon-only {
  padding: 2px;
  border: 1px solid var(--idb-border);
  background: var(--idb-bg);
}
.md-typeset .itemdb-link.itemdb-link--icon-only:hover {
  border-color: var(--idb-accent);
  background: var(--idb-bg-strong);
}
.md-typeset .itemdb-link.itemdb-link--icon-only .itemdb-link__icon {
  width: 36px;
  height: 36px;
}

/* Compact stat strip: airy cards in a flex row, no heavy borders */
.itemdb-statrow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin: 0 0 0.6rem;
}
.itemdb-statcell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0.8rem;
  background: var(--idb-bg);
  border: 1px solid var(--idb-border);
  border-radius: 12px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.itemdb-statcell::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--vfro-gold), var(--vfro-red));
  opacity: 0.55;
  border-radius: 3px;
}
.itemdb-statcell__label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--idb-text-mute);
}
.itemdb-statcell__val {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  color: inherit;
}

/* Key/value table panel: each row is a 2-cell table with a divider between
   label and value (proper table-cell look). */
.itemdb-kv-grid {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  border: 1px solid var(--idb-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--idb-bg);
}
.itemdb-kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0;
  border-bottom: 1px solid var(--idb-border);
  align-items: stretch;
}
.itemdb-kv:last-child { border-bottom: 0; }
.itemdb-kv:hover { background: var(--idb-bg-strong); }

/* Two-panel split: render the rows as TWO independent kv-grids side by side.
   Avoids the alignment gotcha you get with CSS column-count (which breaks
   columns mid-row). Each panel keeps its own borders, so left/right are
   visually distinct table-blocks. */
.itemdb-kv-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0 0 0.6rem;
  /* Each panel shrinks to its own content — no trailing empty space when
     one side has fewer rows than the other. */
  align-items: start;
}
.itemdb-kv-split > .itemdb-kv-grid { margin: 0; }
@media (max-width: 640px) {
  .itemdb-kv-split { grid-template-columns: 1fr; }
}

/* Label cell — uppercase pill on a tinted strip, divider toward value */
.itemdb-kv > span:first-child {
  font-size: 0.68rem;
  color: var(--idb-text-mute);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: var(--idb-bg-strong);
  border-right: 1px solid var(--idb-border);
  white-space: nowrap;
}
.itemdb-kv > span:first-child::before {
  content: "";
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--idb-accent-dot);
  opacity: 0.85;
  flex: 0 0 auto;
}
/* Value cell */
.itemdb-kv > div:last-child {
  min-width: 0;
  padding: 0.35rem 0.6rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.85rem;
}
.itemdb-job {
  display: inline-block;
  padding: 0.08rem 0.55rem;
  background: var(--idb-bg-strong);
  border: 1px solid var(--idb-border);
  border-radius: 999px;
  font-size: 0.72rem;
  color: inherit;
  font-weight: 500;
}

.itemdb-section {
  margin-top: 1rem;
  border: 1px solid var(--idb-border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--idb-bg);
}
.itemdb-section h3 {
  margin: 0;
  padding: 0.6rem 0.95rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--idb-accent);
  background:
    linear-gradient(90deg, rgba(240, 191, 66, 0.08), transparent 60%),
    var(--idb-bg-strong);
  border-bottom: 1px solid var(--idb-border);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.itemdb-section h3::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--idb-accent-dot);
  box-shadow: 0 0 0 3px rgba(240, 191, 66, 0.22);
}

/* Inner padding wrapper used when a section embeds full-width sub-panels
   (e.g. the mob "Thông số" split kv-grid). Keeps the inner panels from
   touching the outer section's border. */
.itemdb-section__inner {
  padding: 0.7rem;
}
.itemdb-section__inner > .itemdb-kv-split,
.itemdb-section__inner > .itemdb-kv-grid {
  margin: 0;
}
.itemdb-desc {
  font-size: 0.86rem;
  line-height: 1.6;
  padding: 0.85rem 1rem;
  white-space: normal;
}
.itemdb-desc__sep {
  border: 0;
  border-top: 1px dashed var(--idb-border);
  margin: 0.45rem 0;
}
.itemdb-desc--empty {
  color: var(--idb-text-mute);
  font-style: italic;
}

/* Empty state inside a section panel: no own border (panel has it) */
.itemdb-section > .itemdb-empty {
  background: transparent;
  border: 0;
  padding: 1rem;
  border-radius: 0;
}

/* Item Script: code block flush inside the section panel (no inner border) */
.itemdb-script-pre {
  margin: 0;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
[data-md-color-scheme="default"] .itemdb-script-pre { background: rgba(0, 0, 0, 0.04); }
.itemdb-script-pre code { background: transparent !important; padding: 0 !important; font-size: inherit; }

/* "Giải thích" toggle in the script section header */
.itemdb-script-explain-btn {
  margin-left: auto;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--idb-border);
  background: var(--idb-bg);
  color: var(--idb-accent);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.itemdb-script-explain-btn:hover {
  background: rgba(240, 191, 66, 0.14);
  border-color: var(--idb-accent);
}
.itemdb-script-explain-btn[aria-expanded="true"] {
  background: var(--idb-accent);
  color: #1a1a1a;
  border-color: var(--idb-accent);
}
.itemdb-script-explain-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* "Giải thích" popup: floating modal sitting above the detail modal.
   z-index needs to clear the detail modal (which uses ~1000 in this
   project; bump high enough to overlay it). */
.itemdb-explain-popup {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.itemdb-explain-popup--open { display: flex; }
.itemdb-explain-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
/* Panel needs an OPAQUE background regardless of Material color scheme.
   `var(--md-default-bg-color)` is unreliable on this site (the parchment-
   themed light skin replaces it with a translucent value), so we hard-code
   solid colors per scheme. */
.itemdb-explain-popup__panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  background: #fffaf0;
  color: #1c1213;
  border: 1px solid var(--idb-border);
  border-radius: 14px;
  box-shadow:
    0 30px 80px -20px rgba(5, 3, 16, 0.6),
    0 8px 24px -8px rgba(5, 3, 16, 0.35);
  overflow: hidden;
}
[data-md-color-scheme="slate"] .itemdb-explain-popup__panel {
  background: #1c1213;
  color: #f1ead5;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 80px -20px rgba(0, 0, 0, 0.7),
    0 8px 24px -8px rgba(0, 0, 0, 0.5);
}
.itemdb-explain-popup__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--idb-border);
  background:
    linear-gradient(90deg, rgba(240, 191, 66, 0.18), transparent 60%),
    #f7ecd2;
}
[data-md-color-scheme="slate"] .itemdb-explain-popup__header {
  background:
    linear-gradient(90deg, rgba(240, 191, 66, 0.12), transparent 60%),
    #261a1c;
}
.itemdb-explain-popup__header h3 {
  margin: 0;
  flex: 1;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--idb-accent);
  text-transform: uppercase;
}
.itemdb-explain-popup__close {
  font: inherit;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--idb-border);
  background: transparent;
  color: var(--idb-text-mute);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.itemdb-explain-popup__close:hover {
  color: var(--idb-text);
  border-color: var(--idb-accent);
}
.itemdb-explain-popup__body {
  flex: 1;
  overflow: auto;
  padding: 0.7rem 1rem 1rem;
}
.itemdb-explain-popup__loading,
.itemdb-explain-popup__empty {
  padding: 0.6rem 0;
  color: var(--idb-text-mute);
  font-style: italic;
}
.itemdb-explain-popup__empty code {
  font-style: normal;
  padding: 0 0.25rem;
}
/* Lock background scroll while the popup is open (added to <html>) */
.itemdb-explain-popup-locked { overflow: hidden; }

/* Bonus | Ý nghĩa table */
.itemdb-explain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  line-height: 1.5;
}
.itemdb-explain-table th,
.itemdb-explain-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--idb-border);
}
.itemdb-explain-table thead th {
  position: sticky;
  top: 0;
  background: #fffaf0;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--idb-accent);
  border-bottom: 1px solid var(--idb-border);
  box-shadow: 0 1px 0 var(--idb-border);
}
[data-md-color-scheme="slate"] .itemdb-explain-table thead th {
  background: #1c1213;
}
.itemdb-explain-table tbody tr:last-child td { border-bottom: 0; }
.itemdb-explain-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}
[data-md-color-scheme="default"] .itemdb-explain-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}
.itemdb-explain-table td:first-child {
  width: 1%;
  white-space: nowrap;
}
.itemdb-explain-table td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--idb-accent);
  background: transparent !important;
  padding: 0 !important;
}

/* Drops: airy cards in a responsive grid, hairline border + lift on hover */
.itemdb-drops {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.55rem;
  padding: 0.7rem;
}
.itemdb-drop {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  background: var(--md-default-bg-color);
  color: inherit !important;
  text-decoration: none !important;
  align-items: center;
  position: relative;
  border: 1px solid var(--idb-border);
  border-radius: 10px;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.itemdb-drop:hover {
  border-color: var(--idb-accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -8px rgba(214, 58, 68, 0.35);
}
.itemdb-drop__sprite {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: pixelated;
}
.itemdb-drop__sprite.is-fallback {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.04) 3px, transparent 3px, transparent 6px),
    rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}
.itemdb-drop__main { min-width: 0; }
.itemdb-drop__name {
  font-size: 0.84rem;
  font-weight: 600;
  word-break: break-word;
}
.itemdb-drop__meta {
  font-size: 0.7rem;
  color: var(--idb-text-mute);
  margin-top: 0.1rem;
}
.itemdb-drop__rate {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--idb-accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.itemdb-drop__tags {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  display: flex;
  gap: 0.2rem;
}
.itemdb-drop__tag {
  font-size: 0.62rem;
  padding: 0.05rem 0.35rem;
  background: rgba(214, 58, 68, 0.25);
  border-radius: 4px;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.itemdb-drop__tag--mvp {
  background: linear-gradient(135deg, var(--vfro-gold), var(--vfro-gold-soft));
  color: #1a1235;
  font-weight: 700;
}
.itemdb-drop__tag--unknown {
  background: rgba(120, 120, 120, 0.25);
  color: var(--idb-text-mute);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

/* Item Script collapsibles */
.itemdb-script {
  background: var(--md-default-bg-color);
  border: 1px solid var(--idb-border);
  border-radius: 10px;
  overflow: hidden;
}
.itemdb-script summary {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--idb-text-mute);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.itemdb-script summary::-webkit-details-marker { display: none; }
.itemdb-script summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--idb-accent);
  font-size: 0.7rem;
}
.itemdb-script[open] summary::before { transform: rotate(90deg); }
.itemdb-script[open] summary { border-bottom: 1px solid var(--idb-border); }
.itemdb-script pre {
  margin: 0;
  padding: 0.75rem 0.95rem;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
[data-md-color-scheme="default"] .itemdb-script pre { background: rgba(0, 0, 0, 0.04); }
.itemdb-script code { background: transparent !important; padding: 0 !important; }

/* ---------------------------------------------------------------------
 * Map popup tab + clickable spawn rows
 * ------------------------------------------------------------------ */
.itemdb-spawn--btn {
  cursor: pointer;
  text-align: left;
  padding: 0.45rem 0.55rem;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.itemdb-spawn--btn:hover {
  background: var(--idb-bg-strong);
  border-color: var(--idb-accent);
}
.itemdb-spawn--btn:active { transform: translateY(1px); }
.itemdb-spawn__thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
}
.itemdb-spawn__thumb.is-broken {
  background: linear-gradient(135deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.08) 100%);
}
/* Instance entry tile: emoji glyph in place of a map thumbnail. */
.itemdb-spawn__icon-wrap {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(214,58,68,.18), rgba(240,191,66,.12));
  color: var(--idb-accent);
}

/* Instance tab head — uses map icon variant; glyph fallback when no
   `tab.iconMap` was set yet. */
.itemdb-tab__icon--instance {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(214,58,68,.22), rgba(240,191,66,.1));
  color: var(--idb-accent);
  font-size: 0.95rem;
  flex: 0 0 auto;
}
.itemdb-tab--instance .itemdb-tab__pill {
  background: linear-gradient(135deg, rgba(214,58,68,.05), rgba(240,191,66,.04));
}

/* Tiny mute helper (used inline inside instance kv rows for "(x,y)" hints). */
.itemdb-text-mute { color: var(--idb-text-mute); font-size: 0.85em; }
.itemdb-spawn__main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 auto;
  min-width: 0;
}
.itemdb-spawn__meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.itemdb-tab--map .itemdb-tab__pill { background: rgba(80, 200, 120, 0.08); }
.itemdb-tab__icon--map {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.15);
}
.itemdb-tab__icon--map.is-broken {
  background: linear-gradient(135deg, rgba(80,200,120,.3), rgba(80,200,120,.1));
}

.itemdb-tabhead__icon--map {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.18);
}

.itemdb-section--mapimg { padding: 0.7rem; }
.itemdb-mapimg-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  min-height: 200px;
  padding: 0.4rem;
}
.itemdb-mapimg {
  max-width: 100%;
  max-height: 600px;
  border-radius: 8px;
  display: block;
}
.itemdb-mapimg__fallback { display: none; color: var(--idb-text-mute); font-style: italic; }
.itemdb-mapimg-wrap.is-broken .itemdb-mapimg__fallback { display: block; }

.itemdb-route {
  list-style: none;
  margin: 0;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.itemdb-route__step {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  background: var(--md-default-bg-color);
  border: 1px solid var(--idb-border);
  border-left: 3px solid var(--idb-accent);
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.45;
}
.itemdb-route__step--warper { border-left-color: #50c878; }
.itemdb-route__step--npc { border-left-color: #f0bf42; }
.itemdb-route__step--instance { border-left-color: #d63a44; }
.itemdb-route__step--instance .itemdb-route__num { color: #d63a44; }
.itemdb-route__num {
  font-weight: 700;
  color: var(--idb-accent);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  min-width: 5em;
}
.itemdb-route__step--warper .itemdb-route__num { color: #50c878; }
.itemdb-route__step--npc .itemdb-route__num { color: #f0bf42; }
.itemdb-route__body { flex: 1 1 auto; min-width: 0; word-wrap: break-word; }
.itemdb-route__body code { font-size: 0.82em; }
.itemdb-route__via {
  font-style: normal;
  font-size: 0.78em;
  color: var(--idb-text-mute);
  background: rgba(240, 191, 66, 0.1);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
}
.itemdb-route__via-name {
  color: var(--idb-accent);
  font-weight: 700;
}
/* NPC sprite — plain inline image, intentionally NOT clickable.
   Route panels (detail tab): show the FULL sprite (object-fit: contain) so
   the player recognises the visual; box gets a generous height so tall
   sprites aren't squished. Inline icons in shorter contexts use a smaller
   square box but still contain (no cropping). */
.itemdb-route__npc-icon {
  width: 28px;
  height: 44px;
  max-width: 28px;
  max-height: 44px;
  object-fit: contain;
  object-position: center bottom;
  vertical-align: bottom;
  margin: 0 0.25rem;
  image-rendering: pixelated;
  pointer-events: none;
  display: inline-block;
  background: transparent;
}
.itemdb-exit__npc-icon {
  width: 26px;
  height: 36px;
  max-width: 26px;
  max-height: 36px;
  object-fit: contain;
  object-position: center;
  vertical-align: middle;
  margin: 0 0.2rem;
  image-rendering: pixelated;
  pointer-events: none;
  display: inline-block;
  background: transparent;
}
.itemdb-route__maplink { text-decoration: underline dotted; }
.itemdb-route__maplink:hover { text-decoration: underline; }
.itemdb-route__hint {
  margin: 0.5rem 0.6rem 0;
  padding: 0.5rem 0.7rem;
  font-size: 0.78rem;
  color: var(--idb-text-mute);
  background: rgba(240, 191, 66, 0.06);
  border: 1px dashed rgba(240, 191, 66, 0.3);
  border-radius: 6px;
}

/* Map exits panel — list of every outgoing edge as a clickable chip-row. */
.itemdb-exits {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem;
}
.itemdb-exit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  background: var(--md-default-bg-color);
  border: 1px solid var(--idb-border);
  border-radius: 8px;
  font-size: 0.8rem;
  text-decoration: none !important;
  color: inherit !important;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.itemdb-exit:hover { border-color: var(--idb-accent); background: var(--idb-bg-strong); }
.itemdb-exit__tag {
  flex: 0 0 auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(80, 200, 120, 0.18);
  color: #50c878;
  letter-spacing: 0.05em;
}
.itemdb-exit__tag--npc {
  background: rgba(240, 191, 66, 0.18);
  color: var(--idb-accent);
}
.itemdb-exit__from,
.itemdb-exit__to-coord {
  font-variant-numeric: tabular-nums;
  color: var(--idb-text-mute);
  font-size: 0.76rem;
}
.itemdb-exit__arrow { color: var(--idb-text-mute); }
.itemdb-exit__to {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
}
.itemdb-exit__via {
  font-size: 0.72rem;
  color: var(--idb-text-mute);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14ch;
}

/* ---------------------------------------------------------------------------
   Hunting Missions table (vfro-mission-table) — flat row-per-mission with
   stacked mob list inside the third cell. Replaces collapsible cards for
   denser scanning.
   --------------------------------------------------------------------------- */
.vfro-mission-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.5rem;
  font-size: 0.92em;
}
.vfro-mission-table thead th {
  text-align: left;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  background: var(--idb-bg-strong, #f4f4f4);
  border-bottom: 2px solid var(--idb-border, #e0e0e0);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--idb-text-mute, #666);
}
.vfro-mission-table tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--idb-border, #e8e8e8);
  vertical-align: top;
  line-height: 1.55;
}
.vfro-mission-table tbody tr:hover td {
  background: var(--idb-surface, rgba(255, 152, 0, 0.04));
}
.vfro-mission-table tbody td:first-child {
  font-weight: 600;
  width: 14em;
  max-width: 14em;
  /* Allow long mission names ("Khám phá Illusion of Abyss Turtle Island")
     to wrap onto 2 lines instead of widening the column. */
}
.vfro-mission-table tbody td:nth-child(2) {
  white-space: nowrap;
  width: 1%;
}
.vfro-mission-table tbody td:nth-child(2) code {
  font-size: 0.82em;
}
@media (max-width: 720px) {
  .vfro-mission-table tbody td:first-child {
    width: auto;
    max-width: none;
  }
}
/* In mission tables, drop the chip frame entirely and render the mob
   link as plain inline `[icon] Name`. The default chip uses inline-flex
   + 28px icon + padding + vertical-align: -0.35em which (a) makes each
   <br>-separated line ~38px tall and (b) leaves visible whitespace
   between chip and the trailing `×N` count. */
.md-typeset .vfro-mission-table .itemdb-link,
.md-typeset .vfro-mission-table .itemdb-link:hover,
.md-typeset .vfro-mission-table .itemdb-link:focus-visible {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  vertical-align: baseline;
  line-height: inherit;
  white-space: nowrap;
}
.md-typeset .vfro-mission-table .itemdb-link:hover {
  color: var(--idb-accent);
}
.md-typeset .vfro-mission-table .itemdb-link__icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  margin-right: 3px;
}
.vfro-mission-table tbody td:nth-child(3) {
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  /* On narrow screens, let the map cell wrap so the table stays in
     viewport without horizontal scroll. */
  .vfro-mission-table tbody td:nth-child(2) { white-space: normal; }
}
