/* IP 地址百科: friendly textbook styles */

:root {
  --bg: #eef5f0;
  --paper: #ffffff;
  --ink: #13322b;
  --muted: #4e6b62;
  --leaf: #2f7d6d;
  --sun: #f5c542;
  --line: #cfe0d7;
  --wash: #e3f0e9;
  --grid: rgba(47, 125, 109, 0.08);
  --marker: rgba(245, 197, 66, 0.55);
  --code-bg: #13322b;
  --code-ink: #e3efea;
  --tag-ink: #13322b;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --kai: "Kaiti SC", STKaiti, KaiTi, "AR PL UKai CN", "LXGW WenKai", "Noto Serif CJK SC", "Songti SC", serif;
  --numeral: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Noto Serif", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", "Noto Sans Mono", "DejaVu Sans Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1f1a;
    --paper: #16291f;
    --ink: #e3efea;
    --muted: #9db8ae;
    --leaf: #6cc3ae;
    --sun: #e3b94b;
    --line: #2b473a;
    --wash: #1c3528;
    --grid: rgba(108, 195, 174, 0.07);
    --marker: rgba(227, 185, 75, 0.32);
    --code-bg: #0f1f1a;
    --code-ink: #e3efea;
  }
}

/* Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.85;
  overflow-wrap: break-word;
}

@media (min-width: 720px) {
  body {
    font-size: 1.125rem;
  }
}

h1,
h2,
h3 {
  line-height: 1.35;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.85rem, 6vw, 2.6rem);
  font-weight: 800;
  margin: 0;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

h3 {
  font-size: 1.12rem;
  font-weight: 700;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--leaf);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-color: var(--sun);
  text-decoration-thickness: 3px;
}

:focus-visible {
  outline: 3px solid var(--leaf);
  outline-offset: 3px;
  border-radius: 4px;
}

img,
svg {
  max-width: 100%;
}

code,
kbd,
pre {
  font-family: var(--mono);
}

code {
  background: var(--wash);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: var(--paper);
  padding: 0 0.4em;
  font-size: 0.85em;
  line-height: 1.6;
}

pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.82em;
  line-height: 1.65;
  margin: 1.2rem 0 1.5rem;
}

pre code {
  background: none;
  padding: 0;
  font-size: 1em;
  overflow-wrap: normal;
}

dfn {
  font-style: normal;
  font-weight: 700;
  background: linear-gradient(transparent 58%, var(--marker) 58%);
  padding: 0 0.08em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--paper);
  color: var(--ink);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--leaf);
}

.skip-link:focus {
  top: 0.75rem;
}

.page-wrap {
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 720px) {
  .page-wrap {
    padding: 0 1.5rem;
  }
}

/* Header and footer */

.site-header {
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.02rem;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
}

.site-nav {
  display: flex;
  gap: 0.15rem;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.94rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  white-space: nowrap;
}

.site-nav a:hover {
  background: var(--wash);
}

.site-nav a[aria-current] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--sun);
  text-decoration-thickness: 4px;
  text-underline-offset: 0.35em;
}

@media (max-width: 480px) {
  .site-nav {
    gap: 0;
  }

  .site-nav a {
    padding: 0.3rem 0.32rem;
  }
}

@media (max-width: 380px) {
  .brand {
    font-size: 0.95rem;
  }

  .site-nav a {
    font-size: 0.88rem;
    padding: 0.3rem 0.25rem;
  }
}

/* Four nav items do not fit next to the full name on the narrowest phones */
@media (max-width: 350px) {
  .brand span {
    display: none;
  }
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 5rem;
  padding: 2.25rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-inner {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 720px) {
  .footer-inner {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.footer-title {
  color: var(--ink);
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--ink);
}

.site-footer p {
  margin: 0 0 0.5rem;
}

/* Home: hero and specimen figures */

.hero {
  text-align: center;
  padding: 2.5rem 0 0.5rem;
}

.hero .lead {
  color: var(--muted);
  max-width: 30em;
  margin: 0.75rem auto 2rem;
}

.ip-figure {
  margin: 0 auto 2rem;
  max-width: 46rem;
}

.figure-plate {
  position: relative;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: -1px -1px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem 0.75rem 1.4rem;
}

@media (min-width: 720px) {
  .figure-plate {
    padding: 2.25rem 2rem 1.75rem;
  }
}

.figure-caption {
  margin-top: 0.85rem;
  text-align: center;
  font-family: var(--kai);
  font-size: 1.02rem;
  color: var(--ink);
}

.figure-tag {
  display: inline-block;
  background: var(--sun);
  color: var(--tag-ink);
  font-weight: 700;
  border-radius: 4px;
  padding: 0 0.5em;
  margin-right: 0.35em;
  line-height: 1.6;
}

.octets {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-width: 40rem;
  margin: 0 auto;
}

.octet {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.octet-value,
.octet-dot {
  font-family: var(--numeral);
  font-size: clamp(1.75rem, 8.2vw, 3.6rem);
  font-weight: 700;
  line-height: 1.15;
  padding: 0.2em 0;
  border: 2px solid transparent;
}

.octet-value {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--paper);
  border-color: var(--ink);
  border-radius: 10px;
  font-variant-numeric: lining-nums tabular-nums;
}

.octet-dot {
  flex: none;
  width: 0.55em;
  text-align: center;
  color: var(--leaf);
}

.bits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.3em;
  margin-top: 0.55rem;
  font-family: var(--mono);
  font-size: clamp(0.62rem, 2.9vw, 0.8rem);
  line-height: 1.5;
  letter-spacing: 0.02em;
  white-space: nowrap;
  min-height: 1.5em;
}

@media (min-width: 720px) {
  .bits {
    font-size: 0.92rem;
  }
}

.slot-label {
  font-family: var(--kai);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 0.15rem;
}

.pending .octet-value,
.pending .hextet-value {
  color: var(--line);
  border-style: dashed;
  border-color: var(--line);
}

.pending .bits {
  color: var(--line);
}

.figure-plate .figure-message {
  display: none;
  margin: 0 auto;
  max-width: 30em;
  text-align: center;
  color: var(--ink);
}

.ip-figure.empty .octets,
.ip-figure.empty .hextets,
.ip-figure.empty .short-form {
  display: none;
}

.ip-figure.empty .figure-message {
  display: block;
}

.ip-figure.empty .figure-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 9.5rem;
}

.hextets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  max-width: 42rem;
  margin: 0 auto;
}

@media (min-width: 720px) {
  .hextets {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 0.75rem 1.1rem;
  }

  .hextets .hextet-value,
  .hextets .hextet:not(:last-child)::after {
    font-size: clamp(0.95rem, 1.75vw, 1.2rem);
  }
}

.hextet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hextet-value {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--mono);
  font-size: clamp(1.05rem, 4.6vw, 1.45rem);
  font-weight: 700;
  line-height: 1.2;
  padding: 0.35em 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 8px;
}

.hextet:not(:last-child)::after {
  content: ":";
  pointer-events: none;
  position: absolute;
  top: 0.15em;
  right: -0.72rem;
  font-family: var(--mono);
  font-size: clamp(1.05rem, 4.6vw, 1.45rem);
  font-weight: 700;
  color: var(--leaf);
}

@media (max-width: 719px) {
  .hextet:nth-child(4)::after {
    display: none;
  }
}

@media (min-width: 720px) {
  .hextet:not(:last-child)::after {
    right: -0.8rem;
  }
}

.short-form {
  text-align: center;
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.7em;
}

.short-form code {
  color: var(--ink);
}

/* One-time reveal when the numbers arrive */

@media (prefers-reduced-motion: no-preference) {
  .revealed .octet-value,
  .revealed .hextet-value {
    animation: settle 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .revealed .bits {
    animation: fade-in 0.5s ease both;
    animation-delay: 0.35s;
  }

  .revealed .octet:nth-child(3) .octet-value,
  .revealed .hextet:nth-child(2) .hextet-value {
    animation-delay: 0.08s;
  }

  .revealed .octet:nth-child(5) .octet-value,
  .revealed .hextet:nth-child(3) .hextet-value {
    animation-delay: 0.16s;
  }

  .revealed .octet:nth-child(7) .octet-value,
  .revealed .hextet:nth-child(4) .hextet-value {
    animation-delay: 0.24s;
  }

  .revealed .hextet:nth-child(5) .hextet-value {
    animation-delay: 0.32s;
  }

  .revealed .hextet:nth-child(6) .hextet-value {
    animation-delay: 0.4s;
  }

  .revealed .hextet:nth-child(7) .hextet-value {
    animation-delay: 0.48s;
  }

  .revealed .hextet:nth-child(8) .hextet-value {
    animation-delay: 0.56s;
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(0.35em);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Buttons and status */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  color: #ffffff;
  background: #2f7d6d;
  border: 2px solid #2f7d6d;
  border-radius: 10px;
  padding: 0.55em 1.2em;
  cursor: pointer;
  min-height: 2.75rem;
}

.button:hover {
  background: #26685a;
  border-color: #26685a;
}

.button[disabled] {
  opacity: 0.55;
  cursor: default;
}

@media (prefers-color-scheme: dark) {
  .button {
    color: #0f1f1a;
    background: #6cc3ae;
    border-color: #6cc3ae;
  }

  .button:hover {
    background: #85d1be;
    border-color: #85d1be;
  }
}

.copy-button {
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--leaf);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3em 0.75em;
  cursor: pointer;
  min-height: 2rem;
  white-space: nowrap;
}

.copy-button:hover {
  border-color: var(--leaf);
}

.copy-button.done {
  background: var(--wash);
  color: var(--ink);
}

.figure-actions {
  text-align: center;
  margin: -0.75rem 0 2rem;
  min-height: 2.75rem;
}

.lookup-status {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 auto 1.25rem;
  min-height: 1.7em;
}

.lookup-error {
  max-width: 34rem;
  margin: 0 auto 2rem;
  padding: 1.25rem 1.25rem 1.4rem;
  background: var(--paper);
  border: 2px solid var(--sun);
  border-radius: 12px;
  text-align: center;
}

.lookup-error p {
  margin-bottom: 0.9rem;
}

/* Home: sections */

.home-section {
  max-width: 46rem;
  margin: 3.5rem auto 0;
}

.section-title {
  display: inline;
  background: linear-gradient(transparent 62%, var(--marker) 62%);
  padding: 0 0.1em;
}

.section-head {
  margin: 0 0 1.25rem;
}

.section-head p {
  color: var(--muted);
  margin: 0.6rem 0 0;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.5rem 1rem;
}

@media (min-width: 720px) {
  .panel {
    padding: 0.75rem 1.75rem;
  }
}

.info-list {
  margin: 0;
}

.info-row {
  display: grid;
  grid-template-columns: 5.6em minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--line);
}

.info-row:last-child {
  border-bottom: 0;
}

@media (min-width: 720px) {
  .info-row {
    grid-template-columns: 7.5em minmax(0, 1fr);
  }
}

.info-row dt {
  color: var(--muted);
  font-size: 0.94rem;
}

.info-row dd {
  margin: 0;
  min-width: 0;
}

.info-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  font-weight: 600;
}

.info-value .value {
  overflow-wrap: anywhere;
}

.info-value .ip-value {
  font-family: var(--mono);
  font-size: 0.95em;
  overflow-wrap: break-word;
}

.info-hint {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
  margin-top: 0.2rem;
}

.info-note {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  font-family: var(--kai);
}

.info-note strong {
  color: var(--ink);
}

/* Chapter list styled like a textbook contents page */

.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.chapter-list li:first-child {
  padding-top: 0.25rem;
}

.chapter-list li:last-child {
  border-bottom: 0;
}

.chapter-link {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.chapter-num {
  flex: none;
  font-family: var(--kai);
  color: var(--leaf);
  font-weight: 700;
  min-width: 3.6em;
}

.chapter-title {
  font-weight: 700;
  font-size: 1.06rem;
}

.chapter-link:hover .chapter-title {
  text-decoration: underline;
  text-decoration-color: var(--sun);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.22em;
}

.chapter-leader {
  flex: 1 1 1.5rem;
  min-width: 1rem;
  border-bottom: 2px dotted var(--line);
  transform: translateY(-0.3em);
}

.chapter-time {
  flex: none;
  color: var(--muted);
  font-size: 0.88rem;
}

.chapter-summary {
  margin: 0.35rem 0 0 calc(3.6em + 0.75rem);
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.75;
}

@media (max-width: 480px) {
  .chapter-link {
    flex-wrap: wrap;
    gap: 0 0.6rem;
  }

  .chapter-num {
    min-width: 0;
  }

  .chapter-leader {
    display: none;
  }

  .chapter-time {
    width: 100%;
    order: 4;
  }

  .chapter-summary {
    margin-left: 0;
  }
}

/* FAQ */

.faq-list {
  border-top: 1px solid var(--line);
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary h3 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.6;
}

.faq-item summary::after {
  content: "+";
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1.5rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--leaf);
  font-weight: 700;
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-answer {
  padding: 0 0 1rem;
  color: var(--ink);
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* Inner pages */

.breadcrumb {
  padding-top: 1.25rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.4rem;
}

.breadcrumb li + li::before {
  content: "›";
  margin-right: 0.4rem;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
}

.page-header {
  max-width: 38em;
  padding: 1.75rem 0 0.5rem;
}

.page-header .lead,
.article-header .lead {
  color: var(--muted);
  font-size: 1.05em;
  margin: 0.85rem 0 0;
}

.chapter-tag {
  display: inline-block;
  font-family: var(--kai);
  font-weight: 700;
  color: var(--leaf);
  border: 1.5px solid var(--leaf);
  border-radius: 6px;
  padding: 0 0.55em;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.article-meta {
  margin: 1rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-top: 1.5rem;
}

.article-header {
  max-width: 38em;
}

.toc {
  margin: 1.75rem 0 0.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem 0.8rem;
  font-size: 0.92rem;
  line-height: 1.6;
}

.toc-title {
  font-family: var(--kai);
  font-weight: 700;
  margin: 0 0 0.4rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 0.28rem 0 0.28rem 0.7rem;
  border-left: 3px solid transparent;
}

.toc a:hover {
  color: var(--ink);
}

.toc a.current {
  color: var(--ink);
  font-weight: 700;
  border-left-color: var(--sun);
}

.article-body {
  max-width: 38em;
  min-width: 0;
}

.article-end {
  max-width: 38em;
}

@media (min-width: 1000px) {
  .article {
    grid-template-columns: 13.5rem minmax(0, 38em);
    column-gap: 3.5rem;
    justify-content: center;
    align-items: start;
  }

  .article-header,
  .article-body,
  .article-end {
    grid-column: 2;
  }

  .toc {
    grid-column: 1;
    grid-row: 1 / span 3;
    position: sticky;
    top: 1.5rem;
    margin: 0.5rem 0 0;
    background: transparent;
    border: 0;
    padding: 0;
  }
}

.article-body h2 {
  margin: 2.6em 0 0.7em;
  scroll-margin-top: 1.5rem;
}

.article-body h3 {
  margin: 1.8em 0 0.5em;
  scroll-margin-top: 1.5rem;
}

.article-body > h2:first-child {
  margin-top: 1.8em;
}

.article-body ul,
.article-body ol,
.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0 0 1.2em;
}

.article-body li,
.prose li {
  margin-bottom: 0.35em;
}

.article-body li::marker,
.prose li::marker {
  color: var(--leaf);
}

ol.steps {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
}

ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.4em;
  margin-bottom: 0.7em;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.18em;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  background: var(--wash);
  color: var(--leaf);
  font-weight: 700;
  font-size: 0.9em;
  line-height: 1.6em;
  text-align: center;
}

.note {
  margin: 1.6rem 0;
  padding: 1rem 1.15rem 0.3rem;
  background: var(--wash);
  border-left: 4px solid var(--sun);
  border-radius: 0 12px 12px 0;
}

.note-title {
  font-family: var(--kai);
  font-weight: 700;
  margin: 0 0 0.3rem;
}

.diagram {
  margin: 1.8rem 0;
}

.diagram-plate {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 0.5rem;
}

.diagram svg {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
  margin: 0 auto;
}

.diagram figcaption {
  margin-top: 0.7rem;
  text-align: center;
  font-family: var(--kai);
  font-size: 0.95rem;
  line-height: 1.7;
}

.diagram .figure-tag {
  font-size: 0.92em;
}

/* SVG figure parts, so diagrams follow the colour scheme */

.svg-box {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2;
}

.svg-soft {
  fill: var(--wash);
  stroke: none;
}

.svg-zone {
  fill: none;
  stroke: var(--leaf);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}

.svg-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.svg-faint {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.svg-leaf {
  fill: var(--leaf);
}

.svg-leaf-line {
  fill: none;
  stroke: var(--leaf);
  stroke-width: 2;
}

.svg-sun {
  fill: var(--sun);
}

.svg-ink {
  fill: var(--ink);
}

.svg-paper {
  fill: var(--paper);
}

.diagram text {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
}

.diagram .svg-small {
  font-size: 13px;
}

.diagram .svg-muted {
  fill: var(--muted);
}

.diagram .svg-mono {
  font-family: var(--mono);
}

.diagram .svg-bold {
  font-weight: 700;
}

.diagram .svg-on-sun {
  fill: #13322b;
}

.diagram .svg-on-leaf {
  fill: var(--paper);
}

/* Tables */

.table-wrap {
  margin: 1.6rem 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.9em;
  line-height: 1.65;
}

caption {
  caption-side: top;
  text-align: left;
  font-family: var(--kai);
  font-size: 1rem;
  padding: 0 0 0.55rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

thead th {
  background: var(--wash);
  font-weight: 700;
  white-space: nowrap;
}

thead th:first-child {
  border-top-left-radius: 11px;
}

thead th:last-child {
  border-top-right-radius: 11px;
}

tbody th {
  font-weight: 700;
  white-space: nowrap;
}

td code,
th code {
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  table {
    font-size: 0.84em;
  }

  th,
  td {
    padding: 0.55rem 0.6rem;
  }

  tbody th,
  thead th {
    white-space: normal;
  }

  tbody th {
    min-width: 5.5em;
  }
}

/* Chapter navigation */

.chapter-nav {
  display: grid;
  gap: 0.9rem;
  margin: 3rem 0 0;
}

@media (min-width: 720px) {
  .chapter-nav {
    grid-template-columns: 1fr 1fr;
  }
}

.chapter-nav a {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.6;
}

.chapter-nav a:hover {
  border-color: var(--leaf);
}

.chapter-nav .nav-label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.chapter-nav .nav-title {
  font-weight: 700;
}

.chapter-nav .next {
  text-align: right;
  grid-column: -2;
}

.back-home {
  margin: 1.5rem 0 0;
  padding: 1.1rem 1.25rem;
  border: 1px dashed var(--leaf);
  border-radius: 12px;
  font-size: 0.95rem;
}

.back-home p {
  margin: 0;
}

/* Directory, about, privacy */

.prose {
  max-width: 38em;
}

.prose h2 {
  margin: 2.4em 0 0.6em;
}

.directory {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  max-width: 46rem;
}

.directory > li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem 1.25rem 0.9rem;
  margin-bottom: 1rem;
}

.directory h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.75rem;
}

.directory h2 a {
  color: var(--ink);
  text-decoration-color: var(--line);
}

.directory h2 a:hover {
  text-decoration-color: var(--sun);
}

.directory .chapter-num {
  min-width: 0;
  font-size: 0.95rem;
}

.directory p {
  margin: 0 0 0.5rem;
}

.directory .covers {
  color: var(--muted);
  font-size: 0.9rem;
}

.directory .chapter-time {
  font-size: 0.84rem;
}

/* 404 */

.not-found {
  text-align: center;
  padding: 3rem 0 1rem;
}

.not-found .lead {
  color: var(--muted);
  max-width: 30em;
  margin: 0.75rem auto 0;
}

.not-found .ip-figure {
  max-width: 24rem;
  margin-top: 2rem;
}

.not-found .octets {
  max-width: 18rem;
}

.not-found-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button-quiet {
  color: var(--leaf);
  background: var(--paper);
  border: 2px solid var(--line);
}

.button-quiet:hover {
  background: var(--wash);
  border-color: var(--leaf);
}

@media (prefers-color-scheme: dark) {
  .button-quiet {
    color: var(--leaf);
    background: var(--paper);
    border-color: var(--line);
  }

  .button-quiet:hover {
    background: var(--wash);
    border-color: var(--leaf);
  }
}

a.button {
  text-decoration: none;
}

/* IPv6 test */

.tool-page .home-section {
  margin-left: 0;
}

.tool-page .home-section:first-of-type {
  margin-top: 1.5rem;
}

.verdict {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: center;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
}

.verdict[data-tone="pass"] {
  border-color: var(--leaf);
}

.verdict[data-tone="warn"],
.verdict[data-tone="fail"] {
  border-color: var(--sun);
}

.score {
  width: 5.2rem;
  height: 5.2rem;
  border-radius: 50%;
  border: 3px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.verdict[data-tone="pass"] .score {
  border-color: var(--leaf);
}

.verdict[data-tone="warn"] .score,
.verdict[data-tone="fail"] .score {
  border-color: var(--sun);
}

.score-value {
  font-family: var(--numeral);
  font-size: 2rem;
  font-weight: 700;
}

.score-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.verdict-title {
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
}

.verdict-text {
  margin: 0;
  color: var(--muted);
}

.verdict-actions {
  grid-column: 1 / -1;
  margin: 0;
}

.check-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  color: var(--muted);
  margin-right: 0.5rem;
  vertical-align: 0.1em;
}

[data-state="pass"] .check-badge {
  border-color: var(--leaf);
  color: var(--leaf);
}

[data-state="fail"] .check-badge {
  border-color: var(--sun);
  color: var(--ink);
  background: var(--marker);
}

.check-value {
  font-family: var(--mono);
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* Motion safety net */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
