@font-face{font-family:SUIT;src:url('./assets/SUIT-Regular.woff2')}@font-face{font-family:SUIT;src:url('./assets/SUIT-Bold.woff2');font-weight:700}:root{font-family:SUIT,'Malgun Gothic',sans-serif;color:#213c4c;background:#5ca2bc;font-synthesis:none;--navy:#213e58;--gold:#d8b66b;--paper:#fff8e9}*{box-sizing:border-box}body{margin:0;overflow:hidden}button{font:inherit;cursor:pointer;touch-action:manipulation}button:focus-visible,canvas:focus-visible{outline:3px solid #d58726;outline-offset:4px}button:disabled{cursor:default}button:active:not(:disabled){filter:brightness(.9)}[hidden]{display:none!important}#game,#world{width:100%;height:100dvh;display:block}#world{touch-action:none}#loading{position:absolute;inset:0;background:radial-gradient(ellipse at 50% 30%,#fbf4de,#d6e7db);display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;z-index:10}#loading h1{font-family:Georgia,'Malgun Gothic',serif;font-size:52px;letter-spacing:.16em;margin:17px 0 28px}#loading p{font-size:18px}#loading small{color:#5a6d6c}.compass{height:62px;width:62px;border:1px solid #af914d;border-radius:50%;display:grid;place-items:center}.compass i{width:18px;height:42px;background:linear-gradient(#be963d 50%,#22495f 50%);clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%);animation:turn 5s infinite linear}@keyframes turn{to{transform:rotate(360deg)}}#hud{position:absolute;inset:0;pointer-events:none}header{position:absolute;inset:22px 24px auto;display:flex;justify-content:space-between;align-items:flex-start;gap:20px}.location{position:relative;background:linear-gradient(110deg,#fffaecf2,#fffae2e8);border:1px solid #bea36c;border-radius:3px 19px 4px 17px;padding:13px 23px 12px;box-shadow:0 4px 16px #19334028}.location:before{content:'';position:absolute;left:7px;top:7px;bottom:7px;right:7px;border:1px solid #ccba8e6b;border-radius:2px 12px 3px 10px;pointer-events:none}.eyebrow{font-size:11px;letter-spacing:.2em;font-weight:700;color:#816329}.location h1{font-size:30px;margin:4px 0 7px;line-height:1}.location p{margin:0;font-size:14px}.location p:before{content:'▸';color:#a57e28;margin-right:7px}.brand{position:absolute;left:50%;transform:translateX(-50%);font-family:Georgia,SUIT,serif;letter-spacing:.2em;color:#fff7e4;text-align:center;font-size:22px;text-shadow:0 2px 5px #264a66;top:-3px}.brand span{display:block;font-family:SUIT;font-size:8px;letter-spacing:.3em;margin-top:6px}nav{display:flex;gap:8px;pointer-events:auto}.icon{width:48px;height:48px;border:1px solid #bdab7f;border-radius:8px;background:#fff8e9ed;color:var(--navy);box-shadow:0 3px 12px #12343e22}.icon svg{width:25px;height:25px;vertical-align:middle}.bottom{position:absolute;bottom:max(24px,env(safe-area-inset-bottom));left:27px;right:27px;display:flex;align-items:flex-end;justify-content:space-between}.move-wrap{pointer-events:auto;text-align:center;user-select:none}.move-wrap small{display:block;font-size:11px;color:white;text-shadow:0 1px 3px #203e48;margin-top:9px}#move-pad{width:126px;height:126px;border-radius:50%;border:1px solid #fff8dfb0;background:#fffdf024;box-shadow:0 3px 18px #2a444225;position:relative;touch-action:none;display:grid;place-items:center}#move-pad:before{content:'';position:absolute;inset:12px;border:1px solid #fff7df40;border-radius:50%}#move-pad span{width:47px;height:47px;background:#fff9dfaa;border:1px solid #fffbeccc;border-radius:50%;box-shadow:0 3px 8px #2b494a33;z-index:1}.arrow{position:absolute;border:6px solid transparent;opacity:.6}.up{top:3px;border-bottom-color:white}.down{bottom:3px;border-top-color:white}.left{left:3px;border-right-color:white}.right{right:3px;border-left-color:white}.primary{background:linear-gradient(#2c4d6b,#203950);color:#fff6dd;border:1px solid #dfbc72;box-shadow:inset 0 0 0 3px #2a4863,inset 0 0 0 4px #71828a,0 4px 16px #102c3c33;border-radius:6px 20px 6px 20px;min-height:54px;padding:13px 25px;font-weight:700;letter-spacing:.02em}.primary:disabled{background:#355267c9;color:#e9e6d6;box-shadow:inset 0 0 0 3px #42607080}#interact{pointer-events:auto;min-width:178px;margin-bottom:4px;font-size:18px;display:flex;align-items:center;justify-content:center;gap:18px}#interact span{font-size:11px;padding:3px 6px;border:1px solid #ccbb944d;border-radius:4px}.companion{position:absolute;bottom:0;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:9px;background:#233d4baf;color:#fff8e5;border:1px solid #dfc4868c;padding:5px 17px 5px 6px;border-radius:28px;backdrop-filter:blur(5px)}.companion small{font-size:8px;letter-spacing:.08em;display:block}.companion strong{font-size:14px}.otter-icon{width:32px;height:32px;display:grid;place-items:center;border-radius:50%;background:#ba9269;color:#f9e4c5;font-size:28px;border:2px solid #efdbab}#near-label{position:absolute;left:50%;top:42%;transform:translate(-50%,-50%);font-size:14px;background:#fff8e9e8;border:1px solid #d9bb71;padding:9px 20px;border-radius:24px;opacity:0;transition:opacity .3s;box-shadow:0 3px 12px #15394830}#toast{position:absolute;bottom:145px;left:50%;transform:translateX(-50%);background:#fff8e9f2;border:1px solid #d3b676;border-radius:8px;padding:12px 22px;max-width:min(470px,85vw);text-align:center;opacity:0;transition:opacity .4s;line-height:1.6;font-size:15px}dialog{border:1px solid #ccad65;background:var(--paper);color:#203c4b;border-radius:12px;box-shadow:0 20px 90px #112d4699;padding:30px;max-width:calc(100vw - 28px);max-height:calc(100dvh - 28px);overflow:auto}dialog::backdrop{background:#102c4355;backdrop-filter:blur(4px)}dialog h2{font-family:Georgia,SUIT,serif;font-size:28px;margin:9px 0 14px}dialog p{font-size:16px;line-height:1.7}.close{position:absolute;right:12px;top:10px;min-width:48px;min-height:48px;border:0;background:transparent;color:#506471;font-size:30px;z-index:1}.muted{font-size:13px;color:#617079}dl{display:grid;grid-template-columns:100px 1fr;gap:14px;font-size:14px;border-top:1px solid #dfd1af;padding-top:20px}dt{font-weight:700}dd{margin:0}#guide{width:530px}#workbench{width:830px;padding:25px 34px}.work-heading p{margin:0 0 14px;font-size:15px}.work-heading h2{margin-bottom:7px}.flags{display:grid;grid-template-columns:1fr 1.3fr;gap:30px;padding:18px 0 0;border-top:1px solid #d7c79f}.flags h3{font-size:13px;margin:0 0 15px;display:flex;justify-content:space-between;color:#4f6067;font-weight:700}.flag-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:5px;padding:8px;background:#e3d6b7;border:1px solid #c0aa7c;border-radius:2px;box-shadow:0 5px 0 #bcab86;min-height:49px}.patch{aspect-ratio:1;display:grid;place-items:center;font-family:Georgia,serif;font-size:23px;border:1px dashed #c5b28d;background:#f5ecd7;color:#9a8864}.patch.orange{background:#d99038;border:1px dashed #f6c381;color:#fff6d6;box-shadow:inset 0 0 0 3px #ce7d2d}.patch.blue{background:#31566f;border:1px dashed #8ba8b7;color:#e5f4ee;box-shadow:inset 0 0 0 3px #284a60}.patch.missing{outline:2px solid #b37539;outline-offset:1px}.reference{padding-right:12px}.reference p{text-align:center;font-size:15px;margin:14px 0 0}.creation{padding-left:22px;border-left:1px solid #d8cba8}.creation .flag-grid{gap:4px}.creation .patch{aspect-ratio:1.5}.ratio-readout{display:flex;justify-content:center;gap:20px;margin:12px 0 8px;font-size:22px!important;font-weight:700}.orange-text,#orange-count{color:#a35915}.blue-text,#blue-count{color:#254f70}#total{font-size:12px;color:#7e693f}.controls{display:flex;gap:22px;justify-content:center;margin:18px 0 13px}.counter{display:flex;align-items:center;gap:10px;background:#eee3cc;padding:5px 6px 5px 12px;border-radius:8px}.counter>span{font-size:13px;font-weight:700;margin-right:3px}.counter button{height:48px;width:48px;border:1px solid #bca575;background:#fffbef;border-radius:6px;font-size:25px;color:#29475a}.counter output{font-size:21px;min-width:20px;text-align:center}.counter.orange>span{color:#995019}.counter.blue>span{color:#234f70}#feedback{background:#f1e7d2;padding:12px 16px;border-left:3px solid #b89b5b;font-size:14px;line-height:1.6;min-height:49px}#feedback.success{background:#e2eadc;border-color:#799866}footer{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:15px}.text-button{background:transparent;border:1px solid #c8b58c;color:#405667;min-height:48px;padding:10px 15px;border-radius:6px;font-size:13px}#group-hint{padding:12px 0 0;font-size:13px}#group-hint div{display:flex;gap:12px;align-items:center;margin:5px 0}#group-hint b{letter-spacing:3px;border:1px dashed #b79f6c;padding:4px 9px}#group-hint p{font-size:12px;margin:5px 0}.mobile-break{display:none}@media(max-width:700px){header{inset:14px 14px auto;gap:8px}.location{padding:11px 15px}.location h1{font-size:24px}.location p{font-size:12px}.eyebrow{font-size:9px}.brand{display:none}nav{gap:5px}.icon{width:48px;height:48px}.bottom{left:17px;right:17px;bottom:max(20px,env(safe-area-inset-bottom))}#move-pad{width:112px;height:112px}.companion{bottom:7px;padding-right:10px;left:49%}.companion small{display:none}.companion strong{font-size:12px}.otter-icon{width:24px;height:24px;font-size:20px}#interact{min-width:132px;font-size:15px;padding:12px 16px}#interact span{display:none}#toast{bottom:150px;font-size:13px}.flags{gap:15px;grid-template-columns:1fr 1.2fr}.creation{padding-left:12px}.flags h3{font-size:11px;display:block;line-height:1.5}#total{display:block}#workbench{padding:23px 18px 18px}.work-heading h2{font-size:23px}.work-heading p{font-size:13px}.mobile-break{display:block}.controls{gap:8px}.counter{gap:5px;padding-left:5px;flex-wrap:wrap;justify-content:center;max-width:50%}.counter>span{width:100%;text-align:center;font-size:12px}.counter button{width:48px;height:48px}.counter output{min-width:18px}#feedback{font-size:12px;padding:10px}footer .primary{font-size:13px;padding:12px 18px}#group-hint b{letter-spacing:0;padding:5px}.patch{font-size:16px}.reference{padding-right:0}.reference p{font-size:12px}dialog{padding:24px 18px}dialog h2{font-size:24px}dialog p{font-size:14px}dl{grid-template-columns:80px 1fr;font-size:12px}}@media(max-height:600px){header{top:10px}.location{padding:9px 18px}.location .eyebrow{display:none}.location h1{font-size:24px}.bottom{bottom:12px}#move-pad{width:98px;height:98px}.move-wrap small{display:none}.flags{padding-top:12px}.work-heading p{font-size:13px}.work-heading h2{font-size:22px}.controls{margin:10px 0}.flag-grid{max-width:280px}.patch{aspect-ratio:2}.creation .patch{aspect-ratio:2.5}.flags h3{margin-bottom:8px}#workbench{padding:16px 25px}.work-heading .eyebrow{display:none}.reference p{margin-top:8px}#group-hint{font-size:12px}#toast{bottom:110px}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
/* Equal cloth pieces in the reference and the constructed flag. */
#workbench{--swatch:43px}.flag-grid{grid-template-columns:repeat(5,var(--swatch));width:max-content;gap:4px;max-width:none}.patch,.creation .patch{width:var(--swatch);height:var(--swatch);aspect-ratio:1}.reference p{text-align:left}.creation .flag-grid{gap:4px}.ratio-readout{width:251px}.reference{align-self:start}.flags{grid-template-columns:1fr 1fr}.creation{padding-left:20px}@media(max-width:700px){#workbench{--swatch:clamp(18px,4.4vw,27px)}.ratio-readout{width:auto}.creation{padding-left:10px}.flag-grid{padding:6px}.flags{gap:10px}}@media(max-height:600px) and (min-width:701px){#workbench{--swatch:32px}.ratio-readout{width:196px}}
/* Keep the harbor visible while retaining tablet-sized controls. */
@media(min-width:701px) and (min-height:601px){
 header .location{padding:10px 19px 11px;border-radius:3px 14px 3px 12px;background:linear-gradient(110deg,#fff7e8f7,#f7ebd2ed)}
 header .location h1{font-size:28px;margin:3px 0 8px}
 header .location .eyebrow{font-size:10px;letter-spacing:.16em}
 header .location p{font-size:13px;border-top:1px solid #c6ac7770;padding-top:6px}
}
#interact{border-radius:4px 17px 4px 17px;background:linear-gradient(145deg,#304e6c,#182f49);box-shadow:inset 0 0 0 3px #243c55,inset 0 0 0 4px #bd9c5f,0 4px 16px #102c3c45}
#interact:disabled{background:linear-gradient(145deg,#506471ed,#354b5ded);color:#f2e9d5;box-shadow:inset 0 0 0 3px #425566,inset 0 0 0 4px #b79b65a0}

/* 3D exploration: persistent route and direct camera controls. */
#world{cursor:grab}#world.orbiting{cursor:grabbing}#wayfinder{pointer-events:auto;position:absolute;right:24px;bottom:155px;display:flex;align-items:center;gap:12px;max-width:min(310px,48vw);min-height:68px;padding:12px 16px;border:1px solid #e2c47d;border-radius:7px;background:#173d50ed;color:#fff1c9;text-align:left;box-shadow:0 4px 16px #132a4040}#destination-arrow{display:block;font-size:31px;line-height:1;flex:none;color:#ffdb80;transform-origin:center}#wayfinder strong{display:block;font-size:14px;line-height:1.5}#wayfinder small{display:block;font-size:11px;color:#e5d5ae;margin-top:4px}#mission-label{position:absolute;transform:translate(-50%,-100%);padding:9px 15px;border:1px solid #d9b76c;border-radius:6px;background:#fff4dcea;color:#254b60;font-size:13px;font-weight:700;white-space:nowrap;box-shadow:0 3px 12px #123b4c30}#camera-tools{position:absolute;right:24px;bottom:120px;display:flex;gap:10px;align-items:center;color:#fff7dd;font-size:10px;text-shadow:0 1px 4px #123}#camera-tools button{pointer-events:auto;min-height:32px;border:1px solid #e0d1ac88;border-radius:4px;color:#fff6df;background:#234c5cd9;padding:5px 10px;font-size:11px}#camera-tools kbd{margin-left:5px;font-size:10px}#toast{bottom:auto;top:150px}#near-label{max-width:75vw;text-align:center}
@media(max-width:700px){#wayfinder{right:14px;bottom:167px;max-width:225px;padding:10px 12px;gap:8px;min-height:65px}#wayfinder strong{font-size:12px}#wayfinder small{font-size:10px}#camera-tools{right:14px;bottom:124px}#camera-tools>span{display:none}#camera-tools button{min-height:36px}#mission-label{font-size:11px;padding:7px 10px}#toast{top:132px;bottom:auto}}

@media(max-width:700px){#wayfinder{top:116px;bottom:auto;left:14px;right:14px;max-width:none;min-height:60px}#camera-tools button{min-height:44px}#toast{top:190px}}

/* Keep focus and viewport resizing from scrolling the game canvas out of view. */
html,body{height:100%;overflow:hidden}#game{position:fixed;inset:0}
