:root {
  --red: #a3161d;
  --red-dark: #7d0f15;
  --red-soft: #f8eceb;
  --ink: #1f2428;
  --text: #33393f;
  --muted: #68717a;
  --line: #e2ded8;
  --bg: #f6f4f1;
  --card: #fff;
  --radius: 6px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--sans); color: var(--text); background: var(--bg); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0; }
:focus-visible { outline: 3px solid #e2a13a; outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: var(--red); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }

/* Header */
.site-header { background: var(--red); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 50%; background: #fff; color: var(--red); font: 700 26px/42px var(--serif); text-align: center; flex: none; }
.brand-name { display: block; font: 700 21px/1.2 var(--serif); letter-spacing: .2px; }
.brand-tag { display: block; font-size: 13px; opacity: .85; }

.search { position: relative; display: flex; }
.search input { flex: 1; min-width: 0; border: 0; padding: 0 14px; font: inherit; color: var(--ink); background: #fff; border-radius: var(--radius) 0 0 var(--radius); }
.search input:focus { outline: 3px solid #e2a13a; outline-offset: 0; }
.search button { border: 0; cursor: pointer; font: inherit; font-weight: 600; border-radius: 0 var(--radius) var(--radius) 0; }
.search-header { width: 340px; max-width: 100%; }
.search-header input { height: 40px; }
.search-header button { width: 46px; background: var(--red-dark); color: #fff; display: grid; place-items: center; }

.suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin: 4px 0 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .14); text-align: left; }
.suggest a { display: block; padding: 8px 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest a strong { color: var(--red); margin-right: 8px; }
.suggest a:hover, .suggest a.active { background: var(--red-soft); text-decoration: none; }

/* Letter index */
.letters { background: #fff; border-bottom: 1px solid var(--line); }
.letters ul { display: flex; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0; padding: 8px 0; }
.letters a { display: block; min-width: 30px; padding: 4px 6px; text-align: center; font-weight: 600; color: var(--ink); border-radius: 4px; }
.letters a:hover, .letters a[aria-current] { background: var(--red); color: #fff; text-decoration: none; }

/* Hero */
.hero { background: linear-gradient(var(--red), var(--red-dark)); color: #fff; text-align: center; padding: 44px 0 40px; }
.hero h1 { color: #fff; font: 700 38px/1.15 var(--serif); }
.hero p { margin: 10px 0 0; opacity: .92; }
.search-hero { max-width: 640px; margin: 24px auto 0; box-shadow: 0 6px 22px rgba(0, 0, 0, .22); border-radius: var(--radius); }
.search-hero input { height: 56px; font-size: 18px; padding: 0 18px; }
.search-hero button { padding: 0 28px; background: var(--ink); color: #fff; font-size: 17px; }
.search-hero button:hover { background: #000; }
.hero .hero-stat { font-size: 14px; opacity: .8; margin-top: 16px; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; padding-top: 24px; padding-bottom: 40px; align-items: start; }
.panel, .entry, .box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.panel, .entry { padding: 22px 24px; margin-bottom: 20px; }
.panel-title, .box-title { font: 700 19px/1.3 var(--serif); padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid var(--red); }
.page-title { font: 700 28px/1.2 var(--serif); }
.page-intro { color: var(--muted); margin: 8px 0 16px; }
.empty { margin: 0; }

.crumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 14px; padding: 0; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin: 0 8px; color: #a8adb2; }

/* Term list */
.terms { list-style: none; margin: 0; padding: 0; }
.terms li { border-bottom: 1px solid var(--line); }
.terms li:last-child { border-bottom: 0; }
.terms a { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 11px 6px; color: var(--text); align-items: baseline; }
.terms a:hover { background: var(--red-soft); text-decoration: none; }
.term-abbr { font: 700 17px/1.3 var(--serif); color: var(--red); overflow-wrap: anywhere; }
.term-sum { color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips a { display: block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; color: var(--ink); background: #fff; }
.chips a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }

/* Pager */
.pager ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 20px 0 0; padding: 0; }
.pager a, .pager span { display: block; min-width: 38px; padding: 7px 12px; text-align: center; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #fff; }
.pager a:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.pager span[aria-current] { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.pager .gap { padding: 7px 2px; color: var(--muted); }

/* Entry */
.entry-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.entry-abbr { margin: 0 0 6px; font: 700 44px/1.1 var(--serif); color: var(--red); overflow-wrap: anywhere; }
.entry h1 { font: 600 20px/1.35 var(--sans); }
.entry-meta { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.entry-body { font-size: 17px; line-height: 1.7; overflow-wrap: break-word; }
.entry-body::after { content: ""; display: block; clear: both; }
.entry-body > :first-child { margin-top: 0; }
.entry-body h2, .entry-body h3 { font-family: var(--serif); margin: 1.4em 0 .5em; }
.entry-body ol, .entry-body ul { padding-left: 1.4em; }
.entry-body li { margin: .35em 0; }
.entry-body ol > li::marker { color: var(--red); font-weight: 700; }
.entry-body img { border-radius: 4px; }
.entry-body table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.entry-body td, .entry-body th { border: 1px solid var(--line); padding: 6px 10px; }
.entry-body blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--red); background: var(--red-soft); }
.entry-figure { float: right; margin: 0 0 12px 20px; max-width: 260px; }
.entry-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.entry-nav a { font: 700 17px var(--serif); max-width: 48%; overflow-wrap: anywhere; }
.entry-nav span { display: block; font: 400 13px var(--sans); color: var(--muted); }
.entry-nav .next { margin-left: auto; text-align: right; }

/* Sidebar */
.box { padding: 18px 20px; margin-bottom: 20px; }
.cat-list, .rank-list { list-style: none; margin: 0; padding: 0; }
.cat-list a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; color: var(--text); border-bottom: 1px dashed var(--line); }
.cat-list li:last-child a { border-bottom: 0; }
.cat-list span { color: var(--muted); font-size: 14px; }
.rank-list { counter-reset: rank; }
.rank-list li { counter-increment: rank; display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::before { content: counter(rank); flex: none; width: 22px; color: var(--muted); font-weight: 700; }
.rank-list a { color: var(--text); min-width: 0; }
.rank-list strong { color: var(--red); font-family: var(--serif); }
.rank-list span { font-size: 14px; color: var(--muted); }

.ad { margin: 0 0 20px; min-height: 90px; text-align: center; }

/* Comments */
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .comment-list { margin-left: 22px; border-left: 3px solid var(--line); padding-left: 16px; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment p { margin: 0 0 4px; overflow-wrap: anywhere; }
.comment-head time { color: var(--muted); font-size: 14px; margin-left: 6px; }
.comment-form { margin-top: 20px; }
.comment-form h3 { font: 700 17px var(--serif); margin-bottom: 10px; }
.comment-form p { margin: 0 0 12px; }
.comment-form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.comment-form small { font-weight: 400; color: var(--muted); }
.comment-form input, .comment-form textarea { width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); border: 1px solid #c9c4bc; border-radius: 4px; background: #fff; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hp { position: absolute; left: -9999px; }
.btn { display: inline-block; padding: 10px 22px; border: 0; border-radius: 4px; background: var(--red); color: #fff; font: 600 16px var(--sans); cursor: pointer; }
.btn:hover { background: var(--red-dark); }
.notice { padding: 10px 14px; border-radius: 4px; margin: 0 0 14px; }
.notice-ok { background: #e9f5ec; color: #1c5a2c; border: 1px solid #bcdcc4; }
.notice-err { background: var(--red-soft); color: var(--red-dark); border: 1px solid #e6c3c1; }

/* Footer */
.site-footer { background: var(--ink); color: #c9cdd1; font-size: 15px; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; padding-top: 28px; padding-bottom: 20px; flex-wrap: wrap; }
.footer-inner > div { max-width: 520px; }
.footer-inner p { margin: 0 0 6px; }
.footer-brand { font: 700 18px var(--serif); color: #fff; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: #fff; }
.footer-copy { border-top: 1px solid #3a4046; padding-top: 14px; padding-bottom: 18px; font-size: 14px; color: #9aa1a8; }

@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .search-header { width: 100%; }
  .hero h1 { font-size: 30px; }
}
@media (max-width: 560px) {
  .panel, .entry { padding: 16px; }
  .terms a { grid-template-columns: 1fr; gap: 2px; }
  .form-row { grid-template-columns: 1fr; }
  .entry-abbr { font-size: 34px; }
  .entry-figure { float: none; margin: 0 0 14px; max-width: 100%; }
  .search-hero button { padding: 0 18px; }
  .letters ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .letters ul::-webkit-scrollbar { display: none; }
}
