:root {
  --dq8-ink: #172033;
  --dq8-muted: #5d677a;
  --dq8-link: #1557a6;
  --dq8-link-hover: #0b3c7b;
  --dq8-accent: #b94a2f;
  --dq8-gold: #c89b3c;
  --dq8-surface: #ffffff;
  --dq8-surface-alt: #f3f5f8;
  --dq8-border: #d7dce5;
  --dq8-header: #111827;
  --dq8-header-2: #1f2937;
  --dq8-radius: 12px;
  --dq8-shadow: 0 8px 28px rgba(23, 32, 51, .08);
  --dq8-content: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body.dq8-page {
  margin: 0 !important;
  min-width: 0 !important;
  background: #eef1f6 !important;
  color: var(--dq8-ink) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif !important;
  font-size: 16px !important;
  line-height: 1.75 !important;
  overflow-wrap: anywhere;
}
body.nav-open { overflow: hidden; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; z-index: 10000; top: .5rem; left: .5rem; transform: translateY(-160%);
  background: #fff; color: #000; padding: .65rem 1rem; border-radius: 8px; box-shadow: var(--dq8-shadow);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky; z-index: 1000; top: 0;
  color: #fff; background: linear-gradient(135deg, var(--dq8-header), var(--dq8-header-2));
  border-bottom: 3px solid var(--dq8-gold); box-shadow: 0 3px 16px rgba(0, 0, 0, .18);
}
.site-header__inner {
  width: min(100% - 32px, var(--dq8-content)); min-height: 66px; margin: 0 auto;
  display: flex; align-items: center; gap: 28px;
}
.site-brand { display: inline-flex; align-items: baseline; gap: 9px; color: #fff !important; text-decoration: none !important; font-weight: 800 !important; letter-spacing: .03em; white-space: nowrap; padding: 8px 0 !important; }
.site-brand span { font-size: 1.25rem; }
.site-brand small { color: #f1ca73; font-size: .78rem; font-weight: 700; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.site-nav a { color: #f7f8fb !important; padding: 20px 11px !important; border-radius: 7px; font-size: .9rem; font-weight: 700 !important; text-decoration: none !important; }
.site-nav a:hover, .site-nav a:focus-visible { background: rgba(255, 255, 255, .12) !important; color: #fff !important; }
.site-nav-toggle { display: none; margin-left: auto; width: 44px; height: 44px; padding: 9px; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; background: transparent; }
.site-nav-toggle span:not(.sr-only) { display: block; height: 2px; margin: 5px 0; background: #fff; }

.breadcrumbs { background: #fff; border-bottom: 1px solid var(--dq8-border); }
.breadcrumbs__inner { width: min(100% - 32px, var(--dq8-content)); margin: 0 auto; min-height: 42px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--dq8-muted); font-size: .82rem; }
.breadcrumbs a { color: var(--dq8-link) !important; padding: 5px 0 !important; }

body.dq8-page a { color: var(--dq8-link); text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .16em; font-weight: 600; }
body.dq8-page a:hover { color: var(--dq8-link-hover); background: transparent; }
body.dq8-page a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #f2bd45; outline-offset: 2px; }

#container {
  width: min(100% - 32px, var(--dq8-content)) !important;
  margin: 22px auto 42px !important;
  padding: 0 !important;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  text-align: left !important;
}
#container > br { display: none; }
#main { grid-column: 2; grid-row: 1 / span 3; min-width: 0; }
#sidetop, #side, .sidebar-toggle { grid-column: 1; }
#sidetop { display: none; }
#side {
  position: sticky; top: 88px; max-height: calc(100vh - 106px); overflow: auto;
  padding: 12px; background: var(--dq8-surface); border: 1px solid var(--dq8-border);
  border-radius: var(--dq8-radius); box-shadow: var(--dq8-shadow); scrollbar-width: thin;
}
#side > br { display: none; }
#side #divmargin { margin: 0 0 13px !important; }
#side h3, #side h4 {
  margin: 0 !important; padding: 9px 10px !important; color: #fff !important;
  background: var(--dq8-header) !important; border-radius: 7px 7px 0 0;
  font-size: .86rem !important; line-height: 1.35 !important; font-weight: 800 !important; text-align: left !important;
}
#side h4 { margin-top: 8px !important; color: var(--dq8-ink) !important; background: #e9edf3 !important; border-radius: 6px; }
#sidetable, #sidesptable { width: 100% !important; border: 1px solid var(--dq8-border) !important; background: #fff !important; }
#sidetable td, #sidesptable td { padding: 0 !important; border-color: var(--dq8-border) !important; background: #fff !important; text-align: center; }
#sidetable a, #sidesptable a { display: block; padding: 8px 6px !important; font-size: .79rem; line-height: 1.35; text-decoration: none; }
#sidetable a:hover, #sidesptable a:hover { background: #f0f4fa !important; }
.sidebar-toggle { display: none; width: 100%; border: 0; border-radius: 9px; padding: 12px 16px; color: #fff; background: var(--dq8-header); font-weight: 800; }

/* Legacy top title bars */
body.dq8-page > table:first-of-type, body.dq8-page > .table-scroll:first-of-type { margin-top: 0; }
body.dq8-page > table, #main > table { max-width: var(--dq8-content); margin-left: auto !important; margin-right: auto !important; }
body.dq8-page > table td[bgcolor="#111122"], #main td[bgcolor="#111122"] { background: var(--dq8-header) !important; color: #fff !important; }
body.dq8-page > table td[bgcolor="#e6e6ee"] { background: #fff !important; }
body.dq8-page > table h1 { margin: 0; font-size: 1.35rem !important; color: inherit; }
.page-lead { margin: 8px auto 2px; max-width: 900px; padding: 0 12px; color: var(--dq8-muted); font-size: .92rem; font-weight: 400; line-height: 1.65; }

h1, h2, h3, h4 { color: var(--dq8-ink); font-weight: 800; line-height: 1.35; }
h1 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
h3 { font-size: 1.12rem; }
p { line-height: 1.8; }

#header {
  width: 100% !important; height: auto !important; min-height: 0 !important; margin: 0 !important;
  padding: clamp(24px, 5vw, 64px) clamp(18px, 5vw, 58px) !important;
  border-radius: var(--dq8-radius); background-color: #fff !important; background-size: contain !important;
  box-shadow: var(--dq8-shadow); overflow: hidden;
}
#header h1 { margin: 0 !important; font-size: clamp(2.2rem, 7vw, 5rem) !important; line-height: 1.1 !important; letter-spacing: .03em; text-shadow: 0 3px 10px rgba(17,24,39,.18); }
.page-home #container { display: block; }
.page-home #header { margin-bottom: 18px !important; }
.page-home #tbox { display: grid !important; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; overflow: visible !important; }
.page-home #box, .page-home #box1, .page-home #box2, .page-home #box3, .page-home #box4 { width: auto !important; float: none !important; margin: 0 !important; grid-column: span 4; min-width: 0; }
.page-home #box4 { grid-column: 1 / -1; }

#main > #tbox, #main #tbox { display: flex; flex-wrap: wrap; gap: 16px; overflow: visible !important; margin-bottom: 16px; }
#main #box, #main #box1, #main #box2, #main #box3, #main #box4 {
  float: none !important; width: auto !important; min-width: 0; margin: 0 !important; flex: 1 1 320px;
}
#main #box4 { flex-basis: 100%; }
#block, #linebox, #formbox, #navia {
  background: var(--dq8-surface); border: 1px solid var(--dq8-border); border-radius: var(--dq8-radius);
  box-shadow: 0 3px 16px rgba(23,32,51,.05); overflow: hidden;
}
#linebox, #formbox, #navia { padding: 14px; }
#divmargin { margin-bottom: 16px; }

.table-scroll { width: 100%; overflow-x: auto; overflow-y: hidden; margin: 0 0 16px; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.table-scroll > table { margin-bottom: 0 !important; }
table {
  width: 100% !important; max-width: 100%; border-collapse: collapse !important;
  background: var(--dq8-surface); border: 1px solid var(--dq8-border) !important;
  color: var(--dq8-ink); line-height: 1.55 !important;
}
th, td { height: auto !important; padding: 9px 10px !important; border: 1px solid var(--dq8-border) !important; font-size: .9rem !important; vertical-align: middle; }
th { color: #fff !important; background: #283445 !important; font-weight: 800 !important; text-align: center; }
td[bgcolor="#333344"], td[bgcolor="#333344"] h3, td[bgcolor="#333344"] font,
td[bgcolor="#111122"], td[bgcolor="#111122"] font { color: #fff !important; background: var(--dq8-header) !important; }
td[bgcolor="#ccccdd"], td[bgcolor="#ccccd3"], td[bgcolor="#e6e6ee"], td[bgcolor="#e6e6e6"], td[bgcolor="#eeeeee"] { background: #eef1f6 !important; }
tr:nth-child(even) > td[bgcolor="#f6f6f6"], tr:nth-child(even) > td[bgcolor="#efefef"] { background: #f7f8fa !important; }
table a { padding: 2px 0 !important; }
font { font-family: inherit !important; font-size: inherit !important; }

img { max-width: 100%; height: auto; }
img[align="left"] { margin: 0 18px 10px 0; }
img[align="right"] { margin: 0 0 10px 18px; }
.max img { width: 100% !important; }
map, area { max-width: 100%; }

input, select, textarea, button { font: inherit; }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
  width: min(100%, 34rem); min-height: 42px; padding: 8px 10px; border: 1px solid #aeb7c5; border-radius: 7px; background: #fff;
}
textarea { min-height: 120px; }
input[type="submit"], button:not(.site-nav-toggle):not(.back-to-top) {
  min-height: 42px; padding: 9px 16px; border: 0; border-radius: 7px; color: #fff; background: var(--dq8-link); cursor: pointer; font-weight: 800;
}

#footersab, body.dq8-page > table:last-of-type { clear: both; }
.site-footer { margin-top: 44px; padding: 32px 16px; color: #dce2ec; background: var(--dq8-header); border-top: 4px solid var(--dq8-gold); }
.site-footer__inner { width: min(100%, var(--dq8-content)); margin: 0 auto; text-align: center; }
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 17px; }
.site-footer a { color: #fff !important; font-size: .9rem; }
.site-footer p { margin: 7px 0; font-size: .82rem; color: #b8c1cf; }
.site-footer__copy { color: #f1ca73 !important; }
.back-to-top { position: fixed; right: 18px; bottom: 18px; z-index: 900; width: 44px; height: 44px; padding: 0 !important; border-radius: 50% !important; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; box-shadow: var(--dq8-shadow); }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

@media (max-width: 900px) {
  .site-header__inner { width: min(100% - 24px, var(--dq8-content)); min-height: 58px; }
  .site-brand span { font-size: 1.08rem; }
  .site-nav-toggle { display: block; }
  .site-nav {
    display: none; position: fixed; inset: 61px 0 auto 0; margin: 0; padding: 12px;
    max-height: calc(100vh - 61px); overflow: auto; background: var(--dq8-header); box-shadow: 0 10px 25px rgba(0,0,0,.25);
  }
  .site-nav.is-open { display: grid; grid-template-columns: repeat(2, 1fr); }
  .site-nav a { padding: 13px !important; border: 1px solid rgba(255,255,255,.13); text-align: center; }
  .breadcrumbs__inner { width: min(100% - 24px, var(--dq8-content)); }
  #container { width: min(100% - 20px, var(--dq8-content)) !important; display: block; margin-top: 14px !important; }
  #main { width: 100%; }
  .sidebar-toggle { display: block; margin: 20px 0 10px; }
  #side { display: none; position: static; max-height: none; margin-bottom: 20px; }
  #side.is-open { display: block; }
  .page-home #tbox { grid-template-columns: 1fr; }
  .page-home #box, .page-home #box1, .page-home #box2, .page-home #box3, .page-home #box4 { grid-column: auto; }
  #main > #tbox, #main #tbox { display: block; }
  #main #box, #main #box1, #main #box2, #main #box3, #main #box4 { margin-bottom: 14px !important; }
  th, td { padding: 8px 7px !important; font-size: .84rem !important; }
  #header { padding: 26px 18px !important; background-image: none !important; text-align: center; }
  #header h1 { font-size: clamp(2rem, 12vw, 3.4rem) !important; }
  img[align="left"], img[align="right"] { float: none; display: block; margin: 0 auto 12px; }
}

@media (max-width: 520px) {
  body.dq8-page { font-size: 15px !important; }
  .site-header__inner { width: calc(100% - 18px); gap: 8px; }
  .site-brand { gap: 5px; }
  .site-brand small { display: none; }
  .site-nav.is-open { grid-template-columns: 1fr; }
  .breadcrumbs__inner { width: calc(100% - 18px); min-height: 38px; }
  #container { width: calc(100% - 12px) !important; }
  th, td { padding: 7px 6px !important; font-size: .8rem !important; }
  .page-lead { font-size: .85rem; }
}

@media print {
  .site-header, .breadcrumbs, #side, .sidebar-toggle, .site-footer, .back-to-top, #footersab { display: none !important; }
  body.dq8-page { background: #fff !important; color: #000 !important; }
  #container { width: 100% !important; display: block !important; margin: 0 !important; }
  #main { width: 100% !important; }
  a { color: #000 !important; text-decoration: none !important; }
}

.page-home > table:first-of-type, .page-home > .table-scroll:first-of-type { display: none !important; }

/* The shared shell replaces legacy footer blocks and device switch controls. */
body.dq8-page > #footer,
body.dq8-page > #last,
body.dq8-page > #footersab,
body.dq8-page #footer,
body.dq8-page #last,
body.dq8-page #footersab { display: none !important; }

/* Pages without a sidebar should use the full content width. */
#container:not(:has(#side)) #main { grid-column: 1 / -1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* 2026-08-02d: legacy visual compatibility fixes. */

/*
 * The top page uses a legacy background image containing the Game-Cap logo.
 * Keep the text heading and logo in separate horizontal regions instead of
 * scaling the background across the whole card.
 */
.page-home #header {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 150px !important;
  padding: 0 clamp(420px, 47vw, 640px) 0 clamp(28px, 4vw, 58px) !important;
  background-position: right center !important;
  background-repeat: no-repeat !important;
  background-size: auto 150px !important;
}
.page-home #header h1 {
  margin: 0 !important;
  max-width: none !important;
  font-size: clamp(2.8rem, 4.6vw, 4.35rem) !important;
  line-height: 1.05 !important;
  letter-spacing: .01em !important;
  white-space: nowrap;
}

/*
 * bar1.gif/bar2.gif/bar3.gif are legacy 1x16px stretch images. The general
 * responsive image rule must not change their height to auto; otherwise a
 * 100px-wide bar becomes 1600px tall because of the intrinsic 1:16 ratio.
 */
img[src$="bar1.gif"],
img[src$="bar2.gif"],
img[src$="bar3.gif"] {
  display: inline-block !important;
  height: 16px !important;
  max-width: none !important;
  vertical-align: middle !important;
}

/* Image-map pages are scaled responsively by site.js. */
img[usemap] {
  display: block;
  height: auto !important;
}
#scroll2 {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
#scroll2 img[usemap] {
  max-width: 100% !important;
}

/* Keep hash targets visible below the sticky global header. */
[id] {
  scroll-margin-top: 88px;
}

@media (max-width: 900px) {
  .page-home #header {
    min-height: 0 !important;
    padding: 28px 18px !important;
    justify-content: center;
    background-image: none !important;
  }
  .page-home #header h1 {
    font-size: clamp(2rem, 11vw, 3.35rem) !important;
    white-space: normal;
    text-align: center;
  }
}

/* 2026-08-02e: responsive monster stat meters. */
.dq8-stat-meter {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 150px;
}
.dq8-stat-meter__track {
  position: relative;
  display: flex;
  width: 100%;
  height: 14px;
  overflow: hidden;
  border: 1px solid #aeb8c7;
  border-radius: 999px;
  background: linear-gradient(180deg, #f1f3f6 0%, #d7dce4 100%);
  box-shadow: inset 0 1px 2px rgba(17, 24, 39, .18), 0 1px 1px rgba(255, 255, 255, .8);
}
.dq8-stat-meter__track::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.52), transparent 42%, rgba(0,0,0,.08)),
    repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), rgba(255,255,255,.65) calc(25% - 1px) 25%);
}
.dq8-stat-meter__segment {
  position: relative;
  z-index: 0;
  display: block;
  flex: 0 0 auto;
  height: 100%;
  min-width: 0;
}
.dq8-stat-meter__segment--base {
  background: linear-gradient(90deg, #1671c7 0%, #2f9ce8 58%, #50b8f2 100%);
  box-shadow: inset -1px 0 rgba(255,255,255,.36);
}
.dq8-stat-meter__segment--growth {
  background: linear-gradient(90deg, #ff745e 0%, #ef4054 55%, #c72546 100%);
  box-shadow: inset 1px 0 rgba(255,255,255,.52);
}
.dq8-stat-meter__value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 3.5em;
  color: #394457;
  font-size: .78rem;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.dq8-stat-meter--growth .dq8-stat-meter__value { min-width: 7.2em; }
.dq8-stat-meter__value strong { color: #172033; font-size: .82rem; }
.dq8-stat-meter__value strong:last-child { color: #b62840; }
.dq8-stat-meter--compact {
  display: block;
  min-width: 72px;
}
.dq8-stat-meter--compact .dq8-stat-meter__track {
  min-width: 72px;
  height: 11px;
}
.dq8-stat-legend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  color: #4d586b;
  font-size: .8rem;
}
.dq8-stat-legend i {
  display: inline-block;
  width: 18px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(17,32,51,.18);
  box-shadow: inset 0 1px rgba(255,255,255,.55);
}
.dq8-stat-legend__base { background: linear-gradient(90deg, #1671c7, #50b8f2); }
.dq8-stat-legend__growth { background: linear-gradient(90deg, #ff745e, #c72546); }

/* Keep stat cells readable in the wide battle-road comparison tables. */
.page-data table td:has(.dq8-stat-meter) {
  min-width: 138px;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}
.page-data table td:has(.dq8-stat-meter--compact) { min-width: 90px; }

@media (max-width: 520px) {
  .dq8-stat-meter {
    grid-template-columns: minmax(90px, 1fr) auto;
    min-width: 125px;
    gap: 6px;
  }
  .dq8-stat-meter__track { height: 13px; }
  .dq8-stat-meter__value { font-size: .72rem; }
  .dq8-stat-meter--growth .dq8-stat-meter__value { min-width: 6.6em; }
}

/* 2026-08-02f: mobile-first data cards, readable comparison tables and photo zoom. */
.dq8-mobile-cards,
.dq8-mobile-view-controls,
.dq8-scroll-hint {
  display: none;
}

.dq8-lightbox[hidden] { display: none !important; }
.dq8-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.dq8-lightbox__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(5, 10, 20, .88) !important;
}
.dq8-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 920px);
  max-height: calc(100vh - 32px);
  padding: 48px 12px 12px;
  overflow: auto;
  border-radius: 14px;
  background: #0e1728;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.dq8-lightbox__close {
  position: absolute;
  top: 7px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px !important;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.45) !important;
  border-radius: 50% !important;
  color: #fff !important;
  background: rgba(255,255,255,.12) !important;
  font-size: 1.7rem;
  line-height: 1;
}
.dq8-lightbox__image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  margin: 0 auto;
  object-fit: contain;
}
.dq8-lightbox__caption {
  margin: 10px 4px 0;
  color: #eef4ff;
  text-align: center;
  font-size: .9rem;
}
body.dq8-lightbox-open { overflow: hidden; }

@media (max-width: 720px) {
  body.dq8-page {
    font-size: 16px !important;
  }

  #container {
    width: calc(100% - 12px) !important;
    margin-top: 10px !important;
    margin-bottom: 28px !important;
  }

  #main #box,
  #main #box1,
  #main #box2,
  #main #box3,
  #main #box4 {
    width: 100% !important;
  }

  .table-scroll {
    position: relative;
    max-width: 100%;
    border: 1px solid var(--dq8-border);
    border-radius: 10px;
    background: #fff;
    scrollbar-width: thin;
    scrollbar-color: #8290a5 #e8ecf2;
  }
  .table-scroll::-webkit-scrollbar { height: 10px; }
  .table-scroll::-webkit-scrollbar-track { background: #e8ecf2; }
  .table-scroll::-webkit-scrollbar-thumb { background: #8290a5; border: 2px solid #e8ecf2; border-radius: 999px; }

  .table-scroll > table.dq8-wide-table,
  .table-scroll > table.dq8-medium-table {
    width: var(--dq8-table-min-width, 760px) !important;
    min-width: var(--dq8-table-min-width, 760px) !important;
    table-layout: auto !important;
  }
  .table-scroll > table.dq8-equipment-table { --dq8-table-min-width: 960px; }
  .table-scroll > table.dq8-skill-table { --dq8-table-min-width: 900px; }
  .table-scroll > table.dq8-monster-table { --dq8-table-min-width: 760px; }
  .table-scroll > table.dq8-photo-table { --dq8-table-min-width: 780px; }

  .dq8-wide-table th,
  .dq8-wide-table td,
  .dq8-medium-table th,
  .dq8-medium-table td {
    overflow-wrap: normal !important;
    word-break: normal !important;
    line-break: strict;
    font-size: .88rem !important;
  }
  .dq8-equipment-table th:nth-child(n+4):nth-child(-n+11),
  .dq8-equipment-table td:nth-child(n+4):nth-child(-n+11),
  .dq8-skill-table th:nth-child(n+3):nth-child(-n+8),
  .dq8-skill-table td:nth-child(n+3):nth-child(-n+8) {
    width: 56px;
    min-width: 56px;
    white-space: nowrap;
    text-align: center;
  }
  .dq8-equipment-table th:first-child,
  .dq8-equipment-table td:first-child,
  .dq8-skill-table th:nth-child(2),
  .dq8-skill-table td:nth-child(2),
  .dq8-monster-table th:nth-child(2),
  .dq8-monster-table td:nth-child(2) {
    min-width: 145px;
  }
  .dq8-equipment-table th:last-child,
  .dq8-equipment-table td:last-child,
  .dq8-skill-table th:last-child,
  .dq8-skill-table td:last-child {
    min-width: 230px;
  }

  .dq8-scroll-hint {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 2px 6px;
    color: #58657a;
    font-size: .78rem;
    font-weight: 700;
  }
  .dq8-scroll-hint span {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 22px;
    border-radius: 999px;
    color: #fff;
    background: #53647d;
  }

  .table-scroll.has-mobile-cards:not(.is-mobile-table-visible) {
    display: none !important;
  }
  .table-scroll.has-mobile-cards.is-mobile-table-visible {
    display: block !important;
    margin-top: 8px;
  }

  .dq8-mobile-view-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0 12px;
    padding: 9px 10px;
    border: 1px solid #d7dce5;
    border-radius: 10px;
    background: #f7f9fc;
  }
  .dq8-mobile-view-controls__note {
    color: #59667a;
    font-size: .76rem;
    line-height: 1.35;
  }
  .dq8-mobile-view-toggle {
    flex: 0 0 auto;
    min-height: 36px !important;
    padding: 7px 10px !important;
    border: 1px solid #9ba8ba !important;
    border-radius: 8px !important;
    color: #17345f !important;
    background: #fff !important;
    font-size: .76rem;
    white-space: nowrap;
  }

  .dq8-mobile-cards {
    display: block;
    margin: 0 0 18px;
  }
  .dq8-mobile-cards.is-mobile-hidden { display: none !important; }
  .dq8-card-list {
    display: grid;
    gap: 12px;
  }

  .dq8-data-card {
    overflow: hidden;
    border: 1px solid #cfd6e1;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(23, 32, 51, .07);
  }
  .dq8-data-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 13px 14px;
    border-bottom: 1px solid #dce1e9;
    background: linear-gradient(180deg, #fff, #f5f7fa);
  }
  .dq8-data-card__title {
    flex: 1 1 170px;
    min-width: 0;
    margin: 0 !important;
    color: #17345f;
    font-size: 1.08rem !important;
    line-height: 1.5 !important;
  }
  .dq8-data-card__title a {
    display: inline;
    padding: 1px 0 !important;
  }
  .dq8-data-card__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
  }

  .dq8-pill,
  .dq8-source-chip,
  .dq8-photo-number {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
  }
  .dq8-pill--neutral { color: #374151; background: #e8ecf2; border-color: #cfd6e1; }
  .dq8-pill--stat { color: #8b2635; background: #fff0f2; border-color: #efc4cb; }
  .dq8-pill--skill { color: #1c4e37; background: #e9f6ef; border-color: #bcdcc9; }
  .dq8-pill--monster { color: #4a3c74; background: #efecff; border-color: #d3ccf3; }
  .dq8-pill--id { color: #46536a; background: #f0f3f7; border-color: #d7dde6; }

  .dq8-card-section {
    padding: 11px 14px;
    border-bottom: 1px solid #e2e6ed;
  }
  .dq8-card-section__title {
    margin: 0 0 7px !important;
    color: #536076;
    font-size: .76rem !important;
    letter-spacing: .04em;
  }
  .dq8-card-badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .dq8-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 31px;
    padding: 4px 8px;
    border: 1px solid #d2d9e4;
    border-radius: 8px;
    color: #374151;
    background: #f7f9fb;
    font-size: .74rem;
  }
  .dq8-card-badge__mark { color: #255b9a; font-size: 1rem; line-height: 1; }
  .dq8-card-badge.is-partial .dq8-card-badge__mark { color: #9a6b11; }
  .dq8-card-badge.is-no .dq8-card-badge__mark { color: #b52c42; }

  .dq8-card-source-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px 0;
  }
  .dq8-source-chip.is-alchemy { color: #16613d; background: #ebf8f0; border-color: #bce1cb; }
  .dq8-source-chip.is-shop { color: #735211; background: #fff7df; border-color: #ead69c; }

  .dq8-card-field {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    border-top: 1px solid #e2e6ed;
  }
  .dq8-card-source-row + .dq8-card-field { margin-top: 10px; }
  .dq8-card-field__label {
    padding: 11px 10px;
    color: #4f5b6e;
    background: #f1f4f8;
    font-size: .76rem;
    font-weight: 800;
  }
  .dq8-card-field__value {
    min-width: 0;
    padding: 11px 12px;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.75;
  }
  .dq8-card-field--effect .dq8-card-field__value,
  .dq8-card-field--description .dq8-card-field__value {
    font-size: .94rem;
  }

  .dq8-card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid #e2e6ed;
  }
  .dq8-card-metric {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    padding: 10px;
  }
  .dq8-card-metric + .dq8-card-metric { border-left: 1px solid #e2e6ed; }
  .dq8-card-metric span { color: #68758a; font-size: .7rem; font-weight: 800; }
  .dq8-card-metric strong { color: #18263b; font-size: 1.03rem; font-variant-numeric: tabular-nums; }

  .dq8-photo-card {
    display: block;
  }
  .dq8-photo-card__image-button {
    position: relative;
    display: block;
    width: 100%;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
    background: #172033 !important;
    cursor: zoom-in;
  }
  .dq8-photo-card__image {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-height: 340px;
    object-fit: contain;
    margin: 0 auto;
    background: #101827;
  }
  .dq8-photo-card__zoom-label {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    color: #fff;
    background: rgba(8, 18, 34, .82);
    font-size: .7rem;
    font-weight: 800;
  }
  .dq8-photo-card__body .dq8-data-card__header {
    justify-content: flex-start;
  }
  .dq8-photo-number {
    flex: 0 0 auto;
    color: #fff;
    background: #283a55;
    border-color: #283a55;
  }
  .dq8-photo-card__body .dq8-data-card__title {
    flex-basis: 220px;
  }

  .dq8-mobile-skill-section {
    overflow: hidden;
    border: 1px solid #cfd6e1;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(23, 32, 51, .06);
  }
  .dq8-mobile-skill-section__title {
    margin: 0 !important;
    padding: 12px 14px;
    color: #fff !important;
    background: #283445;
    font-size: 1rem !important;
    text-align: center;
  }
  .dq8-character-skill-cards { display: grid; }
  .dq8-character-skill-card + .dq8-character-skill-card { border-top: 1px solid #dce1e9; }
  .dq8-character-skill-card__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 11px 12px 7px;
  }
  .dq8-character-skill-card__level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    min-height: 30px;
    padding: 4px 7px;
    border-radius: 8px;
    color: #8b2635;
    background: #fff0f2;
    font-size: .76rem;
    font-weight: 800;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .dq8-character-skill-card__name {
    min-width: 0;
    margin: 0 !important;
    color: #17345f;
    font-size: 1rem !important;
  }
  .dq8-character-skill-card__mp {
    padding: 3px 7px;
    border-radius: 999px;
    color: #43536a;
    background: #edf1f6;
    font-size: .7rem;
    font-weight: 800;
    white-space: nowrap;
  }
  .dq8-character-skill-card__description {
    padding: 0 12px 12px;
    color: #303b4d;
    font-size: .92rem;
    line-height: 1.75;
  }

  /* Photo images remain useful even if JavaScript is unavailable. */
  .page-data img[src*="/phot/"] {
    width: min(72vw, 300px) !important;
    max-width: none !important;
    height: auto !important;
  }

  /* Keep the page-top button above common mobile anchor-ad heights. */
  .back-to-top {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .dq8-mobile-view-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .dq8-mobile-view-toggle { width: 100%; }
  .dq8-card-field { grid-template-columns: 82px minmax(0, 1fr); }
  .dq8-data-card__header { padding: 12px; }
  .dq8-character-skill-card__header { grid-template-columns: auto minmax(0, 1fr); }
  .dq8-character-skill-card__mp { grid-column: 2; justify-self: start; }
}

/* 2026-08-02g: keep the smartphone top page free of artificial table scrolling. */
@media (max-width: 900px) {
  .page-home .table-scroll {
    overflow-x: visible !important;
    overflow-y: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    scrollbar-width: none;
  }
  .page-home .table-scroll::-webkit-scrollbar { display: none; }
  .page-home .table-scroll > table,
  .page-home table.dq8-wide-table,
  .page-home table.dq8-medium-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }
  .page-home .dq8-scroll-hint { display: none !important; }
}
