body.blood-mode #card-content .blood-number-memory {
    width: 100%; max-width: 640px; margin: 0 auto 18px;
    font-size: 26px; line-height: 1.4; font-variant-numeric: tabular-nums;
}
body.blood-mode #card-content .blood-number-original {
    color: #adb1b5; font-size: 15px; line-height: 1.6; text-align: left;
    max-width: 640px; margin: 0 auto; padding-top: 14px; border-top: 1px solid #454b50;
}
body.blood-mode #card-content .blood-number-original :is(p, li, ul, aside, b, strong, span) {
    color: inherit; font-size: inherit; line-height: inherit;
}
body.blood-mode #card-content .blood-number-original p { margin: 6px 0 0; }
body.blood-mode #card-content .blood-number-original ul { margin: 6px 0 0; padding-left: 20px; }
body.blood-mode #card-content .blood-number-original .blood-source-note { padding: 8px 0 0; margin: 6px 0 0; border: 0; background: none; }
body.blood-mode #card-content .blood-number-original-label { display: block; font-weight: 600; }
body.blood-mode #open-blood-numbers {
    display: inline-flex; align-items: center; justify-content: center; position: relative;
    width: 46px; min-width: 46px; height: 46px; padding: 0; flex: 0 0 46px;
    border: 1px solid var(--blood-line); border-radius: 7px; color: #dfc18c;
    background: #30363b; box-shadow: none; transition: background 160ms ease, border-color 160ms ease;
}
body.blood-mode #open-blood-numbers:hover { background: #3b4042; border-color: #b8a171; }
#open-blood-numbers svg { width: 24px; height: 24px; }
.blood-numbers-open { overflow: hidden; }
dialog.blood-numbers-dialog {
    --bn-line: #454c50; --bn-muted: #b5bdc1; --bn-accent: #b2c6cc;
    width: min(1240px, calc(100vw - 32px)); height: min(960px, calc(100dvh - 40px));
    max-width: none; max-height: none; padding: 0; margin: auto;
    border: 1px solid #667075; border-radius: 8px; background: #24292c; color: #e9edef;
    box-shadow: none; font: 14px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: 0;
    overflow: hidden; color-scheme: dark;
}
dialog.blood-numbers-dialog[open] { display: flex; flex-direction: column; animation: bn-enter 160ms ease-out; }
.blood-numbers-dialog::backdrop { background: rgb(8 12 14 / 78%); }
.blood-numbers-dialog *, .blood-numbers-dialog *::before, .blood-numbers-dialog *::after { box-sizing: border-box; letter-spacing: 0; text-shadow: none; }
.blood-numbers-dialog button, .blood-numbers-dialog select, .blood-numbers-dialog input { font: inherit; box-shadow: none; }
.bn-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; gap: 16px; border-bottom: 1px solid var(--bn-line); }
.bn-header > div { display: flex; align-items: baseline; gap: 14px; }
.bn-header h2 { margin: 0; font-size: 22px; font-weight: 650; }
#bn-count { color: var(--bn-muted); font-variant-numeric: tabular-nums; }
.bn-icon { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 40px; height: 40px; flex: 0 0 40px; background: transparent; border: 1px solid var(--bn-line); border-radius: 6px; color: #dbe1e3; padding: 0; cursor: pointer; }
.bn-icon:hover { background: #373e42; border-color: #88979d; }
.blood-numbers-dialog svg { width: 20px; height: 20px; stroke-width: 1.8; flex-shrink: 0; }
.bn-controls { display: grid; grid-template-columns: auto minmax(170px,1fr) minmax(155px,auto); align-items: end; gap: 12px; padding: 14px 20px; }
.bn-mode { display: flex; height: 42px; border: 1px solid var(--bn-line); border-radius: 6px; overflow: hidden; }
.bn-mode button { display: flex; gap: 8px; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; background: transparent; color: #bec7cc; border: 0; border-radius: 0; cursor: pointer; transition: color 140ms, background 140ms; }
.bn-mode button[aria-pressed="true"] { background: #414c50; color: #f6f7f7; }
.bn-mode button[data-number-mode="memory"][aria-pressed="true"] { background: #4b4538; color: #f1d49a; }
.bn-mode button:hover { background: #394145; }
.bn-search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 10px; border: 1px solid var(--bn-line); border-radius: 6px; color: var(--bn-muted); }
.bn-search input { min-width: 0; width: 100%; background: transparent; border: 0; color: #eef1f2; padding: 7px 0; outline: 0; }
.bn-search:focus-within { border-color: #a9c9dc; }
.bn-select { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bn-select > span { color: var(--bn-muted); font-size: 11px; }
.bn-select select { width: 100%; min-width: 0; height: 42px; padding: 8px 26px 8px 10px; border-radius: 6px; border: 1px solid var(--bn-line); background: #2b3235; color: #e4eaee; }
.bn-caution { flex-shrink: 0; margin: 0; padding: 8px 20px 12px; font-size: 13px; color: #d8c79f; border-bottom: 1px solid var(--bn-line); }
.bn-content { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #727e84 transparent; padding: 0 20px 24px; }
.bn-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; text-align: left; }
.bn-table thead { position: sticky; top: 0; z-index: 2; background: #24292c; }
.bn-table thead th { padding: 12px 12px; border-bottom: 1px solid #5a6266; color: #aab7bc; font-size: 12px; font-weight: 600; }
.bn-table thead th:nth-child(1) { width: 29%; }
.bn-table thead th:nth-child(2) { width: 20%; }
.bn-table thead th:nth-child(3) { width: 16%; }
.bn-table thead th:nth-child(4) { width: 35%; }
.bn-group-row th { padding: 24px 12px 10px; border-bottom: 1px solid var(--bn-line); font-size: 15px; font-weight: 650; color: #e1e8e9; }
.bn-group-row small { display: block; max-width: 900px; margin-top: 4px; color: var(--bn-muted); font-size: 12px; font-weight: 400; }
.bn-row > th, .bn-row > td { padding: 14px 12px; border-bottom: 1px solid #3a4245; vertical-align: top; overflow-wrap: anywhere; transition: background 130ms ease; }
.bn-row > th { border-left: 3px solid var(--bn-accent); font-size: 14px; font-weight: 550; }
.bn-row:hover > th, .bn-row:hover > td { background: #2d3437; }
.bn-row th > small { display: block; margin-top: 5px; font-size: 11px; font-weight: 400; color: var(--bn-accent); }
.bn-value { font-variant-numeric: tabular-nums; }
.bn-value strong { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 18px; font-weight: 600; color: var(--bn-accent); }
.bn-original { display: block; font-size: 11px; color: #b9c0c3; margin-top: 6px; }
.bn-exact { display: block; margin-top: 4px; font-size: 11px; color: #a8c6b2; }
.bn-approx { color: #dfc18c; }
.bn-unit { color: #d0d8dc; font-variant-numeric: tabular-nums; }
.bn-unit sup, .bn-unit sub { font-size: 10px; }
.bn-context { color: #c3cbd0; font-size: 12px; }
.bn-context p { margin: 0; line-height: 1.55; }
.bn-detail { margin-top: 6px; border: 0; background: transparent; }
.bn-detail > summary { display: flex; justify-content: center; align-items: center; position: relative; width: 32px; height: 30px; padding: 0; list-style: none; cursor: pointer; border-radius: 4px; color: #b5c3c9; }
.bn-detail > summary::-webkit-details-marker { display: none; }
.bn-detail > summary:hover { background: #3d4549; color: #edf2f4; }
.bn-detail > summary svg { width: 17px; height: 17px; }
.bn-detail > div { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--bn-accent); }
.bn-detail b { display: block; margin-top: 10px; color: #e6eaeb; font-size: 12px; }
.bn-detail small { display: block; margin-top: 8px; }
.bn-detail a { display: block; color: #b7d3e3; margin-top: 8px; }
.bn-loading { display: flex; min-height: 180px; align-items: center; justify-content: center; gap: 12px; color: var(--bn-muted); }
.bn-spinner { width: 24px; height: 24px; border: 2px solid #495257; border-top-color: #e8edef; border-radius: 50%; animation: bn-spin 700ms linear infinite; }
.bn-empty { margin: 30px 12px; color: var(--bn-muted); }
.bn-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.blood-numbers-dialog :focus-visible, #open-blood-numbers:focus-visible { outline: 2px solid #adcddd; outline-offset: 2px; }
#open-blood-numbers[data-tooltip]::after, .blood-numbers-dialog [data-tooltip]::after {
    content: attr(data-tooltip); position: absolute; z-index: 5; top: calc(100% + 6px); right: 0;
    width: max-content; max-width: 180px; padding: 6px 9px; color: #ecf1f3; background: #181d20;
    border: 1px solid #5b676d; border-radius: 4px; font-size: 12px; pointer-events: none; opacity: 0;
    transition: opacity 120ms ease;
}
#open-blood-numbers:is(:hover,:focus-visible)::after, .blood-numbers-dialog [data-tooltip]:is(:hover,:focus-visible)::after { opacity: 1; }
@keyframes bn-spin { to { transform: rotate(360deg); } }
@keyframes bn-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 700px) {
    dialog.blood-numbers-dialog { width: calc(100vw - 12px); height: calc(100dvh - 16px); border-radius: 6px; }
    .bn-header { padding: 10px 12px; }
    .bn-header h2 { font-size: 19px; }
    .bn-controls { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px 12px; gap: 8px; }
    .bn-mode { grid-column: 1 / -1; }
    .bn-mode button { flex: 1; }
    .bn-search { grid-column: 1 / -1; }
    .bn-select:last-child { grid-column: 1 / -1; }
    .bn-caution { padding: 8px 12px; font-size: 12px; }
    .bn-content { padding: 0 10px 18px; }
    .bn-table, .bn-table tbody { display: block; }
    .bn-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .bn-group-row { display: block; }
    .bn-group-row th { display: block; padding: 20px 4px 10px; }
    .bn-row { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); column-gap: 12px; padding: 12px 0; border-bottom: 1px solid #414a4e; }
    .bn-row > th, .bn-row > td { padding: 0; border-bottom: 0; }
    .bn-row > th { grid-column: 1; grid-row: 1 / span 2; padding-left: 9px; }
    .bn-row > .bn-value { grid-column: 2; grid-row: 1; }
    .bn-row > .bn-unit { grid-column: 2; grid-row: 2; padding-top: 4px; font-size: 12px; }
    .bn-row > .bn-context { grid-column: 1 / -1; grid-row: 3; padding: 10px 4px 0 12px; }
    .bn-value strong { font-size: 17px; }
}
@media (max-height: 600px) and (max-width: 700px) {
    .bn-controls { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .bn-select:last-child { grid-column: auto; }
    .bn-mode { grid-column: 1; }
    .bn-mode button { padding: 5px; }
    .bn-mode svg { display: none; }
    .bn-search { grid-column: 2 / -1; }
}
@media (prefers-reduced-motion: reduce) {
    .blood-numbers-dialog *, #open-blood-numbers { animation: none !important; transition: none !important; }
    dialog.blood-numbers-dialog[open] { animation: none; }
}
