/* 木こりゲーム：画面の部品。色は木の看板・羊皮紙・森の色でそろえる */
/* hidden の付いた部品は、どんな display の指定があっても出さない（閉じた村のダイアログが透明なまま画面をふさいで、押せなくなっていた・2026-11-15） */
[hidden] { display: none !important; }
#village:not(.show) { pointer-events: none; }
:root {
  --wood: #8a5a36; --wood-l: #a8744a; --wood-d: #4a2e1b; --edge: #6d4a2c;
  --paper: #fbf1da; --paper-l: #fffaf0; --paper-d: #e8d6ae; --ink: #3a2a1a; --ink-l: #7a6248;
  --gold: #ffd36b; --gold-d: #c9952a; --leaf: #6ea84a; --leaf-d: #3f5f2a; --red: #d8452b; --pink: #e8487a;
  --font: "M PLUS Rounded 1c", system-ui, "Hiragino Maru Gothic ProN", "Yu Gothic UI", sans-serif;
  --bottom: max(10px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #4f6b2c; font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; }
#game { display: block; touch-action: none; cursor: none; }
.ico { width: 1.2em; height: 1.2em; flex: none; vertical-align: middle; }
.noart { display: inline-block; width: 24px; height: 24px; border-radius: 50%; background: rgba(110, 168, 74, .4); }
@keyframes bump { 0% { transform: scale(1.22); } 100% { transform: scale(1); } }
.bump { animation: bump .22s ease-out; }

/* ---------- 左上：お金・木材 ---------- */
#hud { position: fixed; left: max(10px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; z-index: 5; }
.plank { display: inline-flex; align-items: center; gap: 9px; min-width: 112px; padding: 3px 16px 3px 8px; font-size: 22px; font-weight: 800; color: #fff6dc; text-shadow: 0 2px 0 rgba(60, 30, 10, .6);
  background: repeating-linear-gradient(176deg, rgba(255, 255, 255, .06) 0 3px, transparent 3px 9px), linear-gradient(#b07a4c, #8a5a36 60%, #74482a);
  border: 3px solid var(--wood-d); border-radius: 14px; box-shadow: inset 0 2px 0 rgba(255, 230, 190, .35), 0 3px 0 var(--wood-d), 0 6px 12px rgba(0, 0, 0, .25); }
.hud-ico { width: 38px; height: 38px; margin: -8px -2px -8px -6px; display: grid; place-items: center; }
.hud-ico .ico { width: 38px; height: 38px; filter: drop-shadow(0 2px 1px rgba(40, 20, 5, .45)); }
#kinds { display: flex; flex-wrap: wrap; gap: 4px; max-width: 46vw; }
#kinds span { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 4px; background: rgba(255, 248, 230, .9); border: 2px solid rgba(109, 74, 44, .5); border-radius: 10px; font-size: 13px; }
#kinds .ki { height: 22px; width: auto; }
#kinds i { font-style: normal; font-weight: 800; }

/* ---------- 右上：メニュー（依頼・店・図鑑・セーブ） ---------- */
#menu { position: fixed; right: max(10px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 8px; z-index: 6; }
#menu button { position: relative; width: 64px; padding: 6px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; font-weight: 800; color: var(--ink);
  background: linear-gradient(#fffaf0, #f3e2bc); border: 3px solid var(--edge); border-radius: 16px; box-shadow: inset 0 -3px 0 rgba(160, 120, 70, .25), 0 3px 0 var(--edge), 0 6px 12px rgba(0, 0, 0, .25); cursor: pointer; transition: transform .1s; }
#menu button:hover { transform: translateY(-1px); }
#menu button:active, #menu button.on { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(160, 120, 70, .25), 0 1px 0 var(--edge); background: linear-gradient(#ffe9a8, var(--gold)); }
#menu .mi .ico { width: 30px; height: 30px; display: block; }
#menu button.ready::after { content: "!"; position: absolute; right: -8px; top: -9px; width: 22px; height: 22px; line-height: 20px; text-align: center; font-size: 14px; color: #fff; background: var(--red); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); animation: hop 1s ease-in-out infinite; }
#menu button.ready { background: linear-gradient(#fff4c8, #ffe08a); }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px); } 60% { transform: translateY(0); } }

/* ---------- 連続の数・知らせ ---------- */
#combo { position: fixed; left: 50%; transform: translateX(-50%); top: 12%; font-size: 28px; font-weight: 800; color: #fff6dc; -webkit-text-stroke: 1px #6d3f1c; text-shadow: 0 3px 0 #6d3f1c; opacity: 0; transition: opacity .25s; pointer-events: none;
  --heat: 0; color: color-mix(in srgb, #fff6dc calc(100% - var(--heat) * 100%), #ff9a3c); }
#combo.show { opacity: 1; }
#combo.bump { animation: bump .15s ease-out; }
#toasts { position: fixed; left: 50%; top: 30%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 40; }
.toast { padding: 8px 18px; background: linear-gradient(rgba(70, 46, 26, .95), rgba(50, 32, 18, .95)); color: #fff4d6; border: 2px solid rgba(255, 220, 160, .35); border-radius: 16px; font-weight: 700; font-size: 15px; text-align: center; width: max-content; max-width: min(92vw, 520px); line-break: strict; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); animation: toastIn .3s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .5s, transform .5s; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.9); } }

/* ---------- パネル ---------- */
#panel { position: fixed; right: max(10px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); bottom: calc(var(--bottom) + 76px); width: min(400px, calc(100vw - 20px)); display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .6), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(200, 160, 100, .18), transparent 60%), var(--paper);
  border: 4px solid var(--edge); border-radius: 20px; box-shadow: 0 0 0 3px #f3e2bc inset, 0 10px 30px rgba(0, 0, 0, .4); z-index: 30; user-select: text; -webkit-user-select: text;
  opacity: 0; transform: translateX(24px) scale(.97); pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2, 1.2, .4, 1); }
#panel.open { opacity: 1; transform: none; pointer-events: auto; }
#panelHead { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; margin: -1px -1px 0; color: #fff6dc; font-size: 19px; text-shadow: 0 2px 0 rgba(60, 30, 10, .6);
  background: repeating-linear-gradient(178deg, rgba(255, 255, 255, .05) 0 3px, transparent 3px 10px), linear-gradient(#b07a4c, #8a5a36); border-radius: 15px 15px 0 0; border-bottom: 3px solid var(--wood-d); }
#panelTitle { display: flex; align-items: center; gap: 8px; }
#panelTitle .ico { width: 30px; height: 30px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .3)); }
#panelClose { width: 36px; height: 36px; font-size: 24px; line-height: 1; color: var(--ink); border: 3px solid var(--wood-d); border-radius: 50%; background: linear-gradient(#fffaf0, #f3e2bc); cursor: pointer; box-shadow: 0 2px 0 var(--wood-d); }
#panelBody { overflow-y: auto; padding: 10px 12px 16px; overscroll-behavior: contain; }
#panelBody h3 { margin: 0 0 4px; font-size: 16px; }
#panelBody p { margin: 0 0 6px; font-size: 13px; line-height: 1.55; }
#panelBody .note { color: var(--ink-l); }
#panelBody .small { font-size: 12px; color: var(--ink-l); }
.sec { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 12px 2px 8px; padding-bottom: 4px; border-bottom: 2px dashed var(--paper-d); }
.sec:first-child { margin-top: 2px; }
.sec b { font-size: 15px; color: var(--wood); }
.sec small { font-size: 11px; color: var(--ink-l); }
.card { position: relative; background: var(--paper-l); border: 2px solid var(--paper-d); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; box-shadow: 0 2px 0 rgba(160, 120, 70, .25); }
.card.main { border-color: #c99a5e; box-shadow: 0 0 0 3px rgba(255, 211, 107, .35), 0 3px 0 rgba(160, 120, 70, .3); }
.card.locked { display: flex; gap: 10px; align-items: center; background: rgba(255, 250, 240, .5); border-style: dashed; color: var(--ink-l); }
.card.locked > .ico { width: 30px; height: 30px; opacity: .7; }
.card.locked p { margin: 0; }
.card.done { opacity: .62; }

/* 依頼のカード：依頼元・ひとこと・要るもの・ほうび */
.q-head { display: flex; align-items: center; gap: 10px; }
.q-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.q-who small { font-size: 11px; color: var(--ink-l); }
.q-who b { font-size: 16px; }
.q-from { margin-left: auto; align-self: flex-start; font-size: 11px; font-weight: 700; color: #fff; background: var(--wood); padding: 2px 8px; border-radius: 8px; white-space: nowrap; }
.crest { --c: #7a5a3a; flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; font-size: 20px; font-weight: 800; color: #fff; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, #fff), var(--c) 70%);
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--c), 0 3px 6px rgba(0, 0, 0, .25); text-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.crest.big { width: 56px; height: 56px; font-size: 26px; }
.bubble { position: relative; margin: 10px 0 8px; padding: 9px 12px; background: #fff; border: 2px solid var(--paper-d); border-radius: 12px; font-size: 14px; line-height: 1.6; font-weight: 500; }
.bubble::before { content: ""; position: absolute; left: 16px; top: -9px; width: 14px; height: 14px; background: #fff; border-left: 2px solid var(--paper-d); border-top: 2px solid var(--paper-d); transform: rotate(45deg); }
.q-build { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--wood); margin-bottom: 4px; }
.q-build .ico { width: 24px; height: 24px; }
.need { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.need li { display: grid; grid-template-columns: 30px auto 1fr auto 20px; align-items: center; gap: 6px; font-size: 14px; padding: 3px 8px 3px 4px; background: #f6ebd2; border-radius: 10px; }
.need li.ok { background: #e3f1cf; }
.need .ni { height: 28px; width: 30px; object-fit: contain; }
.need .bar { height: 8px; background: rgba(120, 90, 50, .18); border-radius: 4px; overflow: hidden; }
.need .bar i { display: block; height: 100%; background: linear-gradient(#f2c64a, #d99a2a); border-radius: 4px; transition: width .4s; }
.need li.ok .bar i { background: linear-gradient(#8fcf62, var(--leaf)); }
.need .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.need .num small { font-weight: 500; color: var(--ink-l); }
.need .ok-ico { width: 20px; height: 20px; }
.rws { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; margin: 6px 0 10px; }
.rws .lbl { font-weight: 800; color: var(--wood); margin-right: 2px; }
.rw { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 4px; background: linear-gradient(#fff3c4, #ffe08a); border: 2px solid #e0b452; border-radius: 10px; font-weight: 700; font-size: 13px; }
.rw .ico, .rw .ri { width: 22px; height: 22px; object-fit: contain; }
.q-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stamp { display: inline-block; padding: 2px 12px; font-weight: 800; color: var(--red); border: 3px solid var(--red); border-radius: 8px; transform: rotate(-8deg); letter-spacing: .1em; }
.card.won { animation: won .6s ease-out; }
@keyframes won { 0% { transform: scale(1); } 30% { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(255, 211, 107, .7); } 100% { transform: scale(1); } }
.built { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0 6px; }
.built small { width: 100%; font-size: 12px; color: var(--ink-l); font-weight: 700; }
.built span { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px 2px 4px; background: #efe0bd; border-radius: 9px; font-size: 13px; }
.built .ico { width: 18px; height: 18px; }
.done-all { text-align: center; }
.done-all > .ico { width: 54px; height: 54px; }

/* ボタン */
.go, .warn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-weight: 800; font-size: 15px; padding: 7px 16px; border-radius: 12px; border: 3px solid var(--edge); background: linear-gradient(#ffe9a8, var(--gold)); color: var(--ink); cursor: pointer; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), 0 3px 0 var(--edge); white-space: nowrap; transition: transform .08s; }
.go:active:not(:disabled), .warn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.go:disabled { background: #e6dccb; color: #9a8a76; border-color: #b9a988; box-shadow: none; cursor: default; }
.go.big { width: 100%; font-size: 18px; padding: 10px; }
.can .go:not(:disabled) { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), 0 3px 0 var(--edge), 0 0 0 0 rgba(255, 211, 107, .0); } 50% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .6), 0 3px 0 var(--edge), 0 0 0 7px rgba(255, 211, 107, .55); } }
.go.buy .ico { width: 20px; height: 20px; }
.warn { background: linear-gradient(#f9c9bc, #f3a08c); }
.max { font-weight: 800; color: var(--leaf-d); background: #e3f1cf; padding: 4px 10px; border-radius: 10px; }

/* 店 */
.purse { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 4px; background: linear-gradient(#fff3c4, #ffe9a8); border: 2px solid #e0b452; border-radius: 12px; font-size: 14px; }
.purse .ico { width: 26px; height: 26px; }
.purse b { font-size: 22px; }
.purse small { width: 100%; font-size: 11px; color: var(--ink-l); }
.card.item { display: flex; align-items: center; gap: 10px; }
.item-ico { flex: none; width: 58px; height: 58px; display: grid; place-items: center; background: radial-gradient(circle, #fff 30%, #f3e2bc); border: 2px solid var(--paper-d); border-radius: 14px; }
.item-ico .ico { width: 44px; height: 44px; }
.item-ico .ti { max-width: 50px; max-height: 50px; }
.item-txt { flex: 1; min-width: 0; }
.item-txt h3 small { font-size: 12px; color: var(--wood); }
.item-txt p { margin: 2px 0 0 !important; font-size: 12px !important; color: var(--ink-l); }
.card.item.locked .item-ico { filter: grayscale(1); opacity: .6; }
.lock-ico { width: 28px; height: 28px; }
.pips { display: flex; gap: 3px; margin: 2px 0; }
.pips i { width: 12px; height: 7px; border-radius: 3px; background: rgba(120, 90, 50, .2); }
.pips i.on { background: linear-gradient(#f2c64a, #d99a2a); }

/* 図鑑 */
.codex { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codex .card { margin: 0; text-align: center; padding: 8px; }
.cx-pic { height: 96px; display: grid; place-items: end center; background: radial-gradient(ellipse at 50% 100%, rgba(110, 168, 74, .35), transparent 70%); border-radius: 10px; margin-bottom: 4px; }
.cx-pic img { max-height: 92px; max-width: 100%; }
.card.cx.locked { display: block; }
.card.cx.locked .cx-pic img { filter: brightness(0); opacity: .22; }
.codex .card p { font-size: 12px !important; }
#panelBody textarea { width: 100%; height: 64px; font-size: 11px; margin-bottom: 6px; border: 2px solid var(--paper-d); border-radius: 8px; }

/* ---------- 下：工具・音・言語 ---------- */
#bar { position: fixed; left: 50%; bottom: var(--bottom); transform: translateX(-50%); display: flex; gap: 8px; align-items: flex-end; max-width: calc(100vw - 16px); padding: 4px; z-index: 6; }
#bar button[data-tool][hidden] { display: none; }
#bar button[data-tool], #bar #plantBtn, #bar #toolBtn, #bar .bb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 70px; padding: 4px 10px 5px; font-size: 13px; font-weight: 800; color: var(--ink);
  background: linear-gradient(#fffaf0, #f3e2bc); border: 3px solid var(--edge); border-radius: 16px; box-shadow: inset 0 -3px 0 rgba(160, 120, 70, .25), 0 3px 0 var(--edge), 0 6px 12px rgba(0, 0, 0, .25); cursor: pointer; white-space: nowrap; }
#bar #plantBtn.on, #bar #toolWrap.open #toolBtn { background: linear-gradient(#ffe9a8, var(--gold)); transform: translateY(-4px); box-shadow: inset 0 -3px 0 rgba(160, 120, 70, .25), 0 3px 0 var(--edge), 0 0 0 3px rgba(255, 255, 255, .6), 0 10px 16px rgba(0, 0, 0, .3); }
.tool-pic { height: 36px; display: grid; place-items: center; }
.tool-pic img { max-height: 36px; max-width: 54px; }
.tool-pic .ico { width: 38px; height: 38px; }
#bar #plantBtn { margin-left: 4px; background: linear-gradient(#f2fbe4, #cfe8a8); }
#bar #plantBtn.on { background: linear-gradient(#ffe9a8, var(--gold)); }
#bar #plantBtn em { background: #e8487a; }
#bar #plantBtn em[hidden] { display: none; }
#bar em { position: absolute; right: -6px; top: -8px; font-style: normal; font-size: 10px; font-weight: 800; color: #fff; background: var(--leaf); border: 2px solid #fff; padding: 0 5px; border-radius: 8px; }
#bar kbd { position: absolute; left: 5px; top: 2px; font-size: 10px; opacity: .45; font-family: inherit; }
#bar .sep { width: 4px; }
#bar .round { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 44px; min-width: 44px; padding: 0 8px; font-size: 12px; font-weight: 800; color: var(--ink); background: linear-gradient(#fffaf0, #f3e2bc); border: 3px solid var(--edge); border-radius: 22px; box-shadow: 0 3px 0 var(--edge); cursor: pointer; }
#bar .round .ico { width: 26px; height: 26px; }

/* 苗木：絵がふわふわ浮いている。押さえたままドラッグして植える */
#seedTray { position: fixed; left: 50%; bottom: calc(var(--bottom) + 76px); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 4px; padding: 16px 10px 4px; max-width: calc(100vw - 16px);
  background: linear-gradient(rgba(40, 28, 16, 0), rgba(40, 28, 16, .38)); border-radius: 20px; z-index: 5; touch-action: none; }
#seedTray:not(.open), #seedTray:empty { display: none; }
#seedTray.open { animation: trayIn .22s ease-out; }
@keyframes trayIn { from { opacity: 0; transform: translate(-50%, 18px) scale(.92); } to { opacity: 1; transform: translate(-50%, 0); } }
.tray-label { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: #fff6dc; background: rgba(60, 40, 20, .75); padding: 1px 10px; border-radius: 9px; white-space: nowrap; pointer-events: none; }
.seed { position: relative; display: flex; flex-direction: column; align-items: center; width: 62px; cursor: grab; touch-action: none; color: #fff6dc; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.seed-pic { position: relative; width: 58px; height: 58px; display: grid; place-items: end center; overflow: hidden; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fffef6, #f3e2bc 70%); border: 3px solid var(--edge); box-shadow: inset 0 -6px 0 rgba(140, 100, 50, .18), 0 3px 0 var(--edge);
  animation: float 2.4s ease-in-out infinite; animation-delay: calc(var(--d) * -1); }
.seed-pic img { max-height: 50px; max-width: 46px; margin-bottom: 2px; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .25)); }
.seed::before { content: ""; position: absolute; top: 62px; width: 40px; height: 9px; border-radius: 50%; background: rgba(0, 0, 0, .35); animation: shade 2.4s ease-in-out infinite; animation-delay: calc(var(--d) * -1); }
.seed b { font-size: 12px; margin-top: 10px; }
.seed small { font-size: 10px; opacity: .85; }
.seed kbd { position: absolute; left: 4px; top: 0; font-size: 9px; opacity: .6; font-family: inherit; }
.seed.on .seed-pic { border-color: #b0702c; box-shadow: inset 0 -6px 0 rgba(140, 100, 50, .18), 0 3px 0 #b0702c, 0 0 0 4px rgba(255, 211, 107, .8); }
.seed:hover .seed-pic { transform: translateY(-10px) scale(1.06); }
.seed.lift .seed-pic { animation: none; transform: translateY(-10px) scale(1.1); opacity: .45; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes shade { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(.75); opacity: .5; } }
.ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; }
.ghost img { position: absolute; left: -40px; bottom: 18px; height: 80px; width: 80px; object-fit: contain; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .35)); transform-origin: 50% 100%; animation: wiggle .5s ease-in-out infinite alternate; }
.ghost::after { content: ""; position: absolute; left: -16px; top: -6px; width: 32px; height: 12px; border-radius: 50%; border: 3px solid rgba(255, 248, 220, .9); box-shadow: 0 0 10px rgba(255, 240, 180, .8); }
.ghost.drop { opacity: 0; transition: opacity .2s; }
@keyframes wiggle { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
@media (hover: none) { #bar kbd, .seed kbd { display: none; } }

/* ---------- チュートリアル ---------- */
#tut { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(500px, calc(100vw - 180px)); display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px 10px 10px; z-index: 45;
  background: var(--paper-l); border: 3px solid var(--edge); border-radius: 18px; box-shadow: 0 0 0 3px #f3e2bc inset, 0 10px 24px rgba(0, 0, 0, .35); animation: tutIn .35s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .3s; }
#tut.hide { opacity: 0; pointer-events: none; }
#tut.low { top: auto; bottom: calc(var(--bottom) + 84px); }
@keyframes tutIn { from { opacity: 0; transform: translate(-50%, -10px) scale(.95); } }
.tut-body { flex: 1; min-width: 0; }
.tut-body small { font-size: 11px; font-weight: 800; color: var(--leaf-d); }
.tut-body p { margin: 2px 0 6px; font-size: 15px; line-height: 1.6; font-weight: 700; }
.tut-btns { display: flex; align-items: center; gap: 8px; }
.tut-btns .go { padding: 5px 16px; font-size: 14px; }
.skip { background: none; border: 0; color: var(--ink-l); font-size: 12px; text-decoration: underline; cursor: pointer; padding: 4px; }
.tut-n { margin-left: auto; font-size: 11px; color: var(--ink-l); }
.tut-focus { animation: focus 1.1s ease-in-out infinite !important; }
#seedTray.tut-focus { animation: focusT 1.1s ease-in-out infinite !important; }
@keyframes focus { 0%, 100% { box-shadow: 0 0 0 3px rgba(255, 211, 107, .9), 0 0 0 0 rgba(255, 211, 107, .6); } 50% { box-shadow: 0 0 0 3px rgba(255, 211, 107, .9), 0 0 0 12px rgba(255, 211, 107, 0); } }
@keyframes focusT { 0%, 100% { box-shadow: 0 0 0 3px rgba(255, 211, 107, .9); } 50% { box-shadow: 0 0 0 8px rgba(255, 211, 107, .4); } }

/* ---------- 納品のお祝い ---------- */
#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 70; }
.flycoin { position: fixed; left: -13px; top: -13px; width: 26px; height: 26px; pointer-events: none; z-index: 80; }
.flycoin .ico { width: 26px; height: 26px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
#celebrate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(30, 20, 10, .55); opacity: 0; transition: opacity .3s; overflow: hidden; }
#celebrate.show { opacity: 1; }
.cel-rays { position: absolute; left: 50%; top: 45%; width: 160vmax; height: 160vmax; transform: translate(-50%, -50%); background: repeating-conic-gradient(rgba(255, 230, 150, .16) 0 10deg, transparent 10deg 20deg); animation: spin 18s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.cel-card { position: relative; width: min(400px, 100%); padding: 40px 18px 18px; text-align: center; background: var(--paper-l); border: 4px solid var(--edge); border-radius: 22px; box-shadow: 0 0 0 4px #f3e2bc inset, 0 20px 50px rgba(0, 0, 0, .5); transform: scale(.6); transition: transform .45s cubic-bezier(.2, 1.6, .4, 1); }
#celebrate.show .cel-card { transform: scale(1); }
.cel-ribbon { position: absolute; left: -14px; right: -14px; top: -24px; height: 52px; display: grid; place-items: center; background: linear-gradient(#e85a3a, #b8341e); border: 3px solid #7a2416; border-radius: 10px; box-shadow: 0 6px 0 #7a2416, 0 10px 16px rgba(0, 0, 0, .3); }
.cel-ribbon span { font-size: 26px; font-weight: 800; color: #ffe9a8; letter-spacing: .08em; text-shadow: 0 3px 0 #7a2416; }
.cel-build { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 12px; font-size: 19px; }
.cel-build .ico { width: 46px; height: 46px; animation: hop 1.2s ease-in-out infinite; }
.cel-client { display: flex; gap: 10px; align-items: center; text-align: left; background: #fff; border: 2px solid var(--paper-d); border-radius: 14px; padding: 10px; margin-bottom: 12px; }
.cel-client small { font-size: 11px; color: var(--ink-l); }
.cel-client p { margin: 2px 0 0; font-size: 14px; line-height: 1.55; font-weight: 700; }
.cel-rw { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; min-height: 30px; }
.cel-rw .rw { font-size: 14px; padding: 4px 12px 4px 6px; transform: scale(0); transition: transform .35s cubic-bezier(.2, 1.8, .4, 1); }
.cel-rw .rw.in { transform: scale(1); }
.cel-rw .rw .ico, .cel-rw .rw .ri { width: 28px; height: 28px; }

/* ---------- 小さい画面 ---------- */
@media (max-width: 620px) {
  #tut { width: calc(100vw - 20px); top: calc(max(10px, env(safe-area-inset-top)) + 96px); }
  #menu button { width: 54px; font-size: 10px; padding: 4px 2px 3px; }
  #menu .mi .ico { width: 24px; height: 24px; }
  .plank { font-size: 18px; min-width: 92px; }
  #bar button[data-tool], #bar #plantBtn, #bar #toolBtn, #bar .bb { min-width: 56px; padding: 3px 6px 4px; font-size: 11px; }
  .tool-pic, .tool-pic img { max-height: 28px; height: 28px; }
  .tool-pic .ico { width: 30px; height: 30px; }
  .hud-ico, .hud-ico .ico { width: 32px; height: 32px; }
  #bar .round { height: 38px; min-width: 38px; }
  #bar .round.lang span { display: none; }
  .seed { width: 54px; }
}
@media (max-height: 500px) {
  #seedTray { bottom: calc(var(--bottom) + 62px); padding-top: 12px; }
  .seed-pic { width: 42px; height: 42px; }
  .seed-pic img { max-height: 36px; }
  .seed::before { top: 44px; }
  .seed b { margin-top: 2px; }
  .seed small { display: none; }
  .tool-pic, .tool-pic img { max-height: 26px; height: 26px; }
  #menu { gap: 4px; }
  #menu button { width: 50px; font-size: 10px; }
  #menu .mi .ico { width: 22px; height: 22px; }
  #tut { top: 8px; width: min(460px, calc(100vw - 260px)); }
  #tut .tut-body p { font-size: 13px; }
}

/* 調整パネル（試作用・本番では消える） */
#tune { position: fixed; left: 12px; bottom: 100px; width: 230px; padding: 10px 12px; background: rgba(30, 24, 18, .85); color: #f5ead2; border-radius: 10px; font-size: 12px; display: none; z-index: 50; }
#tune.open { display: block; }
#tune label { display: block; margin: 6px 0 2px; }
#tune input { width: 100%; }
.tune-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tune-btns button { font: inherit; font-size: 11px; padding: 3px 6px; border: 0; border-radius: 6px; background: #f5ead2; color: #3a2a1a; cursor: pointer; }
#tuneBtn { position: fixed; left: 12px; bottom: calc(var(--bottom) + 8px); padding: 4px 10px; font-size: 12px; background: rgba(30, 24, 18, .7); color: #f5ead2; border: 0; border-radius: 8px; cursor: pointer; z-index: 50; }
#tune.open + #tuneBtn { display: none; }

/* スマホ縦：チュートリアルの吹き出しは右のメニューをよけて置く */
@media (max-width: 620px) {
  #tut { left: 10px; transform: none; width: calc(100vw - 86px); top: calc(max(10px, env(safe-area-inset-top)) + 100px); animation: none; }
  #tut.low { bottom: calc(var(--bottom) + 84px); }
  .crest.big { width: 46px; height: 46px; font-size: 22px; }
  .tut-body p { font-size: 14px; }
}

/* ---------- 森の暮らし：木材・料理の効き目・緊急依頼・工房・仲間・まかない（企画書 16-10） ---------- */
#lumber[hidden] { display: none; }
#buffs { display: flex; flex-wrap: wrap; gap: 4px; }
#buffs:empty { display: none; }
.buff { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 3px; font-size: 13px; background: linear-gradient(#fff3c4, #ffd36b); border: 2px solid #c9952a; border-radius: 10px; box-shadow: 0 2px 0 rgba(120, 80, 20, .35); animation: buffGlow 1.6s ease-in-out infinite; }
.buff .ico { width: 20px; height: 20px; }
.buff b { color: #a0442e; }
.buff i { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }
@keyframes buffGlow { 50% { box-shadow: 0 2px 0 rgba(120, 80, 20, .35), 0 0 0 4px rgba(255, 211, 107, .45); } }
#menu button.urgent::before { content: "急"; position: absolute; left: -9px; top: -9px; width: 22px; height: 22px; line-height: 20px; text-align: center; font-size: 12px; color: #fff; background: #e8792b; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); animation: hop .8s ease-in-out infinite; z-index: 1; }
html[lang="en"] #menu button.urgent::before { content: "!!"; }

.card.urgent { border: 3px solid #e8792b; background: linear-gradient(#fff4e6, var(--paper-l) 40%); box-shadow: 0 0 0 3px rgba(232, 121, 43, .25), 0 3px 0 rgba(160, 80, 30, .3); }
.urgent-tag { display: flex; align-items: center; gap: 6px; margin: -10px -12px 8px; padding: 4px 12px; color: #fff; background: repeating-linear-gradient(135deg, #e8792b 0 12px, #d8662a 12px 24px); border-radius: 11px 11px 0 0; }
.urgent-tag .ico { width: 20px; height: 20px; }
.urgent-tag b { font-size: 14px; letter-spacing: .08em; }
.urgent-tag i { margin-left: auto; font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; background: rgba(0, 0, 0, .2); padding: 0 8px; border-radius: 8px; }
.rw.big { font-size: 16px; }

.ws-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.ws-in, .ws-out { display: flex; flex-direction: column; align-items: center; min-width: 58px; }
.ws-in .ico, .ws-out .ico { width: 38px; height: 38px; }
.ws-in b, .ws-out b { font-size: 20px; line-height: 1.1; }
.ws-in small, .ws-out small { font-size: 11px; color: var(--ink-l); }
.ws-mid { position: relative; display: grid; place-items: center; }
.ws-mid .bar { width: 100%; height: 10px; background: rgba(120, 90, 50, .18); border-radius: 5px; overflow: hidden; }
.ws-mid .bar i { display: block; height: 100%; background: linear-gradient(#8fcf62, var(--leaf)); border-radius: 5px; }
.ws-saw { position: absolute; top: -30px; width: 30px; height: 30px; }
.ws-saw.run { animation: sawing .35s ease-in-out infinite alternate; }
@keyframes sawing { from { transform: translateX(-6px) rotate(-4deg); } to { transform: translateX(6px) rotate(4deg); } }
.ws-add { display: flex; flex-wrap: wrap; gap: 6px; }
/* 工作台（企画書 16-17） */
.cq { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.cq .slot { position: relative; aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--paper-d); background: #f6ebd2; padding: 3px; display: grid; place-items: center; }
.cq .slot .ico { width: 100%; height: 100%; }
.cq .slot.empty { border-style: dashed; background: rgba(255, 250, 240, .5); }
.cq .slot.now { border-color: #8fcf62; background: #eef7e2; }
.cq .slot .bar { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 5px; background: rgba(120, 90, 50, .2); border-radius: 3px; overflow: hidden; }
.cq .slot .bar i { display: block; height: 100%; background: linear-gradient(#8fcf62, var(--leaf)); }
.cq-card .small { margin: 6px 0; }
.goods { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.goods small { font-weight: 800; color: var(--wood); }
.goods i { color: var(--ink-l); font-style: normal; }
.goods .gd { display: inline-flex; align-items: center; gap: 2px; background: #f6ebd2; border-radius: 10px; padding: 2px 8px 2px 4px; }
.goods .gd .ico { width: 30px; height: 30px; }
.goods .gd.want { background: #ffe3c8; box-shadow: 0 0 0 2px #e8792b inset; }
.crafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.card.rc { margin: 0; text-align: center; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.card.rc.locked { display: flex; flex-direction: column; justify-content: center; }
.card.rc.locked .rc-ico { width: 36px; height: 36px; opacity: .6; }
.card.rc.want { border-color: #e8792b; box-shadow: 0 0 0 3px rgba(232, 121, 43, .25); }
.rc .rc-ico { width: 56px; height: 56px; }
.rc h3 { margin: 0; font-size: 15px; }
.rc .small { margin: 0; }
.rc-tag { position: absolute; top: 6px; left: 6px; background: #e8792b; color: #fff; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 1px 6px; }
.rns { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; font-size: 13px; }
.rns .rn, .rns .rt { display: inline-flex; align-items: center; gap: 1px; background: #f6ebd2; border-radius: 8px; padding: 1px 6px 1px 2px; }
.rns .rn.short { background: #fbe0d6; color: #a03a2a; }
.rns .ico, .rns img { width: 22px; height: 22px; object-fit: contain; }
.rns .rt { background: none; color: var(--ink-l); }
.rc .go { width: 100%; margin-top: auto; }
.q-hint { display: flex; align-items: center; gap: 4px; margin: 2px 0 4px; color: #b05a1a; font-weight: 700; }
.q-hint .ico { width: 22px; height: 22px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 3px; font: inherit; font-size: 12px; color: var(--ink); background: #f6ebd2; border: 2px solid var(--paper-d); border-radius: 12px; cursor: pointer; }
.chip .ni { height: 28px; width: 26px; object-fit: contain; }
.chip span { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.chip small { color: var(--ink-l); }
.chip b { margin-left: 2px; padding: 1px 6px; color: #fff; background: var(--leaf); border-radius: 8px; }
.chip:disabled { opacity: .45; cursor: default; }
.chip:active:not(:disabled) { transform: translateY(1px); }

.crew { display: flex; align-items: flex-end; gap: 2px; flex-wrap: wrap; }
.crew-pic { height: 54px; width: auto; }
.crew b { margin-left: 8px; align-self: center; }
.jobs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.job { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; font: inherit; font-size: 12px; font-weight: 800; color: var(--ink-l); background: #eee4cf; border: 2px solid #c9b48a; border-radius: 12px; cursor: pointer; }
.job .ico { width: 30px; height: 30px; filter: grayscale(1); opacity: .6; }
.job i { font-style: normal; font-size: 11px; }
.job.on { color: var(--ink); background: linear-gradient(#f2fbe4, #cfe8a8); border-color: var(--leaf); }
.job.on .ico { filter: none; opacity: 1; }
.job.on i { color: var(--leaf-d); }

.dishes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.card.dish { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 6px; margin: 0; }
.card.dish.none .dish-pic { filter: grayscale(.8); opacity: .5; }
.dish-pic { height: 64px; width: auto; max-width: 100%; object-fit: contain; }
.card.dish h3 { margin: 2px 0 0; font-size: 13px; }
.card.dish h3 small { margin-left: 3px; color: var(--red); }
.card.dish p { margin: 2px 0 6px; min-height: 30px; }
.card.dish .go { padding: 5px 10px; font-size: 13px; }
@media (max-width: 420px) { .dishes { grid-template-columns: 1fr 1fr; } }

/* ---------- 行き先ボタン（右の列。森・ログハウス・村へ移る）・村づくり（2026-11-15） ---------- */
#places { position: fixed; right: max(10px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 230px); display: flex; flex-direction: column; gap: 6px; z-index: 6;
  max-height: calc(100vh - 340px); overflow-y: auto; scrollbar-width: none; padding: 6px 4px 6px 12px; margin-right: -4px; }
#places button { position: relative; width: 64px; padding: 4px 2px 3px; display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 800; color: #fff8e6;
  background: linear-gradient(#6f9a4a, #4f7a34); border: 3px solid #2f4a20; border-radius: 14px; box-shadow: 0 3px 0 #2f4a20, 0 5px 10px rgba(0, 0, 0, .25); cursor: pointer; transition: transform .1s; flex: none; }
#places button:not(.forest) { background: linear-gradient(#b07a4c, #8a5a36); border-color: var(--wood-d); box-shadow: 0 3px 0 var(--wood-d), 0 5px 10px rgba(0, 0, 0, .25); }
#places button .ico { width: 26px; height: 26px; }
#places button span { text-shadow: 0 1px 0 rgba(0, 0, 0, .4); white-space: nowrap; }
#places button.on { transform: translateY(2px); outline: 3px solid #ffd36b; outline-offset: 1px; }
#places .badge { position: absolute; left: -10px; top: -8px; min-width: 22px; height: 22px; line-height: 18px; padding: 0 4px; text-align: center; font-size: 12px; font-style: normal; color: #fff; background: var(--red); border: 2px solid #fff; border-radius: 11px; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); animation: hop 1s ease-in-out infinite; }
#places button.urgent .badge { background: #e8792b; }
#spotLog { position: fixed; left: 0; top: 0; pointer-events: none; border-radius: 18px; z-index: 4; }
.card.fac .item-ico { width: 84px; height: auto; flex: none; display: flex; align-items: center; justify-content: center; }
.card.fac .item-ico img { max-width: 84px; max-height: 76px; }
.card.fac .item-txt { min-width: 0; }
.card.fac .go[data-act="collect"] { margin-top: 6px; padding: 4px 12px; font-size: 13px; }
.fac-buy { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 92px; }
.fac-buy span { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.fac-buy .ico { width: 18px; height: 18px; }
/* スマホ：説明が細い列に押しこまれて読みにくかったので、ボタンは下の段に横長で置く（2026-11-16） */
@media (max-width: 480px) {
  .card.fac { flex-wrap: wrap; }
  .card.fac .item-txt { flex: 1 1 0; }
  .card.fac .fac-buy { flex: 1 1 100%; flex-direction: row; justify-content: center; gap: 12px; padding: 6px 12px; }
  .card.fac .lock-ico { margin-left: auto; }
}
.purse small { display: block; font-size: 12px; margin-top: 2px; }
.cel-build .cel-pic { max-height: 120px; animation: hop 1.2s ease-in-out infinite; }
@media (max-width: 620px) {
  #places { top: calc(max(10px, env(safe-area-inset-top)) + 190px); }
  #places button { width: 54px; font-size: 10px; }
  #places button .ico { width: 22px; height: 22px; }
}
@media (max-height: 500px) {
  #places { top: 8px; right: calc(max(10px, env(safe-area-inset-right)) + 60px); flex-direction: row; max-height: none; max-width: calc(100vw - 420px); overflow-x: auto; }
}

/* ---------- 右下の折りたたみメニュー・ページの点・村のダイアログ（2026-11-15。企画書 16-12） ---------- */
/* 閉じているときは、たたんだ一覧の分の見えない箱が右下の木をおおって押せなかった（2026-11-16）。ボタンと開いた一覧だけ押せる */
#fmenu { position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: var(--bottom); z-index: 7; pointer-events: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#fmBtn { pointer-events: auto; position: relative; width: 58px; height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 800; color: #fff8e6;
  background: linear-gradient(#b07a4c, #8a5a36); border: 3px solid var(--wood-d); border-radius: 18px; box-shadow: 0 3px 0 var(--wood-d), 0 6px 12px rgba(0, 0, 0, .3); cursor: pointer; }
.fm-bars { display: flex; flex-direction: column; gap: 4px; }
.fm-bars i { display: block; width: 22px; height: 3px; border-radius: 2px; background: #fff8e6; transition: transform .2s, opacity .2s; }
#fmenu.open .fm-bars i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#fmenu.open .fm-bars i:nth-child(2) { opacity: 0; }
#fmenu.open .fm-bars i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
#fmList { display: flex; flex-direction: column; gap: 6px; transform-origin: bottom right; transform: scale(.6) translateY(20px); opacity: 0; pointer-events: none; transition: transform .18s, opacity .18s; }
#fmenu.open #fmList { transform: none; opacity: 1; pointer-events: auto; }
#fmList button { position: relative; min-width: 118px; display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; font-size: 14px; font-weight: 800; color: var(--ink); text-align: left;
  background: linear-gradient(#fffaf0, #f3e2bc); border: 3px solid var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--edge), 0 5px 10px rgba(0, 0, 0, .2); cursor: pointer; }
#fmList .mi .ico { width: 28px; height: 28px; display: block; }
#fmList button:active { transform: translateY(2px); }
#fmBtn.ready::after, #btnVillage.ready::after { content: "!"; position: absolute; right: -8px; top: -9px; width: 22px; height: 22px; line-height: 18px; text-align: center; font-size: 14px; color: #fff; background: var(--red); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); animation: hop 1s ease-in-out infinite; }
#pageDots { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom) + 80px); display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 14px; background: rgba(30, 24, 14, .32); z-index: 5; transition: opacity .2s; }
#pageDots.hide { opacity: 0; pointer-events: none; }
#pageDots button { position: relative; width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 248, 230, .55); cursor: pointer; transition: transform .15s, background .15s; }
#pageDots button.on { background: #fff8e6; transform: scale(1.35); }
#pageDots button.base { width: 18px; height: 18px; border-radius: 6px; background: rgba(255, 248, 230, .55); display: grid; place-items: center; }
#pageDots button.base.on { background: #fff8e6; transform: scale(1.15); }
#pageDots button.base .ico { width: 15px; height: 15px; }
#pageDots button.base.alert::after { content: "!"; position: absolute; right: -9px; top: -10px; width: 16px; height: 16px; line-height: 13px; font-size: 11px; font-weight: 900; color: #fff; background: var(--red); border: 2px solid #fff; border-radius: 50%; animation: hop 1s ease-in-out infinite; }
#pageDots button.base.urgent::after { background: #e8792b; }
#village { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); background: rgba(20, 14, 6, .45); opacity: 0; transition: opacity .22s; }
#village.show { opacity: 1; }
.vil-card { width: min(720px, 100%); max-height: 100%; display: flex; flex-direction: column; background: linear-gradient(#fffaf0, #f6e9cc); border: 3px solid var(--wood-d); border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); overflow: hidden; transform: scale(.94); transition: transform .22s; }
#village.show .vil-card { transform: none; }
.vil-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; color: #fff8e6; background: repeating-linear-gradient(178deg, rgba(255, 255, 255, .05) 0 3px, transparent 3px 10px), linear-gradient(#b07a4c, #8a5a36); border-bottom: 3px solid var(--wood-d); }
.vil-head .ico { width: 28px; height: 28px; display: block; }
.vil-head b { flex: 1; font-size: 18px; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
#vilClose { width: 36px; height: 36px; font-size: 24px; line-height: 1; color: var(--ink); border: 3px solid var(--wood-d); border-radius: 50%; background: linear-gradient(#fffaf0, #f3e2bc); cursor: pointer; box-shadow: 0 2px 0 var(--wood-d); }
#vilCanvas { display: block; width: 100%; height: min(56vw, 400px, 46vh); flex: none; border-bottom: 3px solid var(--wood-d); touch-action: manipulation; cursor: pointer; }
#vilInfo { margin: 0; padding: 6px 12px; font-size: 12px; font-weight: 700; color: var(--wood); }
#vilList { overflow-y: auto; padding: 0 10px 12px; flex: 1 1 auto; min-height: 120px; }
.card.fac.flash { animation: focus 0.9s ease-in-out 2; }
#tuneBtn { bottom: calc(var(--bottom) + 120px) !important; }
@media (max-width: 620px) {
  #bar { left: max(8px, env(safe-area-inset-left)); transform: none; max-width: calc(100vw - 86px); }
  #fmBtn { width: 52px; height: 52px; }
  #fmList button { font-size: 13px; min-width: 108px; }
  #pageDots { bottom: calc(var(--bottom) + 66px); }
  #vilCanvas { height: min(78vw, 46vh); }
}

/* ---------- 下のボタン：道具（折りたたみ）・依頼・工房（2026-11-15。企画書 16-13） ---------- */
#toolWrap { position: relative; }
#toolMenu { position: absolute; left: 50%; bottom: calc(100% + 10px); display: flex; flex-direction: column; gap: 6px; transform: translateX(-50%) scale(.7); transform-origin: bottom center; opacity: 0; pointer-events: none; transition: transform .16s, opacity .16s; }
#toolWrap.open #toolMenu { transform: translateX(-50%); opacity: 1; pointer-events: auto; }
#toolMenu button[data-tool].on { background: linear-gradient(#ffe9a8, var(--gold)); }
#toolBtn .tool-more { position: absolute; left: 50%; top: -11px; transform: translateX(-50%); font-style: normal; font-size: 9px; color: var(--wood); background: #fffaf0; border: 2px solid var(--edge); border-radius: 8px; padding: 0 5px; line-height: 13px; }
#toolWrap.open .tool-more { transform: translateX(-50%) rotate(180deg); }
#bar .bb .badge { background: var(--red); font-size: 12px; min-width: 20px; text-align: center; animation: hop 1s ease-in-out infinite; }
#bar .bb.urgent .badge { background: #e8792b; }
#bar .bb .tool-pic .ico { width: 34px; height: 34px; }
#fmBtn > span:last-child { white-space: nowrap; letter-spacing: -.02em; }
@media (max-width: 620px) { #fmBtn > span:last-child { font-size: 9px; } }
/* 仲間が来たときのカード */
.helper-lead, .helper-note { margin: 4px 0 8px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.helper-note { font-size: 12px; color: var(--wood); }
.helper-jobs { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.helper-jobs li { display: grid; grid-template-columns: 34px auto 1fr; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(255, 255, 255, .7); border: 2px solid var(--paper-d); border-radius: 12px; font-size: 13px; opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
.helper-jobs li.in { opacity: 1; transform: none; }
.helper-jobs li .ico { width: 30px; height: 30px; }
.helper-jobs li b { white-space: nowrap; }

/* ページの移動：画面の左右のボタン（2026-11-16。企画書 16-15） */
.page-arrow { position: fixed; top: 46%; z-index: 6; display: flex; align-items: center; gap: 4px; padding: 10px 10px; font-size: 12px; font-weight: 800; color: #fff8e6;
  background: rgba(70, 45, 22, .72); border: 2px solid rgba(255, 240, 210, .55); box-shadow: 0 3px 10px rgba(0, 0, 0, .3); cursor: pointer; backdrop-filter: blur(2px); }
.page-arrow.left { left: 0; padding-left: max(8px, env(safe-area-inset-left)); border-left: 0; border-radius: 0 16px 16px 0; }
.page-arrow.right { right: 0; padding-right: max(8px, env(safe-area-inset-right)); border-right: 0; border-radius: 16px 0 0 16px; }
.page-arrow .pa-arrow { font-size: 16px; }
.page-arrow:active { background: rgba(110, 72, 36, .85); }
@media (max-width: 620px) { .page-arrow { padding: 8px 6px; font-size: 10px; flex-direction: column; gap: 0; } .page-arrow.left { padding-left: max(5px, env(safe-area-inset-left)); } .page-arrow.right { padding-right: max(5px, env(safe-area-inset-right)); flex-direction: column-reverse; } }
