
:root{--paper:#f6f0e2;--desk:#e8e1d1;--ink:#243e3b;--blue:#2869ce;--red:#c4473f;--gold:#d59a37;--sage:#486459;--line:#cfc6b2;--muted:#6b7365}
*{box-sizing:border-box}html,body{width:100%;height:100%;margin:0;overflow:hidden}body{background:var(--desk);color:var(--ink);font-family:ui-rounded,'Avenir Next',Avenir,system-ui,sans-serif;-webkit-user-select:none;user-select:none;overscroll-behavior:none;background-image:radial-gradient(#c4bdab45 .65px,transparent .65px);background-size:6px 6px}
button{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}button:focus-visible,canvas:focus-visible{outline:3px solid var(--blue);outline-offset:4px}canvas.capturing:focus-visible{outline:none}button:disabled{opacity:.3;cursor:default}svg{display:block;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}button svg{margin:auto}button:active:not(:disabled){transform:translateY(2px);box-shadow:none!important}.hidden,[hidden]{display:none!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}
#app{height:100%;height:100dvh;max-width:1240px;margin:auto;display:flex;flex-direction:column;padding:clamp(12px,2.6vh,28px) clamp(12px,3vw,38px) max(12px,env(safe-area-inset-bottom));gap:12px}
header{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;width:100%;max-width:1020px;margin:auto}h1{font-size:clamp(27px,3.6vw,40px);letter-spacing:-2px;line-height:1;margin:0;font-weight:850;display:flex;align-items:center;gap:10px}.brand-mark{width:30px;height:34px;transform:rotate(-8deg);color:var(--blue);stroke-width:2.4}.brand-dot{color:var(--red)}.header-right{display:flex;gap:10px;align-items:center}.level-pill{border:1.5px solid var(--ink);border-radius:10px;background:var(--paper);height:43px;padding:0 13px;display:flex;align-items:center;gap:10px;box-shadow:0 3px 0 #243e3b20}.level-pill svg{width:19px;height:19px}.level-pill b{font-variant-numeric:tabular-nums;font-size:19px;font-weight:800}.level-pill span:not([data-icon]){font-size:12px;color:var(--muted);border-left:1px solid var(--line);padding-left:10px;font-weight:600}
#playfield{flex:1;min-height:0;width:100%;display:flex;align-items:center;justify-content:center;position:relative}
#board-wrap{position:relative;flex:none;border:2px solid var(--ink);border-radius:15px;padding:7px;background:#b69d79;box-shadow:0 7px 0 #a18d6b,0 11px 0 #243e3b10;overflow:hidden}#board{display:block;border-radius:6px;background:var(--paper);touch-action:none;outline-offset:-5px}
#toolbar{flex:none;display:flex;justify-content:center;align-items:center;gap:10px;padding:4px 0 2px;min-height:60px} .tool{width:49px;height:46px;border:1.5px solid #a9ad9b;border-radius:12px;background:#f6f0e2;box-shadow:0 3px 0 #a9ad9b70;position:relative;transition:background .12s,transform .1s}.tool:hover:not(:disabled){background:#fffaf0}.tool.active{background:#d3dfd0;border-color:var(--ink)}.tool.blue{background:var(--blue);color:white;border-color:#194c9c;box-shadow:0 3px 0 #194c9c}.tool.gold{background:#efc15b;border-color:#af8129;box-shadow:0 3px 0 #af8129}.separator{height:25px;border-left:1px solid #b9b7a5;margin:0 3px}.moves{font-variant-numeric:tabular-nums;display:flex;align-items:center;gap:7px;font-size:21px;font-weight:750;min-width:64px;justify-content:center}.moves svg{width:20px;height:20px;color:var(--muted)}
#lesson{min-height:30px;flex:none;display:flex;align-items:center;justify-content:center;gap:13px;opacity:.84}#lesson svg{height:24px;width:24px}#lesson .arrow{width:17px;opacity:.45}#lesson .blue{color:var(--blue)}#lesson .red{color:var(--red)}#lesson .drop{width:36px}.pip-strip{display:flex;gap:5px;align-items:center;margin-left:10px}.pip-strip i{width:5px;height:5px;border-radius:50%;background:#c2bda9}.pip-strip i.done{background:var(--sage)}.pip-strip i.now{background:var(--blue);width:15px;border-radius:4px}
.overlay{position:fixed;inset:0;z-index:4;background:#243e3b60;backdrop-filter:blur(5px);display:flex;align-items:center;justify-content:center;padding:18px}.dialog{width:min(610px,100%);max-height:100%;overflow:auto;background:var(--paper);border:2px solid var(--ink);border-radius:24px;padding:25px;box-shadow:0 9px 0 #243e3b30;position:relative}.dialog-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.dialog-head .badge{display:flex;gap:10px;align-items:center;font-size:23px;font-weight:800}.close{border:0;background:#e9e3d4;width:42px;height:42px;border-radius:50%}.picker-pages{display:flex;justify-content:center;align-items:center;gap:18px;margin-top:15px}.picker-pages b{min-width:95px;text-align:center;font-size:17px;font-variant-numeric:tabular-nums}.picker-pages svg{width:23px}.level-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px}.level-tile{height:75px;border:1.5px solid #b5b9a7;background:#eee8d9;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;position:relative;font-weight:800;font-size:22px}.level-tile.current{border:2px solid var(--blue);background:#e0e9ec}.level-tile.done{background:#dae1cd}.level-tile .tiny-stars{display:flex;gap:2px;height:10px}.tiny-stars svg{width:10px;height:10px;fill:var(--gold);color:#9a722f}.level-tile .piece-dots{height:10px;display:flex;gap:4px}.piece-dots i{width:5px;height:5px;border-radius:50%;background:var(--blue)}
#victory .dialog{width:310px;text-align:center;padding:30px 24px 26px;overflow:visible}#trophy{width:100px;height:100px;margin:0 auto 12px;color:var(--gold);stroke:var(--ink);stroke-width:1.1;fill:#eac066}.stars{display:flex;gap:7px;justify-content:center;margin:12px 0 18px}.stars svg{width:27px;height:27px;fill:#e9c468;stroke:#a3772b}.stars svg.empty{fill:transparent;stroke:#d6cbb1}.win-numbers{display:flex;justify-content:center;gap:7px;align-items:center;font-weight:800;font-size:24px;margin-bottom:22px}.win-numbers svg{width:21px}.win-numbers span{font-size:16px;color:var(--muted);padding-left:7px}.win-actions{display:flex;justify-content:center;gap:12px}.win-actions .next{width:92px}.win-actions .next svg{width:34px}#help .dialog{width:min(440px,100%);padding:22px}#help .dialog-head{margin-bottom:16px}.tutorial-label{font-size:13px;font-weight:750;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.tutorial-skip{border:0;background:transparent;min-width:44px;min-height:44px;padding:0 8px;text-decoration:underline;text-underline-offset:3px;font-size:14px}#tutorialGuide{display:block;width:100%;height:auto;background:#ece4d1;border-radius:14px}#tutorialTitle{font-size:25px;line-height:1.15;margin:20px 0 10px;letter-spacing:-.6px}#tutorialText{font-size:16px;line-height:1.5;margin:0;min-height:72px;color:#526052}.tutorial-actions{display:flex;align-items:center;gap:12px;margin-top:22px}.tutorial-actions button{min-height:46px;border-radius:12px;padding:0 19px;font-weight:700;border:1px solid #a9ad9b;background:var(--paper);box-shadow:0 3px 0 #a9ad9b70}.tutorial-actions #tutorialNext{margin-left:auto;background:var(--blue);color:white;border-color:#194c9c;box-shadow:0 3px 0 #194c9c;min-width:112px}.tutorial-dots{display:flex;gap:6px;margin:auto}.tutorial-dots i{width:6px;height:6px;border-radius:50%;background:#cbc6b4}.tutorial-dots i.current{width:18px;border-radius:4px;background:var(--blue)}
#hintButton.busy{opacity:.5}
@media(max-width:600px){#app{gap:9px;padding-left:12px;padding-right:12px}header{padding:3px 2px}h1{letter-spacing:-1.5px}.brand-mark{width:24px;height:29px}.header-right{gap:6px}.level-pill{padding:0 10px;gap:7px;height:41px}.level-pill span:not([data-icon]){padding-left:7px}#board-wrap{border-radius:12px;padding:5px;box-shadow:0 5px 0 #a18d6b,0 8px 0 #243e3b10}#toolbar{gap:8px}.tool{width:45px;height:45px}#lesson{gap:10px}.pip-strip{gap:4px;margin-left:0}.dialog{padding:20px}.level-grid{gap:7px}.level-tile{height:65px}.moves{min-width:46px;font-size:18px}.separator{margin:0}.dialog-head{margin-bottom:15px}}
@media(max-height:510px) and (min-width:600px){#app{display:grid;grid-template-columns:160px minmax(0,1fr);grid-template-rows:62px 1fr 40px;padding:12px 16px;gap:8px 14px}header{grid-column:1;grid-row:1;flex-direction:column;align-items:flex-start;gap:10px}h1{font-size:27px}.brand-mark{width:23px;height:26px}.level-pill{height:33px}.header-right{width:100%;justify-content:center}#playfield{grid-column:2;grid-row:1 / 4;height:100%}#toolbar{grid-column:1;grid-row:2;display:grid;grid-template-columns:repeat(2,46px);gap:11px;align-content:center;padding-top:35px}.moves{grid-column:1 / 3;order:-1}.separator{display:none}#lesson{grid-column:1;grid-row:3;gap:6px}#lesson svg{width:20px}.pip-strip{display:none}#board-wrap{padding:5px;border-radius:10px}#lesson .drop{width:25px}.dialog{padding:15px}.level-grid{grid-template-columns:repeat(10,1fr);gap:6px}.level-tile{height:62px}.dialog{width:min(730px,100%)}.dialog-head{margin-bottom:10px}#help .dialog{width:min(580px,100%);padding:15px 20px}#help .dialog-head{margin-bottom:6px}.tutorial-body{display:grid;grid-template-columns:1fr 1fr;align-items:center;gap:20px}#tutorialTitle{font-size:22px;margin-top:0}#tutorialText{font-size:15px;min-height:0}.tutorial-actions{margin-top:15px}#victory .dialog{padding:16px}#trophy{width:70px;height:70px}.stars{margin:5px 0 10px}.win-numbers{margin-bottom:12px}}
@media(max-width:600px){.pip-strip{width:113px;flex-wrap:wrap;justify-content:center;row-gap:5px}.pip-strip i.now{width:5px;outline:1px solid var(--blue);outline-offset:2px}}
@media(max-width:360px){#toolbar{gap:4px}.tool{width:44px;height:44px}.moves{min-width:34px;gap:3px;font-size:17px}.moves svg{width:17px}#lesson{gap:8px}.tutorial-actions{gap:8px}.tutorial-actions button{padding:0 14px}.tutorial-actions #tutorialNext{min-width:108px}.tutorial-dots{gap:4px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}

body{display:flex;flex-direction:column;height:100%;height:100dvh}
#app{width:100%;height:calc(100% - 44px - env(safe-area-inset-bottom,0px));flex:1;min-height:0;margin:0 auto}
.site-bar{flex:none;height:calc(44px + env(safe-area-inset-bottom,0px));padding:0 max(12px,env(safe-area-inset-right)) env(safe-area-inset-bottom,0px) max(12px,env(safe-area-inset-left));display:flex;align-items:center;justify-content:space-between;gap:8px;background:#f6f0e2;border-top:1px solid #cfc6b2;--feedback-ink:#243e3b;touch-action:manipulation}
.site-bar a{display:flex;align-items:center;min-height:44px;padding:0 10px;color:#243e3b;text-decoration:none;font-size:13px}.site-bar a:focus-visible{outline:2px solid #2869ce;outline-offset:-4px;border-radius:8px}
.site-name{font-size:12px;font-weight:700;color:#6b7365}.site-bar [data-feedback-mount]{display:inline-flex}
