:root{font-family:system-ui,-apple-system,'Hiragino Kaku Gothic ProN',sans-serif;color:#183f35;background:#f7f6f0;font-synthesis:none}*{box-sizing:border-box}body{margin:0;min-height:100svh;display:flex;flex-direction:column}button,select{font:inherit}button{cursor:pointer;touch-action:manipulation}button:focus-visible,select:focus-visible{outline:3px solid #c18d3d;outline-offset:4px}[hidden]{display:none!important}header{display:flex;align-items:center;justify-content:space-between;padding:24px 5vw;border-bottom:1px solid #e3e5db}.brand{display:flex;gap:12px;align-items:center;color:inherit;text-decoration:none;font-size:15px;font-weight:650;letter-spacing:.06em}.brandmark{background:#183f35;color:#fff;padding:4px 8px;border-radius:5px;font-family:serif;font-size:22px}select{background:transparent;border:1px solid #d6dbd1;border-radius:30px;padding:7px 12px;color:#183f35;font-size:12px}main{width:100%;max-width:600px;margin:auto;padding:26px 16px}#home{text-align:center;padding:24px 0}.eyebrow{font-size:10px;letter-spacing:.2em;color:#788779}.hero-tiles{height:122px;display:flex;justify-content:center;align-items:center;margin:25px 0 15px}.hero-tiles span{display:grid;place-items:center;width:65px;height:87px;background:#fffef8;border:1px solid #deded1;border-bottom:6px solid #cbd5c1;border-radius:8px;font:48px serif;color:#37745b;box-shadow:0 12px 25px #163e3510;transform:rotate(-12deg)}.hero-tiles span+span{transform:rotate(12deg);margin-left:10px}h1{font-family:serif;font-size:42px;line-height:1.5;letter-spacing:.1em;font-weight:500;margin:12px 0}.intro{font-size:13px;color:#778276;margin:18px 0 32px}.primary{display:block;margin:0 auto;background:#183f35;color:white;border:0;border-radius:8px;padding:17px 32px;min-width:230px;font-weight:600;letter-spacing:.12em;box-shadow:0 5px 12px #163e3515}.primary:hover{background:#285848}.text-button{background:none;border:0;color:#758275;padding:14px;font-size:12px}.best{margin:30px auto 5px;display:flex;justify-content:center;gap:20px;font-size:12px;color:#859080}.best strong{color:#183f35;font-variant-numeric:tabular-nums}footer{display:flex;justify-content:space-between;padding:20px 5vw;color:#94a08f;letter-spacing:.15em;font-size:9px}footer button{border:0;background:none;color:#758275;font-size:11px}.game-top{display:flex;align-items:center;margin-bottom:20px;gap:22px}#timer{font-size:27px;font-variant-numeric:tabular-nums;letter-spacing:.05em;margin-top:3px}.count{margin-left:auto;font-size:11px;color:#7c897a}.count strong{font-weight:500;font-size:20px;margin-right:5px}.icon-button{border:1px solid #d9dfd1;background:none;border-radius:50%;width:42px;height:42px;color:#234b3d}.board-wrap{position:relative;background:#1e493d;border-radius:14px;padding:clamp(12px,4vw,26px);box-shadow:inset 0 1px 8px #092a2630,0 12px 32px #183f350a}#board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:4px}.tile{padding:0;aspect-ratio:.79;border:1px solid #ebe9db;border-bottom:3px solid #c4d1b7;border-radius:4px;background:#fffdf0;display:flex;align-items:center;justify-content:center;position:relative;user-select:none;transition:transform .12s,background .12s;font-family:serif}.tile svg{width:85%;height:85%}.tile.empty{visibility:hidden;pointer-events:none}.tile.selected{background:#f9e6af;transform:translateY(-3px);box-shadow:0 0 0 2px #d6ad62}.tile.hinted{background:#cbe6c5;box-shadow:0 0 0 2px #c3d991}.tile.wrong{animation:shake .18s 2}#connection{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}#connection polyline{fill:none;stroke:#edc77d;stroke-width:.06;stroke-linecap:round;stroke-linejoin:round}.game-bottom{display:flex;align-items:center;gap:15px;margin-top:20px}.secondary{border:1px solid #cfd7c9;color:#305644;background:transparent;padding:10px 18px;border-radius:7px;font-size:12px}#message{font-size:11px;color:#7b8776}.caption{text-align:center;color:#8f9a88;font-size:11px;margin:26px 0 0}dialog{border:1px solid #dce1d5;border-radius:16px;background:#f7f6f0;color:#183f35;padding:32px;max-width:380px;width:calc(100% - 36px);text-align:center;box-shadow:0 24px 80px #0002}dialog::backdrop{background:#102e28a6;backdrop-filter:blur(5px)}dialog h2{font-family:serif;font-weight:500;font-size:27px}dialog p{font-size:13px;line-height:1.9;color:#73816d}dialog .primary{min-width:100%;margin:18px 0 0}.result-time{font-size:48px;font-variant-numeric:tabular-nums;margin:20px}.ad-slot{border:1px dashed #cfd6c8;margin-top:24px;min-height:70px;display:grid;place-content:center;color:#9aa38e;font-size:10px;letter-spacing:.1em}.setting{display:flex;justify-content:space-between;padding:16px 0;border-bottom:1px solid #dce1d5;font-size:14px}@keyframes shake{50%{transform:translateX(3px)}}@media(max-width:400px){header{padding:16px}main{padding:18px 10px}#board{gap:3px}.board-wrap{padding:14px}h1{font-size:34px}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
/* 136 tiles: wide desktop board and portrait mobile board. */
.tile{background-color:#f7f0db;background-image:linear-gradient(110deg,#ffffff5c,transparent 45%,#ad956a18);box-shadow:inset 1px 1px 2px #fff9,inset -1px -2px 2px #8c805333,0 2px 1px #102b2960;border-radius:5px;border-color:#e4dbc3;border-bottom-color:#91a783}
.tile svg{filter:drop-shadow(0 .5px .3px #0003);width:89%;height:89%}
.tile.selected{background-color:#f9e6af;background-blend-mode:multiply}.tile.hinted{background-color:#cbe6c5;background-blend-mode:multiply}
#board,.board-wrap,#connection{direction:ltr}#timer,.result-time{direction:ltr}.game-top{gap:16px}
@media(min-width:900px){body:has(#game:not([hidden])) main{max-width:1180px}.board-wrap{padding:28px}#board{gap:6px}.tile{aspect-ratio:.76}body:has(#game:not([hidden])) .caption{margin-top:18px}}
@media(max-width:899px){main{max-width:500px}#board{gap:3px}.board-wrap{padding:14px}.tile{aspect-ratio:.88}#game{padding-bottom:env(safe-area-inset-bottom)}}
.seo-copy{max-width:680px;margin:35px auto 0;border-top:1px solid #e0e3d8;padding:24px 12px;text-align:start;color:#73816d;font-size:12px;line-height:1.9}.seo-copy h2{font:500 18px serif;color:#254d3c}.language-links{display:flex;justify-content:center;flex-wrap:wrap;gap:14px;margin:16px auto;font-size:11px}.language-links a{color:#758275}body:has(#game:not([hidden])) .seo-copy,body:has(#game:not([hidden])) .language-links{display:none}
.tile{background-image:url('/assets/tile.webp');background-size:100% 100%;border:0;border-bottom:2px solid #56723b}.tile svg{padding:3px}.tile.selected{box-shadow:0 0 0 3px #e3b352,inset 0 0 0 100px #f4d78444}.tile.hinted{box-shadow:0 0 0 2px #c3d991,inset 0 0 0 100px #85c87755}
.consent{position:fixed;bottom:16px;left:16px;right:16px;z-index:20;max-width:600px;margin:auto;padding:16px;background:#fffdf3;border:1px solid #cbd4c1;border-radius:10px;box-shadow:0 8px 40px #0003;font-size:13px}.consent button{margin:4px}
/* Model renders: one 34-face atlas, no vector overlays or synthetic tile frame. */
.tile{aspect-ratio:202/300;background:none;border:0;border-radius:8%;box-shadow:none;overflow:visible;transition:transform .12s,filter .12s}
.tile-face,.hero-tiles .hero-model{display:block;background-image:url('/assets/mahjong-v3.webp');background-size:800% 500%;background-repeat:no-repeat}
.tile-face{width:100%;height:100%;pointer-events:none}
.tile.selected{background:none;box-shadow:0 0 0 2px #efc369;filter:brightness(1.08);transform:translateY(-3px)}
.tile.hinted{background:none;box-shadow:0 0 0 2px #b8e6a6;filter:brightness(1.08)}
.hero-tiles .hero-model{width:65px;height:96.53px;background-position:42.857142857% 50%;border:0;border-radius:0;box-shadow:none;padding:0}
.asset-credit{color:#94a08f;font-size:9px;letter-spacing:0;text-decoration:none}
footer{gap:14px;flex-wrap:wrap;align-items:center}
/* During play, fit the complete board and controls into the visible viewport. */
body:has(#game:not([hidden])){height:var(--visible-height,100dvh);min-height:0;overflow:hidden}
body:has(#game:not([hidden])) header{flex-shrink:0;padding:10px 16px}
body:has(#game:not([hidden])) main{margin:0 auto;padding:8px 8px 0;flex:1;min-height:0}
body:has(#game:not([hidden])) footer{display:none}
#game{height:100%;padding:0;display:flex;flex-direction:column;align-items:center}
.game-top{width:100%;flex-shrink:0;margin-bottom:6px}
.board-wrap{flex-shrink:0;margin:0 auto;border-radius:9px;max-width:100%}
.tile{aspect-ratio:auto;min-width:0;min-height:0;width:100%;height:100%}
.game-bottom{width:100%;flex-shrink:0;margin-top:6px;gap:10px}
body:has(#game:not([hidden])) .caption{display:none}
@media(max-width:899px){body:has(#game:not([hidden])) .brand{font-size:12px}.game-top #timer{font-size:21px}.game-top .eyebrow{font-size:9px}.game-top .icon-button{width:34px;height:34px}.game-bottom .secondary{padding:7px 14px}.game-bottom #message{font-size:10px}}
#restart{display:grid;place-items:center;flex-shrink:0}#restart svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:899px){body:has(#game:not([hidden])) header{display:none}body:has(#game:not([hidden])) main{padding-top:max(4px,env(safe-area-inset-top));padding-left:4px;padding-right:4px}.board-wrap{border-radius:4px}#board{gap:0}.tile{border-radius:3%}.game-top{gap:10px}}
/* Reference layout: uninterrupted green table, touching tiles and side controls. */
body:has(#game:not([hidden])){background-color:#12552c;background-image:radial-gradient(ellipse at 45% 35%,#28734160,transparent 75%);color:#fffde9}
body:has(#game:not([hidden])) header{display:none}
body:has(#game:not([hidden])) main{max-width:1440px;padding:max(6px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));height:100%;flex:none}
#game{justify-content:center;gap:0}.board-wrap{background:transparent;box-shadow:none;border-radius:0;margin:0}.tile{border-radius:0}.tile.selected{box-shadow:none;filter:brightness(.78) sepia(.25);transform:none}.tile.hinted{box-shadow:none;filter:brightness(1.2) sepia(.3)}
.game-top{max-width:500px}.game-top .eyebrow,.count{color:#d5e3cc}.icon-button,.game-bottom .secondary{color:#fffde9;border-color:#ffffff65}.game-bottom{max-width:500px}#message{color:#e3edcf}
@media(min-width:900px),(orientation:landscape){
 #game{display:grid;grid-template-columns:auto 100px;grid-template-rows:auto 1fr;column-gap:16px;align-content:center;justify-content:center;direction:ltr}
 .board-wrap{grid-column:1;grid-row:1/3;align-self:center}
 .game-top{grid-column:2;grid-row:1;display:flex;flex-direction:column;align-items:center;gap:16px;margin:0;padding:0;width:100%;align-self:start}
 #timer{font-size:29px!important}.game-top .eyebrow,.game-top .count{display:none}
 .game-top .icon-button{width:46px;height:46px;border:0;font-size:25px}.game-top #restart svg{width:40px;height:40px}
 .game-bottom{grid-column:2;grid-row:2;align-self:start;display:flex;flex-direction:column;margin-top:12px;width:100%}.game-bottom .secondary{padding:9px 4px;font-size:11px;max-width:100%;white-space:normal}
 #message{font-size:10px;text-align:center;line-height:1.5;overflow-wrap:anywhere}
}
@media(max-width:899px) and (orientation:landscape){#game{grid-template-columns:auto 72px;column-gap:12px}.game-top{gap:8px}#timer{font-size:23px!important}.game-top .icon-button{width:36px;height:36px}.game-top #restart svg{width:32px;height:32px}.game-bottom{margin-top:6px}}
/* Compact portrait controls leave the largest possible height for 17 rows. */
@media(max-width:899px) and (orientation:portrait){
 body:has(#game:not([hidden])) main{padding:max(2px,env(safe-area-inset-top)) max(2px,env(safe-area-inset-right)) max(2px,env(safe-area-inset-bottom)) max(2px,env(safe-area-inset-left))}
 #game{justify-content:flex-start}.game-top{height:30px;gap:8px;margin:0 0 2px}.game-top>div:first-child{margin-right:auto}.game-top .eyebrow{display:none}#timer{font-size:20px!important;margin:0;line-height:1}
 .game-top .icon-button{width:30px;height:30px}.game-top #restart svg{width:22px;height:22px}.game-bottom{height:28px;min-height:28px;margin:2px 0 0;gap:6px}.game-bottom .secondary{padding:3px 10px;line-height:20px}.game-bottom .count{margin-left:auto;white-space:nowrap;font-size:10px}.game-bottom .count strong{font-size:15px}.game-bottom #message{font-size:9px;min-width:0;overflow:hidden}
}
@media(min-width:900px),(orientation:landscape){.game-bottom .count{margin:8px 0 0;color:#d5e3cc;font-size:10px}.game-bottom .count strong{font-size:17px}}
/* Hint pairs stand out by outline, corner markers and surrounding contrast. */
#board:has(.hinted) .tile:not(.hinted){filter:brightness(.62)}
#board .tile.hinted{filter:none;box-shadow:none;z-index:2;isolation:isolate}
.tile.hinted::before{content:"";position:absolute;inset:1px;border:3px solid #ffe341;border-radius:3px;box-shadow:0 0 0 1px #332900,inset 0 0 0 1px #332900;pointer-events:none}
.tile.hinted::after{content:"";position:absolute;inset:1px;background:linear-gradient(#fff 0 0) top left/6px 2px no-repeat,linear-gradient(#fff 0 0) top left/2px 6px no-repeat,linear-gradient(#fff 0 0) bottom right/6px 2px no-repeat,linear-gradient(#fff 0 0) bottom right/2px 6px no-repeat;pointer-events:none}
#connection{overflow:visible;z-index:4;pointer-events:none}
#connection polyline{fill:none;stroke:#ffe079;stroke-width:3px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:2;vector-effect:non-scaling-stroke}
dialog{max-height:calc(100dvh - 24px);overflow-y:auto}dialog .result-time{margin:8px;font-size:38px}dialog h2{margin:8px 0}dialog h3{font-size:15px;margin:20px 0 4px}.ranking-note{font-size:11px!important;margin:0 0 8px}.ranking-list{padding:0;list-style:none;margin:0;text-align:start}.ranking-list li{display:grid;grid-template-columns:28px 1fr;gap:3px 8px;padding:7px;border-bottom:1px solid #dce1d5;font-size:12px}.ranking-list strong{font-variant-numeric:tabular-nums}.ranking-list small{grid-column:2;font-size:9px;color:#73816d}.current-record{background:#e5edd8;border-radius:4px}dialog:has(.ranking-list) .ad-slot{min-height:48px;margin-top:12px}
#game-settings{display:grid;place-items:center;flex-shrink:0}#game-settings svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linejoin:round}.settings-language{display:block;width:100%;margin:16px 0}.terms-copy{text-align:start}dialog:has(.settings-language) .text-button{display:block;width:100%;text-align:start;border-bottom:1px solid #dce1d5;padding:13px 0;font-size:14px}
@media(min-width:900px),(orientation:landscape){.game-bottom{height:100%;min-height:0;padding-bottom:6px;box-sizing:border-box}#game-settings{margin-top:auto;width:40px;height:40px;border:0}}
@media(max-width:899px) and (orientation:portrait){#game-settings{margin:0;width:28px;height:28px;border:0}#game-settings svg{width:21px;height:21px}}
/* Reset native button padding so iOS places both icons at the actual center. */
.game-top .icon-button{padding:0;margin:0;appearance:none;-webkit-appearance:none;display:flex;align-items:center;justify-content:center;line-height:1;flex-shrink:0}
.game-top .icon-button svg{display:block;flex-shrink:0;margin:0;padding:0}
#pause svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.operator-info{display:flex;flex-direction:column;gap:6px;padding:16px 0;text-align:start;font-size:12px;border-top:1px solid #dce1d5;margin-top:14px}.operator-info a{color:#2a5f47;overflow-wrap:anywhere}.guide-content{text-align:start}.guide-content h3{font-size:17px;font-weight:600;margin:26px 0 8px}.guide-content p{line-height:1.95;font-size:14px;color:#4d6457;margin:0}.guide-page-link{display:block;text-align:start;margin:14px 0;color:#2a5f47;font-size:13px}.guide-page main{width:100%;max-width:820px;padding:28px 22px;margin:0 auto}.guide-page h1{font-family:inherit;font-size:clamp(24px,4vw,34px);line-height:1.5;letter-spacing:0;font-weight:650}.guide-page .guide-description{font-size:15px;line-height:1.9;color:#4d6457}.guide-page .guide-content h3{font-size:20px;margin-top:32px}.guide-page .guide-content p{font-size:16px;line-height:2}.guide-play{display:inline-block;background:#183f35;color:#fff;text-decoration:none;border-radius:7px;padding:10px 16px;font-size:13px}.guide-page main>.guide-play{margin-top:30px}.guide-page .operator-info{margin-top:32px}.guide-page .operator-info h2{font-size:18px}
/* Keep the larger settings control directly beneath the remaining-tile count. */
.count-settings{display:flex;flex-direction:column;align-items:center;gap:6px;flex-shrink:0}
.count-settings #game-settings{width:44px;height:44px;margin:0;padding:0;display:grid;place-items:center;appearance:none;-webkit-appearance:none;border:1px solid #ffffff65;border-radius:50%;line-height:1}
.count-settings #game-settings svg{width:28px;height:28px;display:block;margin:0;padding:0;stroke-width:1.6}
.game-bottom .count-settings .count{margin:0;line-height:16px}
@media(min-width:900px),(orientation:landscape){.game-bottom .count-settings{margin-top:8px}.game-bottom #game-settings{margin-top:0}}
@media(max-width:899px) and (orientation:portrait){.game-bottom{height:68px;min-height:68px;align-items:center}.count-settings{margin-left:auto;gap:4px}.game-bottom .count-settings .count{font-size:10px}.game-bottom #message{flex:1}}
/* Brief wash: ivory-edged green tile backs move in a temporary overlay. */
.wash-layer{position:absolute;inset:0;z-index:6;pointer-events:none;overflow:visible;perspective:900px}.wash-tile{position:absolute;top:0;left:0;border:2px solid #eee9d8;border-bottom:3px solid #b9bba6;border-radius:7%;background:linear-gradient(135deg,#4a9976,#1c6249 55%,#2c7957);box-shadow:0 2px 3px #0005,inset 0 0 0 2px #ffffff26;will-change:transform}.ranking-date{grid-column:2;font-size:10px;color:#73816d}.result-summary .result-time{font-size:52px;margin:8px 0}.result-summary p{margin:6px 0}.result-details{margin-top:18px}.result-details summary{cursor:pointer;font-size:13px;color:#46624e}dialog:has(.result-summary) .primary{margin-top:12px}

/* Rule diagrams remain readable without JavaScript and fit narrow guide dialogs. */
.rule-examples{margin:24px 0;padding:20px 0;border-block:1px solid #dce1d5}.rule-examples-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:18px}.rule-figure{margin:0;padding:16px;border:1px solid #d8e1d5;border-radius:12px;background:#f0f3ea;min-width:0}.rule-figure h4{font-size:17px;line-height:1.5;margin:10px 0 0}.rule-verdict{display:inline-block;font-size:12px;font-weight:650;border-radius:20px;padding:4px 10px}.rule-verdict.valid{color:#155d45;background:#dceee2}.rule-verdict.invalid{color:#922d2d;background:#f6e0dc}.rule-diagram{display:block;width:100%;max-width:300px;height:auto;margin:8px auto;direction:ltr}.rule-figure p{font-size:14px!important;line-height:1.8!important}.rule-examples>p{margin-top:8px}dialog .rule-examples-grid{grid-template-columns:1fr}dialog .rule-figure{padding:12px}@media(max-width:600px){.rule-examples-grid{grid-template-columns:1fr}.rule-figure h4{font-size:17px}}
