@charset "UTF-8";
:root{color-scheme:light;--paper:#f7f5ee;--ink:#303a37;--muted:#657069;--green:#28594d;--line:#dfe3da;font-family:"Yu Gothic UI","Hiragino Kaku Gothic ProN","Meiryo",sans-serif;font-size:17px;background:var(--paper);color:var(--ink)}
*{box-sizing:border-box}body{margin:0}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer;border:1px solid var(--line);border-radius:12px;min-height:44px;background:#fffefa;padding:8px 12px;font-weight:600}button:hover:not(:disabled){background:#f0f3eb;border-color:#819a8c}button:disabled{opacity:.4;cursor:default}button:focus-visible,a:focus-visible,[tabindex]:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #2168b0;outline-offset:3px}[hidden]{display:none!important}a{color:inherit}h1,h2,h3,p{margin:0}.large-text{font-size:19px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.skip-link{position:fixed;left:16px;top:-100px;z-index:100;background:#fff;padding:15px}.skip-link:focus{top:10px}
.primary-button{background:var(--green);border-color:var(--green);color:#fff;width:100%;min-height:48px}.primary-button:hover:not(:disabled){background:#1e483d;border-color:#1e483d;color:#fff}.text-button{background:transparent;border-color:transparent;font-size:15px}.install-button{background:transparent;border-color:#b9c4b7;font-size:15px}.install-button span{margin-left:6px}
.site-header{max-width:1600px;width:100%;margin:auto;padding:10px 24px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);gap:12px}.brand{display:flex;gap:12px;align-items:center;text-decoration:none;font-size:26px;font-weight:800;white-space:nowrap}.brand img{border-radius:12px}.brand small{display:block;font-size:12px;font-weight:500;color:var(--muted);margin-top:3px}.site-header nav{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.update-notice button{background:var(--green);color:white}
.main-shell{max-width:1600px;width:100%;margin:auto;padding:12px 24px 18px;display:flex;flex-direction:column;gap:12px}.input-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:14px}.input-toolbar select{font:inherit;min-height:44px;padding:8px;border:1px solid var(--line);border-radius:9px;background:#fffefa;color:var(--ink);max-width:100%}.input-toolbar button{font-size:14px}#controller-status{font-size:13px;color:var(--green);margin-left:auto}#controller-status:empty{display:none}.save-error{font-size:14px;color:#8c382c;line-height:1.4;padding:6px 10px;background:#fff0e9;border-radius:8px;flex:none}
.home-screen{flex:1;min-height:0;overflow:auto;padding:22px 26px;background:#fffefa;border:1px solid #e4e5dc;border-radius:20px;scroll-padding:16px}.home-title-row,.home-summary{display:flex;align-items:center;justify-content:space-between;gap:8px 16px}.home-summary{margin-top:8px;flex-wrap:wrap}.home-heading h1{font-size:28px}.home-heading p,.home-copy{color:var(--muted);font-size:15px;line-height:1.7}#home-next-player-button{flex:none;font-size:15px}.home-heading .primary-button{width:auto;font-size:16px}.home-copy{margin-top:14px}.home-levels{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 28px}.stage-group{font-size:15px;margin:18px 0 10px;color:var(--green)}.stage-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.stage-grid button{min-height:76px;font-size:22px;padding:9px 3px;display:flex;flex-direction:column;align-items:center;gap:5px}.stage-grid small{font-size:12px;line-height:1.4}.stage-grid button.done{background:#e6eddf}.stage-grid button.current{border:2px solid var(--green)}.home-footer{margin-top:22px;padding-top:16px;border-top:1px solid var(--line)}.home-footer p{font-size:14px;line-height:1.7;color:var(--muted)}.large-text .home-copy,.large-text .home-heading p,.large-text .home-footer p{font-size:18px}
@media(min-width:900px){body{height:100dvh;display:flex;flex-direction:column}.site-header{flex:none}.main-shell{flex:1;min-height:0}.input-toolbar{flex:none}}
@media(max-width:899px){.site-header{flex-wrap:wrap;padding:10px 16px}.main-shell{padding:10px 16px 18px}}
@media(max-width:700px){.home-screen{padding:18px 16px}.home-levels{grid-template-columns:1fr}}
@media(max-width:480px){.brand{font-size:20px}.brand img{width:32px;height:32px}.brand small{display:none}.site-header button{font-size:13px;padding:7px}.home-heading h1{font-size:22px}.home-title-row{gap:8px}.large-text .home-heading h1{font-size:24px}.stage-grid{gap:5px}.input-toolbar{gap:6px}.input-toolbar button{font-size:13px}}

/* Gameplay owns the viewport. Only the home screen uses page scrolling. */
body[data-screen="play"]{height:100dvh;overflow:hidden;display:flex;flex-direction:column}
body[data-screen="play"]>.site-header,body[data-screen="play"] .input-toolbar{display:none}
body[data-screen="play"] .main-shell{flex:1;min-height:0;padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:6px}
.play-layout{flex:1;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:8px}
.play-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 12px;min-width:0}.chapter{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12px;line-height:1.4}.chapter span:first-child{color:var(--green)}.level-heading h1{font-size:24px;line-height:1.25}.play-heading>button{min-width:90px;font-size:15px}.instruction-card{grid-column:1/-1;display:flex;align-items:center;gap:8px;min-width:0}.instruction-card h2{font-size:16px;line-height:1.3;font-weight:600;color:var(--green)}.step-marker{width:20px;height:20px;display:grid;place-items:center;border-radius:50%;background:#e4eadd;color:var(--green);font-size:12px;flex:none}
.puzzle-card{min-height:0;min-width:0;display:flex;flex-direction:column;background:#fffefa;border:1px solid #e4e5dc;border-radius:18px;overflow:hidden;box-shadow:0 6px 24px #424c3210}.board-toolbar{min-height:44px;flex:none;padding:2px 14px;display:flex;align-items:center;justify-content:space-between;gap:6px;border-bottom:1px solid #eef0e8}.board-stats{display:flex;gap:12px;color:var(--muted);font-size:13px;white-space:nowrap}.board-stats strong{font-size:17px;color:var(--ink);margin:0 2px}.rating-button{display:flex;align-items:center;gap:8px;background:transparent;border:0;padding:0 2px;min-height:40px;font-size:15px;white-space:nowrap}#live-stars,.clear-stars,.stage-stars{color:#926014;letter-spacing:.06em}#elapsed-time{font-variant-numeric:tabular-nums;min-width:60px;text-align:left}
.board-wrap{position:relative;flex:1;min-height:0;display:flex;margin:0 10px}.board{position:relative;width:100%;height:100%;min-height:0;flex:1;background-image:radial-gradient(#d4dbce 1px,transparent 1px);background-size:24px 24px;background-position:center;border-radius:12px}.board svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}.rope-shadow{stroke:#fffefa;stroke-width:20;stroke-linecap:round}.rope-line{stroke-width:11;stroke-linecap:round}.rope-line.selected-rope{stroke-width:14}.cell{position:absolute;transform:translate(-50%,-50%);width:52px;height:52px;min-height:52px;padding:0;display:grid;place-items:center;border:0;background:transparent;border-radius:50%;z-index:2;touch-action:manipulation}.cell:hover:not(:disabled){background:#e7ecdf;border:0}.cell .peg{width:15px;height:15px;border-radius:50%;background:#fffefa;border:2px solid #b8c4b0;display:grid;place-items:center}.cell.occupied .peg{width:42px;height:42px;border:4px solid #fffefa;background:var(--rope-color);box-shadow:0 1px 6px #203a3730;color:white;font-size:16px;font-weight:800}.cell.selected{outline:3px solid var(--green);outline-offset:3px}.cell.destination .peg{width:27px;height:27px;border:2px dashed #37634b;background:#e5efdf}.cell.hint-target{outline:3px dashed #8c5b15;outline-offset:3px;background:#ffefb1}.cell.hint-from{outline:3px solid #8c5b15;outline-offset:3px}.cell.hint-target .peg{width:27px;height:27px;border-color:#8c5b15;background:#ffefb1}.controller-guidance .cell.controller-cursor{outline:3px solid #234c40;outline-offset:3px;box-shadow:0 0 0 6px #fffefa}.controller-guidance .cell.controller-cursor.selected{outline-style:dashed}
.input-help{flex:none;padding:6px 12px;background:#f0f3e9;border-top:1px solid #dfe5d7;color:var(--green)}#input-guide{display:flex;flex-wrap:wrap;justify-content:center;gap:2px 12px;line-height:1.5;font-size:14px}#input-guide>span{display:inline-block}kbd{display:inline-block;font:inherit;background:#fffefa;border:1px solid #dce0d4;padding:0 3px;border-radius:4px;margin-right:3px}
.play-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.play-actions button{min-width:0;min-height:48px;font-size:16px}.return-home-button{border-color:#9bb5a5;background:#eaf0e4;color:var(--green)}.large-text .play-actions button{font-size:18px}.large-text .instruction-card h2{font-size:18px}.large-text #input-guide{font-size:17px}
.clear-panel{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;text-align:center;background:#fffefaee;padding:8px}.clear-stars{font-size:34px;line-height:1}.clear-panel h2{font-size:25px;line-height:1.3}.clear-panel p{font-size:15px;color:var(--muted);line-height:1.5}.clear-panel p small{font-size:13px}.clear-panel .primary-button{max-width:270px;min-height:44px}.clear-panel .text-button{min-height:44px;font-size:14px}
@media(max-width:700px){.play-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.play-actions button{min-height:44px;padding:7px 5px;font-size:15px}.play-heading{gap:2px 8px}.level-heading h1{font-size:20px}.play-heading>button{min-width:80px}.large-text .play-actions button{font-size:17px}.board-toolbar{padding:0 8px}.board-stats{gap:6px;font-size:12px}.board-stats strong{font-size:16px}.rating-button{gap:5px;font-size:14px}#elapsed-time{min-width:54px}.board-wrap{margin:0 6px}.cell{width:44px;height:44px;min-height:44px}.cell.occupied .peg{width:34px;height:34px;font-size:13px;border-width:3px}.input-help{padding:5px 8px}#input-guide{font-size:13px;gap:2px 7px}.large-text #input-guide{font-size:15px}.clear-panel{gap:3px}.clear-stars{font-size:26px}.clear-panel h2{font-size:20px}.clear-panel p{font-size:13px}.clear-panel p small{font-size:12px}}
@media(max-width:360px){body[data-screen="play"] .main-shell{padding-left:max(6px,env(safe-area-inset-left));padding-right:max(6px,env(safe-area-inset-right))}.play-layout{gap:6px}.board-stats{gap:4px;font-size:11px}}
@media(max-height:500px) and (min-width:500px){
  .play-layout{grid-template-columns:180px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:6px 10px}.play-heading{grid-column:1;grid-row:1;grid-template-columns:1fr;gap:5px}.level-heading h1{font-size:20px}.play-heading>button{grid-row:3;min-height:44px}.instruction-card{grid-column:1}.instruction-card h2{font-size:15px}.puzzle-card{grid-column:2;grid-row:1/3}.play-actions{grid-column:1;grid-row:2;grid-template-columns:1fr;align-content:end;gap:4px}.play-actions button,.large-text .play-actions button{min-height:42px;padding:5px;font-size:16px}.board-toolbar{padding:0 6px}.board-stats{font-size:11px;gap:5px}.board-stats strong{font-size:15px}.rating-button{font-size:13px;gap:4px}.input-help{padding:4px 6px}#input-guide,.large-text #input-guide{font-size:13px}.cell{width:44px;height:44px;min-height:44px}.cell.occupied .peg{width:34px;height:34px;border-width:3px;font-size:13px}.clear-stars{font-size:26px}.clear-panel h2{font-size:20px}.clear-panel p{font-size:13px}.clear-panel{gap:3px}.large-text .instruction-card h2{font-size:16px}
}

/* Short dialog pages keep help and settings reachable without scrolling. */
body:has(dialog[open]){overflow:hidden}
dialog{width:min(640px,calc(100% - 24px));max-width:calc(100% - 24px);max-height:calc(100dvh - 16px);padding:20px;border:1px solid var(--line);border-radius:18px;color:var(--ink);background:var(--paper);box-shadow:0 25px 90px #17251a40}dialog::backdrop{background:#223b3059;backdrop-filter:blur(3px)}.dialog-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px;flex:none}.dialog-heading h2{font-size:23px;line-height:1.3}.close-button{flex:none;min-width:44px;min-height:44px;padding:4px;font-size:24px;background:transparent}.dialog-copy{line-height:1.65;font-size:16px;color:var(--muted);margin-bottom:12px}.dialog-copy:last-child{margin-bottom:0}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.dialog-actions button{flex:1;min-width:0;font-size:16px}.dialog-actions .primary-button{width:auto}.large-text .dialog-copy{font-size:18px}.dialog-pages{min-width:0}.page-navigation{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:12px;margin-top:16px}.page-navigation button{font-size:15px;padding:8px 5px}.page-count{font-size:14px;color:var(--muted);font-variant-numeric:tabular-nums}.controller-menu{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.controller-menu button{min-height:48px;font-size:16px;padding:8px 5px}.input-options{display:grid;gap:8px}button[aria-pressed="true"]{border-color:var(--green);background:#e5eddf;color:var(--green)}.controller-active #dialog button:focus{outline:3px solid #2168b0;outline-offset:2px}.star-rules{display:grid;gap:8px;margin-bottom:14px;font-size:20px;color:#926014}
.tutorial-step{display:grid;grid-template-columns:160px minmax(0,1fr);align-items:center;gap:20px;padding:12px;background:#fffefa;border-radius:12px}.tutorial-step svg{width:100%;height:110px}.tutorial-step h3{font-size:18px;line-height:1.4;margin-bottom:8px}.tutorial-step p{font-size:16px;line-height:1.6;color:var(--muted)}.tutorial-step p+p{margin-top:8px}.large-text .tutorial-step p{font-size:18px}
.sound-dialog{width:min(560px,calc(100% - 24px))}.sound-master,.sound-track{padding:8px 12px;background:#fffefa;border:1px solid var(--line);border-radius:12px;min-width:0}.sound-master{background:#edf2e7}.sound-master-controls{display:flex;align-items:center;justify-content:space-between;gap:12px}.sound-master-controls>div{flex:1;min-width:0}.sound-master-controls button{font-size:14px;min-height:44px;flex:none;padding:8px 12px}.sound-tracks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:10px}.sound-title{display:flex;flex-direction:column;justify-content:center;min-height:44px;text-decoration:none;margin-top:4px;line-height:1.4}.sound-title strong{font-size:16px;font-weight:600;color:var(--green);text-decoration:underline;text-underline-offset:3px}.sound-credit{font-size:12px;color:var(--muted);margin-top:2px}.sound-track-label{font-size:15px;font-weight:600;line-height:1.5}.volume-label{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:15px;font-weight:600;line-height:1.5}.volume-label output{min-width:48px;text-align:right;font-variant-numeric:tabular-nums;color:var(--green)}#sound-panel input[type="range"]{display:block;width:100%;height:40px;margin:0;accent-color:var(--green);cursor:pointer}#sound-play{width:100%;min-height:44px;margin-top:8px;font-size:14px}.large-text .volume-label,.large-text .sound-track-label,.large-text .sound-master-controls button,.large-text .sound-title strong{font-size:18px}.large-text .sound-credit{font-size:15px}
#controller-dialog{width:min(760px,calc(100% - 24px))}.controller-mode-label{display:block;font-size:15px;font-weight:700;margin-bottom:6px}#controller-dialog select{width:100%;min-width:0;min-height:44px;padding:8px;font:inherit;font-size:14px;color:var(--ink);border:1px solid #aebea5;border-radius:9px;background:#fffefa}.connection-instructions{font-size:15px;line-height:1.6;margin:10px 0}.connection-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.connection-actions button{font-size:15px;min-height:44px;padding:6px}.connection-actions select,.connection-actions button:only-child{grid-column:1/-1}.connection-status{padding:8px 10px;background:#eaf0e4;border-left:4px solid #66815a;border-radius:4px;margin-top:10px;line-height:1.5;font-size:15px}.controller-test{background:#fffefa;padding:10px;border:1px solid var(--line);border-radius:12px}.controller-test>p{font-size:14px;line-height:1.5;color:var(--muted)}.controller-monitor{display:flex;align-items:center;gap:12px;margin:10px 0}.stick-monitor{position:relative;flex:none;width:80px;height:80px;border-radius:50%;background:#eff2e9;border:1px solid #b7c7ad}.stick-monitor::before,.stick-monitor::after{content:'';position:absolute;background:#becbb5}.stick-monitor::before{width:1px;height:100%;left:50%}.stick-monitor::after{width:100%;height:1px;top:50%}.stick-monitor span{position:absolute;left:calc(50% - 11px);top:calc(50% - 11px);width:22px;height:22px;border-radius:50%;background:var(--green);z-index:1}.input-checks{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;flex:1}.input-check{border:1px solid #dce1d4;border-radius:8px;padding:4px 2px;text-align:center;line-height:1.4;background:#f7f8f2}.input-check span{font-size:13px;display:block;white-space:nowrap}.input-check small{font-size:11px;color:var(--muted);display:block}.input-check.tested{background:#e9f1e3;border-color:#9bb68c}.input-check.tested small{color:#28543b}.input-check.active{outline:2px solid #55734c}.controller-test .controller-live{color:var(--green);min-height:42px}.controller-play-help{font-size:15px;line-height:1.5;margin:10px 0}.controller-play .primary-button{font-size:15px}.calibration-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:8px;font-size:15px}.calibration-controls button{grid-column:1/-1;font-size:15px}.calibration-controls label{display:flex;align-items:center;gap:6px;min-height:44px;cursor:pointer}.calibration-controls input{width:21px;height:21px;accent-color:var(--green)}.firmware-links{display:grid;gap:8px}.firmware-links a{display:flex;align-items:center;justify-content:center;min-height:44px;padding:7px 10px;border:1px solid #bacbb3;border-radius:9px;font-size:15px;color:var(--green);background:#fffefa;text-underline-offset:3px}
@media(max-width:480px){dialog{padding:14px}.dialog-heading{margin-bottom:8px}.dialog-heading h2{font-size:21px}.page-navigation{margin-top:12px;gap:8px}.tutorial-step{grid-template-columns:1fr;gap:6px;padding:12px}.tutorial-step svg{height:90px}.tutorial-step h3{font-size:18px}.sound-tracks{grid-template-columns:1fr;gap:8px;margin-top:8px}.controller-monitor{gap:8px}.stick-monitor{width:56px;height:56px}.controller-test{padding:8px}}
@media(max-height:500px) and (min-width:500px){
  dialog{padding:10px 14px}.dialog-heading{margin-bottom:6px}.dialog-heading h2{font-size:21px}.dialog-copy{line-height:1.5;margin-bottom:8px}.page-navigation{margin-top:8px}.tutorial-step{padding:8px;gap:12px;grid-template-columns:120px minmax(0,1fr)}.tutorial-step svg{height:85px}.tutorial-step h3{margin-bottom:4px}.tutorial-step p,.large-text .tutorial-step p{font-size:16px;line-height:1.5}.controller-menu{gap:6px}.controller-menu button{min-height:44px}.connection-page,.test-page,.firmware-page,.calibration-page{display:grid;grid-template-columns:1fr 1fr;gap:14px;align-items:center}.connection-instructions{margin:6px 0}.connection-status{font-size:14px;margin-top:6px}.controller-play-help{margin:0 0 8px}.controller-monitor{margin:6px 0;gap:6px}.input-checks{gap:4px}.stick-monitor{width:64px;height:64px}.controller-test{padding:6px}.controller-test .controller-live{min-height:0}.sound-tracks{margin-top:6px}.sound-master,.sound-track{padding:6px 10px}.dialog-actions{margin-top:8px}.star-rules{gap:4px;margin-bottom:8px;font-size:18px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important}}
