/* 非周期王氏砖板块: table and detail pages drawn by wang.js */
.wg-page{padding-bottom:1rem}
.wg-page .hero{padding-block:3rem 1.2rem}
.wg-hero-fig{margin:0 0 1.5rem; background:var(--surface); border:1px solid var(--rule); border-radius:10px; padding:.6rem; max-width:420px}
.wg-hero-fig svg{width:100%; height:auto; display:block}
.wg-loading{color:var(--muted)}

.wg-tri{stroke:rgba(0,0,0,.35); stroke-width:.6; vector-effect:non-scaling-stroke}
.wg-lab{font:600 9px ui-monospace,Menlo,monospace; fill:#1F2328; text-anchor:middle; dominant-baseline:middle; pointer-events:none}
.wg-mark{fill:none; stroke:var(--ink); stroke-width:3.5}

.wg-legend{display:flex; flex-wrap:wrap; gap:.5rem 1.4rem; font-size:.88rem; color:var(--muted); margin:0 0 .8rem}
.wg-badge{display:inline-block; white-space:nowrap; font-size:.8rem; font-weight:600; padding:.05rem .55rem; border-radius:99px; border:1px solid transparent}
.wg-self{background:#E2F0E4; color:#2D6A3A; border-color:#BFDCC4}
.wg-eventual{background:#E3ECF7; color:#2C5687; border-color:#C2D4EC}
.wg-stuck{background:var(--tint); color:var(--accent-ink); border-color:var(--rule)}
.wg-unknown,.wg-none{background:var(--rule-soft); color:var(--muted); border-color:var(--rule)}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .wg-self{background:#1F3324; color:#9CD3A8; border-color:#2F4B35}
  :root:not([data-theme="light"]) .wg-eventual{background:#1D2A3B; color:#9EC1EA; border-color:#2E4058}
}
:root[data-theme="dark"] .wg-self{background:#1F3324; color:#9CD3A8; border-color:#2F4B35}
:root[data-theme="dark"] .wg-eventual{background:#1D2A3B; color:#9EC1EA; border-color:#2E4058}
.wg-ours{font-size:.7rem; font-weight:600; padding:.02rem .4rem; border-radius:4px; background:var(--tint); color:var(--accent-ink); vertical-align:.15em; white-space:nowrap}

.wg-tools{display:flex; flex-wrap:wrap; gap:.6rem 1rem; margin:.4rem 0 .8rem}
.wg-seg{display:inline-flex; flex-wrap:wrap; border:1px solid var(--rule); border-radius:8px; overflow:hidden; background:var(--surface)}
.wg-seg button{font:inherit; font-size:.86rem; border:0; background:none; color:var(--muted); padding:.35rem .75rem; cursor:pointer}
.wg-seg button + button{border-left:1px solid var(--rule)}
.wg-seg button[aria-pressed="true"]{background:var(--tint); color:var(--accent-ink); font-weight:600}

/* the table may be wider than the page's 1180px column: up to 1560px, or the viewport minus 16px gutters */
.wg-tablewrap{overflow-x:auto; margin:0 calc(50% - min(50vw - 16px, 780px)) 2.5rem; border:1px solid var(--rule); border-radius:10px; background:var(--surface)}
.wg-tablewrap table{border-collapse:collapse; font-size:.86rem; line-height:1.55; min-width:980px; width:100%}
.wg-tablewrap th,.wg-tablewrap td{border-bottom:1px solid var(--rule-soft); padding:.55rem .6rem; text-align:left; vertical-align:top}
.wg-tablewrap th{background:var(--rule-soft); font-weight:600; white-space:nowrap; position:sticky; top:0}
.wg-tablewrap tr[hidden]{display:none}
.wg-tablewrap .c-n{text-align:right; font-variant-numeric:tabular-nums; width:3em}
.wg-tablewrap .c-name{white-space:nowrap; font-weight:600}
.wg-tablewrap .c-colors{white-space:nowrap; font-variant-numeric:tabular-nums}
.wg-tablewrap .c-origin,.wg-tablewrap .c-proof{min-width:11em}
.wg-tablewrap .c-density{min-width:8em}
.wg-tablewrap .c-chain{min-width:14em}
.wg-tablewrap .c-stripes{white-space:nowrap}
.wg-chain{font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.8rem}
.wg-chain .seg{white-space:nowrap}
.wg-chain b{font-weight:700; color:var(--ink)}
.wg-ax{color:var(--muted)}

.wg-text{max-width:46em}
.wg-text p,.wg-p{margin:0 0 1rem; max-width:46em}
.wg-text h2{font-size:1.5rem; margin:2.6rem 0 .8rem; padding-top:.5rem; border-top:1px solid var(--rule)}

/* detail */
.wg-back{margin:1.6rem 0 0; font-size:.92rem}
.wg-title{font-size:clamp(1.8rem,1.3rem + 2vw,2.6rem); margin:.6rem 0 1rem}
.wg-detail h2{font-size:1.45rem; margin:2.4rem 0 .8rem; padding-top:.5rem; border-top:1px solid var(--rule)}
.wg-detail h3{font-size:1.15rem; margin:0 0 .5rem; display:flex; align-items:center; gap:.6rem}
.wg-facts{display:grid; grid-template-columns:max-content minmax(0,1fr); gap:.35rem 1.2rem; margin:0; max-width:52em;
  background:var(--surface); border:1px solid var(--rule); border-radius:10px; padding:1rem 1.2rem}
.wg-facts dt{color:var(--muted); font-size:.9rem}
.wg-facts dd{margin:0}
@media (max-width:560px){ .wg-facts{grid-template-columns:minmax(0,1fr)} .wg-facts dd{margin-bottom:.4rem} }
.wg-cap{color:var(--muted); font-size:.85rem; margin:.4rem 0 1rem; width:100%}

.wg-tiles{display:flex; flex-wrap:wrap; gap:.45rem; margin:.4rem 0 .6rem}
.wg-tile{margin:0; width:58px; text-align:center}
.wg-tile svg{width:58px; height:58px; display:block; border-radius:3px}
.wg-tile figcaption{font-size:.72rem; color:var(--muted); font-variant-numeric:tabular-nums}
.wg-tile.is-marked figcaption{color:var(--ink); font-weight:700}
.wg-patch{background:var(--surface); border:1px solid var(--rule); border-radius:10px; padding:.7rem; max-width:560px}
.wg-patch svg{width:100%; height:auto; display:block}

.wg-stripwrap{overflow-x:auto; background:var(--surface); border:1px solid var(--rule); border-radius:10px; padding:.6rem}
.wg-strip{height:120px; width:auto; min-width:100%; display:block}
.wg-node{fill:var(--surface); stroke:var(--ink); stroke-width:1.4}
.wg-node.in-loop{fill:var(--tint); stroke:var(--accent)}
.wg-node.is-start{stroke-width:2.6}
.wg-node-n{font:700 18px ui-monospace,Menlo,monospace; fill:var(--ink); text-anchor:middle}
.wg-node-name{font-size:11px; fill:var(--muted); text-anchor:middle}
.wg-edge,.wg-loop{stroke:var(--muted); stroke-width:1.4; fill:none}
.wg-loop{stroke:var(--accent); stroke-dasharray:4 3}
.wg-arrhead{fill:var(--muted)}
.wg-edge-lab{font-size:11px; fill:var(--muted); text-anchor:middle}
.wg-step{margin:1.4rem 0 0; padding:1rem 1.1rem .6rem; background:var(--surface); border:1px solid var(--rule); border-radius:10px}
.wg-inloop{font-size:.72rem; font-weight:600; padding:.02rem .45rem; border-radius:4px; background:var(--tint); color:var(--accent-ink); font-family:inherit}
.wg-detail h3.wg-subst{margin-top:2rem}

/* animated chain */
.wg-anim{margin:1rem 0 0; background:var(--surface); border:1px solid var(--rule); border-radius:10px; padding:.8rem; max-width:680px}
.wg-anim-bar{display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin:0 0 .6rem}
.wg-anim-bar button{font:inherit; font-size:.88rem; border:1px solid var(--rule); background:var(--ground); color:var(--ink); border-radius:7px; padding:.3rem .8rem; cursor:pointer}
.wg-anim-bar button:hover:not(:disabled){border-color:var(--accent)}
.wg-anim-bar button:disabled{opacity:.45; cursor:default}
.wg-anim-bar button.is-primary{background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600}
.wg-anim-toggle{font-size:.88rem; color:var(--muted); display:inline-flex; gap:.35rem; align-items:center; margin-left:auto; cursor:pointer}
.wg-anim-svg{width:100%; height:auto; display:block; cursor:pointer; border-radius:4px}
.wg-anim-svg:focus-visible{outline:2px solid var(--accent); outline-offset:3px}
.wg-anim-status{margin:.6rem 0 0; font-size:.92rem; min-height:3.2em}
.wg-layer{transition:opacity .4s}
.wg-sup{fill:none; stroke:#15171A; stroke-width:2.4; vector-effect:non-scaling-stroke}
.wg-sup0{stroke-width:.8; stroke:rgba(21,23,26,.55)}
.wg-dim{fill:rgba(21,23,26,.55); stroke:none; animation:wg-in .35s ease-out}
.wg-mk{fill:none; stroke:#FFD23F; stroke-width:3.5; vector-effect:non-scaling-stroke; animation:wg-in .35s ease-out}
.wg-merged{fill:rgba(255,255,255,.6); stroke:none; animation:wg-out 1.2s ease-in forwards}
.wg-fade-in{animation:wg-in .8s ease-out}
.wg-fade-out{animation:wg-out .8s ease-in forwards}
@keyframes wg-in{from{opacity:0} to{opacity:1}}
@keyframes wg-out{from{opacity:1} to{opacity:0}}
@media (prefers-reduced-motion: reduce){ .wg-dim,.wg-mk,.wg-merged,.wg-fade-in,.wg-fade-out{animation:none} .wg-fade-out,.wg-merged{opacity:0} .wg-layer{transition:none} }
.wg-node.is-current{stroke-width:3.4; stroke:var(--ink)}
.wg-more{margin:1.6rem 0 0}
.wg-more summary{cursor:pointer; font-weight:600; color:var(--accent-ink)}

/* self-similarity panels */
.wg-ss{margin:1rem 0 0; background:var(--surface); border:1px solid var(--rule); border-radius:10px; padding:.8rem}
.wg-ss-row{display:flex; flex-wrap:wrap; align-items:center; gap:.6rem}
.wg-ss-panel{margin:0; flex:1 1 220px; max-width:300px; text-align:center}
.wg-ss-panel svg{width:100%; height:auto; display:block; overflow:hidden}
.wg-ss-panel figcaption{font-size:.85rem; color:var(--muted); margin-top:.3rem}
.wg-ss-panel figcaption b{color:var(--ink); font-family:ui-monospace,Menlo,monospace}
.wg-ss-arrow{font-size:.85rem; color:var(--muted); white-space:nowrap}
.wg-ss-move{transition:transform .9s ease-in-out}
.wg-ss-mid{fill:none; stroke:rgba(21,23,26,.35); stroke-width:.7; stroke-dasharray:3 2; vector-effect:non-scaling-stroke}
.wg-ss-l1{fill:none; stroke:rgba(21,23,26,.8); stroke-width:1.3; vector-effect:non-scaling-stroke}
.wg-ss-l2{fill:none; stroke:#15171A; stroke-width:2.8; vector-effect:non-scaling-stroke}
.wg-ss-hit{fill:transparent; cursor:pointer}
.wg-ss-hl{fill:rgba(255,210,63,.45); stroke:#FFD23F; stroke-width:3.5; vector-effect:non-scaling-stroke; pointer-events:none}
.wg-ss-ctx{fill:none; stroke:#FFD23F; stroke-width:2; stroke-dasharray:5 3; vector-effect:non-scaling-stroke; pointer-events:none}
@media (prefers-reduced-motion: reduce){ .wg-ss-move{transition:none} }
@media (max-width:560px){ .wg-ss-arrow{flex-basis:100%; text-align:center} .wg-ss-panel{max-width:none} }

/* numbered tiles (as wang_carcassone/numbered_wang.py): tinted triangles, white seams, the tile number in the centre */
.wg-ntri{stroke-width:.4; vector-effect:non-scaling-stroke}
.wg-seam{fill:none; stroke:#fff; stroke-width:1; vector-effect:non-scaling-stroke}
.wg-num{font-family:Arial,Helvetica,sans-serif; font-weight:700; fill:#282828; stroke:#fff; paint-order:stroke; stroke-linejoin:round;
  text-anchor:middle; dominant-baseline:central; pointer-events:none}
.wg-ss-nums{transition:opacity .25s}

/* substitution rules "k → block" */
.wg-ruleset{margin:.9rem 0 0}
.wg-ruleset h4{font-size:.95rem; margin:0 0 .4rem; display:flex; align-items:center; gap:.5rem; font-weight:600}
.wg-rules{list-style:none; margin:.3rem 0 1rem; padding:0; display:flex; flex-wrap:wrap; gap:.35rem .45rem;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.82rem; font-variant-numeric:tabular-nums}
.wg-rule{display:inline-flex; align-items:center; gap:.3rem; padding:.15rem .45rem; border:1px solid var(--rule); border-radius:6px; background:var(--surface)}
.wg-rule.is-merged{background:var(--tint); border-color:var(--accent)}
.wg-rule b{color:var(--ink); min-width:1.4em; text-align:right}
.wg-to{color:var(--muted)}
.wg-blk{display:inline-grid; gap:1px; background:var(--rule); border:1px solid var(--rule); border-radius:3px; overflow:hidden; vertical-align:middle}
.wg-blk span{background:var(--surface); padding:0 .3rem; text-align:center; line-height:1.35}
.wg-blk1{padding:0 .3rem}
