.rule-guide {
  --guide-ink:#252820;--guide-blue:var(--edition-ink,#285249);--guide-line:#b4b0a1;
  width:min(510px,calc(100% - 24px));max-height:85vh;max-height:85dvh;
  overflow-y:auto;overscroll-behavior:contain;box-sizing:border-box;scrollbar-width:none;
  border:1px solid #858579;border-radius:3px;padding:0;background:var(--print-stock,#f3ead4);background-image:var(--print-grain,none);
  color:var(--guide-ink);font-family:inherit;text-align:left;color-scheme:light;
}
.rule-guide::-webkit-scrollbar{display:none}
.rule-guide::backdrop{background:#141815c7}
.rule-guide button{font:inherit;color:inherit;cursor:pointer}
.rule-guide button:focus-visible{outline:3px solid #b27528;outline-offset:2px}
.rg-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:12px;padding:10px 12px;background:#1c201e;color:#f7f2e4;border-bottom:1px solid #585b51}
.rg-head::before{content:"";width:52px;height:42px;flex:none;background-position:center;background-size:cover}
.rule-guide[data-game="code"] .rg-head::before{background-image:url('/assets/edition/code.webp')}
.rule-guide[data-game="rect"] .rg-head::before{background-image:url('/assets/edition/rect.webp')}
.rule-guide[data-game="loop"] .rg-head::before{background-image:url('/assets/edition/loop.webp')}
.rg-head h2{font:600 22px/1.3 MaruBuri,serif;letter-spacing:-.055em;margin:0}
.rg-head button{margin-left:auto;width:44px;height:44px;border:0;background:transparent;font-size:26px}
.rg-sections{padding:0 clamp(14px,4vw,27px)}
.rg-section{padding:20px 0 17px}
.rg-section+.rg-section{border-top:1px solid var(--guide-line)}
.rg-section h3{margin:0 0 11px;display:flex;align-items:center;gap:9px;font:600 clamp(17px,4.7vw,21px)/1.45 MaruBuri,serif;letter-spacing:-.06em}
.rg-count{display:grid;place-items:center;flex:none;min-width:20px;height:23px;border-bottom:2px solid currentColor;color:var(--guide-blue);font:750 13px/1 SUIT,sans-serif}
.rg-caption{margin:9px 0 0;font-size:14px;line-height:1.6;color:#45534b;word-break:keep-all}
.rg-board{background:#fcf7e8;background-image:var(--print-grain,none);border-block:1px solid var(--guide-line);min-height:125px;display:grid;align-content:center;justify-items:center;gap:7px;padding:7px}
.rg-board svg{display:block;width:100%;height:auto;max-height:130px;font-family:inherit}
.rg-practice{padding:14px 9px 8px}
.rg-status{margin:0;min-height:2.1em;line-height:1.4;font-size:13px;font-weight:650;color:var(--guide-blue);text-align:center;word-break:keep-all;align-content:center}
.rg-end{padding:0 18px 16px;display:flex;justify-content:center}
.rg-end button{min-width:108px;min-height:44px;background:#252921;color:#faf5e8;border:0;border-radius:3px;font-weight:650}
.rg-cell{position:relative;height:68px;width:80px;margin:12px auto 4px;border:1px dashed #888f94;border-left:4px solid var(--guide-blue);display:grid;place-items:center}.rg-clue{font-size:29px;line-height:1}.rg-cell i{background:var(--guide-ink);border-radius:50%;height:7px;width:7px;position:absolute;pointer-events:none}.rg-cell i:nth-of-type(odd){left:-5px}.rg-cell i:nth-of-type(even){right:-4px}.rg-cell i:nth-of-type(-n+2){top:-4px}.rg-cell i:nth-of-type(n+3){bottom:-4px}
.rg-edge{position:absolute;height:44px;width:calc(100% - 6px);left:3px;top:-22px;border:0;background:transparent;padding:0}.rg-edge::before{content:'';display:block;border-top:2px dashed var(--guide-blue)}.rg-edge[data-mark="1"]::before{border-top:4px solid var(--guide-blue)}.rg-edge[data-mark="2"]::before{border-top-color:#aaa}.rg-edge[data-mark="2"]::after{content:'×';position:absolute;inset:0;display:grid;place-content:center;font-size:26px;color:#9b452c}
.rg-grid{--columns:2;display:grid;grid-template-columns:repeat(2,48px);border:1px solid #a9afb4}.rg-grid button{width:48px;height:48px;border:1px solid #c6cbcd;background:#fff;font-size:21px}.rg-grid .noted,.rg-grid .corner,.rg-deck .chosen,.rg-card[aria-pressed="true"]{background:#c9e1d4;border-color:var(--guide-blue);color:#234d3e}
.rg-deck{display:flex;gap:5px}.rg-card{width:clamp(36px,10.3vw,53px);min-height:66px;display:grid;grid-template-columns:1fr 1fr;align-items:center;text-align:left;gap:4px;padding:7px 5px;border:1.5px solid #8a9299;border-radius:4px;background:#fff;font:inherit}.rg-card span,.rg-card small{font-size:12px;font-weight:650}.rg-card strong{grid-row:2;grid-column:1/3;font-size:24px;line-height:1;text-align:center}.rg-card small{grid-column:2;grid-row:1;text-align:right}

/* Each vignette plays once as it enters the reading area and ends in its explanation pose. */
@media(prefers-reduced-motion:no-preference){
 .rg-running .rg-build{animation:rg-build .45s var(--delay,0s) both}
 .rg-running .rg-lift{animation:rg-lift .6s var(--delay,0s) both}
 .rg-running .rg-trace{stroke-dasharray:1;animation:rg-trace 1.8s ease-in-out both}
 .rg-running .rg-fill{animation:rg-fill .6s var(--delay,0s) both}
 .rg-running:not([data-touched]) .rg-edge[data-mark="0"]::before{animation:rg-edge-hint .75s ease-in-out 2 alternate}
 .rg-running:not([data-touched]) .rg-grid button:nth-child(-n+2),.rg-running:not([data-touched]) .rg-deck button:nth-child(4){animation:rg-touch .7s ease-in-out 2 alternate}
 .rg-running:not([data-touched]) .rg-grid button:nth-child(2){animation-delay:.4s}
 @keyframes rg-build{from{opacity:.25;transform:translateY(4px)}to{opacity:1;transform:none}}
 @keyframes rg-lift{from{opacity:.45;transform:translateY(9px)}to{opacity:1;transform:none}}
 @keyframes rg-trace{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}
 @keyframes rg-fill{from{opacity:0}to{opacity:1}}
 @keyframes rg-touch{to{box-shadow:inset 0 0 0 3px #64896d}}
 @keyframes rg-edge-hint{to{border-top-style:solid;box-shadow:0 0 0 3px #a8cbb1}}
}

.rule-guide[data-game=janggi] {--guide-blue:#344f61}
.rule-guide[data-game=janggi] .rg-head::before {background-image:url('/assets/edition/janggi.webp')}
.rg-janggi-pieces {display:flex;flex-wrap:wrap;gap:4px;justify-content:center}
.rg-janggi-pieces button {min-height:44px;min-width:44px;padding:4px 8px;border:1px solid #92968a;border-radius:2px;background:transparent;font-size:13px}
.rg-janggi-pieces button[aria-pressed=true] {background:#354957;border-color:#354957;color:#fff7e7}
.rg-janggi-moves {display:grid;grid-template-columns:repeat(3,30px);margin-block:5px;border:1px solid #71796e}
.rg-janggi-moves span {display:grid;place-items:center;aspect-ratio:1;border:1px solid #b5b7ac}
.rg-janggi-moves span:nth-child(5) {background:#f3dfad;color:#342c22;font:700 21px/1 serif}
.rg-janggi-moves .reachable::after {content:'';width:8px;height:8px;background:#354957;border-radius:50%}

.rg-janggi-pieces button {width:64px;display:grid;justify-items:center;padding:3px 2px}
.rg-janggi-pieces svg {width:55px;height:55px;display:block;background:#f8f4e8}
