:root{font-family:ui-rounded,'PingFang SC','Microsoft YaHei',sans-serif;color:#494b3d;background:#f4eee2;font-synthesis:none}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 0 70%,#e2e5d388,transparent 55%),radial-gradient(ellipse at 100% 0,#ead7c488,transparent 55%),#f4eee2}button,select,a{-webkit-tap-highlight-color:transparent}button,select{font:inherit;color:inherit}button,a,select{touch-action:manipulation}button{cursor:pointer}button:disabled{cursor:default}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #416f64;outline-offset:4px}button{border:1px solid #d8d2c1;background:#fffaf0;border-radius:12px;min-height:44px}a{color:inherit;text-decoration:none;display:inline-flex;align-items:center;min-height:44px}.workshop{max-width:1240px;margin:auto;padding:12px 38px;min-height:100svh;display:flex;flex-direction:column;gap:14px}.topbar{display:flex;justify-content:space-between;align-items:center;font-size:13px}.topbar>span{letter-spacing:2px;font-size:10px;color:#999783}.topbar button{padding:0 14px}.topbar a{font-weight:600}header{display:flex;align-items:center;justify-content:space-between;padding:6px 0}.eyebrow{font-size:10px;letter-spacing:2px;color:#8b8c75;margin:0 0 8px}h1{font-family:Georgia,'Songti SC',serif;font-weight:500;font-size:42px;letter-spacing:3px;margin:0}.title-star{color:#c18360;font-size:34px;margin-left:16px;display:inline-block;transform:rotate(12deg)}.subtitle{font-size:13px;color:#8c8c7e;margin:9px 0 0}.level-picker label{display:block;font-size:11px;color:#8b8c75;margin-bottom:8px}.level-picker select{border:1px solid #d6d0bd;background:#faf7ef;border-radius:12px;padding:0 12px;min-height:44px;min-width:155px}.play-layout{display:grid;grid-template-columns:minmax(0,1fr) 290px;gap:24px;flex:1;min-height:0}.loom{border:1px solid #ddd8c7;border-radius:24px;background:linear-gradient(135deg,#fffcf3bb,#ece9d9aa);box-shadow:inset 0 0 0 6px #fffcf344;position:relative;display:flex;flex-direction:column;overflow:hidden;min-height:360px}.scene-label{display:flex;justify-content:space-between;gap:8px;font-size:11px;color:#90917c;letter-spacing:.5px;padding:22px 24px}.scene-label b{color:#656954;font-weight:500}.wood-rail{height:12px;background:linear-gradient(#ccb498,#af9171);border-radius:10px;box-shadow:0 6px 10px #5c493b12;margin:10px 24px 0}.threads{display:flex;justify-content:center;align-items:flex-start;gap:18px;flex:1;padding:0 30px;min-height:220px}.cloth{flex:1;max-width:130px;min-width:0;text-align:center;position:relative;padding-top:33px}.cloth:before{content:'';position:absolute;top:-7px;left:calc(50% - 13px);width:26px;height:39px;border:5px solid #c0aa84;border-radius:13px;box-shadow:inset 1px 0 0 #fff6}.pull{width:100%;height:64px;position:relative;z-index:2;background:var(--yarn);border:0;border-radius:15px 15px 9px 9px;color:#fff9ee;box-shadow:inset 0 -5px 0 #00000010,0 5px 9px #67564017;transition:transform .18s,filter .18s;overflow:visible}.pull:before,.stripe:before{content:'';position:absolute;inset:0;border-radius:inherit;background:repeating-linear-gradient(98deg,transparent 0 4px,#fff3 4px 6px,transparent 6px 9px),repeating-linear-gradient(0deg,transparent 0 5px,#0000000d 5px 7px);pointer-events:none}.pull:hover:not(:disabled){transform:translateY(-4px);filter:brightness(1.06)}.pull .symbol{font-size:29px;position:relative;display:block;line-height:30px}.pull .color-name{font-size:10px;position:relative;text-shadow:0 1px 3px #0008}.pull:after{content:'';position:absolute;width:18px;height:16px;border:4px solid var(--yarn);border-bottom:0;border-radius:16px 16px 0 0;top:-14px;left:calc(50% - 9px)}.layers{border-radius:0 0 20px 20px;overflow:hidden;box-shadow:0 12px 20px #5a553410;min-height:3px}.stripe{background:var(--yarn);height:var(--stripe-height,20px);position:relative;border-bottom:2px solid #0000000c;color:#fff9;font-size:11px;line-height:var(--stripe-height,20px)}.cloth-count{font-size:10px;color:#9a9988;margin:16px 0 0;letter-spacing:1px}.empty-cloth{height:64px;border:1px dashed #c8c9b7;border-radius:15px;color:#abb099;display:flex;align-items:center;justify-content:center;font-size:25px}.loom-note{font-size:11px;color:#9b9b88;text-align:center;margin:20px 8px 22px}.loom-note span{margin-right:7px}.bench{display:flex;flex-direction:column;padding:15px 4px 4px}.bench-heading h2{font-family:Georgia,'Songti SC',serif;font-weight:500;margin:0;font-size:26px;letter-spacing:2px}.bench-heading>p:last-child{font-size:12px;color:#92917f;line-height:1.7;margin:8px 0 25px}.tray-caption,.progress-label{display:flex;justify-content:space-between;font-size:11px;color:#868976;margin-bottom:9px}.tray{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;margin-bottom:24px}.slot{height:49px;border-radius:12px;background:#e7e4d5;box-shadow:inset 0 2px 5px #6b624210;display:grid;place-items:center}.spool{background:var(--yarn);width:31px;height:35px;border-radius:45%;display:grid;place-items:center;color:#fff9ee;position:relative;box-shadow:inset -4px -2px 0 #0001;font-size:18px;animation:wind .3s ease-out}.spool:before{content:'';position:absolute;inset:2px;border-radius:45%;background:repeating-linear-gradient(25deg,transparent 0 4px,#fff4 4px 5px)}progress{width:100%;height:5px;appearance:none;border:0;border-radius:5px;background:#dedfcf}progress::-webkit-progress-bar{background:#dedfcf;border-radius:5px}progress::-webkit-progress-value{background:#839b73;border-radius:5px}progress::-moz-progress-bar{background:#839b73}#status{font-size:12px;line-height:1.7;min-height:41px;color:#7b806c;margin:17px 0}.restart{background:transparent;width:100%;font-size:12px}.rules{margin-top:auto;padding-top:22px}.rules h3{font-size:12px;font-weight:500;margin:0 0 10px}.rules p{font-size:11px;line-height:1.9;color:#92917f;margin:5px 0}.result{padding:12px;background:#e5ebda;border:1px solid #d6dfc8;border-radius:15px;margin:0 0 12px}.result h2{font-size:18px;margin:0}.result p{font-size:12px;line-height:1.6;margin:7px 0 10px}.primary{background:#667e60;color:#fffaf0;border:0;width:100%;font-size:13px}.flight{position:absolute;pointer-events:none;z-index:8;width:30px;height:30px;border-radius:50%;opacity:0;background:var(--yarn);box-shadow:0 0 0 5px #fff5}.flight.moving{animation:unwind .45s ease-in-out forwards}footer{display:flex;justify-content:space-between;color:#a19e8c;font-size:9px;letter-spacing:1px;padding:5px 0 3px}.fallback-fullscreen{position:fixed;inset:0;overflow:auto;z-index:9999;background:#f4eee2;max-width:none}.lost .slot{box-shadow:inset 0 0 0 1px #c5886d}.lost #status{color:#a2634c}[hidden]{display:none!important}@keyframes wind{from{transform:scale(.4) rotate(-90deg);opacity:0}to{transform:scale(1) rotate(0);opacity:1}}@keyframes unwind{0%{opacity:1;transform:translate(0,0) scale(1)}70%{opacity:1;transform:translate(70px,100px) scale(.7)}100%{opacity:0;transform:translate(110px,140px) scale(.3)}}
@media(min-height:850px) and (min-width:800px){.workshop{padding-top:25px;padding-bottom:25px;gap:22px}.threads{padding-top:22px}.loom-note{margin-bottom:35px}.bench{padding-top:30px}.cloth{max-width:140px}.pull{height:78px}}
@media(max-width:760px){.workshop{padding:8px 16px;gap:9px}.topbar>span{display:none}header{padding:2px 0}h1{font-size:29px}.eyebrow{font-size:8px;letter-spacing:1px}.title-star{font-size:23px;margin-left:8px}.subtitle{font-size:10px;margin-top:5px}.level-picker label{font-size:9px}.level-picker select{min-width:116px;font-size:12px;padding:0 6px}.play-layout{grid-template-columns:1fr;gap:12px}.loom{min-height:270px}.scene-label{padding:13px 16px;font-size:10px}.wood-rail{margin:0 16px}.threads{padding:0 18px;gap:12px;min-height:160px}.cloth{padding-top:27px;max-width:110px}.pull{height:53px}.pull .symbol{font-size:22px;line-height:26px}.pull .color-name{font-size:9px}.stripe{height:min(var(--stripe-height),12px);line-height:12px;font-size:8px}.cloth-count{margin:9px 0 0;font-size:9px}.loom-note{margin:10px 4px 12px;font-size:10px}.bench{padding:0 2px;display:grid;grid-template-columns:1fr auto;gap:0 14px}.bench-heading{display:none}.tray-caption{grid-column:1;font-size:10px;margin-bottom:6px}.tray{grid-column:1;margin:0;gap:5px}.slot{height:42px}.spool{height:31px;width:27px}.restart{grid-column:2;grid-row:1/3;width:90px;align-self:end;font-size:11px;height:47px}.progress-label{grid-column:1/3;margin:10px 0 5px;font-size:10px}progress{grid-column:1/3}#status{grid-column:1/3;min-height:0;font-size:11px;margin:8px 0 0}.rules{grid-column:1/3;padding-top:6px}.rules h3,.rules p:last-child{display:none}.rules p{font-size:10px;line-height:1.6;margin:0}.result{grid-column:1/3;grid-row:6;padding:10px;margin:10px 0 0;display:grid;grid-template-columns:1fr 100px;gap:5px}.result h2{font-size:16px}.result p{grid-column:1;font-size:10px;margin:0}.result button{grid-column:2;grid-row:1/3;align-self:center}footer{font-size:8px;letter-spacing:0}footer span:last-child{display:none}}
@media(max-height:650px) and (min-width:761px){.workshop{gap:6px;padding-top:4px;padding-bottom:4px}header{padding:0}h1{font-size:30px}.subtitle{margin-top:4px}.play-layout{gap:20px}.loom{min-height:290px}.scene-label{padding:12px 20px}.wood-rail{margin-top:0}.threads{min-height:150px}.stripe{height:min(var(--stripe-height),10px);line-height:10px;font-size:8px}.cloth-count{margin-top:8px}.loom-note{margin:10px 5px}.bench{padding-top:0}.bench-heading h2{font-size:22px}.bench-heading>p:last-child{margin:6px 0 12px}.tray{margin-bottom:12px}.rules{padding-top:9px}.rules p{font-size:10px}.rules p:last-child{display:none}#status{margin:9px 0;min-height:30px}footer{padding:0}.result{padding:8px}.result h2{font-size:15px}.result p{font-size:10px;margin:4px 0}}
@media(max-height:500px) and (orientation:landscape){.workshop{padding:4px 16px;gap:4px}.topbar{height:44px}.topbar>span{display:block}header{display:none}.play-layout{grid-template-columns:minmax(0,1fr) 240px;gap:16px}.loom{min-height:250px}.threads{min-height:150px}.stripe{height:min(var(--stripe-height),9px);line-height:9px}.bench{display:flex;padding-top:4px}.bench-heading{display:none}.tray{margin-bottom:10px}.slot{height:38px}.restart{width:100%;height:44px;flex-shrink:0;margin-top:6px}.progress-label{margin-top:0}.rules{padding-top:7px}.result{display:block;margin:6px 0}.result h2{font-size:14px}.result p{display:none}.result button{margin-top:5px}.loom-note{margin:8px}footer{padding:0}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}
/* A strand travels from the exposed loop all the way to its basket slot. */
.flight{position:fixed;z-index:10001;background:repeating-linear-gradient(20deg,#fff3 0 2px,transparent 2px 5px),var(--yarn)}.flight.moving{animation:reel-spool .55s ease-in-out forwards}.unwinding-thread{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:10000;overflow:visible;opacity:0}.unwinding-thread path{fill:none;stroke-width:3;stroke-linecap:round;stroke-dasharray:var(--length);stroke-dashoffset:0}.unwinding-thread.reeling{opacity:1}.unwinding-thread.reeling path{animation:reel-strand .55s ease-in-out forwards}@keyframes reel-spool{0%{opacity:1;transform:translate(0,0) scale(.7) rotate(0)}55%{opacity:1;transform:translate(var(--mx),var(--my)) scale(1) rotate(180deg)}90%{opacity:1;transform:translate(var(--dx),var(--dy)) scale(.9) rotate(320deg)}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.65) rotate(360deg)}}@keyframes reel-strand{0%{stroke-dashoffset:0;opacity:.8}85%{opacity:.8}100%{stroke-dashoffset:calc(-1 * var(--length));opacity:0}}
@media(max-height:500px) and (orientation:landscape){header{display:block;position:absolute;top:4px;left:50%;transform:translateX(-50%);z-index:10;padding:0}header>div:first-child,.level-picker label,.topbar>span{display:none}.level-picker select{min-width:125px;height:44px}.topbar{position:relative} }
@media(prefers-reduced-motion:reduce){.unwinding-thread,.flight{display:none!important}}
/* Readable working labels on warm paper; color names have solid paper tags. */
.subtitle,.level-picker label,.scene-label,.scene-label b,.cloth-count,.loom-note,.bench-heading>p:last-child,.tray-caption,.progress-label,#status,.rules p,footer{color:#555b47}
.pull .color-name{display:inline-block;color:#494b3d;background:#fffaf0;border-radius:4px;padding:1px 5px;line-height:12px;text-shadow:none}
.pull .symbol,.stripe,.spool{color:#000000}
.primary{background:#536c4e;color:#fffaf0}
.lost #status{color:#834c38}
.empty-cloth{color:#555b47}
.stripe>span,.spool>span{position:relative;z-index:1}
/* Short phones retain the entire puzzle and controls, including terminal states. */
@media(max-width:760px) and (max-height:650px) and (orientation:portrait){
.workshop{height:100svh;min-height:0;padding:6px 12px;gap:6px}
.topbar{height:44px;min-height:44px;flex-shrink:0}.topbar a{font-size:11px}.topbar button{font-size:11px;padding:0 8px}.topbar>span{display:none}
header{display:block;position:absolute;top:6px;left:50%;transform:translateX(-50%);z-index:10;padding:0}header>div:first-child,.level-picker label{display:none}.level-picker select{min-width:108px;max-width:112px;font-size:11px;height:44px}
.play-layout{min-height:0;grid-template-rows:minmax(220px,1fr) auto;gap:8px}.loom{min-height:220px;border-radius:18px}.scene-label{padding:9px 12px;font-size:9px}.wood-rail{height:8px;min-height:8px;margin:0 12px}.threads{padding:0 10px;gap:10px;min-height:0}.cloth{padding-top:20px}.cloth:before{height:30px;width:22px;left:calc(50% - 11px);border-width:4px}.pull{height:44px;min-height:44px;border-radius:10px 10px 6px 6px}.pull .symbol{font-size:19px;line-height:20px}.pull .color-name{font-size:9px;line-height:12px}.pull:after{height:11px;top:-10px;border-width:3px}.stripe{height:6px;line-height:6px;font-size:6px}.cloth-count{margin:6px 0 0;font-size:9px}.loom-note{margin:6px 0 7px;font-size:9px}.empty-cloth{height:44px}
.bench{gap:0 10px;padding:0}.tray-caption{margin-bottom:4px}.slot{height:39px}.spool{height:29px;width:25px}.restart{height:44px;min-height:44px;width:82px;font-size:10px}.progress-label{margin:7px 0 4px}#status{font-size:10px;line-height:1.5;margin:6px 0 0}.rules{padding-top:5px}.rules p{font-size:9px;line-height:1.45}.result{margin-top:7px;padding:7px;grid-template-columns:1fr 88px;gap:3px}.result h2{font-size:14px}.result p{font-size:9px;line-height:1.4}.result button{font-size:11px;min-height:44px}footer{display:none}
}
@media(max-width:760px) and (max-height:520px) and (orientation:portrait){.loom-note,.result p{display:none}.scene-label{padding:6px 12px}.play-layout{grid-template-rows:minmax(200px,1fr) auto}.loom{min-height:200px}.rules p{font-size:8px}.result h2{align-self:center}}

/* Optional quiet feedback and reversible, interruption-safe play. */
.workshop-actions{display:flex;gap:8px;margin-top:8px;grid-column:1/-1}.workshop-actions button{flex:1;min-height:44px;font-size:11px;padding:6px 8px}.workshop-actions button:disabled{opacity:.5}.workshop-actions button[aria-pressed="true"]{background:#466a57;color:#fff8e9}.tray.matched{animation:basket-match .48s ease-out}@keyframes basket-match{50%{transform:scale(1.025);filter:brightness(1.12)}}
@media(max-height:650px) and (max-width:760px) and (orientation:portrait){.workshop{height:auto;min-height:100svh}.workshop-actions{margin-top:6px}.workshop-actions button{min-height:44px}.rules{padding-top:3px}}
@media(prefers-reduced-motion:reduce){.tray.matched{animation:none}}
