/* ============ VNDB INFO — modern dark theme ============ */
:root {
  --bg: #0b0d14;
  --bg2: #10131d;
  --card: #161a27;
  --card2: #1c2133;
  --line: #262c40;
  --text: #e8eaf2;
  --muted: #8b93ad;
  --dim: #5a617a;
  --accent: #8b7cf8;
  --accent2: #4fd1e0;
  --pink: #f472b6;
  --gold: #fbbf24;
  --grad: linear-gradient(135deg, #8b7cf8, #4fd1e0);
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scrollbar-color: #333a55 var(--bg); }
body {
  background: var(--bg); color: var(--text);
  font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Hiragino Kaku Gothic ProN", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans CJK JP", system-ui, sans-serif;
  font-size: 15px; line-height: 1.55;
  min-height: 100vh;
}
body::before {  /* ambient glow */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 400px at 85% -5%, rgba(139,124,248,.13), transparent 60%),
    radial-gradient(500px 350px at -5% 20%, rgba(79,209,224,.08), transparent 60%);
}
a { color: var(--accent2); text-decoration: none; }
button { font-family: inherit; }
img { display: block; }

/* ---------- navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 24px;
  background: rgba(11,13,20,.75); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: baseline; gap: 8px; cursor: pointer; user-select: none; }
.logo b {
  font-size: 20px; font-weight: 800; letter-spacing: .5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo span { color: var(--dim); font-size: 12px; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--muted); padding: 7px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: .18s;
}
.nav-links a:hover { color: var(--text); background: var(--card2); }
.nav-links a.on { color: var(--text); background: var(--card2); box-shadow: inset 0 -2px 0 var(--accent); }
.nav-sp { flex: 1; }

/* search */
.searchbox { position: relative; width: min(320px, 34vw); }
.searchbox input {
  width: 100%; padding: 8px 14px 8px 36px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font-size: 14px; outline: none; transition: .2s;
}
.searchbox input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,124,248,.18); }
.searchbox .icon { position: absolute; left: 12px; top: 8px; color: var(--dim); pointer-events: none; }
.search-drop {
  position: absolute; top: 44px; left: 0; right: 0; max-height: 62vh; overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: none;
}
.search-drop.show { display: block; }
.search-item { display: flex; gap: 10px; padding: 8px 12px; cursor: pointer; align-items: center; }
.search-item:hover { background: var(--card2); }
.search-item img { width: 34px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--bg2); }
.search-item .t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .s { font-size: 11.5px; color: var(--muted); }

/* language switcher */
.lang-sw { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang-sw button {
  border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; transition: .15s;
}
.lang-sw button:hover { color: var(--text); }
.lang-sw button.on { background: rgba(139,124,248,.2); color: #c9c2fd; }

/* nsfw toggle */
.toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.toggle .tk {
  width: 36px; height: 20px; border-radius: 999px; background: var(--card2);
  border: 1px solid var(--line); position: relative; transition: .2s;
}
.toggle .tk::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--dim); transition: .2s;
}
.toggle.on .tk { background: rgba(244,114,182,.25); border-color: var(--pink); }
.toggle.on .tk::after { left: 18px; background: var(--pink); }
.toggle.on { color: var(--pink); }

#view { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ---------- page head ---------- */
.page-head { margin: 6px 0 20px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.page-head h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ---------- filter bar ---------- */
.filters {
  position: sticky; top: 58px; z-index: 50;
  display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: flex-end;
  background: rgba(16,19,29,.85); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.f-group { display: flex; flex-direction: column; gap: 6px; }
.f-group > label { font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.f-row { display: flex; gap: 6px; align-items: center; }
select, .num {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 10px; font-size: 13.5px; outline: none;
}
select:focus, .num:focus { border-color: var(--accent); }
.num { width: 76px; }
.chip {
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.on { background: rgba(139,124,248,.16); border-color: var(--accent); color: #c9c2fd; }
.f-stat { margin-left: auto; color: var(--dim); font-size: 12.5px; align-self: center; }
.f-stat b { color: var(--accent2); font-weight: 700; }

/* ---------- ranking rows ---------- */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row {
  display: grid; grid-template-columns: 64px 68px 1fr 270px; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 18px 10px 10px; cursor: pointer; transition: .18s;
  content-visibility: auto; contain-intrinsic-size: 118px;
}
.rank-row:hover { transform: translateY(-2px); border-color: #3a4260; box-shadow: var(--shadow); background: var(--card2); }
.rank-no { font-size: 22px; font-weight: 800; color: var(--dim); text-align: center; font-variant-numeric: tabular-nums; }
.rank-row:nth-child(1) .rank-no, .rank-no.top1 { color: var(--gold); }
.rank-no.top { color: #c9c2fd; }
.rank-cover { width: 68px; height: 96px; border-radius: 9px; overflow: hidden; background: var(--bg2); position: relative; }
.rank-cover img { width: 100%; height: 100%; object-fit: cover; }
.rank-main { min-width: 0; }
.rank-title { font-size: 16.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-latin { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.badges { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--bg2); color: var(--muted); border: 1px solid var(--line);
}
.badge.y { color: var(--accent2); border-color: rgba(79,209,224,.35); }
.rank-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { text-align: center; }
.stat .v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .v.hl { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .k { font-size: 10.5px; color: var(--dim); font-weight: 700; letter-spacing: .5px; margin-top: 1px; }
.stat .bar { height: 3px; border-radius: 2px; background: var(--bg2); margin-top: 5px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--grad); border-radius: 2px; }

.sentinel { height: 10px; }
.loading-hint { text-align: center; color: var(--dim); padding: 24px; font-size: 13px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* nsfw blur */
.blur img, img.blur { filter: blur(18px) saturate(.7); transform: scale(1.1); }
.nsfw-tag {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: rgba(244,114,182,.9); letter-spacing: 1px; z-index: 2;
}

/* ---------- detail page ---------- */
.hero { position: relative; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 22px; }
.hero-bg {
  position: absolute; inset: -40px; background-size: cover; background-position: center 25%;
  filter: blur(42px) saturate(1.3) brightness(.55); opacity: .55; transform: scale(1.15);
}
.hero-in { position: relative; display: flex; gap: 28px; padding: 30px; background: linear-gradient(180deg, rgba(11,13,20,.25), rgba(11,13,20,.82)); }
.hero-cover { flex: 0 0 auto; width: 220px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); position: relative; background: var(--bg2); }
.hero-cover img { width: 100%; height: auto; }
.hero-info { min-width: 0; flex: 1; }
.hero-info h1 { font-size: 28px; font-weight: 800; line-height: 1.25; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.hero-info .latin { color: #b9c0d8; font-size: 15px; margin-top: 3px; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.hero-meta .badge { background: rgba(22,26,39,.7); font-size: 12px; padding: 4px 12px; }
.score-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.score-card {
  background: rgba(22,26,39,.72); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; text-align: center; min-width: 92px;
}
.score-card .v { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score-card .v.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.score-card .k { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 1px; }
.hero-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 0; cursor: pointer; border-radius: 11px; padding: 9px 18px;
  font-size: 13.5px; font-weight: 700; transition: .18s; color: var(--text); background: var(--card2);
  border: 1px solid var(--line);
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn.primary { background: var(--grad); color: #0b0d14; border: 0; }
.btn.primary:hover { box-shadow: 0 4px 20px rgba(139,124,248,.4); }

.section { margin: 26px 0; }
.section > h2 { font-size: 17px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.section > h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--grad); }
.section > h2 .cnt { color: var(--dim); font-size: 12.5px; font-weight: 600; }
.desc { color: #c3c9dd; font-size: 14.5px; max-width: 900px; white-space: pre-line; }
.desc .more { color: var(--accent2); cursor: pointer; font-weight: 600; }

/* tags */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12.5px; padding: 4px 12px; border-radius: 999px; cursor: pointer; display: inline-block;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); transition: .15s;
}
.tag b { color: var(--text); font-weight: 600; }
.tag .sc { font-size: 10.5px; opacity: .75; margin-left: 4px; }
.tag.cont { border-color: rgba(139,124,248,.4); } .tag.cont b { color: #c9c2fd; }
.tag.tech { border-color: rgba(79,209,224,.35); } .tag.tech b { color: #9fe8f2; }
.tag.ero  { border-color: rgba(244,114,182,.4); } .tag.ero b { color: #f9a8d4; }
.tag:hover { transform: translateY(-1px); border-color: var(--accent); background: var(--card2); }
.tag .en { font-size: 10.5px; color: var(--dim); margin-left: 5px; }
.spoil-note { font-size: 12px; color: var(--dim); cursor: pointer; margin-top: 8px; }
.spoil-note:hover { color: var(--pink); }

/* media gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.shot {
  position: relative; border-radius: 12px; overflow: hidden; cursor: zoom-in;
  background: var(--bg2); border: 1px solid var(--line); transition: .2s;
  content-visibility: auto;
}
.shot:hover { transform: scale(1.025); border-color: var(--accent); box-shadow: var(--shadow); z-index: 2; }
.shot img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: var(--ar, 4/3); }
.shot .dim { position: absolute; right: 8px; bottom: 6px; font-size: 10.5px; color: rgba(255,255,255,.75); background: rgba(0,0,0,.45); padding: 1px 7px; border-radius: 999px; backdrop-filter: blur(4px); }

/* characters */
.char-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.char-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  transition: .18s; cursor: zoom-in;
}
.char-card:hover { transform: translateY(-3px); border-color: #3a4260; box-shadow: var(--shadow); }
.char-card .im { position: relative; aspect-ratio: 3/4; background: var(--bg2); overflow: hidden; }
.char-card .im img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.char-card .nm { padding: 8px 10px 3px; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card .cv { padding: 0 10px 8px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card .role { position: absolute; left: 8px; top: 8px; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); color: #c9c2fd; z-index: 2; }

/* staff / producers / quotes */
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 13px; font-size: 13px; color: var(--text); display: inline-block; transition: .15s; }
a.pill:hover { border-color: var(--accent); background: var(--card2); transform: translateY(-1px); }
.pill .sub { color: var(--muted); font-size: 11px; margin-left: 6px; }
.pill .r { color: var(--dim); font-size: 11px; margin-left: 6px; }
.quote { border-left: 3px solid var(--accent); padding: 4px 14px; margin-bottom: 10px; color: #c3c9dd; font-style: italic; }
.quote .by { color: var(--dim); font-size: 12px; font-style: normal; margin-top: 2px; }
.links a { margin-right: 14px; font-size: 13px; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: rgba(5,6,10,.92); backdrop-filter: blur(10px);
  align-items: center; justify-content: center; flex-direction: column;
}
.lightbox.show { display: flex; }
.lb-media { max-width: 92vw; max-height: 84vh; display: flex; align-items: center; justify-content: center; }
.lb-media img, .lb-media video { max-width: 92vw; max-height: 84vh; border-radius: 8px; box-shadow: 0 12px 60px rgba(0,0,0,.7); }
.lb-media audio { width: min(600px, 90vw); }
.lb-bar { margin-top: 14px; display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 13px; }
.lb-btn { background: var(--card); border: 1px solid var(--line); color: var(--text); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 16px; transition: .15s; }
.lb-btn:hover { border-color: var(--accent); background: var(--card2); }
.lb-x { position: absolute; top: 18px; right: 22px; }

/* ---------- graph page ---------- */
.graph-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: calc(100vh - 150px); min-height: 560px; }
.graph-side { display: flex; flex-direction: column; gap: 12px; overflow: auto; padding-right: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.panel h3 { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.graph-canvas-wrap { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#graph-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
#graph-canvas.dragging { cursor: grabbing; }
.graph-tip {
  position: absolute; pointer-events: none; z-index: 10; display: none;
  background: rgba(16,19,29,.95); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 12.5px; box-shadow: var(--shadow); max-width: 260px;
}
.graph-tip b { display: block; font-size: 13px; }
.graph-tip .s { color: var(--muted); font-size: 11.5px; }
.graph-hint { position: absolute; left: 12px; bottom: 10px; color: var(--dim); font-size: 11.5px; pointer-events: none; }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--muted); }
.legend .li { display: flex; align-items: center; gap: 9px; }
.legend .sw { width: 22px; height: 4px; border-radius: 2px; }
.sim-bars { display: flex; flex-direction: column; gap: 8px; }
.sim-bar .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.sim-bar .tr { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.sim-bar .tr i { display: block; height: 100%; border-radius: 3px; }
.node-info .ni-head { display: flex; gap: 12px; margin-bottom: 12px; }
.node-info .ni-head img { width: 58px; height: 82px; object-fit: cover; border-radius: 8px; background: var(--bg2); }
.node-info .ni-title { font-size: 14px; font-weight: 700; line-height: 1.3; }
.node-info .ni-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.shared-list { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.shared-list b { color: var(--text); font-weight: 600; }
.shared-list .row { margin-bottom: 5px; }
.mini-btns { display: flex; gap: 8px; margin-top: 12px; }
.mini-btns .btn { padding: 6px 12px; font-size: 12.5px; flex: 1; }

.seed-picker { max-width: 720px; margin: 40px auto; text-align: center; }
.seed-picker h2 { font-size: 22px; margin-bottom: 8px; }
.seed-picker p { color: var(--muted); margin-bottom: 20px; }
.seed-input { position: relative; }
.seed-input input {
  width: 100%; padding: 13px 22px; font-size: 15px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--text); outline: none;
}
.seed-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139,124,248,.15); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 26px; }
.preset {
  cursor: pointer; border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  background: var(--card); transition: .18s; position: relative;
}
.preset:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.preset img { width: 100%; aspect-ratio: 3/4.2; object-fit: cover; }
.preset .t { font-size: 11.5px; padding: 7px 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.err-box { text-align: center; padding: 80px 20px; color: var(--muted); }

/* entity (tag / producer / staff) listing head */
.ent-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ent-kind { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent2); border: 1px solid rgba(79,209,224,.35); padding: 3px 10px; border-radius: 999px; }
.hero-info .otitle { color: #b9c0d8; font-size: 15px; margin-top: 3px; }
.hero-info .latin { color: var(--muted); font-size: 13px; margin-top: 1px; }

@media (max-width: 900px) {
  .rank-row { grid-template-columns: 40px 56px 1fr; }
  .rank-stats { display: none; }
  .graph-wrap { grid-template-columns: 1fr; height: auto; }
  .graph-canvas-wrap { height: 60vh; }
  .hero-in { flex-direction: column; }
  .hero-cover { width: 160px; }
  .searchbox { width: 40vw; }
  .nav { flex-wrap: wrap; gap: 10px; }
}
