:root {
  --text: #1f2933;
  --muted: #5b6776;
  --accent: #1f5f8b;
  --accent-soft: #eaf1f8;
  --head-bg: #dce6f1;
  --line: #d9e0e7;
  --side-bg: #f5f7f9;
  --sidebar-w: 19rem;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 17px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

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

:focus-visible {
  outline: 3px solid #e8a317;
  outline-offset: 2px;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.site-head {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--side-bg);
  border-right: 1px solid var(--line);
  padding: 2rem 1.25rem 2rem 1.5rem;
}

.brand {
  margin: 0 0 2rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--accent);
}

.menu-btn { display: none; }

.nav-group + .nav-group { margin-top: 1.75rem; }

.group-label {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

.nav-list a {
  display: block;
  padding: 0.55rem 0.75rem;
  margin: 0.15rem 0;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.5;
}

.nav-list a:hover { background: #e9eef3; }

.nav-list a[aria-current="page"] {
  background: #fff;
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.08);
}

.content { padding: 3rem 2.5rem 5rem; }

.not-found { padding: 3rem 1.5rem; }
.not-found .brand { margin: 0; }

.report { max-width: 46em; margin: 0 auto; }
.report:focus { outline: none; }

.doc-header {
  margin: 0 0 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.report h1 {
  margin: 0 0 1.5rem;
  font-size: 1.9rem;
  line-height: 1.4;
}

.report h2 {
  margin: 2.75rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--line);
  font-size: 1.4rem;
  line-height: 1.5;
}

.report h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--accent);
}

.report p { margin: 0 0 1.1rem; }

.summary {
  margin: 0 0 1.75rem;
  padding: 1rem 1.25rem 0.1rem;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
}

.report .info {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.report .info strong { color: var(--text); }

.report .example {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  background: #f7f7f2;
  border-left: 3px solid #b8a45a;
  border-radius: 0 6px 6px 0;
  font-size: 0.97rem;
}

figure { margin: 2rem 0; padding: 0; }

figcaption {
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 0.6rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  line-height: 1.6;
}

th, td {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  min-width: 7em;
}

th { background: var(--head-bg); font-weight: 700; }

.flow td { text-align: center; vertical-align: middle; }
.flow td.node { background: var(--head-bg); font-weight: 700; min-width: 9em; }
.flow td.arrow { min-width: 0; width: 2.5em; border-left: 0; border-right: 0; color: var(--muted); }

.report .source {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 767px) {
  body { font-size: 16px; }

  .layout { display: block; }

  .site-head {
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0;
  }

  html.js .site-head {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .head-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
  }

  .brand { margin: 0; font-size: 0.9rem; }

  html.js .menu-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0 1rem;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: #fff;
    color: var(--accent);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
  }

  html.js .menu-btn[aria-expanded="true"] { background: var(--accent); color: #fff; }

  .site-nav { padding: 0.5rem 1rem 1.25rem; }

  html.js .site-nav {
    display: none;
    max-height: calc(100vh - 4.5rem);
    overflow-y: auto;
    border-top: 1px solid var(--line);
  }

  html.js .site-nav.open { display: block; }

  .nav-list a { padding: 0.75rem 0.75rem; }

  .content { padding: 1.75rem 1rem 4rem; }

  .report h1 { font-size: 1.5rem; }
  .report h2 { font-size: 1.25rem; margin-top: 2.25rem; }
}

@media print {
  .site-head { display: none; }
  .layout { display: block; }
  .content { padding: 0; }
  .report { max-width: none; }
  .table-wrap { overflow: visible; }
  figure, .summary, .example, table { break-inside: avoid; }
  body { font-size: 11pt; }
}
