/* =============================================================================================
   PrincipleSim · 和 (Wa) design system
   生成り washi paper · 墨 sumi ink · 朱 shu vermilion · 金 kin gold leaf · 藍 ai indigo
   Light theme = 昼 (hiru, day). Dark theme = 夜 (yoru, night).
   Accessibility classes on <html>: a11y-contrast · a11y-legible · a11y-underline · a11y-cb · a11y-calm
   ============================================================================================= */
:root {
  --washi: #f5efe3;
  --washi-2: #ebe2cf;
  --paper: #fffcf5;
  --paper-2: #f8f2e6;
  --text: #1c1814;
  --muted: #6b6255;
  --line: rgba(28, 24, 20, 0.13);
  --line-soft: rgba(28, 24, 20, 0.07);
  --shu: #c23b22;
  --shu-deep: #8f2715;
  --ai: #234a78;
  --kin: #a98128;
  --kin-hi: #e2c174;
  --matcha: #5f8547;
  --sakura: #e9a7b6;
  --accent: #234a78;
  --accent-soft: rgba(35, 74, 120, 0.10);
  /* plot & data colours (Okabe–Ito-friendly variant used when a11y-cb is on) */
  --c1: #234a78; --c2: #c23b22; --c3: #4f7d3c; --c4: #a98128; --c5: #7b4fa5;
  --plot-bg: #fffcf5; --grid: rgba(28, 24, 20, 0.07); --axis: #6b6255;
  --good: #3c7a46; --bad: #c23b22;
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 1px 2px rgba(60, 40, 20, 0.06), 0 6px 18px -10px rgba(60, 40, 20, 0.22);
  --shadow-lg: 0 24px 60px -28px rgba(50, 30, 15, 0.38);
  --radius: 18px;
  --radius-sm: 12px;
  --fs: 1;               /* text scale (accessibility panel) */
  --lh: 1.7;             /* line height (accessibility panel) */
  --ls: 0em;             /* letter spacing (accessibility panel) */
  --font: 'Zen Kaku Gothic New', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Shippori Mincho B1', 'Hiragino Mincho ProN', 'Yu Mincho', Georgia, serif;
  --brush: 'Yuji Syuku', 'Shippori Mincho B1', serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 66px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --night: 1; } }
:root[data-theme="dark"], :root:not([data-theme="light"])[data-night="1"] { --night: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --washi: #0f1220; --washi-2: #161a2c; --paper: #171b2d; --paper-2: #1d2236;
    --text: #efe7d6; --muted: #a79d8a; --line: rgba(239, 231, 214, 0.14); --line-soft: rgba(239, 231, 214, 0.07);
    --shu: #e65a3d; --shu-deep: #b8401f; --ai: #8fb0e3; --kin: #d6b25a; --kin-hi: #f0d690; --matcha: #9fc485; --sakura: #f0b4c2;
    --accent: #9cbbe9; --accent-soft: rgba(156, 187, 233, 0.14);
    --c1: #9cbbe9; --c2: #ff8a6b; --c3: #9fd18c; --c4: #e8c56c; --c5: #c8a5e8;
    --plot-bg: #141829; --grid: rgba(239, 231, 214, 0.07); --axis: #a79d8a; --good: #9fd18c; --bad: #ff8a6b;
    --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 22px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 70px -28px rgba(0, 0, 0, 0.85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --washi: #0f1220; --washi-2: #161a2c; --paper: #171b2d; --paper-2: #1d2236;
  --text: #efe7d6; --muted: #a79d8a; --line: rgba(239, 231, 214, 0.14); --line-soft: rgba(239, 231, 214, 0.07);
  --shu: #e65a3d; --shu-deep: #b8401f; --ai: #8fb0e3; --kin: #d6b25a; --kin-hi: #f0d690; --matcha: #9fc485; --sakura: #f0b4c2;
  --accent: #9cbbe9; --accent-soft: rgba(156, 187, 233, 0.14);
  --c1: #9cbbe9; --c2: #ff8a6b; --c3: #9fd18c; --c4: #e8c56c; --c5: #c8a5e8;
  --plot-bg: #141829; --grid: rgba(239, 231, 214, 0.07); --axis: #a79d8a; --good: #9fd18c; --bad: #ff8a6b;
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 22px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -28px rgba(0, 0, 0, 0.85);
  color-scheme: dark;
}
/* ---------- accessibility modes ---------- */
html.a11y-contrast { --text: #000; --muted: #2b2b2b; --line: rgba(0, 0, 0, 0.55); --washi: #fff; --washi-2: #fff; --paper: #fff; --paper-2: #fff; --accent: #003a80; --shu: #a01a00; }
html.a11y-contrast[data-theme="dark"] { --text: #fff; --muted: #e6e6e6; --line: rgba(255, 255, 255, 0.6); --washi: #000; --washi-2: #000; --paper: #000; --paper-2: #0a0a0a; --accent: #9fd0ff; --shu: #ff8f6b; }
html.a11y-legible { --font: 'Atkinson Hyperlegible', system-ui, sans-serif; --serif: 'Atkinson Hyperlegible', system-ui, sans-serif; }
html.a11y-underline a { text-decoration: underline !important; }
html.a11y-cb { --c1: #0072b2; --c2: #d55e00; --c3: #009e73; --c4: #e69f00; --c5: #cc79a7; --good: #009e73; --bad: #d55e00; }
html.a11y-calm *, html.a11y-calm *::before, html.a11y-calm *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.a11y-focus :focus-visible { outline: 4px solid #ffbf00 !important; outline-offset: 3px !important; box-shadow: 0 0 0 7px #000 !important; }

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: shoji-out .45s var(--ease) both; }
::view-transition-new(root) { animation: shoji-in .55s var(--ease) both; }
@keyframes shoji-out { to { opacity: 0; transform: translateX(-2%); filter: blur(2px); } }
@keyframes shoji-in { from { opacity: 0; transform: translateX(2%); filter: blur(2px); } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: calc(100% * var(--fs)); scroll-padding-top: calc(var(--header-h) + 20px); }
html, body { margin: 0; }
body {
  background: var(--washi); color: var(--text); font-family: var(--font);
  font-size: 0.94rem; line-height: var(--lh); letter-spacing: var(--ls);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh; overflow-x: hidden;
}
::selection { background: color-mix(in srgb, var(--shu) 25%, transparent); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
img, svg, canvas { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 0 0 0.5em; letter-spacing: 0.01em; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 3.6vw, 2.5rem); font-weight: 800; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.04rem; }
p { margin: 0 0 0.9em; text-wrap: pretty; }
small, .small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.err { color: var(--bad); font-size: 0.86rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; border-radius: 6px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 300; background: var(--shu); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; transition: top .2s; }
.skip-link:focus { top: 10px; text-decoration: none; }
[lang="ja"] { font-feature-settings: "palt"; }
.kj { font-family: var(--serif); }
.brush { font-family: var(--brush); }

/* ---------- atmosphere: washi fibre, asanoha lattice, mist ---------- */
.wa-atmos { position: fixed; inset: 0; z-index: -2; pointer-events: none; background:
  radial-gradient(70% 50% at 85% -10%, color-mix(in srgb, var(--sakura) 22%, transparent), transparent 70%),
  radial-gradient(60% 50% at -10% 30%, color-mix(in srgb, var(--ai) 10%, transparent), transparent 70%),
  radial-gradient(80% 60% at 50% 120%, color-mix(in srgb, var(--kin) 12%, transparent), transparent 70%), var(--washi); }
.wa-atmos::before { content: ''; position: absolute; inset: 0; opacity: .45; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.35  0 0 0 0 0.25  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.wa-atmos::after { content: ''; position: absolute; inset: 0; opacity: .06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='104' viewBox='0 0 60 104'><g fill='none' stroke='%23231a10' stroke-width='0.8'><path d='M30 0 L30 34.6 M30 34.6 L0 52 M30 34.6 L60 52 M0 0 L30 17.3 L60 0 M0 52 L30 69.3 L60 52 M30 69.3 L30 104 M0 104 L30 86.6 L60 104 M0 52 L0 0 M60 52 L60 0 M0 52 L0 104 M60 52 L60 104'/><path d='M0 0 L30 34.6 L60 0 M0 104 L30 69.3 L60 104'/></g></svg>"); background-size: 60px 104px; }
:root[data-theme="dark"] .wa-atmos::before { mix-blend-mode: screen; opacity: .06; }
:root[data-theme="dark"] .wa-atmos::after { filter: invert(1); opacity: .05; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wa-atmos::before { mix-blend-mode: screen; opacity: .06; } :root:not([data-theme="light"]) .wa-atmos::after { filter: invert(1); opacity: .05; } }
#wa-season { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
main { position: relative; z-index: 1; }

/* =============================================================================================
   HEADER (暖簾 noren): paper bar, vermilion hem, gold hairline
   ============================================================================================= */
.wa-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line); transition: box-shadow .3s var(--ease); }
.wa-header::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--shu) 12%, var(--shu) 30%, var(--kin) 50%, var(--shu) 70%, var(--shu) 88%, transparent); opacity: .85; }
.wa-header.scrolled { box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.35); }
.wa-header .row { max-width: 1320px; margin: 0 auto; height: var(--header-h); padding: 0 18px; display: flex; align-items: center; gap: 14px; }
.wa-brand { display: flex; align-items: center; gap: 11px; color: var(--text); flex: none; }
.wa-brand:hover { text-decoration: none; }
.wa-brand .seal { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; background: var(--shu); color: #fff6ea;
  font-family: var(--brush); font-size: 1.45rem; line-height: 1; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22), 0 6px 14px -6px color-mix(in srgb, var(--shu) 80%, transparent); transform: rotate(-3deg); transition: transform .4s var(--ease); }
.wa-brand:hover .seal { transform: rotate(4deg) scale(1.05); }
.wa-brand .name { font-family: var(--serif); font-weight: 800; font-size: 1.16rem; line-height: 1.05; letter-spacing: 0.01em; }
.wa-brand .name small { display: block; font-family: var(--font); font-weight: 500; font-size: 0.62rem; letter-spacing: 0.26em; color: var(--muted); margin-top: 3px; }
.wa-search-btn { flex: 1 1 260px; max-width: 460px; min-width: 0; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 8px 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--muted); font: inherit; font-size: 0.88rem; cursor: text; text-align: left;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05); transition: border-color .2s, box-shadow .2s, background .2s; }
.wa-search-btn:hover { border-color: color-mix(in srgb, var(--shu) 45%, var(--line)); background: var(--paper); }
.wa-search-btn svg { flex: none; width: 17px; height: 17px; color: var(--shu); }
.wa-search-btn .txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-search-btn kbd, kbd { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 1px 0 var(--line); white-space: nowrap; }
.wa-nav { display: flex; align-items: center; gap: 2px; }
.wa-nav > a, .wa-nav > button { font: inherit; font-size: 0.9rem; color: var(--text); padding: 9px 13px; border-radius: 999px; border: 0; background: none; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; position: relative; }
.wa-nav > a:hover, .wa-nav > button:hover, .wa-nav > button[aria-expanded="true"] { background: var(--accent-soft); text-decoration: none; }
.wa-nav > a[aria-current="page"]::after, .wa-nav > button.current::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--shu); }
.wa-nav .chev { display: inline-block; font-size: 0.7em; margin-left: 4px; transition: transform .25s var(--ease); }
.wa-nav button[aria-expanded="true"] .chev { transform: rotate(180deg); }
.wa-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.wa-icon { position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--text); cursor: pointer; transition: background .2s, border-color .2s, transform .3s var(--ease); }
.wa-icon:hover { background: var(--accent-soft); border-color: var(--line); }
.wa-icon svg { width: 19px; height: 19px; }
.wa-icon[aria-pressed="true"]::after { content: ''; position: absolute; right: 6px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--shu); box-shadow: 0 0 0 2px var(--paper); }
.wa-cta { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--shu); color: #fff8ee; font-weight: 700; font-size: 0.86rem; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 18px -10px var(--shu); transition: transform .2s var(--ease), background .2s; }
.wa-cta:hover { text-decoration: none; background: var(--shu-deep); transform: translateY(-1px); }
.wa-menu-btn { display: none; }
.wa-branch-ribbon { max-width: 1320px; margin: 0 auto; padding: 0 18px; height: 0; }

/* ---------- Explore mega panel ---------- */
.wa-mega { position: absolute; left: 0; right: 0; top: calc(100% + 4px); padding: 0 14px; }
.wa-mega[hidden] { display: none; }
.wa-mega .panel { max-width: 1320px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 1fr 280px; overflow: hidden; animation: unfurl .35s var(--ease); max-height: calc(100dvh - var(--header-h) - 30px); }
@keyframes unfurl { from { opacity: 0; transform: translateY(-10px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
.wa-mega .cols { padding: 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px 22px; overflow-y: auto; }
.wa-mega .col h3 { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; margin: 0 0 6px; }
.wa-mega .col h3 a { color: var(--text); }
.wa-mega .col .count { margin-left: auto; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.wa-mega .col ul { list-style: none; margin: 0; padding: 0; }
.wa-mega .col li a { display: block; padding: 5px 10px 5px 40px; border-radius: 10px; color: var(--text); font-size: 0.86rem; line-height: 1.4; transition: background .15s; }
.wa-mega .col li a:hover, .wa-mega .col li a[aria-current="page"] { background: var(--accent-soft); text-decoration: none; }
.wa-mega .col li a[aria-current="page"] { font-weight: 700; color: var(--accent); }
.wa-mega .col.soon { opacity: .62; }
.wa-mega .col.soon .note { padding-left: 40px; font-size: 0.8rem; color: var(--muted); }
.wa-mega aside { background: var(--paper-2); border-left: 1px solid var(--line); padding: 22px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.wa-mega aside h4 { font-size: 0.72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-family: var(--font); margin: 0; }
.wa-mega aside a.feat { display: block; padding: 12px 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); color: var(--text); }
.wa-mega aside a.feat:hover { text-decoration: none; border-color: var(--shu); }
.wa-mega aside a.feat b { display: block; font-family: var(--serif); }
.wa-mega aside a.feat span { font-size: 0.78rem; color: var(--muted); }

/* ---------- kamon (family crest) ---------- */
.kamon { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--bc, var(--shu)); background: color-mix(in srgb, var(--bc, var(--shu)) 10%, transparent); border: 1px solid color-mix(in srgb, var(--bc, var(--shu)) 30%, transparent); }
.kamon svg { width: 72%; height: 72%; }
.kamon.lg { width: 56px; height: 56px; }

/* ---------- mobile drawer ---------- */
.wa-drawer { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: flex-end; background: rgba(10, 8, 6, 0.45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.wa-drawer[hidden] { display: none; }
.wa-drawer .sheet { width: min(420px, 92vw); height: 100%; background: var(--paper); border-left: 1px solid var(--line); display: flex; flex-direction: column; animation: slidein .35s var(--ease); }
@keyframes slidein { from { transform: translateX(100%); } }
.wa-drawer .top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.wa-drawer .body { flex: 1; overflow-y: auto; padding: 10px 14px 24px; }
.wa-drawer .links a { display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 12px; color: var(--text); font-weight: 600; }
.wa-drawer .links a:hover { background: var(--accent-soft); text-decoration: none; }
.wa-drawer details { border: 0; background: none; box-shadow: none; padding: 0; margin: 0; }
.wa-drawer details summary { padding: 11px 10px; border-radius: 12px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.wa-drawer details summary::before { display: none; }
.wa-drawer details summary .count { margin-left: auto; font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }
.wa-drawer details ul { list-style: none; margin: 0 0 6px; padding: 0 0 0 50px; }
.wa-drawer details li a { display: block; padding: 6px 0; color: var(--text); font-size: 0.9rem; }
.wa-drawer .grouplabel { margin: 16px 10px 6px; font-size: 0.7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

/* =============================================================================================
   PAGE FRAME
   ============================================================================================= */
.page { max-width: 1320px; margin: 0 auto; padding: 26px 18px 64px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.8rem; color: var(--muted); margin: 0 0 16px; padding: 0; list-style: none; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--shu); }
.crumbs .sep { opacity: .5; }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }
.page-head { position: relative; margin: 4px 0 26px; padding-right: 110px; }
.page-head p { color: var(--muted); max-width: 860px; margin: 0; }
.page-head p b { color: var(--text); }
.page-seal { position: absolute; right: 10px; top: 0; width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; background: var(--bc, var(--shu)); color: #fff6ea;
  font-family: var(--brush); font-size: 1.6rem; transform: rotate(4deg); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2), 0 12px 24px -12px var(--bc, var(--shu)); }
.page-kanji { position: absolute; right: 18px; top: 66px; writing-mode: vertical-rl; white-space: nowrap; font-family: var(--brush); font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; letter-spacing: .12em; color: var(--bc, var(--shu)); opacity: .2; user-select: none; pointer-events: none; }
.exp-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--bc, var(--shu)); font-weight: 700; margin-bottom: 10px; }
.exp-tag::before { content: ''; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: var(--muted); background: var(--paper); border: 1px solid var(--line); white-space: nowrap; }
.chip b { color: var(--text); }
.chip.level-Beginner { color: var(--good); }
.chip.level-Advanced { color: var(--shu); }

.sim-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.stage { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* card = a framed hanging scroll (掛軸): hairline frame, inner paper margin */
.card, .washi-card { position: relative; border-radius: var(--radius); padding: 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.card::before, .washi-card::before { content: ''; position: absolute; inset: 5px; border-radius: calc(var(--radius) - 5px); border: 1px solid var(--line-soft); pointer-events: none; }
.card + .card { margin-top: 20px; }
.grid-2 > .card, .grid-3 > .card { margin-top: 0; }
.card h2 { font-size: 1.1rem; margin-bottom: 12px; }
.card-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.card-title h2::before, .card > h2::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 10px; vertical-align: 0.12em; background: var(--shu); transform: rotate(45deg); border-radius: 1px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.canvas-wrap { position: relative; width: 100%; border-radius: 12px; overflow: hidden; background: var(--plot-bg); border: 1px solid var(--line); }
.canvas-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.canvas-hint { position: absolute; left: 10px; bottom: 9px; font-size: 0.74rem; color: #efe7d6; background: rgba(15, 12, 10, 0.55); padding: 3px 10px; border-radius: 999px; pointer-events: none; }
.canvas-hint:empty { display: none; }
.canvas-caption { font-size: 0.8rem; color: var(--muted); margin: 8px 2px 0; }

/* ---------- controls ---------- */
aside.controls { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; scrollbar-width: thin; }
.ctrl-group { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 14px; }
.ctrl-group:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.ctrl-group > .label { display: flex; align-items: center; gap: 8px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.ctrl-group > .label::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.86rem; margin-bottom: 5px; font-weight: 500; }
.field label output, .field label .val { float: right; margin-left: 8px; font-family: var(--mono); font-size: 0.74rem; color: var(--accent); background: var(--accent-soft); padding: 1px 9px; border-radius: 999px; }
select, input:not([type]), input[type="number"], input[type="text"], input[type="email"], input[type="search"], input[type="url"], input[type="tel"], textarea {
  width: 100%; font: inherit; font-size: 0.9rem; color: var(--text); background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px;
  transition: border-color .2s, box-shadow .2s, background .2s; }
/* browser autofill keeps the theme instead of a grey/yellow box */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 60px var(--paper-2) inset; caret-color: var(--text); transition: background-color 9999s; }
/* spam honeypot: never visible, never focusable by people */
/* Turnstile human check: takes no space unless Cloudflare asks the visitor to click */
.wa-turnstile { width: 100%; flex-basis: 100%; }
.wa-turnstile:empty { display: none; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
textarea { font-family: var(--mono); font-size: 0.8rem; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 55%, calc(100% - 14px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--shu); box-shadow: 0 0 0 4px color-mix(in srgb, var(--shu) 14%, transparent); background: var(--paper); }
select option { background: var(--paper); color: var(--text); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 2px 0; cursor: pointer; --f: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--shu) 0 var(--f), color-mix(in srgb, var(--text) 14%, transparent) var(--f) 100%); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 14%, transparent); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--shu); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--paper); border: 2px solid var(--shu); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); transition: transform .15s var(--ease); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 2px solid var(--shu); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 6px color-mix(in srgb, var(--shu) 22%, transparent); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; margin-bottom: 8px; cursor: pointer; line-height: 1.45; }
.check input[type="checkbox"] { -webkit-appearance: none; appearance: none; flex: none; width: 38px; height: 22px; border-radius: 999px; margin: 0; position: relative; cursor: pointer;
  background: color-mix(in srgb, var(--text) 18%, transparent); transition: background .25s var(--ease); }
.check input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); transition: transform .25s var(--ease); }
.check input[type="checkbox"]:checked { background: var(--shu); }
.check input[type="checkbox"]:checked::after { transform: translateX(16px); }
.check input[type="radio"] { -webkit-appearance: none; appearance: none; flex: none; width: 18px; height: 18px; border-radius: 50%; margin: 2px 0 0; border: 2px solid color-mix(in srgb, var(--text) 35%, transparent); cursor: pointer; }
.check input[type="radio"]:checked { border: 6px solid var(--shu); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn, .btn-j { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 0.86rem; font-weight: 700; border-radius: 999px; padding: 9px 17px; cursor: pointer;
  color: var(--text); border: 1px solid var(--line); background: var(--paper); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 3px 10px -7px rgba(0, 0, 0, 0.4);
  transition: transform .15s var(--ease), border-color .2s, background .2s, color .2s; }
.btn:hover, .btn-j:hover { transform: translateY(-1px); border-color: var(--shu); text-decoration: none; }
.btn:active, .btn-j:active { transform: translateY(1px) scale(0.98); }
.btn.primary, .btn-j.primary { color: #fff8ee; border-color: transparent; background: var(--shu); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 22px -12px var(--shu); }
.btn.primary:hover, .btn-j.primary:hover { background: var(--shu-deep); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-j .arr { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); transition: transform .3s var(--ease); }
.btn-j:hover .arr { transform: translateX(3px); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--text) 6%, transparent); border: 1px solid var(--line-soft); }
.seg button { font: inherit; font-size: 0.8rem; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: background .25s var(--ease), color .2s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--paper); color: var(--shu); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.35); }

/* ---------- readouts ---------- */
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat, .readout { border-radius: 12px; padding: 10px 13px; min-width: 0; background: var(--paper-2); border: 1px solid var(--line-soft); }
.stat .k, .readout .k { display: block; font-size: 0.64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.stat .v, .readout .v { display: block; font-family: var(--mono); font-size: 0.95rem; font-weight: 600; overflow-wrap: anywhere; margin-top: 2px; }
.stat .v.good, .readout .v.good { color: var(--good); }
.stat .v.bad, .readout .v.bad { color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line-soft); }
.legend span::before { content: ''; width: 14px; height: 4px; border-radius: 4px; background: var(--sw); }

/* ---------- prose: theory, notes, details, tables ---------- */
.theory { margin-top: 20px; }
.theory .card { line-height: calc(var(--lh) + 0.08); }
.theory h3 { margin-top: 1.1em; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.theory h3::before { content: ''; width: 16px; height: 2px; background: var(--shu); border-radius: 2px; flex: none; }
.theory h3:first-child { margin-top: 0; }
.theory ul, .theory ol { padding-left: 1.25em; margin: 0 0 0.9em; }
.theory li { margin-bottom: 5px; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 6px 0; }
.note { border-radius: 12px; padding: 10px 14px; font-size: 0.9rem; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.note.warn { background: color-mix(in srgb, var(--kin) 12%, transparent); border-left-color: var(--kin); }
details { border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; background: var(--paper-2); border: 1px solid var(--line-soft); }
details summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; list-style: none; display: flex; align-items: center; gap: 10px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '+'; display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); color: var(--shu); font-weight: 800; transition: transform .3s var(--ease); }
details[open] summary::before { transform: rotate(45deg); }
details p { margin: 8px 0 2px 32px; font-size: 0.9rem; color: var(--muted); }
.table-scroll { overflow: auto; max-height: 340px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
table.data, table.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.84rem; }
table.data th, table.data td, table.data-table th, table.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; }
table.data thead th, table.data-table thead th, table.data-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); font-weight: 700; font-size: 0.66rem; text-transform: uppercase; letter-spacing: .1em; background: var(--paper-2); }
table.data tbody tr:hover td, table.data-table tbody tr:hover td { background: var(--accent-soft); }
table.data td.num { font-family: var(--mono); text-align: right; }
table.obs input, table.obs select { padding: 5px 9px; font-family: var(--mono); font-size: 0.8rem; width: 100%; border-radius: 8px; }
table.obs td { padding: 4px 5px; }

/* ---------- prev / next & discussion ---------- */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.prevnext a { display: flex; flex-direction: column; gap: 3px; padding: 16px 22px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-family: var(--serif); transition: transform .25s var(--ease), border-color .2s; }
.prevnext a:hover { transform: translateY(-2px); border-color: var(--shu); text-decoration: none; }
.prevnext a small { font-family: var(--font); font-weight: 600; color: var(--muted); font-size: 0.7rem; letter-spacing: .12em; text-transform: uppercase; }
.prevnext a.next { text-align: right; grid-column: 2; }
.wa-discuss { margin-top: 30px; }
/* ---------- comments (comments.js) ---------- */
.cm-head { margin-bottom: 12px; }
.cm-title { margin: 0 0 2px; font-size: 1.1rem; }
.cm-title::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 10px; vertical-align: 0.12em; background: var(--shu); transform: rotate(45deg); border-radius: 1px; }
.cm-count { color: var(--muted); font-family: var(--mono); font-size: .8rem; font-weight: 600; }
.cm-head p { margin: 0; }
.cm-form { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line-soft); margin-bottom: 18px; }
.cm-form textarea { font-family: var(--font); font-size: .92rem; min-height: 84px; background: var(--paper); }
.cm-who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cm-name { flex: 1 1 220px; }
.cm-name input { background: var(--paper); border-radius: 999px; }
.cm-or { flex: none; }
.cm-gbtn { min-height: 32px; }
.cm-me { display: inline-flex; align-items: center; gap: 10px; flex: 1; font-size: .88rem; }
.cm-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.cm-reply-to { margin-right: auto; font-size: .82rem; color: var(--muted); }
.cm-cancel { border: 0; background: none; color: var(--shu); font-size: 1.1rem; cursor: pointer; padding: 0 4px; }
.cm-status { margin: 0; }
.cm-status:empty, .cm-ts:empty { display: none; }
.cm-status.ok { color: var(--good); }
.cm-list, .cm-replies { list-style: none; margin: 0; padding: 0; }
.cm-item { display: flex; gap: 12px; padding: 14px 0; border-top: 1px dashed var(--line); }
.cm-list > .cm-item:first-child { border-top: 0; }
.cm-replies { margin-top: 6px; }
.cm-replies .cm-item { padding: 10px 0 4px; border-top: 0; }
.cm-av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; object-fit: cover; }
.cm-sub .cm-av { width: 28px; height: 28px; font-size: .68rem; }
.cm-main { flex: 1; min-width: 0; }
.cm-meta { font-size: .84rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cm-meta time { color: var(--muted); font-size: .76rem; }
.cm-badge { font-size: .62rem; font-weight: 800; letter-spacing: .06em; padding: 1px 7px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); }
.cm-body { margin-top: 3px; font-size: .92rem; overflow-wrap: anywhere; }
.cm-reply { margin-top: 4px; border: 0; background: none; padding: 2px 0; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.cm-reply:hover { color: var(--shu); }
.cm-empty, .cm-loading { padding: 10px 0; }

/* ---------- AdSense container ---------- */
/* collapsed until AdSense actually fills the slot, so visitors never see an empty box */
.adsense-unit-wrap { margin: 0; padding: 0; border: 0; min-height: 0; text-align: center; overflow: hidden; }
.adsense-unit-wrap:has(ins[data-ad-status="unfilled"]) { display: none; }
.adsense-unit-wrap .ad-label { display: none; }
.adsense-unit-wrap:has(ins[data-ad-status="filled"]) { margin: 28px 0; padding: 12px; border-radius: 14px; border: 1px solid var(--line-soft); background: var(--paper-2); }
.adsense-unit-wrap:has(ins[data-ad-status="filled"]) .ad-label { display: block; }
.ad-label { font-size: 0.64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* =============================================================================================
   FOOTER
   ============================================================================================= */
.wa-footer { position: relative; z-index: 1; margin-top: 40px; background: var(--paper); border-top: 1px solid var(--line); }
.wa-footer::before { content: ''; display: block; height: 22px; opacity: .55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='22' viewBox='0 0 44 22'><g fill='none' stroke='%23c23b22' stroke-width='1'><circle cx='22' cy='22' r='20'/><circle cx='22' cy='22' r='15'/><circle cx='22' cy='22' r='10'/><circle cx='0' cy='22' r='20'/><circle cx='0' cy='22' r='15'/><circle cx='44' cy='22' r='20'/><circle cx='44' cy='22' r='15'/></g></svg>"); background-size: 44px 22px; border-bottom: 1px solid var(--line); }
.wa-footer .inner { max-width: 1320px; margin: 0 auto; padding: 36px 18px 26px; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
.wa-footer h4 { font-size: 0.72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-family: var(--font); margin: 0 0 12px; }
.wa-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.wa-footer ul a { color: var(--text); font-size: 0.88rem; }
.wa-footer .brandcol p { color: var(--muted); font-size: 0.88rem; max-width: 380px; }
.wa-footer .legal { max-width: 1320px; margin: 0 auto; padding: 16px 18px 26px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; font-size: 0.78rem; color: var(--muted); }
.wa-news { display: flex; gap: 8px; margin-top: 12px; max-width: 400px; }
.wa-news { flex-wrap: wrap; }
.wa-news input { flex: 1 1 180px; min-width: 0; border-radius: 999px; }
.wa-news .btn { flex: none; }

/* =============================================================================================
   DIALOGS: search palette, accessibility panel, forms, shortcuts, toasts
   ============================================================================================= */
.wa-dialog { position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 14px 14px; background: rgba(12, 9, 6, 0.5); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fade .2s ease; }
.wa-dialog[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.wa-dialog .box { position: relative; width: min(720px, 100%); max-height: 84vh; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .3s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.wa-dialog .box.narrow { width: min(480px, 100%); }
.wa-dialog .box-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.wa-dialog .box-head h2 { margin: 0; font-size: 1.1rem; }
.wa-dialog .box-body { padding: 18px; overflow-y: auto; }
.wa-dialog .close { margin-left: auto; }
/* search palette */
.wa-search .bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.wa-search .bar svg { width: 22px; height: 22px; color: var(--shu); flex: none; }
.wa-search .bar input { border: 0; background: none; box-shadow: none; padding: 6px 0; font-size: 1.08rem; font-family: var(--font); }
.wa-search .bar input:focus { box-shadow: none; background: none; }
.wa-search .bar input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.wa-search .filters { display: flex; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.wa-search .filters::-webkit-scrollbar { display: none; }
.wa-search .filters button { flex: none; font: inherit; font-size: 0.76rem; font-weight: 600; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.wa-search .filters button[aria-pressed="true"] { background: var(--shu); color: #fff8ee; border-color: var(--shu); }
.wa-search .results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.wa-search .group { padding: 10px 12px 4px; font-size: 0.68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.wa-search .res { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 14px; color: var(--text); cursor: pointer; }
.wa-search .res[aria-selected="true"], .wa-search .res:hover { background: var(--accent-soft); text-decoration: none; }
.wa-search .res[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--shu); }
.wa-search .res .t { font-weight: 700; font-family: var(--serif); display: block; }
.wa-search .res .s { font-size: 0.8rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-search .res .meta { margin-left: auto; flex: none; font-size: 0.7rem; color: var(--muted); text-align: right; white-space: nowrap; }
.wa-search mark { background: color-mix(in srgb, var(--kin) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.wa-search .empty { padding: 30px 18px; text-align: center; color: var(--muted); }
.wa-search .foot { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 18px; border-top: 1px solid var(--line-soft); font-size: 0.74rem; color: var(--muted); }
/* accessibility panel */
.wa-a11y .opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--line-soft); }
.wa-a11y .opt:last-child { border-bottom: 0; }
.wa-a11y .opt b { display: block; font-size: 0.92rem; }
.wa-a11y .opt span { font-size: 0.78rem; color: var(--muted); }
.wa-a11y .stepper { display: inline-flex; align-items: center; gap: 4px; }
.wa-a11y .stepper button { width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); color: var(--text); font: inherit; font-weight: 800; cursor: pointer; }
.wa-a11y .stepper output { min-width: 52px; text-align: center; font-family: var(--mono); font-size: 0.8rem; }
.wa-a11y .switch { -webkit-appearance: none; appearance: none; flex: none; width: 44px; height: 26px; border-radius: 999px; background: color-mix(in srgb, var(--text) 18%, transparent); position: relative; cursor: pointer; transition: background .2s; }
.wa-a11y .switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); transition: transform .2s var(--ease); }
.wa-a11y .switch:checked { background: var(--shu); }
.wa-a11y .switch:checked::after { transform: translateX(18px); }
/* forms */
.wa-form { display: grid; gap: 12px; }
.wa-form label { display: grid; gap: 5px; font-size: 0.86rem; font-weight: 600; }
.wa-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.wa-form .status { font-size: 0.86rem; min-height: 1.2em; }
.wa-form .status.ok { color: var(--good); }
.wa-form .status.err { color: var(--bad); }
.wa-shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; font-size: 0.9rem; }
.wa-toasts { position: fixed; z-index: 500; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.wa-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--paper); font-size: 0.88rem; box-shadow: var(--shadow-lg); animation: rise .3s var(--ease); }
.wa-toast .seal { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--shu); color: #fff; font-family: var(--brush); font-size: 0.8rem; }

/* =============================================================================================
   GENERIC CONTENT PAGES (about, legal, contact, explore, community)
   ============================================================================================= */
.prose { max-width: 820px; }
.prose h2 { margin-top: 1.6em; display: flex; align-items: center; gap: 10px; }
.prose h2::before { content: ''; width: 18px; height: 2px; background: var(--shu); }
.page-hero { position: relative; padding: 18px 0 8px; margin-bottom: 18px; }
.page-hero .kicker, .kicker { margin: 0 0 6px; font-size: 0.72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kicker [lang="ja"] { font-family: var(--serif); letter-spacing: .25em; color: var(--shu); }
.page-hero h1 { font-size: clamp(1.8rem, 4.4vw, 3rem); }
.page-hero p { color: var(--muted); max-width: 760px; font-size: 1.02rem; }
.hero, .contact-hero { padding: 18px 0; }
.exp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.exp-card { display: flex; gap: 14px; border-radius: var(--radius); padding: 16px 18px; color: var(--text); background: var(--paper); border: 1px solid var(--line); transition: transform .3s var(--ease), border-color .2s; }
.exp-card:hover { transform: translateY(-3px); border-color: var(--shu); text-decoration: none; }
.exp-num { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-family: var(--brush); font-size: 1.1rem; color: #fff6ea; background: var(--shu); }
.exp-card h3 { margin: 0 0 4px; }
.exp-card p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.exp-card .method { margin-top: 8px; display: inline-block; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 28px; }
.principles .card { margin: 0; }
.contact-container, .contact-card { max-width: 900px; }
.zen-form { display: grid; gap: 12px; }
.zen-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.zen-field { display: grid; gap: 5px; }
.zen-input, .zen-select, .zen-textarea { width: 100%; }
.success-seal, .hanko { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--shu); color: #fff; font-family: var(--brush); font-size: 1.3rem; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--shu); animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- experiment card (shared by landing & explore) ---------- */
.xcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.xcard { position: relative; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow-sm); transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .3s; }
.xcard::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--bc, var(--shu)); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.xcard:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--bc, var(--shu)) 55%, var(--line)); text-decoration: none; }
.xcard:hover::after { transform: scaleX(1); }
.xcard:focus-visible { outline: 3px solid var(--bc, var(--shu)); outline-offset: 3px; }
.xprev { position: relative; height: 150px; background: #0d1122; }
.xprev canvas { width: 100%; height: 100%; display: block; }
.xprev .kanji-wm { position: absolute; right: 10px; bottom: 4px; font-family: var(--brush); font-size: 2.2rem; color: rgba(255, 255, 255, 0.14); pointer-events: none; }
.xbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.xmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.xtag { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--bc, var(--shu)); }
.xcard h3 { font-size: 1.02rem; margin: 2px 0 0; }
.xcard .xjp { font-family: var(--serif); font-size: 0.78rem; color: var(--muted); }
.xcard p { font-size: 0.84rem; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.xcard .xfoot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; font-size: 0.76rem; color: var(--muted); }
.xcard .xgo { color: var(--bc, var(--shu)); font-weight: 700; }
.badge-new { font-size: 0.62rem; font-weight: 800; letter-spacing: .1em; color: #fff; background: var(--shu); padding: 2px 7px; border-radius: 999px; }

/* ---------- reveal motion (ink bleeds in) ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* =============================================================================================
   RESPONSIVE
   ============================================================================================= */
@media (max-width: 1180px) {
  .wa-nav > a.opt-wide { display: none; }
}
@media (max-width: 980px) {
  .sim-layout { grid-template-columns: minmax(0, 1fr); }
  .wa-nav, .wa-cta { display: none; }
  .wa-menu-btn { display: grid; }
  .wa-search-btn { max-width: none; }
  .wa-mega .panel { grid-template-columns: 1fr; }
  .wa-mega aside { display: none; }
  body.has-sheet { padding-bottom: 80px; }
  aside.controls { position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; z-index: 90; margin: 0; max-height: 78dvh; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 22px; padding: 0 16px 18px; transform: translateY(calc(100% - 60px)); transition: transform .38s var(--ease); box-shadow: 0 -10px 40px -12px rgba(0, 0, 0, 0.45); }
  aside.controls.open { transform: translateY(0); }
  .sheet-handle { display: flex; align-items: center; justify-content: center; gap: 10px; width: calc(100% + 32px); margin: 0 -16px 12px; position: sticky; top: 0; z-index: 2; height: 60px;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 22px 22px 0 0; background: var(--paper); color: var(--text); font: inherit; font-family: var(--serif); font-weight: 700; font-size: 1rem; cursor: pointer; }
  .sheet-handle .grip { position: absolute; top: 8px; width: 44px; height: 5px; border-radius: 5px; background: color-mix(in srgb, var(--text) 22%, transparent); }
  .sheet-handle .chev { font-size: 0.7rem; color: var(--muted); transition: transform .3s var(--ease); }
  aside.controls.open .sheet-handle .chev { transform: rotate(180deg); }
  .wa-footer .inner { grid-template-columns: 1fr 1fr; }
}
.sheet-handle { display: none; }
@media (max-width: 980px) { .sheet-handle { display: flex; } }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .wa-form .row2, .zen-form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --header-h: 58px; }
  body { font-size: 0.9rem; }
  .wa-header .row { padding: 0 10px; gap: 8px; }
  .wa-brand .name small { display: none; }
  .wa-brand .name { font-size: 1.02rem; }
  .wa-brand .seal { width: 34px; height: 34px; font-size: 1.2rem; }
  .wa-search-btn { height: 38px; padding: 0 12px; flex: 1 1 auto; }
  .wa-search-btn .txt, .wa-search-btn kbd { display: none; }
  .wa-search-btn { flex: 0 0 auto; width: 40px; padding: 0; justify-content: center; border-radius: 999px; }
  .wa-actions .opt-hide { display: none; }
  .page { padding: 18px 12px 40px; }
  .page-head { padding-right: 62px; }
  .page-seal { width: 42px; height: 42px; font-size: 1.15rem; }
  .page-kanji { font-size: 1.8rem; top: 52px; right: 12px; }
  .card { padding: 13px; }
  .card + .card { margin-top: 12px; }
  .stage, .grid-2, .grid-3 { gap: 12px; }
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .canvas-wrap[style*="height:5"], .canvas-wrap[style*="height:4"], .canvas-wrap[style*="height:3"] { height: 270px !important; }
  .canvas-wrap[style*="height:2"] { height: 200px !important; }
  .canvas-wrap[style*="height:1"] { height: 150px !important; }
  .seg { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { padding: 6px 11px; font-size: 0.76rem; white-space: nowrap; flex: none; }
  .prevnext { grid-template-columns: 1fr; }
  .prevnext a.next { grid-column: 1; }
  .wa-footer .inner { grid-template-columns: 1fr; gap: 22px; }
  .wa-dialog { padding: 0; align-items: flex-end; }
  .wa-dialog .box { max-height: 92dvh; border-radius: 22px 22px 0 0; width: 100%; }
}
@media print {
  .wa-header, .wa-footer, aside.controls, .prevnext, #wa-season, .wa-atmos, .adsense-unit-wrap, .wa-discuss { display: none !important; }
  .sim-layout { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
}
