:root {
  --s5-ink: #18211d;
  --s5-muted: #64736b;
  --s5-paper: #fffdf7;
  --s5-line: rgba(24, 33, 29, 0.14);
  --s5-green: #0b7651;
  --s5-red: #bf332a;
  --s5-gold: #e1b84a;
  --s5-blue: #1f6fb2;
  --s5-shadow: 0 22px 55px rgba(24, 33, 29, 0.14);
  --s5-radius: 8px;

  /* Type scale */
  --s5-fs-xs: clamp(0.7rem, 0.66rem + 0.2vw, 0.78rem);
  --s5-fs-sm: clamp(0.82rem, 0.76rem + 0.3vw, 0.95rem);
  --s5-fs-base: clamp(1rem, 0.94rem + 0.3vw, 1.1rem);
  --s5-fs-md: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  --s5-fs-lg: clamp(1.4rem, 1.1rem + 1.5vw, 2.2rem);
  --s5-fs-xl: clamp(1.8rem, 1.3rem + 2.5vw, 3.2rem);
  --s5-fs-2xl: clamp(2.4rem, 1.6rem + 4vw, 5rem);
  --s5-fs-hero: clamp(2.8rem, 1.8rem + 5vw, 5.8rem);

  /* Spacing scale */
  --s5-sp-xs: clamp(4px, 0.4vw, 8px);
  --s5-sp-sm: clamp(8px, 1vw, 14px);
  --s5-sp-md: clamp(14px, 2vw, 28px);
  --s5-sp-lg: clamp(28px, 3.5vw, 56px);
  --s5-sp-xl: clamp(42px, 5vw, 80px);
  --s5-sp-2xl: clamp(56px, 7vw, 110px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.s5-body {
  margin: 0;
  color: var(--s5-ink);
  background:
    linear-gradient(90deg, rgba(15, 138, 95, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #fffdf7 0%, #f4f8f5 38%, #ffffff 100%);
  background-size: 72px 72px, auto;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
  line-height: 1.7;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
.s5-skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1000;
  padding: .7rem 1rem;
  background: var(--s5-ink);
  color: #fff;
}
.s5-skip:focus { top: 1rem; }

.s5-masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 253, 247, 0.94);
  border-bottom: 1px solid var(--s5-line);
  backdrop-filter: blur(18px);
}
.s5-topline {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px clamp(18px, 4vw, 34px) 10px;
}
.s5-brand, .s5-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: 0;
}
.s5-brand img { border-radius: 50%; border: 2px solid var(--s5-green); }
.s5-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 34px) 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.s5-nav a {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--s5-muted);
  font-size: .95rem;
  font-weight: 700;
}
.s5-nav a:hover, .s5-nav a.s5-active {
  color: var(--s5-ink);
  background: #fff;
  border-color: var(--s5-line);
}
.s5-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--s5-line);
  border-radius: 8px;
  background: #fff;
}
.s5-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--s5-ink);
}

.s5-main { overflow: clip; }
.s5-hero, .s5-page-hero, .s5-section {
  max-width: 1180px;
  margin: 0 auto;
  padding-left: clamp(18px, 4vw, 34px);
  padding-right: clamp(18px, 4vw, 34px);
}
.s5-hero {
  min-height: calc(100vh - 110px);
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, .98fr);
  gap: clamp(28px, 6vw, 78px);
  align-items: center;
  padding-top: 40px;
  padding-bottom: 58px;
}
.s5-hero-copy { position: relative; }
.s5-kicker {
  margin: 0 0 12px;
  color: var(--s5-green);
  font-size: .78rem;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .08em;
}
h1, h2, h3 {
  margin: 0;
  font-family: "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  line-height: 1.12;
  letter-spacing: 0;
}
h1 { font-size: clamp(2.6rem, 7vw, 5.8rem); max-width: 900px; }
h2 { font-size: clamp(1.8rem, 4vw, 3.4rem); }
h3 { font-size: 1.2rem; }
p { color: var(--s5-muted); }
.s5-hero p { max-width: 680px; font-size: 1.08rem; }
.s5-hero-actions, .s5-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.s5-btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 900;
  border: 1px solid var(--s5-line);
}
.s5-btn-primary { background: var(--s5-green); color: #fff; border-color: var(--s5-green); }
.s5-btn-secondary { background: #fff; color: var(--s5-ink); }

.s5-ledger-stage { position: relative; }
.s5-stage-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--s5-line);
  border-radius: var(--s5-radius);
  box-shadow: var(--s5-shadow);
}
.s5-ledger-card {
  position: absolute;
  right: -18px;
  bottom: 24px;
  width: min(310px, 78%);
  padding: 18px;
  background: #fff;
  border: 1px solid var(--s5-line);
  border-left: 7px solid var(--s5-red);
  border-radius: var(--s5-radius);
  box-shadow: var(--s5-shadow);
}
.s5-ledger-card span, .s5-dock-card span, .s5-step span, .s5-lane-index {
  color: var(--s5-red);
  font-weight: 900;
  font-size: .82rem;
}
.s5-ledger-card strong { display: block; font-family: "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif; font-size: 1.25rem; }
.s5-mini-action {
  border: 0;
  background: var(--s5-gold);
  color: var(--s5-ink);
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 900;
  cursor: pointer;
}

.s5-signal-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--s5-line);
  border: 1px solid var(--s5-line);
  border-radius: var(--s5-radius);
  overflow: hidden;
  margin-bottom: 34px;
}
.s5-signal-strip div { padding: 22px; background: #fff; }
.s5-signal-strip span { display: block; font: 900 2rem "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif; color: var(--s5-green); }
.s5-signal-strip p { margin: 2px 0 0; }

.s5-section { padding-top: 58px; padding-bottom: 58px; }
.s5-section-head {
  display: grid;
  grid-template-columns: minmax(0, .78fr) minmax(260px, .42fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 26px;
}
.s5-section-head p:last-child { margin: 0; }
.s5-lane-grid, .s5-dock-grid, .s5-article-grid, .s5-glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.s5-lane-card, .s5-dock-card, .s5-article-card, .s5-info-panel, .s5-tool-box, .s5-empty-state, .s5-planner, .s5-step, .s5-glossary-grid article {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--s5-line);
  border-radius: var(--s5-radius);
  box-shadow: 0 12px 28px rgba(24, 33, 29, .07);
}
.s5-lane-card {
  position: relative;
  min-height: 420px;
  overflow: hidden;
}
.s5-lane-card img, .s5-article-img img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.s5-lane-card h3, .s5-lane-card p, .s5-lane-card .s5-card-link, .s5-lane-index { margin-left: 18px; margin-right: 18px; }
.s5-lane-index { display: block; margin-top: 18px; }
.s5-card-link { color: var(--s5-green); font-weight: 900; }

.s5-compare-band {
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  gap: 22px;
  align-items: stretch;
}
.s5-step-rail { display: grid; gap: 14px; }
.s5-step { padding: 20px; }
.s5-step:nth-child(2) { border-left: 6px solid var(--s5-blue); }
.s5-step:nth-child(3) { border-left: 6px solid var(--s5-red); }

.s5-planner { padding: 18px; }
.s5-tab-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.s5-tab-btn {
  border: 1px solid var(--s5-line);
  background: #fff;
  color: var(--s5-muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 900;
}
.s5-tab-btn.s5-active { background: var(--s5-ink); color: #fff; }
.s5-tab-panel { padding: 18px; background: #f7fbf8; border-radius: var(--s5-radius); }

.s5-dock-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.s5-dock-card { padding: 20px; min-height: 210px; border-top: 5px solid var(--s5-green); }
.s5-dock-card:nth-child(2) { border-top-color: var(--s5-gold); }
.s5-dock-card:nth-child(3) { border-top-color: var(--s5-blue); }
.s5-dock-card:nth-child(4) { border-top-color: var(--s5-red); }
.s5-author-band, .s5-page-hero {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(260px, .42fr);
  gap: 28px;
  align-items: center;
}
.s5-author-band img, .s5-page-hero img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--s5-radius);
  border: 1px solid var(--s5-line);
}
.s5-author-band > img { aspect-ratio: 1; max-width: 260px; }
.s5-role { color: var(--s5-green); font-weight: 900; }

.s5-page-hero { padding-top: 44px; padding-bottom: 34px; }
.s5-page-hero h1 { font-size: clamp(2.2rem, 5.8vw, 4.8rem); }
.s5-two-col, .s5-contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.s5-contact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.s5-info-panel, .s5-tool-box, .s5-empty-state { padding: 22px; }
.s5-link-stack { display: grid; gap: 10px; }
.s5-link-stack a, .s5-search-results a {
  padding: 12px;
  border: 1px solid var(--s5-line);
  border-radius: var(--s5-radius);
  background: #fff;
}

.s5-tool-box {
  display: grid;
  gap: 16px;
  max-width: 760px;
}
.s5-tool-box label { display: grid; gap: 8px; font-weight: 800; }
.s5-tool-box input, .s5-tool-box select, .s5-tool-box textarea, .s5-search-box input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--s5-line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.s5-tool-result, .s5-note-list {
  display: block;
  padding: 14px;
  background: #f7fbf8;
  border: 1px dashed rgba(15, 138, 95, .35);
  border-radius: var(--s5-radius);
  color: var(--s5-ink);
}
.s5-note-list { display: grid; gap: 10px; }
.s5-note-list div { padding: 12px; background: #fff; border: 1px solid var(--s5-line); border-radius: var(--s5-radius); }
.s5-note-list button { border: 0; background: var(--s5-red); color: #fff; border-radius: 6px; padding: 6px 10px; }

.s5-accordion { display: grid; gap: 8px; }
.s5-acc-trigger {
  width: 100%;
  text-align: left;
  border: 1px solid var(--s5-line);
  background: #fff;
  border-radius: var(--s5-radius);
  padding: 14px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.s5-acc-panel {
  display: none;
  padding: 0 14px 12px;
  border-left: 3px solid var(--s5-green);
}
.s5-acc-trigger.s5-open + .s5-acc-panel { display: block; }

.s5-article-card { overflow: hidden; }
.s5-article-card > div { padding: 18px; }
.s5-chip {
  display: inline-flex;
  padding: 5px 9px;
  background: rgba(225, 184, 74, .25);
  color: var(--s5-ink);
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 900;
}
.s5-empty-state { text-align: center; }
.s5-empty-pulse {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--s5-gold);
  box-shadow: 0 0 0 10px rgba(225, 184, 74, .16);
}
.s5-prose { max-width: 820px; margin: 0 auto; }
.s5-article-page { max-width: 980px; margin: 0 auto; padding: 44px clamp(18px, 4vw, 34px); }
.s5-article-hero img { width: 100%; border-radius: var(--s5-radius); margin-top: 22px; }
.s5-glossary-grid article { padding: 18px; }
.s5-glossary-grid span { font-weight: 900; color: var(--s5-green); }
.s5-search-box { display: flex; gap: 12px; align-items: end; }
.s5-search-box label { flex: 1; font-weight: 900; }
.s5-search-results { display: grid; gap: 10px; margin-top: 18px; }

.s5-reveal { opacity: 1; transform: none; transition: transform .35s ease; }
.s5-reveal.s5-visible { transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .s5-reveal { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 900px) {
  .s5-menu-toggle { display: block; }
  .s5-nav { display: none; padding-top: 8px; }
  .s5-nav.s5-open { display: flex; }
  .s5-hero, .s5-page-hero, .s5-author-band, .s5-compare-band, .s5-section-head, .s5-two-col, .s5-contact-grid {
    grid-template-columns: 1fr;
  }
  .s5-signal-strip, .s5-lane-grid, .s5-dock-grid, .s5-article-grid, .s5-glossary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .s5-hero { min-height: auto; }
}

@media (max-width: 620px) {
  .s5-signal-strip, .s5-lane-grid, .s5-dock-grid, .s5-article-grid, .s5-glossary-grid {
    grid-template-columns: 1fr;
  }
  .s5-search-box { display: grid; }
  .s5-ledger-card { position: static; width: 100%; margin-top: 12px; }
  h1 { font-size: clamp(2.25rem, 14vw, 3.7rem); }
}

/* Sport539 magazine override */
.s5-masthead {
  position: relative;
  background: #fffdf7;
  border-bottom: 4px double var(--s5-ink);
  backdrop-filter: none;
}
.s5-topline {
  max-width: 1240px;
  padding-top: 18px;
  padding-bottom: 14px;
  justify-items: center;
}
.s5-brand {
  justify-self: center;
  font-size: clamp(1.9rem, 5vw, 4rem);
  gap: 16px;
}
.s5-brand picture,
.s5-brand img {
  width: 58px;
  height: 58px;
}
.s5-brand picture {
  display: block;
}
.s5-brand img {
  border-radius: 0;
  border: 2px solid var(--s5-ink);
  padding: 4px;
  background: #fff;
}
.s5-nav {
  justify-content: center;
  border-top: 1px solid var(--s5-line);
  padding-top: 10px;
  padding-bottom: 12px;
}
.s5-nav a {
  border-radius: 0;
  text-transform: none;
  color: var(--s5-ink);
  background: transparent;
}
.s5-nav a.s5-active,
.s5-nav a:hover {
  background: var(--s5-ink);
  color: #fff;
}

.s5-frontpage,
.s5-inner-cover,
.s5-stat-ledger,
.s5-section {
  max-width: 1240px;
  margin: 0 auto;
  padding-left: clamp(16px, 4vw, 38px);
  padding-right: clamp(16px, 4vw, 38px);
}
.s5-frontpage {
  padding-top: 24px;
  padding-bottom: 28px;
}
.s5-edition-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--s5-ink);
  border-bottom: 1px solid var(--s5-ink);
  color: var(--s5-ink);
  font-size: .72rem;
  font-weight: 900;
}
.s5-edition-line span:nth-child(2) { text-align: center; color: var(--s5-red); }
.s5-edition-line span:last-child { text-align: right; }
.s5-cover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .82fr);
  grid-template-areas:
    "copy image"
    "note image";
  gap: 22px;
  padding-top: 24px;
}
.s5-cover-copy { grid-area: copy; border-bottom: 6px solid var(--s5-ink); padding-bottom: 22px; }
.s5-cover-copy h1 {
  max-width: 820px;
  font-size: clamp(3.1rem, 8.2vw, 7.7rem);
  line-height: .98;
}
.s5-cover-copy p { max-width: 760px; color: #35453d; }
.s5-cover-image {
  grid-area: image;
  margin: 0;
  border-left: 1px solid var(--s5-line);
  padding-left: 22px;
}
.s5-cover-image picture,
.s5-inner-cover-grid picture,
.s5-page-hero picture {
  display: block;
  width: 100%;
}
.s5-cover-image img,
.s5-inner-cover-grid img {
  width: 100%;
  min-height: 420px;
  object-fit: cover;
  border-radius: 0;
  border: 1px solid var(--s5-ink);
  box-shadow: none;
}
.s5-cover-image figcaption {
  margin-top: 10px;
  color: var(--s5-muted);
  font-size: .92rem;
}
.s5-ledger-note {
  grid-area: note;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--s5-line);
  border-bottom: 1px solid var(--s5-line);
}
.s5-ledger-note span,
.s5-contact-ledger span,
.s5-rule-column span {
  color: var(--s5-red);
  font-weight: 900;
}
.s5-ledger-note strong {
  font: 700 clamp(1.05rem, 2vw, 1.4rem) "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
}

.s5-stat-ledger {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--s5-ink);
  border-bottom: 1px solid var(--s5-ink);
  margin-top: 18px;
}
.s5-stat-ledger div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 18px 16px;
  border-right: 1px solid var(--s5-line);
}
.s5-stat-ledger div:last-child { border-right: 0; }
.s5-stat-ledger b {
  font: 900 clamp(2rem, 5vw, 4rem) "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color: var(--s5-green);
}
.s5-stat-ledger span { color: var(--s5-muted); font-weight: 900; }

.s5-editorial-heading {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(260px, .5fr);
  gap: 30px;
  align-items: end;
  border-bottom: 1px solid var(--s5-ink);
  padding-bottom: 18px;
  margin-bottom: 0;
}
.s5-editorial-heading h2 {
  font-size: clamp(2rem, 5.6vw, 5rem);
  line-height: 1;
}
.s5-index-list {
  border-bottom: 1px solid var(--s5-ink);
}
.s5-index-row {
  display: grid;
  grid-template-columns: 70px 150px minmax(0, 1fr) 70px;
  gap: 20px;
  align-items: center;
  padding: 18px 0;
  border-top: 1px solid var(--s5-line);
}
.s5-index-row picture,
.s5-index-row img,
.s5-row-thumb {
  width: 150px;
  height: 96px;
  border: 1px solid var(--s5-ink);
}
.s5-index-row picture {
  display: block;
}
.s5-index-row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.s5-row-thumb {
  display: block;
  background-color: #fff;
  background-position: center;
  background-size: cover;
}
.s5-row-num {
  font: 900 2.2rem "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color: var(--s5-green);
}
.s5-index-row small {
  color: var(--s5-red);
  font-weight: 900;
  text-transform: uppercase;
}
.s5-index-row h3 { font-size: clamp(1.35rem, 2.6vw, 2.2rem); }
.s5-index-row p { margin: 5px 0 0; }
.s5-index-row b { justify-self: end; color: var(--s5-green); }

.s5-split-feature {
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.s5-feature-copy {
  position: sticky;
  top: 18px;
  border-top: 6px solid var(--s5-red);
  padding-top: 16px;
}
.s5-rule-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--s5-ink);
  background: #fff;
}
.s5-rule-column {
  padding: 22px;
  border-right: 1px solid var(--s5-line);
}
.s5-rule-column:last-child { border-right: 0; }

.s5-planner,
.s5-tool-box,
.s5-info-panel,
.s5-article-card,
.s5-empty-state,
.s5-empty-news,
.s5-glossary-grid article {
  border-radius: 0;
  box-shadow: none;
  border-color: var(--s5-ink);
}
.s5-planner {
  margin-top: 20px;
  background: #fff;
  border: 1px solid var(--s5-ink);
}
.s5-tab-btn { border-radius: 0; }
.s5-tab-panel { border-radius: 0; background: #fff9e8; border-left: 6px solid var(--s5-gold); }

.s5-empty-news {
  margin-top: 20px;
  padding: clamp(24px, 5vw, 54px);
  border-top: 1px solid var(--s5-ink);
  border-bottom: 1px solid var(--s5-ink);
  background: linear-gradient(90deg, rgba(225, 184, 74, .16), transparent);
}
.s5-empty-news span { color: var(--s5-red); font-weight: 900; }
.s5-empty-news h3 { font-size: clamp(1.7rem, 4vw, 3rem); }

.s5-tool-table {
  margin-top: 18px;
  border-top: 1px solid var(--s5-ink);
}
.s5-tool-row {
  display: grid;
  grid-template-columns: 70px minmax(240px, .55fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--s5-line);
}
.s5-tool-row span {
  font: 900 2rem "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color: var(--s5-red);
}
.s5-tool-row h3 { font-size: clamp(1.2rem, 2.4vw, 2rem); }
.s5-tool-row p { margin: 0; }

.s5-editor-card {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  border-top: 4px double var(--s5-ink);
  border-bottom: 4px double var(--s5-ink);
}
.s5-editor-card img,
.s5-author-portrait {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 3px solid var(--s5-ink);
}
.s5-editor-card img {
  object-fit: cover;
}
.s5-author-portrait {
  background: #fff image-set(url("/images/author.webp") type("image/webp"), url("/images/author.jpg") type("image/jpeg")) center / cover no-repeat;
}

.s5-inner-cover {
  padding-top: 24px;
  padding-bottom: 28px;
}
.s5-inner-cover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .72fr);
  gap: 24px;
  align-items: stretch;
  padding-top: 24px;
}
.s5-inner-cover h1 {
  max-width: 800px;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: .98;
  border-bottom: 6px solid var(--s5-ink);
  padding-bottom: 16px;
}
.s5-inner-cover p { max-width: 720px; }
.s5-editorial-spread {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(250px, .62fr);
  gap: 0;
  border-top: 1px solid var(--s5-ink);
  border-bottom: 1px solid var(--s5-ink);
}
.s5-editorial-spread article {
  padding: clamp(22px, 4vw, 42px);
  border-right: 1px solid var(--s5-line);
  border-bottom: 1px solid var(--s5-line);
}
.s5-editorial-spread article:last-child { border-bottom: 0; }
.s5-large-note {
  grid-row: span 2;
  background: #fff;
}
.s5-editorial-spread span {
  color: var(--s5-red);
  font-weight: 900;
}
.s5-contact-ledger {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--s5-ink);
  border-bottom: 1px solid var(--s5-ink);
  gap: 0;
}
.s5-contact-ledger article {
  padding: clamp(20px, 4vw, 36px);
  border-right: 1px solid var(--s5-line);
}
.s5-contact-ledger article:last-child { border-right: 0; }

.s5-footer {
  max-width: 1240px;
  margin: 58px auto 0;
  padding: 0 clamp(16px, 4vw, 38px) 28px;
  color: var(--s5-ink);
}
.s5-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr) minmax(220px, .65fr);
  gap: clamp(22px, 5vw, 54px);
  padding: 26px 0;
  border-top: 4px double var(--s5-ink);
  border-bottom: 1px solid var(--s5-ink);
}
.s5-footer-brand {
  font-size: clamp(1.45rem, 3vw, 2.4rem);
  line-height: 1.1;
}
.s5-footer p {
  max-width: 480px;
  margin: 14px 0 0;
  color: #53645c;
}
.s5-footer-links {
  display: grid;
  align-content: start;
  gap: 0;
}
.s5-footer-links::before {
  content: attr(aria-label);
  display: block;
  margin-bottom: 10px;
  color: var(--s5-red);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}
.s5-footer-links a {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 0;
  border-top: 1px solid var(--s5-line);
  font-weight: 800;
  line-height: 1.35;
}
.s5-footer-links a:hover {
  color: var(--s5-green);
}
.s5-footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 14px;
  color: var(--s5-muted);
  font-size: .92rem;
}

@media (max-width: 920px) {
  .s5-topline { justify-items: start; }
  .s5-brand { justify-self: start; font-size: clamp(1.6rem, 8vw, 2.4rem); }
  .s5-cover-grid,
  .s5-inner-cover-grid,
  .s5-split-feature,
  .s5-editorial-heading,
  .s5-editor-card {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }
  .s5-cover-copy,
  .s5-cover-image,
  .s5-ledger-note { grid-area: auto; }
  .s5-cover-image { border-left: 0; padding-left: 0; }
  .s5-rule-columns,
  .s5-contact-ledger,
  .s5-stat-ledger,
  .s5-footer-inner {
    grid-template-columns: 1fr;
  }
  .s5-stat-ledger div,
  .s5-rule-column,
  .s5-contact-ledger article { border-right: 0; border-bottom: 1px solid var(--s5-line); }
  .s5-index-row { grid-template-columns: 54px 110px minmax(0, 1fr); }
  .s5-index-row b { display: none; }
  .s5-index-row picture,
  .s5-index-row img,
  .s5-row-thumb { width: 110px; height: 84px; }
  .s5-tool-row { grid-template-columns: 54px minmax(0, 1fr); }
  .s5-tool-row p { grid-column: 2; }
  .s5-footer-bottom { display: grid; }
}

@media (max-width: 620px) {
  .s5-edition-line { grid-template-columns: 1fr; }
  .s5-edition-line span,
  .s5-edition-line span:nth-child(2),
  .s5-edition-line span:last-child { text-align: left; }
  .s5-cover-copy h1,
  .s5-inner-cover h1 { font-size: clamp(2.55rem, 16vw, 4.2rem); }
  .s5-cover-image img,
  .s5-inner-cover-grid img { min-height: 300px; }
  .s5-ledger-note { grid-template-columns: 1fr; }
  .s5-index-row { grid-template-columns: 1fr; }
  .s5-index-row picture,
  .s5-index-row img,
  .s5-row-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .s5-editorial-spread { grid-template-columns: 1fr; }
}

/* Article prose body */
.s5-prose h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 2.2em 0 .7em; padding-bottom: .4em; border-bottom: 2px solid var(--s5-line); }
.s5-prose h3 { font-size: 1.2rem; margin: 1.8em 0 .5em; }
.s5-prose h4 { font-size: 1.05rem; margin: 1.4em 0 .4em; color: var(--s5-ink); }
.s5-prose p { margin: 0 0 1.2em; color: var(--s5-ink); }
.s5-prose a { color: var(--s5-green); text-decoration: underline; text-underline-offset: 3px; }
.s5-prose a:hover { color: var(--s5-ink); }
.s5-prose ul, .s5-prose ol { margin: 0 0 1.2em; padding-left: 1.6em; color: var(--s5-ink); }
.s5-prose li { margin-bottom: .5em; }
.s5-prose blockquote { margin: 1.6em 0; padding: 16px 20px; border-left: 5px solid var(--s5-green); background: rgba(11, 118, 81, .06); border-radius: 0 var(--s5-radius) var(--s5-radius) 0; }
.s5-prose blockquote p { margin: 0; }
.s5-prose code { font-family: "Courier New", monospace; font-size: .88em; padding: 2px 6px; background: rgba(24, 33, 29, .08); border-radius: 4px; }
.s5-prose pre { background: #1a2421; color: #e2e8e5; padding: 18px 22px; border-radius: var(--s5-radius); overflow-x: auto; margin: 1.4em 0; }
.s5-prose pre code { background: none; padding: 0; color: inherit; }
.s5-prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .95rem; }
.s5-prose th { background: var(--s5-green); color: #fff; padding: 10px 14px; text-align: left; }
.s5-prose td { padding: 9px 14px; border-bottom: 1px solid var(--s5-line); }
.s5-prose tr:nth-child(even) td { background: rgba(11, 118, 81, .04); }

/* Article page FAQ */
.s5-article-faqs { max-width: 820px; margin: 2.4em auto 0; padding-top: 2em; border-top: 2px solid var(--s5-line); }
.s5-article-faqs h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 1.2em; }

/* Author byline card at bottom of article */
.s5-author-byline {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  max-width: 820px;
  margin: 2.4em auto 0;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--s5-line);
  border-left: 6px solid var(--s5-green);
  border-radius: var(--s5-radius);
}
.s5-author-byline .s5-author-portrait {
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}
.s5-author-byline strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.s5-author-byline p { margin: 6px 0; font-size: .94rem; }

/* Related notes section */
.s5-related-notes {
  max-width: 980px;
  margin: 2.8em auto 0;
  padding: clamp(18px, 4vw, 34px);
  border-top: 4px double var(--s5-ink);
}
.s5-related-notes h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 1.2em; }
.s5-related-notes .s5-article-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .s5-author-byline { grid-template-columns: 80px minmax(0, 1fr); }
  .s5-author-byline .s5-author-portrait { width: 68px; height: 68px; }
  .s5-related-notes .s5-article-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .s5-author-byline { grid-template-columns: 1fr; }
}

/* ============================================================
   HOMEPAGE — Notebook Journal Layout
   ============================================================ */

/* --- Notebook page container (narrow, intimate) --- */
.s5-hp-notebook {
  max-width: 800px;
  margin: 0 auto;
  padding-left: clamp(16px, 4vw, 38px);
  padding-right: clamp(16px, 4vw, 38px);
}

/* --- Hero: Compact notebook page with ruled lines --- */
.s5-hp-hero {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: var(--s5-sp-lg) clamp(16px, 4vw, 38px) var(--s5-sp-lg);
  border-bottom: 2px solid var(--s5-ink);
}
.s5-hp-hero::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 70px;
  width: 2px;
  background: rgba(191, 51, 42, 0.2);
  pointer-events: none;
}
.s5-hp-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 31px,
    rgba(24, 33, 29, 0.06) 31px,
    rgba(24, 33, 29, 0.06) 32px
  );
}
.s5-hp-hero-content {
  position: relative;
  z-index: 1;
}
.s5-hp-edition {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--s5-ink);
  margin-bottom: var(--s5-sp-md);
  font-size: var(--s5-fs-xs);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--s5-muted);
}
.s5-hp-edition span:nth-child(2) { color: var(--s5-red); }
.s5-hp-hero h1 {
  font-size: var(--s5-fs-hero);
  line-height: 0.98;
  max-width: 700px;
  margin-bottom: var(--s5-sp-md);
}
.s5-hp-hero-lead {
  font-size: var(--s5-fs-base);
  color: var(--s5-muted);
  max-width: 640px;
  margin-bottom: var(--s5-sp-md);
}
.s5-hp-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* --- Hero image as a "taped photo" --- */
.s5-hp-photo {
  max-width: 800px;
  margin: var(--s5-sp-md) auto 0;
  padding: 0 clamp(16px, 4vw, 38px);
}
.s5-hp-photo figure {
  margin: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--s5-ink);
  box-shadow: 0 6px 24px rgba(24, 33, 29, 0.1);
  transform: rotate(-0.8deg);
}
.s5-hp-photo img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.s5-hp-photo figcaption {
  margin-top: 8px;
  font-size: var(--s5-fs-sm);
  color: var(--s5-muted);
  font-style: italic;
}

/* --- Margin annotation: Edit note --- */
.s5-hp-margin-note {
  max-width: 800px;
  margin: var(--s5-sp-md) auto;
  padding: 12px clamp(16px, 4vw, 38px) 12px 82px;
  position: relative;
  border-top: 1px solid var(--s5-line);
  border-bottom: 1px solid var(--s5-line);
}
.s5-hp-margin-note::before {
  content: attr(data-label);
  position: absolute;
  left: clamp(16px, 4vw, 38px);
  top: 14px;
  font-size: var(--s5-fs-xs);
  font-weight: 900;
  color: var(--s5-red);
  text-transform: uppercase;
  writing-mode: vertical-lr;
  letter-spacing: 0.1em;
}
.s5-hp-margin-note strong {
  font-family: "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  font-size: var(--s5-fs-md);
}

/* --- Stats: Handwritten tally marks style --- */
.s5-hp-tally {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--s5-sp-md) clamp(16px, 4vw, 38px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-bottom: 2px solid var(--s5-ink);
}
.s5-hp-tally div {
  padding: 14px 12px;
  border-right: 1px solid var(--s5-line);
}
.s5-hp-tally div:last-child { border-right: 0; }
.s5-hp-tally b {
  display: block;
  font: 900 var(--s5-fs-xl) "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color: var(--s5-green);
  line-height: 1;
}
.s5-hp-tally span {
  display: block;
  margin-top: 4px;
  color: var(--s5-muted);
  font-weight: 800;
  font-size: var(--s5-fs-sm);
}

/* --- Section heading: Journal entry style --- */
.s5-hp-entry-head {
  max-width: 800px;
  margin: var(--s5-sp-xl) auto var(--s5-sp-md);
  padding: 0 clamp(16px, 4vw, 38px);
  border-bottom: 1px solid var(--s5-ink);
  padding-bottom: var(--s5-sp-sm);
}
.s5-hp-entry-head h2 {
  font-size: var(--s5-fs-xl);
  line-height: 1.05;
  margin: 0 0 8px;
}
.s5-hp-entry-head p {
  color: var(--s5-muted);
  font-size: var(--s5-fs-base);
  margin: 0;
}

/* --- Category index: Single column reading flow --- */
.s5-hp-index-list {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 38px);
  border-bottom: 1px solid var(--s5-ink);
}
.s5-hp-index-row {
  display: grid;
  grid-template-columns: 54px 130px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--s5-line);
}
.s5-hp-index-row picture { display: block; }
.s5-hp-index-row img {
  width: 130px;
  height: 84px;
  object-fit: cover;
  border: 1px solid var(--s5-ink);
}
.s5-hp-row-num {
  font: 900 1.8rem "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color: var(--s5-green);
}
.s5-hp-index-row small {
  color: var(--s5-red);
  font-weight: 900;
  text-transform: uppercase;
  font-size: var(--s5-fs-xs);
}
.s5-hp-index-row h3 {
  font-size: var(--s5-fs-md);
  margin: 2px 0;
}
.s5-hp-index-row p {
  margin: 0;
  font-size: var(--s5-fs-sm);
}

/* --- Split concepts: Sticky notes with rotation --- */
.s5-hp-sticky-section {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--s5-sp-xl) clamp(16px, 4vw, 38px) 0;
}
.s5-hp-sticky-copy {
  border-top: 4px solid var(--s5-red);
  padding-top: var(--s5-sp-sm);
  margin-bottom: var(--s5-sp-lg);
}
.s5-hp-sticky-copy h2 {
  font-size: var(--s5-fs-xl);
  margin: 0 0 8px;
}
.s5-hp-sticky-copy p {
  color: var(--s5-muted);
  margin: 0;
}
.s5-hp-sticky-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.s5-hp-sticky-card {
  padding: 20px;
  background: #fffde8;
  border: 1px solid rgba(24, 33, 29, 0.18);
  box-shadow: 3px 4px 12px rgba(24, 33, 29, 0.08);
  transform: rotate(-1.2deg);
  transition: transform 0.25s ease;
}
.s5-hp-sticky-card:nth-child(2) {
  background: #e8fff0;
  transform: rotate(0.8deg);
}
.s5-hp-sticky-card:nth-child(3) {
  background: #fff0e8;
  transform: rotate(-0.5deg);
}
.s5-hp-sticky-card:hover {
  transform: rotate(0deg) translateY(-4px);
}
.s5-hp-sticky-card span {
  display: block;
  color: var(--s5-red);
  font-weight: 900;
  font-size: var(--s5-fs-xs);
  margin-bottom: 8px;
}
.s5-hp-sticky-card h3 {
  font-size: var(--s5-fs-md);
  margin: 0 0 6px;
}
.s5-hp-sticky-card p {
  margin: 0;
  font-size: var(--s5-fs-sm);
  color: var(--s5-muted);
}

/* --- Tabs section: Journal entry reading flow --- */
.s5-hp-tabs-wrap {
  max-width: 800px;
  margin: var(--s5-sp-xl) auto 0;
  padding: 0 clamp(16px, 4vw, 38px);
}

/* --- Articles: Single column stack --- */
.s5-hp-article-stack {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}
.s5-hp-article-stack .s5-article-card {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  overflow: hidden;
}
.s5-hp-article-stack .s5-article-img img {
  width: 200px;
  height: 100%;
  min-height: 140px;
  object-fit: cover;
}
.s5-hp-article-stack .s5-article-card > div { padding: 16px; }

/* --- Tool desk: Torn page style --- */
.s5-hp-tool-desk {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 38px);
}
.s5-hp-tool-table {
  border-top: 1px solid var(--s5-ink);
}
.s5-hp-tool-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--s5-line);
  position: relative;
}
.s5-hp-tool-row::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--s5-green);
  border-radius: 50%;
}
.s5-hp-tool-row span {
  font: 900 1.6rem "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color: var(--s5-red);
}
.s5-hp-tool-row h3 { font-size: var(--s5-fs-md); margin: 0; }
.s5-hp-tool-row p { margin: 4px 0 0; font-size: var(--s5-fs-sm); }

/* --- Author: Handwritten signature block --- */
.s5-hp-signature {
  max-width: 800px;
  margin: var(--s5-sp-xl) auto 0;
  padding: var(--s5-sp-lg) clamp(16px, 4vw, 38px);
  border-top: 4px double var(--s5-ink);
  border-bottom: 4px double var(--s5-ink);
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}
.s5-hp-signature-portrait {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid var(--s5-ink);
  background: #fff image-set(url("/images/author.webp") type("image/webp"), url("/images/author.jpg") type("image/jpeg")) center / cover no-repeat;
}
.s5-hp-signature h2 {
  font-size: var(--s5-fs-xl);
  margin: 0 0 4px;
}
.s5-hp-signature .s5-role {
  color: var(--s5-green);
  font-weight: 900;
  margin-bottom: 8px;
  display: block;
}
.s5-hp-signature p {
  font-size: var(--s5-fs-sm);
  color: var(--s5-muted);
  margin: 0 0 14px;
}

/* --- FAQ accordion in notebook --- */
.s5-hp-faq {
  max-width: 800px;
  margin: var(--s5-sp-xl) auto 0;
  padding: 0 clamp(16px, 4vw, 38px) var(--s5-sp-xl);
}

/* --- Homepage responsive --- */
@media (max-width: 900px) {
  .s5-hp-tally { grid-template-columns: repeat(2, 1fr); }
  .s5-hp-tally div:nth-child(2) { border-right: 0; }
  .s5-hp-sticky-grid { grid-template-columns: 1fr; }
  .s5-hp-sticky-card,
  .s5-hp-sticky-card:nth-child(2),
  .s5-hp-sticky-card:nth-child(3) { transform: rotate(0deg); }
  .s5-hp-signature { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .s5-hp-article-stack .s5-article-card { grid-template-columns: 1fr; }
  .s5-hp-article-stack .s5-article-img img { width: 100%; height: 200px; }
}
@media (max-width: 620px) {
  .s5-hp-hero::before { left: 40px; }
  .s5-hp-margin-note { padding-left: 52px; }
  .s5-hp-tally { grid-template-columns: 1fr; }
  .s5-hp-tally div { border-right: 0; border-bottom: 1px solid var(--s5-line); }
  .s5-hp-tally div:last-child { border-bottom: 0; }
  .s5-hp-index-row { grid-template-columns: 1fr; }
  .s5-hp-index-row picture,
  .s5-hp-index-row img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .s5-hp-photo figure { transform: rotate(0deg); }
  .s5-hp-hero h1 { font-size: clamp(2.2rem, 12vw, 3.6rem); }
}

/* ============================================================
   MOTION LAYER — Notebook / Handwritten animations
   ============================================================ */

/* --- Pen-stroke animated underline on headings --- */
.s5-pen-stroke {
  position: relative;
  display: inline-block;
}
.s5-pen-stroke::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--s5-green), var(--s5-gold));
  border-radius: 2px;
  transform: scaleX(0) skewY(-0.6deg);
  transform-origin: left center;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.s5-pen-stroke--drawn::after {
  transform: scaleX(1) skewY(-0.6deg);
}

/* --- Page-flip reveal for cards / rows --- */
.s5-page-flip {
  opacity: 0;
  transform: perspective(900px) rotateY(-8deg) translateX(-12px);
  transition:
    opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.s5-page-flip.visible {
  opacity: 1;
  transform: perspective(900px) rotateY(0) translateX(0);
}

/* --- Notebook ruled lines overlay --- */
.s5-notebook-lines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 31px,
    rgba(24, 33, 29, 0.04) 31px,
    rgba(24, 33, 29, 0.04) 32px
  );
  opacity: 1;
}

/* --- Paper grain texture overlay on body --- */
.s5-paper-grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0.028;
  mix-blend-mode: multiply;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* --- Handwriting char draw-in --- */
.s5-char {
  display: inline-block;
  opacity: 0;
  transform: scale(0.78) rotate(3deg);
  transition:
    opacity 0.35s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.s5-char.visible {
  opacity: 1;
  transform: scale(1) rotate(0);
}

/* --- Ink splatter particles on button clicks --- */
.s5-ink-dot {
  position: absolute;
  border-radius: 50%;
  background: var(--s5-ink);
  pointer-events: none;
  z-index: 10;
  animation: s5-ink-spread 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: transform, opacity;
}

@keyframes s5-ink-spread {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 0.85;
  }
  100% {
    transform: translate(var(--ix), var(--iy)) scale(1);
    opacity: 0;
  }
}

/* --- Custom scrollbar (thin, paper bg, green thumb) --- */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--s5-paper);
}
::-webkit-scrollbar-thumb {
  background: var(--s5-green);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #095e40;
}
html {
  scrollbar-width: thin;
  scrollbar-color: var(--s5-green) var(--s5-paper);
}

/* --- Text selection --- */
::selection {
  background: var(--s5-green);
  color: var(--s5-paper);
}

/* --- Reduced motion: disable all motion additions --- */
@media (prefers-reduced-motion: reduce) {
  .s5-pen-stroke::after { transition: none; transform: scaleX(1) skewY(-0.6deg); }
  .s5-page-flip { opacity: 1; transform: none; transition: none; }
  .s5-char { opacity: 1; transform: none; transition: none; }
  .s5-ink-dot { animation: none; display: none; }
  .s5-paper-grain { display: none; }
}
