:root {
  color-scheme: light;
  --paper: #f6f4ed;
  --panel: #fffdf7;
  --ink: #242e29;
  --quiet: #59615a;
  --brick: #873f2e;
  --edge: #d8d4c7;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.65 var(--sans); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
a { color: var(--brick); text-underline-offset: .22em; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #95733c; outline-offset: 4px; }
h1, h2, h3, p, ol { margin: 0; }
h1, h2, h3 { font-family: var(--serif); }
h2 { font-size: 1.5rem; line-height: 1.4; letter-spacing: .06em; }
h3 { font-size: 1.2rem; line-height: 1.5; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.masthead { background: #fbfaf5; border-bottom: 1px solid var(--edge); }
.mast-inner, main { width: min(72rem, calc(100% - 5rem)); margin-inline: auto; }
.mast-inner { min-height: 4.5rem; display: flex; align-items: stretch; justify-content: space-between; gap: 1rem; }
.brand, nav a, nav button { display: inline-flex; align-items: center; gap: .46rem; text-decoration: none; }
.brand { gap: .72rem; color: var(--ink); font: 700 1.35rem/1 var(--serif); letter-spacing: .1em; }
.seal { display: grid; place-content: center; width: 2.05rem; height: 2.1rem; background: var(--brick); color: #fff7da; border: 2px solid var(--brick); outline: 1px solid #e8cab0; outline-offset: -4px; border-radius: 3px 2px 4px 2px; font: 700 1.42rem/1 var(--serif); letter-spacing: 0; }
nav { display: flex; align-items: stretch; gap: 1.65rem; }
nav a, nav button { position: relative; padding: .35rem .2rem; border: 0; background: transparent; color: var(--quiet); font-size: .94rem; }
nav a:hover, nav button:hover, nav .nav-current { color: var(--brick); }
nav .nav-current::after { content: ""; position: absolute; bottom: -1px; left: .15rem; right: .15rem; height: 3px; background: var(--brick); }
.intro { margin: 2.8rem 0 1.9rem; }
h1 { color: #24362f; font-size: clamp(2.65rem, 4.4vw, 4rem); line-height: 1.22; letter-spacing: .06em; font-weight: 700; }
.intro p { margin-top: .6rem; color: var(--quiet); letter-spacing: .06em; }
.desk { display: grid; grid-template-columns: minmax(0, 1.96fr) minmax(17.9rem, 1fr); align-items: stretch; gap: 1.25rem; }
.toss-card, .board, .audit, .reading { border: 1px solid var(--edge); border-radius: 8px; background: var(--panel); }
.toss-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.tray { position: relative; isolation: isolate; overflow: hidden; display: flex; flex: 1; flex-direction: column; justify-content: space-between; min-height: 19.7rem; padding: 1.55rem 1.75rem 1.5rem; color: #f4ecd3;
  background-color: #193e37;
  background-image: radial-gradient(ellipse at 45% 46%, #46615496, transparent 66%), linear-gradient(105deg, #112f2bbd, transparent 44%, #102e28b8), repeating-linear-gradient(95deg, #bdd6b30c 0 1px, transparent 1px 4px), repeating-linear-gradient(3deg, #080f0b14 0 1px, transparent 1px 3px);
}
.tray-frame { position: absolute; z-index: -1; inset: .56rem; border: 1px solid #bba57462; }
.tray-frame::before, .tray-frame::after { content: ""; pointer-events: none; position: absolute; inset: 3px; background:
 linear-gradient(#bba57494,#bba57494) left top / 14px 1px, linear-gradient(#bba57494,#bba57494) left top / 1px 14px,
 linear-gradient(#bba57494,#bba57494) right top / 14px 1px, linear-gradient(#bba57494,#bba57494) right top / 1px 14px,
 linear-gradient(#bba57494,#bba57494) left bottom / 14px 1px, linear-gradient(#bba57494,#bba57494) left bottom / 1px 14px,
 linear-gradient(#bba57494,#bba57494) right bottom / 14px 1px, linear-gradient(#bba57494,#bba57494) right bottom / 1px 14px; background-repeat: no-repeat; }
.tray-frame::after { inset: 7px; opacity: .43; }
.tray-rings { pointer-events: none; z-index: -1; width: 25rem; max-width: 90%; aspect-ratio: 1; position: absolute; left: 50%; top: 51%; transform: translate(-50%,-50%); border-radius: 50%; opacity: .62; background: radial-gradient(circle closest-side, transparent 66%, #c6be8521 66.3% 66.6%, transparent 66.9% 76.5%, #c6be851f 76.8% 77.1%, transparent 77.4% 92%, #c6be8528 92.3% 92.6%, transparent 92.9% 96%, #c6be8521 96.3% 96.55%, transparent 96.8%); }
.tray-rings::before { content: ""; position: absolute; inset: 4.75%; border-radius: 50%; background: repeating-conic-gradient(from -1deg, #d5ca983d 0 .55deg, transparent .7deg 7.5deg); -webkit-mask: radial-gradient(closest-side,transparent 98%,#000 98.5%); mask: radial-gradient(closest-side,transparent 98%,#000 98.5%); }
.tray-heading, .board-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tray-heading h2 { font-size: 1.22rem; font-weight: 500; letter-spacing: .11em; }
.source { color: #eee1b6; background: #183d35de; border: 1px solid #a98f6282; border-radius: 3px; font-size: .81rem; padding: .1rem .52rem; text-align: right; max-width: 70%; }
#coins { width: min(82%, 31rem); margin: .8rem auto; display: flex; justify-content: space-between; align-items: center; perspective: 800px; }
.coin-slot { width: 27.6%; perspective: 600px; --angle: -13deg; --lift: 2%; --cross: 29%; --arc: -32%; }
.coin-slot:nth-child(2) { --angle: 8deg; --lift: -7%; --cross: -4%; --arc: -44%; }
.coin-slot:nth-child(3) { --angle: -6deg; --lift: 7%; --cross: -29%; --arc: -27%; }
.coin { container-type: inline-size; isolation: isolate; aspect-ratio: 1; position: relative; transform: translateY(var(--lift)) rotate(var(--angle)); filter: drop-shadow(0 3px 0 #674e2a) drop-shadow(1px 9px 6px #06150e8c); }
.coin-metal { position: absolute; inset: 0; border-radius: 50%; border: 1px solid #dfc48c; 
  background: radial-gradient(ellipse at 20% 20%, #faf0aa50, transparent 48%), radial-gradient(ellipse at 75% 68%, #684e2644, transparent 50%), repeating-linear-gradient(115deg, #f4dfac12 0 1px, transparent 1px 3px), repeating-linear-gradient(9deg, #493b1c15 0 1px, transparent 1px 4px), conic-gradient(from 25deg, #a68850, #d4b06a 19%, #8d7548 35%, #baa06a 47%, #b09050 64%, #dbc995 77%, #a68850);
  box-shadow: inset 1px 2px 0 #fff0b7c9, inset -2px -2px 1px #775d35, inset 0 0 0 4px #ae925dcc;
  -webkit-mask: linear-gradient(#000 0 0) center/100% 100% no-repeat,linear-gradient(#000 0 0) center/18% 18% no-repeat; -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) center/100% 100% no-repeat,linear-gradient(#000 0 0) center/18% 18% no-repeat; mask-composite: exclude;
}
.coin-rim { position: absolute; inset: 5.4%; border-radius: 50%; border: 1px solid #765f36a8; box-shadow: 0 -1px 1px #e8d299, inset 0 1px 1px #e6d29a; }
.hole { position: absolute; width: 24%; height: 24%; top: 38%; left: 38%; border: max(2px, .035em) solid #c4a563; box-shadow: 1px 1px 0 #755f37, -1px -1px 0 #ead49b, inset 1.5px 1.5px 0 #6d542d, inset -1px -1px 0 #ddcb8a; }
.ct { position: absolute; display: grid; place-content: center; font-family: var(--serif); font-weight: 800; font-size: 1.5rem; font-size: 23cqw; line-height: 1; color: #735a32; text-shadow: 0 .7px 0 #efdaa2, -.5px -.7px 0 #55472866; }
.ct.top { inset: 10% 32% auto; }.ct.right { inset: 37% 10% auto auto; }.ct.bottom { inset: auto 32% 10%; }.ct.left { inset: 37% auto auto 10%; }
.ct.top::before { content: "乾"; }.ct.bottom::before { content: "隆"; }.ct.right::before { content: "通"; }.ct.left::before { content: "寶"; }
.coin[data-face="tails"] .ct.top::before, .coin[data-face="tails"] .ct.bottom::before { content: ""; }
.coin[data-face="tails"] .ct.left::before { content: "寶"; }.coin[data-face="tails"] .ct.right::before { content: "泉"; }
.coin[data-face="tails"] .coin-metal { filter: saturate(.76) brightness(.93); }
.casting .coin { animation: tumble .68s cubic-bezier(.34,.02,.35,1) both; }
.casting .coin-slot:nth-child(2) .coin { animation-delay: .025s; }.casting .coin-slot:nth-child(3) .coin { animation-delay: .045s; }
@keyframes tumble {
  0% { transform: translateY(var(--lift)) rotate(var(--angle)); }
  35% { transform: translate(calc(var(--cross) * .64),var(--arc)) rotateY(260deg) rotate(-22deg); }
  59% { transform: translate(var(--cross),6%) rotateY(440deg) rotate(13deg); }
  77% { transform: translate(2%,-8%) rotateY(622deg) rotate(-4deg); }
  100% { transform: translateY(var(--lift)) rotateY(720deg) rotate(var(--angle)); }
}
.faces { text-align: center; color: #e7dec2; font-size: .91rem; letter-spacing: .1em; }
.controls { padding: 1.2rem 1.45rem 1.3rem; }
.control-caption { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
#status { color: var(--quiet); font-size: .9rem; overflow-wrap: anywhere; }
.actions, .dialog-actions, .audit-actions { display: flex; align-items: center; gap: .65rem; }
.actions { margin-top: .85rem; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.85rem; padding: .5rem 1.35rem; border-radius: 4px; border: 1px solid transparent; font-size: 1rem; font-weight: 550; }
.primary { background: var(--brick); color: #fffaf2; border-color: #783628; }.primary:hover:enabled { background: #723427; }
.secondary { color: #3b4940; background: #fbfaf3; border-color: #c7c8b9; }.secondary:hover:enabled { background: #efeee3; }
.secondary[aria-pressed=true] { color: #284c3f; border-color: #8d9e8b; background: #edf2e8; }
#toss { flex: 1.25; } #motion { flex: 1; }
.board { min-width: 0; padding: 1.55rem 1.5rem 1.04rem; display: flex; flex-direction: column; }
.board h2 { font-size: 1.45rem; }
.count { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d9d7c9; color: #536253; font: 500 .91rem/1.5 Georgia, var(--serif); font-variant-numeric: tabular-nums; padding: .1rem .62rem; border-radius: 99px; white-space: nowrap; }
.board-note { color: var(--quiet); font-size: .875rem; margin-top: .25rem; }
#lines { display: grid; flex: 1; align-content: stretch; list-style: none; padding: 0; margin: .75rem 0 .58rem; border-top: 1px solid var(--edge); }
#lines li { border-bottom: 1px solid #e5e2d6; display: grid; grid-template-columns: minmax(2.45em, auto) minmax(2rem,1fr) minmax(3.5em,auto); align-items: center; gap: 1rem; min-height: 2.75rem; padding: .25rem .12rem; }
.rank { font: 1rem/1.5 var(--serif); color: #535b50; white-space: nowrap; }.line-value { color: var(--quiet); font-size: .85rem; text-align: right; }
.stroke { width: 100%; max-width: 8.5rem; justify-self: center; height: .43rem; background: #31493c; }
.stroke.pending { background: repeating-linear-gradient(90deg,#c7cabc 0 6px, transparent 6px 10px); height: 2px; }
#lines .current .rank { font-weight: 700; color: var(--brick); } #lines .current .line-value { color: var(--brick); }
.stroke.yin { background: linear-gradient(90deg, #31493c 44%, transparent 44% 56%, #31493c 56%); }
.moving .line-value, .moving .rank { color: var(--brick); }.moving .stroke.yang { background: var(--brick); }.moving .stroke.yin { background: linear-gradient(90deg,var(--brick) 44%, transparent 44% 56%, var(--brick) 56%); }
.text-button { display: inline-flex; align-items: center; gap: .43rem; align-self: flex-start; padding: .45rem .2rem; min-height: 2.75rem; font-size: .9rem; color: var(--quiet); background: none; border: 0; }.text-button:hover:enabled { color: var(--brick); }
.reading { margin-top: 1.2rem; padding: 1.4rem 1.5rem; }.reading h3 { margin: 1rem 0 .4rem; }.reading p { margin: .4rem 0; }.reading a { font-size: .9rem; }
.moving-summary { color: var(--quiet); font-size: .91rem; }
.hex-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.hex-card { padding: 1.1rem 1.25rem; background: #f7f6ee; border: 1px solid #e1dece; border-top: 2px solid #486656; border-radius: 3px; }
.hex-card + .hex-card { border-top-color: #9d785b; }.hex-card .hex-kicker { margin: 0; color: var(--quiet); font-size: .86rem; }
.hex-card h3 { margin: .15rem 0 .65rem; font-size: 1.55rem; }.hex-diagram { display: grid; width: 4.25rem; gap: .23rem; }
.hex-diagram .stroke { height: .33rem; }.hex-card blockquote { margin: .9rem 0 .65rem; font: 1.15rem/1.8 var(--serif); }
.audit { margin-top: 1.2rem; overflow: hidden; scroll-margin-top: 1rem; }
summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; gap: .75rem; min-height: 3.65rem; padding: .8rem 1.35rem; list-style: none; }
summary::-webkit-details-marker { display: none; } .audit[open] > summary { border-bottom: 1px solid var(--edge); }
.audit summary:focus-visible { outline-offset: -4px; }.audit-title, .audit-aside { display: inline-flex; align-items: center; gap: .55rem; }
.audit-title { font: 600 1.06rem/1.5 var(--serif); }.audit-title .icon { color: #6d715e; }
.audit-aside { font-size: .85rem; color: var(--quiet); }.chevron { transition: transform .18s; }.audit[open] > summary .chevron { transform: rotate(180deg); }
.audit-body { padding: 1rem 1.4rem 1.4rem; }.audit-actions { margin-top: .8rem; flex-wrap: wrap; }
#audit-log { overflow-wrap: anywhere; } #audit-log p { margin: .45em 0; } #audit-log pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; } #audit-log li { margin: .25rem 0; }
.audit-row + .audit-row { border-top: 1px solid var(--edge); }.audit-row summary { justify-content: flex-start; padding: .55rem .2rem; min-height: 2.75rem; font-size: .93rem; }
.audit-row summary::before { content: "+"; color: var(--brick); font-size: 1.1rem; }.audit-row[open] summary::before { content: "−"; }
.audit-row pre { background: #f2f1e8; padding: .85rem; border-radius: 4px; }.audit-row p { color: var(--quiet); font-size: .9rem; }
footer { margin: 1.9rem auto 2rem; display: flex; align-items: center; gap: .7rem; justify-content: center; color: #8b7764; }.footer-rule { height: 1px; width: 2.2rem; background: #cfc8b7; }.closing-mark { display: grid; place-items: center; width: 1.35rem; height: 1.35rem; font: 1rem/1 var(--serif); border: 1px solid #b6a392; border-radius: 2px; }
dialog { margin: auto; max-width: min(31rem,calc(100% - 2rem)); max-height: calc(100dvh - 3rem); overflow: auto; overscroll-behavior: contain; padding: 1.6rem; color: var(--ink); background: var(--panel); border: 1px solid var(--edge); border-top: 4px solid var(--brick); border-radius: 8px; box-shadow: 0 1rem 4rem #12251b26; }
dialog::backdrop { background: #142a25a8; } dialog h2 { margin-bottom: .8rem; } dialog h3 { margin-top: 1rem; } dialog p { color: var(--quiet); margin: .45rem 0; }
.dialog-actions { align-items: stretch; flex-wrap: wrap; margin-top: 1.15rem; }.guide-steps { padding-left: 1.5rem; }.guide-steps li + li { margin-top: .55rem; }.guide-steps li::marker { color: var(--brick); }
@media (max-width: 54rem) {
  .mast-inner, main { width: calc(100% - 2.5rem); }.desk { grid-template-columns: minmax(0, 1.6fr) minmax(16rem,1fr); gap: .85rem; }
  .board { padding: 1.25rem 1.15rem .8rem; }.tray { min-height: 17.25rem; padding: 1.2rem 1.3rem; }
  #coins { width: 92%; } .controls { padding: 1rem 1.1rem 1.12rem; }.intro { margin-top: 2.1rem; }
  .actions button { padding-inline: .65rem; } #lines li { gap: .65rem; }
}
@media (max-width: 43rem) {
  .mast-inner, main { width: calc(100% - 2rem); }.mast-inner { min-height: 3.75rem; }
  .brand { font-size: 1.1rem; gap: .45rem; }.seal { width: 1.75rem; height: 1.8rem; font-size: 1.15rem; }
  nav { gap: .85rem; } nav a, nav button { font-size: .88rem; gap: .28rem; }.record-link .icon { display: none; }
  .intro { margin: 1.65rem 0 1.18rem; }.intro p { margin-top: .38rem; font-size: .92rem; letter-spacing: .02em; }
  .desk { grid-template-columns: minmax(0,1fr); gap: .9rem; }.tray { min-height: 15rem; padding: 1rem 1.25rem; }
  .tray-rings { width: 20rem; }.tray-heading h2 { font-size: 1.06rem; } #coins { width: 88%; max-width: 23rem; margin-block: .65rem; }
  .faces { font-size: .85rem; }.actions { margin-top: .7rem; }.control-caption { gap: .18rem .65rem; }
  .board { padding: 1.12rem 1.2rem .55rem; } #lines li { min-height: 2.5rem; }
  .stroke { max-width: 8.3rem; }.board h2 { font-size: 1.3rem; }.board-note { margin-top: .08rem; }
  .audit, .reading { margin-top: .9rem; } summary { padding-inline: 1.1rem; }.reading, .audit-body { padding: 1.1rem; }
  .hex-pair { grid-template-columns: minmax(0,1fr); gap: .7rem; }.hex-card { padding: .95rem 1rem; }
  footer { margin-block: 1.4rem; }
}
@media (max-width: 22rem) {
  .mast-inner, main { width: calc(100% - 1.25rem); } nav { gap: .45rem; } nav .icon { display: none; }
  .intro p { font-size: .86rem; }.tray { min-height: 13.3rem; }.control-caption { display: block; }.audit-aside { gap: .22rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }.casting .coin, .chevron { animation: none; transition: none; }
}
