:root {
  --ink: #2b1a0c;
  --text: #2b2118;
  --mute: #6b5a4a;
  --wood: #4f2f17;
  --line: rgba(58,40,24,.16);
  --font-ui: 'Nunito Sans', system-ui, sans-serif;
  --font-hand: 'Kalam', 'Comic Sans MS', cursive;
  --font-brand: 'Kaushan Script', 'Kalam', cursive;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body {
  margin: 0; min-height: 100vh;
  background-color: #bb8550;
  background-image: radial-gradient(rgba(70,40,15,.18) 1px, transparent 1.5px), radial-gradient(rgba(255,230,190,.12) 1px, transparent 1.5px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 3px 5px;
  color: var(--text); font: 16.5px/1.6 var(--font-ui);
  -webkit-text-size-adjust: 100%;
}
a { color: #7a3a0c; text-underline-offset: 3px; }
a:hover { color: #4a2206; }
a:focus-visible { outline: 3px solid #fde06a; outline-offset: 2px; border-radius: 2px; }

.doc-top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; padding: 8px 24px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background-color: var(--wood);
  background-image: repeating-linear-gradient(178deg, rgba(255,210,160,.05) 0 3px, transparent 3px 9px), linear-gradient(180deg, #63401f 0%, #4a2b14 100%);
  box-shadow: 0 3px 0 #331c0b, 0 8px 18px rgba(0,0,0,.35);
}
.doc-back { color: #fbeed8; font-family: var(--font-brand); font-size: 24px; text-decoration: none; white-space: nowrap; }
.doc-back:hover { color: #fde06a; }
.doc-nav { color: rgba(251,238,216,.6); font-weight: 700; font-size: 15px; }
.doc-nav a { color: #fbeed8; text-decoration: none; padding: 6px 4px; }
.doc-nav a[aria-current="page"] { color: #fde06a; text-decoration: underline; text-decoration-thickness: 2px; }

.doc { max-width: 880px; margin: 0 auto; padding: 34px 20px calc(96px + env(safe-area-inset-bottom, 0px)); }
.doc-sheet {
  position: relative;
  padding: 44px 56px 48px;
  background: #fbf5e8;
  box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 26px 40px -18px rgba(40,20,5,.6);
  transform: rotate(-.25deg);
}
.doc-sheet::before {
  content: ""; position: absolute; left: 50%; top: -10px; width: 22px; height: 22px; margin-left: -11px;
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8a8a, #c9232f 60%, #7d0f17);
  box-shadow: 0 3px 4px rgba(0,0,0,.4);
}
.doc-sheet h1 { margin: 0 0 6px; font-family: var(--font-hand); font-weight: 700; font-size: 40px; line-height: 1.1; color: var(--ink); }
.doc-sheet h2 { margin: 34px 0 10px; font-size: 20px; line-height: 1.3; font-weight: 900; color: var(--ink); }
.doc-sheet h3 { margin: 22px 0 8px; font-size: 17px; font-weight: 800; }
.doc-sheet p { margin: 0 0 12px; }
.doc-sheet ol, .doc-sheet ul { margin: 0 0 12px; padding-left: 26px; }
.doc-sheet li { margin: 0 0 7px; padding-left: 2px; }
.doc-sheet li > ol, .doc-sheet li > ul { margin: 7px 0 0; }
.doc-sheet strong { font-weight: 800; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
.todo { background: #fdebc8; color: #6b3f00; padding: 1px 5px; border-radius: 3px; font-weight: 700; font-size: .92em; }

.doc-draft {
  display: inline-block; margin: 6px 0 18px !important; padding: 5px 12px;
  border: 2px solid #b3261e; color: #8a1d16; font-weight: 900; font-size: 13.5px; letter-spacing: .02em;
  transform: rotate(-1.2deg);
}
.doc-toc { margin: 8px 0 26px; padding: 14px 20px 10px; background: #f3e8d2; border-left: 4px solid #c9a46a; }
.doc-toc-t { margin: 0 0 6px !important; font-weight: 900; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.doc-toc ol { columns: 2; column-gap: 28px; margin: 0; padding-left: 22px; font-size: 15px; }
.doc-toc li { margin: 0 0 5px; break-inside: avoid; }

.table { overflow-x: auto; margin: 4px 0 16px; -webkit-overflow-scrolling: touch; }
.doc-sheet table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.45; }
.doc-sheet th, .doc-sheet td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc-sheet thead th { background: #f0e4cc; font-size: 13px; font-weight: 900; }

.doc-foot { margin-top: 26px; text-align: center; color: #fff6e6; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.doc-foot a { color: #fff6e6; }
.doc-btn {
  display: inline-flex; align-items: center; height: 46px; padding: 0 22px; margin-top: 4px;
  background: #fde06a; color: var(--ink) !important; text-decoration: none; text-shadow: none;
  font-weight: 900; box-shadow: 0 6px 12px rgba(0,0,0,.35); transform: rotate(-1deg);
}
.doc-btn:hover { background: #ffe989; }
.doc-fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: inline-flex; align-items: center; height: 50px; padding: 0 20px;
  background: #fde06a; color: var(--ink); text-decoration: none;
  font-family: var(--font-hand); font-size: 20px; font-weight: 700;
  transform: rotate(-2deg); box-shadow: 0 10px 16px -4px rgba(0,0,0,.5);
}
.doc-fab:hover { background: #ffe989; color: var(--ink); }
.doc-fab:focus-visible { outline: 3px solid #2b1a0c; outline-offset: 3px; }

@media (max-width: 700px) {
  body { font-size: 16px; }
  .doc-top { padding-left: 14px; padding-right: 14px; flex-wrap: wrap; gap: 2px 12px; }
  .doc-back { font-size: 21px; }
  .doc-nav { font-size: 14px; }
  .doc { padding: 18px 10px 90px; }
  .doc-fab { right: 12px; height: 46px; padding: 0 16px; font-size: 18px; }
  .doc-sheet { padding: 30px 18px 32px; transform: none; }
  .doc-sheet h1 { font-size: 32px; }
  .doc-sheet h2 { font-size: 18.5px; margin-top: 28px; }
  .doc-toc { padding: 12px 14px 8px; }
  .doc-toc ol { columns: 1; }
  .doc-sheet ol, .doc-sheet ul { padding-left: 22px; }
  .doc-sheet table { font-size: 13.5px; }
  .doc-sheet th, .doc-sheet td { padding: 8px 7px; }
}
@media print {
  body { background: #fff; }
  .doc-top, .doc-foot, .doc-fab, .doc-sheet::before { display: none; }
  .doc { max-width: none; padding: 0; }
  .doc-sheet { box-shadow: none; transform: none; padding: 0; background: #fff; }
}
.doc-404 { text-align: center; padding-top: 56px; padding-bottom: 56px; }
.doc-404 p { font-size: 18px; }
.doc-404 .doc-btn { margin-top: 10px; }
