.boot-loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #f8f2e6 url('../assets/landscape-design/paper-landscape.webp') center / cover;
}

.boot-loader-tray {
  display: flex;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid #c8d3c2;
  border-radius: 20px;
  background: #e9eee1;
}

.boot-loader-tray span {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(#acb7a2, #cdd5c4);
}

.boot-loader-tray span::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(from -45deg, var(--light) 0 25%, var(--right) 25% 50%, var(--dark) 50% 75%, var(--left) 75%);
  box-shadow: inset 0 0 0 1px #29372b1c;
  animation: boot-bead-lift 1.8s ease-in-out infinite;
}

.boot-loader-tray span:nth-child(1) { --light:#a8ba9d; --right:#799172; --dark:#4d6b54; --left:#86a183; }
.boot-loader-tray span:nth-child(2) { --light:#f5c49b; --right:#d68d67; --dark:#af6646; --left:#e6a882; }
.boot-loader-tray span:nth-child(3) { --light:#a0bbc1; --right:#6d939f; --dark:#4b6d7a; --left:#84a9af; }
.boot-loader-tray span:nth-child(2)::before { animation-delay: .3s; }
.boot-loader-tray span:nth-child(3)::before { animation-delay: .6s; }

@keyframes boot-bead-lift {
  0%, 45%, 100% { transform: translateY(0); }
  22% { transform: translateY(-14px); filter: brightness(1.12); }
}

@media (max-aspect-ratio: 4/5) {
  .boot-loader { background-image: url('../assets/landscape-design/paper-landscape-portrait.webp'); }
}

@media (prefers-reduced-motion: reduce) {
  .boot-loader-tray span::before { animation: none; }
}
:root{--game-font:Arial,Helvetica,sans-serif;font-family:var(--game-font);color:#293f35;background:#f7f3eb;font-synthesis:none;--ink:#293f35;--muted:#697667;--green:#506c50;--line:#c5c6b8;--paper:#fcfaf4}*{box-sizing:border-box}body{margin:0;min-width:320px;min-height:100dvh;background:#f7f3eb}button,input{font:inherit}button{cursor:pointer;color:var(--ink);-webkit-tap-highlight-color:transparent}button:disabled{cursor:default;opacity:.42}button:focus-visible,a:focus-visible,canvas:focus-visible,input:focus-visible{outline:3px solid #c48b65;outline-offset:3px}button:not(:disabled):hover{filter:brightness(1.045)}button:not(:disabled):active{transform:translateY(1px)}[hidden]{display:none!important}h1,h2,p{margin:0}h1{font-size:clamp(32px,4.7vw,68px);letter-spacing:-1.5px;line-height:1.12}h2{font-size:24px}.icon{width:23px;height:23px;flex:none;vertical-align:middle}.icon-button{width:44px;height:44px;border:1px solid var(--line);border-radius:12px;background:#f7f4eb;display:inline-flex;align-items:center;justify-content:center;padding:10px}.button{min-height:52px;border:1px solid var(--line);border-radius:30px;background:#f8f6ee;display:inline-flex;justify-content:center;align-items:center;gap:10px;padding:13px 25px;font-size:18px;text-decoration:none;line-height:1.25}.button.primary{color:#fffdf6;background:linear-gradient(#5a7556,#466348);border-color:#486448;font-weight:600}.text-button{min-height:44px;background:none;border:0;padding:10px 14px}.app-header{height:88px;padding:0 4%;background:#faf7f0eF;border-bottom:1px solid #deded1;display:flex;align-items:center;justify-content:space-between;gap:12px}.header-left,.header-right{display:flex;align-items:center;gap:16px}.header-right{gap:12px}.wordmark{border:0;background:none;font-size:25px;font-weight:600;padding:10px 0}.header-level{font-size:17px;color:var(--muted);padding-left:20px;border-left:1px solid var(--line)}.app-header [data-action=pause],.header-level{display:none}.is-game .app-header [data-action=pause],.is-game .header-level{display:inline-flex}.is-game .app-header [data-action=settings]{display:none}.is-home .app-header [data-action=back]{display:none}.screen{min-height:calc(100dvh - 88px)}.screen-home{display:grid;place-items:start center}.home-content{text-align:center;padding:118px 20px 70px;width:100%;max-width:680px}.home-emblem{width:190px;height:115px;margin-bottom:24px}.home-content h1{font-weight:600}.subtitle{font-size:20px;line-height:1.5;color:var(--muted);margin-top:24px}.home-actions{display:flex;flex-direction:column;gap:20px;width:min(380px,100%);margin:52px auto 0}.home-save{font-size:16px;color:var(--muted);margin-top:30px;min-height:20px}.home-content .text-button{margin-top:14px}.prototype-note{font-size:12px;color:#63735d;margin-top:20px}.screen-game{padding:42px 5% 58px}.game-layout{max-width:1240px;margin:0 auto;display:grid;grid-template-columns:minmax(0,700px) minmax(350px,440px);gap:48px;align-items:start}.field-column{min-width:0}.field-frame{width:100%;height:min(65vh,650px);border:1px solid #a7b39c;box-shadow:0 2px 7px #3a4b3010;overflow:hidden;background:#f7f3eb}.field-frame canvas{display:block;width:100%;height:100%;touch-action:none;user-select:none;cursor:default}.field-frame canvas:active{cursor:default}.tray-column{min-width:0;padding-top:6px}.desktop-level h2{font-size:30px}.save-status{font-size:14px;color:var(--muted);margin-top:15px}.instruction{padding:25px 21px;border:1px solid #d2d9c3;border-radius:16px;background:#e6ead9;box-shadow:0 4px 7px #263b2d10;font-size:16px;line-height:1.6;margin-top:34px}.tray-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:40px 8px 18px}.tray-heading h2{font-size:23px}.tray-heading span{font-size:13px;color:var(--muted);white-space:nowrap}.tray-frame{border:1px solid #b9c4ab;border-radius:14px;background:#e2e7d9;padding:0;overflow:visible}.tray-frame canvas{display:block;width:100%;aspect-ratio:6/1.13;touch-action:manipulation}.tray-hint{font-size:15px;line-height:1.6;color:#526047;text-align:center;background:#f7f3ebed;border-radius:15px;padding:5px 10px;margin:25px auto 0;max-width:350px}.mobile-save{display:none}#flight{position:fixed;inset:0;width:100vw;height:100dvh;pointer-events:none;z-index:20}.screen-collection{padding:45px 24px 70px;text-align:center}.screen-collection h1{font-size:34px}.screen-collection .subtitle{margin-top:14px;font-size:16px}.collection-grid{display:flex;justify-content:center;margin-top:35px}.level-card{width:300px;max-width:100%;border:1px solid var(--line);border-radius:18px;background:var(--paper);box-shadow:0 4px 7px #263b2d16;padding:16px}.level-placeholder{height:224px;border-radius:12px;background:#e8e9df;display:grid;place-items:center;overflow:hidden}.level-placeholder img{width:100%;height:100%;object-fit:contain}.neutral-mosaic{display:grid;grid-template-columns:27px 27px;gap:6px}.neutral-mosaic i{height:27px;border-radius:6px;background:#b3c2a3}.neutral-mosaic i:nth-child(2){background:#829d83}.neutral-mosaic i:nth-child(3){background:#8da9b3}.neutral-mosaic i:nth-child(4){background:#c58b67}.level-card h2{font-size:21px;text-align:left;margin-top:20px}.level-card p{text-align:left;font-size:14px;color:var(--muted);margin:10px 0 20px}.level-card .button{width:100%}.level-card .text-button{display:block;width:100%;font-size:14px}.screen-victory{max-width:1250px;margin:0 auto;padding:65px 25px 70px;display:grid;grid-template-columns:minmax(0,630px) minmax(320px,1fr);gap:65px;align-items:center}.victory-art img{display:block;width:100%;aspect-ratio:1}.victory-copy{text-align:center}.victory-copy h1{font-size:36px;letter-spacing:-.8px;margin-top:32px;white-space:nowrap}.victory-copy p{font-size:20px;color:var(--muted);margin:25px 0 60px}.victory-mark,.pause-mark{display:inline-grid;place-items:center;background:#a6b28b;border-radius:18px;width:64px;height:64px;color:white}.victory-mark .icon{width:35px;height:35px}.victory-copy .button{display:flex;margin:18px auto;width:100%;max-width:380px}.modal-shade{position:fixed;inset:0;z-index:100;background:#28372c66;backdrop-filter:blur(1.3px);display:flex;justify-content:center;align-items:center;padding:24px;overflow:auto}.dialog{position:relative;flex:none;width:min(490px,100%);max-height:calc(100dvh - 48px);overflow:auto;border:1px solid var(--line);border-radius:24px;background:var(--paper);box-shadow:0 6px 22px #263b2d20;padding:50px 30px 28px;text-align:center}.dialog>.icon-button{position:absolute;right:15px;top:15px}.dialog h2{font-size:30px;letter-spacing:-.6px;margin:20px 0 36px;line-height:1.15}.dialog-body{display:flex;flex-direction:column;gap:15px}.dialog-body p{font-size:16px;line-height:1.65}.dialog .button{width:100%;font-size:17px;min-height:52px}.dialog .muted{color:var(--muted);font-size:14px}.dialog-footnote{font-size:12px!important;color:var(--muted);padding-top:28px}.pause-dialog{padding-top:103px}.pause-dialog h2{margin-top:0;margin-bottom:35px;font-size:34px}.pause-mark{position:absolute;top:29px;left:calc(50% - 23px);width:46px;height:46px;border-radius:13px;color:var(--green);background:#d8e0c9}.setting-row{display:flex;justify-content:space-between;align-items:center;text-align:left;gap:18px;padding:12px 0}.setting-row input{width:24px;height:24px;accent-color:var(--green)}.help-list{text-align:left;padding-left:22px;font-size:16px;line-height:1.55;margin:0}.help-list li+li{margin-top:14px}.dialog-picture{max-width:100%;width:100%;aspect-ratio:1}.loading,.boot-error{padding:15vh 24px;text-align:center;max-width:650px;margin:auto}.boot-error p{margin:25px 0;line-height:1.6}.boot-error h1{font-size:32px}#notice{display:none}#notice.visible{display:block;position:fixed;z-index:150;bottom:16px;left:50%;transform:translateX(-50%);width:min(580px,calc(100% - 24px));padding:13px 18px;border-radius:14px;border:1px solid #bfad86;background:#fff3d9;box-shadow:0 4px 15px #362d2220;font-size:14px;line-height:1.5;color:#4f442f}
@media(max-width:850px){.app-header{height:100px;padding:32px 12px 12px;background:transparent;border:0}.header-left{gap:12px}.wordmark{font-size:21px}.header-right{gap:8px}.header-level{display:none!important}.is-game .wordmark{font-size:20px}.is-game .header-left .wordmark{font-size:0}.is-game .header-left .wordmark:after{content:attr(data-level);font-size:20px}.is-home .wordmark{visibility:hidden}.screen{min-height:calc(100dvh - 100px)}.home-content{padding:72px 25px 90px}.home-emblem{width:165px;height:100px;margin-bottom:35px}.home-content h1{font-size:43px;letter-spacing:-1px}.subtitle{font-size:15px;margin-top:25px}.home-actions{width:min(304px,100%);margin-top:68px;gap:17px}.home-save{font-size:13px;margin-top:30px}.prototype-note{font-size:11px;margin-top:14px}.screen-game{padding:34px 12px 40px}.game-layout{display:flex;flex-direction:column;gap:0;margin:auto;max-width:600px}.field-column{width:100%}.field-frame{height:auto;aspect-ratio:1}.tray-column{width:100%;padding-top:0}.desktop-level,.instruction{display:none}.tray-heading{margin:30px 3px 15px}.tray-heading h2{font-size:19px}.tray-heading span{font-size:12px}.tray-hint{font-size:11px;margin-top:18px;padding:6px 8px;max-width:none;white-space:nowrap}.mobile-save{display:block;text-align:center;font-size:11px;margin-top:12px}.screen-collection{padding-top:10px}.screen-collection h1{font-size:28px}.screen-collection .subtitle{font-size:13px}.collection-grid{margin-top:24px}.screen-victory{display:flex;flex-direction:column;padding:22px 26px 70px;gap:0;position:relative}.victory-copy{display:contents}.victory-mark{order:-3;width:40px;height:40px;border-radius:12px;margin-bottom:27px}.victory-mark .icon{width:23px;height:23px}.victory-copy h1{order:-2;font-size:28px;white-space:normal;margin:0 0 25px;letter-spacing:-.6px}.victory-art{width:100%;max-width:450px}.victory-copy p{display:none}.victory-copy .button{max-width:304px;margin:0;min-height:52px;font-size:17px}.victory-copy .button.primary{margin-top:39px;margin-bottom:18px}.modal-shade{padding:24px}.dialog{padding:50px 22px 25px;border-radius:24px;max-width:390px}.dialog h2{font-size:27px}.pause-dialog{max-width:330px;padding-top:102px}.pause-dialog h2{font-size:30px;margin-bottom:33px}.dialog .button{font-size:15px;min-height:47px}.dialog-body{gap:12px}.dialog-footnote{font-size:11px!important}.help-list{font-size:14px}.dialog .muted{font-size:13px}.dialog-body p{font-size:15px}}
@media(max-width:360px){.header-left{gap:6px}.header-right{gap:5px}.wordmark{font-size:18px}.icon-button{width:42px;height:42px}.tray-heading span{font-size:10px}.tray-hint{font-size:10px}.subtitle{font-size:14px}.home-content{padding-left:16px;padding-right:16px}}
@media(max-height:620px) and (min-width:650px){.app-header{height:68px;padding-top:12px}.screen-game{padding:12px 20px 25px}.game-layout{display:grid;grid-template-columns:minmax(250px,1fr) minmax(280px,340px);gap:30px;max-width:1000px}.field-frame{height:calc(100dvh - 145px);aspect-ratio:auto}.tray-column{padding-top:0}.tray-heading{margin-top:12px}.tray-hint{white-space:normal;font-size:12px}.mobile-save{display:none}.home-content{padding-top:20px}.home-emblem{width:110px;height:70px;margin-bottom:10px}.home-actions{margin-top:20px;gap:10px}.home-content h1{font-size:36px}.home-save{margin-top:15px}.subtitle{margin-top:15px}.dialog{max-height:calc(100dvh - 24px)}.screen-victory{display:grid;grid-template-columns:minmax(0,1fr) minmax(250px,1fr);gap:30px;padding-top:10px}.victory-copy{display:block}.victory-mark{display:inline-grid;margin-bottom:0}.victory-copy h1{font-size:27px;margin:20px 0}.victory-art{max-height:calc(100dvh - 110px)}.victory-art img{max-height:calc(100dvh - 110px);object-fit:contain}.victory-copy .button{margin:14px auto!important}}

/* Match the approved compact phone screen: status is already shown on home and errors in the notice. */
@media(max-width:850px){.screen-game{padding-bottom:20px}.mobile-save{display:none}}

/* Playtest: no visible tray heading; retain the accessible canvas label. */
.tray-heading{justify-content:flex-end}
.size-chooser{border:0;padding:0;margin:27px auto 0;max-width:380px}.size-chooser legend{font-size:16px;margin:0 auto 12px;padding:0}.size-chooser>div{display:flex;gap:10px;justify-content:center}.size-chooser button{min-height:44px;min-width:88px;padding:10px 14px;border-radius:14px;border:1px solid var(--line);background:var(--paper);font-weight:600}.size-chooser button[aria-pressed=true]{background:var(--green);color:#fff;border-color:var(--green)}.size-chooser p{font-size:12px;line-height:1.5;color:var(--muted);margin-top:12px}.home-content:has(.size-chooser) .home-actions{margin-top:25px}.home-content:has(.size-chooser){padding-top:55px}.home-content .previous-save{display:block;margin:8px auto 0}.home-content:has(.size-chooser) .home-emblem{margin-bottom:14px}@media(max-width:850px){.home-content:has(.size-chooser){padding-top:22px}.home-content:has(.size-chooser) .home-emblem{width:130px;height:80px}.size-chooser{margin-top:24px}.size-chooser button{min-width:82px}.home-content:has(.size-chooser) .subtitle{margin-top:15px}.home-content:has(.size-chooser) .home-save{margin-top:20px}}
.victory-menu{display:none;border:1px solid var(--line);border-radius:14px;background:var(--paper);min-width:88px}.is-victory .victory-menu{display:inline-flex;align-items:center;justify-content:center}.is-victory .app-header [data-action=back],.is-victory .app-header [data-action=help],.is-victory .app-header [data-action=settings]{display:none}.victory-copy .next-level-note{display:block;font-size:14px;line-height:1.5;margin:14px 0 0;color:var(--muted)}#next-level:disabled{opacity:.65}@media(max-width:850px){.victory-copy .next-level-note{order:5;font-size:12px;margin-top:0;text-align:center}.is-victory .app-header{padding-top:20px}.is-victory .wordmark{font-size:20px}}
/* The field frame follows the square board; no letterboxing inside its border. */
.field-frame{width:min(100%,65vh,650px);height:auto;aspect-ratio:1;margin-inline:auto}.field-actions{display:flex;justify-content:center;gap:18px;margin:24px auto 0}.field-actions .icon-button{width:58px;height:54px;border-radius:16px;background:#f8f6ee;box-shadow:0 2px 4px #263b2d0d}.field-actions .icon{width:27px;height:27px}.field-actions [data-action=hint]{color:#8b712f}.field-actions [data-action=magnet]{color:#547565}.gesture-tip{font-size:13px;line-height:1.5;text-align:center;max-width:430px;margin:15px auto 0;color:#526047;background:#f7f3ebed;padding:7px 12px;border-radius:14px}@media(max-width:850px){.field-frame{width:100%;height:auto;aspect-ratio:1}.field-actions{margin-top:20px}.gesture-tip{font-size:11px;margin-top:12px;max-width:360px}.tray-heading{margin-top:22px}}@media(max-height:620px) and (min-width:650px){.field-frame{width:min(100%,calc(100dvh - 145px));height:auto;aspect-ratio:1}.field-actions{margin-top:10px}.gesture-tip{font-size:11px;margin-top:8px}}
.zoom-rail{position:fixed;left:12px;top:50%;transform:translateY(-50%);z-index:45;display:flex;flex-direction:column;align-items:center;gap:10px;width:42px;padding:12px 5px;border:1px solid var(--line);border-radius:18px;background:#f8f6eef2;box-shadow:0 2px 8px #263b2d12}.zoom-rail input{writing-mode:vertical-lr;direction:rtl;width:24px;height:min(32vh,260px);accent-color:var(--green);margin:0;touch-action:none}.zoom-rail span{font-size:21px;line-height:1}.zoom-rail output{font-size:12px;color:var(--muted)}body.board-expanded{overflow:hidden}#field.field-expanded{position:fixed;inset:0;width:100vw;height:100dvh;z-index:10;background:transparent}.board-expanded .app-header{position:relative;z-index:34}.board-expanded .tray-column{position:fixed;bottom:92px;left:50%;transform:translateX(-50%);width:min(440px,calc(100% - 92px));padding:0;z-index:35}.board-expanded .tray-column .desktop-level,.board-expanded .instruction,.board-expanded .tray-heading,.board-expanded .tray-hint,.board-expanded .mobile-save{display:none}.board-expanded .field-actions{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);margin:0;z-index:36}.board-expanded .gesture-tip{display:none}#flight{z-index:50}@media(max-width:850px){.field-column{padding-left:36px}.zoom-rail{left:5px;width:34px;padding:9px 2px;border-radius:14px}.zoom-rail input{height:min(26vh,190px);width:22px}.zoom-rail output{font-size:10px}.board-expanded .tray-column{width:calc(100% - 72px);bottom:91px}.board-expanded .field-actions{gap:15px}}
.field-column{position:relative}.zoom-rail{position:absolute;left:-44px;top:min(32.5vh,325px)}.board-expanded .zoom-rail{position:fixed;left:12px;top:50%}@media(max-width:850px){.zoom-rail{left:0;top:calc((min(100vw - 24px,600px) - 36px)/2)}.board-expanded .zoom-rail{left:5px;top:50%}}@media(max-height:620px) and (min-width:650px){.zoom-rail{top:calc((100dvh - 145px)/2)}.board-expanded .zoom-rail{top:50%}}
/* Keep the tray and tools in the same screen positions at every zoom level. */
.is-game .screen-game{height:calc(100dvh - 88px);min-height:0;padding:16px 20px 260px}.game-layout{display:flex;flex-direction:column;align-items:center;gap:0;max-width:1240px}.field-column{width:min(100%,650px)}.field-frame{width:min(100%,max(160px,calc(100dvh - 420px)),650px);height:auto;aspect-ratio:1}.tray-column,.board-expanded .tray-column{position:fixed;bottom:92px;left:50%;transform:translateX(-50%);width:min(440px,calc(100% - 92px));padding:0;z-index:35}.is-game .desktop-level,.is-game .instruction,.is-game .tray-hint,.is-game .mobile-save{display:none}.tray-heading,.board-expanded .tray-heading{display:flex;margin:0 8px 10px}.field-actions,.board-expanded .field-actions{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);margin:0;z-index:36}.gesture-tip{margin-top:12px}.zoom-rail{top:calc(min(max(160px,100dvh - 420px),650px)/2)}.board-expanded .zoom-rail{top:50%}@media(max-width:850px){.is-game .screen-game{height:calc(100dvh - 100px);padding:34px 12px 220px}.field-column{width:100%}.field-frame{width:100%}.tray-column,.board-expanded .tray-column{width:calc(100% - 72px);bottom:91px}.field-actions,.board-expanded .field-actions{gap:15px}.zoom-rail{top:calc((min(100vw - 24px,600px) - 36px)/2)}.board-expanded .zoom-rail{top:50%}}
.board-expanded .field-frame{border-color:transparent;background:transparent;box-shadow:none}
/* Informational notices never intercept the field or the fixed action icons. */
#notice{pointer-events:none}
.board-expanded .wordmark{background:#f8f6eef2;border-radius:12px;padding:8px 10px}.board-expanded #capacity{background:#f8f6eef2;color:var(--ink);border-radius:10px;padding:4px 8px}
.collection-grid{display:grid;grid-template-columns:repeat(3,minmax(0,300px));gap:24px;max-width:948px;margin:35px auto 0}.level-card{width:100%;text-align:left}.level-card button{justify-content:center}@media(max-width:850px){.collection-grid{grid-template-columns:repeat(2,minmax(0,300px));gap:16px}.level-placeholder{height:auto;aspect-ratio:1}}@media(max-width:480px){.collection-grid{grid-template-columns:minmax(0,300px);justify-content:center}}

.collection-brand > span:last-child {
  letter-spacing: .035em;
}
:root {
  --paper-landscape: url('../assets/landscape-design/paper-landscape.webp');
}

@media (max-aspect-ratio: 4/5) {
  :root {
    --paper-landscape: url('../assets/landscape-design/paper-landscape-portrait.webp');
  }
}

body.collection-play-mode #app.showcase-collection,
body.collection-mode::before {
  background:
    linear-gradient(180deg, #f7f4ec59, #f7f4ec75 65%, #f7f4ec59),
    var(--paper-landscape) center bottom / cover no-repeat,
    #f7f4ec;
}

body.collection-mode {
  isolation: isolate;
}

body.collection-mode::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body.collection-mode #app.accepted-collection {
  background: transparent;
}
