:root{font-family:"Hiragino Kaku Gothic ProN","Noto Sans JP","Yu Gothic",Meiryo,sans-serif;color:#132f43;background:#e5eadf;font-synthesis:none}*{box-sizing:border-box}body{margin:0;padding:24px 12px 30px;min-height:100dvh}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer}button:focus-visible,a:focus-visible,canvas:focus-visible{outline:3px solid #277aca;outline-offset:3px}button:disabled{cursor:default}.game-shell{width:min(100%,520px);margin:auto;background:#fcf6e6;border:3px solid #142f42;border-radius:28px;overflow:hidden;box-shadow:0 12px 0 #c6cfbd}.topbar{display:flex;align-items:center;justify-content:space-between;padding:15px 20px 4px;font-size:13px;font-weight:800}.back{color:#415a60;text-decoration:none}.help{border:0;background:none;font-size:13px;font-weight:800;padding:5px}.heading{display:flex;align-items:center;justify-content:space-between;padding:8px 22px 14px;gap:8px}.eyebrow{font-size:12px;font-weight:800;letter-spacing:.07em;margin:2px 0 4px;color:#617476}h1{font-size:clamp(34px,9vw,49px);font-weight:1000;letter-spacing:-.07em;line-height:1.18;margin:0;white-space:nowrap}h1>span{color:#ef684b;display:inline-block;transform:rotate(-7deg);font-size:1.16em;margin-right:4px;-webkit-text-stroke:1.2px #183747}.score-box{min-width:75px;border-radius:18px;background:#f2e5bc;display:grid;grid-template-columns:auto auto;align-items:baseline;padding:8px 10px 6px;column-gap:3px;text-align:center}.score-box span:first-child{grid-column:1/3;font-size:11px;font-weight:800}.score-box b{font-size:36px;line-height:1.1;text-align:right}.score-box span:last-child{font-size:11px;font-weight:800}.shape-tools{display:flex;gap:9px;padding:0 17px 13px}.shape-button{display:flex;gap:9px;align-items:center;text-align:left;flex:1;min-width:0;border:2px solid #173247;background:#fffdf4;border-radius:14px;padding:5px 11px}.shape-button svg{width:39px;height:39px;fill:#8d61cf;stroke:#283b55;stroke-width:5;flex:none}.shape-button small{display:block;font-size:10px;color:#677079}.shape-button b{font-size:15px}.shape-button>span:last-child{margin-left:auto}.rotate-button{display:flex;align-items:center;gap:6px;border:2px solid #d1ceb9;background:#f5eddb;border-radius:14px;padding:6px 11px;font-size:25px}.rotate-button span{font-size:11px;font-weight:800}.playfield{position:relative;border-top:2px solid #173247;border-bottom:2px solid #173247;background:#addcda;overflow:hidden}canvas{width:100%;height:auto;display:block;touch-action:none;user-select:none}.phase-tag{position:absolute;left:14px;top:12px;background:#fff9e7;border:1.7px solid #153346;border-radius:20px;padding:6px 11px;font-size:11px;font-weight:900;pointer-events:none}.status{position:absolute;left:12px;right:12px;bottom:11px;min-height:37px;display:flex;align-items:center;justify-content:center;text-align:center;border-radius:13px;border:1.5px solid #193a43;background:#fffbeced;font-size:13px;font-weight:900;padding:7px 9px;pointer-events:none;box-shadow:0 3px 0 #1c493d15}.loading{position:absolute;inset:0;display:grid;place-items:center;background:#e8edcb;font-weight:800}.loading.hidden{display:none}.action-row{padding:14px 17px 0}.action{width:100%;min-height:53px;border:2px solid #162f43;background:#ffd664;border-radius:16px;font-size:17px;font-weight:900;box-shadow:0 4px 0 #163044;transition:transform .12s}.action:active:not(:disabled){transform:translateY(3px);box-shadow:0 1px 0 #163044}.action:disabled{background:#e5e6cf;box-shadow:0 3px 0 #8d9b8b;color:#476251}.hint-row{display:flex;align-items:center;justify-content:space-between;padding:9px 17px 5px;gap:7px}.hint-row p{font-size:10px;color:#5c706d;margin:6px 0;line-height:1.5}.restart{border:0;background:none;text-decoration:underline;font-size:11px;white-space:nowrap;padding:8px 0}footer{border-top:1px dashed #d3d3b5;display:flex;align-items:center;justify-content:space-between;padding:11px 19px 14px;font-size:10px;color:#6c756e}footer button{font-size:10px;border:0;background:none;text-decoration:underline}dialog{width:min(92vw,490px);max-height:84dvh;border:3px solid #173247;border-radius:23px;background:#fff9eb;padding:20px;color:#163547}dialog::backdrop{background:#122e43aa}.modal-top{display:flex;align-items:center;justify-content:space-between;gap:8px;position:sticky;top:-20px;background:#fff9eb;z-index:1;padding:5px 0}h2{font-size:21px;margin:0}.modal-top button{font-size:29px;border:0;background:none;padding:0 4px}dialog p,dialog li{font-size:14px;line-height:1.8}dialog li{margin-bottom:12px}dialog ol{padding-left:23px}.shape-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.shape-choice{border:1.5px solid #c2cabc;border-radius:12px;padding:6px 4px;background:#fffdf4;font-size:12px;font-weight:800;min-width:0}.shape-choice.active{border:2px solid #6941ac;background:#eee2ff}.shape-choice svg{height:53px;width:100%;display:block;fill:#8e60cc;stroke:#203950;stroke-width:4}.sources{display:grid;gap:10px;font-size:12px}.sources a{color:#276c85}h3{font-size:16px}@media(max-width:420px){body{padding:0;background:#fcf6e6}.game-shell{border:0;border-radius:0;box-shadow:none}.topbar{padding-top:max(11px,env(safe-area-inset-top))}.heading{padding:5px 18px 12px}.shape-tools{padding-bottom:11px}.action-row{padding-top:12px}footer{padding-bottom:max(14px,env(safe-area-inset-bottom))}}@media(prefers-reduced-motion:reduce){.action{transition:none}}

.power-control{display:flex;align-items:center;gap:12px;padding:12px 19px 0;font-size:12px;font-weight:800}.power-control label{white-space:nowrap}.power-control input{width:100%;min-width:40px;accent-color:#8260c7;height:25px}.power-control output{min-width:40px;color:#5c5877}.power-control input:disabled{opacity:.45}

/* Suppress accidental double-tap zoom and long-press selection only inside play. */
.game-shell{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
button,input[type="range"]{touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
canvas{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
dialog p,dialog li,dialog h2,dialog h3,dialog a,input[type="search"]{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}

/* Phone Safari: reserve room for the floating toolbar and preserve scroll reach. */
:root{--game-vh:100vh;--browser-reserve:80px}html{scroll-padding-bottom:calc(var(--browser-reserve) + env(safe-area-inset-bottom,0px))}
@supports(height:100svh){:root{--game-vh:100svh}}
.topbar{justify-content:flex-end}
dialog{max-height:min(84svh,calc(var(--game-vh) - 96px - env(safe-area-inset-bottom,0px)));overflow-y:auto;overscroll-behavior:contain;scroll-padding-bottom:28px;padding-bottom:calc(24px + env(safe-area-inset-bottom,0px))}
@media(max-width:600px){
 body{padding:0 0 calc(var(--browser-reserve) + env(safe-area-inset-bottom,0px));min-height:100%;overflow-y:auto}
 .game-shell{border-radius:0;box-shadow:none;overflow:visible}
 .topbar{padding:7px 16px 0;min-height:27px}.help{min-height:28px;padding:3px 0}
 .heading{padding:2px 16px 7px}.eyebrow{font-size:11px;margin:0 0 2px}h1{font-size:34px}.score-box{min-width:68px;padding:5px 8px}.score-box b{font-size:30px}
 .shape-tools{padding:0 14px 9px;gap:8px}.shape-button{min-height:49px}.rotate-button{min-height:49px}
 .playfield{width:min(100%,max(240px,calc((var(--game-vh) - 337px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)) * 6 / 7)));margin-inline:auto}
 .playfield canvas{width:100%;height:auto;aspect-ratio:6/7}
 .power-control{padding:9px 15px 0;min-height:34px}.action-row{padding:9px 14px 0}.action{min-height:52px}
 .hint-row{padding:7px 14px 4px}footer{padding:9px 16px 12px}
 dialog{width:calc(100% - 24px);margin:auto;padding:16px 14px calc(28px + env(safe-area-inset-bottom,0px))}.modal-top{top:-16px}.shape-grid{gap:7px}.shape-choice{min-height:70px}
}

@media(max-width:600px){body{padding-top:env(safe-area-inset-top,0px)}.action-row,.controls,.power-control{scroll-margin-bottom:calc(96px + env(safe-area-inset-bottom,0px))}}

.status:empty{display:none}.hint-row,footer{justify-content:flex-end}
