:root{color-scheme:light;--ink:#16324a;--muted:#63788a;--blue:#1677b8;--sky:#e9f5fc;--line:#b7cad8;--good:#16835b;--coral:#ef6b55;font-family:"Hiragino Sans","Yu Gothic",system-ui,sans-serif}
*{box-sizing:border-box}body{margin:0;background:linear-gradient(180deg,#eef8ff,#fff 36%);color:var(--ink);overscroll-behavior:none}.lab{width:min(100%,680px);margin:auto;padding:12px max(12px,env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}.hero{display:flex;align-items:center;justify-content:space-between}.eyebrow{font-size:11px;font-weight:800;letter-spacing:.1em;color:var(--blue)}h1{font-size:24px;line-height:1.1;margin:3px 0 10px}.icon-button{width:44px;height:44px;border:1px solid var(--line);border-radius:50%;background:#fff;color:var(--blue);font-size:25px}.settings{display:flex;flex-wrap:wrap;gap:8px;align-items:end}.settings label:first-child{display:grid;gap:4px;flex:1;min-width:100%;font-size:12px;font-weight:700;color:var(--muted)}select{width:100%;min-height:44px;border:1px solid var(--line);border-radius:12px;background:#fff;padding:0 12px;color:var(--ink);font:700 15px inherit}.switch{height:44px;display:flex;align-items:center;gap:6px;padding:0 10px;border:1px solid var(--line);border-radius:12px;background:#fff;font-size:12px;font-weight:700;white-space:nowrap}.switch input{width:20px;height:20px;accent-color:var(--blue)}.status{margin:10px 0 7px}.status>div:first-child{display:flex;justify-content:space-between;align-items:center}.status strong{font-size:14px}.status span{font-size:12px;color:var(--muted)}.status p{min-height:20px;margin:6px 0 0;text-align:center;font-size:13px;font-weight:700}.status p.good{color:var(--good)}.status p.bad{color:#bf3e2e}.progress{height:7px;margin-top:5px;background:#dbe9f1;border-radius:20px;overflow:hidden}.progress i{display:block;width:0;height:100%;background:linear-gradient(90deg,#21a77a,#58c9a4);transition:width .25s}.board-wrap{position:relative;width:min(100%,520px);margin:auto;aspect-ratio:1;max-height:min(52vh,520px);background:#f8fcff;border:1px solid var(--line);border-radius:22px;box-shadow:0 8px 28px #28608016;overflow:hidden;touch-action:none}.board-wrap:after{content:"北";position:absolute;right:10px;top:9px;color:#7892a3;font-size:11px;font-weight:800}.board-wrap svg{display:block;width:100%;height:100%;touch-action:none}.target{fill:#e4edf3;stroke:#8faaba;stroke-width:2;cursor:pointer;transition:fill .18s,filter .18s}.target.active-region{fill:#d5eaf6}.target.placed{fill:#39b98a;stroke:#147754}.target.hint{fill:#ffd56a;filter:drop-shadow(0 0 18px #f8a900);animation:pulse .7s ease-in-out 3}.target:focus{outline:none;stroke:#ef6b55;stroke-width:5}.zoom-controls{position:absolute;left:10px;top:10px;display:flex;gap:6px}.zoom-controls button{min-width:44px;height:44px;border:0;border-radius:12px;background:#fffffff2;color:var(--blue);font-size:22px;font-weight:800;box-shadow:0 3px 14px #17384b2b;touch-action:manipulation}.zoom-controls button:last-child{font-size:11px}.zoom-controls button:disabled{opacity:.4}.hint-button{position:absolute;right:10px;bottom:10px;min-height:44px;border:0;border-radius:22px;background:#fffffff2;color:var(--blue);font-weight:800;box-shadow:0 3px 14px #17384b2b;padding:0 16px;touch-action:manipulation}.tray{margin:10px auto 0;width:min(100%,520px);display:grid;grid-template-columns:1fr 142px;grid-template-rows:auto auto;gap:4px 10px;align-items:center;background:#fff;border:1px solid var(--line);border-radius:18px;padding:10px 12px;box-shadow:0 6px 22px #28608012}.tray-copy{display:grid;gap:3px}.tray-copy span{font-size:11px;color:var(--muted);font-weight:700}.tray-copy strong{font-size:22px}.piece{grid-row:1/3;grid-column:2;min-width:132px;height:118px;border:2px dashed #6fa5c6;border-radius:14px;background:var(--sky);color:var(--blue);touch-action:none;user-select:none;padding:5px;cursor:grab}.piece.selected{border-style:solid;background:#fff5d8;box-shadow:0 0 0 4px #ffd56a55}.piece svg{display:block;width:100%;height:82px}.piece .target,.floater .target{fill:#ef6b55;stroke:#a83b2b;stroke-width:2}.piece span{font-size:11px;font-weight:800}.tray>p{margin:0;font-size:11px;line-height:1.4;color:var(--muted)}.floater{position:fixed;z-index:20;width:108px;height:108px;pointer-events:none;transform:translate(-50%,-50%);filter:drop-shadow(0 9px 8px #16324a4d)}.floater svg{width:100%;height:100%;overflow:visible}dialog{width:min(calc(100% - 32px),390px);border:0;border-radius:24px;text-align:center;padding:26px;box-shadow:0 18px 70px #0b294c55}dialog::backdrop{background:#102f4866;backdrop-filter:blur(3px)}dialog h2{margin:4px 0;font-size:30px}dialog p{color:var(--muted)}dialog button{min-height:48px;border:0;border-radius:14px;background:var(--blue);color:#fff;font-size:16px;font-weight:800;padding:0 24px}.complete-mark{display:inline-grid;place-items:center;width:58px;height:58px;border-radius:50%;background:#dff7ed;color:var(--good);font-size:34px}@keyframes pulse{50%{fill:#ff9e66;filter:drop-shadow(0 0 26px #ef6b55)}}@media(min-width:560px){.lab{padding-top:18px}h1{font-size:28px}.tray{grid-template-columns:1fr 170px}.piece{min-width:160px}.board-wrap{max-height:58vh}}@media(prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* 別ウィンドウ（「大きな画面で開く」）では画面全体を使えるので地図を大きく見せる。
   埋め込み時は教材ページのiframe高さに合わせるため、これらは適用しない。 */
:root[data-standalone] .lab{width:min(100%,900px)}
:root[data-standalone] .tray{width:100%}
/* スマホでは地図の大きさが横幅で決まるため、左右の余白を詰めて可能な限り広げる。
   縦を伸ばしても上下に余白が増えるだけなので、正方形の比率は変えない。 */
:root[data-standalone] .board-wrap{width:100%;max-width:none;max-height:min(64vh,620px)}
@media(max-width:559px){
  :root[data-standalone] .lab{padding-left:max(4px,env(safe-area-inset-left));padding-right:max(4px,env(safe-area-inset-right))}
}
@media(min-width:900px){
  /* 横に余裕があるときは地図とトレイを左右に並べ、地図に高さを譲る */
  :root[data-standalone] .lab{width:min(100%,1180px)}
  :root[data-standalone] .board-wrap{aspect-ratio:auto;height:min(78vh,860px);max-height:none}
  :root[data-standalone] .work{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px;align-items:start}
  :root[data-standalone] .work .tray{margin:0;position:sticky;top:12px;grid-template-columns:1fr;justify-items:center;text-align:center}
  :root[data-standalone] .work .piece{grid-row:auto;grid-column:auto;width:100%;height:190px}
  :root[data-standalone] .work .piece svg{height:150px}
}
