:root{color-scheme:light;--paper:#f7f3e8;--ink:#263c38;--teal:#247d6a;--line:#d8dfcf;font-family:ui-rounded,system-ui,-apple-system,"Hiragino Sans","Yu Gothic","Segoe UI",sans-serif;color:var(--ink);background:var(--paper)}*{box-sizing:border-box}html,body{width:100%;height:100%;margin:0;overflow:hidden}button,input,select{font:inherit}button,a,select{touch-action:manipulation}button{cursor:pointer;color:inherit;border:0}button:disabled{opacity:.5;cursor:wait}button,input,select{border-radius:10px}a{color:var(--teal)}[hidden]{display:none!important}:focus-visible{outline:3px solid #d7a34d;outline-offset:3px}#app{height:100svh;min-height:360px;display:flex;flex-direction:column}.appbar{height:56px;flex:none;display:flex;justify-content:space-between;align-items:center;padding:8px 18px;gap:10px;border-bottom:1px solid var(--line)}.brand{display:flex;align-items:center;gap:8px;text-decoration:none;flex:none}.brand svg{width:30px;height:30px;stroke:var(--teal);fill:none;stroke-width:2;stroke-linejoin:round}.brand>span{display:flex;flex-direction:column;gap:1px}.brand b{font-size:10px;letter-spacing:.17em}.brand small{font-size:11px;color:#697f70}.tools{display:flex;align-items:center;gap:7px}.rank-button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:7px 12px;background:#f0d277;color:#4c4928;border:1px solid #cbb15b;font-size:12px;font-weight:750;box-shadow:0 2px 0 #b29e57;white-space:nowrap}.rank-button:hover{background:#ffde83}.icon-btn{width:36px;height:36px;border:1px solid var(--line);background:#fffdf5;font-size:21px;font-weight:650}.language select{height:36px;max-width:150px;background:#fffdf5;color:var(--ink);border:1px solid var(--line);padding:0 7px;font-size:12px}.stage{flex:1;min-height:0;position:relative;overflow:hidden;margin:12px 14px 0;border-radius:18px;border:1px solid #d4dfce;background:#d6edf2}.stage canvas{width:100%;height:100%;display:block;touch-action:none;-webkit-user-select:none;user-select:none}.hud{position:absolute;top:12px;inset-inline:12px;display:flex;justify-content:space-between;gap:14px;padding:10px 14px;border:1px solid #ffffffaa;border-radius:12px;background:#fffdf2ed;pointer-events:none}.hud>div{display:flex;flex-direction:column;gap:4px;min-width:0}.hud small{color:#718272;font-size:10px}.hud strong{font-size:25px;font-weight:800;font-variant-numeric:tabular-nums;line-height:1.1;white-space:nowrap}.hud strong span{font-size:13px;font-weight:500;color:#86917d;margin-inline-start:4px}.hud #height-value{font-size:19px;margin-top:3px}.lean-meter{position:absolute;inset-inline-start:22px;top:105px;display:grid;grid-template-columns:1fr auto;gap:5px 13px;min-width:140px;padding:8px 10px;border-radius:8px;background:#fffdf1dd;pointer-events:none;font-size:10px}.lean-meter>i{grid-column:1/-1;height:4px;border-radius:6px;background:#d6ddce;overflow:hidden}.lean-meter i b{display:block;height:100%;width:0;background:var(--teal)}.hand-info{position:absolute;top:28%;left:59%;width:36%;padding:0 12px;pointer-events:none}.hand-info button{pointer-events:auto}.eyebrow{font-size:10px;font-weight:800;letter-spacing:.14em;color:var(--teal)}.hand-info h1{font-size:clamp(21px,2.9vw,36px);line-height:1.2;letter-spacing:-.035em;margin:8px 0 12px}.hand-info p{font-size:13px;line-height:1.8;color:#657960;margin:8px 0}.start-actions{display:grid;gap:9px;margin-top:15px}.primary,.secondary{display:flex;justify-content:center;align-items:center;min-height:43px;padding:10px 14px;font-size:13px;font-weight:750;line-height:1.45}.primary{background:var(--teal);color:white;box-shadow:0 3px 0 #165647}.primary:hover{background:#1c6b57}.secondary{background:#fffdf4;color:var(--ink);border:1px solid #cfd8c5}.status{color:#b05b39!important;font-size:11px!important;overflow-wrap:anywhere}.paper-readiness{display:grid;gap:6px;margin-top:13px;font-size:13px;color:#b4553e;font-weight:750}.paper-readiness>i{height:5px;border-radius:5px;overflow:hidden;background:#d7ddcc}.paper-readiness b{display:block;height:100%;background:currentColor}.paper-readiness.is-ready{color:var(--teal)}.next-landmark{position:absolute;bottom:15px;inset-inline-start:20px;display:grid;gap:4px;color:#324e39;background:#fffdf2e6;padding:8px 11px;border-radius:8px;pointer-events:none;margin:0}.next-landmark span{font-size:9px;color:#71806c}.next-landmark b{font-size:13px}.game-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px;padding:3px 17px;font-size:11px;flex:none}.game-footer p{font-size:11px;color:#5e785c;margin:0;line-height:1.5}.game-footer>div{display:flex;align-items:center;gap:7px;flex:none}.text-btn{padding:6px;background:none;min-height:32px;font-size:11px;color:#65775d}.text-btn:hover{color:var(--teal);text-decoration:underline}.boot{position:absolute;inset:0;display:grid;place-items:center;background:#f7f3e8;color:#41624b;font-size:14px;z-index:10}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}dialog{margin:auto;width:min(520px,calc(100% - 28px));max-height:calc(100svh - 28px);overflow:auto;padding:27px;border:1px solid var(--line);border-radius:20px;background:var(--paper);color:var(--ink);box-shadow:0 20px 80px #203b3438}dialog::backdrop{background:#24493c80;backdrop-filter:blur(4px)}dialog[open]{animation:arrive .18s ease-out}@keyframes arrive{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}dialog h2{font-size:25px;margin:8px 25px 16px 0;line-height:1.3;letter-spacing:-.03em}dialog p{font-size:13px;line-height:1.8;color:#64775e}dialog .primary{width:100%;margin-top:12px}.dialog-close{position:absolute;top:10px;inset-inline-end:10px;width:32px;height:32px;background:none;color:#71816a;font-size:25px}.rank-scroll{max-height:40svh;overflow:auto;border-block:1px solid var(--line);margin:14px 0}table{border-collapse:collapse;width:100%;font-size:12px}th{text-align:start;font-size:10px;color:#697e5e;position:sticky;top:0;background:var(--paper)}th,td{padding:11px 6px;border-bottom:1px solid #dce1d0;overflow-wrap:anywhere}tr.you{background:#e5eed5;font-weight:750}#my-rank{color:var(--teal);font-weight:700}.result-dialog{text-align:center;max-width:460px}.result-big{font-size:70px;line-height:1.15;color:var(--teal);font-weight:850;margin:13px 0}.result-big span{font-size:24px;color:#a0ad93}#result-time{font-size:17px;font-weight:650}#ranking-form{display:grid;text-align:start;gap:8px;margin:16px 0;padding-block:15px;border-block:1px solid var(--line)}#ranking-form label{font-size:11px;font-weight:700}#ranking-form input{height:43px;padding:9px 10px;border:1px solid #c2d1b7;background:#fffdf5;color:var(--ink);width:100%;font-size:16px}#ranking-form button{margin-top:0}#result-ranks{margin:15px 0 5px;width:100%}
.stage:not(.wide-stage) .hand-info{left:15%;top:37%;width:70%;padding:0;text-align:center}.stage:not(.wide-stage) .hand-info h1{font-size:21px;margin:4px 0 7px}.stage:not(.wide-stage) .hand-info p{font-size:11px;line-height:1.55;margin:4px 0}.stage:not(.wide-stage) .hand-info .eyebrow{font-size:9px}.stage:not(.wide-stage) .start-actions{margin-top:9px;grid-template-columns:1fr 1fr;gap:7px}.stage:not(.wide-stage) .primary,.stage:not(.wide-stage) .secondary{font-size:11px;min-height:37px;padding:7px}.stage:not(.wide-stage) .paper-readiness{margin-top:6px;font-size:11px;gap:3px}.stage:not(.wide-stage) .next-landmark{bottom:40%;font-size:11px;padding:5px 8px}.stage:not(.wide-stage) .next-landmark span{font-size:8px}.stage:not(.wide-stage) .next-landmark b{font-size:11px}
@media(max-width:700px){.appbar{height:48px;padding:6px 10px;gap:5px}.brand>span{display:none}.brand svg{width:25px;height:25px}.tools{gap:4px}.language select{max-width:78px;font-size:10px;height:32px}.rank-button{font-size:10px;padding:5px 7px;min-height:32px;gap:4px}.icon-btn{width:31px;height:32px;font-size:19px}.stage{margin:6px 7px 0;border-radius:14px}.hud{top:8px;inset-inline:8px;padding:8px 10px;gap:8px}.hud strong{font-size:22px}.hud #height-value{font-size:16px}.hud small{font-size:9px}.hud strong span{font-size:11px}.lean-meter{top:90px;inset-inline-start:14px;font-size:9px;min-width:126px;padding:6px 8px}.game-footer{padding:3px 8px;min-height:38px;gap:3px}.game-footer p,.text-btn{font-size:10px}.game-footer>div{gap:1px}dialog{padding:23px}dialog h2{font-size:23px}.hand-info h1{font-size:21px}.hand-info p{font-size:11px}.next-landmark{inset-inline-start:12px}.result-big{font-size:62px}}
@media(max-height:500px) and (min-width:600px){.appbar{height:43px}.stage{margin-top:5px}.hud{top:7px;padding:6px 10px}.hud strong{font-size:20px}.hud #height-value{font-size:15px}.lean-meter{top:84px}.hand-info{top:28%;left:58%;width:39%;padding:0 8px}.hand-info h1{font-size:19px;margin:4px 0}.hand-info p{font-size:10px;line-height:1.4}.hand-info .eyebrow{font-size:8px}.start-actions{grid-template-columns:1fr 1fr;gap:6px;margin-top:7px}.start-actions button{font-size:10px;padding:5px;min-height:32px}.game-footer{min-height:34px}.paper-readiness{font-size:10px;gap:3px;margin-top:4px}}
@media(prefers-reduced-motion:reduce){dialog[open]{animation:none}}

.rank-button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;flex:none}
@media(max-width:700px){.stage:not(.wide-stage):not(.is-playing) .hand-info{top:31%;left:6%;width:88%;background:#fffcf2f2;border:1px solid #dce3d2;border-radius:12px;padding:10px!important}.stage:not(.wide-stage).is-playing .hand-info{top:auto;bottom:39.5%;left:28%;width:69%;background:#fffdf1e8;border-radius:8px;padding:6px 8px!important}.stage:not(.wide-stage).is-playing .hand-info h1,.stage:not(.wide-stage).is-playing .hand-info .eyebrow,.stage:not(.wide-stage).is-playing #instruction{display:none}.stage:not(.wide-stage).is-playing:not([data-drag="1"]) .hand-info{display:none}}

/* Give the folding surface priority over the tower preview and repeated title. */
.wide-stage .hand-info{left:37%;top:91px;width:61%;padding:0 10px}
.wide-stage .hand-info h1,.wide-stage .hand-info .eyebrow{display:none}
.wide-stage .hand-info #instruction{font-size:12px;line-height:1.5;margin:0}
.wide-stage .start-actions{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:7px;gap:9px}
.wide-stage .start-actions button{min-height:38px;font-size:12px;padding:7px 10px}
.wide-stage .paper-readiness{font-size:12px;gap:4px;margin-top:6px}
.stage:not(.wide-stage) .next-landmark{bottom:53%}
.stage:not(.wide-stage).is-playing .hand-info{bottom:52.5%}
@media(max-width:700px){.stage:not(.wide-stage):not(.is-playing) .hand-info{top:18%}.stage:not(.wide-stage):not(.is-playing) .lean-meter{visibility:hidden}.stage:not(.wide-stage).is-playing .hand-info{bottom:52.5%}}
@media(max-height:500px) and (min-width:600px){.wide-stage .hand-info{top:69px;padding:0 5px}.wide-stage .hand-info #instruction{font-size:10px;line-height:1.4}.wide-stage .start-actions{gap:6px;margin-top:6px}.wide-stage .start-actions button{min-height:31px;font-size:10px;padding:5px}.wide-stage .paper-readiness{font-size:10px}}

/* Phone / iPad viewport and readable, scrollable ranking sheets. */
#app{min-height:0}dialog{max-width:calc(100% - 16px);max-height:calc(100dvh - 16px);overflow:auto}dialog td{overflow-wrap:anywhere}dialog input{font-size:16px}

.rank-page-status{display:flex;align-items:center;justify-content:center;gap:10px;min-height:36px;margin:4px 0;font-size:12px;color:#64775e}.rank-page-status:empty{display:none}.rank-page-status button{font:inherit;min-height:36px;padding:7px 12px;border:1px solid var(--line);border-radius:8px;background:#fffdf5;color:inherit}

.rank-scroll{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
