:root {
  --ink: #1c2430;
  --muted: #526274;
  --line: #e3e8ee;
  --paper: #ffffff;
  --bg: #eef2f6;
  --blue: #1565c0;
  --blue-dark: #0d3f7a;
  --soft: #f4f8fc;
  --pin-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 17px;
  line-height: 1.85;
}

img { max-width: 100%; }

a { color: var(--blue); }

a:hover { color: var(--blue-dark); }

.pin {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 10px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #102033;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: block;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  margin-left: auto;
  padding: 11px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: #102033;
}

.nav-toggle:hover,
.nav-toggle[aria-expanded="true"] {
  background: var(--soft);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
}

.nav a {
  color: var(--blue);
  text-decoration: none;
  font-size: 14px;
}

.nav a[aria-current="page"] {
  color: #102033;
  font-weight: 700;
}

#ads {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 8px 10px 6px;
  background: #fff;
  border-top: 1px solid var(--line);
}

#ads > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 76px;
}

#ads figure { margin: 0; }

#ads a {
  display: inline-block;
  text-decoration: none;
  border-radius: 18px;
}

#ads img {
  width: 65px;
  height: 65px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(24, 24, 24, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease;
  display: block;
  background: #fff;
}

#ads img:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 10px 24px rgba(24, 24, 24, 0.18);
}

#ads figcaption,
#ads .caption {
  height: 16px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 16px;
  color: #666;
  text-align: center;
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet {
  max-width: 860px;
  margin: 22px auto 40px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(16, 32, 51, 0.05);
}

.prose { padding: 8px 32px 4px; }

.sheet h1 {
  margin: 28px 0 12px;
  font-size: 30px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

h2 {
  margin: 1.7em 0 0.55em;
  font-size: 22px;
  line-height: 1.4;
  padding-left: 12px;
  border-left: 4px solid var(--blue);
}

h3 {
  margin: 1.2em 0 0.4em;
  font-size: 18px;
}

p { margin: 0 0 0.95em; }

.lead {
  font-size: 18px;
  color: #243246;
}

.note {
  background: var(--soft);
  border: 1px solid #d7e4f2;
  border-radius: 12px;
  padding: 12px 14px;
  color: #243e5c;
  font-size: 15px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 0;
}

ul, ol { margin: 0 0 1em; padding-left: 1.3em; }

li { margin: 0.25em 0; }

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.1em;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

th, td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

th { background: var(--soft); font-weight: 700; }

figure.shot {
  margin: 8px auto 26px;
  max-width: 400px;
  padding: 0 16px;
}

figure.shot img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  border: 1px solid #d5dde6;
  box-shadow: 0 10px 26px rgba(16, 32, 51, 0.08);
  background: #101820;
}

figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.foot {
  max-width: 860px;
  margin: 0 auto 28px;
  padding: 0 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.foot a { margin-right: 12px; }

.back {
  display: inline-block;
  margin-top: 8px;
  font-weight: 700;
  text-decoration: none;
}

@media (min-width: 861px) {
  .pin {
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .nav {
    margin: 8px 28px 8px 36px;
  }
}

@media (max-width: 860px) {
  body {
    font-size: 16px;
    padding-top: var(--pin-h);
  }

  .pin {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    box-shadow: 0 2px 12px rgba(16, 32, 51, 0.06);
  }

  .topbar {
    flex-wrap: nowrap;
    position: relative;
  }

  .nav-toggle { display: inline-flex; }

  .nav {
    display: none;
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    right: 12px;
    left: auto;
    min-width: 168px;
    margin: 0;
    padding: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(16, 32, 51, 0.14);
  }

  .nav.is-open { display: flex; }

  .nav a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
  }

  .nav a:hover { background: var(--soft); }

  .sheet {
    margin: 0 auto;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
  }

  .sheet h1 { font-size: 24px; margin-top: 18px; }

  h2 { font-size: 20px; }

  body.home .prose { padding: 4px 14px 4px; }

  body.home figure.shot { padding: 0; max-width: none; }

  body.subpage main { padding: 0 18px 28px; }

  body.subpage .sheet { margin-top: 12px; border-radius: 14px; }

  body.subpage .prose { padding: 4px 16px 8px; }

  .foot { padding: 8px 18px 20px; }
}
