:root {
  color-scheme: dark;
  --page-bg: #101416;
  --page-bg-soft: #161c1f;
  --panel: #1b2226;
  --panel-strong: #20292e;
  --line: #364349;
  --line-soft: #29343a;
  --text: #f4f7f8;
  --muted: #b5c1c6;
  --accent: #00e5ff;
  --accent-ink: #051518;
  --warm: #f2d06b;
  --danger: #ff9c8c;
  --content-width: 760px;
  --shell-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(0, 229, 255, 0.08), transparent 34rem),
    var(--page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 17px;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: #72f2ff;
}

button,
textarea {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 8px 12px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 4px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(16, 20, 22, 0.94);
}

.header-inner,
.site-footer-inner {
  width: min(calc(100% - 36px), var(--shell-width));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.brand-pao,
.brand-latin-pao {
  color: var(--accent);
}

.brand-latin {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  font-weight: 750;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: var(--accent);
}

.library-main,
.article-main {
  width: min(calc(100% - 36px), var(--shell-width));
  margin: 0 auto;
}

.library-main {
  padding: 58px 0 84px;
}

.library-hero {
  max-width: 820px;
  padding: 20px 0 46px;
}

.eyebrow,
.article-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.library-hero h1,
.article-hero h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 66px);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.library-deck,
.article-deck {
  max-width: 760px;
  margin: 22px 0 0;
  color: #d5dde0;
  font-size: clamp(19px, 2.5vw, 24px);
  line-height: 1.65;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 22px;
}

.article-card {
  display: flex;
  min-height: 290px;
  flex-direction: column;
  padding: 28px;
  color: var(--text);
  background: linear-gradient(145deg, var(--panel-strong), #171d20);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: 8px;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease;
}

.article-card:hover {
  color: var(--text);
  border-color: #5a6b72;
  transform: translateY(-3px);
}

.card-category {
  color: var(--warm);
  font-size: 14px;
  font-weight: 800;
}

.article-card h2 {
  margin: 16px 0 14px;
  font-size: clamp(25px, 4vw, 33px);
  line-height: 1.35;
}

.article-card p {
  margin: 0 0 26px;
  color: var(--muted);
}

.card-link {
  margin-top: auto;
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

.library-note {
  max-width: 760px;
  margin-top: 34px;
  padding: 22px 24px;
  color: var(--muted);
  border-left: 4px solid var(--warm);
  background: rgba(242, 208, 107, 0.06);
}

.article-main {
  padding: 48px 0 86px;
}

.breadcrumbs {
  max-width: var(--content-width);
  margin: 0 auto 34px;
  color: #8fa0a8;
  font-size: 14px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 6px;
  color: #63737a;
}

.breadcrumbs a {
  color: #a8b5ba;
}

.article-hero,
.article-body,
.article-feedback,
.article-footer-nav {
  max-width: var(--content-width);
  margin-right: auto;
  margin-left: auto;
}

.article-hero {
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 24px 0 0;
  color: #98a8ae;
  font-size: 14px;
}

.article-body {
  padding-top: 34px;
}

.article-body h2 {
  margin: 56px 0 18px;
  font-size: clamp(28px, 4.5vw, 38px);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.article-body h3 {
  margin: 34px 0 12px;
  font-size: 23px;
  line-height: 1.4;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin-top: 0;
  margin-bottom: 24px;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35em;
}

.article-body li + li {
  margin-top: 9px;
}

.article-body strong {
  color: #ffffff;
}

.quick-answer {
  margin: 6px 0 38px;
  padding: 24px 26px;
  background: linear-gradient(145deg, rgba(0, 229, 255, 0.1), rgba(0, 229, 255, 0.03));
  border: 1px solid rgba(0, 229, 255, 0.36);
  border-radius: 7px;
}

.quick-answer h2 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 20px;
}

.quick-answer ul {
  margin-bottom: 0;
}

.formula-card {
  display: grid;
  gap: 12px;
  margin: 28px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--warm);
  border-radius: 7px;
  background: #0d1113;
}

.formula-line {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  align-items: baseline;
}

.formula-distance {
  color: var(--warm);
  font-weight: 850;
}

.formula-math {
  color: #edf3f5;
  font-variant-numeric: tabular-nums;
}

.example-box,
.track-note,
.source-note {
  margin: 28px 0;
  padding: 22px 24px;
  border-left: 4px solid var(--accent);
  background: var(--page-bg-soft);
}

.example-box h3,
.track-note h3,
.source-note h2 {
  margin-top: 0;
}

.example-box p:last-child,
.track-note p:last-child,
.source-note p:last-child {
  margin-bottom: 0;
}

.table-scroll {
  overflow-x: auto;
  margin: 26px 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  -webkit-overflow-scrolling: touch;
}

.pace-table {
  width: 100%;
  min-width: 690px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.pace-table th,
.pace-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  white-space: nowrap;
}

.pace-table th:first-child,
.pace-table td:first-child {
  position: sticky;
  left: 0;
  text-align: left;
  background: #171e21;
}

.pace-table thead th {
  color: var(--warm);
  background: #171e21;
  font-size: 14px;
}

.pace-table tbody tr:last-child td {
  border-bottom: 0;
}

.pace-table tbody tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.018);
}

.pace-table tbody tr:nth-child(even) td:first-child {
  background-color: #1a2226;
}

.table-caption {
  color: #8fa0a8;
  font-size: 14px;
}

.steps {
  counter-reset: article-step;
  padding: 0 !important;
  list-style: none;
}

.steps li {
  position: relative;
  min-height: 48px;
  padding-left: 62px;
}

.steps li::before {
  counter-increment: article-step;
  content: counter(article-step);
  position: absolute;
  top: 2px;
  left: 0;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 50%;
  font-weight: 900;
  line-height: 1;
}

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

.faq-list details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  cursor: pointer;
  color: #ffffff;
  font-weight: 800;
}

.faq-list details p {
  margin: 14px 0 0;
  color: var(--muted);
}

.article-feedback {
  margin-top: 58px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.article-feedback h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.article-feedback > p {
  margin: 0;
  color: var(--muted);
}

.feedback-actions,
.feedback-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.feedback-button {
  min-height: 44px;
  padding: 9px 17px;
  color: var(--text);
  background: #13191c;
  border: 1px solid #53636a;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 750;
}

.feedback-button:hover,
.feedback-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.feedback-button.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.feedback-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.feedback-form {
  margin-top: 20px;
}

.feedback-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 750;
}

.feedback-form textarea {
  width: 100%;
  min-height: 112px;
  padding: 12px 14px;
  resize: vertical;
  color: var(--text);
  background: #0f1416;
  border: 1px solid #53636a;
  border-radius: 5px;
}

.feedback-form textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(0, 229, 255, 0.18);
}

.feedback-status {
  min-height: 1.7em;
  margin-top: 14px !important;
  color: var(--accent) !important;
}

.feedback-status[data-state="error"] {
  color: var(--danger) !important;
}

.article-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 28px;
  font-size: 15px;
}

.site-footer {
  border-top: 1px solid var(--line-soft);
  background: #0b0f11;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 28px;
  padding: 26px 0;
  color: #89999f;
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: #b2bec3;
}

[hidden] {
  display: none !important;
}

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

  .header-inner,
  .site-footer-inner,
  .library-main,
  .article-main {
    width: min(calc(100% - 28px), var(--shell-width));
  }

  .header-inner {
    min-height: 64px;
  }

  .brand-latin,
  .site-nav a:first-child {
    display: none;
  }

  .site-nav {
    margin-right: 34px;
  }

  .site-header .pbd-account-standalone {
    right: 12px;
  }

  .library-main,
  .article-main {
    padding-top: 34px;
  }

  .library-hero h1,
  .article-hero h1 {
    font-size: clamp(36px, 11vw, 50px);
  }

  .article-card,
  .article-feedback {
    padding: 22px;
  }

  .formula-line {
    grid-template-columns: 82px 1fr;
    gap: 10px;
  }

  .article-body h2 {
    margin-top: 46px;
  }

  .quick-answer,
  .formula-card,
  .example-box,
  .track-note,
  .source-note {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .article-card {
    transition: none;
  }
}
