:root {
  color-scheme: light;
  --bg: #F7F0E1;
  --bg-panel: #FFFBF3;
  --bg-panel-2: #EFE5D2;
  --border: #E2D5BE;
  --accent: #0B6B8A;
  --accent-dark: #074A61;
  --accent-tint: #DCEBEE;
  --accent-tint-2: #CADFE4;
  --text: #2A2118;
  --text-muted: #6E6152;
  --success: #2E7D4F;
  --warn: #B7791F;
  --error: #B83A2E;
  --paper-hi: #FBF6EC;
  --paper-lo: #F2E8D4;
  --page-lo: #F3E9D6;
  --sheen: #FFFFFF;
  --abyss: #03242F;
  --leather-1: #3C2E21;
  --leather-2: #1D1610;
  --foil-hi: #EAD39C;
  --foil-mid: #C9A65E;
  --foil-lo: #94702F;
  --ribbon-1: #B0703F;
  --ribbon-2: #7A4527;
  --ink-brown: #5B3C24;
  --flag-red: var(--error);
  --flag-navy: #24406C;
  --flag-white: var(--bg-panel);
  --wall-ink: #635F59;
  --clear: transparent;

  --font-display: "Inter","Noto Sans SC","PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
  --font-body: "Inter","Noto Sans SC","PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-mono: "JetBrains Mono",ui-monospace,"SFMono-Regular",Menlo,Consolas,"Liberation Mono",monospace;
  --size-display: clamp(52px, 4.45vw, 68px);
  --size-hero: clamp(40px, 4.45vw, 66px);
  --size-section: clamp(26px, 3.1vw, 44px);
  --size-card: clamp(19px, 1.8vw, 24px);
  --size-body: 16px;
  --size-lead: 20px;
  --size-ui: 14px;
  --size-nav: 15px;
  --size-small: 13px;
  --size-label: 12px;
  --size-brand: 20px;
  --weight-ui: 700;
  --weight-brand: 800;
  --weight-display: 900;
  --r-btn: 3px;
  --r-field: 8px;
  --r-pop: 14px;
  --r-card: 22px;
  --r-groove: 18px;
  --r-pill: 999px;
  --r-round: 50%;
  --nav-h: 72px;
  --anchor-top: calc(var(--nav-h) + 14px);
  --toc-room: 68px;
  --gutter: max(24px, calc((100vw - 1296px) / 2));
  --section-space: clamp(44px, 6vw, 88px);
  --float-room: calc(88px + env(safe-area-inset-bottom, 0px));

  --shadow-card: inset 0 1px 0 color-mix(in srgb,var(--sheen) 70%,var(--clear)), 0 18px 48px -18px color-mix(in srgb,var(--accent) 14%,var(--clear));
  --shadow-pop: 0 20px 40px -18px color-mix(in srgb,var(--accent) 24%,var(--clear));
  --shadow-btn: inset 0 1px 0 color-mix(in srgb,var(--sheen) 22%,var(--clear)), 0 8px 18px -8px color-mix(in srgb,var(--accent) 60%,var(--clear));
  --veil: color-mix(in srgb,var(--abyss) 42%,var(--clear));
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.5 0 0 0 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.4 0 0 0 2.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--anchor-top); scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--size-body)/1.6 var(--font-body);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: var(--text);
  -webkit-mask: var(--grain) repeat 0 0 / 180px 180px;
  mask: var(--grain) repeat 0 0 / 180px 180px;
  opacity: .06;
}
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .17em; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; height: auto; }
svg { max-width: 100%; vertical-align: middle; }
button, summary { cursor: pointer; }
p { margin: 0 0 1em; text-wrap: pretty; }
h1, h2, h3 { margin: 0 0 .5em; font-family: var(--font-display); }
h1, h2 { text-wrap: balance; }
h1 { font-size: var(--size-display); font-weight: var(--weight-display); line-height: 1.12; letter-spacing: -.02em; }
h2 { font-size: var(--size-section); font-weight: var(--weight-brand); line-height: 1.18; letter-spacing: -.018em; }
h3 { font-size: var(--size-card); line-height: 1.3; text-wrap: pretty; }
small, .muted { color: var(--text-muted); }
small { font-size: var(--size-small); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-btn); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 16px; top: 12px; z-index: 120; padding: 8px 14px; background: var(--bg-panel); color: var(--text); border-radius: var(--r-btn); text-decoration: none; font-weight: var(--weight-ui); transform: translateY(-200%); }
.skip:focus { transform: none; }
.no-break { white-space: nowrap; }
.mono, code, pre { font-family: var(--font-mono); }
code { overflow-wrap: anywhere; }
pre { max-width: 100%; overflow-x: auto; padding: 16px; background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: var(--r-field); }
pre code { white-space: pre; overflow-wrap: normal; }
.prose { min-width: 0; }
.prose :is(p, blockquote, ol, ul) { max-width: 44em; }
.prose a:not(.btn) { color: var(--accent-dark); }
.prose section + section { margin-block-start: 40px; }
.wrap { width: 100%; min-width: 0; margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-top: var(--section-space); padding-bottom: var(--section-space); }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 245px),1fr)); gap: clamp(14px,2vw,24px); }
.grid > *, .head-in > *, .footer-grid > * { min-width: 0; }
.dot, .icon, .kicker-dot { flex-shrink: 0; }
.icon { width: 18px; height: 18px; }
.ornament-box { position: relative; overflow-x: clip; }
.ornament-box > .stripe-halo { position: absolute; inset-inline: 0; max-width: 100%; pointer-events: none; }
.tilt-detail { transform: rotate(-4deg); }
.ink-ring { position: relative; display: inline-block; isolation: isolate; }
.ink-ring svg { position: absolute; left: -.22em; top: -.14em; z-index: -1; width: calc(100% + .44em); max-width: none; height: calc(100% + .26em); overflow: visible; pointer-events: none; }
.ink-ring path { fill: none; stroke: var(--accent); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.s-current { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.f-accent { fill: var(--accent); }
.f-current { fill: currentColor; }
.panel, .card { min-width: 0; padding: clamp(16px,2.4vw,32px); background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.groove { background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: var(--r-groove); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 7px 16px;
  border: 1px solid var(--clear); border-radius: var(--r-btn);
  font: var(--weight-ui) var(--size-ui)/1 var(--font-body);
  text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--solid, .btn-primary { color: var(--bg-panel); background: var(--accent); box-shadow: var(--shadow-btn); }
.btn--solid:hover, .btn-primary:hover { background: var(--accent-dark); }
.btn--tint, .btn-secondary { color: var(--accent-dark); background: var(--accent-tint); }
.btn--tint:hover, .btn-secondary:hover { background: var(--accent-tint-2); }
.btn--outline { border-color: var(--accent); color: var(--accent-dark); background: var(--clear); }
.btn--outline:hover { background: var(--accent-tint); }
.btn--text { color: var(--accent-dark); background: var(--clear); text-decoration: underline; }
.btn--text:hover { background: var(--bg-panel-2); }
.btn--lg { min-height: 52px; padding-inline: 28px; font-size: var(--size-body); }
.btn:not(:disabled):active { box-shadow: inset 0 2px 5px var(--veil); }
.btn:disabled { background: var(--bg-panel-2); border-color: var(--border); color: var(--text-muted); box-shadow: none; cursor: not-allowed; }

.site-head { position: relative; z-index: 20; height: var(--nav-h); background: var(--bg); border-bottom: 1px solid var(--border); }
.head-in { position: relative; z-index: 3; height: 100%; display: flex; align-items: center; gap: 28px; padding-inline: var(--gutter); background: var(--bg); }
.brand { display: inline-flex; flex: none; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: var(--weight-brand) var(--size-brand)/1 var(--font-display); letter-spacing: -.02em; white-space: nowrap; }
.brand img { width: 30px; height: 30px; flex: none; }
.nav { flex: 1; min-width: 0; }
.nav-list { display: flex; align-items: center; justify-content: flex-end; list-style: none; margin: 0; padding: 0; gap: clamp(6px,.7vw,12px); font-size: var(--size-nav); }
.nav-list > li { display: flex; align-items: center; white-space: nowrap; }
.nav-list > li + li::before { content: "·"; color: var(--text-muted); opacity: .65; margin-right: clamp(6px,.7vw,12px); font-weight: var(--weight-ui); }
.nav-list a, .nav-more summary { display: inline-flex; align-items: center; min-height: 32px; padding-inline: 1px; color: var(--text-muted); text-decoration: none; font-weight: 500; }
.nav-list a:hover, .nav-more summary:hover { color: var(--text); }
.nav-list a[aria-current="page"], .nav-more[data-current] summary { color: var(--text); font-weight: var(--weight-ui); box-shadow: inset 0 -2px var(--accent); }
.nav-more { position: relative; }
.nav-more summary { list-style: none; gap: 4px; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary svg { width: 12px; height: 12px; }
.more-pop, .lang-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 35;
  min-width: 154px; margin: 0; padding: 8px; list-style: none;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-pop); box-shadow: var(--shadow-pop);
}
.more-pop a, .lang-pop a { display: flex; align-items: center; min-height: 40px; padding: 6px 12px; border-radius: var(--r-field); text-decoration: none; white-space: nowrap; }
.more-pop a:hover, .lang-pop a:hover, .lang-pop a[aria-current="page"] { background: var(--bg-panel-2); }
.head-actions { display: flex; flex-shrink: 0; align-items: center; gap: 8px; }
.lang-switch { position: relative; }
.lang {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  min-height: 40px; min-width: 44px; width: auto; padding: 0 10px;
  background: var(--clear); border: 0; border-radius: var(--r-btn);
  font: 500 var(--size-ui)/1 var(--font-body); color: var(--text-muted);
}
.lang svg { width: 16px; height: 16px; flex: none; }
.lang:hover, .lang[aria-expanded="true"] { background: var(--bg-panel-2); color: var(--text); }
.head-start, .head-login { flex-shrink: 0; }
.menu-toggle { display: none; }
.nav-drawer, .nav-veil, .sample-menu { display: none; }
html.nav-open { overflow: hidden; }

.site-foot { padding-block: 48px 24px; background: var(--bg-panel-2); border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr) minmax(0,.65fr); gap: 32px; }
.footer-about p { max-width: 27em; margin-block: 14px 0; color: var(--text-muted); }
.footer-title { margin: 0 0 8px; font-size: var(--size-ui); font-weight: var(--weight-brand); color: var(--text); }
.footer-links, .footer-chips, .footer-tail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.footer-links a, .footer-tail a { display: inline-flex; align-items: center; min-height: 28px; font-size: var(--size-ui); color: var(--text-muted); }
.footer-links a:hover, .footer-tail a:hover { color: var(--accent-dark); }
.footer-search { margin-top: 26px; }
.footer-chips { gap: 8px; }
.footer-chips a { display: inline-flex; align-items: center; min-height: 30px; padding: 3px 10px; border: 1px solid var(--text-muted); border-radius: var(--r-pill); color: var(--text); font-size: var(--size-small); text-decoration: none; }
.footer-chips a:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-tint); }
.footer-tail { justify-content: space-between; margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--border); }
#server-status { margin: 0 0 24px; padding: clamp(10px,2vw,22px); overflow: hidden; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-card); }
#server-status + * { margin-block-start: 24px; }
.reveal { transition: opacity .34s ease, transform .34s ease; }
.reveal.pending { opacity: 0; transform: translateY(16px); }
.reveal.shown { opacity: 1; }
.reveal.pending:focus-within { opacity: 1; transform: none; }

@media (max-width: 1350px) {
  html:lang(en), html:lang(ja), html:lang(ko) { --size-nav: 14px; }
  html:lang(en) .head-in, html:lang(ja) .head-in, html:lang(ko) .head-in { gap: 12px; }
  html:lang(en) .nav-list, html:lang(ja) .nav-list, html:lang(ko) .nav-list { gap: 6px; }
  html:lang(en) .nav-list > li + li::before, html:lang(ja) .nav-list > li + li::before, html:lang(ko) .nav-list > li + li::before { margin-right: 6px; }
}
@media (max-width: 1100px) {
  .nav { display: none; }
  .head-actions { margin-left: auto; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 0;
    color: var(--text); background: var(--bg-panel-2); border: 0; border-radius: var(--r-btn);
  }
  .menu-toggle svg { width: 20px; height: 20px; }
  .menu-toggle[aria-expanded="true"] { color: var(--accent-dark); background: var(--accent-tint); }
  .nav-drawer:not([hidden]) {
    display: block; position: fixed; z-index: 2;
    inset: var(--nav-h) 0 auto auto; width: min(390px,100%);
    height: calc(100dvh - var(--nav-h)); max-height: calc(100dvh - var(--nav-h));
    overflow-y: auto; overscroll-behavior: contain;
    padding: 12px var(--gutter) calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-panel); border-top: 1px solid var(--border); box-shadow: var(--shadow-pop);
  }
  .nav-drawer a, .sample-menu a { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: var(--r-field); text-decoration: none; font-weight: 600; }
  .nav-drawer a:hover, .nav-drawer a[aria-current="page"], .sample-menu a:hover { background: var(--accent-tint); color: var(--accent-dark); }
  .drawer-languages { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
  .nav-veil:not([hidden]) { display: block; position: fixed; inset: var(--nav-h) 0 0; z-index: 1; background: var(--veil); }
  .sample-menu { display: block; position: relative; }
  .sample-menu > summary { list-style: none; }
  .sample-menu > summary::-webkit-details-marker { display: none; }
  .sample-menu > nav { position: absolute; right: 0; top: calc(100% + 10px); z-index: 40; width: min(280px, calc(100vw - 32px)); max-height: calc(100dvh - var(--nav-h) - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 8px; border: 1px solid var(--border); border-radius: var(--r-pop); background: var(--bg-panel); box-shadow: var(--shadow-pop); }
}
@media (max-width: 768px) {
  :root { --size-display: clamp(28px,6vw,40px); --size-hero: clamp(30px,6.8vw,40px); --gutter: clamp(16px,4vw,24px); }
  .footer-grid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 22px; }
  .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  :root { --nav-h: 64px; --size-brand: 16px; }
  .no-break { white-space: normal; }
  .tilt-detail { transform: none; }
  .head-in { gap: 6px; flex-wrap: nowrap; }
  .head-in .brand { gap: 4px; }
  .head-in .brand img { width: 22px; height: 22px; }
  .head-actions { gap: 4px; }
  .head-actions .btn { padding-inline: 7px; font-size: var(--size-label); }
  .head-actions .lang { padding-inline: 4px; font-size: var(--size-label); gap: 4px; justify-content: center; }
  .head-actions .lang svg { display: none; }
}
@media (max-width: 480px) {
  .nav-drawer:not([hidden]) { width: 100%; }
}
@media (max-width: 375px) {
  .head-in .brand img { width: 18px; height: 18px; }
  .head-in .brand { font-size: var(--size-ui); }
  .head-actions { gap: 3px; }
  .head-actions .btn { padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .reveal, .reveal.pending { transition: none; }
  .reveal, .reveal.pending { opacity: 1; transform: none; }
}