/* ============================================================
   Game Database — Dedicated Styles
   Reuses the main site's style.css design tokens (dark theme, liquid glass, brand colors)
   Class name prefix .db-*, mainly tuned for desktop (≥1024px)
   ============================================================ */

/* Main container */
.db-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: calc(var(--navbar-height) + 1.5rem) 1.5rem 3rem;
}

/* Title container (icon + text) */
.db-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.8rem;
}
.db-header .gensri-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
}

/* Version info */
.db-version {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.db-version .version-value { color: #fff; font-weight: 600; }

/* Main tab bar (characters / weapons / artifacts) */
.db-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}
.db-tab {
  padding: 0.45rem 1.4rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  transition: all var(--transition-fast);
}
.db-tab:hover { color: #fff; border-color: var(--glass-border-hover); }
.db-tab.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  cursor: default;
  pointer-events: none;
}

/* ============================================================
   Filter area
   ============================================================ */
.db-filters {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  margin-bottom: 1.2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}
.db-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}
.db-search i { color: var(--text-tertiary); font-size: 0.8rem; }
.db-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
}
.db-search input::placeholder { color: var(--text-tertiary); }
.db-filter-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.db-filter-title {
  flex: 0 0 auto;
  width: 2.6rem;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.db-filter-opts {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.db-filter-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}
.db-filter-opt:hover { color: #fff; border-color: var(--glass-border-hover); }
.db-filter-opt.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.db-filter-opt img {
  width: 1.15rem;
  height: 1.15rem;
  object-fit: contain;
  display: block;
}

/* ============================================================
   Card grid
   ============================================================ */
.db-grid {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.7rem;
}
.db-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.db-empty i { font-size: 1.8rem; }

/* Shared card styles */
.db-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.8rem 0.6rem 0.7rem;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all var(--transition-normal);
}
.db-card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  transform: translateY(-3px);
}

/* Card image (the underlying Font Awesome icon acts as a placeholder when the image fails to load) */
.db-card-img {
  position: relative;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--glass-border-hover);
  flex-shrink: 0;
}
.db-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Placeholder icon: hidden by default, shown only when there is no image or loading failed */
.db-card-img .db-img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--text-tertiary);
}
.db-card-img.no-img .db-img-fallback {
  display: flex;
}

/* Weapon image (square, not cropped into a circle) */
.db-card-weapon .db-card-img {
  border-radius: var(--radius-md);
  border: none;
  background: rgba(255, 255, 255, 0.05);
}

/* Card name */
.db-card-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Rarity (star string, colored per rarity tier) */
.db-star { letter-spacing: 0.05em; line-height: 1; font-size: 0.68rem; }
.db-star.star5 { color: #f7b733; }
.db-star.star4 { color: #b58ae6; }
.db-star.star3 { color: #6ea8fe; }

/* Character card footer: element icon + weapon icon */
.db-card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  margin-top: 0.1rem;
}
.db-card-foot img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
  display: block;
}
.db-card-foot .db-foot-divider {
  width: 1px;
  height: 1.15rem;
  background: rgba(255, 255, 255, 0.22);
}

/* Weapon card meta info (ATK + secondary stat) */
.db-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.66rem;
  color: var(--text-secondary);
  line-height: 1.35;
}
.db-card-meta b { color: #fff; font-weight: 600; }

/* Loading / error message */
.db-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ============================================================
   Background (fully rewritten: absolute path + background-attachment:fixed removed,
   fixing background images not loading in some browsers with fixed positioning)
   ============================================================ */
.background-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.background-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/png/index-background-7.1.1.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  opacity: 0.4;
  transition: opacity 0.6s ease;
}
.background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 16, 0.35);
  transition: background 0.6s ease;
}
/* Immersive mode: the background image fades out and switches to the solid color #404040 */
body.immersive .background-layer::before {
  opacity: 0;
}
body.immersive .background-layer::after {
  background: #262626;
}

/* Responsive: compact layout on small screens */
@media (max-width: 768px) {
  .background-layer::before {
    background-image: url("/png/index-background-7.1.1(phone).jpg");
    background-attachment: scroll;
  }
  .db-tab {
    padding: 0.32rem 0.8rem;
    font-size: 0.74rem;
    white-space: nowrap;
  }
  .db-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }
  .db-filter-title { width: auto; }
  .db-filter-opts { width: 100%; }
  /* Filter option grid: 4 columns for elements (Pyro/Hydro/Electro/Cryo, Anemo/Geo/Dendro), 5 for weapons, rarity varies by page */
  .db-filter-opts-element { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
  .db-filter-opts-weapon { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
  .db-filter-opts-star { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
  body[data-page="weapons"] .db-filter-opts-star { grid-template-columns: repeat(3, 1fr); }
  .db-filter-opt { padding: 0.3rem 0.3rem; font-size: 0.72rem; justify-content: center; }
  .db-filter-opt .db-opt-label { display: none; }
  .db-filter-opt img { width: 1.1rem; height: 1.1rem; }
  /* Center the list; 3 columns for characters, 2 for weapons */
  .db-grid { justify-content: center; }
  body[data-page="characters"] .db-grid { grid-template-columns: repeat(3, 1fr); }
  body[data-page="weapons"] .db-grid { grid-template-columns: repeat(2, 1fr); }
  .db-card-img { width: 2.6rem; height: 2.6rem; }
  .db-card-name { font-size: 0.66rem; }
  .db-star { font-size: 0.58rem; }
  .db-card-meta { font-size: 0.58rem; }
  .db-card { gap: 0.22rem; padding: 0.45rem 0.3rem 0.4rem; }
  .db-card-foot img { width: 0.9rem; height: 0.9rem; }
  .db-main { padding-left: 0.6rem; padding-right: 0.6rem; }
}

/* Mobile top immersive button (hidden on desktop, shown inside @media on mobile) */
.mobile-immersive { display: none; }

/* ============================================================
   Character detail page
   ============================================================ */
.cd-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: calc(var(--navbar-height) + 1.5rem) 1.5rem 3rem;
}

/* Back button (overlaid on the navigation, subtly emphasized) */
.cd-back {
  margin-right: 0.3rem;
  color: var(--accent);
}

/* ============================================================
   Main info
   ============================================================ */
.cd-hero {
  display: flex;
  gap: 1.5rem;
  padding: 1.3rem 1.4rem;
  /* The version dropdown expanded in diff mode needs to cover the content area below: .glass's
     backdrop-filter creates a stacking context, so this block's stacking order is raised explicitly */
  position: relative;
  z-index: 5;
}
.cd-hero-info { flex: 1; min-width: 0; }
.cd-hero-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.1rem;
}
/* Character ID: on the same line as the title and also gray, for easy copy-and-query */
.cd-hero-id {
  margin-left: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.cd-hero-name { font-size: 1.8rem; font-weight: 700; color: #fff; line-height: 1.2; }
.cd-name-divider {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 0.45rem;
  vertical-align: -0.12em;
}
.cd-name-en {
  font-size: 0.72em;
  font-weight: 500;
  color: var(--text-secondary);
}
.cd-hero-star { margin-top: 0.2rem; font-size: 0.9rem; }
.cd-hero-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.2rem;
}
.cd-hero-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.cd-hero-type i { color: var(--accent); }
.cd-hero-type img {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  display: block;
}

.cd-hero-splash {
  flex: 0 0 46%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 220px;
}
.cd-hero-splash img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.45));
  display: block;
}
.cd-hero-splash .db-img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-tertiary);
}
.cd-hero-splash.no-img .db-img-fallback {
  display: flex;
}

/* Level slider and values */
.cd-level { margin-top: 1rem; }
.cd-level-head {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.cd-level-head b { color: #fff; font-size: 1rem; margin-left: 0.2rem; }

.cd-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.cd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  cursor: pointer;
}
.cd-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  cursor: pointer;
}

.cd-stats {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
}
.cd-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.cd-stat b { color: #fff; font-weight: 600; }

/* ============================================================
   Section titles
   ============================================================ */
.cd-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.cd-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  padding-left: 0.6rem;
  border-left: 3px solid var(--accent);
}

/* ============================================================
   Skills
   ============================================================ */
.cd-skill {
  padding: 1rem 1.1rem;
}
.cd-skill-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}
.cd-skill-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--element-glow, var(--glass-border-hover));
  box-shadow: 0 0 8px var(--element-glow, rgba(110, 168, 254, 0.4));
  flex-shrink: 0;
}
.cd-skill-head-text { min-width: 0; }
.cd-skill-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  display: block;
}
.cd-skill-name { font-size: 1.05rem; font-weight: 700; color: #fff; }

.cd-skill-body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.cd-skill-desc {
  flex: 1.4;
  min-width: 0;
  font-size: 0.78rem;
  color: #fff;
  line-height: 1.7;
}
.cd-skill-desc i { color: rgba(240, 240, 245, 0.78); }

.cd-skill-mult {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
}
.cd-mult-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.cd-mult-head b { color: #fff; margin-left: 0.15rem; }
.cd-mult-head .cd-slider { width: 8rem; }
.cd-mult-rows {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.cd-mult-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 0.74rem;
  color: #fff;
}
.cd-mult-row b { color: #fff; font-weight: 600; white-space: nowrap; }

/* ============================================================
   Passive talents / constellations (2-column grid)
   ============================================================ */
.cd-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.cd-talent {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem;
}
.cd-talent-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cd-talent-icon {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--element-glow, var(--glass-border-hover));
  box-shadow: 0 0 8px var(--element-glow, rgba(110, 168, 254, 0.4));
  flex-shrink: 0;
}
.cd-talent-name { font-size: 0.9rem; font-weight: 700; color: #fff; }
.cd-const-idx {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.02rem 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: rgba(110, 168, 254, 0.14);
  border: 1px solid rgba(110, 168, 254, 0.35);
  vertical-align: 1px;
}
.cd-talent-desc {
  font-size: 0.74rem;
  color: #fff;
  line-height: 1.65;
}

/* ============================================================
   Glossary
   ============================================================ */
.cd-glossary {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.cd-term { padding: 0.8rem 0.9rem; }
.cd-term-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFD780;
  margin-bottom: 0.3rem;
}
.cd-term-desc {
  font-size: 0.74rem;
  color: #fff;
  line-height: 1.65;
}

/* ============================================================
   Detail page responsive
   ============================================================ */
@media (max-width: 768px) {
  .cd-hero { flex-direction: column; }
  .cd-hero-splash { flex: none; min-height: 0; }
  .cd-skill-body { flex-direction: column; }
  .cd-grid-2 { grid-template-columns: 1fr; }
  .cd-stats { grid-template-columns: 1fr; }
  .cd-main { padding-left: 0.8rem; padding-right: 0.8rem; }
  /* Scale all typography down on mobile */
  .cd-hero-title { font-size: 0.58rem; }
  .cd-hero-id { font-size: 0.52rem; margin-left: 0.35rem; }
  .cd-hero-name { font-size: 1rem; }
  .cd-hero-star { font-size: 0.62rem; }
  .cd-hero-type { font-size: 0.55rem; padding: 0.16rem 0.4rem; }
  .cd-level-head { font-size: 0.6rem; }
  .cd-stat { font-size: 0.58rem; padding: 0.24rem 0.4rem; }
  .cd-section-title { font-size: 0.76rem; }
  .cd-skill-label { font-size: 0.52rem; }
  .cd-skill-name { font-size: 0.72rem; }
  .cd-skill-desc { font-size: 0.58rem; }
  .cd-skill-icon { width: 1.4rem; height: 1.4rem; }
  .cd-mult-head { font-size: 0.58rem; }
  .cd-mult-row { font-size: 0.56rem; }
  .cd-talent-icon { width: 1.4rem; height: 1.4rem; }
  .cd-talent-name { font-size: 0.64rem; }
  .cd-const-idx { font-size: 0.52rem; margin-right: 0.25rem; padding: 0 0.2rem; }
  .cd-talent-desc { font-size: 0.56rem; }
  .cd-term-name { font-size: 0.62rem; }
  .cd-term-desc { font-size: 0.56rem; }
  /* Mobile: the level selector slider takes the full width */
  .cd-mult-head { width: 100%; }
  .cd-mult-head .cd-slider { flex: 1; width: auto; }
  /* Mobile: remove the tooltip, tapping navigates directly */
  .cd-tooltip { display: none; }
  /* Mobile top immersive button */
  .mobile-immersive {
    display: inline-flex;
    position: fixed;
    top: 0.7rem;
    right: 0.8rem;
    z-index: 300;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--glass-border);
    font-size: 0.72rem;
    color: var(--text-secondary);
  }
  .mobile-immersive.active { color: #FFD780; border-color: #FFD780; }
}

/* ============================================================
   Glossary links and tooltip
   ============================================================ */
.cd-term-link {
  color: #FFD780;
  cursor: pointer;
  border-bottom: 1px dashed #FFD780;
  transition: color var(--transition-fast);
}
.cd-term-link:hover { color: #FFE5A3; }

/* Skill name highlight ({LINK#Sxxx}) */
.cd-skill-link { color: var(--accent); }

/* Glossary tooltip */
.cd-tooltip {
  position: fixed;
  z-index: 999;
  max-width: 560px;
  padding: 0.6rem 0.8rem;
  background: rgba(18, 18, 28, 0.97);
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  font-size: 0.72rem;
  color: var(--text-secondary);
  pointer-events: none;
}
.cd-tooltip b {
  display: block;
  color: #fff;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}
.cd-tooltip p { line-height: 1.55; }

/* Glossary anchor: clears the fixed navbar when jumping to it */
.cd-term { scroll-margin-top: calc(var(--navbar-height) + 1rem); }

/* ============================================================
   Immersive button (replaces the former music button)
   ============================================================ */
.nav-immersive {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-fast);
}
.nav-immersive:hover { color: #fff; border-color: var(--glass-border-hover); }
.nav-immersive.active { color: #FFD780; border-color: #FFD780; }
.nav-immersive.active i { color: #FFD780; }

/* ============================================================
   Glass container: darker background + soft glowing border (less see-through)
   ============================================================ */
.glass {
  background: rgba(12, 12, 20, 0.55);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 8px rgba(110, 168, 254, 0.08), 0 4px 24px rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 10px color-mix(in srgb, var(--element-glow) 28%, transparent), 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   Weapon detail page
   ============================================================ */
.wd-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: calc(var(--navbar-height) + 1.5rem) 1.5rem 3rem;
}

/* Weapon stat bar (info on the left / weapon image on the right) */
.wd-hero {
  display: flex;
  gap: 1.5rem;
  padding: 1.3rem 1.4rem;
}
.wd-hero-info { flex: 1; min-width: 0; }
.wd-hero-name { font-size: 1.8rem; font-weight: 700; color: #fff; line-height: 1.2; }
.wd-hero-star { margin-top: 0.2rem; font-size: 0.9rem; }
.wd-hero-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.2rem;
}
.wd-hero-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.wd-hero-type img {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  display: block;
}
/* Weapon ID: on the same row as the weapon type, styled like the type tags */
.wd-hero-id {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

/* Weapon image (right side) */
.wd-hero-img {
  flex: 0 0 34%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 200px;
}
.wd-hero-img img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.45));
  display: block;
}
.wd-hero-img .db-img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-tertiary);
}
.wd-hero-img.no-img .db-img-fallback { display: flex; }

/* Level slider and values */
.wd-level { margin-top: 1rem; }
.wd-level-head {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.wd-level-head b { color: #fff; font-size: 1rem; margin-left: 0.2rem; }
.wd-stats {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
}
.wd-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.wd-stat b { color: #fff; font-weight: 600; }

/* Semi-transparent divider */
.wd-divider {
  border: none;
  height: 1px;
  margin: 0.2rem 0;
  background: rgba(255, 255, 255, 0.14);
}

/* Weapon passive */
.wd-passive { padding: 1.1rem 1.3rem; }
.wd-passive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.wd-passive-name { font-size: 1.05rem; font-weight: 700; color: #fff; }
.wd-refine { display: flex; gap: 0.35rem; }
.wd-refine-btn {
  min-width: 2.1rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.wd-refine-btn:hover:not(:disabled) {
  color: #fff;
  border-color: var(--glass-border-hover);
}
.wd-refine-btn.active {
  color: #FFD780;
  border-color: #FFD780;
  background: rgba(255, 215, 128, 0.12);
}
.wd-refine-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.wd-passive-desc {
  font-size: 0.8rem;
  color: #fff;
  line-height: 1.75;
}

/* Ascension materials + weapon story */
.wd-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.wd-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  padding-left: 0.6rem;
  border-left: 3px solid var(--accent);
}
.wd-mats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.wd-mat {
  position: relative;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}
.wd-mat img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.wd-mat-count {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 0 0.22rem;
  border-top-left-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.72);
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
}

/* Weapon story (light gray text) */
.wd-story {
  font-size: 0.76rem;
  color: rgba(240, 240, 245, 0.45);
  line-height: 1.8;
  padding-left: 0.6rem;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

/* Weapon detail page responsive */
@media (max-width: 768px) {
  .wd-main { padding-left: 0.8rem; padding-right: 0.8rem; }
  .wd-hero { flex-direction: column; }
  .wd-hero-img { flex: none; min-height: 0; }
  .wd-hero-name { font-size: 1rem; }
  .wd-hero-star { font-size: 0.62rem; }
  .wd-hero-type { font-size: 0.55rem; padding: 0.16rem 0.4rem; }
  .wd-hero-id { font-size: 0.55rem; padding: 0.16rem 0.4rem; }
  .wd-level-head { font-size: 0.6rem; }
  .wd-stats { grid-template-columns: 1fr; }
  .wd-stat { font-size: 0.58rem; padding: 0.24rem 0.4rem; }
  .wd-passive { padding: 0.8rem 0.9rem; }
  .wd-passive-name { font-size: 0.76rem; }
  .wd-refine-btn { font-size: 0.56rem; min-width: 1.6rem; padding: 0.2rem 0.35rem; }
  .wd-passive-desc { font-size: 0.58rem; }
  .wd-section-title { font-size: 0.76rem; }
  .wd-mat { width: 2.4rem; height: 2.4rem; }
  .wd-mat-count { font-size: 0.5rem; }
  .wd-story { font-size: 0.56rem; }
}

/* ============================================================
   Artifact list page
   ============================================================ */

/* Filter bar: search box + "Show effects" toggle */
.ar-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.ar-filter-bar .db-search { flex: 1; min-width: 12rem; }

/* "Show effects" toggle button */
.ar-fx-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ar-fx-toggle:hover {
  color: #fff;
  border-color: var(--glass-border-hover);
}
.ar-fx-toggle.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(110, 168, 254, 0.12);
}

/* Grid column counts: two layouts, "Show effects" on / off */
body.fx-off .db-grid { grid-template-columns: repeat(7, 1fr); }
body.fx-on .db-grid { grid-template-columns: repeat(2, 1fr); }

/* Artifact card */
.ar-card { cursor: pointer; }

/* Set icon: the border color is determined by rarity */
.ar-icon {
  position: relative;
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ar-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ar-icon.star5 { border-color: #F7B733; box-shadow: 0 0 12px rgba(247, 183, 51, 0.55); }
.ar-icon.star4 { border-color: #B58AE6; box-shadow: 0 0 12px rgba(181, 138, 230, 0.55); }
.ar-icon.star3 { border-color: #6EA8FE; box-shadow: 0 0 12px rgba(110, 168, 254, 0.55); }

/* Icon placeholder (no icon data / failed to load) */
.ar-icon .db-img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--text-tertiary);
}
.ar-icon.no-img .db-img-fallback { display: flex; }

/* "Show effects" enabled: the container stretches horizontally, icon + name on the left, set effects on the right */
.ar-card-fx {
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  text-align: left;
  padding: 1rem 1.1rem;
}
.ar-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  width: 5.2rem;
}
.ar-right { flex: 1; min-width: 0; }
.ar-bonus {
  font-size: 0.72rem;
  color: #fff;
  line-height: 1.6;
}
.ar-bonus-tag {
  color: var(--accent);
  font-weight: 700;
}
.ar-bonus-empty { color: var(--text-tertiary); }
.ar-divider {
  border: none;
  height: 1px;
  margin: 0.45rem 0;
  background: rgba(255, 255, 255, 0.14);
}

/* Artifact list page responsive */
@media (max-width: 768px) {
  body.fx-off .db-grid { grid-template-columns: repeat(3, 1fr); }
  body.fx-on .db-grid { grid-template-columns: 1fr; }
  .ar-icon { width: 2.9rem; height: 2.9rem; }
  .ar-icon .db-img-fallback { font-size: 1.1rem; }
  .ar-filter-bar .db-search { min-width: 0; }
  .ar-fx-toggle { font-size: 0.72rem; padding: 0.42rem 0.7rem; }
  /* On mobile, switch to a stacked layout when effects are shown, with the text taking the full width */
  .ar-card-fx {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.7rem 0.8rem;
  }
  .ar-left {
    flex-direction: row;
    justify-content: flex-start;
    width: auto;
    gap: 0.5rem;
  }
  .ar-bonus { font-size: 0.6rem; }
}

/* ============================================================
   Artifact detail page
   ============================================================ */
.ad-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: calc(var(--navbar-height) + 1.5rem) 1.5rem 3rem;
}

/* Header: title on the left, image (flower) on the right, rarity below the title */
.ad-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.3rem 1.4rem;
}
.ad-hero-info { flex: 1; min-width: 0; }
.ad-hero-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.ad-hero-star { margin-top: 0.35rem; font-size: 0.9rem; }
/* Artifact ID: below the rarity and above the version picker, small gray text */
.ad-hero-id {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.ad-hero-img {
  flex: 0 0 26%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 150px;
}
.ad-hero-img img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.45));
  display: block;
}
.ad-hero-img .db-img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-tertiary);
}
.ad-hero-img.no-img .db-img-fallback { display: flex; }

/* Set effects */
.ad-bonus { padding: 1.1rem 1.3rem; }
.ad-bonus-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}
/* Spacing between the title and the content */
.ad-bonus-body { margin-top: 1.1rem; }
.ad-bonus-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.3rem;
}
.ad-bonus-desc {
  font-size: 0.8rem;
  color: #fff;
  line-height: 1.75;
}
.ad-bonus-empty { font-size: 0.8rem; color: var(--text-tertiary); }
.ad-divider {
  border: none;
  height: 1px;
  margin: 1rem 0;
  background: rgba(255, 255, 255, 0.14);
}

/* Set pieces */
.ad-pieces { padding: 1.1rem 1.3rem; }
.ad-piece-list {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.ad-piece {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
}
.ad-piece-img {
  position: relative;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ad-piece-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ad-piece-img .db-img-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-tertiary);
}
.ad-piece-img.no-img .db-img-fallback { display: flex; }
.ad-piece-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
}

/* Artifact detail page responsive */
@media (max-width: 768px) {
  .ad-main { padding-left: 0.8rem; padding-right: 0.8rem; }
  .ad-hero { gap: 0.8rem; padding: 0.9rem 1rem; }
  .ad-hero-name { font-size: 1rem; }
  .ad-hero-star { font-size: 0.62rem; }
  .ad-hero-id { font-size: 0.52rem; }
  .ad-hero-img { flex: 0 0 32%; min-height: 90px; }
  .ad-hero-img .db-img-fallback { font-size: 1.8rem; }
  .ad-bonus { padding: 0.8rem 0.9rem; }
  .ad-bonus-title { font-size: 0.8rem; }
  .ad-bonus-body { margin-top: 0.8rem; }
  .ad-bonus-label { font-size: 0.68rem; }
  .ad-bonus-desc { font-size: 0.6rem; }
  .ad-divider { margin: 0.7rem 0; }
  .ad-pieces { padding: 0.8rem 0.9rem; }
  .ad-piece { gap: 0.7rem; padding: 0.45rem 0.6rem; }
  .ad-piece-img { width: 2.6rem; height: 2.6rem; }
  .ad-piece-name { font-size: 0.66rem; }
}

/* ============================================================
   Version picker (shared by the character / weapon / artifact detail pages)
   ============================================================ */
.ver-picker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.ver-label {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.ver-opts {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.ver-opt {
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ver-opt:hover {
  color: #fff;
  border-color: var(--glass-border-hover);
}
.ver-opt.active {
  color: #FFD780;
  border-color: #FFD780;
  background: rgba(255, 215, 128, 0.12);
}

/* ============================================================
   Character detail page · Version diff mode
   ============================================================ */

/* Version diff mode toggle */
.dfx-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}
.dfx-toggle-label {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.dfx-toggle-btn {
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.dfx-toggle-btn:hover { color: #fff; border-color: var(--glass-border-hover); }
.dfx-toggle-btn.on {
  color: #FFD780;
  border-color: #FFD780;
  background: rgba(255, 215, 128, 0.12);
}

/* Two-version selection: two columns with a semi-transparent divider in the middle */
.dfx-compare-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.dfx-compare {
  flex: 1 1 20rem;
  display: flex;
  align-items: stretch;
  min-width: 0;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  /* overflow: hidden cannot be used here — the expanded version dropdown list would be clipped
     by the container, so each side is given its own border radius instead, which has the same effect */
}
.dfx-side:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}
.dfx-side:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}
.dfx-side {
  position: relative;
  flex: 1 1 50%;
  min-width: 0;
  padding: 0.6rem 0.7rem;
}
.dfx-side + .dfx-side {
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.02);
}
.dfx-side-title {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-bottom: 0.35rem;
}

/* Version dropdown: dark liquid glass */
.dfx-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 0.76rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.dfx-select-btn:hover { border-color: var(--glass-border-hover); }
.dfx-select-btn i { font-size: 0.62rem; color: var(--text-tertiary); }
.dfx-select-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dfx-select-list {
  position: absolute;
  z-index: 30;
  left: 0.7rem;
  right: 0.7rem;
  margin-top: 0.3rem;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border-hover);
  background: rgba(18, 20, 28, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.dfx-select-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.36rem 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.dfx-select-opt:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.dfx-select-opt.active { color: #FFD780; background: rgba(255, 215, 128, 0.12); }

/* Hint bar */
.dfx-empty {
  flex: 1 1 20rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.76rem;
}
.dfx-empty-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.6rem 1rem;
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.dfx-empty-body i { color: #7BD88F; }

/* Side-by-side comparison skeleton (desktop: new on the left, old on the right) */
.dfx-pair {
  display: flex;
  align-items: stretch;
  margin-top: 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}
.dfx-col { flex: 1 1 50%; min-width: 0; }
.dfx-col + .dfx-col { border-left: 1px solid rgba(255, 255, 255, 0.09); }
.dfx-col-head {
  padding: 0.25rem 0.6rem;
  font-size: 0.66rem;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--glass-border);
}
.dfx-col-body {
  padding: 0.55rem 0.65rem;
  font-size: 0.74rem;
  line-height: 1.7;
  color: #fff;
  word-break: break-word;
}

/* Change highlights: additions / after values are green, deletions / before values are red (obvious, for quick scanning) */
.dfx-add {
  background: rgba(74, 222, 128, 0.48);
  border-radius: 2px;
  padding: 0 1px;
}
.dfx-del {
  background: rgba(248, 113, 113, 0.45);
  border-radius: 2px;
  padding: 0 1px;
}
.dfx-none { color: var(--text-tertiary); }

/* Version number in the comparison column header */
.dfx-col-ver {
  color: #FFD780;
  font-weight: 600;
}

/* "New version / old version" label before the multiplier value on mobile: hidden on desktop */
.dfx-mult-tag { display: none; }

/* Side-by-side names: new first, old after */
.dfx-name-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dfx-name {
  border-radius: 2px;
  padding: 0 2px;
}

/* Talents / constellations / entries: each changed item takes its own row */
.dfx-skill .cd-skill-body { display: block; }
.dfx-talent { margin-bottom: 0.7rem; }
.dfx-talent:last-child { margin-bottom: 0; }

/* Multiplier comparison: the header and the data rows share the same two columns, "new on the left, old on the right"
   (previously the header had a placeholder plus two titles while the paired rows had two, so the columns did not line up) */
.dfx-mult-cols,
.dfx-mult-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dfx-mult-cols {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.66rem;
  color: var(--text-tertiary);
}
.dfx-mult-cols .dfx-col-head {
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  text-align: center;
}
.dfx-mult-row {
  padding: 0.22rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
/* Each column holds "multiplier entry name + value"; both the name and the value can be change-highlighted */
.dfx-mult-cell {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.2rem;
}
.dfx-mult-cell.dfx-col-old {
  border-left: 1px solid rgba(255, 255, 255, 0.07);
}
.dfx-mult-rn {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.72rem;
  color: #fff;   /* Same color as the skill text */
  word-break: break-word;
}
.dfx-mult-rv {
  flex: 0 0 auto;
  font-size: 0.74rem;
  color: #fff;
  text-align: right;
}
/* The <i> verses in the text and in the multipliers stay italic */
.dfx-col-body i,
.dfx-mult-cell i { font-style: italic; }

@media (max-width: 768px) {
  .ver-picker { margin-top: 0.6rem; gap: 0.4rem; }
  .ver-label { font-size: 0.6rem; }
  .ver-opt { font-size: 0.55rem; padding: 0.22rem 0.45rem; }

  /* Version diff mode: vertical layout (new version on top, old version below) */
  .dfx-toggle { margin-top: 0.6rem; gap: 0.35rem; }
  .dfx-toggle-label { font-size: 0.6rem; }
  .dfx-toggle-btn { font-size: 0.55rem; padding: 0.22rem 0.5rem; }

  .dfx-compare { flex-direction: column; }
  .dfx-side { padding: 0.5rem 0.55rem; }
  .dfx-side + .dfx-side {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }
  /* After switching to a vertical layout, the border radius direction has to change too */
  .dfx-side:first-child {
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
    border-bottom-left-radius: 0;
  }
  .dfx-side:last-child {
    border-top-right-radius: 0;
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
  }
  .dfx-side-title { font-size: 0.58rem; }
  .dfx-select-btn { font-size: 0.62rem; padding: 0.32rem 0.5rem; }
  .dfx-select-opt { font-size: 0.6rem; }
  .dfx-select-list { left: 0.55rem; right: 0.55rem; max-height: 13rem; }

  .dfx-pair { flex-direction: column; }
  .dfx-col { flex: 1 1 auto; }
  .dfx-col + .dfx-col {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }
  .dfx-col-head { font-size: 0.56rem; padding: 0.2rem 0.5rem; }
  .dfx-col-body { font-size: 0.6rem; padding: 0.45rem 0.5rem; line-height: 1.65; }

  .dfx-name-pair { gap: 0.3rem; }

  /* Multipliers: the two columns become two stacked blocks, each "version label + name + value" */
  .dfx-mult-cols { display: none; }
  .dfx-mult-row {
    display: block;
    padding: 0.4rem 0;
  }
  .dfx-mult-cell {
    display: block;
    padding: 0 0 0.25rem 0.7rem;
  }
  .dfx-mult-cell.dfx-col-old {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 0.25rem;
  }
  .dfx-mult-rn {
    display: block;
    font-size: 0.6rem;
  }
  .dfx-mult-rv {
    display: block;
    text-align: left;
    font-size: 0.6rem;
  }
  .dfx-mult-tag {
    display: block;
    margin-bottom: 0.1rem;
    font-size: 0.56rem;
    color: var(--text-tertiary);
  }
}

/* ============================================================
   "Updates" page
   ============================================================ */
.up-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.up-ver {
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid #FFD780;
  background: rgba(255, 215, 128, 0.12);
  color: #FFD780;
  font-size: 0.85rem;
  font-weight: 600;
}
.up-total { font-size: 0.84rem; color: var(--text-secondary); }
.up-total b { color: #fff; }

.up-section { margin-bottom: 1.8rem; }
.up-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  padding-left: 0.6rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 0.9rem;
}
.up-count {
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: rgba(110, 168, 254, 0.15);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
}
.up-more {
  margin-left: auto;
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--text-tertiary);
}
.up-more:hover { color: var(--accent); }
.up-none {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed var(--glass-border);
  color: var(--text-tertiary);
  font-size: 0.82rem;
  text-align: center;
}
.up-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.7rem;
}
.up-empty { max-width: 520px; margin: 2rem auto; }

@media (max-width: 1024px) {
  .up-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 768px) {
  .up-grid { grid-template-columns: repeat(3, 1fr); }
  .up-head { gap: 0.5rem; }
  .up-ver { font-size: 0.7rem; padding: 0.25rem 0.6rem; }
  .up-total { font-size: 0.68rem; }
  .up-title { font-size: 0.8rem; }
  .up-none { font-size: 0.66rem; }
}

/* ----------------------------------------------------------
   18. Database grid layout fix
   Cards are laid out with flex instead of a fixed 7-column grid so
   that the last row stays centred and long names wrap instead of
   pushing the grid past the right edge of the page.
   ---------------------------------------------------------- */
.db-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.7rem;
}

.db-grid .db-card {
  box-sizing: border-box;
  min-width: 0;
  flex: 0 0 calc((100% - 4.2rem) / 7);
  max-width: calc((100% - 4.2rem) / 7);
}

/* Long artifact / weapon names wrap onto a second line and shrink a little
   rather than being cut off with an ellipsis. */
.db-grid .db-card-name {
  font-size: 0.72rem;
  line-height: 1.28;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 1.85rem;
}

/* Desktop: keep all seven element chips (icon + label) on one line.
   English labels are wider than the Chinese ones, so the element row
   uses slightly tighter padding, gap and font size to always fit. */
@media (min-width: 1025px) {
  .db-filter-row { flex-wrap: nowrap; }
  .db-filter-row .db-filter-opts { flex-wrap: nowrap; }
  .db-filter-title { width: auto; min-width: 4.4rem; }
  .db-filter-opts-element { gap: 0.3rem; }
  .db-filter-opts-element .db-filter-opt {
    padding: 0.24rem 0.5rem;
    gap: 0.25rem;
    font-size: 0.7rem;
  }
  .db-filter-opts-element .db-filter-opt img {
    width: 1.05rem;
    height: 1.05rem;
  }
}

@media (max-width: 1024px) {
  .db-grid .db-card { flex: 0 0 calc((100% - 3.5rem) / 6); max-width: calc((100% - 3.5rem) / 6); }
}

@media (max-width: 768px) {
  .db-grid .db-card { flex: 0 0 calc((100% - 2.1rem) / 4); max-width: calc((100% - 2.1rem) / 4); }
  .db-grid .db-card-name { min-height: 0; }
}

@media (max-width: 400px) {
  .db-grid .db-card { flex: 0 0 calc((100% - 1.4rem) / 3); max-width: calc((100% - 1.4rem) / 3); }
}

/* ----------------------------------------------------------
   19. Artifact grid — "Show Effects" mode
   The grid is flex-based now (section 18), so the original
   `body.fx-on/-off .db-grid { grid-template-columns }` rules no
   longer control the column count. These rules restore them:
     fx-on  -> two wide cards per row (icon + set-bonus panel beside it)
     fx-off -> the compact seven-per-row layout
   ---------------------------------------------------------- */
body.fx-on .db-grid .db-card {
  flex: 0 0 calc((100% - 0.7rem) / 2);
  max-width: calc((100% - 0.7rem) / 2);
}

body.fx-off .db-grid .db-card {
  flex: 0 0 calc((100% - 4.2rem) / 7);
  max-width: calc((100% - 4.2rem) / 7);
}

/* Show-effects cards keep the icon and the bonus text side by side, exactly
   like the original grid layout (cards in the same row stay equal height). */
body.fx-on .db-grid {
  align-items: stretch;
}

body.fx-on .db-grid .ar-card-fx {
  flex-direction: row;
  align-items: center;
  height: auto;
}

@media (max-width: 1024px) {
  body.fx-off .db-grid .db-card { flex: 0 0 calc((100% - 3.5rem) / 6); max-width: calc((100% - 3.5rem) / 6); }
  body.fx-on  .db-grid .db-card { flex: 0 0 calc((100% - 0.7rem) / 2); max-width: calc((100% - 0.7rem) / 2); }
}

@media (max-width: 768px) {
  body.fx-off .db-grid .db-card { flex: 0 0 calc((100% - 2.1rem) / 4); max-width: calc((100% - 2.1rem) / 4); }
  body.fx-on  .db-grid .db-card { flex: 0 0 100%; max-width: 100%; }
  body.fx-on  .db-grid .ar-card-fx {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 400px) {
  body.fx-off .db-grid .db-card { flex: 0 0 calc((100% - 1.4rem) / 3); max-width: calc((100% - 1.4rem) / 3); }
}