*{box-sizing:border-box} :root{font-family:"Hiragino Maru Gothic ProN","Yu Gothic",Meiryo,sans-serif;color:#582a10;background:#f3e5cd;font-synthesis:none} body{margin:0;min-height:100svh;display:grid;place-items:center;background:radial-gradient(ellipse at 50% 35%,#fffcf5,#ecd9b6)}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}button:disabled{cursor:wait;opacity:.65}button:focus-visible,a:focus-visible{outline:3px solid #489acb;outline-offset:5px}button:active:not(:disabled){transform:translateY(2px)}[hidden]{display:none!important}.app{width:min(100%,460px);min-height:min(100svh,900px);background:#fff8e9 url("assets/background-cream.png") center/cover;position:relative;padding:20px 24px 12px;box-shadow:0 15px 90px #80501920;border-inline:1px solid #e6d5b860;overflow:hidden}.topline{display:flex;justify-content:space-between;align-items:center;gap:8px}.brand{color:#603317;text-decoration:none;font-size:20px;font-weight:900;letter-spacing:.07em}.brand span{display:block;font-size:9px;font-weight:500;letter-spacing:.12em;margin-top:2px;color:#9a785c}.icon-button{width:42px;height:42px;border:1px solid #dac7a1;background:#fffaf1aa;border-radius:50%;font-weight:800;display:flex;align-items:center;justify-content:center;gap:1px;font-size:21px;flex:none}.icon-button span{font-size:9px}.title-screen{text-align:center;padding-top:10px}.logo{margin:0 auto;width:min(80%,290px);line-height:0}.logo svg{width:100%;height:auto;aspect-ratio:1184/818}.tagline{font-size:17px;letter-spacing:.035em;font-weight:800;margin:10px 0 0}.hero-tower{margin:16px auto 18px;position:relative;width:93%;max-width:350px}.hero-tower svg{display:block;width:100%;aspect-ratio:1325/1010}.hero-note{display:block;position:absolute;bottom:-5px;right:-5px;border:1px solid #ecc4b4;border-radius:30px;padding:6px 12px;background:#fff8ed;box-shadow:0 3px 8px #7139130c;font-size:11px;transform:rotate(-4deg);color:#aa5c54}.best-pill{display:flex;align-items:baseline;justify-content:center;gap:9px;margin:14px auto 14px;border:2px solid #9acde9;border-radius:30px;background:#ffffffb8;width:230px;padding:6px 16px;font-size:13px;font-weight:800}.best-pill strong{font-size:29px;line-height:1.1;border-left:1px solid #bddced;padding-left:13px}.button{border-radius:26px;font-weight:900;min-height:48px;width:100%;padding:11px 20px;border:2px solid #794219;background:#fff9ed;box-shadow:0 3px 0 #b79a7233;transition:transform .1s,filter .1s}.primary{background:linear-gradient(#ffe784,#ffc129);border-color:#d38a10;box-shadow:inset 0 3px 0 #fff4bb,0 5px 0 #cc8e23,0 7px 14px #b87a1520;font-size:25px;padding:13px 12px;letter-spacing:.08em}.primary:hover{filter:brightness(1.035)}.secondary{background:#fffdf6b8;font-size:15px}.start-button{font-size:31px;min-height:68px}.title-screen>.secondary{width:65%;margin-top:17px}.fineprint{font-size:11px;color:#9a795d;margin:14px 0 0}.error{font-size:13px;color:#a33430}.error button{border:0;background:transparent;text-decoration:underline}.play-heading{display:flex;justify-content:space-between;align-items:center;margin-top:10px;font-size:21px;font-weight:900;color:#b57513;letter-spacing:-.03em}.chocolate{color:#592b12}.pause-button{width:32px;height:32px;font-size:16px}.scorebar{border:3px solid #91c7e7;background:#fffdf8;border-radius:28px;display:flex;align-items:center;justify-content:space-evenly;height:76px;margin-top:12px;box-shadow:0 4px 12px #a16d2610}.scorebar>div{display:flex;gap:6px;align-items:baseline;font-weight:900}.scorebar strong{font-size:45px;line-height:1}.scorebar span{font-size:17px}.scorebar i{display:block;width:1px;height:38px;background:#c5e1ef}.scorebar .best-score{gap:5px}.best-score strong{font-size:25px}.best-score span{font-size:11px}.cake-info{display:flex;align-items:center;justify-content:center;gap:9px;font-size:11px;height:34px;color:#906746}.cake-info span:last-child{border:1px solid #e0ca9e;border-radius:14px;padding:2px 10px;background:#fffdf7}.cake-info.momo{color:#b2526b}.board-wrap{position:relative;width:100%;height:clamp(275px,calc(100svh - 305px),530px);overflow:hidden}canvas{display:block;width:100%;height:100%;object-fit:contain;touch-action:none;cursor:pointer}.toast{position:absolute;top:26%;left:50%;transform:translate(-50%,-8px);text-align:center;white-space:nowrap;background:#fffef4ed;border:2px solid #e6b33f;border-radius:24px;padding:8px 17px;font-size:20px;font-weight:900;color:#a75e00;pointer-events:none;opacity:0;transition:opacity .14s,transform .14s;box-shadow:0 4px 14px #9d620815}.toast.visible{opacity:1;transform:translate(-50%,0)}.toast.pink{border-color:#ebb7c0;color:#b75874}.board-hint{position:absolute;top:12%;width:100%;text-align:center;color:#bb813c;font-size:13px;pointer-events:none;animation:hint 1.6s ease-in-out infinite}.drop-button{font-size:27px;min-height:65px}.play-tip{font-size:12px;text-align:center;margin:15px 0 0;color:#8e6c4d;min-height:18px}footer{text-align:center;font-size:9px;color:#b29c80;letter-spacing:.1em;margin-top:16px}footer span{padding:0 8px}.modal{border:1px solid #e5cf9e;border-radius:29px;padding:0;color:#582a10;width:min(90vw,390px);max-height:90svh;background:#fffbef;box-shadow:0 20px 70px #57341044}.modal::backdrop{background:#51341966;backdrop-filter:blur(5px)}.modal-inner{padding:28px 26px 24px;text-align:center}.eyebrow{font-size:10px;letter-spacing:.17em;color:#b0804e;font-weight:800}h2{font-size:24px;margin:9px 0 18px;letter-spacing:.03em}.instructions{text-align:left;list-style:none;counter-reset:step;padding:0;margin:22px 0}.instructions li{counter-increment:step;position:relative;padding-left:37px;margin:18px 0}.instructions li:before{content:counter(step);position:absolute;left:0;top:0;background:#ffde71;border-radius:50%;width:26px;height:26px;text-align:center;line-height:26px;font-weight:900}.instructions b{display:block;font-size:14px}.instructions span{display:block;font-size:12px;line-height:1.8;margin-top:5px;color:#8b6b50}.help-peach{background:#fff0e8;border-radius:16px;padding:12px 10px;margin:18px 0 23px;font-size:12px;line-height:1.8;color:#a25e5e}.modal .primary{font-size:22px}.compact p{font-size:13px;color:#997253;margin:0 0 27px}.compact .secondary{margin-top:16px}.result-count{display:flex;justify-content:center;align-items:baseline;gap:8px}.result-count strong{font-size:88px;line-height:1;color:#87420c;letter-spacing:-.05em}.result-count span{font-size:23px;font-weight:900}.result-modal h2{margin-bottom:14px}.result-modal p{font-size:12px;color:#987453}.result-stats{display:flex;justify-content:center;gap:0;border-block:1px solid #ead9bb;padding:15px 0;margin-top:20px}.result-stats>div{width:50%;display:grid;gap:5px}.result-stats>div+div{border-left:1px solid #ead9bb}.result-stats span{font-size:11px;color:#a48565}.result-stats strong{font-size:20px}.result-best{font-size:12px;margin:14px 0 21px;color:#946c49}.result-best b{font-size:18px;padding-left:9px}.result-actions{display:flex;gap:10px;margin-top:18px}.result-actions button{font-size:12px;padding:8px;min-height:42px}.share-status{min-height:15px;margin:11px 0 0!important}.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}@keyframes hint{50%{opacity:.35}}@media(min-width:600px){body{padding:22px}.app{border-radius:30px}}@media(max-height:780px){.app{padding-top:12px}.logo{width:64%;max-width:230px}.tagline{font-size:15px;margin-top:4px}.hero-tower{width:78%;max-width:285px;margin:12px auto 16px}.best-pill{margin:10px auto 12px}.title-screen>.secondary{margin-top:14px}.start-button{min-height:59px;font-size:28px}.fineprint{margin-top:12px}footer{margin-top:12px}.scorebar{height:65px;margin-top:8px}.scorebar strong{font-size:38px}.scorebar .best-score strong{font-size:25px}.play-heading{margin-top:6px}}@media(max-width:360px){.app{padding-inline:16px}.tagline{font-size:14px}.brand span{font-size:8px}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* Keep every play control inside the viewport, including short phones. */
.app[data-screen="play"]{height:min(920px,100svh);min-height:0;display:flex;flex-direction:column}
.play-screen{display:flex;flex:1;min-height:0;flex-direction:column}
.play-screen .board-wrap{flex:1;height:auto;min-height:150px}
.play-heading,.scorebar,.cake-info,.drop-button,.play-tip{flex-shrink:0}
@media(min-width:600px){.app{min-height:min(calc(100svh - 44px),900px)}.app[data-screen="play"]{height:min(900px,calc(100svh - 44px))}}
@media(max-height:780px){.logo{width:190px}.hero-tower{width:210px;max-width:70%;margin:9px auto 13px}.tagline{font-size:14px}.best-pill{padding:4px 12px;margin:8px auto 10px}.best-pill strong{font-size:25px}.start-button{font-size:26px;min-height:54px;padding:10px}.title-screen>.secondary{min-height:40px;padding:8px;margin-top:12px}.fineprint{margin-top:10px}.app[data-screen="play"] .topline{display:none}.app[data-screen="play"] footer{margin-top:5px}.play-tip{margin:12px 0 0}.play-heading{margin-top:0}}
@media(max-height:620px){.logo{width:150px}.hero-tower{width:170px;margin:7px auto 10px}.brand span,.fineprint{display:none}.topline{height:32px}.icon-button{width:32px;height:32px}.tagline{font-size:12px}.best-pill{margin:5px auto 9px;padding:3px 10px}.title-screen>.secondary{margin-top:10px}.app[data-screen="play"] .scorebar{height:54px}.cake-info{height:27px}.drop-button{min-height:51px;font-size:23px;padding:9px}.play-tip{font-size:10px;margin-top:9px}.play-screen .board-wrap{min-height:130px}}
/* A real tower keepsake, with a separate scrollable view for tall towers. */
.result-modal{width:min(94vw,460px)}
.result-modal .modal-inner{padding:23px 22px 20px}
.result-modal h2{font-size:22px;margin:7px 0 15px}
.share-actions{display:flex;gap:9px;margin-top:16px;align-items:stretch}
.share-actions .button{display:flex;align-items:center;justify-content:center;text-decoration:none;flex:1;min-height:49px;font-size:17px;padding:10px 7px;box-sizing:border-box}
.share-actions [aria-disabled="true"]{opacity:.45;pointer-events:none}
.result-modal .share-hint{line-height:1.7;font-size:11px;margin:12px 0 0;text-align:left}
.result-modal .share-status:empty{display:none}
.result-home{margin:14px auto 0}
.tower-modal{width:min(94vw,600px);overflow:hidden}
.tower-view-inner{display:flex;flex-direction:column;max-height:90svh;padding:22px;box-sizing:border-box;text-align:center}
.tower-view-inner h2{margin:7px 0 10px}
.tower-view-inner>.primary{flex-shrink:0;min-height:48px;margin-top:14px;padding:9px;font-size:19px}
@media(max-height:620px){.result-modal .modal-inner{padding:17px}.tower-preview canvas{height:260px}.tower-view-inner{padding:16px}.tower-view-inner h2{font-size:20px}.tower-view-hint{margin:6px 0 9px}}
.share-actions a.button{color:#582a10}
.tower-view-inner{height:min(90svh,820px)}

.result-modal #retry{margin-top:22px}

/* Shared, viewport-sized comparison canvas; scroll space carries the full height. */
#result-card[hidden]{display:none}
.ct-inspector{display:flex;flex-direction:column;min-width:0;width:100%;min-height:0;text-align:center}
.ct-view-controls{display:flex;align-items:center;justify-content:center;gap:6px;flex-shrink:0}
.ct-view-controls .button{width:auto;min-height:40px;padding:7px 12px;font-size:12px;box-shadow:none;white-space:nowrap}
.ct-view-controls output{min-width:42px;font-size:12px;font-weight:700;color:#8a5b2f}
.ct-view-reference{font-size:11px!important;line-height:1.5;margin:9px 0!important;color:#8a5b2f!important;flex-shrink:0}
.ct-view-scroll{position:relative;min-width:0;width:100%;max-width:100%;height:clamp(240px,45svh,420px);min-height:120px;overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y;border:1px solid #a6cee4;border-radius:15px;background:#fffaf0;scrollbar-gutter:stable both-edges;flex-shrink:0}
.ct-view-space{position:relative;min-height:100%}
.ct-view-space canvas{position:sticky;top:0;left:0;display:block;width:100%;max-height:none;object-fit:fill;cursor:default;touch-action:pan-x pan-y}
.ct-view-jumps{display:flex;justify-content:space-between;gap:8px;margin-top:5px;flex-shrink:0}
.ct-view-jumps button{border:0;background:transparent;color:#8a5b2f;padding:8px 5px;min-height:34px;font:inherit;font-size:11px;cursor:pointer}
.ct-inspector button:disabled{opacity:.4;cursor:default}
.ct-view-hint{font-size:10px!important;line-height:1.6;margin:4px 0 9px!important;color:#987453!important;flex-shrink:0}
.inspect-larger{min-height:38px;font-size:12px;padding:7px 12px;margin-top:4px}
.result-modal .result-summary{font-size:23px;font-weight:800;color:#87420c;margin:4px 0 6px}
.result-details{font-size:10px;line-height:1.8;color:#987453;margin-bottom:14px}
#large-inspector{flex:1;min-height:0}
#large-inspector .ct-view-scroll{flex:1;min-height:100px;height:auto;flex-shrink:1}
.tower-view-inner h2{flex-shrink:0}
@media(max-width:360px){.result-modal .modal-inner{padding:17px 12px}.ct-view-controls{gap:4px}.ct-view-controls .button{padding:6px 10px}.tower-view-inner{padding:16px 12px}}
