:root{font-size:150%;--paper:#faf7ef;--ink:#192e29;--muted:#3f5750;--green:#145c43;--bronze:#725313;--line:#b6c0b4;--tile-width:2.667rem;--tile-height:3.667rem;color:var(--ink);background:var(--paper);font-family:"Microsoft JhengHei","PingFang TC","Noto Sans TC",sans-serif;font-synthesis:none}*{box-sizing:border-box}body{margin:0;line-height:1.7}button,input,select{font:inherit}button,a,input,select{touch-action:manipulation}button{cursor:pointer}a{color:inherit;text-underline-offset:.2em}button:disabled{cursor:default}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline:3px solid #1d4ed8;outline-offset:5px}h1,h2,h3,p{margin-top:0}h1,h2,h3{line-height:1.35;letter-spacing:-.035em}h1{font-size:1.667rem;margin-bottom:1rem}h2{font-size:1.333rem;margin-bottom:.8rem}h3{font-size:1.16rem}p{margin-bottom:.8rem}small,.small{font-size:.917rem;color:var(--muted)}.site-header{max-width:1440px;margin:auto;padding:1.1rem 2rem;display:flex;justify-content:space-between;gap:1rem;align-items:center;border-bottom:1px solid var(--line)}.brand{display:flex;align-items:center;gap:.6rem;text-decoration:none;font-weight:700;line-height:1.4;letter-spacing:.03em}.brand-mark{background:var(--green);color:var(--paper);border-radius:.35rem;min-width:2.3rem;min-height:2.8rem;display:grid;place-items:center;font-family:DFKai-SB,KaiTi,serif;font-size:1.6rem;box-shadow:inset 0 0 0 5px var(--green),inset 0 0 0 6px #b8c5aa}.brand-sub{display:block;font-size:.917rem;font-weight:400;letter-spacing:0;color:var(--muted)}nav{display:flex;gap:.5rem;flex-wrap:wrap}nav a{display:grid;place-items:center;text-decoration:none;min-height:56px;padding:.3rem .65rem;border-bottom:3px solid transparent}nav a[aria-current]{color:var(--green);border-color:var(--green);font-weight:700}main{max-width:1320px;margin:auto;padding:1.5rem 2rem 3rem;min-height:60vh}section{margin-bottom:2rem}.hero{display:grid;grid-template-columns:1.15fr .85fr;gap:1.5rem;align-items:center;padding:2rem 0}.eyebrow{font-size:.917rem;letter-spacing:.07em;color:var(--bronze);font-weight:600;margin-bottom:.55rem}.hero h1{font-size:2.2rem;line-height:1.45;font-weight:700;letter-spacing:.02em}.hero-copy{max-width:30em;color:var(--muted)}.hero-art{min-height:16rem;position:relative;display:grid;place-items:center;background:radial-gradient(ellipse at 50% 55%,#e6ebdc 0,#f0f0e3 55%,transparent 56%)}.art-ring{position:absolute;width:80%;height:85%;border:1px solid #a4b29a;border-radius:50%;transform:rotate(-18deg)}.art-ring:after{content:"";position:absolute;inset:10px;border:1px solid #cbd2bf;border-radius:50%}.art-caption{position:absolute;top:.25rem;font-size:.917rem;color:var(--muted)}.art-tiles{display:flex;align-items:center;gap:.6rem;transform:rotate(-7deg);position:relative}.art-tiles>span:nth-child(2){transform:translateY(-.7rem) rotate(10deg)}.art-tiles>span:nth-child(3){transform:rotate(16deg)}.art-tiles .tile-face{width:4rem;height:5.5rem;box-shadow:.2rem .35rem 0 #9cab91,.3rem .6rem 1rem #192e2920}.art-seal{position:absolute;bottom:1rem;right:10%;font-family:DFKai-SB,KaiTi,serif;font-size:1rem;color:var(--bronze);border:2px solid var(--bronze);padding:.15rem .4rem;line-height:1.3;transform:rotate(5deg)}.button{display:inline-flex;justify-content:center;align-items:center;gap:.5rem;min-height:64px;border:1px solid var(--green);border-radius:.45rem;padding:.55rem 1rem;font-weight:600;text-decoration:none;line-height:1.5;text-align:center;max-width:100%;overflow-wrap:anywhere}.primary{color:white;background:var(--green)}.primary:hover{background:#0e4633}.secondary{background:transparent;color:var(--green)}.secondary:hover{background:#e7ede2}.button:disabled{background:#e2e7de;color:#496056;border-color:#92a293}.actions,.audio-buttons{display:flex;flex-wrap:wrap;gap:12px;margin:1rem 0}.learning-strip{display:flex;gap:1.5rem;justify-content:space-between;align-items:center;padding:1.2rem 1.4rem;background:#e9eee2;border-top:1px solid #c4cebd;border-bottom:1px solid #c4cebd}.learning-strip p{margin-bottom:0}.learning-strip strong{font-size:1.33rem}.font-control{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;font-size:.917rem}.font-control select{max-width:100%}select{border:1px solid #61756b;border-radius:.35rem;background:white;color:var(--ink);min-height:56px;padding:.3rem .6rem;max-width:100%;min-width:0}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}.chapter-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem}.chapter-card{border:1px solid var(--line);background:#fffdf8;border-radius:.65rem;padding:1.2rem;position:relative}.chapter-number{font-size:2rem;font-weight:400;color:var(--green);font-family:Georgia,serif;line-height:1;margin-bottom:1.3rem}.chapter-card h3{margin-bottom:.6rem}.chapter-card p{color:var(--muted)}.text-link{display:inline-flex;align-items:center;gap:.3rem;min-height:56px;font-weight:600;color:var(--green)}.preview{margin-top:2rem;padding:1.6rem 0;border-top:1px solid var(--line);max-width:36rem}.preview p{color:var(--muted)}.page-title{padding:1.5rem 0 .5rem;max-width:36rem}.tutorials{display:grid;gap:1rem}.tutorial{display:flex;gap:1rem;padding:1.4rem;border-top:1px solid var(--line)}.tutorial>div{max-width:33rem}.step-number{display:grid;place-items:center;flex:none;width:2rem;height:2rem;background:#e5ecdf;color:var(--green);border-radius:50%;font-family:Georgia,serif;font-size:1.25rem}.sample-tiles{display:flex;gap:12px;flex-wrap:wrap;margin:.75rem 0}.tile-face{width:var(--tile-width);height:var(--tile-height);display:block;border:1px solid #8e8876;border-radius:.32rem;background:linear-gradient(135deg,#fffef9 12%,#fffdf4 70%,#f1e9d5);box-shadow:inset 1px 1px 1px white,inset -1px -2px 1px #dfd6c1,0 .11rem 0 #d2c9af,0 .21rem 0 #446858;flex:none}.tile-face svg{display:block;width:100%;height:100%}.tile-static,.tile-choice{display:flex;flex-direction:column;align-items:center;gap:.4rem;min-width:0}.tile-name{font-size:.917rem;line-height:1.35;overflow-wrap:anywhere;text-align:center;display:block}.start-panel{background:var(--green);color:white;padding:1.8rem;border-radius:.65rem;margin-top:1rem}.start-panel p{max-width:35rem}.start-panel .primary{background:var(--paper);color:var(--green);border-color:var(--paper)}.notice{background:#fff3d6;padding:1rem;color:#784b00;border-radius:.4rem}.audio-panel{border-top:1px solid var(--line);padding-top:.8rem;margin-top:2rem}.audio-panel p{margin-bottom:.3rem}.lesson-top{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap}.question-heading{margin-top:1rem}#question-prompt{max-width:35rem}.objective{color:var(--muted);font-size:.917rem;margin-bottom:.7rem}.progress-track{height:6px;background:#e1e7dc;margin:1rem 0;border-radius:5px}.progress-track span{display:block;height:100%;background:var(--green);border-radius:5px}.hand-panel{background:#e9eee2;border:1px solid #c3cfbc;border-radius:.65rem;padding:1.2rem}.hand-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(var(--tile-width),1fr));gap:20px 12px;max-width:36rem;align-items:start}.tile-choice{padding:0;border:0;border-radius:.3rem;background:transparent;color:var(--ink);position:relative;font-weight:600;width:100%;max-width:5rem;justify-self:center}.tile-choice .tile-face{transition:box-shadow .15s}.tile-choice.selected .tile-face{outline:3px solid #1d4ed8;outline-offset:3px}.tile-choice.correct .tile-face{outline:3px solid var(--green);outline-offset:3px}.tile-choice:disabled{opacity:1}.tile-state{display:block;text-align:center;color:#145c43;font-size:.917rem;line-height:1.35;overflow-wrap:anywhere}.tile-choice.selected:not(.correct) .tile-state{color:#1d4ed8}.answer-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.answer-choice{border:1px solid #61756b;background:#fffefa;color:var(--ink);border-radius:.5rem;padding:1rem;text-align:left;display:flex;gap:.8rem;align-items:flex-start;min-height:80px}.choice-letter{border:1px solid var(--line);border-radius:50%;display:grid;place-items:center;min-width:1.6rem;height:1.6rem;font-size:.917rem;flex:none}.answer-choice.selected{outline:3px solid #1d4ed8;outline-offset:1px;background:#f0f4ff}.answer-choice.correct{border:2px solid var(--green);background:#e7f3ec}.answer-choice:disabled{opacity:1}.choice-state{display:block;font-size:.917rem;color:var(--green);margin-top:.5rem}.submission{padding:1.2rem 0;margin-bottom:0}.submission p{font-weight:600}.feedback{padding:1.5rem;border-left:5px solid var(--green);background:#e7f3ec;border-radius:0 .5rem .5rem 0;margin:1rem 0 2rem}.feedback.retry{border-color:#784b00;background:#fff3d6}.feedback p{max-width:36rem}.feedback h2:focus{outline:none}.feedback-detail{border-top:1px solid #b6c4b2;padding-top:1rem;margin-top:1rem}.feedback-detail h3{font-size:1rem;margin-bottom:.3rem}.next-action{padding-top:1.3rem;margin-top:1.3rem;border-top:1px solid #b6c4b2}.panel{padding:1.4rem;background:#fffdf8;border:1px solid var(--line);border-radius:.65rem;min-width:0}.result-hero{padding:2rem 0;text-align:center}.score-number{font-family:Georgia,serif;font-size:4rem;color:var(--green);line-height:1.5}.score-number span{font-family:"Microsoft JhengHei",sans-serif;font-size:1rem;color:var(--muted)}.practice-tip{padding-left:.8rem;border-left:3px solid var(--bronze)}.answer-records details{border-top:1px solid var(--line);padding:.7rem 0}.answer-records summary{cursor:pointer;min-height:56px;line-height:1.6}.answer-records details p{margin-top:.7rem;padding:0 .5rem}.record-status{font-size:.917rem;font-weight:700;color:var(--green);margin-right:.5rem}.score-list{display:grid;gap:1rem}.settings-panel{max-width:40rem}.setting-row{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:1rem 0;border-bottom:1px solid var(--line);flex-wrap:wrap}.setting-row>span{flex:1 1 10rem}.setting-row select{flex:0 1 17rem;width:100%}.setting-description{display:block;font-size:.917rem;color:var(--muted);margin-top:.3rem}.setting-row input[type=checkbox]{appearance:none;width:64px;height:56px;border:2px solid #61756b;border-radius:.4rem;background:#fff;flex:none;cursor:pointer}.setting-row input[type=checkbox]:checked{background:var(--green);border-color:var(--green)}.setting-row input[type=checkbox]:checked:after{content:'✓';display:grid;place-items:center;color:white;font-size:1.4rem;line-height:52px}.setting-row input[type=range]{min-height:56px;width:min(100%,12rem);accent-color:var(--green)}.reading-sample{margin:1rem 0;padding:1rem;background:#e9eee2;border-radius:.4rem}.settings-panel>.button{margin-top:1rem}.save-notice{background:#fff3d6;color:#784b00;padding:1rem;border:2px solid #784b00;border-radius:.5rem;margin-bottom:1rem}.save-notice[hidden]{display:none}footer{border-top:1px solid var(--line);max-width:1320px;margin:auto;padding:1.5rem 2rem 2rem;display:flex;flex-direction:column;gap:.3rem;color:var(--muted)}footer p{margin:0}.footer-brand{font-weight:700;color:var(--green)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.skip-link{position:absolute;left:1rem;top:-100px;background:white;padding:.5rem;z-index:10}.skip-link:focus{top:1rem}.big-tiles{--tile-width:3.333rem;--tile-height:4.583rem}.high-contrast{--paper:white;--ink:black;--muted:black;--line:black;background:white;color:black}.high-contrast .panel,.high-contrast .chapter-card,.high-contrast .hand-panel,.high-contrast .learning-strip{background:white;border:2px solid black}.high-contrast .tile-face{box-shadow:none;border:2px solid black}.high-contrast .hero-art{background:none}
@media(min-width:1100px){.hand-grid{grid-template-columns:repeat(9,minmax(var(--tile-width),1fr))}.big-tiles .hand-grid{grid-template-columns:repeat(auto-fit,minmax(var(--tile-width),1fr))}}
@media(max-width:1000px){.site-header{flex-direction:column;align-items:flex-start}.hero{grid-template-columns:1fr}.hero-art{display:none}.chapter-grid{grid-template-columns:1fr}.chapter-card{display:flex;gap:1rem}.chapter-number{margin-top:.2rem}.learning-strip{flex-wrap:wrap}.hero{padding:1rem 0}.hero h1{font-size:1.85rem}.answer-choices{grid-template-columns:1fr}}
@media(max-width:600px){.site-header{padding:1rem 16px;gap:.6rem}nav{width:100%;justify-content:space-between;gap:0}nav a{padding:.3rem .2rem}.brand-sub{display:none}main{padding:1rem 16px 2rem}.hero h1{font-size:1.667rem}.hero-copy br{display:none}.learning-strip{padding:1rem;gap:1rem}.chapter-card,.panel{padding:1rem}.hand-panel{padding:.7rem 0;background:transparent;border-left:0;border-right:0;border-radius:0}.hand-grid{grid-template-columns:repeat(auto-fit,minmax(var(--tile-width),1fr));max-width:100%;gap:20px 12px}.tutorial{padding:1rem 0;gap:.6rem}.tutorial .step-number{width:1.5rem;height:1.5rem}.tutorial h2{font-size:1.2rem}.start-panel,.feedback{padding:1rem}.audio-buttons .button{flex:1 1 7rem}.actions .button{flex:1 1 auto}#question-prompt{font-size:1.333rem}.section-heading h2{font-size:1.2rem}.answer-choice{padding:.8rem;gap:.6rem}.lesson-top{gap:.5rem}.score-number{font-size:3rem}footer{padding:1.2rem 16px}.settings-panel .setting-row>span{flex-basis:75%}.setting-row select{flex-basis:100%}.setting-row input[type=checkbox]{width:56px}.setting-row{gap:.5rem}.brand{font-size:1rem}.chapter-card{display:block}.chapter-number{margin-bottom:1rem}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}

/* Keep the large reading text comfortably substantial on Windows. */
body{font-weight:500}

/* Waiting alternatives are separated by “or”; grouped tiles keep their original layout. */
.wait-tiles{align-items:center}.wait-or{font-size:.917rem;color:var(--muted);align-self:center}
@media(max-width:600px){.answer-choice:has(.wait-tiles){display:block}.answer-choice:has(.wait-tiles)>.choice-letter{width:1.6rem;margin-bottom:.5rem}.big-tiles .wait-tiles{flex-direction:column;align-items:center}}
.inline-audio{margin:.65rem 0}.inline-audio p{margin-bottom:.4rem}[data-audio-status]:empty{display:none}.native-audio-slot:empty{display:none}.native-audio-slot audio{display:block;width:100%;max-width:32rem;min-width:0;min-height:56px;border-radius:.4rem}

.explanation-tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .16rem;
  margin: .2rem .09rem;
  vertical-align: middle;
  break-inside: avoid;
  line-height: 1;
}
.explanation-tile .tile-face {
  width: calc(var(--tile-width) * .62);
  height: calc(var(--tile-height) * .62);
}
.explanation-alternatives{margin-bottom:1rem}.feedback-detail p{overflow-wrap:anywhere}

.explanation-alternatives > p { white-space: pre-line; }
/* All question tiles remain HTML/SVG; the image supplies only the empty table surface. */
.mahjong-table{padding:1rem;background:#1c614b url('/assets/mahjong-table.webp') center/cover;border:3px solid #735a35;border-radius:.7rem;display:grid;gap:1rem;min-width:0}
.table-zone{background:#f8f9f0f5;color:var(--ink);border:1px solid #b7c9b6;border-radius:.4rem;padding:1rem;min-width:0}
.table-zone h2{font-size:1.2rem;margin-bottom:.7rem}.table-zone .section-heading{margin-bottom:.5rem}.table-zone .section-heading h2{margin-bottom:0}.table-empty{margin:0}.table-tiles{display:flex;flex-wrap:wrap;gap:16px 12px;min-width:0;align-items:flex-start}.table-tiles>.tile-static{width:var(--tile-width);flex:none}.table-river{border-bottom:3px solid #a2b8a0}.table-hand .hand-grid{margin-top:.7rem}
.high-contrast .mahjong-table{background:#fff;border:2px solid #000}.high-contrast .table-zone{background:#fff;border:2px solid #000}
@media(max-width:600px){.mahjong-table{padding:8px;border-width:1px;gap:12px}.table-zone{padding:7px;border-width:1px}.table-zone h2{font-size:1.15rem}.table-zone .section-heading{gap:.4rem}.table-hand .hand-grid{gap:20px 12px}}
/* Keep the felt visible beneath the tiles, as on a physical table. */
body:not(.high-contrast) .table-zone {
  background: rgb(6 44 32 / 42%);
  border-color: rgb(238 235 202 / 37%);
  color: #fffcf0;
}
body:not(.high-contrast) .table-zone :is(h2, .small, .tile-name) { color: #fffcf0; }
body:not(.high-contrast) .table-zone .tile-state {
  background: #fff9df;
  color: #173c2c;
  border-radius: .2rem;
}
.explanation-development{margin:1.2rem 0}.development-branches{display:grid;gap:.8rem}.development-branch{margin:0;padding:.75rem;border-left:3px solid var(--green);background:#ffffffa6;border-radius:0 .3rem .3rem 0;overflow-wrap:anywhere}.high-contrast .development-branch{background:#fff;border-color:#000}
.wait-table{margin-bottom:12px}.table-instruction{color:#fff;background:#123f31;padding:.6rem .8rem;border-radius:.3rem;margin:0;font-size:.917rem}.wait-hand-row{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:20px 12px;max-width:38rem;align-items:start}.wait-table-tile{display:flex;justify-content:center;min-width:0}.wait-focus{outline:3px solid #725313;outline-offset:3px;border-radius:.3rem;background:#fff3d6}.wait-row-zone{padding:1rem}.wait-hand-row .tile-static{width:var(--tile-width)}.drill-stats{font-weight:700;color:var(--green);padding:.7rem;background:#e7f3ec;border-radius:.3rem}.high-contrast .table-instruction{background:#fff;color:#000;border:2px solid #000}.high-contrast .wait-focus{outline-color:#000;background:#fff}
@media(max-width:900px){.wait-hand-row{grid-template-columns:repeat(auto-fit,minmax(var(--tile-width),1fr))}.wait-row-zone{padding:7px}.wait-table .table-instruction{padding:.5rem}}
@media(min-width:901px){.big-tiles .wait-hand-row{grid-template-columns:repeat(auto-fit,minmax(var(--tile-width),1fr))}}
.wait-hand-row{grid-template-columns:repeat(auto-fit,minmax(var(--tile-width),1fr));max-width:calc(8 * var(--tile-width) + 84px)}
body:not(.high-contrast) .table-zone .wait-focus .tile-name { color: #382a10; }
.illustrated-tutorial>div{max-width:none;min-width:0;flex:1}.lesson-tile-groups{display:grid;gap:1.2rem}.lesson-tile-group{margin:0;padding-top:.8rem;border-top:1px solid var(--line)}.lesson-tile-group h3{margin-bottom:.6rem}.lesson-tile-row{display:flex;flex-wrap:wrap;gap:16px 12px}.lesson-tile{display:inline-flex;flex:none}.lesson-tile-group p{max-width:32rem}.illustrated-tutorial .lesson-tile-row{padding-bottom:.2rem}
@media(max-width:600px){.illustrated-tutorial{display:block}.illustrated-tutorial>.step-number{margin-bottom:.7rem}}

/* Keep the unlocked next-chapter link separate from the continue-practice button. */
.next-action > .rolling-progress,
.drill-entry > .rolling-progress {
  margin-bottom: max(12px, .75rem);
}
.answer-breakdown { width:100%; border-collapse:collapse; margin:1rem 0; }
.answer-breakdown th,.answer-breakdown td { border:1px solid #a5b7a6; padding:.45em; text-align:left; vertical-align:middle; overflow-wrap:anywhere; }
.answer-breakdown th { background:#e2eadd; }
.answer-breakdown tbody th { width:25%; }
.answer-breakdown small { display:block; font-size:.85em; }
.answer-breakdown .wait-count { display:inline-block; }
@media(max-width:500px) {
  .answer-breakdown { table-layout:fixed; }
  .answer-breakdown th,.answer-breakdown td { padding:.2em; }
  .answer-breakdown thead th:nth-child(2) { width:44%; }
}
/* The public board uses real tile nodes, so every seat remains readable and replaceable. */
.four-seat-board{display:grid;grid-template-columns:minmax(0,1fr) minmax(7rem,.8fr) minmax(0,1fr);grid-template-areas:". across ." "left center right" "self self self";gap:12px;align-items:start;min-width:0}.board-center{grid-area:center;align-self:center;justify-self:stretch;display:flex;flex-direction:column;align-items:center;text-align:center;padding:1rem .4rem;background:#123f31;color:#fff;border:1px solid #d1c58e;border-radius:.5rem;font-size:.917rem}.board-center strong{font-size:1.8rem;line-height:1.4;font-variant-numeric:tabular-nums}.board-seat{background:#f8f9f0f5;color:var(--ink);padding:.65rem;border:1px solid #b7c9b6;border-radius:.4rem;margin:0;min-width:0}.board-seat-across{grid-area:across}.board-seat-left{grid-area:left}.board-seat-right{grid-area:right}.board-seat-self{grid-area:self}.seat-heading{display:flex;gap:.5rem;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:.6rem}.seat-heading h2{font-size:1.15rem;margin:0}.seat-direction{display:block;font-size:.917rem;font-weight:500;letter-spacing:0;color:var(--muted)}.dealer-badge{display:inline-block;padding:.15rem .45rem;border:2px solid #725313;border-radius:.3rem;background:#fff3d6;color:#573d0c;font-weight:700;font-size:.917rem}.seat-river h3,.seat-melds h3{font-size:.917rem;margin:0 0 .4rem;letter-spacing:0}.seat-melds{border-top:1px solid var(--line);padding-top:.6rem;margin-top:.7rem}.seat-tiles{display:flex;flex-wrap:wrap;gap:12px;min-width:0;align-items:flex-start}.seat-tiles>.tile-static{flex:none;width:var(--tile-width)}.seat-empty{margin:0;overflow-wrap:anywhere}.seat-meld{margin:.6rem 0}.meld-label{font-size:.917rem;font-weight:700;display:block;margin-bottom:.3rem}.board-seat-self .seat-river,.board-seat-self .seat-melds{min-width:0}.high-contrast .board-seat,.high-contrast .board-center,.high-contrast .dealer-badge{background:#fff;color:#000;border:2px solid #000}
@media(max-width:900px){.four-seat-board{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:"across across" "left right" "center center" "self self"}.board-center{flex-direction:row;justify-content:center;gap:.5rem;padding:.5rem;flex-wrap:wrap}.board-seat{padding:7px}.seat-heading{align-items:flex-start}.board-seat-across .seat-tiles,.board-seat-self .seat-tiles{justify-content:flex-start}}
@media(max-width:400px){.big-tiles .four-seat-board{grid-template-columns:minmax(0,1fr);grid-template-areas:"across" "left" "right" "center" "self"}}
.mahjong-table{container-type:inline-size}
@container(max-width:40rem){.four-seat-board{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:"across across" "left right" "center center" "self self"}.board-center{flex-direction:row;justify-content:center;gap:.5rem;padding:.5rem;flex-wrap:wrap}.board-seat{padding:7px}}
@container(max-width:12rem){.four-seat-board{grid-template-columns:minmax(0,1fr);grid-template-areas:"across" "left" "right" "center" "self"}}
.recent-discard .tile-face{outline:3px solid #725313;outline-offset:2px}.recent-discard-label{font-size:.917rem;font-weight:700;line-height:1.35;color:#573d0c;background:#fff3d6;border:1px solid #725313;border-radius:.2rem;padding:.05rem .12rem;white-space:nowrap;align-self:center}.high-contrast .recent-discard .tile-face{outline-color:#000}.high-contrast .recent-discard-label{background:#fff;color:#000;border-color:#000}
.explanation-fold { margin-block:.6rem; border:1px solid var(--line); border-radius:.4rem; background:var(--paper,#fffdf7); }
.explanation-fold summary { cursor:pointer; padding:.65rem .8rem; font-weight:700; color:var(--ink); }
.explanation-fold summary:focus-visible { outline:3px solid #1858ac; outline-offset:2px; }
.explanation-fold[open] { padding:0 .6rem .6rem; }
/* A single felt playing surface: seat names sit at the rail, public tiles toward the center. */
.mahjong-table{position:relative;padding:16px;border:12px solid #795134;border-radius:1.5rem;background:radial-gradient(ellipse at 50% 30%,#28735b 0,#17523f 75%),#17523f;box-shadow:inset 0 0 0 2px #b6a56d,inset 0 0 35px #062f2890,0 6px 0 #49301f,0 12px 22px #192e2926;gap:1rem;color:#fff9df}
.mahjong-table:before{content:"";position:absolute;inset:-8px;pointer-events:none;border:1px solid #d2a96d80;border-radius:1.25rem}
.mahjong-table .table-zone{background:transparent;border:0;border-radius:0;padding:.5rem 0;color:inherit;margin:0;box-shadow:none}
.mahjong-table h2,.mahjong-table h3,.mahjong-table .small{color:#fff9df}
.mahjong-table .table-instruction{background:transparent;border:0;padding:.25rem 0;color:#fff9df}
.mahjong-table .four-seat-board{grid-template-columns:minmax(0,1fr) minmax(5rem,.65fr) minmax(0,1fr);grid-template-areas:"across across across" "left center right" "self self self";gap:.8rem;align-items:center;min-height:13rem}
.mahjong-table .board-seat{display:flex;flex-direction:column;gap:.65rem;background:transparent;color:inherit;border:0;border-radius:0;padding:0;box-shadow:none}
.mahjong-table .seat-heading{margin:0;justify-content:center;gap:.4rem;align-items:center}
.mahjong-table .seat-heading h2{font-size:1rem;letter-spacing:.06em}
.mahjong-table .seat-melds{border:0;padding:0;margin:0;order:1}
.mahjong-table .seat-river{order:2;min-width:0}
.mahjong-table .seat-meld{margin:0;display:flex;flex-direction:column;gap:.3rem}
.mahjong-table .seat-meld+.seat-meld{margin-top:.5rem}
.mahjong-table .seat-tiles{gap:8px;justify-content:center}
.mahjong-table .seat-river h3,.mahjong-table .meld-label{text-align:center;margin:0 0 .3rem;font-size:.917rem;font-weight:500;color:#f4eccd}
.mahjong-table .board-seat-across{justify-self:center;width:min(100%,30rem);padding-bottom:.25rem}
.mahjong-table .board-seat-left .seat-heading{justify-content:flex-start}
.mahjong-table .board-seat-right .seat-heading{justify-content:flex-end}
.mahjong-table .board-seat-left .seat-tiles{justify-content:flex-start}
.mahjong-table .board-seat-right .seat-tiles{justify-content:flex-end}
.mahjong-table .board-seat-left .seat-river{align-self:flex-end}
.mahjong-table .board-seat-right .seat-river{align-self:flex-start}
.mahjong-table .board-seat-left .seat-melds{align-self:flex-start}
.mahjong-table .board-seat-right .seat-melds{align-self:flex-end}
.mahjong-table .board-seat-self{padding-top:.4rem}
.mahjong-table .board-seat-self .seat-river{order:0}
.mahjong-table .board-seat-self .seat-melds{order:1}
.mahjong-table .board-seat-self .seat-heading{order:2}
.mahjong-table .board-center{width:100%;min-width:0;justify-self:center;align-self:center;flex-direction:column;gap:0;padding:.7rem .2rem;border:1px solid #c6ba8570;border-radius:50%;background:#0c362c60;box-shadow:0 0 0 5px #143e3025;color:#fff9df}
.mahjong-table .board-center strong{font-size:1.65rem}
.mahjong-table .table-hand{padding-top:.8rem;border-top:1px solid #e8dba045}
.mahjong-table .table-hand .hand-grid{display:flex;flex-wrap:wrap;gap:16px 4px;max-width:none;justify-content:center;margin-top:.8rem}
.mahjong-table .hand-grid>.tile-static{flex:none;width:var(--tile-width)}
.mahjong-table .tile-face{box-shadow:inset 1px 1px 1px white,inset -1px -2px 1px #dfd6c1,0 3px 0 #d2c9af,0 7px 0 #456450,2px 9px 8px #06251c70}
.mahjong-table .wait-row-zone{padding:.5rem 0}
.mahjong-table .wait-hand-row{margin-inline:auto;gap:18px 12px}
.mahjong-table .wait-focus{outline-color:#f7d782;background:#d9ac48;border-radius:.3rem}
@container(max-width:26rem){
 .mahjong-table .four-seat-board{grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:"across across" "left right" "center center" "self self";gap:1rem .5rem;min-height:0}
 .mahjong-table .board-center{width:auto;max-width:100%;border-radius:2rem;flex-direction:row;flex-wrap:wrap;gap:.35rem;padding:.3rem .7rem}
 .mahjong-table .seat-tiles{gap:14px 5px}
 .mahjong-table .seat-heading{flex-wrap:wrap}
}
@media(max-width:600px){
 .mahjong-table{padding:10px 7px;border-width:7px;border-radius:.85rem;gap:.7rem}
 .mahjong-table:before{inset:-4px;border-radius:.65rem}
 .mahjong-table .table-hand .hand-grid{gap:16px 6px;justify-content:space-evenly}
 .mahjong-table .seat-heading h2{letter-spacing:0}
}
.high-contrast .mahjong-table{background:#fff;color:#000;border-color:#000;box-shadow:none}
.high-contrast .mahjong-table:before{display:none}
.high-contrast .mahjong-table h2,.high-contrast .mahjong-table h3,.high-contrast .mahjong-table .small,.high-contrast .mahjong-table .table-instruction,.high-contrast .mahjong-table .meld-label{color:#000}
.high-contrast .mahjong-table .board-seat,.high-contrast .mahjong-table .table-zone{background:transparent;color:#000;border:0}
.high-contrast .mahjong-table .board-center{background:#fff;color:#000;border:2px solid #000;box-shadow:none}
.high-contrast .mahjong-table .table-hand{border-top:2px solid #000}
.high-contrast .mahjong-table .tile-face{box-shadow:none;border:2px solid #000}
/* Keep each exposed set intact and separate from the discards. */
.mahjong-table .board-seat .seat-melds {
  order:2; align-self:stretch; container-type:inline-size;
  display:flex; flex-wrap:wrap; justify-content:center; gap:12px .7rem;
}
.mahjong-table .board-seat .seat-river { order:1; align-self:stretch; }
.mahjong-table .board-seat .seat-river + .seat-melds {
  border-top:1px solid currentColor; padding-top:.5rem;
}
.mahjong-table .board-seat .seat-meld {
  flex:0 0 auto; margin:0;
  --tile-width:min(2.667rem,calc(25cqw - 3px));
  --tile-height:calc(var(--tile-width) * 1.375);
}
.mahjong-table .seat-meld .seat-tiles { flex-wrap:nowrap; gap:3px; }
.mahjong-table .board-seat-right .seat-melds { justify-content:flex-end; }
.mahjong-table .board-seat-left .seat-melds { justify-content:flex-start; }
.mahjong-table .board-seat-right .seat-river h3 { text-align:right; }
.mahjong-table .board-seat-left .seat-river h3 { text-align:left; }
.high-contrast .mahjong-table .wait-focus{outline-color:#000;background:#fff}
@media(min-width:601px){.mahjong-table{border-top-width:9px;border-bottom-width:15px}}
/* Keep complete hands in two physical rows, including narrow and enlarged layouts. */
.mahjong-table .hand-rack-scroll{min-width:0;max-width:100%;width:100%;overflow-x:auto;overscroll-behavior-inline:contain;padding:6px 6px 14px;scrollbar-color:#e4d6a5 #123f31;scrollbar-width:auto}
.mahjong-table .hand-rack{width:max-content;min-width:100%;padding:0 4px}
.mahjong-table .hand-rack .wait-hand-row{display:flex;flex-wrap:nowrap;justify-content:center;gap:12px;max-width:none;margin:0}
.mahjong-table .hand-rack .wait-table-tile{flex:0 0 var(--tile-width);width:var(--tile-width)}
.mahjong-table .hand-rack .wait-row-zone{padding:.5rem 0 .8rem}
.mahjong-table .hand-rack .wait-row-zone h2{font-size:1rem;margin-bottom:.5rem}
.mahjong-table .hand-scroll-hint{margin:.3rem 0 0}
@container(min-width:34rem){.mahjong-table .hand-scroll-hint{display:none}}
.high-contrast .mahjong-table .hand-rack-scroll{scrollbar-color:#000 #fff}

@media (max-width: 600px) {
  .mahjong-table .four-seat-board { gap: 8px; }
  .mahjong-table .board-center {
    flex-flow: row nowrap;
    inline-size: max-content;
    gap: .25em;
    padding: 3px 12px;
    font-size: .85rem;
    line-height: 1.35;
  }
  .mahjong-table .board-center strong { font-size: 1.12em; }
  .mahjong-table .table-hand .section-heading { gap: 4px; }
  .mahjong-table .hand-rack .wait-hand-row { gap: 3px; }
  .mahjong-table .hand-rack .wait-row-zone { padding: 4px 0 8px; }
  .mahjong-table .hand-rack .wait-row-zone h2 { margin-bottom: 4px; }
  body:not(.big-tiles) .mahjong-table .hand-rack-scroll {
    --tile-width: min(48px, calc((100cqw - 32px) / 9));
    --tile-height: calc(var(--tile-width) * 1.42);
    padding: 4px 4px 10px;
  }
  body:not(.big-tiles) .mahjong-table .hand-rack { padding: 0; }
  body:not(.big-tiles) .mahjong-table .hand-scroll-hint { display: none; }
}

practice-rack { display:block; min-width:0; }
practice-rack .rack-help { font-size:.92rem; }
.arrange-row { margin-block:12px; }
.arrange-tiles { display:flex; align-items:flex-end; gap:4px; overflow-x:auto; padding:6px 4px 10px; }
.arrange-tiles button { padding:0; background:transparent; border:0; border-radius:5px; flex:none; }
.arrange-tiles button[aria-pressed="true"] { outline:3px solid #b77813; transform:translateY(-3px); }
.arrange-tiles button[draggable] { cursor:grab; }
.arrange-tiles button[draggable] > * { pointer-events:none; }
.arrange-tiles button[data-insert="before"] { box-shadow:-4px 0 #ffda83; }
.arrange-tiles button[data-insert="after"] { box-shadow:4px 0 #ffda83; }
.arrange-tiles button:disabled { opacity:.62; }
.mahjong-table practice-rack .button { background:var(--paper); }
@media(max-width:600px){
 body:not(.big-tiles) .arrange-tiles { --tile-width:min(44px,calc((100cqw - 40px) / 10)); gap:3px; }
 body:not(.big-tiles) .arrange-tiles .tile-face { height:auto; aspect-ratio: 1 / 1.42; }
 .arrange-tiles button { min-height:44px; }
}

.answer-choices.discard-options {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-start;
  gap:12px 6px;
}
.discard-option {
  position:relative;
  display:grid;
  place-items:center;
  padding:4px 2px 8px;
  min-width:44px;
  min-height:48px;
  border:2px solid transparent;
  border-radius:8px;
  background:transparent;
}
.discard-option:hover:enabled { border-color:var(--green); }
.discard-option[aria-pressed="true"] { outline:3px solid currentColor; color:var(--green); }
.discard-option .rack-mark {
  position:absolute; top:-4px; right:-2px; border-radius:50%;
  width:22px; height:22px; text-align:center; line-height:22px;
  color:white; background:#145c43; font-weight:bold; font-size:16px;
}
.discard-option .rack-mark.wrong { background:#933624; }
@media(max-width:600px){
  body:not(.big-tiles) .discard-option { --tile-width:42px; --tile-height:59px; }
}

.answer-breakdown.efficiency-table { table-layout:fixed; }
.efficiency-table thead th:first-child { width:14%; }
.answer-breakdown.efficiency-table thead th:nth-child(2) { width:16%; }
.efficiency-table thead th:last-child { width:17%; }
.efficiency-table .wait-count { margin-inline-end:.25em; }
@media(max-width:600px){
  .efficiency-table thead th:first-child { width:18%; }
  .efficiency-table thead th:last-child { width:19%; }
  .efficiency-table .wait-count { max-width:100%; }
}

.mahjong-table .round-wind { font-weight:700; white-space:nowrap; }
@media (max-width:600px) {
  .mahjong-table .board-center { flex-wrap:wrap; }
  .mahjong-table .round-wind { flex-basis:100%; }
}
/* Shared course identity: warm paper, olive ink, and Chinese book typography. */
:root {
  --paper:#faf7f1; --ink:#402e23; --muted:#615a4c; --green:#526338;
  --bronze:#755b36; --line:#d1c9b8;
  --book-font:"Noto Serif TC","Songti TC","PMingLiU","MingLiU",serif;
}
body { background:var(--paper); }
.site-header { max-width:none; background:var(--paper); padding:.55rem max(4vw,1rem); }
.brand, nav, h1, h2, h3, .button, .footer-brand { font-family:var(--book-font); }
h1,h2,h3 { letter-spacing:.035em; }
.brand-mark {
  background:#f8f3df; color:var(--green); border:1px solid #808669;
  box-shadow:inset 0 0 0 3px #fffdf5,inset 0 0 0 4px #b4b79e,3px 2px 0 #7a8264;
  min-width:1.65rem; min-height:2rem; font-size:1.22rem;
}
.brand-sub { font-size:.68rem; letter-spacing:.09em; }
nav a { font-size:.88rem; letter-spacing:.09em; }
.button.primary { background:var(--green); color:white; border-color:var(--green); border-radius:2rem; padding-inline:1.1rem; }
.button.primary:hover { background:#404f2d; }
.panel,.chapter-card,.answer-choice,.tutorial.illustrated-tutorial {
  border-color:var(--line); border-radius:.8rem; background:#fffdf8;
}
.chapter-number,.step-number { font-family:Georgia,serif; }
.learning-strip,.preview,.reading-sample { background:#efeee2; border-color:var(--line); }
body:not(.high-contrast) :is(.page-title,.result-hero) {
  padding:clamp(1rem,3vw,2.2rem); border-radius:.85rem;
  background:linear-gradient(100deg,#f6f1e7 45%,#e7e8d7); border:1px solid var(--line);
}
body:not(.high-contrast) .question-heading { border-bottom:1px solid var(--line); padding-bottom:1rem; }
footer { color:var(--muted); background:var(--paper); }
main:has(.field-hero) { max-width:none; padding-inline:0; padding-top:0; }
main:has(.field-hero)>:not(.field-hero) { width:min(92%,1240px); margin-inline:auto; }
.studio-hero {
  display:grid; place-items:center; text-align:center; min-height:clamp(400px,46vw,685px);
  padding:2rem 5vw; margin-bottom:0; background:#eee6d6 url('/assets/sunlit-table.webp') center center/cover no-repeat;
}
.studio-hero>div { padding-bottom:1.8rem; }
.studio-hero h1 { font-size:clamp(1.55rem,5.4vw,4rem); color:#482e1f; font-weight:600; margin:0 0 .7rem; }
.studio-hero h2,.foundation-section h2 { color:var(--green); font-weight:600; }
.studio-hero h2 { font-size:clamp(1rem,2.35vw,1.7rem); letter-spacing:.12em; }
.studio-hero p { font-family:var(--book-font); color:#44382c; }
.studio-hero .primary { padding-inline:1.65rem; }
.foundation-section { padding-block:1.5rem .2rem; text-align:center; }
.foundation-section h2 { margin-bottom:1rem; }
.foundations { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:clamp(12px,1.8vw,28px); }
.foundation { display:block; text-decoration:none; border-radius:.85rem; overflow:hidden; background:#f1ece2; }
.foundation:hover h3 { text-decoration:underline; text-underline-offset:.2em; }
.foundation img { display:block; width:100%; height:auto; }
.foundation>div { padding:.65rem .65rem .9rem; }
.foundation h3 { margin:0 0 .3rem; font-size:1.1rem; }
.foundation h3 span { display:inline-grid; place-items:center; width:1.45em; height:1.45em; border-radius:50%; background:#68734b; color:white; margin-right:.35em; font-family:Georgia,serif; }
.foundation p { color:var(--muted); margin:0; font-size:.88rem; }
.high-contrast :is(.foundation,.studio-hero,.preview,.reading-sample) { background:white; border:2px solid black; }
.high-contrast :is(.studio-hero h1,.studio-hero h2,.studio-hero p,.foundation-section h2) { color:black; }
@media(min-width:701px) and (max-width:1000px) { .site-header { flex-direction:row; align-items:center; } }
@media(max-width:700px) {
  .studio-hero { min-height:16rem; background-image:linear-gradient(90deg,#faf5e599,#faf5e555),url('/assets/sunlit-table.webp'); }
  .studio-hero>div { padding-bottom:.6rem; }
  .foundations { grid-template-columns:1fr; }
  .foundation { display:grid; grid-template-columns:32% 1fr; align-items:center; text-align:left; }
  .foundation img { height:100%; object-fit:cover; }
  .foundation h3 { font-size:1rem; }
  .foundation-section h2 { font-size:1.18rem; }
}

.field-hero {
  margin:0; padding:clamp(1.5rem,5vw,4rem) 4vw;
  background:linear-gradient(95deg,#faf5e9f2 10%,#faf5e9cf 46%,#faf5e92a 83%),url('/assets/sunlit-table.webp') center 64%/cover;
  border-bottom:1px solid var(--line);
}
.field-layout { width:min(100%,1240px); margin:auto; display:grid; grid-template-columns:1fr 1fr; gap:clamp(1rem,5vw,4rem); align-items:center; }
.field-intro h1 { color:#3a2b20; font-size:clamp(1.75rem,4.55vw,3.2rem); line-height:1.3; }
.field-copy { max-width:21em; margin-bottom:1.2rem; color:#4c4438; }
.field-trial { padding:clamp(1rem,2.6vw,2.1rem); background:#233f34; color:#fff9e9; border:1px solid #697b61; border-radius:.85rem; box-shadow:0 .55rem 1.4rem #33291729; }
.trial-label { color:#e2d4ad; font-size:.77rem; letter-spacing:.12em; }
.field-trial h2 { font-size:clamp(1.05rem,2.2vw,1.55rem); line-height:1.45; }
.trial-tiles>span { display:inline-flex; gap:.22rem; }
.trial-rule { margin:.6rem 0; font-size:.83rem; }
.trial-options { display:grid; grid-template-columns:1fr 1fr; gap:.5rem; }
.trial-options button { background:#fff9ec; color:#293e30; padding:.4rem; border:2px solid transparent; border-radius:.42rem; min-height:48px; font-weight:700; }
.trial-options button:hover,.trial-options button[aria-pressed=true] { background:#e2dfbb; border-color:#ae985a; }
.trial-result:not(:empty) { border-top:1px solid #829582; padding-top:.7rem; margin-top:.8rem; }
.trial-result p { font-size:.88rem; margin:.3rem 0 0; }
.high-contrast .field-hero,.high-contrast .field-trial { background:white; color:black; border:2px solid black; }
.high-contrast :is(.field-intro h1,.field-copy,.trial-label) { color:black; }
@media(max-width:760px){
  .field-layout { grid-template-columns:1fr; gap:1rem; }
  .field-hero { padding:1rem 4vw; }
  .field-intro h1 { margin-bottom:.45rem; }
  .field-copy { margin-bottom:.65rem; }
  .field-trial h2 br { display:none; }
}

.curriculum-stage {
  display:grid; grid-template-columns:minmax(8rem,24%) minmax(0,1fr);
  margin-bottom:1rem; border:1px solid var(--line); border-radius:.8rem;
  overflow:hidden; background:#fffdf8;
}
.curriculum-cover {
  color:#fff9ee; padding:1.1rem; display:flex; flex-direction:column; justify-content:flex-end;
  background:linear-gradient(0deg,#28392b 4%,#293728b8 56%,#29372819),var(--cover) center/cover;
}
.curriculum-cover span,.curriculum-record small {font-size:.76rem;}
.curriculum-cover h3 {margin:.25rem 0 0;}
.curriculum-stage ol {list-style:none; margin:0; padding:0;}
.curriculum-stage li+li {border-top:1px solid var(--line);}
.curriculum-row {display:grid; grid-template-columns:auto minmax(0,1fr) auto auto; align-items:center; gap:.7rem; padding:.75rem .9rem; text-decoration:none;}
.curriculum-row:hover,.curriculum-row:focus-visible {background:#f2f1e6;}
.curriculum-row:focus-visible {outline-offset:-4px;}
.curriculum-id {font:1.05rem Georgia,serif; color:var(--green);}
.curriculum-topic,.curriculum-record {display:grid;}
.curriculum-topic strong {font-family:var(--book-font);}
.curriculum-topic>span,.curriculum-record {color:var(--muted); font-size:.8rem;}
.curriculum-record {text-align:right;}
.curriculum-record .passed {color:var(--green);}
.curriculum-record .available {color:#704914;}
.curriculum-arrow {font-size:1.3rem; color:var(--green);}
.trial-result .button {margin-top:.5rem;}
.high-contrast .curriculum-cover {color:black;background:white;border-bottom:1px solid black;}
@media(max-width:800px){
  .curriculum-stage {grid-template-columns:1fr;}
  .curriculum-cover {padding:.7rem 1rem;background:linear-gradient(90deg,#28392b 30%,#29372880),var(--cover) center 54%/cover;}
  .curriculum-row {grid-template-columns:auto minmax(0,1fr) auto;gap:.2rem .6rem;}
  .curriculum-record {grid-column:2; text-align:left;}
  .curriculum-arrow {grid-column:3;grid-row:1/3;}
}

.sample-library { padding-top:clamp(1.3rem,4vw,2.4rem); }
.sample-library header { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:.25rem 1rem; margin-bottom:.8rem; }
.sample-library header h2,.sample-library header p { margin:0; }
.sample-library header p { color:var(--muted); font-size:.88rem; }
.sample-library ul { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.65rem; padding:0; margin:0; list-style:none; }
.sample-library li a { display:grid; gap:.5rem; height:100%; padding:.8rem 1rem; border:1px solid var(--line); border-radius:.65rem; background:#fffdf7; text-decoration:none; }
.sample-library li a:hover,.sample-library li a:focus-visible { background:#f0f0e4; border-color:var(--green); }
.sample-top { display:flex; align-items:center; justify-content:space-between; gap:.3rem; }
.sample-top small,.sample-open { font-size:.77rem; color:var(--green); }
.sample-faces { display:flex; gap:.08rem; padding:.18rem .26rem .28rem; background:#314b3d; border-radius:.25rem; }
.sample-faces .tile-face { width:.86rem; height:1.18rem; }
.sample-library strong { font-family:var(--book-font); line-height:1.45; }
.sample-open { justify-self:start; font-weight:700; }
.high-contrast .sample-library li a { background:white; color:black; border-color:black; }
@media(max-width:880px){ .sample-library ul { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:540px){ .sample-library ul { grid-template-columns:1fr; } .sample-library li a { grid-template-columns:1fr auto; align-items:center; gap:.15rem .45rem; } .sample-top { grid-column:1/-1; } }

/* Keep each player's river on the inside and exposed sets along their rail. */
.mahjong-table .four-seat-board {
  grid-template-columns:minmax(0,1fr) minmax(0,.65fr) minmax(0,1fr);
  grid-template-areas:"across across across" "left center right" "self self self";
  gap:clamp(5px,1cqw,16px); min-height:clamp(230px,37cqw,460px);
}
.mahjong-table .board-center { width:fit-content; max-width:100%; border-radius:.6rem; }
.mahjong-table :is(.board-seat-left,.board-seat-right) {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.35rem; align-items:center;
}
.mahjong-table .board-seat-left { grid-template-areas:"label label" "sets river"; }
.mahjong-table .board-seat-right { grid-template-areas:"label label" "river sets"; }
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-heading {grid-area:label;}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-river {grid-area:river;}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-melds {
  grid-area:sets; display:grid; justify-content:center; gap:.65rem; padding:.25rem; border:0;
}
.mahjong-table .board-seat-right .seat-river + .seat-melds {border-left:1px solid #b9bb99;}
.mahjong-table .board-seat-left .seat-river + .seat-melds {border-right:1px solid #b9bb99;}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-tiles {
  --side-width:clamp(20px,4cqw,52px);
  display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,var(--side-width)),1fr)); gap:4px;
}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-meld {container-type:normal;}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-meld .seat-tiles {
  --side-width:clamp(20px,4vw,52px); grid-template-columns:auto;
}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-tiles .tile-static {
  width:min(100%,var(--side-width)); justify-self:center;
}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-tiles .tile-face {
  width:100%; height:auto; aspect-ratio:1.375; display:grid; place-items:center;
}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-tiles svg {width:72%;height:137.5%;grid-area:1/1;transform:rotate(90deg);}
.mahjong-table .board-seat-right .seat-tiles svg {transform:rotate(-90deg);}
.mahjong-table .seat-melds .seat-meld {min-width:0;}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-melds {container-type:normal;}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-meld .tile-static {width:var(--side-width);max-width:100%;}
.mahjong-table .table-hand {background:transparent;}

@container(min-width:39rem){
  .mahjong-table practice-rack {display:grid; grid-template-columns:minmax(0,1fr); gap:.3rem;}
  .mahjong-table practice-rack .arrange-row {margin:0;max-width:100%;}
  .mahjong-table practice-rack .arrange-tiles {--tile-width:min(2.667rem,4.6cqw);--tile-height:calc(var(--tile-width)*1.375);}
}

.mahjong-table .seat-heading {display:flex;align-items:center;flex-wrap:wrap;}
.seat-wind {display:block;color:inherit;font:normal .67rem/1.45 sans-serif;}
.wind-counter {display:inline-grid;place-items:center;width:1.75rem;height:1.65rem;flex:none;border-radius:48%;background:radial-gradient(ellipse at 35% 25%,#ffd468,#e8a62b 63%,#b57e1d);box-shadow:0 3px 0 #876221,0 4px 6px #15352688;}
.wind-counter b {display:grid;place-items:center;width:63%;height:72%;border-radius:.12rem;background:#fffbee;color:#322920;font:bold 1.05rem/1 DFKai-SB,serif;}
.board-seat-across .wind-counter {order:5;}
.mahjong-table .board-seat-left .seat-heading:has(.wind-counter) {flex-direction:column;align-items:flex-start;}
.mahjong-table .board-seat-right .seat-heading:has(.wind-counter) {flex-direction:column;align-items:flex-end;}
.board-seat-right .wind-counter {order:5;}
.wall-opening {color:inherit;font-size:.72rem;border:1px solid currentColor;border-radius:.25rem;padding:0 .25rem;}
.table-dice {color:inherit;white-space:nowrap;font:1.05rem/1.4 "Segoe UI Symbol",sans-serif;}

/* Concealed tiles and exposed sets share the outer rail; discards face the learner. */
.mahjong-table .concealed-rail {
  display:block;width:clamp(58px,12vw,154px);height:12px;border-radius:3px;
  background:repeating-linear-gradient(90deg,transparent 0 10px,#33562f 10px 11px),linear-gradient(#b6cd7c,#779747 30%,#4b6937 85%,#38542e);
  box-shadow:0 2px 3px #10352680;
}
.mahjong-table .board-seat-across .seat-melds {order:0;align-items:center;border:0;padding:0;}
.mahjong-table .board-seat-across .seat-heading {order:-1;}
.mahjong-table .board-seat-across .seat-meld svg {transform:rotate(180deg);}
.mahjong-table :is(.board-seat-left,.board-seat-right) .concealed-rail {
  width:12px;height:clamp(40px,7vw,80px);justify-self:center;
  background:repeating-linear-gradient(0deg,transparent 0 9px,#33562f 9px 10px),linear-gradient(90deg,#acc97a,#789847 35%,#456234);
}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-river .seat-tiles {
  display:grid;grid-template-columns:repeat(2,minmax(0,auto));justify-content:center;gap:4px;
}
.mahjong-table :is(.board-seat-across,.board-seat-left,.board-seat-right) .seat-river .tile-static {width:clamp(16px,2.4vw,33px);max-width:100%;}
.mahjong-table :is(.board-seat-across,.board-seat-left,.board-seat-right) .seat-river .tile-face {width:100%;height:auto;aspect-ratio:64/88;}
.mahjong-table :is(.board-seat-across,.board-seat-left,.board-seat-right) .seat-river svg {width:100%;height:100%;transform:none;}
.mahjong-table :is(.board-seat-left,.board-seat-right) .seat-meld .seat-tiles {--side-width:clamp(20px,3vw,40px);}
.mahjong-table .seat-backs {grid-area:sets;justify-self:center;align-self:center;order:0;}
.lesson-tile-groups .tutorial-board {grid-column:1/-1;min-width:0;}

.draw-wall {max-width:26rem;margin:1rem auto;padding:1rem;border-radius:.65rem;background:#204e40;color:#fffaf0;}
.draw-wall-shape {display:grid;grid-template-columns:1.2rem 1fr 1.2rem;grid-template-rows:1.2rem 3rem;margin:0 10%;}
.draw-wall-shape i {background:repeating-linear-gradient(0deg,#93aa62 0 .66rem,#455c38 .67rem .75rem);border:1px solid #b8c98e;border-radius:3px;}
.draw-wall-shape i:first-child {grid-column:1/-1;background:repeating-linear-gradient(90deg,#93aa62 0 .66rem,#455c38 .67rem .75rem);}
.draw-wall-shape i:last-child {grid-column:3;}
.draw-wall figcaption {display:flex;justify-content:space-between;gap:.5rem;margin-top:.45rem;text-align:center;font-size:.9rem;}
.wall-check summary {cursor:pointer;color:var(--green);font-weight:bold;}

.chapter-practice {display:flex;align-items:center;flex-wrap:wrap;gap:.65rem 1rem;border-top:1px solid var(--line);margin-top:.8rem;padding-top:.8rem;}
.chapter-practice .rolling-progress {flex:1 1 20rem;min-width:0;}
.chapter-practice > p,.chapter-practice .drill-stats {margin:0;}

.chapter-cover {display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);overflow:hidden;border:1px solid var(--line);border-radius:.85rem;background:#faf5e9;margin:.6rem 0 1.4rem;}
.chapter-cover-body {padding:clamp(1rem,3.5vw,2.1rem);align-self:center;}
.chapter-cover-body h1 {font-family:var(--book-font);font-size:clamp(1.65rem,3.4vw,2.65rem);line-height:1.2;margin:.35rem 0 .5rem;}
.chapter-cover-body header p {margin:0;}
.chapter-cover > img {width:100%;height:100%;min-height:0;object-fit:cover;}
.chapter-score {border-top:1px solid var(--line);color:var(--green);font-size:.86rem;padding-top:.7rem;margin:.85rem 0 .7rem;}
.chapter-cover-actions {display:flex;align-items:center;gap:.55rem 1rem;flex-wrap:wrap;}
.chapter-cover-actions .text-link {margin:0;}
.book-index {display:inline-block;vertical-align:baseline;margin-inline-end:.65em;padding-inline-end:.65em;border-inline-end:1px solid currentColor;color:var(--green);font:600 .68em/1.1 Georgia,serif;font-variant-numeric:tabular-nums;}
.high-contrast .chapter-cover {background:white;border-color:black;}
.high-contrast .chapter-score {color:black;}
@media(max-width:720px){
  .chapter-cover {grid-template-columns:1fr;}
  .chapter-cover > img {grid-row:1;height:clamp(4rem,22vw,7rem);object-position:center 55%;}
}

/* Shared playback control for questions, table tiles, and explanations. */
.button[data-reading-label] {
  display:inline-flex;align-items:center;justify-content:center;gap:.55em;
  min-block-size:44px;min-inline-size:min(100%,8.2em);max-inline-size:100%;
  padding:.42em .85em;border:1px solid #babda7;border-radius:2em;
  background:#faf8ef;color:#445538;font-weight:600;line-height:1.35;
}
.button[data-reading-label]::before {
  content:"";flex:none;width:.76em;height:.84em;background:currentColor;
  clip-path:polygon(12% 0,100% 50%,12% 100%);
}
.button[data-reading-label]:hover {background:#eeefdf;border-color:#64734a;}
.button[data-reading-label][aria-pressed="true"] {background:#465b38;border-color:#465b38;color:#fffdf3;}
.button[data-reading-label][aria-pressed="true"]::before {clip-path:inset(9% 3% round .08em);}
.button[data-reading-label]:focus-visible {outline:3px solid #986627;outline-offset:3px;}
@media(forced-colors:active){
  .button[data-reading-label]::before {forced-color-adjust:none;background:ButtonText;}
  .button[data-reading-label][aria-pressed="true"]::before {background:ButtonText;}
}

.discard-controls { display:flex; flex-wrap:wrap; align-items:center; gap:.2rem; }
.compare-discard { border:1px solid currentColor; border-radius:.3rem; padding:.15em .35em; font:inherit; font-size:.72em; min-height:24px; color:var(--olive,#485a34); background:transparent; cursor:pointer; }
.compare-discard[aria-pressed="true"] { background:#475835; color:white; }
.wait-count.common-wait { filter:grayscale(1); color:#646464; }
.wait-count.common-wait .inline-tile, .wait-count.common-wait svg { opacity:.58; }
.winning-groups { display:flex; flex-wrap:wrap; gap:.5rem 1rem; }.winning-groups > span { display:inline-flex; }

/* Hands follow their seat. The ivory front lip distinguishes standing tiles
   from the shorter faces of exposed sets lying on the felt. */
.mahjong-table .board-seat-self > .table-hand {
  order:3; width:100%; min-width:0; align-self:center;
  background:transparent; border:0; padding:.35rem 0;
}
.board-seat-self .table-hand .section-heading,
.board-seat-self .table-hand .actions {justify-content:center;}
.board-seat-self .table-hand .rack-help {text-align:center;}
.board-seat-self .arrange-tiles {justify-content:safe center;}
.mahjong-table .standing-backs {
  display:grid; grid-template-columns:repeat(var(--columns),minmax(0,1fr));
  width:min(100%,calc(var(--columns) * 1.25rem)); gap:4px 2px; margin:auto;
}
.standing-backs i {
  aspect-ratio:4/5; border:1px solid #536546; border-top:3px solid #f1e9ca;
  border-radius:3px; background:linear-gradient(105deg,#adb978,#718853);
  box-shadow:0 2px 1px #183d30;
}
.mahjong-table .board-seat-across .seat-backs {width:100%;}
.mahjong-table .revealed-standing {min-width:0;}
.revealed-standing h2 {font-size:.85rem;text-align:center;}
.mahjong-table .revealed-standing .table-tiles {justify-content:center;gap:6px 2px;}
.mahjong-table .revealed-standing .tile-static {width:min(100%,1.5rem);}
.mahjong-table .revealed-standing .tile-face {width:100%;height:auto;aspect-ratio:64/88;}
.mahjong-table :is(.board-seat-across,.board-seat-self) .seat-melds {
  display:flex;flex-flow:row wrap;align-items:end;justify-content:center;gap:.4rem;
}
.mahjong-table :is(.board-seat-across,.board-seat-self) .seat-meld {margin:0;}
.mahjong-table :is(.board-seat-across,.board-seat-self) .seat-meld .seat-tiles {gap:2px;flex-wrap:nowrap;}
.mahjong-table :is(.board-seat-across,.board-seat-self) .seat-meld .tile-static {width:clamp(22px,3.3cqw,42px);}
.mahjong-table :is(.board-seat-across,.board-seat-self) .seat-meld .tile-face {width:100%;height:auto;aspect-ratio:1;}
.mahjong-table .seat-meld .tile-face,.flat-tiles .tile-face {box-shadow:0 2px #c5bda1,0 3px #55674c;}
.mahjong-table .table-hand .tile-face,.standing-tiles .tile-face,.revealed-standing .tile-face {
  position:relative; isolation:isolate; padding:0; border:0; border-radius:0;
  background:transparent; box-shadow:none; filter:drop-shadow(1px 3px 1px #102d2399);
}
:is(.table-hand,.standing-tiles,.revealed-standing) .tile-face::before {
  content:""; position:absolute; inset:0; z-index:-1; pointer-events:none;
  clip-path:polygon(0 12%,8% 0,98% 0,100% 2%,100% 89%,92% 100%,2% 100%,0 98%);
  background:linear-gradient(to bottom,#69865b 0 4%,#b4c497 4% 7%,#efe2bb 7% 12%,transparent 12%),
             linear-gradient(to left,#71835f 0 4%,#b8ac88 4% 9%,#e5d7b4 9%);
}
:is(.table-hand,.standing-tiles,.revealed-standing) .tile-face > svg {
  position:absolute; inset:11% auto auto 0; width:93%; height:89%;
  border:1px solid #a49878; border-radius:7% / 5%;
  background:linear-gradient(105deg,#fffef7,#faf5e6);
}
@media (forced-colors:active) {
  :is(.table-hand,.standing-tiles,.revealed-standing) .tile-face::before {background:CanvasText;}
  :is(.table-hand,.standing-tiles,.revealed-standing) .tile-face > svg {background:Canvas;border-color:CanvasText;}
}
.illustrated-tutorial .teaching-felt {
  display:grid;grid-template-columns:repeat(var(--columns), minmax(0,1fr));width:fit-content;max-width:100%;
  gap:12px 3px;background:#205342;border-radius:.4rem;padding:.55rem .5rem .8rem;
}
.teaching-felt .lesson-tile {min-width:0;}
.teaching-felt .tile-face {width:min(100%,var(--tile-width));height:auto;aspect-ratio:64/88;}
.teaching-felt.flat-tiles .tile-face {aspect-ratio:1;}
.mahjong-table .board-seat-across .seat-melds .standing-backs {flex:0 1 calc(var(--columns) * 1.25rem);margin:0;}
.illustrated-tutorial .teaching-felt {width:min(100%,calc(var(--columns) * (var(--tile-width) + 3px) + 1rem));}
