:root{--ink:#242038;--muted:#686176;--paper:#fff9e9;--line:#292237;--gold:#ffd05b;--red:#f47781;--yellow:#ffdc65;--blue:#8fa8ff;--green:#badd85;color-scheme:light;font-family:'Trebuchet MS',ui-rounded,system-ui,sans-serif;color:var(--ink);background:#000}*{box-sizing:border-box}body{margin:0;background:#000;color:var(--ink)}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;font-weight:700;cursor:pointer;border:2px solid var(--line);background:var(--paper);color:var(--ink);border-radius:12px;min-height:44px;padding:10px 14px;box-shadow:0 3px 0 var(--line);transition:background .12s,transform .12s,box-shadow .12s}button:hover:not(:disabled){background:#fff0b7;transform:translateY(-1px)}button:active:not(:disabled){transform:translateY(2px);box-shadow:0 1px 0 var(--line)}button:disabled{opacity:.45;cursor:default}button:focus-visible,a:focus-visible{outline:3px solid #ff9e4f;outline-offset:4px}[hidden]{display:none!important}.touch-only{display:none!important}html[data-input="touch"] .touch-only{display:flex!important}header{display:flex;align-items:center;justify-content:space-between;gap:20px;max-width:1220px;margin:auto;padding:24px 30px;color:#fff6df}.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:inherit}.brand-letters{display:flex;gap:3px}.brand-letters i{display:grid;place-items:center;width:32px;height:37px;font-style:normal;font-size:26px;font-weight:1000;color:#242038;border:2px solid #242038;border-radius:7px;box-shadow:0 3px 0 #fff4cb;font-family:'Arial Black',system-ui,sans-serif;transform:rotate(-5deg);background:#ffce61}.brand-letters i:nth-child(2n){background:#a9cbff;transform:rotate(5deg)}.brand-letters i:nth-child(3n){background:#f79dba;transform:rotate(-2deg)}.brand-letters i:nth-child(4n){background:#bbdd8b;transform:rotate(7deg)}.demo{font-size:9px;font-weight:900;letter-spacing:1px;border:1px dashed #d2c6a5;border-radius:6px;padding:5px;transform:rotate(-8deg)}.language{display:flex;flex-direction:column;gap:6px;margin-left:auto}.language>span{font-size:11px;color:#e6d9bf}#languages,.guide-languages{display:flex;gap:5px}.language-button{padding:5px;min-height:34px;display:flex;align-items:center;gap:4px;box-shadow:none;border:2px solid transparent;border-radius:7px;background:#252232;color:#fff}.language-button img{width:23px;height:16px;object-fit:cover}.language-button span{font-size:9px}.language-button[aria-pressed="true"]{border-color:#ffce61;background:#403a26}.language-button:hover:not(:disabled){background:#51435c}.quiet{background:transparent}.quiet:hover:not(:disabled){background:#f2dfc6}#rulesBtn{background:#fff4d8;transform:rotate(2deg);font-size:13px}main{max-width:1180px;margin:auto;padding:20px 30px 0}.intro{display:flex;justify-content:space-between;align-items:center;gap:24px;margin:0 0 30px;color:#fff8e8}.eyebrow{font-size:10px;font-weight:900;letter-spacing:1.6px;margin:0 0 8px;color:var(--muted)}.intro .eyebrow{color:#ffce61}h1,h2{font-family:'Trebuchet MS',ui-rounded,system-ui,sans-serif;font-weight:900;line-height:1.1}h1{font-size:clamp(30px,4vw,48px);letter-spacing:-1.7px;margin:0 0 12px;color:#fff5dc}h1:after{content:'✦';display:inline-block;color:#f7a0bd;font-size:.75em;margin-left:12px;transform:rotate(12deg)}h2{font-size:24px;margin:0;letter-spacing:-.6px}.intro p:last-child{margin:0;color:#cfc1b0;font-size:14px}.journey{display:flex;align-items:center;gap:10px}.step{width:46px;height:46px;padding:5px;border-radius:14px;background:#3e354a;color:#fff;font-size:18px;box-shadow:0 3px 0 #9e82b8}.step.current{background:#ffcf60;color:#242038;transform:rotate(-7deg);box-shadow:0 4px 0 #aa783b}.step.done{background:#badd85;color:#242038}.journey-line{width:18px;border-top:3px dotted #b19aa7}.game-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:28px;align-items:start}.board-panel{background:#d7e7a6;border:3px solid var(--line);border-radius:24px;box-shadow:0 7px 0 #738553;overflow:hidden;position:relative}.board-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:20px 22px 16px}.board-heading .eyebrow{color:#4f5c36;font-size:9px}.fruit-badge{background:#fff7de;border:2px solid var(--line);border-radius:12px;box-shadow:2px 3px 0 #a2b36f;padding:9px 12px;font-size:13px;font-weight:900;white-space:nowrap;transform:rotate(3deg)}.board-wrap{padding:0 14px;max-width:680px;margin:auto}#board{position:relative;width:100%;aspect-ratio:1;border:3px solid var(--line);border-radius:9px;background:#fff;isolation:isolate;overflow:hidden}#boardArt,#overlay,#grid{position:absolute;inset:0;width:100%;height:100%}#boardArt{pointer-events:none}#overlay{pointer-events:none;z-index:2;overflow:visible}#grid{display:grid;grid-template-columns:repeat(8,1fr);grid-template-rows:repeat(8,1fr);z-index:3}.cell{padding:0;min-height:0;border:0;border-radius:0;background:transparent!important;box-shadow:none!important;transform:none!important}.cell:focus-visible{outline:3px solid #ec9629;outline-offset:-4px}#board,#grid,.cell{touch-action:none;user-select:none;-webkit-user-select:none}.board-footer{display:flex;justify-content:space-between;gap:10px;padding:14px 22px;font-size:11px;color:#4b5833;font-weight:800}aside{display:grid;gap:18px}.tool-panel{background:#e1d1f2;border:3px solid var(--line);border-radius:22px;padding:22px;box-shadow:0 7px 0 #8e73a9;position:relative}.tool-panel>.eyebrow{display:inline-block;background:#ffdb74;border:2px solid var(--line);border-radius:6px;padding:6px 9px;transform:rotate(-3deg);margin:-38px 0 17px;color:#4d3b24;letter-spacing:1px}.tool-panel h2{font-size:25px}.muted{font-size:12px;line-height:1.5;color:#5f516e;margin:12px 0 18px}#tray{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}.piece-button{height:82px;min-width:0;padding:7px 4px;background:#fffaf0;border:2px solid #625470;border-radius:12px;box-shadow:0 4px 0 #ae97c3;position:relative}.piece-button:nth-child(2n){transform:rotate(2deg)}.piece-button svg{width:100%;height:100%;overflow:visible}.piece-button.active{background:#ffe69c;border-color:#30243e;outline:3px solid #ffb84d;outline-offset:2px;transform:translateY(-3px)}.piece-button.placed:after{content:'✓';position:absolute;right:2px;top:1px;background:#3d7144;color:#fff;border-radius:50%;width:17px;height:17px;font-size:12px;text-align:center}.rotation-help{font-size:11px;color:#60516e;line-height:1.45;margin:16px 0 8px}.selected-label{font-size:12px;font-weight:800;min-height:32px;margin:10px 0;line-height:1.4}.transform{display:flex;gap:8px}.transform button{flex:1;min-width:0;min-height:61px;font-size:27px;display:flex;align-items:center;justify-content:center;gap:7px;padding:8px;background:#ffce61}.transform button:nth-child(2){background:#9ed7e3}.transform button span{font-size:15px}.transform #confirm{background:#b8df83}.transform button:hover:not(:disabled){filter:brightness(1.06)}.placement-help{font-size:10px;line-height:1.5;color:#675874;margin:12px 0 0}.clear-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:16px}.clear-actions button{font-size:11px;padding:8px;min-height:42px}.clear-actions #undo{grid-column:1/-1;background:#fff7e6}.clear-actions #clear{background:#f6b6b8}.clear-actions #remove{background:#e9dcf6}.wide{width:100%}#feedback{min-height:22px;color:#e2d3bf;font-size:13px;line-height:1.5;margin:20px 0 0}#feedback.error{color:#ff9ea3}#feedback:empty{display:none}footer{display:flex;justify-content:space-between;gap:15px;padding:24px 0;color:#ad9eb3;font-size:10px}dialog{max-width:680px;width:calc(100% - 24px);max-height:94dvh;overflow:auto;padding:26px;border:3px solid var(--line);border-radius:24px;background:#fff8e8;color:var(--ink);box-shadow:0 8px 0 #a58653,0 20px 100px #0008}dialog::backdrop{background:#000c}dialog h2{font-size:27px}dialog p{font-size:14px;line-height:1.6}.guide-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px}.guide-top .eyebrow{margin:0;color:#806348;white-space:nowrap}.guide-languages .language-button span{display:none}.guide-languages .language-button{background:#f0e3ce}.guide-languages .language-button[aria-pressed="true"]{background:#ffe8a6;border-color:#b77c1a}#guideTitle{outline:none;margin-bottom:18px}.guide-visual{text-align:center;background:#eee3cc;border:2px dashed #c5b18c;border-radius:16px;padding:12px}#guideImage{display:block;max-width:100%;width:auto;height:min(34dvh,310px);margin:auto;object-fit:contain;border-radius:8px;background:white}#guideControlsArt{height:min(25dvh,210px);display:grid;place-items:center;font-size:64px;color:#71578e}#guideDescription{min-height:66px;margin:16px 0 12px}#animationToggle{font-size:11px;min-height:32px;padding:5px 9px;box-shadow:none}.guide-actions{position:sticky;bottom:-26px;background:#fff8e8;padding:14px 0 3px;margin-top:8px}.guide-navigation{display:flex;gap:10px;margin-bottom:12px}.guide-navigation button{flex:1}.primary{background:#ffce61;font-weight:900;min-height:48px}#guideExit{background:#badd85}#win{text-align:center;max-width:440px}.win-art{font-size:72px;color:#e9a32d;text-shadow:3px 3px 0 #55366f}#stay{margin-top:12px}html[data-input="touch"] .transform{flex-wrap:wrap}html[data-input="touch"] #confirm{flex-basis:100%}
@media(max-width:900px){header{padding:18px 20px;gap:12px}.brand-letters i{width:26px;height:33px;font-size:23px}.language-button span{display:none}main{padding:14px 18px 0}.game-layout{grid-template-columns:minmax(0,1fr) 280px;gap:18px}.tool-panel{padding:18px}.board-heading{padding:15px 14px}.board-wrap{padding:0 9px}.fruit-badge{font-size:11px;padding:7px}.transform button span{font-size:13px}}
@media(max-width:700px){body{padding-bottom:256px}header{padding:13px 12px 10px;flex-wrap:wrap;gap:12px}.brand-letters i{width:25px;height:29px;font-size:21px;border-radius:5px}.brand-letters{gap:2px}.demo{font-size:8px}#rulesBtn{margin-left:auto;font-size:11px;min-height:38px;padding:7px 10px}.language{order:3;width:100%;margin:0;flex-direction:row;justify-content:space-between;align-items:center;gap:8px}.language>span{font-size:10px}.language-button{min-height:30px;padding:4px}.language-button img{width:23px;height:16px}#languages{gap:7px}main{padding:6px 8px 0}.intro{margin:5px 4px 15px;gap:8px;align-items:center}.intro .eyebrow,.intro p:last-child{display:none}h1{font-size:24px;letter-spacing:-.8px;margin:0;max-width:210px}h1:after{display:none}.journey{gap:4px;flex-shrink:0}.step{width:30px;height:32px;min-height:32px;border-radius:9px;font-size:13px}.journey-line{width:6px;border-top-width:2px}.game-layout{display:block}.board-panel{border-radius:17px;border-width:2px;box-shadow:0 5px 0 #738553}.board-heading{padding:12px 10px 10px}.board-heading h2{font-size:21px}.board-heading .eyebrow{font-size:8px;letter-spacing:1px;margin-bottom:5px}.board-wrap{padding:0 5px;max-width:520px}#board{border-width:2px;border-radius:6px}.board-footer{font-size:10px;padding:9px 12px}.fruit-badge{padding:6px;font-size:10px}aside{margin:0}.tool-panel{position:fixed;bottom:0;left:0;right:0;z-index:10;border:2px solid var(--line);border-radius:20px 20px 0 0;box-shadow:0 -5px 0 #0008;padding:10px 12px calc(8px + env(safe-area-inset-bottom));background:#e1d1f2}.tool-panel>.eyebrow,.tool-panel>h2,.tool-panel>.muted,.placement-help{display:none}#tray{max-width:520px;margin:auto;gap:9px}.piece-button{height:53px;padding:4px;box-shadow:0 2px 0 #ae97c3;border-radius:10px}.selected-label{min-height:16px;font-size:10px;margin:7px 0 6px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rotation-help{max-width:520px;font-size:10px;text-align:center;line-height:1.2;margin:6px auto 0}.transform,html[data-input="touch"] .transform{max-width:520px;margin:auto;flex-wrap:nowrap;gap:7px}.transform button{min-height:48px;font-size:23px;gap:4px;padding:5px}.transform button span{font-size:12px}.transform #confirm,html[data-input="touch"] #confirm{flex-basis:0}.clear-actions{max-width:520px;margin:8px auto 0;grid-template-columns:1fr 1fr 1fr;gap:6px}.clear-actions #undo{grid-column:auto}.clear-actions button{font-size:10px;padding:4px;min-height:34px;border-radius:8px;box-shadow:0 2px 0 var(--line)}#feedback{font-size:11px;margin:13px 4px 0}footer{font-size:9px;padding:14px 4px;flex-direction:column;gap:5px}#rules{padding:16px;max-height:96dvh}.guide-top{gap:8px;flex-wrap:wrap;margin-bottom:14px}.guide-languages{margin-left:auto;gap:3px}.guide-languages .language-button{padding:3px}.guide-languages .language-button img{width:20px;height:14px}#guideTitle{font-size:22px}.guide-visual{padding:6px}#guideImage{height:min(29dvh,240px)}#guideDescription{font-size:12px;line-height:1.5;min-height:0}.guide-actions{bottom:-16px;padding-top:10px}.guide-navigation button{font-size:12px;min-height:42px}#guideExit{min-height:44px}}
@media(max-width:360px){.brand-letters i{width:22px;font-size:19px}.brand{gap:6px}#languages{gap:4px}h1{font-size:21px}.transform button span{font-size:11px}.clear-actions button{font-size:9px}}
@media(max-height:520px) and (min-width:701px){header{padding-top:10px;padding-bottom:10px}main{padding-top:0}.intro{margin-bottom:15px}.board-wrap{max-width:430px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}

/* Motion decorates the tray only; board geometry stays still and precise. */
.fx-particle{pointer-events:none;z-index:1000;display:block;will-change:transform,opacity}
.fx-ring{position:absolute;z-index:4;border:4px solid;border-radius:50%;pointer-events:none;will-change:transform,opacity}
.piece-button:not(.placed):not(.active) svg{animation:tile-sway 3.8s ease-in-out infinite;transform-origin:50% 65%}
.piece-button:nth-child(2n) svg{animation-delay:-1.2s!important}.piece-button:nth-child(3n) svg{animation-delay:-2.4s!important}
.piece-button:hover svg,.piece-button:focus-visible svg{animation-play-state:paused}
@keyframes tile-sway{0%,100%{transform:rotate(-2deg) translateY(0)}50%{transform:rotate(2deg) translateY(-2px)}}
#feedback{position:relative;border:2px solid #292237;border-radius:18px 18px 18px 5px;background:#d7efb0;color:#242038;padding:14px 18px;box-shadow:0 4px 0 #678347;line-height:1.45;font-weight:700}
#feedback.error{background:#ffd1df;color:#69253e;box-shadow:0 4px 0 #a44c6c;border-color:#69253e}
#win{overflow:hidden;border:3px solid #7b509b;background:#fff8e8}#win .win-art{color:#f3b733}

@media(prefers-reduced-motion:reduce){.piece-button svg{animation:none!important}.fx-particle,.fx-ring{display:none}}

/* A single inline explanation, beside the board, without routine status chatter. */
#feedback{margin:0 14px 16px;padding:12px 14px;font-size:13px;box-shadow:none;border-radius:12px;line-height:1.45}
.board-footer{justify-content:flex-end;padding-block:8px}
footer{justify-content:center}footer>span:empty{display:none}
@media(max-width:700px){#feedback{margin:0 7px 10px;padding:9px 10px;font-size:12px}}

.ghost-sprite{transform-origin:50px 55px}.ghost-sprite.awake{animation:ghost-sway 2.8s ease-in-out infinite}.ghost-sprite.caught{animation:none;transform:none}
@keyframes ghost-sway{0%,100%{transform:translateX(-1.5px) rotate(-3deg)}50%{transform:translateX(1.5px) rotate(3deg)}}
@media(prefers-reduced-motion:reduce){.ghost-sprite.awake{animation:none}}

.fruit-sprite{transform-origin:50px 90px}.fruit-sprite.bouncing{animation:fruit-bounce 2.4s infinite}.fruit-sprite.collected{animation:none;transform:none}
@keyframes fruit-bounce{0%,12%,100%{transform:translateY(0);animation-timing-function:ease-out}48%{transform:translateY(-4px);animation-timing-function:ease-in}84%{transform:translateY(0);animation-timing-function:ease-out}90%{transform:translateY(0) scale(1.025,.975)}}
@media(prefers-reduced-motion:reduce){.fruit-sprite.bouncing{animation:none}}

#board,#grid,.cell{touch-action:pan-y pinch-zoom}#board.piece-selected,#board.piece-selected #grid,#board.piece-selected .cell{touch-action:none}
.diamond-sprite.sparkling{animation:diamond-shine 2.7s ease-in-out infinite}.diamond-glint{animation:diamond-glint 2.7s ease-in-out infinite;transform-origin:72px 26px}.diamond-sprite.collected{animation:none}
@keyframes diamond-shine{0%,100%{opacity:1}50%{opacity:.65}}
@keyframes diamond-glint{0%,100%{opacity:0;transform:scale(.3)}45%,60%{opacity:1;transform:scale(1)}}
#languageStart{max-width:450px}#startLanguages{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:24px}#startLanguages button{display:flex;align-items:center;gap:12px;min-height:58px}#startLanguages img{width:32px;height:23px;object-fit:cover}
@media(prefers-reduced-motion:reduce){.diamond-sprite.sparkling,.diamond-glint{animation:none}}
/* Direct manipulation and interactive practice. */
#tray,#lessonTray{touch-action:none;user-select:none}
#tray .piece-button,#lessonTray .piece-button{touch-action:none;cursor:grab}
#tray .piece-button:active,#lessonTray .piece-button:active{cursor:grabbing}
.invalid-preview{animation:invalid-pulse .85s ease-in-out infinite}
@keyframes invalid-pulse{0%,100%{opacity:1}50%{opacity:.32}}
.invalid-x{paint-order:stroke;pointer-events:none}
#rules{max-width:650px}
#lessonBoard{position:relative;aspect-ratio:1;width:min(100%,360px);margin:12px auto;background:#fff;isolation:isolate;touch-action:pan-y pinch-zoom}
#lessonArt,#lessonGrid{position:absolute;inset:0;width:100%;height:100%}
#lessonArt{pointer-events:none}
#lessonGrid{display:grid;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(5,1fr)}
#lessonBoard .cell{touch-action:pan-y pinch-zoom}
#lessonBoard.piece-selected,#lessonBoard.piece-selected .cell{touch-action:none}
#lessonTray{display:flex;justify-content:center;gap:12px}
#lessonTray .piece-button{width:78px;height:72px;transform:none}
.lesson-tools{display:flex;justify-content:center;gap:10px;margin:14px 0}
.lesson-tools button{min-height:48px}
#lessonFeedback{min-height:40px;text-align:center;font-size:14px;font-weight:700;color:#6d526b;margin:8px 0}
#lessonFeedback.solved{color:#346c33;background:#e1f0ca;border-radius:10px;padding:10px}
#guideDescription{min-height:0;margin:8px 0;font-size:14px;line-height:1.45}
#rules .guide-actions{position:static;padding:8px 0;margin:0}
@media(max-width:600px){#rules{padding:16px;max-height:96dvh}#lessonBoard{width:min(100%,32dvh)}#guideTitle{font-size:22px;margin-bottom:10px}.lesson-tools{margin:10px 0}#lessonTray .piece-button{height:62px;width:70px}.guide-top{margin-bottom:10px}}
@media(prefers-reduced-motion:reduce){.invalid-preview{animation:none;opacity:.7}}

#contactExamples{display:flex;gap:12px;margin:10px 0}#contactExamples figure{flex:1;margin:0;padding:8px;border:2px solid #b94753;border-radius:12px;background:#fff1ed;text-align:center}#contactExamples svg{height:125px;max-width:100%;display:block;margin:auto}#contactExamples figcaption{font-size:12px;line-height:1.4;font-weight:700;color:#842b38}

#edgeExample{display:flex;align-items:center;gap:16px;background:#eef5dd;border:2px solid #6a8d4d;border-radius:12px;padding:10px;margin:10px 0}#edgeExample svg{width:110px;height:105px;flex-shrink:0}#edgeExample p{font-size:13px;line-height:1.4;margin:0}
