:root {
  --ink: #1d2433;
  --muted: #5a6275;
  --accent: #2446c8;
  --accent-dark: #173396;
  --paper: #ffffff;
  --tint: #f2f5fb;
  --code-bg: #f6f7fa;
  --line: #dde2ec;
  --warn: #fff6e0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

/* ----- header ----- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 12px 24px;
  background: var(--tint);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 1.4rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 4px 2px; }
.site-nav a:hover { text-decoration: underline; }
.search { display: flex; margin-left: auto; }
.search input, .search-page input {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px 0 0 6px;
  min-width: 200px;
}
.search button, .search-page button { border-radius: 0 6px 6px 0; }

/* ----- buttons ----- */
.button, button.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--accent-dark); color: #fff; }
.button.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.button.secondary:hover { background: var(--tint); color: var(--accent-dark); }
.button:disabled { background: #aab3c7; cursor: not-allowed; }
.search button, .search-page button, .notify button {
  font: inherit; padding: 7px 14px; border: 0; background: var(--accent); color: #fff; cursor: pointer;
}

/* ----- layout ----- */
main { max-width: 1040px; margin: 0 auto; padding: 0 24px 40px; }
main.page { max-width: 820px; padding-top: 24px; }
h1 { font-size: 2.2rem; line-height: 1.2; }
h2 { margin-top: 2.2em; font-size: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
h3 { font-size: 1.15rem; }
.lead { font-size: 1.2rem; color: var(--muted); }
.small { font-size: 0.9rem; color: var(--muted); }

.hero { padding: 56px 0 32px; text-align: left; }
.hero h1 { font-size: 3.4rem; margin: 0; }
.tagline { font-size: 1.35rem; max-width: 40em; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.split { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: start; margin-top: 24px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-top: 40px; }
.cards article { background: var(--tint); border-radius: 10px; padding: 20px; }
.cards article a { font-weight: 600; }

.notice { margin-top: 40px; background: var(--warn); border-radius: 10px; padding: 18px 22px; }
.notice h2 { border: 0; margin-top: 0; font-size: 1.2rem; }

/* ----- code ----- */
pre.code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 1em 0;
}
code { font-family: Consolas, "Courier New", monospace; font-size: 0.92em; background: var(--code-bg); padding: 1px 4px; border-radius: 4px; }
pre.code code { background: none; padding: 0; font-size: inherit; }

/* ----- tables and lists ----- */
table.downloads { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.95rem; }
table.downloads th, table.downloads td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.downloads th { color: var(--muted); font-weight: 600; }
.hash { font-family: Consolas, monospace; word-break: break-all; font-size: 0.85em; }

.verify { background: var(--tint); border-radius: 10px; padding: 18px; margin: 1em 0; }
#verify-result { font-weight: 600; margin-bottom: 0; }
#verify-result.ok { color: #1b7a3a; }
#verify-result.bad { color: #b00000; }

dl.faq dt { font-weight: 700; margin-top: 1em; }
dl.faq dd { margin: 0.3em 0 0 0; }

/* ----- search ----- */
.search-page { display: flex; gap: 0; margin: 16px 0; }
.search-page input { flex: 1; border-radius: 6px 0 0 6px; }
.results { padding-left: 1.2em; }
.results li { margin-bottom: 1.2em; }
.results .result-title { font-weight: 600; font-size: 1.1rem; }
.results mark { background: #ffe57a; padding: 0 2px; }

/* ----- book ----- */
.book-buy { display: grid; grid-template-columns: 220px 1fr; gap: 28px; margin: 24px 0; background: var(--tint); border-radius: 12px; padding: 24px; }
.cover {
  aspect-ratio: 5 / 7.4;
  background: linear-gradient(160deg, #2446c8, #0c1f66);
  color: #fff;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.cover span { font-size: 2rem; font-weight: 700; }
.cover small { font-size: 1rem; opacity: 0.9; }
.status { background: #fff; border-radius: 6px; padding: 8px 12px; }
.notify { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.notify label { width: 100%; font-weight: 600; }
.notify input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; min-width: 240px; }
ol.chapters li { margin-bottom: 6px; }

/* ----- footer ----- */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; padding: 20px 24px; text-align: center; }

/* ----- small screens ----- */
@media (max-width: 760px) {
  .split, .book-buy { grid-template-columns: 1fr; }
  .search { margin-left: 0; width: 100%; }
  .search input { flex: 1; min-width: 0; }
  .hero h1 { font-size: 2.6rem; }
}
