/* 聖杯が満ちる夜 攻略DB — white reference-book layout; crimson = Command Seal, gold hairlines = the Grail. */
:root {
  --ink: #1c1b1a;
  --ink2: #55524d;
  --mute: #6c6861;
  --line: #e3e0da;
  --soft: #f6f5f2;
  --seal: #a3162e;
  --seal-d: #7d0f22;
  --gold: #8a6a1f;
  --ok: #2f6b3a;
  --r: 6px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: #fff; font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; line-height: 1.75; }
a { color: var(--seal); text-underline-offset: 3px; }
a:hover { color: var(--seal-d); }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.75rem; line-height: 1.35; margin: 0 0 .6rem; letter-spacing: .01em; }
h2 { font-size: 1.3rem; line-height: 1.4; margin: 2.4rem 0 .8rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
h2 small, h1 small { color: var(--mute); font-weight: 400; font-size: .8em; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; }
p { margin: 0 0 1rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.prose { max-width: 780px; }
.fine { color: var(--ink2); font-size: .875rem; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* header */
.top { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; white-space: nowrap; min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; }
.langs { flex: none; }
.brand img { display: block; }
.langs { display: flex; gap: 2px; font-size: .8125rem; }
.langs a { white-space: nowrap; color: var(--ink2); text-decoration: none; padding: 4px 8px; border-radius: 4px; }
.langs a[aria-current] { color: var(--ink); background: var(--soft); font-weight: 600; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; color: var(--ink2); text-decoration: none; font-size: .875rem; padding: 6px 10px; border-radius: 4px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a[aria-current] { color: var(--seal); box-shadow: inset 0 -2px 0 var(--seal); border-radius: 0; }
.crumbs { font-size: .8125rem; color: var(--mute); padding-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--ink2); text-decoration: none; }
main { padding: 18px 0 48px; }

/* intro + calculator */
.intro { max-width: 820px; padding-top: 8px; }
.intro p { color: var(--ink2); }
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r); margin: 18px 0 8px; }
.calc > * { padding: 18px 20px; }
.calc-in { border-right: 1px solid var(--line); }
.calc-out { min-width: 0; }
.target { grid-column: 1 / -1; border-top: 1px solid var(--line); background: var(--soft); border-radius: 0 0 var(--r) var(--r); }
.calc .wall { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.calc-h { font-weight: 700; margin: 0 0 .7rem; display: flex; align-items: center; gap: 8px; }
.calc-h::before { content: ""; width: 3px; height: 1em; background: var(--seal); border-radius: 2px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.presets button, .go, .buy, .restore button, .cta { font: inherit; cursor: pointer; transition: transform .08s, background .15s, border-color .15s; }
.presets button { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 5px 12px; border-radius: 999px; font-size: .875rem; }
.presets button:hover { border-color: var(--ink2); }
.presets button[aria-pressed="true"] { border-color: var(--seal); color: var(--seal); font-weight: 600; }
button:active, .cta:active { transform: scale(.97); }
.sl { display: grid; grid-template-columns: 6.5em minmax(0, 1fr) 2.6em; align-items: center; gap: 10px; margin: 10px 0; }
.sl label { font-weight: 600; font-size: .9375rem; }
.sl output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
input[type=range] { width: 100%; accent-color: var(--seal); height: 28px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 6px; font-size: .9375rem; }
.checks input { accent-color: var(--seal); }
.affs { margin-top: 10px; font-size: .9375rem; }
.affs summary { cursor: pointer; color: var(--ink2); }
.aff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 12px; margin: 10px 0; }
.aff-grid label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .875rem; }
.aff-grid input { width: 4.2em; font: inherit; padding: 3px 6px; border: 1px solid #8f8a81; border-radius: 4px; text-align: right; }
.hits { list-style: none; margin: 0; padding: 0; }
.hit { display: grid; grid-template-columns: 1.6em 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hit .rk { color: var(--mute); font-weight: 700; text-align: center; }
.hit .nm { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.hit .nm a { color: var(--ink); text-decoration: none; font-weight: 700; }
.hit .nm a:hover { color: var(--seal); }
.hit .nm small { color: var(--mute); }
.hit .pc { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.hits.fresh .hit { animation: rise .28s ease both; }
.hits.fresh .hit:nth-child(2) { animation-delay: .03s; }
.hits.fresh .hit:nth-child(3) { animation-delay: .06s; }
@keyframes rise { from { opacity: .2; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.face { display: block; border-radius: 4px; background: var(--soft); border: 1px solid var(--line); object-fit: cover; }
.locked { margin: 10px 0 4px; padding: 12px 14px; border: 1px dashed #d8b5bc; border-radius: var(--r); background: #fdf8f8; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.locked p { margin: 0; flex: 1 1 200px; font-size: .9375rem; }
.buy { border: 0; background: var(--seal); color: #fff; padding: 10px 18px; min-height: 44px; border-radius: var(--r); font-weight: 700; }
.buy:hover { background: var(--seal-d); }
.buy[disabled] { opacity: .6; cursor: wait; }
.sp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 10px; }
.sp-row div { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.sp-row small { display: block; color: var(--ink2); font-size: .8125rem; line-height: 1.4; }
.sp-row b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.clsbar { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.clsbar li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 4.2em; align-items: center; gap: 8px; font-size: .8125rem; }
.clsbar i { display: block; height: 8px; background: var(--soft); border-radius: 4px; position: relative; overflow: hidden; }
.clsbar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--gold); border-radius: 4px; transition: width .25s ease; }
.clsbar b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tg-row label { font-weight: 600; }
.tg-row select { font: inherit; padding: 7px 10px; border: 1px solid #8f8a81; border-radius: var(--r); background: #fff; min-width: 220px; max-width: 100%; }
.go { border: 1px solid var(--seal); background: #fff; color: var(--seal); padding: 8px 14px; min-height: 44px; border-radius: var(--r); font-weight: 700; }
.go:hover { background: #fdf3f4; }
.tg-out { margin-top: 12px; }
.tg-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.tg-card h4 { margin: 0 0 .3rem; font-size: 1.1rem; }
.tg-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0; }
.tg-stats div { line-height: 1.3; }
.tg-stats small { display: block; color: var(--ink2); font-size: .78rem; }
.tg-stats b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tg-card ul { margin: .4rem 0 0; padding-left: 1.2em; }
.wall { padding: 18px 20px; background: #fff; }
.wall-h { font-weight: 800; font-size: 1.15rem; margin: 0 0 .4rem; color: var(--seal); }
.wall ul { margin: 0 0 .8rem; padding-left: 1.2em; }
.restore { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; align-items: center; }
.restore input { font: inherit; padding: 6px 10px; border: 1px solid #8f8a81; border-radius: var(--r); flex: 1 1 200px; min-width: 0; }
.restore button { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: var(--r); color: var(--ink2); }
.restore p { flex-basis: 100%; margin: 0; }
.ok-pass { color: var(--ok); font-weight: 700; }

/* facts */
.facts dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--line); }
.facts dl > div { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 14px; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 1.05rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.6; }
.facts dd { margin: 0; font-size: .9375rem; color: var(--ink2); }

/* grids & tables */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 28px; }
.cg h3 { margin: .9rem 0 .4rem; font-size: .95rem; }
.cg h3 a { color: var(--ink); text-decoration: none; }
.cg h3 small { color: var(--mute); font-weight: 400; }
.faces { display: flex; flex-wrap: wrap; gap: 4px; }
.faces a { display: block; border-radius: 5px; transition: transform .12s; }
.faces a:hover { transform: translateY(-2px); }
.faces a:hover .face { border-color: var(--seal); }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
thead th { background: var(--soft); font-size: .8125rem; color: var(--ink2); font-weight: 600; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #fcfbf9; }
td.sv a { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
td.sv a:hover { color: var(--seal); }
td.sv span { display: flex; flex-direction: column; line-height: 1.35; }
td.sv small { color: var(--mute); font-weight: 400; font-size: .8125rem; }
tbody th { font-weight: 600; white-space: nowrap; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.jump a { border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; text-decoration: none; color: var(--ink2); font-size: .875rem; }
.jump a:hover { border-color: var(--seal); color: var(--seal); }
.search { margin: 14px 0 10px; display: flex; flex-direction: column; gap: 4px; max-width: 520px; }
.search label { font-weight: 600; font-size: .9375rem; }
.search input { font: inherit; padding: 9px 12px; border: 1px solid #8f8a81; border-radius: var(--r); }
.search input:focus, .tg-row select:focus, .restore input:focus { outline: 2px solid var(--seal); outline-offset: 1px; }
tr[hidden] { display: none; }
.hid td { color: var(--mute); }
.lockname { display: inline-block; padding: 1px 8px; border: 1px dashed #d8b5bc; border-radius: 4px; color: var(--seal); font-size: .8125rem; }
.locked-sec { border: 1px solid #ecd9dc; background: #fdf8f8; border-radius: var(--r); padding: 14px 16px; margin: 16px 0; }
.locked-sec h3 { margin-top: 0; }
.locked-sec.open { background: #fff; border-color: var(--line); }
.locked-sec ol, .locked-sec ul { padding-left: 1.3em; }
.locked-sec li { margin: .3rem 0; }

/* servant page */
.sv-head { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 8px; }
.sv-cls { margin: 0; color: var(--seal); font-weight: 700; font-size: .9rem; }
.sv-title { color: var(--ink2); margin-bottom: .8rem; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--line); }
.kv > div { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
.kv dt { font-size: .78rem; color: var(--mute); }
.kv dd { margin: 0; font-weight: 600; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 0 32px; }
.params { max-width: 320px; border: 1px solid var(--line); }
.params td { font-weight: 700; font-size: 1.05rem; }
.np-meta { color: var(--gold); font-weight: 700; margin-bottom: .3rem; }
.skills { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.skills li { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; }
.skills .rank { font-weight: 700; color: var(--gold); }
.tag { border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; color: var(--ink2); font-size: .75rem; }
.quote { border-left: 3px solid var(--gold); padding-left: 14px; font-size: 1.05rem; }
details summary { cursor: pointer; }
.frags li { margin: .4rem 0; }
.pn { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .9375rem; }
.cta { display: inline-block; background: var(--seal); color: #fff; text-decoration: none; padding: 9px 16px; border-radius: var(--r); font-weight: 700; }
.cta:hover { background: var(--seal-d); color: #fff; }
.shot figure { margin: 0 0 14px; }
.shot img { border-radius: var(--r); border: 1px solid var(--line); }
.shot figcaption { font-size: .8125rem; color: var(--mute); margin-top: 4px; }
.ext::after { content: " ↗"; }

/* catalyst checker */
.chk { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin: 16px 0 8px; }
.chk-h { margin: 0 0 .4rem; font-size: 1.3rem; border: 0; padding: 0; }
.chk-lead { color: var(--ink2); font-size: .9375rem; }
.chk-in { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.chk-in label { display: flex; flex-direction: column; gap: 3px; font-size: .8125rem; font-weight: 600; color: var(--ink2); }
.chk-in input { font: inherit; font-size: .9375rem; padding: 8px 10px; border: 1px solid #8f8a81; border-radius: var(--r); min-width: 0; color: var(--ink); background: #fff; transition: border-color .15s; }
.chk-in input:focus { outline: 2px solid var(--seal); outline-offset: 1px; }
.chk-out td.cat { font-size: .875rem; color: var(--ink2); }
.chk-out td.wr { width: 38%; min-width: 150px; }
.chk-out td.wr b { font-variant-numeric: tabular-nums; margin-left: 8px; }
.chk-out td.wr small { color: var(--mute); margin-left: 6px; font-size: .78rem; }
.wbar { display: inline-block; vertical-align: middle; width: calc(100% - 7.5em); max-width: 160px; height: 8px; background: var(--soft); border-radius: 4px; position: relative; overflow: hidden; }
.wbar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--gold); border-radius: 4px; transition: width .25s ease; }
.chk-out tr.pick { background: #fdf6f7; }
.chk-out tr.pick td:first-child { box-shadow: inset 3px 0 0 var(--seal); color: var(--ink); font-weight: 700; }
.chk-out tr.pick .wbar::after { background: var(--seal); }
.chk-out tr.none td { color: var(--ink2); font-size: .875rem; }
.chk-out tr.miss td { color: var(--mute); font-size: .875rem; }
.cm { display: none; font-style: normal; }
.chk-ex { margin: -4px 0 8px; }
.chk-plan { margin: 8px 0 0; }
.chk-verdict { font-weight: 700; margin: 12px 0 6px; }
.chk-next { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: .9375rem; }
.chk-shot { margin: 0; }
.chk-shot img { display: block; border-radius: var(--r); border: 1px solid var(--line); }
.chk-shot figcaption { font-size: .8125rem; color: var(--mute); margin-top: 6px; line-height: 1.5; }

/* life flow */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px; }
.steps li { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 22px; align-items: start; }
.steps figure { margin: 0; }
.steps img { display: block; border-radius: var(--r); border: 1px solid var(--line); max-height: 300px; width: 100%; object-fit: cover; object-position: top; }
.steps h3 { margin-top: 0; }
.steps p { color: var(--ink2); }

/* footer */
.foot { border-top: 1px solid var(--line); background: var(--soft); padding: 22px 0 40px; font-size: .8125rem; color: var(--ink2); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot-links a { color: var(--ink2); }

@media (max-width: 860px) {
  .chk { grid-template-columns: minmax(0, 1fr); }
  .chk-shot { max-width: 420px; }
  .steps li { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .calc { grid-template-columns: minmax(0, 1fr); }
  .calc-in { border-right: 0; border-top: 1px solid var(--line); }
  .calc-out { order: -1; }
  .facts dl { grid-template-columns: minmax(0, 1fr); }
  .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  h1 { font-size: 1.4rem; }
  .chk { padding: 14px; gap: 14px; }
  .chk-h { font-size: 1.15rem; }
  .chk-lead { display: none; }
  .intro p { display: none; }
  .chk-in { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .chk-in label { flex-direction: row; align-items: center; gap: 8px; }
  .chk-in label span { flex: none; width: 3.6em; }
  .chk-in input { flex: 1; padding: 6px 9px; }
  .chk-out td.cat, .chk-out thead th:first-child { display: none; }
  .cm { display: block; color: var(--mute); font-weight: 400; font-size: .75rem; line-height: 1.35; }
  .chk-out td.wr { min-width: 0; width: auto; }
  .wbar { display: none; }
  .chk-out td.wr b { margin-left: 0; }
  .chk-out td.wr small { display: block; margin-left: 0; }
  .chk-out .sv .face { width: 32px; height: 32px; }
  .wrap { padding: 0 14px; }
  .calc > * { padding: 14px; }
  .brand span { font-size: .875rem; }
  .langs a { padding: 4px 5px; font-size: .75rem; }
  .intro p { font-size: .9375rem; }
  .sv-head { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .sv-head .face { width: 96px; height: 96px; }
  .tg-card { grid-template-columns: 64px minmax(0, 1fr); }
  .tg-card .face { width: 64px; height: 64px; }
  .cgrid { grid-template-columns: minmax(0, 1fr); }
  .tg-row select { min-width: 0; flex: 1 1 100%; }
  th, td { padding: 7px 9px; }
  .facts dl > div { grid-template-columns: 4.4rem minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
