@import url('./vendor/fonts/jua.css');
@import url('./vendor/fonts/noto-sans-kr.css');
:root{font-family:'Noto Sans KR',sans-serif;color:#243e39;background:#eaf5ef}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 15% 30%,#fff6d9aa,transparent 45%),radial-gradient(ellipse at 90% 65%,#cce9e6aa,transparent 45%);min-height:100dvh}button{font:inherit;cursor:pointer;border:0;color:inherit;touch-action:none}button:focus-visible{outline:3px solid #f2a237;outline-offset:3px}main{max-width:650px;margin:auto;padding:24px 24px 18px}header{display:flex;justify-content:space-between;align-items:center}.brand{font-size:17px;font-weight:900;letter-spacing:1px;color:#315c4e;text-decoration:none}.brand span{font-size:9px;display:block;letter-spacing:3.5px;margin-left:22px}#sound{background:#ffffff9c;border:1px solid #d1e3d8;border-radius:20px;padding:8px 13px;font-size:11px}.heading{text-align:center;margin:24px 0 22px}.heading p{font-size:11px;letter-spacing:3px;color:#64877a;margin:0 0 3px}h1{font-family:Jua,sans-serif;font-size:44px;letter-spacing:-2px;margin:0 0 5px}h1 span{font-size:17px;color:#f6ae56;margin-left:6px}.heading>div{font-size:12px;color:#799086}.game-shell{max-width:418px;margin:auto;background:#fffdf5;padding:16px;border-radius:24px;box-shadow:0 12px 0 #c6dbd0,0 22px 50px #355a4320;border:1px solid white}.stats{height:62px;display:flex;gap:32px;padding:0 5px}.stats>div{display:flex;flex-direction:column}.stats span,aside>span{font-size:9px;font-weight:900;letter-spacing:2px;color:#8b9c90}.stats strong{font-size:25px;line-height:1.4;font-variant-numeric:tabular-nums}#pause{margin-left:auto;align-self:flex-start;background:#eff3e9;border-radius:10px;width:36px;height:36px;font-weight:900}.play-area{position:relative;display:flex;gap:12px}#game{width:calc(100% - 74px);aspect-ratio:1/2;background:#203e38;border-radius:13px;overflow:hidden}#game canvas{display:block;width:100%!important;height:100%!important}aside{width:62px;text-align:center;padding-top:8px}#next{width:48px;height:81px;display:block;margin:8px auto 19px;background:#f1f3e9;border-radius:14px}.chain-badge{border-top:1px solid #e2e6d9;padding-top:17px;display:flex;flex-direction:column}.chain-badge strong{font-size:28px;color:#e79845}.chain-badge span{font-size:8px;letter-spacing:2px;color:#8b9c90}aside p{font-size:11px;line-height:1.8;color:#95a293;margin-top:25px}aside b{color:#597968}#restart{background:none;color:#698273;font-size:27px;margin-top:18px}button small{display:block;font-size:9px}#overlay{position:absolute;inset:0 74px 0 0;background:#1b3935ed;display:flex;align-items:center;justify-content:center;flex-direction:column;color:#fff7e4;border-radius:13px;text-align:center;padding:12px}.mini-faces{font-size:43px;letter-spacing:2px;color:#f1af68;text-shadow:0 5px #ca784e}#overlay-label{font-size:9px;letter-spacing:3px;color:#a9c8b4;margin-top:24px}h2{font-family:Jua,sans-serif;font-weight:400;font-size:28px;margin:4px 0}#overlay-desc{font-size:11px;line-height:1.9;color:#c5d8cb}#start{background:#f5c36e;padding:13px 21px;border-radius:12px;font-weight:700;margin:18px 0}#start span{margin-left:25px}#overlay-hint{font-size:8px;color:#9ab9a8;max-width:190px;line-height:1.8}.controls{display:flex;gap:7px;margin-top:15px}.controls button{height:47px;flex:1;border-radius:12px;background:#edf0e5;box-shadow:0 3px #dce1d2;font-size:17px}.controls .rotate{background:#d5e9db}.controls .drop{background:#f8dfad}.controls button:active{transform:translateY(2px);box-shadow:none}footer{display:flex;justify-content:center;gap:13px;flex-wrap:wrap;font-size:9px;color:#748d7e;margin:28px 0 0}.note{text-align:center;font-size:10px;color:#97a99b;margin-top:17px}@media(max-width:450px){main{padding:15px 16px}.heading{margin:17px 0}h1{font-size:36px}.game-shell{max-width:360px;padding:13px}.stats{height:55px}.stats strong{font-size:22px}footer{gap:8px;font-size:8px}.note{margin:12px 0 0}}@media(max-height:780px){main{max-width:550px}.heading{margin:12px 0}.heading h1{font-size:33px}.game-shell{max-width:340px}.stats{height:49px}footer{margin-top:20px}.note{display:none}}
/* A small garden arcade: original paper, stitch and botanical details. */
body{background:radial-gradient(circle at 18% 18%,#fff2c999,transparent 34%),radial-gradient(circle at 88% 65%,#b9dfd766,transparent 43%),radial-gradient(#567f6314 .8px,transparent .8px);background-size:auto,auto,19px 19px;background-color:#eaf5ef}
.game-shell{border:1px solid #ffffff;box-shadow:0 7px 0 #c6dbd0,0 20px 60px #355a4320;position:relative}
#game{box-shadow:inset 0 0 0 2px #152f29,0 0 0 4px #e5ece1}
.stats strong{letter-spacing:-1px}.stats>div:nth-child(2) strong{color:#718579}
#next{background:#eef2e6;border:1px solid #e0e6d8;box-shadow:inset 0 2px 4px #6473540a}
#overlay{background:linear-gradient(155deg,#203f39f5,#16332ff5);border:1px solid #8dab7d55;overflow:hidden}
#overlay::before{content:'';position:absolute;width:200px;height:200px;border-radius:50%;border:1px solid #ffffff09;top:14%;pointer-events:none}
.mini-faces{width:180px;height:auto;position:relative;filter:drop-shadow(0 7px 5px #071c1b20);animation:float 3.5s ease-in-out infinite}
#overlay-label{margin-top:8px}#start{box-shadow:0 4px 0 #b58344,0 8px 24px #0002;transition:transform .14s,filter .14s;z-index:1}#start:hover{filter:brightness(1.05);transform:translateY(-2px)}#start:active{transform:translateY(2px);box-shadow:0 2px 0 #b58344}
.controls{user-select:none;-webkit-user-select:none}.controls button{transition:background .12s,transform .08s;min-height:48px;border:1px solid #ffffffa0}.controls button:hover{filter:brightness(1.025)}.controls button.pressed{transform:translateY(3px);box-shadow:none;filter:brightness(.96)}
#pause,#sound,#restart{transition:transform .15s,background .15s}#pause:hover,#sound:hover{background:#dde9dc}#restart:hover{transform:rotate(-12deg)}
@keyframes float{0%,100%{transform:translateY(0) rotate(-2deg)}50%{transform:translateY(-6px) rotate(2deg)}}
@media(max-width:450px){.heading{margin:12px 0}.heading p{font-size:10px}.heading>div{font-size:11px}footer{margin-top:21px}}
@media(max-width:450px) and (max-height:760px){main{padding:10px 14px}.brand{font-size:14px}.heading{margin:8px 0}.heading h1{font-size:29px}.heading>div{display:none}.game-shell{max-width:min(340px,calc((100dvh - 222px) / 2 + 100px))}.stats{height:43px}.stats strong{font-size:20px}.stats span{font-size:8px}.controls{margin-top:11px}.controls button{min-height:44px;height:44px}aside p{margin-top:12px}#restart{margin-top:8px}.chain-badge{padding-top:9px}#next{margin-bottom:12px}footer{margin-top:17px}.note{display:none}}
@media(prefers-reduced-motion:reduce){.mini-faces{animation:none}button{transition:none!important}}
.preview-action{text-align:center;margin:23px auto 0}.preview-action button{background:#fffdf5;border:1px solid #c9ddce;border-radius:14px;padding:11px 20px;font-weight:700;font-size:12px;box-shadow:0 3px #d5e4d8}.preview-action span{display:block;font-size:9px;color:#7d9684;font-weight:400;margin-top:3px}.effects-dialog{width:min(380px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:1px solid #fff;background:#fffdf5;color:#243e39;border-radius:22px;padding:18px;box-shadow:0 22px 100px #102a3960}.effects-dialog::backdrop{background:#142d2bd9;backdrop-filter:blur(5px)}.demo-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}.demo-heading small{font-size:8px;letter-spacing:2px;color:#809482}.demo-heading h2{font-size:23px;margin-top:4px}.demo-close{background:#edf0e5;border-radius:50%;width:32px;height:32px;flex-shrink:0}.demo-description{font-size:10px;color:#829385;margin:8px 0 12px}.demo-canvas{width:min(264px,calc((100dvh - 260px) / 2));min-width:150px;aspect-ratio:1/2;margin:auto;border-radius:12px;overflow:hidden;box-shadow:0 0 0 3px #e0e8dc}.demo-canvas canvas{display:block;width:100%!important;height:100%!important}.demo-steps{display:flex;justify-content:center;gap:11px;margin:16px 0}.demo-steps span{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;font-size:11px;font-weight:700;background:#e9eee2;color:#8a9a8e;transition:transform .2s,background .2s}.demo-steps .active{background:#f4c776;color:#493e29;transform:scale(1.2);box-shadow:0 0 0 4px #f4c77630}.demo-steps .done{background:#cee3d4;color:#537260}.demo-actions{display:flex;gap:8px}.demo-actions button{border-radius:11px;padding:12px 8px;font-size:11px;flex:1;background:#e8eee1}.demo-actions .demo-return{background:#f4dba7}@media(prefers-reduced-motion:reduce){.demo-steps span{transition:none}}
/* Keep the game inside camera cutouts and Android gesture navigation areas. */
body{padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px);overscroll-behavior-y:none}
.effects-dialog{max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 24px)}
.header-actions{display:flex;align-items:center;gap:6px;max-width:68%}#language{font:inherit;font-size:10px;max-width:110px;min-width:70px;width:26vw;padding:8px 5px;border:1px solid #d1e3d8;border-radius:16px;background:#fffdf5;color:#315c4e;text-overflow:ellipsis}#sound{font-size:10px;white-space:nowrap;padding:8px 10px}#game-title{font-size:inherit;letter-spacing:inherit;color:inherit;margin:0}.title-dot{font-size:17px;color:#f6ae56;margin-left:6px}h1{font-size:clamp(29px,7vw,44px)}.play-area,.controls,.stats,.demo-canvas,.demo-steps{direction:ltr}.controls button{min-width:0}.controls small,#restart small{overflow-wrap:anywhere;line-height:1.2;hyphens:auto}aside p{overflow-wrap:anywhere}#overlay-desc{white-space:pre-line}#overlay-title{font-size:clamp(20px,5vw,28px);max-width:100%;line-height:1.3;overflow-wrap:anywhere}#start{max-width:100%;overflow-wrap:anywhere}.stats>div{min-width:0}.stats span{letter-spacing:1px}#overlay-label{letter-spacing:1px}footer span{max-width:160px}.preview-action b{font-weight:700}.demo-heading>div{min-width:0}.demo-heading h2{font-size:21px;line-height:1.3;overflow-wrap:anywhere}.demo-description{line-height:1.6}.demo-heading small{letter-spacing:1px}.demo-actions button{overflow-wrap:anywhere}html:not([lang="ko"]) h1{font-family:'Noto Sans KR',system-ui,sans-serif;font-size:clamp(25px,6vw,38px);font-weight:900;letter-spacing:-1px}html[dir="rtl"] #overlay-label{letter-spacing:0}html[dir="rtl"] .demo-heading{text-align:right}@media(max-width:380px){.brand{font-size:13px}#language{max-width:85px}#sound{font-size:9px;padding:8px}.header-actions{max-width:65%}.controls small{font-size:8px}}
html:not([lang="ko"]){font-family:system-ui,-apple-system,'Segoe UI',sans-serif}html:not([lang="ko"]) h1{font-family:system-ui,-apple-system,'Segoe UI',sans-serif}#language{font-family:system-ui,sans-serif}#matchHint{line-height:1.6}#effects-preview{max-width:100%;white-space:normal}

.preview-action{display:flex;justify-content:center;flex-wrap:wrap;gap:10px}.speed-picker{display:flex;align-items:center;justify-content:center;gap:12px;font-size:13px}.speed-picker select{font:inherit;border:1px solid #c9ddce;background:#edf3e9;border-radius:10px;padding:8px 16px;color:#243e39}.speed-readout{text-align:center;font-size:15px;font-weight:700;margin:12px 0}.speed-readout+.demo-canvas{margin-bottom:16px}

.stats{gap:clamp(10px,3vw,24px)}.stats .play-clock{margin-left:auto;align-items:flex-end;white-space:nowrap}.stats .play-clock span{font-size:8px;letter-spacing:.5px}.stats .play-clock strong{font-size:19px;letter-spacing:0;line-height:1.8;direction:ltr}#pause{margin-left:0;flex-shrink:0}@media(max-width:380px){.stats{gap:10px}.stats strong{font-size:19px}.stats .play-clock strong{font-size:17px}}

.rule-picker{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 3px 14px;font-size:9px;color:#718579}.rule-picker select{font:inherit;font-size:12px;color:#315c4e;background:#eff3e9;border:1px solid #d1e3d8;border-radius:10px;padding:8px;max-width:56%}

/* Player entry: only gameplay and player settings. */
.player-view .preview-action,.player-view .note{display:none}.player-view main{padding-bottom:28px}.player-view footer{margin-top:23px}.player-view .heading{margin-top:18px}.player-view .rule-picker{margin-bottom:12px}

/* Native app: safe-area spacing, compact header and large touch controls. */
:is(.app-view,.web-view){overscroll-behavior:none;-webkit-tap-highlight-color:transparent}
:is(.app-view,.web-view) main{width:100%;max-width:440px;min-height:100dvh;padding:calc(8px + env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) calc(14px + env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px))}
:is(.app-view,.web-view) header{justify-content:flex-end;min-height:32px}:is(.app-view,.web-view) .brand{display:none}:is(.app-view,.web-view) .header-actions{max-width:100%}:is(.app-view,.web-view) .heading{margin:5px 0 12px}:is(.app-view,.web-view) .heading h1{font-size:28px}:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 285px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 98px));min-width:265px;max-width:100%;padding:10px;border-radius:20px}:is(.app-view,.web-view) .rule-picker{margin-bottom:9px}:is(.app-view,.web-view) .rule-picker>span{max-width:44%;line-height:1.5}:is(.app-view,.web-view) .stats{height:46px;gap:10px;padding:0 2px}:is(.app-view,.web-view) .stats strong{font-size:20px}:is(.app-view,.web-view) .stats .play-clock strong{font-size:17px}:is(.app-view,.web-view) .controls{gap:6px;margin-top:12px}:is(.app-view,.web-view) .controls button{height:56px;font-size:21px}:is(.app-view,.web-view) .controls small{font-size:9px}:is(.app-view,.web-view) footer,:is(.app-view,.web-view) #overlay-hint{display:none}:is(.app-view,.web-view) #overlay{padding:10px}:is(.app-view,.web-view) #overlay-title{font-size:23px}:is(.app-view,.web-view) #start{margin:12px 0}:is(.app-view,.web-view) #overlay-label{margin-top:12px}:is(.app-view,.web-view) .mini-faces{max-width:80%;height:auto}:is(.app-view,.web-view) #overlay-desc{font-size:10px}

/* App play space: settings live in a modal, no permanent side rail. */
:is(.app-view,.web-view) main{max-width:600px;padding-top:calc(10px + env(safe-area-inset-top,0px));padding-left:max(10px,env(safe-area-inset-left,0px));padding-right:max(10px,env(safe-area-inset-right,0px))}
:is(.app-view,.web-view) header,:is(.app-view,.web-view) .heading{display:none}
:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 205px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px));min-width:260px;margin:0 auto;padding:10px}
:is(.app-view,.web-view) .stats{height:48px;align-items:flex-start}:is(.app-view,.web-view) #app-settings{width:36px;height:36px;border-radius:10px;background:#eff3e9;font-size:23px;flex-shrink:0}
:is(.app-view,.web-view) .app-hud{width:100%;height:50px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 3px;margin:0 0 10px;text-align:left}:is(.app-view,.web-view) .app-hud>span{font-size:9px}:is(.app-view,.web-view) #next{width:27px;height:46px;margin:0 auto 0 0;border-radius:8px}:is(.app-view,.web-view) .chain-badge{border:0;padding:0;flex-direction:row;align-items:center;gap:7px}:is(.app-view,.web-view) .chain-badge strong{font-size:25px}:is(.app-view,.web-view) .app-hud p{display:none}
:is(.app-view,.web-view) #game{width:100%}:is(.app-view,.web-view) #overlay{inset:0}:is(.app-view,.web-view) .play-area{display:block}:is(.app-view,.web-view) .controls button{height:54px}
.app-settings-dialog .settings-content{display:flex;flex-direction:column;gap:22px;padding:20px 0}.app-settings-dialog .rule-picker{display:flex;font-size:11px;margin:0}.app-settings-dialog .header-actions{display:flex;max-width:100%;justify-content:space-between}.app-settings-dialog #language{width:65%;max-width:none;font-size:13px}.app-settings-dialog #sound{font-size:12px}.app-settings-dialog #restart{margin:0;background:#edf0e5;border-radius:12px;padding:12px;font-size:23px}.app-settings-dialog #restart small{font-size:12px}.settings-done{width:100%;padding:13px;border-radius:12px;background:#f5d49a;font-size:14px;font-weight:700}

/* App HUD: readable scores, centered next pair, larger controls. */
:is(.app-view,.web-view) .stats{height:66px;gap:12px;align-items:flex-start;padding:2px 3px}
:is(.app-view,.web-view) .stats span{font-size:11px;letter-spacing:.3px}:is(.app-view,.web-view) .stats strong{font-size:28px;line-height:1.35}:is(.app-view,.web-view) .stats .play-clock span{font-size:10px}:is(.app-view,.web-view) .stats .play-clock strong{font-size:24px;line-height:1.5}
:is(.app-view,.web-view) #pause,:is(.app-view,.web-view) #app-settings{width:46px;height:46px;border-radius:13px;font-size:25px}
:is(.app-view,.web-view) .app-hud{height:91px;justify-content:center;gap:13px;margin-bottom:12px;padding:0}:is(.app-view,.web-view) .app-hud>span{font-size:13px;letter-spacing:1px}:is(.app-view,.web-view) #next{width:46px;height:78px;margin:0;border-radius:12px}:is(.app-view,.web-view) .app-hud .chain-badge{display:none}
:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 265px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px))}
@media(max-width:380px){:is(.app-view,.web-view) .stats{gap:8px}:is(.app-view,.web-view) .stats strong{font-size:24px}:is(.app-view,.web-view) .stats span{font-size:9px}:is(.app-view,.web-view) .stats .play-clock strong{font-size:21px}:is(.app-view,.web-view) #pause,:is(.app-view,.web-view) #app-settings{width:42px;height:44px;font-size:23px}}

/* One unified top bar: scores | next pair | time and actions. */
:is(.app-view,.web-view) .stats{height:94px;align-items:center;gap:12px;position:relative;padding:0 3px 8px}
:is(.app-view,.web-view) .stats .app-hud{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:7px;height:80px;width:auto;flex:1;min-width:50px;margin:0;padding:0}
:is(.app-view,.web-view) .stats .app-hud>span{font-size:11px}:is(.app-view,.web-view) .stats #next{width:42px;height:71px;margin:0;flex-shrink:0}:is(.app-view,.web-view) .stats .play-clock{margin-left:0}:is(.app-view,.web-view) .stats>div:not(.play-clock){flex-shrink:0}
:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 200px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px))}
@media(max-width:450px){:is(.app-view,.web-view) .stats{gap:7px}:is(.app-view,.web-view) .stats strong{font-size:23px}:is(.app-view,.web-view) .stats span{font-size:9px}:is(.app-view,.web-view) .stats .play-clock strong{font-size:20px}:is(.app-view,.web-view) .stats .play-clock span{font-size:8px}:is(.app-view,.web-view) .stats .app-hud{flex-direction:column;gap:1px}:is(.app-view,.web-view) .stats .app-hud>span{font-size:9px}:is(.app-view,.web-view) .stats #next{width:34px;height:57px}:is(.app-view,.web-view) #pause,:is(.app-view,.web-view) #app-settings{width:38px;height:44px;font-size:22px}}
:is(.app-view,.web-view) #pause,:is(.app-view,.web-view) #app-settings{align-self:center}

.one-hand-controls{display:none}:is(.app-view,.web-view) .controls{display:none}:is(.app-view,.web-view) .one-hand-controls{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:12px;margin-top:14px;direction:ltr;touch-action:none;user-select:none}:is(.app-view,.web-view) .one-hand-controls.left-handed{grid-template-columns:minmax(0,1fr) minmax(0,1.6fr)}.left-handed .thumb-pad{order:2}.left-handed .thumb-actions{order:1}.thumb-pad{position:relative;display:flex;min-height:112px;background:#e5eee2;border:1px solid #d0dfd0;border-radius:20px;box-shadow:0 4px #cbdcc9;overflow:hidden;touch-action:none}.thumb-pad button{flex:1;background:transparent;font-size:30px;padding-bottom:20px;min-width:0}.thumb-pad button+span+button{border-left:1px solid #cadac8}.pad-hint{position:absolute;bottom:12px;left:6px;right:6px;text-align:center;font-size:9px;color:#6d8978;pointer-events:none}.thumb-actions{display:grid;grid-template-columns:1fr;gap:12px}.thumb-actions button{border-radius:16px;min-height:50px;font-size:25px;box-shadow:0 4px #bfd8c8;background:#d5e9db;touch-action:none}.thumb-actions .thumb-drop{background:#f8dfad;box-shadow:0 4px #e5c98f}.thumb-actions small{font-size:10px}.one-hand-controls .pressed{filter:brightness(.94);transform:translateY(2px)}.hand-setting{display:flex;justify-content:space-between;align-items:center;font-size:12px;gap:12px}.hand-setting select{font:inherit;border:1px solid #c9ddce;border-radius:10px;padding:9px;background:#edf3e9;color:#315c4e}:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 265px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px))}

.mini-faces{width:198px;height:80px}:is(.app-view,.web-view) .mini-faces{width:198px;height:auto}#game canvas{image-rendering:auto}

.feedback-open{padding:14px;border-radius:12px;background:#e5eee2;font-size:14px;font-weight:700}.feedback-dialog textarea{display:block;width:100%;margin-top:10px;font:inherit;font-size:14px;padding:12px;color:#243e39;background:white;border:1px solid #c9ddce;border-radius:12px;resize:vertical;min-height:140px}.feedback-dialog label{font-size:13px}.feedback-status{font-size:12px;line-height:1.6;min-height:24px}.feedback-dialog button:disabled{opacity:.6;cursor:wait}
/* Circular virtual joystick, with a neutral center and spring return. */
:is(.app-view,.web-view) .one-hand-controls{align-items:center;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);min-height:148px}.joystick-area{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:7px;touch-action:none}.joystick{position:relative;width:126px;height:126px;border-radius:50%;background:radial-gradient(circle at 45% 38%,#f4f8ef 0 25%,#e4eddf 62%,#d3e1cf);border:2px solid #cadbc8;box-shadow:inset 0 3px 9px #55764c13,0 4px 0 #bfd1bc;touch-action:none}.joystick button{position:absolute;background:transparent;font-size:29px;color:#6f8c76;line-height:1;padding:0;width:34px;height:34px}.stick-left{left:3px;top:44px}.stick-right{right:3px;top:44px}.stick-down{bottom:0;left:44px}.stick-knob{position:absolute;pointer-events:none;width:58px;height:58px;left:32px;top:32px;border-radius:50%;background:radial-gradient(circle at 35% 25%,#fffdf5,#d9e9d5 65%,#b9d3b9);border:1px solid #abc8ad;box-shadow:0 5px 10px #355a4330,inset 0 2px 0 #ffffffc0;transition:transform .12s ease-out;will-change:transform}.joystick.dragging .stick-knob{transition:none}.joystick[data-direction] .stick-knob{border-color:#79a789;background:radial-gradient(circle at 35% 25%,#effbf0,#b7dac0)}.stick-hint{font-size:9px;text-align:center;color:#6d8978}.one-hand-controls.left-handed .joystick-area{order:2}.one-hand-controls .thumb-actions{width:100%;gap:16px}.one-hand-controls .thumb-actions button{min-height:58px}:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 300px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px))}
:is(.app-view,.web-view) .game-shell{container-type:inline-size}
@container (max-width:360px){:is(.app-view,.web-view) .stats{gap:4px;padding-left:0;padding-right:0}:is(.app-view,.web-view) .stats strong{font-size:17px;letter-spacing:-.6px}:is(.app-view,.web-view) .stats span,:is(.app-view,.web-view) .stats .play-clock span{font-size:7px;letter-spacing:0}:is(.app-view,.web-view) .stats .play-clock strong{font-size:17px}:is(.app-view,.web-view) .stats .app-hud{min-width:30px;flex-direction:column;gap:0}:is(.app-view,.web-view) .stats .app-hud>span{font-size:8px}:is(.app-view,.web-view) .stats #next{width:28px;height:47px}:is(.app-view,.web-view) #pause,:is(.app-view,.web-view) #app-settings{width:30px;height:38px;font-size:20px}}

.joystick .stick-up{top:0;left:44px;font-size:21px}.one-hand-controls .thumb-actions{display:flex;align-items:center}.one-hand-controls .thumb-rotate{width:100%;min-height:80px;border-radius:24px;font-size:32px}.one-hand-controls .thumb-rotate small{font-size:12px}

.update-status{font-size:11px;line-height:1.6;margin:-12px 0 0;color:#6d8978}.update-notes{white-space:pre-wrap;font-size:13px;line-height:1.7;overflow-wrap:anywhere}.update-version{font-size:15px;font-weight:700}.update-download{display:flex;align-items:center;justify-content:center;flex:1;border-radius:11px;padding:12px 8px;font-size:12px;font-weight:700;background:#f4dba7;color:#243e39;text-decoration:none}
/* Single gesture surface, reachable from either hand. */
:is(.app-view,.web-view) .one-hand-controls.gesture-controls{display:block;min-height:132px;margin-top:14px}.gesture-pad{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;width:100%;height:132px;overflow:hidden;touch-action:none;user-select:none;background:linear-gradient(145deg,#eef5e8,#d9e9db);border:1px solid #bfd5c2;border-radius:24px;box-shadow:0 4px #bfd1bc;color:#315c4e}.gesture-arrows{font-size:30px;line-height:1;display:flex;align-items:center;justify-content:center;gap:30px;color:#6d937b}.gesture-arrows b{font-size:25px;font-weight:400}.gesture-pad strong{font-size:13px;pointer-events:none}.gesture-pad small{font-size:10px;color:#6d8978;pointer-events:none}.gesture-touch{position:absolute;width:44px;height:44px;margin:-22px 0 0 -22px;border:2px solid #81b597;background:#a1d4b43d;border-radius:50%;pointer-events:none;opacity:0}.gesture-pad.dragging .gesture-touch{opacity:1}.gesture-pad.dragging{background:linear-gradient(145deg,#e4f1df,#cee3d2)}:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 280px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px))}
.six-cell-pad{padding:0;justify-content:flex-end;gap:5px;padding-bottom:12px}.pad-cells{position:absolute;inset:0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));pointer-events:none}.pad-cells>span{border-right:1px solid #bdd4c2;display:flex;justify-content:center;padding-top:21px;color:#6e927a;font-size:19px;font-variant-numeric:tabular-nums}.pad-cells>span:last-child{border-right:0}.pad-cells>span.active{background:#a9cdbb55;color:#285e43}.six-cell-pad strong,.six-cell-pad small{position:relative;z-index:1;max-width:96%;background:#e1eddfdf;padding:2px 6px;border-radius:5px}.six-cell-pad strong{font-size:11px}.six-cell-pad small{font-size:9px}
/* Directional keypad: rotation, repeat movement and soft drop. */
:is(.app-view,.web-view) .one-hand-controls.keypad-controls{display:flex;justify-content:center;align-items:center;margin-top:14px;min-height:180px;direction:ltr}.direction-keypad{display:grid;grid-template-columns:repeat(3,minmax(58px,76px));grid-template-rows:repeat(3,54px);gap:7px;touch-action:none;user-select:none}.direction-keypad button{background:#e3eee0;border:1px solid #c5d9c4;border-radius:15px;box-shadow:0 3px #bdd1bc;font-size:24px;touch-action:none}.direction-keypad .key-up{grid-column:2;grid-row:1;background:#d5e9db}.key-left{grid-column:1;grid-row:2}.key-right{grid-column:3;grid-row:2}.key-down{grid-column:2;grid-row:3}.key-center{grid-column:2;grid-row:2;display:grid;place-items:center;color:#99b49b;font-size:22px}.direction-keypad small{font-size:9px;line-height:1.2}.direction-keypad .pressed{transform:translateY(2px);box-shadow:0 1px #bdd1bc;background:#c7dfcd}:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - 325px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px))}

/* Compact one-thumb keypad, configurable alignment and size. */
:is(.app-view,.web-view) .one-hand-controls.keypad-controls{min-height:0;padding:0 3px 3px;justify-content:flex-end}.keypad-controls[data-position="left"]{justify-content:flex-start!important}.keypad-controls[data-position="center"]{justify-content:center!important}.keypad-controls .direction-keypad{grid-template-columns:repeat(3,var(--key-size,44px));grid-template-rows:repeat(3,var(--key-size,44px));gap:6px}.keypad-controls .direction-keypad button{font-size:calc(var(--key-size,44px) * .43);border-radius:12px}.keypad-controls .direction-keypad small{font-size:8px}.keypad-controls .key-center{font-size:18px}.keypad-preferences{display:flex;flex-direction:column;gap:16px;padding-bottom:4px}:is(.app-view,.web-view) .game-shell{width:min(100%,calc((100dvh - var(--keypad-reserve,304px) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) / 2 + 20px))}

/* App viewport owns the layout; the keypad always stays above system navigation. */
html:has(body:is(.app-view,.web-view)){height:100%;overflow:hidden}:is(.app-view,.web-view){height:100dvh;min-height:0;overflow:hidden}:is(.app-view,.web-view) main{height:100dvh;min-height:0;width:100%;max-width:none;margin:0;padding:calc(6px + env(safe-area-inset-top,0px)) max(6px,env(safe-area-inset-right,0px)) calc(22px + env(safe-area-inset-bottom,0px)) max(6px,env(safe-area-inset-left,0px));display:flex;flex-direction:column}
:is(.app-view,.web-view) .game-shell{display:flex;flex-direction:column;width:100%;max-width:600px;min-width:0;height:100%;min-height:0;margin:0 auto;padding:8px;border-radius:18px;box-shadow:none;container-type:inline-size;overflow:hidden}:is(.app-view,.web-view) .stats{height:76px;min-height:76px;flex:0 0 76px;padding-bottom:6px}:is(.app-view,.web-view) .stats .app-hud{height:68px}:is(.app-view,.web-view) .play-area{flex:1;min-height:0;width:100%;display:flex}:is(.app-view,.web-view) #game{width:100%;height:100%;min-height:0;aspect-ratio:auto}:is(.app-view,.web-view) #game canvas{width:100%!important;height:100%!important}:is(.app-view,.web-view) #overlay{inset:0}:is(.app-view,.web-view) .one-hand-controls.keypad-controls{flex:0 0 auto;margin-top:10px;padding-bottom:6px}:is(.app-view,.web-view) .direction-keypad{max-width:100%}
@media(max-height:650px){:is(.app-view,.web-view) .stats{height:62px;min-height:62px;flex-basis:62px}:is(.app-view,.web-view) .stats .app-hud{height:56px}:is(.app-view,.web-view) .stats #next{width:28px;height:47px}:is(.app-view,.web-view) .keypad-controls .direction-keypad{grid-template-rows:repeat(3,min(var(--key-size,44px),44px))}:is(.app-view,.web-view) #overlay-label{margin-top:4px}:is(.app-view,.web-view) #overlay-desc{margin:6px 0}:is(.app-view,.web-view) #start{margin:8px 0}}

/* Preserve square cells: fit the 6x12 board without stretching either axis. */
:is(.app-view,.web-view) .play-area{container-type:size;position:relative;display:flex;align-items:center;justify-content:center}
:is(.app-view,.web-view) #game{flex:none;width:min(100cqw,50cqh);height:min(100cqh,200cqw);aspect-ratio:1 / 2;margin:auto}
:is(.app-view,.web-view) #overlay{inset:auto;left:50%;top:50%;transform:translate(-50%,-50%);width:min(100cqw,50cqh);height:min(100cqh,200cqw)}

/* The web shares the player shell, while retaining its original five controls. */
.web-view .controls{display:flex;flex:0 0 auto;margin-top:12px;padding-bottom:5px}.web-view .controls button{height:48px}.web-view #overlay-hint{display:block}.web-view .one-hand-controls{display:none}.web-view main{padding-bottom:12px}.web-view .game-shell{max-width:600px}.web-view .controls .drop{background:#f8dfad}
/* App: put the next pair at the right end of the top bar. */
:is(.app-view,.web-view) .stats .play-clock{order:3;margin-left:auto}:is(.app-view,.web-view) .stats #pause{order:4}:is(.app-view,.web-view) .stats #app-settings{order:5}:is(.app-view,.web-view) .stats .app-hud{order:6;flex:0 0 auto;width:60px;min-width:0;flex-direction:column;gap:1px}:is(.app-view,.web-view) .stats .app-hud>span{font-size:9px}:is(.app-view,.web-view) .stats #next{width:30px;height:51px}
@container(max-width:360px){:is(.app-view,.web-view) .stats .app-hud{width:34px}:is(.app-view,.web-view) .stats #next{width:26px;height:44px}:is(.app-view,.web-view) .stats .app-hud>span{font-size:8px}}

/* App next pair sits beside the board, halfway down its right edge. */
:is(.app-view,.web-view) .game-shell{position:relative;--next-rail:48px;--keypad-height:150px}:is(.app-view,.web-view) .play-area{width:calc(100% - var(--next-rail));align-self:center;margin-right:var(--next-rail)}
:is(.app-view,.web-view) .side-next{position:absolute;right:6px;top:calc(76px + (100% - 76px - var(--keypad-height) - 30px) / 2);transform:translateY(-50%);width:42px;height:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;margin:0;padding:0;z-index:4}
:is(.app-view,.web-view) .side-next>span{font-size:10px;letter-spacing:.5px}:is(.app-view,.web-view) .side-next #next{width:38px;height:64px;margin:0;border-radius:10px}:is(.app-view,.web-view) .side-next .chain-badge,:is(.app-view,.web-view) .side-next p{display:none}
@media(max-height:650px){:is(.app-view,.web-view) .side-next{top:calc(62px + (100% - 62px - var(--keypad-height) - 30px) / 2)}}
/* Keep the board geometry unchanged; only float the next preview in the gutter. */
:is(.app-view,.web-view) .play-area{width:100%;align-self:stretch;margin-right:0}
:is(.app-view,.web-view) .side-next{right:0;width:40px}
:is(.app-view,.web-view) .side-next #next{width:30px;height:51px}

/* Enlarge the next pair only within the actual unused right gutter. */
:is(.app-view,.web-view) .side-next #next{width:var(--next-preview-width,48px);height:auto;aspect-ratio:64 / 108;max-width:100%;margin:0;border-radius:12px}:is(.app-view,.web-view) .side-next>span{font-size:11px}:is(.app-view,.web-view) .side-next{gap:9px}
#game-results[hidden]{display:none}#game-results{width:100%;max-width:270px;margin:8px 0 0}.result-metrics{display:grid;grid-template-columns:1fr 1fr;gap:8px}.result-metrics>div{display:flex;flex-direction:column;align-items:center;gap:4px;padding:9px 5px;background:#ffffff0c;border:1px solid #b9d4bf25;border-radius:12px}.result-metrics>div:first-child{grid-column:1 / -1}.result-metrics span{font-size:10px;color:#b7cebc}.result-metrics strong{font-size:19px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.result-metrics>div:first-child strong{font-size:30px;color:#ffdc93}.share-result{width:100%;margin-top:10px;padding:11px;border-radius:12px;background:#d5e9db;font-weight:700;color:#24473a;font-size:13px}.share-result:disabled{opacity:.6}.share-status{font-size:10px;line-height:1.5;margin:6px 0}.share-status:empty{display:none}.share-fallback{width:100%;height:100px;font-size:11px}.show-results #overlay-desc{display:none}.show-results .mini-faces{max-width:150px;height:auto}.show-results #overlay-label{margin:8px 0 0}.show-results #overlay-title{font-size:23px}.show-results #start{margin:10px 0 0}@media(max-height:700px){.show-results .mini-faces,.show-results #overlay-label,.show-results #overlay-hint{display:none!important}.result-metrics>div{padding:5px}.result-metrics strong{font-size:16px}.result-metrics>div:first-child strong{font-size:24px}.show-results #start{padding:8px 16px}.share-result{padding:8px}}



/* Web uses the same portrait viewport and board space as the app. */
.web-view main{max-width:612px;margin:0 auto;padding-bottom:calc(22px + env(safe-area-inset-bottom,0px))}.web-view .game-shell{overflow:hidden}.web-view .controls{min-height:150px;align-items:flex-end;flex-shrink:0;margin-top:10px;padding-bottom:6px}.web-view .controls button{flex:1;height:48px}.web-view .side-next{padding:0;gap:9px}.web-view .side-next>span{font-size:11px}
.web-view .controls{position:relative}.web-view .keyboard-guide{position:absolute;top:14px;left:0;right:0;padding:4px 8px;text-align:center;white-space:pre-line;color:#668377;font-size:13px;font-weight:600;line-height:2;pointer-events:none}.app-view .keyboard-guide{display:none}@media(max-width:450px){.web-view .keyboard-guide{font-size:11px}}
