:root{color-scheme:light;--bg:#f3f6f8;--panel:#fff;--ink:#162637;--muted:#526679;--line:#d8e2e9;--soft:#edf4f6;--accent:#146b76;--accent-dark:#095965;--accent-ink:#fff;--shadow:0 12px 35px #2549600b;--radius:16px;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Noto Sans JP",sans-serif}
:root[data-theme=dark]{color-scheme:dark;--bg:#101a22;--panel:#182631;--ink:#e6eef2;--muted:#a1b4c1;--line:#344a58;--soft:#223744;--accent:#72d2d2;--accent-dark:#92e5e3;--accent-ink:#0d2930;--shadow:none}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-size:15px;line-height:1.65}button,input,textarea,select{font:inherit}button{cursor:pointer}a{color:var(--accent);text-underline-offset:3px}button:focus-visible,a:focus-visible,textarea:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid var(--accent);outline-offset:3px}button:disabled{opacity:.45;cursor:not-allowed}.shell{max-width:1040px;margin:auto;padding:0 28px}.topbar{border-bottom:1px solid var(--line);background:var(--panel)}.nav{display:flex;min-height:68px;align-items:center;gap:16px;justify-content:space-between}.brand{display:flex;gap:10px;align-items:center;font-weight:750;text-decoration:none;color:var(--ink);letter-spacing:-.03em}.brandmark{display:grid;place-items:center;background:var(--accent);color:var(--accent-ink);width:35px;height:35px;border-radius:10px}.brandmark svg{width:24px;height:24px}.nav-actions{display:flex;align-items:center;gap:10px}.nav-actions a{font-weight:600;font-size:13px;text-decoration:none}.theme{border:1px solid var(--line);background:var(--panel);color:var(--ink);width:36px;height:36px;border-radius:10px}.hero{padding:48px 0 27px}.eyebrow{font:700 11px/1.5 ui-monospace,monospace;letter-spacing:.13em;color:var(--accent);text-transform:uppercase}.hero h1{font-size:clamp(28px,5vw,44px);margin:7px 0 10px;letter-spacing:-.055em;line-height:1.18}.hero p{color:var(--muted);margin:0;max-width:760px}.features{display:flex;flex-wrap:wrap;gap:8px 16px;margin:18px 0 0;color:var(--muted);font-size:12px}.features span:before{content:'✓';color:var(--accent);font-weight:bold;margin-right:6px}.workspace{background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:var(--radius);overflow:hidden}.tabs{display:flex;gap:6px;background:var(--soft);padding:7px;border-bottom:1px solid var(--line)}.tab{border:1px solid transparent;background:transparent;color:var(--muted);font-weight:650;padding:10px 18px;flex:1;border-radius:10px}.tab[aria-selected=true]{background:var(--panel);border-color:var(--line);color:var(--ink);box-shadow:0 2px 8px #00000008}.pane{padding:24px}.pane[hidden]{display:none}.section-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:0 0 12px}.section-head h2,.section-head label{font-weight:700;font-size:16px;margin:0}.sub{font-size:12px;color:var(--muted)}.field{width:100%;resize:vertical;min-height:108px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:var(--ink);font-family:ui-monospace,SFMono-Regular,Consolas,monospace;line-height:1.6}.field::placeholder{color:var(--muted);opacity:.8}.controlrow{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:12px 0 20px}.spacer{flex:1}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--line);border-radius:9px;padding:8px 12px;background:var(--panel);color:var(--ink);font-weight:650;font-size:13px;text-decoration:none;min-height:38px}.btn:hover:not(:disabled){background:var(--soft);border-color:var(--accent)}.btn.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}.btn.primary:hover:not(:disabled){background:var(--accent-dark);color:var(--accent-ink)}select{max-width:100%;border:1px solid var(--line);background:var(--panel);color:var(--ink);border-radius:8px;padding:7px 9px;font-size:13px}.option{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}.preview{min-height:126px;background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:14px;display:flex;align-items:center;align-content:center;flex-wrap:wrap;gap:3px;color:var(--ink);overflow-wrap:anywhere}.preview .glyph{width:48px;height:66px;flex:none}.preview .gap{margin-right:14px}.empty{color:var(--muted);font-size:14px;padding:12px}.notice{min-height:21px;font-size:12px;color:var(--muted);margin:7px 0 0}.warning{color:#9b4b13}:root[data-theme=dark] .warning{color:#ffba83}.exportbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:12px}.rule{border:0;border-top:1px solid var(--line);margin:23px 0}.compact{min-height:48px;resize:vertical}.keyset{display:grid;grid-template-columns:repeat(13,minmax(0,1fr));gap:6px}.key{display:flex;flex-direction:column;align-items:center;gap:0;border:1px solid var(--line);border-radius:10px;padding:5px 0 3px;background:var(--panel);color:var(--ink);min-width:0}.key:hover{background:var(--soft);border-color:var(--accent)}.key .glyph{width:100%;max-width:47px;height:54px}.key .keylabel{font-size:11px;font-weight:700;color:var(--muted)}.keyset.hide-labels .keylabel{visibility:hidden}.keyset-title{font-size:13px;font-weight:700;margin:14px 0 7px}.decoded{min-height:78px}.check{display:flex;gap:6px;align-items:center;color:var(--muted);font-size:12px}.reference{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}.ref{border:1px solid var(--line);border-radius:10px;padding:8px 4px;text-align:center;min-width:0}.ref strong{display:block;font-size:15px}.ref .pair{display:flex;justify-content:center}.ref .glyph{width:48%;max-width:43px;height:59px}.ref small{color:var(--muted);display:block;font-size:10px}.content{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:24px 0}.article{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:22px}.article h2{font-size:18px;margin:0 0 10px;letter-spacing:-.025em}.article p,.article li{font-size:14px;color:var(--muted)}.article p:last-child{margin-bottom:0}.article ol{padding-left:20px;margin-bottom:0}.wide{grid-column:1/-1}.article details{border-top:1px solid var(--line);padding:12px 0}.article details:last-child{padding-bottom:0}.article summary{cursor:pointer;font-weight:650}.article details p{margin-bottom:0}.foot{border-top:1px solid var(--line);padding:20px 0 36px;color:var(--muted);font-size:12px}.foot a{margin-right:12px}.foot p{margin:6px 0}.mono{font-family:ui-monospace,monospace}.tag{font-size:11px;color:var(--accent);background:var(--soft);border-radius:5px;padding:2px 6px}.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);z-index:10;background:var(--ink);color:var(--panel);padding:9px 16px;border-radius:10px;box-shadow:var(--shadow);max-width:90vw;font-size:13px;pointer-events:none}.toast[hidden]{display:none}.ad-slot:empty{display:none}.skip{position:absolute;left:-999px}.skip:focus{left:12px;top:12px;background:var(--panel);padding:10px;z-index:100}code{overflow-wrap:anywhere}@media(max-width:720px){.shell{padding:0 15px}.nav{min-height:60px}.hero{padding:30px 0 20px}.pane{padding:15px}.tab{padding:9px 4px;font-size:13px}.keyset{grid-template-columns:repeat(7,minmax(0,1fr))}.reference{grid-template-columns:repeat(4,minmax(0,1fr))}.content{grid-template-columns:1fr;gap:12px}.article{padding:17px}.preview .glyph{width:40px;height:55px}.section-head{flex-wrap:wrap}.exportbar .option{flex-wrap:wrap}.brand{font-size:14px}.nav-actions{gap:8px}}@media(max-width:350px){.keyset{grid-template-columns:repeat(5,minmax(0,1fr))}.reference{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(prefers-reduced-motion:no-preference){.btn,.key,.tab{transition:background .12s,border-color .12s}}

.after-preview{margin-top:18px}

/* In-place decoder editing */
.edit-preview{gap:5px;align-content:flex-start;align-items:center}
.edit-token{display:inline-flex;align-items:center;justify-content:center;flex:none;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--ink);padding:3px;min-width:44px;min-height:44px}
.edit-token:hover{border-color:var(--accent);background:var(--panel)}
.edit-token[aria-pressed=true]{border-color:var(--accent);background:var(--panel);box-shadow:0 0 0 2px var(--accent)}
.edit-hint{margin:9px 0 6px}
.edit-status{display:flex;align-items:center;flex-wrap:wrap;gap:7px;min-height:38px;color:var(--muted);font-size:12px}
.edit-status .is-editing{color:var(--accent);font-weight:700}
.edit-status .btn[hidden]{display:none}

/* Compact workspace (v0.2.3). Keep the figure buttons individually accessible. */
body{line-height:1.5}
.nav{min-height:50px}
.brandmark{width:30px;height:30px;border-radius:8px}
.brandmark svg{width:21px;height:21px}
.hero{padding:17px 0 13px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:3px 16px}
.hero .eyebrow{grid-column:1/-1;font-size:10px}
.hero h1{font-size:clamp(24px,3vw,32px);margin:0;line-height:1.2}
.hero p{grid-column:1/-1;grid-row:3;font-size:13px;max-width:none}
.features{grid-column:2;grid-row:2;margin:0;gap:4px 12px;justify-content:flex-end;font-size:11px}
.tabs{padding:4px;gap:4px}
.tab{min-height:36px;padding:6px 12px;border-radius:8px;font-size:14px}
.pane{padding:14px 16px}
.section-head{margin:0 0 6px;gap:6px}
.section-head h2,.section-head>label{font-size:15px}
.section-head .check{font-size:12px;font-weight:500}
.section-head .check input{margin:0}
.field{min-height:76px;padding:8px 10px;line-height:1.45;border-radius:8px}
.controlrow{gap:6px;margin:7px 0 12px}
.btn{min-height:34px;padding:5px 10px;border-radius:7px;font-size:12px;white-space:nowrap}
select{padding:5px 7px}
.preview{min-height:80px;padding:7px;gap:2px;border-radius:9px}
.preview .glyph{width:42px;height:54px}
.empty{padding:7px;font-size:13px}
.notice{min-height:0;margin:4px 0 0}
.notice:empty{margin:0;display:none}
.exportbar{margin-top:7px;gap:6px}
.rule{margin:11px 0}
.compact{min-height:38px}
.pane>.sub{margin:5px 0 8px}
#decode .edit-preview{min-height:66px;max-height:174px;overflow-y:auto;overscroll-behavior:contain;align-content:flex-start;gap:2px}
.edit-preview .edit-token{padding:2px;min-width:44px;min-height:44px;border-radius:6px}
.edit-preview .glyph{width:39px;height:49px}
/* The hint remains available to assistive technology; the live status conveys it visually. */
#edit-hint{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;margin:0;padding:0}
.decoder-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:4px 12px;margin:6px 0 8px}
.decoder-toolbar .controlrow{margin:0;gap:5px}
.decoder-toolbar .edit-status{min-height:0;flex:1 1 280px;justify-content:flex-end;gap:5px;font-size:11px;line-height:1.4}
.decoder-toolbar .edit-status span{flex:1;text-align:right}
.decoded-row{display:flex;align-items:center;gap:8px}
.decoded-row>label{font-size:14px;font-weight:700;flex-shrink:0}
.decoded-row .decoded{flex:1;min-width:0;min-height:38px;height:38px;width:auto;padding:8px 10px;resize:vertical}
.keyset{gap:4px}
.key{border-radius:7px;padding:2px 0;min-height:54px}
.key .glyph{height:39px;max-width:43px}
.key .keylabel{font-size:10px;line-height:12px}
.keyset-title{font-size:12px;line-height:1.4;margin:8px 0 4px}
#decode .keyboard-hint{margin:0 0 4px}
.parse-row{display:flex;align-items:stretch;gap:6px}
.parse-row .field{flex:1;min-width:0;height:42px}
.parse-row .btn{flex-shrink:0;align-self:center}
.reference{gap:5px}
.ref{padding:4px 3px;border-radius:7px}
.ref .glyph{height:46px}
.ref small{font-size:10px}
#glyph-note{margin:7px 0}
.content{margin:16px 0;gap:12px}
.article{padding:16px}
.article h2{margin:0 0 6px}
@media(max-width:720px){
 .shell{padding:0 12px}
 .nav{min-height:46px}
 .hero{padding:12px 0 10px;display:flex;flex-direction:column;align-items:flex-start;gap:3px}
 .hero h1{font-size:25px}
 .hero p{font-size:12px}
 .hero .features{justify-content:flex-start;gap:3px 9px;font-size:10px}
 .pane{padding:10px}
 .tab{font-size:13px;padding:6px 3px}
 .btn{min-height:36px;padding:5px 8px}
 .decoder-toolbar{gap:4px;margin:5px 0 7px}
 .decoder-toolbar .edit-status{justify-content:flex-start;flex:1 1 100%;gap:4px}
 .decoder-toolbar .edit-status span{text-align:left;flex:1 1 100%}
 .decoded-row{gap:6px}
 .decoded-row>label{font-size:12px}
 .decoded-row .decoded{font-size:14px}
 .keyset{gap:3px}
 .key{min-height:50px;padding:1px 0}
 .key .glyph{height:35px;max-width:38px}
 .key .keylabel{font-size:10px;line-height:12px}
 #decode .edit-preview{min-height:58px;max-height:139px;padding:4px}
 .edit-preview .glyph{width:35px;height:43px}
 .rule{margin:9px 0}
 .content{gap:9px;margin:12px 0}
}
@media(max-width:350px){.shell{padding:0 8px}.pane{padding:8px}.keyset{gap:4px}.decoded-row{flex-wrap:wrap}.decoded-row .decoded{flex-basis:50%}}

/* Compact figure-order switch; keep it on the existing selector heading row. */
.keyboard-options{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:6px 12px}
.key-order{display:inline-flex;gap:2px;padding:2px;border:1px solid var(--line);border-radius:8px;background:var(--soft)}
.key-order button{border:1px solid transparent;padding:3px 10px;min-height:27px;border-radius:5px;background:transparent;color:var(--muted);font-size:12px;font-weight:650;line-height:1.35;white-space:nowrap}
.key-order button[aria-pressed=true]{background:var(--panel);border-color:var(--line);color:var(--ink);box-shadow:0 1px 3px #00000012}
.key-order button:hover{color:var(--accent)}
.keyboard-options .check{white-space:nowrap}
@media(max-width:720px){.keyboard-options{gap:4px 8px}.key-order button{min-height:30px;padding:4px 8px;font-size:11px}.keyboard-options .check{font-size:11px;gap:3px}}
