:root {
  --ink: #17191e; --sub: #5d636e; --line: #e3e6ea; --bg: #fff; --soft: #f5f6f8; --red: #e0102f; --red-ink: #b80b25;
  --LR: #17191e; --UR: #d4142f; --SSR: #8a6508; --SR: #128578; --R: #2a78c2; --N: #7d8590;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.75; -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; }
a { color: var(--red-ink); text-underline-offset: 3px; }
a:hover { color: var(--red); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.4; letter-spacing: 0; }
h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 0 0 .4rem; }
h2 { font-size: 1.35rem; margin: 2.6rem 0 .8rem; padding-top: .2rem; }
h3 { font-size: 1.08rem; margin: 1.6rem 0 .5rem; }
p { margin: .5rem 0 .9rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.prose { max-width: 760px; }

/* header */
.top { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 18px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); text-decoration: none; white-space: nowrap; font-size: 1.02rem; }
.brand i { width: 18px; height: 24px; border-radius: 4px; background: var(--red); transform: rotate(-10deg); display: inline-block; }
.brand small { font-weight: 600; color: var(--sub); font-size: .8rem; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .92rem; white-space: nowrap; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current] { color: var(--red-ink); font-weight: 700; }
@media (max-width: 760px) {
  .top .wrap { flex-wrap: wrap; gap: 0; padding-top: 8px; }
  .nav { width: 100%; margin: 0 -10px; padding-bottom: 4px; }
}

main { padding: 26px 0 60px; }
.lead { color: var(--sub); max-width: 760px; }
.updated { color: var(--sub); font-size: .85rem; }
.crumbs { font-size: .85rem; color: var(--sub); margin-bottom: 8px; }
.crumbs a { color: var(--sub); }

/* rarity badge (colours follow the game's rank colours; SR uses teal, not the game's blue-red hue) */
.rk { display: inline-block; min-width: 2.6em; text-align: center; font-weight: 800; font-size: .74rem; line-height: 1.5; padding: 0 .4em; border-radius: 4px; color: #fff; vertical-align: 1px; }
.rk-LR { background: var(--LR); color: #f6c945; } .rk-UR { background: var(--UR); } .rk-SSR { background: var(--SSR); } .rk-SR { background: var(--SR); } .rk-R { background: var(--R); } .rk-N { background: var(--N); }

/* search tool */
.tool { border: 1px solid var(--line); border-radius: 10px; padding: 18px; background: #fff; }
.tool-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tool-head h2 { margin: 0; font-size: 1.15rem; }
.search { display: flex; margin: 12px 0 8px; }
.search input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 12px 14px; border: 2px solid var(--ink); border-right: 0; border-radius: 8px 0 0 8px; outline: none; }
.search input:focus { border-color: var(--red); }
.search button { font: inherit; font-weight: 700; padding: 0 20px; border: 0; background: var(--ink); color: #fff; border-radius: 0 8px 8px 0; cursor: pointer; }
.search button:hover { background: #000; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: .86rem; color: var(--sub); align-items: center; }
.chips button { font: inherit; font-size: .86rem; border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 2px 11px; cursor: pointer; color: var(--ink); }
.chips button:hover { border-color: var(--ink); }
.hits { margin-top: 12px; }
.hit-list { list-style: none; padding: 0; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.hit-list li + li { border-top: 1px solid var(--line); }
.hit-list button { all: unset; box-sizing: border-box; display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 12px; cursor: pointer; }
.hit-list button:hover, .hit-list button[aria-selected="true"] { background: var(--soft); }
.hit-list .nm { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-list .sb { color: var(--sub); font-size: .85rem; white-space: nowrap; }
.av { width: 40px; height: 40px; border-radius: 50%; background: var(--soft); object-fit: cover; flex: none; }
.av.lg { width: 72px; height: 72px; }

.card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px 16px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.card h3 { margin: 0; font-size: 1.15rem; }
.card .meta { color: var(--sub); font-size: .9rem; }
.card .facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.fact { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.fact b { display: block; font-size: 1.15rem; }
.fact span { color: var(--sub); font-size: .8rem; }
.card .more { grid-column: 1 / -1; font-size: .92rem; }
.note { color: var(--sub); font-size: .86rem; }

/* tables */
.tbl-wrap { overflow-x: auto; margin: .6rem 0 1.2rem; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { font-size: .82rem; color: var(--sub); font-weight: 700; background: var(--soft); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.hl td { background: #fff5f6; }

/* people grid (LR/UR, set members) */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; list-style: none; padding: 0; margin: .6rem 0 1rem; }
.people li { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; }
.people .t { min-width: 0; }
.people .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .94rem; }
.people .t span { color: var(--sub); font-size: .8rem; }

/* sets */
.set { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.set h3 { margin: 0 0 2px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.set h3 small { color: var(--sub); font-weight: 400; font-size: .85rem; }
.set .people { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* achievements */
.ach { list-style: none; padding: 0; margin: .4rem 0 1.4rem; }
.ach li { border-top: 1px solid var(--line); padding: 12px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; }
.ach .nm { font-weight: 800; }
.ach .cond { color: var(--ink); }
.ach .how { grid-column: 1 / -1; color: var(--sub); font-size: .92rem; }
.ach .pt { font-weight: 700; color: var(--red-ink); white-space: nowrap; }
.ach li.locked .nm { color: var(--sub); }

/* page links with real screenshots */
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 1rem 0; }
.links a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--ink); text-decoration: none; background: #fff; }
.links a:hover { border-color: var(--ink); }
.links img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; background: var(--soft); border-bottom: 1px solid var(--line); }
.links .faces { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; aspect-ratio: 16 / 9; align-content: center; justify-content: center; background: var(--soft); border-bottom: 1px solid var(--line); overflow: hidden; }
.links .faces img { width: 44px; height: 44px; aspect-ratio: auto; border-radius: 50%; border: 0; }
.links b { display: block; padding: 10px 14px 0; }
.links span { display: block; padding: 0 14px 12px; color: var(--sub); font-size: .88rem; }

/* diagnosis + paywall */
.diag textarea { width: 100%; min-height: 92px; font: .9rem/1.5 ui-monospace, Menlo, Consolas, monospace; padding: 10px; border: 2px solid var(--ink); border-radius: 8px; resize: vertical; }
.diag textarea:focus { outline: none; border-color: var(--red); }
.btn { display: inline-block; font: inherit; font-weight: 800; border: 0; border-radius: 8px; padding: 11px 22px; cursor: pointer; background: var(--ink); color: #fff; text-decoration: none; }
.btn:hover { background: #000; color: #fff; }
.btn.red { background: var(--red); }
.btn.red:hover { background: var(--red-ink); }
.btn:disabled { opacity: .55; cursor: wait; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.err { color: var(--red-ink); font-weight: 700; }
.sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 14px 0; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--red); }
.wall { border: 2px solid var(--ink); border-radius: 10px; padding: 18px; margin: 16px 0; background: #fff; }
.wall h3 { margin-top: 0; }
.wall ul { margin: .4rem 0 1rem; padding-left: 1.2em; }
.wall .price { font-size: 1.6rem; font-weight: 800; }
.restore { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; font-size: .9rem; }
.restore input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; width: min(260px, 100%); }
.restore button { font: inherit; padding: 6px 12px; border: 1px solid var(--ink); background: #fff; border-radius: 6px; cursor: pointer; }
.shot { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 20px; align-items: start; }
.shot figure { margin: 0; }
.shot img { border: 1px solid var(--line); border-radius: 10px; }
.shot figcaption { font-size: .8rem; color: var(--sub); }
@media (max-width: 700px) { .shot { grid-template-columns: 1fr; } .shot figure { max-width: 240px; } }

.foot { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--sub); font-size: .85rem; background: var(--soft); }
.foot a { color: var(--sub); }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 10px; }
@media (max-width: 560px) {
  .set .people, .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .people li { padding: 6px 8px; gap: 8px; }
  .people .av { width: 32px; height: 32px; }
  .card { grid-template-columns: 56px minmax(0, 1fr); padding: 12px; }
  .card .av.lg { width: 56px; height: 56px; }
  .card .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* rewrite additions */
.next { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 0; }
.next a { display: block; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 8px; padding: 10px 14px; color: var(--ink); text-decoration: none; background: #fff; }
.next a:hover { border-color: var(--ink); border-left-color: var(--red); }
.next b { display: block; }
.next span { display: block; color: var(--sub); font-size: .86rem; line-height: 1.5; }
@media (max-width: 760px) { .next { grid-template-columns: 1fr; gap: 6px; } .next a { padding: 8px 12px; } }
.callout { border-left: 4px solid var(--red); background: #fff5f6; padding: 10px 14px; border-radius: 0 8px 8px 0; }
.q { color: var(--sub); font-weight: 800; letter-spacing: .1em; }
@media (min-width: 900px) { .ach.cols { columns: 2; column-gap: 36px; } .ach.cols li { break-inside: avoid; } }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.toc a { border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; color: var(--ink); text-decoration: none; font-size: .9rem; background: var(--soft); }
.toc a:hover { border-color: var(--ink); }
.toc small { color: var(--sub); margin-left: 6px; }
.toc-sets:empty { display: none; }
.people.own li { padding: 0; }
.people.own label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; width: 100%; min-width: 0; cursor: pointer; }
.people.own input { accent-color: var(--SR); width: 18px; height: 18px; flex: none; margin: 0; }
.people.own li:has(input:checked) { background: #eef7f6; border-color: #9cd0ca; }
.set .left { margin-left: auto; font-size: .88rem; font-weight: 700; color: var(--red-ink); }
.set.done .left { color: var(--SR); }
.calc { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.calc input { font: inherit; width: 9em; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 6px; }
.calc .btn { padding: 7px 16px; }
@media (max-width: 560px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: none; }
  .people.own label { padding: 6px 8px; gap: 6px; }
  .people.own input { width: 16px; height: 16px; }
}
.chips > span { flex: none; }
.hid-t td:nth-child(1), .hid-t td:nth-child(2) { white-space: nowrap; }
@media (max-width: 560px) {
  [data-search] .tool-head .note { display: none; }
  .hid-t td:nth-child(2) { white-space: normal; }
}
@media (max-width: 560px) {
  .hid-t thead { display: none; }
  .hid-t tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .hid-t td { border: 0; padding: 2px 6px; }
  .hid-t td:nth-child(2) { display: none; }
  .hid-t td:nth-child(4) { grid-column: 1 / -1; color: var(--sub); font-size: .9rem; }
}
.ach li .calc { grid-column: 1 / -1; }
.wall .what { padding-left: 1.2em; }
.wall .also { font-size: .9rem; color: var(--sub); margin-top: 0; }
@media (max-width: 560px) { [data-out] .people { grid-template-columns: minmax(0, 1fr); } }
.av.sm { width: 28px; height: 28px; }
.dset td { vertical-align: top; }
.dset .who { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; line-height: 1.45; }
.dset .who + .who { border-top: 1px dashed var(--line); }
.dset td.gain { color: var(--SR); font-weight: 700; }
.people .t span.rk, .dset .rk { color: #fff; }
.people .t span.rk-LR, .dset .rk-LR { color: #f6c945; }
details summary { cursor: pointer; font-weight: 700; margin: 1rem 0 .4rem; }
h4 { margin: 1.2rem 0 .3rem; font-size: 1rem; }
@media (max-width: 560px) {
  .dset thead { display: none; }
  .dset tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .dset td { border: 0; padding: 2px 6px; }
  .dset td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
.people.own .t { display: block; min-width: 0; }
.people.own .t { flex: 1 1 auto; overflow: hidden; }
.btn { white-space: nowrap; }
@media (max-width: 380px) { .card .row .btn { padding: 10px 14px; font-size: .9rem; } }
.people.own { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.people.own .t b { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.4; }
.people.own .t > span { display: block; line-height: 1.5; }
@media (max-width: 560px) { .people.own { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
