diff --git a/.achievement_data/.gitkeep b/.achievement_data/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/.achievement_data/.htaccess b/.achievement_data/.htaccess
new file mode 100644
index 0000000..fa39801
--- /dev/null
+++ b/.achievement_data/.htaccess
@@ -0,0 +1,6 @@
+
+ Require all denied
+
+
+ Deny from all
+
diff --git a/.htaccess b/.htaccess
index fc13343..1a8ccd5 100644
--- a/.htaccess
+++ b/.htaccess
@@ -8,8 +8,14 @@
ExpiresByType image/webp "access plus 30 days"
ExpiresByType audio/mpeg "access plus 30 days"
ExpiresByType audio/wav "access plus 30 days"
+
+
+ Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
+ Header set Pragma "no-cache"
+ Header set Expires "0"
+
Header set Cache-Control "no-cache, must-revalidate"
Header set Pragma "no-cache"
diff --git a/.tmp-edge-profile2/Crashpad/settings.dat b/.tmp-edge-profile2/Crashpad/settings.dat
deleted file mode 100644
index 3b20fde..0000000
Binary files a/.tmp-edge-profile2/Crashpad/settings.dat and /dev/null differ
diff --git a/.tmp-edge-profile2/Crashpad/throttle_store.dat b/.tmp-edge-profile2/Crashpad/throttle_store.dat
deleted file mode 100644
index 9639e1b..0000000
--- a/.tmp-edge-profile2/Crashpad/throttle_store.dat
+++ /dev/null
@@ -1 +0,0 @@
-level=none expiry=0
diff --git a/ACHIEVEMENT_AUDIT.md b/ACHIEVEMENT_AUDIT.md
new file mode 100644
index 0000000..5f3a086
--- /dev/null
+++ b/ACHIEVEMENT_AUDIT.md
@@ -0,0 +1,268 @@
+# 実績システム再監査レポート v39.16.78
+
+対象: 全72実績、解除イベント、判定順序、進捗リセット、保存・復元、Undo/Redo、サーバー同期
+方針: 前回重点対象だった「自分のずんち」「敵の敵は味方」だけでなく、これまで大きく取り上げていなかった実績を再度コード経路から監査した。明確な不具合は修正し、ゲームデザイン判断が必要な条件は変更していない。
+
+## 1. 今回新たに確定・修正した不具合
+
+### 1.1 「ミニマリスト」: プレイヤー設置物情報が保存されなくなる
+
+`ミニマリスト` は「現在存在するプレイヤー設置物が10個以下」を判定するため、各アイテムの `_achievementPlayerPlaced` を必要とする。
+
+旧実装では、この情報を保存する条件が実質的に `無計画都市` の未解除状態へ依存していた。そのため、`無計画都市` を先に解除した後にセーブ・ロードすると、既存アイテムのプレイヤー設置情報が失われ、`ミニマリスト` の物数判定が過少になる可能性があった。
+
+**修正:** `無計画都市` と `ミニマリスト` のどちらかが未解除なら、プレイヤー設置情報を保存する。30秒削除用の設置時刻は従来どおり `無計画都市` に必要な場合だけ保存する。
+
+---
+
+### 1.2 「サウナ水風呂」: 高温開始時刻が更新され続ける
+
+条件は「暑すぎる状態になった個体を15秒以内に寒すぎる状態へ移す」だが、旧実装は高温状態を評価するたびに開始時刻を現在時刻へ更新していた。
+
+このため、長時間高温に置いた後でも、寒冷へ移した直前の評価時刻との差だけで15秒以内と判定され得た。
+
+**修正:** 快適域外の高温状態へ**入った瞬間**だけ開始時刻を記録し、連続して高温にいる間は更新しない。高温状態を離れてから再び入った場合は新しい試行として時刻を記録する。
+
+---
+
+### 1.3 「抵抗器じゃない」: 致死感電した7体目がカウントされない
+
+旧実装では感電ダメージを与えた後に実績カウントを行っていた。感電が致死になると対象は死亡済みになり、`recordWireShock` の生存チェックで除外されるため、7体目がその感電で死亡すると解除できない場合があった。
+
+**修正:** 有効な感電を確認した時点で、ダメージ適用より先に実績カウントを行う。致死・非致死のどちらでも、その感電自体は1体分として扱う。
+
+---
+
+### 1.4 実績リセット後に隠れた途中進捗が残る
+
+全実績リセット後も、World・たりない・アイテム本体に直接保持された一部の途中状態が残っていた。そのため、リセット直後に少ない追加操作だけで再解除できる実績があった。
+
+**修正したリセット対象:**
+
+- 同一個体への直接給餌回数・直接治療回数
+- サウナ開始時刻・直前高温状態
+- たりない保持開始時刻
+- 喧嘩餅から喧嘩開始までの一時情報
+- 粘着爆弾の受け渡し回数
+- `無計画都市` 用の配置時刻
+- 自然奴隷・自然王の世代進捗
+
+`ミニマリスト` が現在の配置物を正しく識別するため、既存アイテムの「プレイヤーが配置した物か」という事実自体はリセットで消していない。
+
+---
+
+### 1.5 「監視カメラ」: Undo/Redo・地面変更が介入になっていない
+
+配置・削除・給餌・つつく・射撃などは観察タイマーをリセットしていた一方、Undo、Redo、有効な地面変更は世界状態を変更する操作なのに観察タイマーをリセットしていなかった。
+
+**修正:** 成功したUndo/Redo、および実際に地面種別が変わった操作を介入として記録する。
+
+---
+
+## 2. 前回重点対象の修正状態
+
+### 「あぁ^~ たまらねぇぜ」
+
+現在の条件は次の経路で成立する。
+
+`おしり鋲でずんち蓄積 → おしり鋲を抜いて排出 → 排出ずんちが本人から一度離れる → バウンス柵等で反射・加速 → 本人へ帰還して致死衝突`
+
+- 生成直後の本人との重なりは衝突扱いしない。
+- 本人から一度離れた後に帰還した衝突だけを自己帰還として扱う。
+- 非致死では解除しない。
+- バウンス柵による反射・加速は資格を失わせない。
+- 停止済み・プレイヤー保持済みの排出ずんちは対象外。
+- 致死処理で本人の生存IDが解放されても、ダメージ前に所有者一致を保持するため解除可能。
+
+### 「敵の敵は味方」
+
+30体以上の状態で稼いだ連続数は、生存たりないが30体未満になった時点で0へ戻る。危険カテゴリのアイテムによるたりないへのダメージでも従来どおりリセットする。
+
+前回ユーザー確認済みの「無傷」の範囲、戦闘ペア危険死の期限、機械化産業の履歴AND条件は現行仕様のまま変更していない。
+
+---
+
+## 3. これまで大きく取り上げていなかった実績の再監査結果
+
+### 生態・繁殖
+
+- `はじめての繁殖`、`ベビーブーム`、`大いなる母` は実際の繁殖成功イベントから接続されている。
+- `天寿`、`水銀で天寿` は最終確定した死亡理由を受けた後に判定される。
+- `25体全員が病気` は睡眠病だけを除外し、ずんち病・爆発病・喧嘩病を対象としている。
+- `管理された楽園` は6日目以降から連続1ゲーム日を計測する。
+- `安全第一` は25体以上を300ゲーム秒維持し、天寿以外の死亡で再計測する。天寿後に25体を下回れば人数条件によって停止する。
+- `自給自足` は20体以上・複製機なし・直接給餌なしを600ゲーム秒維持するフィールド内条件。
+- `雨宿り完了` は現行の雨天である小雨時に、パラソル・巣箱・土管の保護判定を使う。
+- `町のお医者さん` は応急手当を使った回数ではなく、実際にHPが1以上回復した回数だけを累計する。
+- `豊穣ヲ希求スル者` はラブ餅の影響下で成立した繁殖だけを累計する。
+
+**追加の到達不能・イベント未接続は確認されなかった。**
+
+### 実験・危険行動
+
+- `6番目の大量絶滅` は同一Worldの10ゲーム秒ローリング区間で死亡50件。
+- `豆野、殺ッカーやろうぜ!` は通常ボールの速度条件を満たした致死衝突から直接接続される。
+- `ヘコヘコ中に着火` は着火処理が繁殖儀式状態を消す前に判定される。
+- `下剤中の餓死` は死亡フレームの下剤状態を保持して判定する。
+- `物理法則を下側に超越` はアイテム位置の実温度計算を走査しており、温度効果の重畳で到達可能。
+- `おくすり手帳全埋め` は現行仕様どおり11種類を対象とし、鎖・王冠は除外する。
+- `革命` は王の喧嘩死と、直前0.1ゲーム秒以内の奴隷による喧嘩ダメージを照合する。
+- `火に油` は喧嘩餅を受けた個体が30ゲーム秒以内に参加する喧嘩開始を判定する。
+- `五体満足` / `零体満足` は状態効果付与時と自然ステータス変化時の双方から再評価される。
+- `混沌ヲ希求スル者` は喧嘩餅影響下の喧嘩開始だけを永続累計する。
+- `命のバトン` は同じ生存中の粘着爆弾の受け渡し回数を保存・復元する。
+- `情報化産業` は別々の2基盤を電線類で直接つなぎ、信号が実際に伝達された経路から解除される。
+
+**追加の確定不具合は「抵抗器じゃない」の致死感電順序だけで、修正済み。**
+
+### 建築・環境
+
+- `物でいっぱい` はプレイヤー配置イベントを永続累計し、リンク類の配置も配置として数える。
+- `清掃業者` はロボット掃除機による有効な清掃200回のフィールド内進捗で、現行ドキュメントと一致する。
+- `潔癖症` は生存たりない0、生存アリ0、生存アイテムがロボット掃除機のみ、かつ条件を満たす稼働掃除機が存在する場合に成立する。死亡たりないは死亡直後に非表示となり定期圧縮されるため、画面上の死体残留との矛盾は確認されなかった。
+- `メガロポリス` は100体・複製機10・草ベッド/巣箱/土管合計15の境界値で評価される。
+- `砂場` は生存中のトイレ5個で成立する。
+- `そこ公共空間だよ?` は公園フィールドで実際に地面変更が成立した時だけ解除する。
+- `破格の工事費用` は壁時計1秒以内の有効な地面変更4回を数える。
+
+**追加の確定不具合は「ミニマリスト」の保存メタデータだけで、修正済み。**
+
+### 操作・継続
+
+- `秘密のコレクション` は9スロットすべてに実セーブハッシュがあることを確認する。
+- `何やってるの?` は空フィールドへのクリックだけを壁時計1秒内に4回数える。
+- `見なかったことにしよう` は1回のUndo前後で死亡個体が10体以上減った場合に成立する。
+- `やっぱなし` / `やっぱあり` は成功したUndo/Redoだけを永続累計する。
+- `割とふわふわ` は共通の「つつく」対象判定からぬいぐるみを飛ばした場合に成立する。
+- `狙撃手` は命中ではなく発砲333回を永続累計する。
+- `スペックがたりない` は有効な計測FPSが10未満になった場合で、非表示タブ由来の異常なフレーム間隔を除外する。
+- `毎日たりない観察` はローカル暦の日付単位の7日連続起動。
+- `寝ろ` / `めっちゃたりない観察` は壁時計の連続経過で、現行仕様どおりタブ非表示時間も継続として扱う。
+- `真・たりない観察` は自身以外の71実績が解除済みかを判定する。
+
+**追加の確定不具合は「監視カメラ」の介入漏れと、全実績リセット後の隠れ進捗残留で、修正済み。**
+
+---
+
+## 4. 仕様確認が必要な曖昧点 — 現在は未変更
+
+以下は実装が壊れているとは断定できず、表示文から複数の解釈が成立するため、回答を受けるまで条件変更を行っていない。
+
+### Q1. 「ずんちどれい」「たりない王」の「出現」範囲
+
+現行は**喧嘩戦績による自然変身だけ**で解除する。
+
+- 鎖を付けて奴隷化 → 対象外
+- 王冠で王化 → 対象外
+- 奴隷同士から生まれた生来の奴隷 → 対象外
+
+候補:
+
+- **A: 現行どおり** — 喧嘩戦績による変身だけ
+- **B: 人工付与以外** — 喧嘩戦績変身 + 生来の奴隷を対象。鎖・王冠は除外
+- **C: 文字どおり全出現** — 鎖・王冠を含め、状態になった時点で解除
+
+### Q2. 「末代までの恥」「華麗なる王族」の「○代連続」
+
+現行は**同じ家系でなくても、自然変身した個体の世代番号が連番なら成立**する。例えば無関係な家系の2代・3代・4代・5代・6代に自然奴隷が1体ずついれば5代連続になる。
+
+候補:
+
+- **A: 現行どおり** — 世界内の世代番号の連続
+- **B: 直系家系限定** — 親子関係を辿って同じ系譜で連続して状態が続く必要がある
+
+Q1で生来の奴隷を対象にする場合、Q2の奴隷5代判定にもその出生を含めるかを合わせて決める必要がある。
+
+### Q3. 「過保護」の「薬で治療」
+
+現行は、薬カテゴリの直接使用なら効果の善悪を問わず治療回数に加算する。対象には応急手当だけでなく、睡眠薬、下剤、プロテイン、ニテロプ、弾薬、水銀、巨大化薬、小型化薬なども含まれる。
+
+候補:
+
+- **A: 現行どおり** — 薬カテゴリの直接使用3回
+- **B: 治療系アイテムだけ** — 対象薬を明示的に限定
+- **C: 実際に有益な回復が発生した使用だけ**
+
+### Q4. 「無計画都市」の「削除する操作を累計30回」
+
+現行は**操作回数ではなく、30秒以内に削除された対象物1個につき1回**進む。範囲削除1回で対象物を10個消した場合、最大10進む。
+
+候補:
+
+- **A: 現行どおり** — 削除した対象物数を数える
+- **B: 削除コマンド単位** — クリック/範囲削除の1実行を1回として数える
+- **C: 連続削除ジェスチャ単位** — 押している間の連続削除を1回として数える
+
+### Q5. 「監視カメラ」の5分と「見るだけ」の意味
+
+現行は**300ゲーム秒**。高速化すれば実時間5分より早く解除できる。今回、世界を変更するUndo/Redo・地面変更も介入として追加したが、UI操作、セーブ、速度変更、ポーズ、空クリックなど世界を直接変更しない操作はタイマーを止めない。
+
+時間基準:
+
+- **A: 現行どおり300ゲーム秒**
+- **B: 実時間5分**
+
+「見るだけ」の入力基準:
+
+- **1: 現行どおり世界への介入だけでリセット**
+- **2: ほぼすべてのユーザー操作でリセット**
+
+例: `Q5 = A1` のように指定可能。
+
+### Q6. 「抵抗器じゃない」のセーブ/Undo跨ぎ
+
+現行の「同じ1本」はランタイム中の同一電線オブジェクト。セーブロードやUndo/RedoでWorldが再構築されると、1~6体までの途中人数は失われる。
+
+候補:
+
+- **A: 現行どおり** — 7体すべてを同じランタイム中に感電させる
+- **B: 同じ保存上の電線なら継続** — セーブロード後も電線ごとの途中人数を保存する
+
+### Q7. 「害虫駆除」の「アリを倒す」主体
+
+現行は**アリが死亡した事実をすべて累計**する。プレイヤーの危険アイテムだけでなく、たりないとの戦闘、設備・環境など別要因で死亡しても1体として数える。
+
+候補:
+
+- **A: 現行どおり** — 死亡したアリをすべて数える
+- **B: プレイヤー由来の撃破だけ**
+- **C: プレイヤーまたはたりない陣営が倒した場合だけ**
+
+---
+
+## 5. 前回ユーザー確認済みの仕様 — 変更なし
+
+以下は前回の確認により現行仕様を維持している。
+
+- 戦闘ペア危険死: 第1死亡から第2死亡まで同一World内で明示的な時間制限なし。
+- 機械化産業: ロープ・棒・ばねの配置履歴と信号作動履歴のAND。現在同時に存在する必要なし。
+- 敵の敵は味方: 「無傷」は危険カテゴリ由来のたりないへのダメージをリセット対象とし、あらゆるダメージを禁止する意味ではない。
+
+---
+
+## 6. 検証結果
+
+v39.16.78 に対して以下を実行し、すべて成功した。
+
+- JavaScript全ファイル・監査スクリプトの `node --check`
+- 全72実績の定義・カテゴリUI・同期監査
+- プレイスタイル実績の境界値・リセット範囲・永続化・フック監査
+- 「あぁ^~ たまらねぇぜ」専用の生成直後除外 / 離脱 / 帰還 / 致死・非致死回帰テスト
+- サウナ開始時刻、実績リセット、監視介入、ミニマリスト保存情報、致死感電の追加回帰テスト
+- 実績イベント統合監査
+- サーバー状態・旧形式移行・並行同期監査
+- 全体回帰監査 `scripts/regression_check.py`
+- Python監査スクリプトのコンパイル確認
+- `achievement_api.php` のPHP構文確認
+
+結果はすべて `[OK]`。今回の再監査で新たに確認した**確定不具合は5系統で、すべて修正済み**。上記Q1~Q7は仕様回答待ちのため、v39.16.78では現行挙動を維持している。
+
+
+## Confirmed specification decisions (39.16.78)
+- ずんちどれい / たりない王: birth-status appearances also qualify.
+- 末代までの恥 / 華麗なる王族: only a direct qualifying parent-child lineage counts.
+- 過保護: a treatment counts only when the direct use actually improves the health need.
+- 無計画都市: one deletion operation counts once, even if area deletion removes multiple objects.
+- 監視カメラ: requires 3 uninterrupted game days; gameplay operations are interventions.
+- 抵抗器じゃない: partial wire progress remains nonpersistent across save/load and Undo.
+- 害虫駆除: only player-caused ant deaths count.
diff --git a/AI_MAP.md b/AI_MAP.md
index b393891..820acb1 100644
--- a/AI_MAP.md
+++ b/AI_MAP.md
@@ -6,7 +6,7 @@ Purpose: static Japanese browser simulation/game. Optimize context by reading th
- Entrypoint: `index.html` defines the app shell, canvas, dialogs, right panels, and exact script order.
- Runtime style: plain browser JS, global IIFEs, exports on `window`, no bundler/module loader.
-- Version/cache: `app_manifest.json`, `js/version.js`, and generated `service-worker.js` share `39.16.18`.
+- Version/cache: `app_manifest.json`, `js/version.js`, generated `service-worker.js`, and `index.html` query params share `39.16.78`.
- Main loop: `js/main.js` initializes assets/audio/world/UI/save, then drives update/render.
- Performance/display settings: `js/perf_profiler.js` owns manual visual settings and profiler buckets; display tiers affect rendering/visuals, not simulation-quality branches.
- Update order: `js/system_order.js` calls phase facades from `js/simulation_systems.js`.
@@ -81,3 +81,25 @@ This section records current boundaries only. Version-by-version cleanup history
- Effect-specific spatial indexing, fuller delta-history storage, and high-speed collision partitioning. These need new indexes or semantics beyond cleanup.
- UI/text-side meaning consolidation, including labels, wrapping/measurement helpers, and duplicated scalar helpers such as `num`, `finiteOr`, `isObject`, and `clonePlain`.
- Further `World.prototype` reduction is possible, but only for helpers proven not to be runtime-facing canvas/UI/tool APIs.
+
+## Current Feature Routing
+
+- Achievement system: `js/achievements.js`, `achievement_api.php`, `js/save_schema.js`, `js/save_codec.js`, `js/snapshot_system.js`, and achievement audit scripts. Current save schema is `49`; current app/cache version is `39.16.78`.
+- Achievement UI: `index.html` achievement dialog, `css/components.css` achievement rows/toast styles, and `js/achievements.js` DOM rendering.
+- Achievement spell payload: `TarinaiAchievements.exportSpellState()`, `snapshot.g.s`, `save_system.js` spell export inclusion, and `save_codec.js` achievement metadata readers/writers.
+- Logic board: `js/circuit_board_system.js`, `js/signal_system.js`, signal-related item definitions/metadata, and the generated circuit editor markup/styles.
+- Shared play: `js/seesaw_system.js`, tarinai action/need modules, placement preview, and item/structure definitions.
+- Reset presets: `js/world_reset_presets.js`; UI reset selection is in `js/ui_layout_dialogs.js`; social archive reset/fallback routing touches `js/world_family_social.js`.
+- Physics tool icons and previews: `js/ui_tools.js`, `js/render.js`, `js/placement_preview_system.js`, `js/physics_shape_editor_system.js`, and `js/item_tool_metadata.js`.
+
+## Cleanup Candidate Audit - resolved
+
+The previous cleanup candidate queue has been applied or adjusted. Current state:
+
+- Version/docs routing was aligned to `39.16.78`; `js/version.js` build identity now matches the app version, and `README.md` no longer points at an older cache-query script URL.
+- One-version and overlapping audit scripts from the candidate list were removed; the broad audit suite remains `scripts/achievement_audit.js`, `scripts/playstyle_achievement_audit.js`, `scripts/achievement_integration_audit.py`, `scripts/achievement_server_state_audit.py`, and `scripts/regression_check.py`.
+- Shared scalar/object/clone/hash/text helpers now live on `TarinaiCoreHelpers` in `js/deterministic_helpers.js`; action, behavior, structure, snapshot, save, geometry, physics, seesaw, placement-preview, circuit, and signal code route repeated helper logic through that shared surface or through `TarinaiGeometry`.
+- UI HTML escaping is owned by `js/ui_helpers.js`; consumers bind explicitly to `TarinaiUIHelpers.htmlEscape`, and `index.html` loads `ui_helpers.js` before the consumers that need it.
+- `js/achievements.js` uses `renderIfDialogOpen()` for progress refreshes instead of repeating the hidden-dialog check at each event recorder.
+- `js/world_placement_log.js` uses shared close/backdrop binding for editor dialogs; deeper editor extraction can still be done as feature work, but the repeated close process from the cleanup list is removed.
+- `FILES.json` now includes JavaScript audit scripts and newer core bootstrap files (`domain_ids`, deterministic helpers, item registries/definitions) in machine routing.
diff --git a/BUILD_NOTE.txt b/BUILD_NOTE.txt
index f988d61..55074fa 100644
--- a/BUILD_NOTE.txt
+++ b/BUILD_NOTE.txt
@@ -5,8 +5,8 @@ tarinai_compact_save_stage4
- The binary header contains one schema byte; its high bit signals whether a string table follows. Empty string tables and the duplicate snapshot version are omitted.
- Deflate state is folded into the low bit of the frame-length varuint, eliminating the separate compression byte.
- 15-bit text conversion uses arithmetic Unicode range mapping instead of a 32768-character string and reverse Map.
-- Previous binary schemas are intentionally unsupported.
-- Version: 39.16.18
+- Binary schema 51 is the current save format; schemas 49 and 50 remain readable. Achievement payload v6 stores 72 unlock bits and persistent statistician progress while v5 remains importable.
+- Version: 39.16.94
- CompressionStream and DecompressionStream are drained concurrently to avoid browser backpressure stalls.
- Load confirmation uses the in-game dialog; fan wind is realtime; zunchi tool preview opacity, carried plushie depth, and blanket grass rules were corrected.
@@ -27,3 +27,236 @@ tarinai_compact_save_stage4
- v39.16.16: colony population chart records births/deaths, rotators accept negative motor speed, champion personality boosts inherit through descendants, champion-pair mating is slightly reduced, and one-way fence previews/pathfinding honor the passable direction.
- v39.16.16: one-way fences allow Tarinai forward crossing in swept collision; chart legend dots toggle series; wire tools attach to Tarinai/ants; energized living endpoints panic and take damage; selected data reports electrocution.
+
+- v39.16.19: added direct food/medicine giving by placement or pinched drop, with a give overlay, stronger food-gift personality change, and heart bursts; removed unused collision reasons and duplicate constraint projection dirty checks.
+
+- v39.16.20: localized the direct-feeding personality reason, normalized electrocution deaths to the Japanese electrocution label, added detector-controlled gate fences, made chart legend labels fully clickable, and escaped non-ASCII runtime source.
+
+- v39.16.21: hid pinch overlays for rope/rod/spring/wire connection items and added detector time schedules with a dual-thumb range control, overnight ranges, and persistent copy/save state.
+
+- v39.16.22: shortened detector copy, removed the time-range explanatory hint, cascaded connection-item removal when any endpoint disappears, and repaired detached plushies so they return to a living owner or disappear with a missing owner.
+
+- v39.16.23: excluded transient splat effects from all connection endpoint selection and renamed the user-facing feeding need from the formal feeding term to the appetite label.
+- v39.16.25: added toilet-seeking before normal defecation; renamed rain shelter to parasol; added sunny +3.5C and unsheltered rain -3.5C felt-temperature corrections; parasols neutralize both and block sunbathing. Pet food, first aid, and sedative remain included.
+
+- v39.16.29: replaced toilet-seeking with walkable toilet sand that immediately removes poop spawned on its surface; added a parasol ground shadow and explicit hot-sun/cold-rain temperature-seeking targets; fixed null candidate temperatures being interpreted as 0C.
+
+- v39.16.29: aligned parasol placement overlay with its shade, made toilet sand absorb rain water, expanded Happy/Athletic/War presets, simplified Athletic rotators, and reserved their full rotation envelope from fences.
+
+- v39.16.30: added a few bounce fences to War, reduced ordinary-fence restitution, restored ball collisions for visible sleeping Tarinai, moved nest-box tooltips closer, allowed movable-item placement overlap, and fixed delete-tool target lookup.
+
+- v39.16.31: unified in-world tooltip spacing, added the Hair Trigger preset, and replaced physics-category line-like tool icons with distinct semantic silhouettes.
+
+- v39.16.35: moved snap-mode switching to a dedicated operation control with Free/20px/40px/60px cycling, removed F/G from size badges, allowed valid placement against the field top edge, and standardized preset descriptions with Japanese full stops.
+
+- v39.16.37: unified biological/environmental conditions into the detector, removed the standalone sensor and relay types with no save migration, folded temperature/limits, moved secondary controls into the header menu, preserved tool mode while browsing tarinai data, and added five-second mobile selection tips.
+
+- v39.16.38: detector numeric sliders match the time-control presentation; colony settings are unified; display settings are inline; meter colors, snap control, range-delete icon, and ant chart defaults are revised.
+
+- v39.16.39: restored the compact sticky operation palette, added exact-match panel search, reorganized colony settings/stats, and refreshed range-delete and mechanism icons.
+- v39.16.40: moved partial panel search to the header with previous/next navigation and tooltip text indexing; localized snap mode labels; simplified bounce-fence and reciprocator icons; matched expanded colony settings to the chart background.
+
+39.16.41: Added local achievements and optional self-hosted shared unlock percentage API.
+
+39.16.42: Expanded achievements to ten conditions, added local/shared reset, rapid-event windows, generation streaks, and special collision tracking.
+
+39.16.44: Expanded achievements to fifteen conditions, changed rapid deaths to 50 in 10 seconds, moved conditions into game tooltips, added toast-to-button absorption, and added colony disease/happiness, cumulative hand feeding, ritual ignition, and laxative-starvation achievements.
+
+39.16.44: Audited all achievements; fixed impossible slave generation tracking, persisted generation runs, queued simultaneous unlock toasts, hardened launched-zunchi stop detection, and preserved laxative-at-death timing.
+
+39.16.45: Added seven play-style achievements for passive observation, fifty world placements, detector automation, rope/rod/spring coverage, a five-minute death-free 25-Tarinai colony, 25 live ants, and 30 cumulative ant kills; persisted world-scoped timers and placement progress.
+
+39.16.46: Revised achievement naming and disclosure UI, replaced achievement tooltips with inline post-unlock descriptions and horizontal shared-rate bars, merged detector automation plus link coverage into 機械化産業, changed placement and ant-kill goals to persistent totals of 100, and made direct-feeding progress reset with the field.
+
+39.16.47: Added 大いなる母 and 喧嘩両成敗, renamed five achievements, revised five revealed descriptions, and added a debug-only all-achievements button.
+
+39.16.48: Corrected the zunchi-slave fight-record threshold text to 30%; fixed wire placement totals, danger-kill attribution for 喧嘩両成敗, partial legacy link migration, strict player-ID validation, post-unlock storage writes, and debug-only unlock isolation from shared statistics.
+
+39.16.49: Added additive client-to-server full-state synchronization for automatic aggregate recovery after server-side achievement data loss.
+
+39.16.51: Expanded achievements from 27 to 43 with history, cleanup, care, ecology, temperature, weather, medicine, combat, and ant-experiment conditions; persisted the required reset-scoped metadata in a new incompatible save schema; made nest-box and pipe occupants weather-protected; and added false-positive guards for time-zero markers and stale ant damage attribution.
+
+39.16.52: Reorganized achievements into four collapsible categories, removed achievement tooltips, surfaced pre-unlock disclosures in the achievement UI, and replaced native browser confirmations with a shared in-game dialog.
+
+
+39.16.53: Renamed the four achievement categories to 生態/実験/建築/その他, moved unlocked achievements to the top of their own categories, disclosed four additional conditions before unlock, raised 大いなる母 to 3333 births, and moved achievement unlock toasts to the upper-left.
+
+39.16.54: Added 真・たりない観察, 悠久の歴史, 五体満足, and 零体満足; disclosed 悠久の歴史 before unlock; reduced achievement overhead by skipping closed-dialog list rebuilds, caching category mappings, debouncing pending sync, and retaining periodic full recovery sync.
+
+39.16.55: Added 町のお医者さん and 割とふわふわ; changed ベビーブーム to 30 births per minute and 管理された楽園 to one uninterrupted happy in-game day from play day 6; repaired shared つつく targeting, damage, plushie fling, and hover overlay; corrected manual rotator/reciprocator push direction; tightened tool/limit typography; reduced periodic achievement scans; and changed server aggregate writes to compact v2 JSON with legacy-state migration.
+39.16.56: Added 混沌ヲ希求スル者 and 潔癖症; made fight progress persistent; revised ミニマリスト, おくすり手帳全埋め, and 清掃業者; and made achievement-rate bars visible on unlocked cards.
+
+39.16.57: Compactly embeds unlocked achievements and persistent achievement progress in exported spell saves; spell loads merge achievements without erasing local progress and resync restored unlocks to the server.
+
+39.16.59: Replaced JSON-string achievement metadata in spell/save binaries with a sparse binary schema; achievement unlock masks are raw bits, progress is bit-packed, timestamps use minute deltas, and old v39.16.57 spells remain readable.
+39.16.60: Added persistent sniper, megalopolis, and love-mochi fertility achievements; changed chaos progress to fight-mochi-influenced fights only; extended compact spell progress without migrating obsolete generic fight counts; omitted completed achievement counters from spell metadata; and tightened population-limit labels/layout.
+
+39.16.62: Expanded achievements from 54 to 59 with single-digit FPS, 24-hour continuous play, five toilet-sand placements, park-ground editing, and four ground changes per second; revised safety, observation, and empty-click conditions; moved the two observation achievements to the bottom of その他; and expanded binary achievement masks to eight bytes while retaining schemas 41–43.
+
+39.16.63: Fixed achievement progress typography and tab-switch observation continuity; added アリ観察 and 命のバトン; persisted sticky-bomb pass counts; aligned sauna/enemy-ant conditions; removed obsolete spell compatibility; current exports use schema 45 and achievement payload v4.
+
+## v39.16.64
+- Added 毎日たりない観察 and 抵抗器じゃない.
+- Daily streak state is carried by achievement payload v5 and binary schema 46.
+- Achievement aggregate JSON migrates compact v2/verbose input to compact v3 automatically under the API file lock.
+
+## v39.16.65
+- Re-audited the not-yet-deployed shared achievement server with generated randomized unlock data instead of a fixed production sample.
+- Shared summaries are read-only; only POST session/unlock/sync/reset calls register or update players, and GET mutations are rejected.
+- State writes now use a separate lock file plus atomic same-directory replacement, preserving the previous state across interrupted writes.
+- Invalid or structurally unknown JSON returns `storage_corrupt` without overwriting the source file.
+- `completionistEligible: false` now prevents `true_tarinai_observer` from being re-added by the same sync payload.
+- The randomized server audit covers 32 v2/verbose migrations and 72 concurrent player syncs with exact semantic comparison.
+
+## v39.16.66
+- Added seesaw cooperative play and friendship growth.
+- Added circuit-board editor with positioned input/output terminals and AND/OR/NOT gates.
+- Added electrical control for fan, stove, dry ice, and duplicator.
+- Added connectable-item and circuit-terminal highlights while wiring.
+- Save snapshot/schema: 38/47.
+
+## v39.16.67
+- Circuit board editor now uses a grid canvas with direct gate placement and cursor-drawn wiring.
+- Legacy circuit layouts are intentionally not converted.
+- Colony state evaluates every two in-game hours; growing populations cannot be classified as Weakened.
+- Seesaw action selection, fixed orientation, and placement preview were corrected.
+
+## v39.16.68
+- Seesaw leisure can start at a lower boredom threshold, and a waiting rider raises the second rider's action priority.
+- Active paired play is shown as 「シーソーをしている。」 in selected Tarinai data.
+- Seesaws render in the low/back item layer instead of covering Tarinai sprites.
+- AND/OR gate input pins and gate outputs are snapped to the same 40px circuit-editor grid used by cursor wiring.
+
+## v39.16.69
+- Circuit-board internal wiring now uses straight grid segments with explicit branch junctions and unlimited fan-out per terminal.
+- Removed OR and added a one-input/one-output rectifier; internal logic parts rotate in 90-degree steps.
+- Circuit-board external terminal counts and positions are editable; the board footprint and default terminal spacing were expanded.
+- Detector numeric conditions now use a dual-thumb minimum/maximum range plus direct numeric inputs.
+- Seesaw riders render slightly above the seat surface.
+- Save snapshot/schema: 39/48. Older saves are intentionally unsupported.
+
+
+## v39.16.70
+- The default circuit-board grid is now 10x6, one quarter of the previous editor area, with a correspondingly smaller world footprint.
+- Circuit-board width and height are editable; the board world size follows the grid dimensions.
+- Input/output terminal count is limited by board height, and every external terminal can be dragged independently onto the left, right, top, or bottom edge.
+- Branch junctions can be moved directly; all connected straight segments follow the junction.
+- NOT and rectifier bodies are visually smaller while their pins remain on grid intersections.
+- Existing external wires follow terminal positions after a board resize or terminal move.
+- Seesaw action reasons now use play-specific wording instead of inheriting unrelated fulfillment reasons such as bed demand.
+- Save snapshot/schema: 40/49. Older saves are intentionally unsupported.
+
+
+## v39.16.71
+- Circuit-board external terminals are now placed directly with IN/OUT terminal tools; the +/- terminal-count controls were removed.
+- Disconnected external terminals are dimmed in the circuit-board editor; connected terminals retain their signal colors and cannot be deleted until their world wire is removed.
+- Placement previews no longer use the generic ellipse fallback: circle items use circles, obstacle/mechanical items use their collision footprints, and special items use dedicated shapes.
+- Detector, wire, insulated wire, and circuit board moved from the Physics palette section to a new Electrical section.
+- Clicking a detector dual-range track outside either thumb teleports the nearer thumb to the clicked value.
+- Save snapshot/schema remains 40/49; the persisted circuit-board v4 structure is unchanged.
+
+
+## v39.16.72
+- Circuit-board default grid is 10x10 and both dimensions can grow to 20x20; the world footprint scales proportionally in both axes.
+- AND gate body height is two grid cells. Compact one-input parts can be placed one grid row from the top/bottom edges when their rotated pins remain in bounds.
+- Placement previews prefer shared occupancy/collision footprints; the dedicated seesaw preview was removed and circuit boards use their rectangular board footprint.
+- Internal combinational feedback loops are explicitly detected and forced OFF; a NOT self-loop is unstable and does not provide power.
+- Save snapshot/schema remains 40/49; the persisted circuit-board v4 structure is unchanged.
+
+
+## v39.16.73
+- Circuit-board editing shows placement ghosts for pending internal parts and terminals.
+- Q/E rotates pending internal parts by 90 degrees before placement.
+- The ON constant source is documented in the editor.
+- Wire and insulated-wire palette silhouettes render correctly in the Electrical category.
+- Save snapshot/schema remains 40/49.
+
+
+## v39.16.76
+- Removed the circuit-board OFF constant source.
+- Added the achievement 「情報化産業」 for transmitting an active signal directly from one circuit board output to another circuit board input through wire or insulated wire.
+- Extended the 8-byte achievement mask to use its final bit, supporting all 64 current achievements.
+- Save snapshot/schema remains 40/49.
+
+
+## v39.16.78
+- Fixed 「あぁ^~ たまらねぇぜ」: burst zunchi no longer treat their spawn overlap with the owner as a collision.
+- A burst zunchi now becomes eligible only after it has cleared the owner once; a later fatal return collision unlocks the achievement, including routes that reflect and accelerate on a bounce fence.
+- Preserved the existing nonfatal, stopped, and player-held disqualification behavior.
+- Fixed ミニマリスト placement-origin metadata so it remains saveable after 無計画都市 has already unlocked.
+- Fixed サウナ水風呂 to measure 15 seconds from genuine entry into a hot state instead of refreshing the hot timestamp on every hot evaluation.
+- Fixed 抵抗器じゃない so a Tarinai killed by the qualifying shock still counts before death clears its live state.
+- Achievement reset now clears reset-scoped hidden per-Tarinai and per-item progress, including care counts, sauna state, held duration, fight-mochi metadata, sticky-bomb pass count, and quick-delete timestamps.
+- Undo/Redo and valid ground changes now reset 監視カメラ observation progress as world interventions.
+- Added route-level and secondary regression coverage for these achievement paths. Ambiguous achievement semantics identified by the renewed audit remain unchanged pending explicit specification.
+
+39.16.78: Applied confirmed achievement semantics: birth-status slave/king appearances count; dynasty achievements require direct parent-child qualifying lineage; Overprotective treatment counts only actual beneficial health recovery; Unplanned City counts deletion operations rather than removed objects; Surveillance Camera requires 3 uninterrupted game days and resets on gameplay interventions; wire-shock partial progress remains nonpersistent; Pest Control counts only player-caused ant deaths.
+
+
+## v39.16.80
+- Optimized Tarinai social-neighbor scans with squared-distance filtering, nearest-N partial selection, pair-deduplicated symmetric work, cached personality profiles, and shared disease spread logic.
+- Added personality-derived crowd comfort bounds. Overcrowded Tarinai flee toward less crowded space with the specified behavior text; undercrowded Tarinai become stressed and approach the nearest living Tarinai with the specified loneliness text.
+
+
+## v39.16.85
+- Replaced Undo/Redo object snapshots and recursive patch history with the existing synchronous binary save codec payload.
+- Exposed binary snapshot encode/decode helpers from TarinaiSaveCodec for internal history reuse without Base32768 text conversion or asynchronous compression.
+- Replaced JSON.stringify-based duplicate detection with a compact dual 32-bit fingerprint over the encoded history bytes.
+- Unified Undo and Redo stack movement through a shared history transition path while preserving synchronous behavior and the 48-entry limit.
+- Added binary-history regression coverage for storage shape, duplicate suppression, Undo restoration, and Redo restoration.
+
+
+## v39.16.85
+- Render stack optimization: static visible stacks are cached by static spatial generation and camera region, while dynamic stacks reuse previous-frame order before insertion sorting and are merged linearly.
+- Link rendering now uses dedicated AABB spatial cells instead of per-frame full type-bucket fallback scans.
+- Carried plushies render at owner-relative positions without mutating simulation coordinates during rendering.
+- Fixed render culling radii are cached on eligible static entities.
+- Render-layer sort keys are computed once per stack insertion.
+
+
+## v39.16.85
+- Reduced fixed render cost by skipping the fallback full-screen gradient whenever the transformed field fully covers the viewport.
+- Cached full-screen fallback gradients and rebuilt atmospheric full-screen lighting at 8 Hz instead of constructing multiple full-screen gradients every frame.
+- Reused dynamic render-layer entries, sort maps, and previous-order ID arrays to reduce per-frame garbage collection as population grows.
+
+
+## v39.16.86
+- Removed social crowd-retreat selection and the overcrowded colony-state distance scan.
+- Removed the unconditional three-second full terrain-cache invalidation; cached terrain now refreshes only from real terrain changes, with splat fading invalidating local chunks.
+- Throttled structure dependency safety sweeps, staggered item/ant compaction, and stopped timer-only item bucket rebuilds.
+- Deferred periodic statistics UI refreshes and collapsed population statistics into a single pass.
+- Ordinary item additions/removals no longer invalidate the full terrain cache unless cached terrain items actually changed.
+
+## v39.16.88
+- Large-save restore uses an adaptive non-damaging settling phase for dense loaded populations, preventing synthetic body-overlap and obstacle-correction impulses from cascading into impact deaths.
+- Duplicator loading takes priority over direct feeding when a Tarinai overlaps the machine.
+- Save schema 50 explicitly stores elapsed completed days; total simulation time is restored monotonically and seasons/climate derive from elapsed days. Schema 49 spells remain readable.
+
+
+## v39.16.89
+- Moved the ずんちどれい and たりない王 population-chart toggles to immediately after 死亡数.
+- Removed the 12-second periodic Tarinai runtime-cache full sweep that caused large-population performance regressions.
+- Runtime relationship/cache cleanup is now scheduled only after accumulated deaths reach max(20, floor(living population * 15%)), then runs once during the next Tarinai compaction and resets its counter.
+
+
+## v39.16.90
+- Added eight playstyle-survey achievements: 数こそ力, 少数精鋭, 踩屎感, 快適な寝床, 石に枕す, 季節を越えて, 推し, and 統計学者.
+- 数こそ力 unlocks at 100 living Tarinai. 少数精鋭 requires 1-25 living Tarinai continuously for five game days and discloses its condition/progress before unlock.
+- 統計学者 counts 30 statistics-tab or chart-series visibility button presses in persistent achievement state, so field resets do not clear its progress.
+- Achievement spell payload v6 and binary save schema 51 expand the unlock mask from 64 to 72 achievements while retaining v5/schema 49-50 read compatibility.
+- Updated the Item lifecycle pipeline regression to validate local bucket/spatial invalidation when passive serving-food decay actually changes its visual footprint.
+
+
+## v39.16.94
+- Removed previous-order render Maps and custom insertion sorting; dynamic visible lists now use native Array.sort after culling.
+- Removed the shared route cache while retaining actor-local route throttling.
+- Disabled detailed performance counters in normal play; diagnostics remain available only in explicit debug/perf mode.
+- Isolated obstacle-query cache invalidation to routing-obstacle generations instead of generic spatial movement.
+- Replaced per-frame full Tarinai spatial-grid rebuilds with cell-crossing incremental updates.
+- Added sustained hysteresis to automatic performance-profile transitions to prevent rapid quality oscillation.
+- Death-reference cleanup now executes in bounded per-frame chunks after the existing adaptive death threshold.
+
+## v39.16.94
+- Fixed dense-population birth regression caused by incremental Tarinai spatial-grid bucket ordering interacting with an early 20-candidate contact cutoff. Contact interactions now consider the complete already-fetched local candidate set while retaining only the nearest bounded interaction list.
+- Moved the "季節を越えて" achievement from the ecology category to "その他".
+39.16.96: UI input/limits/zoom refinements, infection chance reduced to one-third, 75 achievements, grass spatial/hot-path optimization, summer flat temperature bonus removed.
diff --git a/FILES.json b/FILES.json
index 57d6e87..22c5608 100644
--- a/FILES.json
+++ b/FILES.json
@@ -1,6 +1,6 @@
{
"purpose": "Token-efficient machine-readable routing for tarinai_. Use scripts/ai_inventory.py for exact current file expansion.",
- "version": "39.16.18",
+ "version": "39.16.98",
"entrypoints": {
"app": "index.html",
"runtime": "js/main.js",
@@ -37,7 +37,9 @@
"AI_MAP.md",
"GAME_FEATURES.md",
"FILES.json",
- "service-worker.js"
+ "service-worker.js",
+ "achievement_api.php",
+ ".achievement_data/.htaccess"
],
"meaning": "Repo/app shell metadata, server/static cache config, docs, manifest, entrypoint."
},
@@ -51,19 +53,28 @@
{
"id": "scripts",
"patterns": [
+ "scripts/*.js",
"scripts/*.py",
"scripts/*.ps1"
],
- "meaning": "Generators, regression checks, and token-aware AI inventory tooling."
+ "meaning": "Generators, regression checks, version-specific audits, and token-aware AI inventory tooling."
},
{
"id": "core",
"patterns": [
"js/version.js",
"js/event_bus.js",
+ "js/domain_ids.js",
"js/registry_base.js",
"js/disease_registry.js",
"js/sound_pack.js",
+ "js/deterministic_helpers.js",
+ "js/item_tool_metadata.js",
+ "js/item_tool_definitions.js",
+ "js/item_visual_definitions.js",
+ "js/item_food_definitions.js",
+ "js/item_effect_definitions.js",
+ "js/item_registry.js",
"js/data.js",
"js/ground_types.js",
"js/health.js",
@@ -121,7 +132,8 @@
"js/item*.js",
"js/items.js",
"js/structures.js",
- "js/structure_lifecycle.js"
+ "js/structure_lifecycle.js",
+ "js/circuit_board_system.js"
],
"meaning": "Item/structure registry, lifecycle, dynamic behavior, rendering."
},
@@ -129,7 +141,8 @@
"id": "tarinai",
"patterns": [
"js/tarinai*.js",
- "js/ants.js"
+ "js/ants.js",
+ "js/seesaw_system.js"
],
"meaning": "Creature state/actions/needs/social life/item effects/disease/rendering plus ant actor model."
},
@@ -149,7 +162,8 @@
"js/ui*.js",
"js/text_catalog.js",
"js/command_dispatcher.js",
- "js/family_graph.js"
+ "js/family_graph.js",
+ "js/achievements.js"
],
"meaning": "DOM UI, input, tools, selected panel, logs, charts, family tree, text labels, command routing."
},
diff --git a/GAME_FEATURES.md b/GAME_FEATURES.md
index b3037f2..89ef423 100644
--- a/GAME_FEATURES.md
+++ b/GAME_FEATURES.md
@@ -1,300 +1,100 @@
-## v39.16.17 mechanical one-way fence runtime fix
-
-- Mechanical objects now query their canonical physics-body velocity when resolving one-way-fence contacts.
-- This removes the `bodyFor is not defined` runtime failure while preserving the existing directional fence behavior.
-
-## v39.16.16 directional fences, chart controls, and living wire endpoints
-
-- Tarinai can physically cross one-way fences in the arrow direction, including swept/high-speed movement.
-- Colony chart color dots toggle individual series.
-- Wire and insulated wire can attach to Tarinai and ants. Energized living endpoints take damage and panic regardless of insulation; only bare wire damages incidental contact.
-- Selected Tarinai data shows `感電している。` while shocked.
-
-
-## v39.16.16 colony lineage and directional routing
-
-- Population history overlays interval birth and death counts.
-- Rotators preserve negative motor speed and rotate in reverse.
-- Tarinai Champion boosts to aggression, openness, and sociability pass to descendants with generational damping.
-- Champion-pair mating preference is slightly reduced.
-- One-way fence placement previews show the allowed direction.
-- Pathfinding treats one-way fences as passable only along their arrow direction.
-
-## v39.16.16 colony graph, reverse rotator, and champion lineage
-
-- コロニー統計の個体数グラフへ、2時間区間ごとの誕生数と死亡数を追加した。
-- 回転体のモーター速度は負値を保持し、負の角度方向へ逆回転できる。
-- たりない王の攻撃性・開放性・社交性補正は子孫の誕生時性格へ減衰継承される。
-- たりない王同士の繁殖優先倍率を5.0から4.0へ下げ、繁殖確率をやや抑えた。
-- 保存形式は変更しない。
-
# tarinai_ Game Features
-## v39.16.16 link, bounce-fence, and spring fixes
+`tarinai_` is an observation sandbox about small creatures called tarinai. The player shapes a field with food, medicine, furniture, hazards, machines, weather, and ground choices, then watches how the colony reacts. The game is about cause and effect: small changes in the environment can alter movement, stress, disease, relationships, reproduction, accidents, cleanup, and survival.
-- ヒモ、棒、バネ、電線、絶縁電線は、接続線が画面内を横切る場合、中点の空間セルが画面外でも描画される。
-- バウンス柵はたりないを外力インパルスで確実に吹き飛ばし、柵自身が作る急激な速度変化では衝撃ダメージを与えない。
-- バネは受動式のまま剛性を高め、減衰と強制位置補正を下げ、より大きく長く往復する。
+## Core Play
-## v39.16.13 detector and fence changes
+The player starts by choosing a field and ground, then places objects or uses direct tools on the colony. Tarinai continue acting on their own while the player observes, edits the environment, removes problems, or creates new ones. The colony panel, event log, selected-tarinai data, and family tree help explain what is happening without taking control away from the simulation.
-- 感圧スイッチを「検知器」へ改名し、道具UI上で通常の柵と位置を入れ替えた。
-- 検知器は軸平行の矩形範囲で対象を数える。専用UIから横幅・縦幅・対象・必要数を設定する。
-- 柵の配置境界判定を実際の細長い形状に合わせ、フィールド上下端近くへ配置できるようにした。
-- バウンス柵の反発係数、最低射出速度、最大速度を引き上げ、衝突直後に強く跳ねるようにした。
-- ワープゲートを道具、描画、更新、信号、保存形式から削除した。
-- 一方通行柵を追加した。矢印方向には通過でき、逆方向のみ衝突する。
-- バイナリスキーマ36、スナップショット30。旧形式との読み込み互換は持たない。
+The game supports quiet observation and chaotic experiments. A player can build a comfortable habitat with beds, food, grass, and cleaning tools, or create a dangerous machine field with rotators, fences, stones, pins, explosions, ants, and poison.
-## v39.16.11 mechanism fixes and passive spring
+## Tarinai
-- 検知器は矩形範囲内の「たりない」または「アイテム」を数え、設定個数以上で電線へ信号を送る。
-- 一方通行柵は矢印方向だけ通過でき、逆方向のたりない・アイテム・機構を遮る。
-- バウンス柵は衝突対象へ強い即時反発を与える。
-- バネは棒と同じ2点接続方式で設置する。自動伸縮はせず、外力による伸び縮みに対して受動的に反発し、弾性運動する。
-- 電線と絶縁電線はアイテム同士を接続し、複数本を経由して信号を伝える。通常電線は通電中に接触したたりないへダメージを与え、絶縁電線は与えない。
-- バイナリスキーマ34、スナップショット28。v39.16.10と保存形式は同じ。
+Tarinai are autonomous creatures with HP, needs, stress, personality, age, family links, diseases, item effects, and behavior states. They choose actions from their current condition and surroundings instead of following a fixed script. Hunger can make them seek grass or food, sleepiness can make them find a bed, fear can make them flee, and social state can make them follow, fight, avoid, or approach another tarinai.
-## v39.16.9 load UI and item behavior fixes
+Each tarinai has individual tendencies. Aggressive tarinai fight more easily, social tarinai seek others more often, nervous tarinai react strongly to danger, and inherited traits can make children resemble their parents. Selecting a tarinai shows health, needs, stress, effects, relations, inventory, family information, and the reason for its current behavior.
-- Replaced browser-native load confirmations with an in-game confirmation window.
-- Kept fans in the realtime scheduler lane so wind applies continuously instead of as periodic gusts.
-- Made the zunchi tool preview use the fresh, fully opaque stage.
-- Rendered carried plushies at the same depth position as their owner.
-- Disabled grass spawning, growth, placement capacity, and existing grass on the fluffy blanket ground.
+Tarinai can be damaged by hazards, pushed by physics objects, carried by ants, attached to links, blocked by fences, affected by medicine, frightened by accidents, comforted by habitat items, or preserved when outside the active field. Some objects can become emotionally important, so losing them may cause panic.
-## v39.16.8 compact amount, relationship, seed, and framing save
+## Food And Consumables
-- アイテム種類の標準amountは保存せず、標準値と異なる共通値または個別差分だけを保存する。共通値候補は実バイト数で選択する。
-- 個体関係の対象インデックスを昇順に並べ、前の対象との差分として保存する。
-- worldSeedを固定16進64bitへ統一し、バイナリ上では8バイト固定で保存する。
-- バイナリ先頭はスキーマ1バイトへ統合し、上位bitで文字列テーブルの有無を示す。空の文字列テーブルと重複したスナップショット版番号は保存しない。
-- 圧縮フラグをフレーム長の下位bitへ統合し、独立した1バイトを削除する。
-- 15bit文字化の32768文字テーブルと逆引きMapを廃止し、Unicodeコードポイントの算術変換へ変更する。
-- バイナリスキーマ33、スナップショット27。旧形式との読み込み互換は持たない。
+Grass is both food and habitat material. Tarinai can eat it, feel comfort near it, gather it for simple beds, and interact with it through ground and weather systems. Water can be drunk, can appear from rain, and can be generated or copied by tools.
-## v39.16.7 column-oriented creature save and packed item flags
+Sweet food helps satisfy hunger and can support recovery in some cases. Love mochi makes reproduction behavior more likely for a while, while fight mochi pushes the colony toward conflict. Zunda juice clears item effects, making it useful after medicine or special consumables have changed a tarinai too much.
-- 個体の固定情報を項目別の列指向ビットプレーンへ変更し、全個体で0の列は保存しない。
-- 睡眠状態、遺伝差分、戦績差分の存在は各ID・差分マスクから直接判定し、重複していた3bit/個体を削除する。
-- アイテムの共通追加状態、amount差分、追加状態差分のフラグを全ブロック共通の連続ビット列へ格納する。
-- 共通追加状態は候補ごとに専用バイナリを試算し、全件個別保存より実際に小さい場合だけ採用する。
-- バイナリスキーマ32、スナップショット26。旧形式との読み込み互換は持たない。
+Medicine changes the simulation more aggressively than normal food. Sleep drugs push tarinai toward sleep or sleep disease, laxatives create repeated zunchi and reduce food benefit, protein makes a stronger permanent mode with lower disease risk, and niteropu makes a weaker permanent mode with higher disease risk. Ammo creates temporary speed and impact danger. Mystery drugs choose from eligible effects unpredictably. Mercury changes lifespan, while giant and dwarf drugs reshape size, movement, power, and ongoing damage risk.
-## v39.16.4 compact identity and normal-item binary save
-
-- 個体のbirthSeed文字列を保存せず、出生番号と32bitハッシュへ分解する。`worldSeed + birthSerial`で再現できる個体はハッシュも省略する。
-- 新規出生のbirthSeedは親文字列を含めず、親子関係と遺伝情報は既存の専用フィールドで保持する。
-- 通常アイテムの追加情報を型別専用バイナリへ移行し、JSONテキストを保存しない。未知の追加配列も数値・文字列の型付きバイナリで保存する。
-- 同じ種類のアイテムはamountの最頻値をブロックに1回だけ保存し、同一追加状態が複数ある場合も共有する。個別アイテムには差分だけを保存する。
-- バイナリスキーマ30、スナップショット24。旧形式との読み込み互換は持たない。
+## Habitat And Cleanup
-## v39.16.3 physics binary save and reciprocator cargo contacts
-
-- 回転体・毒ブロック・往復体・ロープ・ロッドの追加情報を、JSON文字列ではなく専用バイナリで保存する。型名、キー名、デフォルト値、重複座標、標準輪郭、インデックス参照済み接続先の文字列情報を省略する。
-- バイナリスキーマは29。v39.16.2のスキーマ28は読み込み互換を維持する。
-- 往復体はボール、石、画鋲などの可動物理アイテムを押し出すが、それらとの接触では方向、レール位相、モーター速度を変更しない。
-
-## v39.16.2 reciprocator collision and placement alignment
-
-- 往復体は、進行方向にある機構、静的障害物、物理アイテムへ衝突した時点で方向転換する。接触分離によって重なりが解消されても反転判定を失わない。
-- 静的障害物との判定から往復体を除外しない。高速移動時は障害物付近でサブステップ判定を増やし、すり抜けを抑える。
-- 往復体の設置前オーバーレイと実配置は同じ角度初期化処理を使用し、物理ボディー角度とレール軸を同じ順序で確定する。
-- セーブ形式は変更しない。
-
-## v39.16.1 debug save-size breakdown
-
-- `?debug=1` でセーブまたは呪文出力を実行すると、デバッグオーバーレイにバイナリ内訳、文字数、エンコード時間が表示される。
-- 内訳は形式情報、文字列テーブル、ワールド、個体基本情報、個体シード、個体関係、アイテム索引、通常アイテム、物理アイテムに分けて実占有バイトを集計する。
-- 通常アイテム・物理アイテムの追加情報について、バイナリ内の占有量とJSON UTF-8元サイズを併記する。ロード後は直近のデコード時間も表示する。
-
-This document describes the playable features of `tarinai_`: what the player sees, what tools do, and how tarinai behave. It is intentionally player/design-facing, not an implementation map.
-
-## v39.16.0 mechanical interaction and limit audit
-
-- 回転体・往復体・毒ブロックは、双方の「当たり判定ON」時にSAT矩形判定で相互作用する。当たり判定OFFの機構は機構同士の衝突対象から除外される。
-- 3種類の輪郭編集は20px間隔のグリッド格子点へスナップする。直線、自由描画、消去位置、テンプレート、再編集時の既存端点に同じ規則を適用する。
-- コロニー上限は中央生成APIで常時適用され、通常実行時に上限を迂回するオプションは持たない。既存要素やセーブ復元要素は削除せず、その後の新規生成のみを抑止する。
-
-## v39.15.165 behavior and colony controls
-
-- たりない王は、繁殖可能な別のたりない王を広い範囲から優先して探し、通常より強い繁殖欲求と短い再繁殖待機時間を持つ。
-- 往復体の新規配置時の標準方向は90度。
-- 毒ブロックの新規配置時の標準輪郭は小型(半径44、輪郭104×40、太さ11)。
-- コロニーパネルで、たりない個体数と生存オブジェクト総数の上限を設定できる。空欄または0は上限なし。既存要素は削除せず、新規追加だけを抑止する。
-- 上限値はスナップショットとバイナリセーブに保存される。
-
-## Game Overview
-
-`tarinai_` is an observation sandbox about small creatures called tarinai. The player places food, furniture, hazards, machines, and environment tools, then watches how individuals live, move, eat, sleep, panic, fight, reproduce, get sick, recover, and leave family records.
-
-The core loop is:
-
-1. Choose a field and observe the colony.
-2. Place tools or objects that change the environment.
-3. Select individual tarinai to inspect health, needs, personality, relations, diseases, records, and current behavior.
-4. Watch the event log, colony graphs, and family tree to understand long-term outcomes.
-
-## Main UI
-
-- **Canvas / field**: the main simulation area. Tarinai, items, effects, ants, weather, and terrain are drawn here.
-- **Top buttons**: pause/resume, speed control, ecology guide, sound settings, credits, save, display settings, and reset.
-- **Display settings**: manually adjust effects, shadows, and drawing detail. `High` keeps quality-preserving optimizations active, while lower tiers cut heavier visuals for crowded scenes without lowering object limits; simulation cadence remains quality-preserving.
-- **Mobile mode controls**: auto, camera, and tool modes for touch screens.
-- **Right panel tabs**: jump between main game, selected tarinai data, tools, colony, events, and family tree.
-- **Tarinai data panel**: appears when a tarinai is selected. Shows health, needs, personality, active effects, relations, inventory, behavior reason, and records.
-- **Tool palette**: grouped buttons for operation, food, medicine, habitat, physics, and danger tools.
-- **Colony panel**: shows population, deaths, colony mood, ground type, and charts for population, needs, and objects.
-- **Event panel**: logs births, deaths, accidents, fights, food events, weather, grass, and relation changes. Optional push-style notifications can be enabled by event type.
-- **Family tree**: shows parent-child generations, inherited stats, personality tags, family links, and archived lineage records.
-- **Ecology dialog**: in-game guide explaining tarinai needs, stress, food, sleep, personality, family, disease, accidents, tools, and colony reading.
-- **Sound menu**: master sound plus voice, notification, and operation categories.
-
-## Tool Categories
-
-### Operation
-
-- **解除 / clear**: cancels the selected tool and returns to normal observe mode.
-- **たりないデータ / observe**: select a tarinai or inspect compatible objects such as signboards.
-- **追加 / new**: calls a new tarinai into the field.
-- **つつく / poke**: pokes tarinai and can push balls.
-- **つまむ / pinch**: drags tarinai and some placed objects.
-- **コピー / copy**: copies a placed item and pastes a new instance with its settings.
-- **戻す / undo** and **進む / redo**: reverse or reapply placement/edit actions.
-- **削除 / delete**: removes placed tools, objects, and stains.
-- **範囲削除 / area delete**: removes many nearby objects or stains around the cursor.
-- **洗浄 / water hose**: drag to clean dirt, zunchi, corpses, and stains.
-
-### Food
-
-- **ずんだ餅 / sweet**: favored food; can cure some illness.
-- **へこ餅 / love mochi**: makes reproduction behavior more likely for a while.
-- **けんか餅 / fight mochi**: makes fighting behavior more likely for a while.
-- **草 / grass**: food and comfort source; can grow, be used for simple beds, and sometimes dampen nearby fire instead of immediately catching.
-- **水滴 / water**: drinkable water, also appears during rain and can be set in duplicators.
-- **ずんだ汁 / zunda juice**: clears item effects from a tarinai.
-- **複製機 / duplicator**: can be loaded with compatible food, medicine, grass, water, pushpins, or oshibyo and then produces or applies that content.
+Zunchi is waste, but it is also part of the ecology. It affects hygiene and disease risk and can fertilize grass. Beds and nest boxes give tarinai safer or better sleep options, reduce stress around resting areas, and help recovery. Balls give tarinai something to play with and can also become part of physics experiments.
-### Medicine
+Robot cleaners are mobile cleanup items. They scan for selected target types, pursue matching waste or corpses, and remove them on contact. The water hose gives the player direct cleanup control by washing dirt, zunchi, corpses, stains, and similar field problems. Signboards are editable objects that can be inspected after placement, useful for labeling areas or experiments.
-- **ねむり薬 / sleep drug**: causes sleepiness or sleep disease; damage can cure the disease.
-- **下剤 / laxative**: causes repeated zunchi and reduces food benefit.
-- **プロテイン / protein**: permanent power mode; more damage dealt, lower disease chance.
-- **ンイテロプ / niteropu**: permanent weak mode; less damage dealt, higher disease chance.
-- **弾薬 / ammo**: temporary high-speed movement and strong collision impact.
-- **怪しい薬 / mystery drug**: randomly applies an eligible item effect or disease.
-- **水銀 / mercury**: increases lifespan multiplier on each use.
-- **巨大薬 / giant drug**: greatly increases size, attack, and speed, but deals ongoing damage.
-- **矮小薬 / dwarf drug**: greatly decreases size, attack, and speed, and also deals ongoing damage.
+## Physics And Machines
-### Habitat
+Physics items turn the field into a mechanical sandbox. Ropes connect two targets with a flexible link that can go slack but should not stretch freely. Rods create a rigid connection. Springs connect targets with elastic motion, allowing linked objects to pull back and oscillate.
-- **ずんち / zunchi**: tarinai waste; affects disease and can fertilize grass.
-- **ロボ掃除機 / robot_cleaner**: moves through the field at fixed normal speed 60, or 120 in high-speed mode. It checks the nearest matching cleanup target every 2 seconds, keeps pursuing it between scans, and cleans every matching object it touches. The 死骸 target also covers blood traces; clicking the item opens its target settings.
-- **干草寝床 / bed**: placeable sleeping spot; helps HP recovery.
-- **巣箱 / nest box**: reduces stress nearby; improves sleep quality when used.
-- **ボール / ball**: toy that tarinai can play with and the player can poke.
-- **看板 / signboard**: editable text object; inspect with observe after placing.
+Fences block movement and can be rotated for layout control. Gates can be opened or closed after placement. One-way fences allow passage from one direction while blocking the opposite direction. Bounce fences launch colliding targets more strongly than normal fences, which makes them useful for traps or kinetic experiments.
-### Physics
-
-- **ヒモ / rope**: connect two targets with a flexible, inextensible link that may go slack but does not lengthen.
-- **棒 / rod**: connect two targets with a rigid link.
-- **柵 / fence**: blocks tarinai movement; Q/E rotate by 45 degrees, Shift+Q/E by 5 degrees.
-- **バウンス柵 / bounce fence**: high-restitution fence that strongly launches things that hit it.
-- **ゲート柵 / gate fence**: click to open or close.
-- **回転体 / rotator**: custom mechanical shape that rotates; click to edit shape and speed.
-- **毒ブロック / poison block**: custom hazard block; touching it damages skin; click to edit shape.
-- **往復体 / reciprocator**: custom mechanical shape that moves back and forth; click to edit shape and speed.
-
-### Danger
-
-- **石 / stone**: heavy object; dangerous when dropped or moved into others.
-- **げんこつ / genkotsu**: large fist impact on the ground.
-- **爆竹 / firecracker**: creates an explosion; flame variants scatter fire while respecting active-fire limits.
-- **画鋲 / pushpin**: rolls when dropped; can lodge in tarinai and cause panic plus continuous damage.
-- **おしり鋲 / oshibyo**: blocks zunchi when lodged; pulling it out releases stored zunchi.
-- **射撃 / shoot**: attacks with a gun effect.
-- **アリの巣 / ant nest**: spawns ants that search for tarinai and carry them to the nest.
-
-## Tarinai Needs And Stats
-
-Tarinai behavior is shaped by health, energy, needs, stress, personality, family, disease, and nearby objects.
-
-Key needs include:
-
-- **Food / hunger**: hungry tarinai seek grass, sweets, food, water-related options, or other edible targets.
-- **Sleep**: sleepy tarinai seek beds, nest boxes, grass beds, or eventually sleep anywhere.
-- **Safety**: danger, pain, hazards, ants, fights, and panic increase defensive behavior.
-- **Social / relations**: tarinai can seek friends, follow parents, avoid enemies, fight rivals, or approach mates.
-- **Fulfillment / comfort**: toys, ground, sun, shelter, and environment affect mood and stress.
-- **Health**: damage, disease, stress, and recovery decide whether tarinai live, weaken, or die.
-
-Stress changes with fear, crowding, dirt, disease, fights, ground type, and environment. High stress makes fleeing, intimidation, sickness, and poor behavior more likely.
-
-Personality and genetics affect tendencies such as aggression, openness, sociability, nervousness, body size, lifespan, damage, and speed. Some traits are inherited by children and shown in the family tree.
-
-## Movement And Behavior
-
-Tarinai are autonomous. Their movement is usually a result of current state, target choice, and local environment.
-
-Common behavior states:
-
-- **Idle / wander**: waits, watches, or moves lightly around the field.
-- **Seek food**: moves toward edible items when hungry or affected by disease.
-- **Eat / drink**: consumes food, grass, water, medicine, or special items.
-- **Seek bed / sleep**: finds a bed, nest box, grass bed, or sleeps in place.
-- **Play ball**: approaches and interacts with balls.
-- **Seek material / build**: gathers material and creates simple structures such as grass beds.
-- **Seek friend / follow parent**: moves toward social targets or parents.
-- **Fight / seek enemy**: approaches and attacks rivals, especially under fight effects or aggression.
-- **Panic / flee**: runs from danger, pain, destroyed owned objects, hazards, or fear triggers.
-- **Intimidate**: threatens another tarinai or ants instead of directly fleeing or attacking.
-- **Birth ritual**: pre-birth/reproduction interaction with a partner.
-- **Sunbath**: rests in good sun to reduce stress.
-- **Disease states**: zunchi sickness, sleep disease, explosion disease, and injury sickness can override normal priorities.
-- **Frozen**: outside-field preservation state.
-
-Tarinai can be pushed by physics objects, carried or affected by ants, dragged by the player, attached with ropes/rods, blocked by fences, and damaged by hazards. Some objects become owned or emotionally important, so losing them can trigger panic.
-
-## Environment
-
-- **Field types**: park, garden, and cage provide different field sizes.
-- **Ground types**: sand, dirt, concrete, blanket, foot massage, ice, and laboratory-style ground affect stress, grass, and movement.
-- **Weather**: rain and other weather influence water, mood, and environment effects.
-- **Grass ecology**: grass grows, feeds tarinai, comforts them, can become bed material, and has a small chance to reduce fire before burning.
-- **Dirt and corpses**: zunchi, splats, corpses, and ant corpses affect hygiene, disease, and observation results.
-- **Day/light conditions**: lighting and sun influence rendering and sunbath behavior.
-- **Season temperature**: automatic summer climate is roughly 5℃ hotter than the previous baseline; manual temperature control remains exact to the slider value.
-
-## Crowded Scene Performance
-
-Crowded fields are an intended sandbox outcome. Performance work should prefer cached, typed, spatial, dirty, or incremental lookups over lowering object limits. High display quality should preserve visible fidelity and simulation rules while avoiding repeated hidden scans in render, tooltip, family tree, collision, effect, fire, and maintenance paths.
-
-## Disease And Recovery
+Rotators are editable mechanical shapes that spin and push nearby targets. Their shape and speed can create conveyors, crushers, traps, or chaotic collision fields. Reciprocators move back and forth along a line, so they can shove objects repeatedly. Poison blocks are custom hazard shapes that damage on contact.
-Diseases and item effects can strongly redirect behavior.
+## Electrical And Automation
-- **Zunchi disease**: changes food/water priorities and makes the tarinai feel unwell.
-- **Sleep disease**: causes sleep-focused behavior.
-- **Explosion disease**: creates dangerous explosive outcomes and water-seeking pressure.
-- **Fight disease / injury sickness**: causes unstable movement or fighting-related behavior.
-- **Item effects**: mochi, medicine, size drugs, mercury, ammo, and power modes create temporary or permanent modifiers.
+Detectors, wires, insulated wires, and circuit boards are grouped in the Electrical tool category. Normal energized wire can hurt living targets on contact, while insulated wire is safer for incidental contact. Detectors can sense target ranges or time windows and send signals; clicking either dual-range track moves the nearer thumb directly to the clicked value. Circuit-board external input and output terminals are placed directly on the board edge, can be moved around all four sides, and appear dim in the editor until a world wire is actually connected.
-Recovery depends on the disease or effect. Water, rest, food, medicine, zunda juice, damage, environment cleanup, or time can all matter depending on the case.
+## Danger Tools
-## Family, Records, And Colony Observation
+Danger tools create immediate or ongoing pressure. Stones are heavy objects that become dangerous when dropped, thrown, or moved by machines. Genkotsu creates a large impact on the ground. Firecrackers cause explosions, with flame variants adding fire while respecting active-fire limits.
-- Tarinai can form parent-child records and partner links.
-- Children inherit parts of their parents' tendencies and are grouped by generation.
-- Family tree nodes show portraits, inherited stats, personality tags, and relationship structure.
-- Event logs record important simulation events such as birth, death, accidents, fights, weather, grass, and relation changes.
-- Colony charts summarize population, needs, and object counts over time.
-- Selected tarinai records help explain why an individual is acting a certain way.
+Pushpins can roll, lodge in tarinai, cause panic, and deal continuous damage. Oshibyo blocks zunchi while lodged and releases stored zunchi when removed. Shooting is a direct attack tool that can hit tarinai, ants, items, pins, balloons, or placed objects depending on the target under the aim point.
-## Save, Reset, And Persistence
+Ant nests introduce an enemy system. Ants search for tarinai, carry captured targets back to the nest, and can be shot or killed. Worker ants and queen ants have separate HP values, and ant counts are shown through colony statistics.
-- The app supports manual save and restore through browser storage.
-- Current saves are allowed to use compact/hash-style text. Old save text does not need to remain loadable when the save format is intentionally shortened or replaced, so load failure is acceptable after intentional save-format changes as long as the current save/load path stays internally consistent.
-- Reset opens field selection and starts a new field state.
-- Service worker caching allows the static app shell to remain available after load, depending on browser support.
+## Operation Tools
+
+The observe tool selects tarinai or compatible objects and opens their data. The add tool introduces new tarinai. Poke applies a small interaction or push, while pinch lets the player drag tarinai and some objects. Copy duplicates placed items with their settings so setups can be repeated quickly. The operation palette also provides a dedicated snap control shared by placement and pinch movement; it cycles through Free, 20px, 40px, and 60px.
+
+Undo and redo reverse or reapply placement and edit actions. Delete removes a specific object or stain, while area delete removes many nearby targets at once. These tools let the player repair a field after experiments without resetting the whole colony.
+
+## Grounds And Environment
+
+Fields define the playable space and boundary style. Grounds change the character of the colony: sand, dirt, concrete, blanket, foot massage, ice, and laboratory-style surfaces can affect movement, stress, comfort, and grass behavior. Ground choice matters because tarinai react not only to objects, but also to the surface they live on.
+
+Weather changes the field over time. Rain can create water and affect comfort, shade can protect from weather or sun, and temperature changes how tarinai experience the environment. Grass, zunchi, splats, corpses, ant corpses, rain drops, and stains all feed into hygiene, disease, cleanup, rendering, and observation.
+
+## Colony Statistics
+
+The colony panel summarizes population, sick tarinai, juveniles, elders, deaths, mood, temperature, population limits, and object limits. Graph tabs show population, needs, and environment. Total ants are included in the environment statistics so active ant pressure can be read alongside other field signals.
+
+The event panel records important simulation events such as birth, death, fights, accidents, weather, grass changes, and relation changes. The family tree shows parent-child structure, generations, inherited stats, personality tags, and family links.
+
+## Save, Display, And Performance
+
+Manual save and restore use browser storage. Reset returns to field selection and starts a new state. Service worker caching can keep the static app shell available after the first successful load when the browser supports it.
+
+Display settings control effects, shadows, drawing detail, and quality choices for crowded scenes. Crowded fields are an intended part of the sandbox, so the game uses spatial lookup, scheduling, cached drawing, and incremental maintenance systems to keep large colonies and many objects playable.
+
+
+## Achievement system (v39.16.78)
+- Sixty-four achievements track reproduction, natural status changes, generation runs, rapid population events, special deaths, colony conditions, individual care, autonomous ecology, history usage, cleanup, rapid deletion, temperature transitions, weather shelter, medicine-category completion, combat reversals, circuit-board signaling, and ant-related play styles.
+- Locked rows reveal only the configured condition allowlist; all others show `???`. There are no achievement tooltips. 大いなる母, めっちゃたりない観察, 敵の敵は味方, 混沌ヲ希求スル者, and 豊穣ヲ希求スル者 include local progress percentages, and unlocked achievements are sorted first inside each category.
+- Each achievement row behaves as a horizontal bar chart. Its background fill visualizes the optional global completion percentage from 0–100%, and the global achiever count is displayed beside it.
+- `物でいっぱい` requires 100 cumulative player placements across field resets. `害虫駆除` requires 100 cumulative ant kills across field resets.
+- `餌やりじいさん` requires 33 direct feedings in one field; resetting the field resets this progress.
+- `機械化産業` replaces the former detector-automation and link-craftsman achievements and unlocks only when both requirements are met.
+- v39.16.56 adds 混沌ヲ希求スル者 and 潔癖症, raises 清掃業者 to 200, starts ミニマリスト from day 6, excludes chain/crown from おくすり手帳全埋め, and keeps shared-rate bars visible after unlock.
+- v39.16.54 added 真・たりない観察, 悠久の歴史, 五体満足, and 零体満足. v39.16.55 added 町のお医者さん for 50 effective first-aid recoveries and 割とふわふわ for flinging a plushie with つつく. ベビーブーム now requires 30 births in one minute; 管理された楽園 starts tracking from play day 6 and requires one uninterrupted happy in-game day.
+- Local unlocks and persistent totals live in browser storage. Field-scoped direct-feeding, cleaner, self-sufficiency, enemy-ant, generation, observation, safety, and per-entity/item progress follow current-format saves where applicable. Nest-box and pipe occupants block rain/weather effects and count as sheltered for 雨宿り完了.
+- Achievement evaluation is primarily event-driven; periodic world scans skip completed or irrelevant conditions. The server writes compact v3 achievement aggregate JSON while migrating older aggregate formats on read.
+- v39.16.78 fixes achievement edge paths found by a renewed 64-condition audit: Minimalist placement metadata survives unrelated unlocks, Sauna/Cold-Plunge uses true hot-entry timing, lethal qualifying wire shocks count before death cleanup, reset clears hidden reset-scoped progress, and Undo/Redo/ground changes interrupt passive observation. Ambiguous semantics are intentionally unchanged pending specification.
+
+### Achievement spell persistence (v39.16.78)
+- Exported spells compactly include non-debug achievement unlocks, unlock times, and persistent progress.
+- Loading a spell merges achievements and keeps the greater progress instead of erasing local achievement data.
+- Restored unlocks are queued for the existing server recovery synchronization. Save slots remain world-only.
+
+- Spell achievement metadata uses a sparse binary encoding: raw unlock bits, bit-packed persistent progress, minute-delta unlock timestamps, and sparse per-entity state. Binary save schema 51 is current; schemas 49 and 50 remain readable. Achievement payload v6 stores 72 unlock bits and statistician progress, while legacy payload v5 remains importable.
+- v39.16.60: Added 狙撃手, メガロポリス, and 豊穣ヲ希求スル者; restricted 混沌ヲ希求スル者 to fight-mochi-influenced fights; extended compact achievement spell progress and omitted counters for already-unlocked achievements.
+- v39.16.62: Added five achievements for low FPS, uninterrupted 24-hour play, toilet-sand placement, park-ground editing, and rapid ground changes. 寿命 deaths are excluded from 安全第一 failures, empty-field clicks replace pause-button clicks for 何やってるの?, and the two long observation achievements are last in その他.
+
+- v39.16.63: Added アリ観察 and 命のバトン; stabilized progress-row typography; continuous-play observation no longer resets on tab changes; corrected sauna wording and enemy-ant streak reset behavior; obsolete spell formats are rejected.
diff --git a/README.md b/README.md
index 0527577..ea6631c 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,19 @@ AI-first entrypoint for a static browser simulation/game. Keep this file small;
## Runtime Shape
-- No bundler; `index.html` loads ordered global-IIFE scripts with `?v=39.16.18`.
-- v39.16.18 changes: redundant physics normalization, dirty-marking, compaction, pickup, and collision bookkeeping were removed; one-way-fence and bounce corrections now use shared canonical helpers.
+- v39.16.37 changes: biological and environmental conditions are unified into the detector; the standalone sensor and relay are removed; temperature and limits are folded; ecology, sound, display settings, and credits are in the header menu; reset remains outside in red; tarinai-data navigation preserves the active tool; mobile tool descriptions appear at the top for five seconds. Snap mode remains Free/20px/40px/60px, top-edge placement is fixed, and preset descriptions end with punctuation.
+- v39.16.38 changes: detector numeric controls use value-labelled sliders like the time control; colony temperature and limits share one Colony settings fold; display settings use an inline menu matching sound settings; HP/stress meter colors are fixed; the snap control follows Clear with a faint grid icon; area-delete has a new icon; the Ant chart series is renamed and hidden initially.
+- v39.16.55 changes: expanded the achievement set to 49 with 町のお医者さん and 割とふわふわ; changed ベビーブーム to 30 births per minute and 管理された楽園 to one happy in-game day from play day 6; restored shared poke targeting/highlights and plushie fling; corrected manual rotator/reciprocator push direction; tightened tool/limit UI; reduced periodic achievement scans; and introduced compact achievement aggregate storage.
+- v39.16.52 changes: reorganized achievements into collapsible categories, removed achievement tooltips, and moved confirmation flows into the game UI. Previous v39.16.51 changes: expanded the achievement set to 43 with sixteen play-style and special-action conditions; added persistent Undo/Redo and quick-delete counters, field-local cleaner/automation-free ecology progress, individual care/temperature/fight tracking, complete medicine-category collection, protected rain shelter in nest boxes and pipes, and stricter ant-kill attribution.
+- v39.16.49 changes: added additive full-state synchronization so shared achievement aggregates can be rebuilt as players return after server data loss.
+- v39.16.48 changes: corrected the zunchi-slave threshold text to 30%; repaired wire placement counting, danger-kill attribution, partial legacy link migration, UUID validation, and debug-only achievement isolation.
+- v39.16.47 changes: Two achievements are added (大いなる母 and 喧嘩両成敗); five names and five revealed descriptions are revised; `?debug=1` exposes an all-achievements button.
+- v39.16.46 changes: achievement names and presentation are revised; conditions are revealed only after unlock; shared completion rates render as horizontal background bars; automation and link coverage merge into 機械化産業; placement and ant-kill targets are persistent totals of 100; direct feeding resets with the field.
+- v39.16.45 changes: seven play-style achievements add passive observation, cumulative placement, detector automation, link-tool coverage, safe large-colony operation, ant population, and ant elimination measurements. World-scoped timers and placement counts persist in current-format saves.
+- No bundler; `index.html` loads ordered global-IIFE scripts with `?v=39.16.78`.
+- v39.16.31 changes: all in-world tooltips use the closer offset; Hair Trigger adds a central bounce-fence ball enclosure with Tarinai and pet-food duplicators outside; physics tools use distinct icons.
+- v39.16.29 changes: parasol placement preview now uses the exact shade center and footprint; toilet sand absorbs rain-created water drops. Happy adds parasols, water balloons, and toilet sand beneath each duplicator; Athletic uses fence-safe single-bar rotators and water balloons; War adds rotating fans.
+- v39.16.19 changes: food and medicine can be given directly by placement or pinched drop, with a dedicated overlay, food heart bursts, and stronger personality effects; unused collision reasons and duplicate constraint projection dirty checks were removed.
- Mutable runtime lives on `window`; primary entities are `World`, `Tarinai`, items, structures, ants, family graph, weather, and save snapshots.
- Update loop: `main.js` creates the world/UI loop; `World.update` delegates to `TarinaiSystemOrder.update`; `system_order.js` runs named phases.
- UI loop: pointer/tool/UI intents go through `command_dispatcher.js`; canvas drawing is in render modules; side panels are `ui_*.js`.
@@ -56,3 +67,46 @@ AI-first entrypoint for a static browser simulation/game. Keep this file small;
### v39.16.16
Colony birth/death chart lines, reverse rotators, champion-trait inheritance, reduced champion-pair mating, and directional one-way-fence routing.
+
+
+- v39.16.39 changes: restored the compact sticky operation palette, added exact-match right-panel search, reorganized colony settings, and refreshed tool icons.
+
+
+## Achievement system (v39.16.78)
+- Sixty-four local achievements cover biological events, special deaths, colony conditions, individual care, passive ecology, Undo/Redo behavior, rapid deletion, cleaner use, temperature transitions, medicine-category completion, weather shelter, combat reversals, circuit-board signaling, and ant-related play styles.
+- Locked entries show the configured pre-unlock disclosure directly in the row; all other locked entries show `???`. 大いなる母, めっちゃたりない観察, and 敵の敵は味方 show local progress percentages. Unlocked entries appear first within each category.
+- Each entry is a horizontal completion-rate bar whose background fill reflects the optional shared global unlock percentage; the shared achiever count appears beside the percentage.
+- v39.16.64 adds 毎日たりない観察(7 calendar days) and 抵抗器じゃない(7 distinct tarinai shocked by one energized bare wire). v39.16.54 added 真・たりない観察, 悠久の歴史, 五体満足, and 零体満足. v39.16.55 added 町のお医者さん for 50 effective first-aid recoveries and 割とふわふわ for flinging a plushie with つつく; both are event-driven and 町のお医者さん is disclosed before unlock. v39.16.56 added two achievements, persistent fight progress, stricter robot-only evaluation, revised thresholds, and unlocked-card rate bars. v39.16.60 adds three achievements and restricts the chaos counter to fight-mochi-influenced fights.
+- Persistent totals include 物でいっぱい, 害虫駆除, 大いなる母(3333体), 無計画都市, やっぱなし, and やっぱあり. Field-local progress includes 餌やりじいさん, 清掃業者, 自給自足, and 敵の敵は味方; applicable field-local metadata follows current-format saves.
+- `自動化の第一歩` and `リンク職人` are retired and replaced by `機械化産業`, which requires both detector-driven activation and rope/rod/spring coverage. Existing players with both retired achievements migrate automatically.
+- Optional same-origin PHP API aggregates anonymous player counts and global unlock percentages. Raw aggregate data is stored under `.achievement_data/state.json` in compact v3 positional arrays. Compact v2 and the prior verbose object are accepted only as migration inputs and are automatically rewritten under a separate server lock with atomic file replacement on the next API read. UUIDs are binary/base64url encoded, achievement IDs are indexed, timestamps are delta-coded, and repeated game versions use a dictionary.
+- On startup, shared-stat refresh, achievement-screen opening, and every five minutes, the client sends its complete non-debug unlock set with original local timestamps. Ordinary unlock bursts send only unsynchronized records after a short debounce. The server adds only missing records, so a lost `state.json` is rebuilt incrementally as players return without overwriting surviving records.
+
+### Shared achievement percentage deployment
+- Upload `achievement_api.php` and the hidden `.achievement_data` directory with the game.
+- PHP must be enabled, and `.achievement_data` must be writable by the PHP process.
+- On a static-only host, local unlocks still work; the global percentage is shown as unavailable.
+- Set `window.TARINAI_ACHIEVEMENT_API` before `achievements.js` to use a different same-origin endpoint.
+- The current release tracks sixty-four achievement IDs, supports per-player reset, and accepts additive bulk synchronization for automatic recovery after aggregate-data loss. A separate backup remains necessary to recover players who never return.
+- `python3 scripts/achievement_server_state_audit.py` creates deterministic randomized achievement histories at runtime; it does not require or modify a production `state.json`.
+- v39.16.60 changes: achievement metadata in spells is now encoded as sparse binary data instead of embedded JSON; unlock masks, progress, timestamps, per-entity counters, and placement metadata are compactly packed and spell data is accepted only from the current format.
+- v39.16.60: Added 狙撃手, メガロポリス, and 豊穣ヲ希求スル者; restricted 混沌ヲ希求スル者 to fight-mochi-influenced fights; extended compact achievement spell progress and omitted counters for already-unlocked achievements.
+- v39.16.62: Added スペックがたりない, 寝ろ, 砂場, そこ公共空間だよ?, and 破格の工事費用; 寿命 deaths no longer reset 安全第一; 何やってるの? now uses empty-field clicks; and save schema 44 expands the achievement mask while decoding schemas 41–43.
+
+- v39.16.63: Fixed achievement progress text weight and continuous-play tab switching; added アリ観察 and 命のバトン; corrected サウナ水風呂 and 敵の敵は味方 condition mismatches; save/spell data accepts only schema 45 and achievement payload v4.
+- v39.16.64: Added 毎日たりない観察 and 抵抗器じゃない; introduced calendar-day streak persistence; and migrated server aggregate JSON to compact v3 positional data automatically on read.
+- v39.16.65: Hardened pre-deployment server migration with read-only summaries, POST-only mutations, corruption-safe decoding, atomic writes under a separate lock, completionist eligibility filtering, and seeded randomized/concurrent migration audits.
+
+- v39.16.66: Added two-user seesaw play, an editable AND/OR/NOT circuit board with positioned terminals, signal control for fan/stove/dry ice/duplicator, and wire-target highlighting.
+
+- v39.16.67: Replaced the circuit-board dropdown editor with direct grid placement and cursor-drawn wiring; changed colony-state evaluation to every two in-game hours and excluded growing populations from Weakened; fixed seesaw action selection, fixed its orientation, and matched the placement overlay to its shape.
+- v39.16.69: Reworked circuit-board wiring into straight grid segments with branches and multi-connect terminals; removed OR and added a rectifier; made internal parts rotatable and external terminal count/positions editable; expanded board terminal spacing; changed detector numeric conditions to min/max dual sliders with number inputs; and raised seesaw riders slightly above the seats.
+- v39.16.68: Fixed seesaw participation so idle/bored Tarinai can initiate play and a waiting rider strongly recruits a partner; selected data reports active play as 「シーソーをしている。」; moved seesaws behind sprite layers; and aligned all two-input circuit gate pins to the 40px wiring grid.
+- v39.16.70: Reduced the default circuit-board footprint to one quarter of the previous area; made grid width/height editable; made external terminals movable on all four edges with a height-dependent count limit; made branch junctions movable; reduced NOT/rectifier body sizes; and corrected seesaw action-reason text.
+
+- v39.16.71: Replaced circuit-board terminal +/- controls with direct IN/OUT terminal placement and erasing, dimmed terminals without external world wires, removed generic elliptical placement previews, added an Electrical tool category for detector/wires/circuit board, and made detector range-track clicks move the nearest thumb.
+
+- v39.16.72: Circuit boards now default to 10x10 with a 20x20 maximum, AND uses a two-cell height, compact gates can sit closer to top/bottom edges, placement previews follow occupancy footprints more directly, and unstable internal logic loops are explicitly forced OFF.
+- v39.16.73: Circuit-board editing now shows placement ghosts for internal parts and terminals, Q/E rotates the pending internal part by 90 degrees, ON constant sources are explained in the editor, and wire/insulated-wire palette silhouettes render correctly after the Electrical category move.
+- v39.16.78: Fixed 「あぁ^~ たまらねぇぜ」 so burst zunchi ignore their spawn overlap with the owner, arm only after clearing the owner once, and unlock on a later fatal return collision including bounce-fence reflections. The renewed achievement audit also fixes ミニマリスト save metadata, サウナ水風呂 hot-entry timing, lethal wire-shock counting, reset-scoped hidden progress cleanup, and 監視カメラ intervention gaps for Undo/Redo and ground changes.
+- v39.16.76: Removed the circuit-board OFF constant part and added the 「情報化産業」 achievement for carrying an active signal directly from one circuit board to another over wire or insulated wire.
diff --git a/achievement_api.php b/achievement_api.php
new file mode 100644
index 0000000..d439797
--- /dev/null
+++ b/achievement_api.php
@@ -0,0 +1,513 @@
+ [], 'unlocks' => []];
+}
+
+function compact_player_id(string $value): string {
+ $hex = str_replace('-', '', strtolower($value));
+ if (strlen($hex) !== 32 || !ctype_xdigit($hex)) return '';
+ $binary = hex2bin($hex);
+ if ($binary === false) return '';
+ return rtrim(strtr(base64_encode($binary), '+/', '-_'), '=');
+}
+
+function expand_player_id(string $value): string {
+ if (strlen($value) !== 22 || preg_match('/^[A-Za-z0-9_-]{22}$/', $value) !== 1) return '';
+ $binary = base64_decode(strtr($value, '-_', '+/') . '==', true);
+ if ($binary === false || strlen($binary) !== 16) return '';
+ $hex = bin2hex($binary);
+ return substr($hex, 0, 8) . '-' . substr($hex, 8, 4) . '-' . substr($hex, 12, 4) . '-' . substr($hex, 16, 4) . '-' . substr($hex, 20, 12);
+}
+
+function detect_state_format(mixed $value): string {
+ if (!is_array($value)) return 'invalid';
+ if ($value === []) return 'empty';
+ if (array_is_list($value)) {
+ return (($value[0] ?? null) === STATE_SCHEMA_VERSION
+ && isset($value[1], $value[2], $value[3], $value[4])
+ && is_array($value[2]) && is_array($value[3]) && is_array($value[4]))
+ ? 'v3' : 'invalid';
+ }
+ if (($value['v'] ?? null) === 2 && isset($value['p'], $value['u']) && is_array($value['p']) && is_array($value['u'])) {
+ return 'v2';
+ }
+ if (array_key_exists('players', $value) || array_key_exists('unlocks', $value)) return 'verbose';
+ return 'invalid';
+}
+
+function normalize_state(mixed $value): array {
+ if (!is_array($value)) return empty_state();
+ $players = [];
+ $unlocks = [];
+
+ // v3 positional form: [version, baseTime, versions, players, unlocks].
+ if (($value[0] ?? null) === STATE_SCHEMA_VERSION && isset($value[1], $value[2], $value[3], $value[4])
+ && is_array($value[2]) && is_array($value[3]) && is_array($value[4])) {
+ $baseTime = max(1, (int)$value[1]);
+ $versions = array_map(static fn($entry): string => substr((string)$entry, 0, 32), $value[2]);
+ $playerIds = [];
+ foreach ($value[3] as $row) {
+ if (!is_array($row) || !isset($row[0]) || !is_string($row[0])) continue;
+ $id = expand_player_id($row[0]);
+ if (!valid_player_id($id)) continue;
+ $firstSeen = $baseTime + max(0, (int)($row[1] ?? 0));
+ $lastSeen = $firstSeen + max(0, (int)($row[2] ?? 0));
+ $versionIndex = max(0, (int)($row[3] ?? 0));
+ $playerIds[] = $id;
+ $players[$id] = [
+ 'firstSeen' => max(1, $firstSeen),
+ 'lastSeen' => max(1, $lastSeen),
+ 'gameVersion' => $versions[$versionIndex] ?? '',
+ ];
+ }
+ foreach ($value[4] as $row) {
+ if (!is_array($row) || count($row) < 3) continue;
+ $achievementIndex = (int)$row[0];
+ $achievementId = ACHIEVEMENT_IDS[$achievementIndex] ?? '';
+ if ($achievementId === '') continue;
+ $records = [];
+ $count = count($row);
+ for ($i = 1; $i + 1 < $count; $i += 2) {
+ $playerIndex = (int)$row[$i];
+ if (!isset($playerIds[$playerIndex])) continue;
+ $records[$playerIds[$playerIndex]] = $baseTime + max(0, (int)$row[$i + 1]);
+ }
+ if ($records) $unlocks[$achievementId] = $records;
+ }
+ // v2 is an on-read migration source and is always rewritten as v3.
+ } elseif (($value['v'] ?? null) === 2 && isset($value['p'], $value['u']) && is_array($value['p']) && is_array($value['u'])) {
+ $playerIds = [];
+ foreach ($value['p'] as $row) {
+ if (!is_array($row) || !isset($row[0]) || !is_string($row[0]) || !valid_player_id($row[0])) continue;
+ $id = strtolower($row[0]);
+ $playerIds[] = $id;
+ $players[$id] = [
+ 'firstSeen' => max(1, (int)($row[1] ?? 1)),
+ 'lastSeen' => max(1, (int)($row[2] ?? ($row[1] ?? 1))),
+ 'gameVersion' => substr((string)($row[3] ?? ''), 0, 32),
+ ];
+ }
+ foreach ($value['u'] as $achievementId => $flat) {
+ if (!is_string($achievementId) || (!in_array($achievementId, ACHIEVEMENT_IDS, true) && !in_array($achievementId, ['signal_automation_first', 'link_craftsman'], true)) || !is_array($flat)) continue;
+ $records = [];
+ $count = count($flat);
+ for ($i = 0; $i + 1 < $count; $i += 2) {
+ $playerIndex = (int)$flat[$i];
+ if (!isset($playerIds[$playerIndex])) continue;
+ $records[$playerIds[$playerIndex]] = max(1, (int)$flat[$i + 1]);
+ }
+ if ($records) $unlocks[$achievementId] = $records;
+ }
+ } else {
+ $rawPlayers = isset($value['players']) && is_array($value['players']) ? $value['players'] : [];
+ foreach ($rawPlayers as $id => $player) {
+ if (!is_string($id) || !valid_player_id($id) || !is_array($player)) continue;
+ $players[strtolower($id)] = [
+ 'firstSeen' => max(1, (int)($player['firstSeen'] ?? 1)),
+ 'lastSeen' => max(1, (int)($player['lastSeen'] ?? ($player['firstSeen'] ?? 1))),
+ 'gameVersion' => substr((string)($player['gameVersion'] ?? ''), 0, 32),
+ ];
+ }
+ $rawUnlocks = isset($value['unlocks']) && is_array($value['unlocks']) ? $value['unlocks'] : [];
+ foreach ($rawUnlocks as $achievementId => $records) {
+ if (!is_string($achievementId) || (!in_array($achievementId, ACHIEVEMENT_IDS, true) && !in_array($achievementId, ['signal_automation_first', 'link_craftsman'], true)) || !is_array($records)) continue;
+ foreach ($records as $id => $timestamp) {
+ $normalizedId = strtolower((string)$id);
+ if (!isset($players[$normalizedId])) continue;
+ $unlocks[$achievementId][$normalizedId] = max(1, (int)$timestamp);
+ }
+ }
+ }
+
+ $legacySignal = isset($unlocks['signal_automation_first']) && is_array($unlocks['signal_automation_first'])
+ ? $unlocks['signal_automation_first'] : [];
+ $legacyLinks = isset($unlocks['link_craftsman']) && is_array($unlocks['link_craftsman'])
+ ? $unlocks['link_craftsman'] : [];
+ if ($legacySignal && $legacyLinks) {
+ if (!isset($unlocks['mechanized_industry']) || !is_array($unlocks['mechanized_industry'])) {
+ $unlocks['mechanized_industry'] = [];
+ }
+ foreach ($legacySignal as $playerId => $signalTime) {
+ if (!isset($legacyLinks[$playerId])) continue;
+ $unlocks['mechanized_industry'][$playerId] = max((int)$signalTime, (int)$legacyLinks[$playerId]);
+ }
+ }
+ unset($unlocks['signal_automation_first'], $unlocks['link_craftsman']);
+
+ return ['players' => $players, 'unlocks' => $unlocks];
+}
+
+function compact_state(array $state): array {
+ $playerIds = array_keys($state['players']);
+ sort($playerIds, SORT_STRING);
+ $playerIndex = [];
+ $timestamps = [];
+ $versionCounts = [];
+ foreach ($playerIds as $id) {
+ $player = is_array($state['players'][$id] ?? null) ? $state['players'][$id] : [];
+ $timestamps[] = max(1, (int)($player['firstSeen'] ?? 1));
+ $timestamps[] = max(1, (int)($player['lastSeen'] ?? ($player['firstSeen'] ?? 1)));
+ $version = substr((string)($player['gameVersion'] ?? ''), 0, 32);
+ $versionCounts[$version] = ($versionCounts[$version] ?? 0) + 1;
+ }
+ foreach ($state['unlocks'] as $achievementId => $records) {
+ if (!is_string($achievementId) || !in_array($achievementId, ACHIEVEMENT_IDS, true) || !is_array($records)) continue;
+ foreach ($records as $timestamp) $timestamps[] = max(1, (int)$timestamp);
+ }
+ $baseTime = $timestamps ? min($timestamps) : 1;
+ uksort($versionCounts, static function (string $a, string $b) use ($versionCounts): int {
+ $countOrder = ($versionCounts[$b] ?? 0) <=> ($versionCounts[$a] ?? 0);
+ return $countOrder !== 0 ? $countOrder : strcmp($a, $b);
+ });
+ $versions = array_keys($versionCounts);
+ if (!$versions) $versions = [''];
+ $versionIndex = array_flip($versions);
+
+ $players = [];
+ foreach ($playerIds as $index => $id) {
+ $playerIndex[$id] = $index;
+ $player = is_array($state['players'][$id] ?? null) ? $state['players'][$id] : [];
+ $firstSeen = max(1, (int)($player['firstSeen'] ?? 1));
+ $lastSeen = max($firstSeen, (int)($player['lastSeen'] ?? $firstSeen));
+ $version = substr((string)($player['gameVersion'] ?? ''), 0, 32);
+ $row = [compact_player_id($id), $firstSeen - $baseTime, $lastSeen - $firstSeen];
+ $indexValue = (int)($versionIndex[$version] ?? 0);
+ if ($indexValue !== 0) $row[] = $indexValue;
+ $players[] = $row;
+ }
+
+ $unlocks = [];
+ foreach (ACHIEVEMENT_IDS as $achievementIndex => $achievementId) {
+ $records = $state['unlocks'][$achievementId] ?? null;
+ if (!is_array($records) || !$records) continue;
+ $pairs = [];
+ foreach ($records as $id => $timestamp) {
+ if (!isset($playerIndex[$id])) continue;
+ $pairs[] = [$playerIndex[$id], max(1, (int)$timestamp) - $baseTime];
+ }
+ usort($pairs, static fn(array $a, array $b): int => $a[0] <=> $b[0]);
+ if (!$pairs) continue;
+ $row = [$achievementIndex];
+ foreach ($pairs as [$indexValue, $timestampDelta]) {
+ $row[] = $indexValue;
+ $row[] = max(0, $timestampDelta);
+ }
+ $unlocks[] = $row;
+ }
+ return [STATE_SCHEMA_VERSION, $baseTime, $versions, $players, $unlocks];
+}
+
+function encode_compact_state(array $state): string {
+ try {
+ return json_encode(compact_state($state), JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE | JSON_THROW_ON_ERROR);
+ } catch (JsonException $error) {
+ throw new RuntimeException('storage_encode_failed', 0, $error);
+ }
+}
+
+function decode_stored_state(string $contents): array {
+ if (trim($contents) === '') return [empty_state(), 'empty'];
+ try {
+ $decoded = json_decode($contents, true, 512, JSON_THROW_ON_ERROR);
+ } catch (JsonException $error) {
+ throw new RuntimeException('storage_corrupt', 0, $error);
+ }
+ $format = detect_state_format($decoded);
+ if ($format === 'invalid') throw new RuntimeException('storage_corrupt');
+ return [normalize_state($decoded), $format];
+}
+
+function atomic_write_state(string $dataPath, string $encoded): void {
+ $dataDir = dirname($dataPath);
+ $tempPath = tempnam($dataDir, DATA_FILE_NAME . '.tmp.');
+ if ($tempPath === false) throw new RuntimeException('storage_unavailable');
+ $handle = @fopen($tempPath, 'wb');
+ if ($handle === false) {
+ @unlink($tempPath);
+ throw new RuntimeException('storage_unavailable');
+ }
+ try {
+ $length = strlen($encoded);
+ $offset = 0;
+ while ($offset < $length) {
+ $written = fwrite($handle, substr($encoded, $offset));
+ if ($written === false || $written === 0) throw new RuntimeException('storage_write_failed');
+ $offset += $written;
+ }
+ if (!fflush($handle)) throw new RuntimeException('storage_write_failed');
+ if (function_exists('fsync') && !fsync($handle)) throw new RuntimeException('storage_write_failed');
+ } catch (Throwable $error) {
+ fclose($handle);
+ @unlink($tempPath);
+ throw $error;
+ }
+ fclose($handle);
+ @chmod($tempPath, 0664);
+ if (!@rename($tempPath, $dataPath)) {
+ @unlink($tempPath);
+ throw new RuntimeException('storage_write_failed');
+ }
+}
+
+function build_summary(array $state): array {
+ $total = count($state['players']);
+ $achievements = [];
+ foreach (ACHIEVEMENT_IDS as $id) {
+ $unlocked = isset($state['unlocks'][$id]) && is_array($state['unlocks'][$id])
+ ? count($state['unlocks'][$id])
+ : 0;
+ $percentage = $total > 0 ? round(($unlocked / $total) * 100, 1) : 0.0;
+ $achievements[$id] = [
+ 'unlockedPlayers' => $unlocked,
+ 'percentage' => $percentage,
+ ];
+ }
+ return [
+ 'ok' => true,
+ 'totalPlayers' => $total,
+ 'achievements' => $achievements,
+ ];
+}
+
+$method = strtoupper($_SERVER['REQUEST_METHOD'] ?? 'GET');
+if (!in_array($method, ['GET', 'POST'], true)) respond(['ok' => false, 'error' => 'method_not_allowed'], 405);
+
+$payload = [];
+if ($method === 'POST') {
+ $declaredLength = max(0, (int)($_SERVER['CONTENT_LENGTH'] ?? 0));
+ if ($declaredLength > MAX_REQUEST_BYTES) respond(['ok' => false, 'error' => 'request_too_large'], 413);
+ $raw = file_get_contents('php://input', false, null, 0, MAX_REQUEST_BYTES + 1);
+ if (!is_string($raw) || strlen($raw) > MAX_REQUEST_BYTES) respond(['ok' => false, 'error' => 'request_too_large'], 413);
+ try {
+ $decoded = json_decode($raw, true, 64, JSON_THROW_ON_ERROR);
+ } catch (JsonException) {
+ respond(['ok' => false, 'error' => 'invalid_json'], 400);
+ }
+ if (!is_array($decoded)) respond(['ok' => false, 'error' => 'invalid_json'], 400);
+ $payload = $decoded;
+}
+
+$action = $method === 'POST'
+ ? (string)($payload['action'] ?? '')
+ : (string)($_GET['action'] ?? 'summary');
+$playerId = $method === 'POST'
+ ? (string)($payload['playerId'] ?? '')
+ : (string)($_GET['playerId'] ?? '');
+
+if (!in_array($action, ['session', 'unlock', 'sync', 'reset', 'summary'], true)) {
+ respond(['ok' => false, 'error' => 'invalid_action'], 400);
+}
+if ($method === 'GET' && $action !== 'summary') {
+ respond(['ok' => false, 'error' => 'method_not_allowed'], 405);
+}
+if (!valid_player_id($playerId)) {
+ respond(['ok' => false, 'error' => 'invalid_player'], 400);
+}
+$playerId = strtolower($playerId);
+$syncUnlocks = [];
+$completionistEligible = null;
+if ($action === 'unlock') {
+ $achievementId = (string)($payload['achievementId'] ?? '');
+ if (!in_array($achievementId, ACHIEVEMENT_IDS, true)) {
+ respond(['ok' => false, 'error' => 'invalid_achievement'], 400);
+ }
+} elseif ($action === 'sync') {
+ $submittedUnlocks = $payload['unlocked'] ?? null;
+ if (!is_array($submittedUnlocks) || count($submittedUnlocks) > count(ACHIEVEMENT_IDS)) {
+ respond(['ok' => false, 'error' => 'invalid_unlocks'], 400);
+ }
+ if (array_key_exists('completionistEligible', $payload)) {
+ if (!is_bool($payload['completionistEligible'])) {
+ respond(['ok' => false, 'error' => 'invalid_completionist_state'], 400);
+ }
+ $completionistEligible = $payload['completionistEligible'];
+ }
+ foreach ($submittedUnlocks as $achievementId => $timestamp) {
+ if (!is_string($achievementId) || !in_array($achievementId, ACHIEVEMENT_IDS, true)) {
+ respond(['ok' => false, 'error' => 'invalid_achievement'], 400);
+ }
+ if (!is_int($timestamp) && !is_float($timestamp) && !is_string($timestamp)) {
+ respond(['ok' => false, 'error' => 'invalid_timestamp'], 400);
+ }
+ $numericTimestamp = filter_var($timestamp, FILTER_VALIDATE_FLOAT);
+ if ($numericTimestamp === false || !is_finite((float)$numericTimestamp) || $numericTimestamp <= 0) {
+ respond(['ok' => false, 'error' => 'invalid_timestamp'], 400);
+ }
+ $syncUnlocks[$achievementId] = (float)$numericTimestamp;
+ }
+ if ($completionistEligible === false) unset($syncUnlocks['true_tarinai_observer']);
+}
+
+$dataDir = __DIR__ . DIRECTORY_SEPARATOR . DATA_DIR_NAME;
+if (!is_dir($dataDir) && !mkdir($dataDir, 0775, true) && !is_dir($dataDir)) {
+ respond(['ok' => false, 'error' => 'storage_unavailable'], 503);
+}
+$dataPath = $dataDir . DIRECTORY_SEPARATOR . DATA_FILE_NAME;
+$lockPath = $dataDir . DIRECTORY_SEPARATOR . LOCK_FILE_NAME;
+$lockHandle = @fopen($lockPath, 'c');
+if ($lockHandle === false || !flock($lockHandle, LOCK_EX)) {
+ if (is_resource($lockHandle)) fclose($lockHandle);
+ respond(['ok' => false, 'error' => 'storage_locked'], 503);
+}
+
+$summary = null;
+$storageError = null;
+try {
+ $contents = is_file($dataPath) ? file_get_contents($dataPath) : '';
+ if ($contents === false) throw new RuntimeException('storage_unavailable');
+ [$state, $sourceFormat] = decode_stored_state($contents);
+ $now = time();
+ $mutatesPlayer = $action !== 'summary';
+
+ if ($mutatesPlayer) {
+ $player = isset($state['players'][$playerId]) && is_array($state['players'][$playerId])
+ ? $state['players'][$playerId]
+ : ['firstSeen' => $now];
+ $player['lastSeen'] = $now;
+ $submittedGameVersion = substr((string)($payload['gameVersion'] ?? ''), 0, 32);
+ if ($submittedGameVersion !== '' || !isset($player['gameVersion'])) $player['gameVersion'] = $submittedGameVersion;
+ $state['players'][$playerId] = $player;
+ }
+
+ if ($action === 'unlock') {
+ $achievementId = (string)$payload['achievementId'];
+ if (!isset($state['unlocks'][$achievementId]) || !is_array($state['unlocks'][$achievementId])) {
+ $state['unlocks'][$achievementId] = [];
+ }
+ if (!isset($state['unlocks'][$achievementId][$playerId])) {
+ $state['unlocks'][$achievementId][$playerId] = $now;
+ }
+ } elseif ($action === 'sync') {
+ if ($completionistEligible === false && isset($state['unlocks']['true_tarinai_observer'][$playerId])) {
+ unset($state['unlocks']['true_tarinai_observer'][$playerId]);
+ }
+ foreach ($syncUnlocks as $achievementId => $submittedTimestamp) {
+ if (!isset($state['unlocks'][$achievementId]) || !is_array($state['unlocks'][$achievementId])) {
+ $state['unlocks'][$achievementId] = [];
+ }
+ if (isset($state['unlocks'][$achievementId][$playerId])) continue;
+ $timestampSeconds = $submittedTimestamp >= 100000000000
+ ? (int)floor($submittedTimestamp / 1000)
+ : (int)floor($submittedTimestamp);
+ $state['unlocks'][$achievementId][$playerId] = max(1, min($now, $timestampSeconds));
+ }
+ } elseif ($action === 'reset') {
+ foreach ($state['unlocks'] as $achievementId => $records) {
+ if (is_array($records)) unset($state['unlocks'][$achievementId][$playerId]);
+ }
+ }
+
+ $encoded = encode_compact_state($state);
+ if (trim($contents) !== $encoded || $sourceFormat !== 'v3' || $mutatesPlayer) {
+ atomic_write_state($dataPath, $encoded);
+ }
+ $summary = build_summary($state);
+} catch (RuntimeException $error) {
+ $known = ['storage_corrupt', 'storage_unavailable', 'storage_write_failed', 'storage_encode_failed'];
+ $storageError = in_array($error->getMessage(), $known, true) ? $error->getMessage() : 'storage_unavailable';
+} finally {
+ flock($lockHandle, LOCK_UN);
+ fclose($lockHandle);
+}
+
+if ($storageError !== null) respond(['ok' => false, 'error' => $storageError], 503);
+respond(is_array($summary) ? $summary : ['ok' => false, 'error' => 'storage_unavailable'], is_array($summary) ? 200 : 503);
diff --git a/app_manifest.json b/app_manifest.json
index 312f41f..48459a8 100644
--- a/app_manifest.json
+++ b/app_manifest.json
@@ -1,5 +1,5 @@
{
- "version": "39.16.18",
+ "version": "39.16.98",
"css": [
"css/base.css",
"css/layout.css",
@@ -36,6 +36,7 @@
"js/constraint_system.js",
"js/physics_world_system.js",
"js/physics_projection_system.js",
+ "js/circuit_board_system.js",
"js/signal_system.js",
"js/assets.js",
"js/audio.js",
@@ -88,9 +89,11 @@
"js/tarinai_consumable_behavior.js",
"js/tarinai_social_action_runtime.js",
"js/tarinai_building_behavior.js",
+ "js/seesaw_system.js",
"js/tarinai_action_definitions.js",
"js/tarinai_needs_items.js",
"js/tarinai_food_prototype_mixin.js",
+ "js/tarinai_direct_feeding_system.js",
"js/tarinai_need_planner_system.js",
"js/tarinai_item_interaction_context.js",
"js/tarinai_food_interaction_system.js",
@@ -144,8 +147,10 @@
"js/command_dispatcher.js",
"js/text_catalog.js",
"js/ui.js",
- "js/ui_log.js",
+ "js/game_dialogs.js",
+ "js/achievements.js",
"js/ui_helpers.js",
+ "js/ui_log.js",
"js/ui_selected.js",
"js/save_schema.js",
"js/snapshot_system.js",
diff --git a/css/base.css b/css/base.css
index 5e59647..91b9d49 100644
--- a/css/base.css
+++ b/css/base.css
@@ -325,13 +325,13 @@ h1 {
--tool-watermark-size: 0px;
border-radius: 12px;
display: grid;
- grid-template-columns: 29px minmax(0,1fr);
+ grid-template-columns: 31px minmax(0,1fr);
align-items: center;
justify-items: stretch;
- gap: 3px;
- padding: 4px 4px 4px 2px;
+ gap: 2px;
+ padding: 3px 3px 3px 2px;
min-height: 47px;
- font-size: 10.2px;
+ font-size: 11.4px;
line-height: 1.06;
letter-spacing: -0.015em;
text-align: left;
@@ -374,16 +374,16 @@ h1 {
max-width: 100%;
min-width: 0;
overflow-wrap: anywhere;
- font-size: 10.2px;
- line-height: 1.10;
+ font-size: 11.4px;
+ line-height: 1.08;
font-weight: 700;
- max-width: 5.05em;
+ max-width: 5.35em;
word-break: normal;
overflow-wrap: anywhere;
text-shadow: 0 1px 0 rgba(255,255,255,0.62);
}
-.tool.tool-has-canvas-icon { --tool-icon: none; grid-template-columns: 29px minmax(0,1fr); min-height: 47px; padding-top: 4px; }
+.tool.tool-has-canvas-icon { --tool-icon: none; grid-template-columns: 31px minmax(0,1fr); min-height: 47px; padding-top: 4px; }
.tool.tool-has-canvas-icon::before,
.tool.tool-has-canvas-icon::after { background: none !important; }
@@ -401,6 +401,7 @@ h1 {
.tool[data-tool="giant_drug"] .tool-sprite-preview { width: 39px; height: 39px; left: -4px; }
.tool[data-tool="dwarf_drug"] .tool-sprite-preview,
.tool[data-tool="oshibyo"] .tool-sprite-preview { width: 22px; height: 22px; left: 5px; }
+.tool.tool-has-physics-icon .tool-physics-preview { width: 31px; height: 31px; left: 0; filter: drop-shadow(0 1px 2px rgba(52,40,26,0.16)); }
.tool[data-tool="poke"], .tool[data-tool="water_hose"] { --tool-icon-zoom: 0.92; }
.signboard-editor {
@@ -620,6 +621,164 @@ h1 {
padding: 4px 6px;
}
+
+.pressure-numeric-control[hidden] { display: none; }
+.pressure-numeric-control {
+ display: grid;
+ gap: 8px;
+ padding: 10px 10px 8px;
+ border-radius: 11px;
+ border: 1px solid rgba(84,68,48,0.13);
+ background: rgba(255,255,255,0.58);
+}
+.pressure-value-slider {
+ width: calc(100% - 14px);
+ height: 34px;
+ margin: 0 7px;
+ padding: 0;
+ appearance: none;
+ -webkit-appearance: none;
+ background: transparent;
+}
+.pressure-value-slider::-webkit-slider-runnable-track {
+ height: 6px;
+ border-radius: 999px;
+ background: rgba(67,158,218,0.78);
+ box-shadow: inset 0 1px 2px rgba(43,55,66,0.16);
+}
+.pressure-value-slider::-webkit-slider-thumb {
+ width: 20px;
+ height: 20px;
+ margin-top: -7px;
+ border-radius: 50%;
+ border: 2px solid rgba(42,121,172,0.88);
+ background: #fafdff;
+ box-shadow: 0 2px 6px rgba(42,78,104,0.24);
+ appearance: none;
+ -webkit-appearance: none;
+ cursor: grab;
+}
+.pressure-value-slider::-moz-range-track {
+ height: 6px;
+ border: 0;
+ border-radius: 999px;
+ background: rgba(67,158,218,0.78);
+ box-shadow: inset 0 1px 2px rgba(43,55,66,0.16);
+}
+.pressure-value-slider::-moz-range-thumb {
+ width: 17px;
+ height: 17px;
+ border-radius: 50%;
+ border: 2px solid rgba(42,121,172,0.88);
+ background: #fafdff;
+ box-shadow: 0 2px 6px rgba(42,78,104,0.24);
+ cursor: grab;
+}
+.pressure-value-slider:focus-visible::-webkit-slider-thumb {
+ outline: 3px solid rgba(73,157,216,0.30);
+ outline-offset: 2px;
+}
+.pressure-value-slider:focus-visible::-moz-range-thumb {
+ outline: 3px solid rgba(73,157,216,0.30);
+ outline-offset: 2px;
+}
+
+.pressure-time-control[hidden] { display: none; }
+.pressure-spatial-control[hidden] { display: none; }
+.pressure-time-control {
+ display: grid;
+ gap: 8px;
+ padding: 10px 10px 8px;
+ border-radius: 11px;
+ border: 1px solid rgba(84,68,48,0.13);
+ background: rgba(255,255,255,0.58);
+}
+.pressure-time-summary {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ color: var(--ink);
+ font-size: 13px;
+ font-weight: 700;
+}
+.pressure-time-summary output {
+ display: inline-block;
+ min-width: 42px;
+ text-align: center;
+ font-variant-numeric: tabular-nums;
+}
+.pressure-time-range {
+ position: relative;
+ height: 34px;
+ margin: 0 7px;
+}
+.pressure-time-track {
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 14px;
+ height: 6px;
+ border-radius: 999px;
+ background: rgba(94,112,128,0.22);
+ box-shadow: inset 0 1px 2px rgba(43,55,66,0.16);
+}
+.pressure-time-thumb {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 34px;
+ margin: 0;
+ padding: 0;
+ appearance: none;
+ -webkit-appearance: none;
+ background: transparent;
+ pointer-events: none;
+}
+.pressure-time-thumb::-webkit-slider-runnable-track {
+ height: 6px;
+ background: transparent;
+ border: 0;
+}
+.pressure-time-thumb::-webkit-slider-thumb {
+ width: 20px;
+ height: 20px;
+ margin-top: -7px;
+ border-radius: 50%;
+ border: 2px solid rgba(42,121,172,0.88);
+ background: #fafdff;
+ box-shadow: 0 2px 6px rgba(42,78,104,0.24);
+ appearance: none;
+ -webkit-appearance: none;
+ pointer-events: auto;
+ cursor: grab;
+}
+.pressure-time-thumb::-moz-range-track {
+ height: 6px;
+ background: transparent;
+ border: 0;
+}
+.pressure-time-thumb::-moz-range-thumb {
+ width: 17px;
+ height: 17px;
+ border-radius: 50%;
+ border: 2px solid rgba(42,121,172,0.88);
+ background: #fafdff;
+ box-shadow: 0 2px 6px rgba(42,78,104,0.24);
+ pointer-events: auto;
+ cursor: grab;
+}
+.pressure-time-thumb:focus-visible::-webkit-slider-thumb {
+ outline: 3px solid rgba(73,157,216,0.30);
+ outline-offset: 2px;
+}
+.pressure-time-thumb:focus-visible::-moz-range-thumb {
+ outline: 3px solid rgba(73,157,216,0.30);
+ outline-offset: 2px;
+}
+.pressure-time-thumb-start { z-index: 2; }
+.pressure-time-thumb-end { z-index: 3; }
+.pressure-time-range[data-wraps="1"] .pressure-time-thumb-start { z-index: 4; }
.signal-channel-label {
font-size: 13px;
color: var(--ink);
@@ -758,3 +917,125 @@ h1 {
.save-confirm-dialog { z-index: 36; }
.save-confirm-panel { width: min(390px, 100%); }
.save-confirm-message { margin-bottom: 8px; color: var(--ink); font-size: 14px; }
+
+/* Logic-board editor */
+.circuit-board-editor{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:18px;background:rgba(18,22,27,.58);backdrop-filter:blur(3px)}
+.circuit-board-editor.hidden{display:none}
+.circuit-board-panel{width:min(980px,96vw);max-height:92vh;overflow:hidden;background:rgba(250,249,244,.98);color:#2e3531;border:1px solid rgba(44,74,57,.35);border-radius:18px;box-shadow:0 24px 70px rgba(0,0,0,.35);display:flex;flex-direction:column}
+.circuit-board-titlebar{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;background:linear-gradient(135deg,#235b3a,#347b50);color:white}
+.circuit-board-titlebar h2{margin:0;font-size:1.18rem}
+.circuit-board-titlebar button{border:0;background:transparent;color:white;font-size:1.7rem;line-height:1;cursor:pointer}
+.circuit-board-help{margin:12px 18px 6px;font-size:.88rem;color:#536059}
+.circuit-board-layout{display:grid;grid-template-columns:minmax(280px,42%) minmax(360px,58%);gap:14px;padding:10px 18px;min-height:0;flex:1}
+.circuit-board-preview{align-self:start;background:#17231c;border-radius:14px;padding:10px;min-height:250px;position:sticky;top:0}
+.circuit-board-preview svg{width:100%;height:auto;display:block}
+.circuit-preview-lines path{fill:none;stroke:#d7b84d;stroke-width:2.4}
+.circuit-preview-gates rect{fill:#26352d;stroke:#d9e9dd;stroke-width:1.3}.circuit-preview-gates text{fill:#f4f7f2;text-anchor:middle;font:700 11px sans-serif}
+.circuit-preview-pins circle{fill:#73c8ff;stroke:#f4f1d6;stroke-width:1.2}.circuit-preview-pins circle:nth-of-type(n+4){fill:#ff9a60}.circuit-preview-pins text{fill:#eef4ef;font:700 11px sans-serif}
+.circuit-board-scroll{overflow:auto;padding-right:4px}.circuit-board-scroll section{margin:0 0 14px;padding:12px;border:1px solid rgba(45,83,60,.18);border-radius:12px;background:white}.circuit-board-scroll h3{margin:0 0 10px;font-size:.94rem}
+.circuit-port-row,.circuit-gate-row,.circuit-output-row{display:grid;grid-template-columns:minmax(72px,1fr) auto auto auto;gap:8px;align-items:center;padding:7px 0;border-bottom:1px solid rgba(0,0,0,.07)}
+.circuit-port-row:last-child,.circuit-gate-row:last-child,.circuit-output-row:last-child{border-bottom:0}.circuit-port-row label,.circuit-gate-row label{display:flex;align-items:center;gap:4px;font-size:.8rem}
+.circuit-board-panel select,.circuit-board-panel button{font:inherit}.circuit-board-panel select{padding:5px 7px;border:1px solid rgba(37,77,53,.27);border-radius:7px;background:white}
+.circuit-gate-actions{display:flex;gap:7px;margin-bottom:8px}.circuit-gate-actions button,.circuit-gate-row button,.circuit-board-actions button{padding:7px 12px;border:1px solid rgba(38,82,54,.26);border-radius:9px;background:#f1f5f1;cursor:pointer}.circuit-gate-row button{padding:4px 9px;color:#a13f3f}
+.circuit-empty{margin:6px 0;color:#7a837d;font-size:.84rem}.circuit-output-row{grid-template-columns:50px 1fr}.circuit-board-actions{display:flex;justify-content:flex-end;gap:9px;padding:12px 18px 16px;border-top:1px solid rgba(0,0,0,.09)}.circuit-board-actions .primary{background:#2e754b;color:white;border-color:#245f3d}
+@media(max-width:760px){.circuit-board-layout{grid-template-columns:1fr}.circuit-board-preview{position:relative;min-height:180px}.circuit-port-row,.circuit-gate-row{grid-template-columns:1fr 1fr}.circuit-gate-row button{justify-self:end}.circuit-board-panel{max-height:96vh}}
+
+/* Grid circuit editor reuses the mechanical editor shell and toolbar. */
+.circuit-grid-panel { width: min(930px, calc(100vw - 28px)); }
+.circuit-grid-tools { max-height: none; overflow: visible; }
+.circuit-grid-canvas-wrap {
+ max-width: 100%;
+ max-height: min(62vh, 560px);
+ overflow: auto;
+ padding: 6px;
+ border-radius: 12px;
+ background: rgba(20,35,27,0.35);
+}
+#circuitGridCanvas {
+ width: auto;
+ height: auto;
+ max-width: none;
+ display: block;
+ border-radius: 10px;
+ border: 1px solid rgba(84,68,48,0.20);
+ background: #14231b;
+ touch-action: none;
+ cursor: crosshair;
+}
+.circuit-grid-hint { line-height: 1.55; }
+@media (max-width: 560px) {
+ .circuit-grid-panel { width: calc(100vw - 16px); }
+ .circuit-grid-tools { max-height: 20vh; overflow-y: auto; }
+ .circuit-grid-canvas-wrap { max-height: min(48vh, 360px); }
+ #circuitGridCanvas { max-width: none; }
+}
+
+/* v39.16.69: circuit terminal count controls and detector numeric range inputs. */
+.circuit-port-count-controls {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+ margin: 0 0 10px;
+}
+.circuit-port-count-controls label {
+ display: inline-flex;
+ align-items: center;
+ gap: 7px;
+ padding: 7px 9px;
+ border: 1px solid rgba(84,68,48,0.14);
+ border-radius: 10px;
+ background: rgba(255,255,255,0.56);
+ font-size: 13px;
+ font-weight: 700;
+}
+.circuit-port-count-controls button {
+ width: 30px;
+ height: 30px;
+ padding: 0;
+ border: 1px solid rgba(38,82,54,.26);
+ border-radius: 8px;
+ background: #f1f5f1;
+ cursor: pointer;
+}
+.circuit-port-count-controls input {
+ width: 54px;
+ min-height: 30px;
+ padding: 3px 6px;
+ border: 1px solid rgba(37,77,53,.27);
+ border-radius: 7px;
+ background: white;
+ text-align: center;
+ font: inherit;
+ font-variant-numeric: tabular-nums;
+}
+.pressure-number-inputs {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 8px;
+}
+.pressure-number-inputs label {
+ display: grid;
+ grid-template-columns: auto minmax(72px, 1fr);
+ align-items: center;
+ gap: 7px;
+ font-size: 12px;
+ font-weight: 700;
+}
+.pressure-number-inputs input {
+ width: 100%;
+ min-width: 0;
+ padding: 6px 8px;
+ border: 1px solid rgba(42,121,172,0.28);
+ border-radius: 8px;
+ background: rgba(255,255,255,0.92);
+ color: var(--ink);
+ font: inherit;
+ font-variant-numeric: tabular-nums;
+}
+@media (max-width: 560px) {
+ .circuit-port-count-controls { display: grid; grid-template-columns: 1fr; }
+ .circuit-port-count-controls label { justify-content: space-between; }
+}
+
+/* v39.16.70: resizable circuit board and movable junctions. */
+.circuit-port-count-controls label:nth-child(-n+2){background:rgba(236,246,239,.82)}
diff --git a/css/components.css b/css/components.css
index 240b0f3..a13e84e 100644
--- a/css/components.css
+++ b/css/components.css
@@ -643,129 +643,145 @@
font-size: 12px;
line-height: 1.45;
}
-.visual-settings-dialog-panel {
- width: min(560px, calc(100vw - 32px));
+/* v39.16.40: compact header menu and folded colony settings. */
+.top-menu { position: relative; display: inline-block; }
+.top-menu-btn {
+ min-width: 40px;
+ padding-inline: 11px;
+ font-size: 20px;
+ line-height: 1;
+ font-family: system-ui, sans-serif;
}
-.visual-setting-row {
+.top-menu-panel {
+ position: absolute;
+ right: 0;
+ top: calc(100% + 8px);
+ z-index: 14000;
+ width: min(250px, calc(100vw - 20px));
+ padding: 8px;
+ border: 1px solid rgba(84,68,48,.16);
+ border-radius: 16px;
+ background: rgba(255,252,246,.98);
+ box-shadow: 0 16px 42px rgba(44,34,25,.20);
display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- gap: 12px;
- align-items: center;
- padding: 12px 0;
- border-top: 1px solid rgba(115, 91, 62, 0.16);
-}
-.visual-setting-row strong,
-.visual-setting-row span {
- display: block;
-}
-.visual-setting-row strong {
- color: #4f3928;
- font-size: 15px;
-}
-.visual-setting-row span {
- margin-top: 3px;
- color: #6d5a46;
- font-size: 12px;
-}
-.visual-setting-options {
- display: inline-flex;
gap: 5px;
- padding: 4px;
- border: 1px solid rgba(115, 91, 62, 0.18);
- border-radius: 999px;
- background: rgba(255, 255, 255, 0.50);
}
-.visual-setting-options button {
- min-width: 46px;
- min-height: 32px;
- border: 1px solid transparent;
- border-radius: 999px;
+.top-menu-panel.hidden { display: none; }
+.top-menu-item {
+ width: 100%;
+ min-height: 38px;
+ border: 0;
+ border-radius: 11px;
+ padding: 8px 10px;
background: transparent;
- color: #5d4938;
- cursor: pointer;
+ color: var(--ink);
+ text-align: left;
font: inherit;
- font-weight: 800;
+ font-size: 13px;
+ font-weight: 700;
+ cursor: pointer;
}
-.visual-setting-options button.active,
-.visual-setting-options button[aria-pressed="true"] {
- border-color: rgba(127, 94, 54, 0.28);
- background: #fff4d8;
- color: #3f3023;
- box-shadow: 0 2px 8px rgba(96, 70, 40, 0.12);
-}
-.visual-setting-options button:focus-visible {
- outline: 2px solid rgba(184, 128, 54, 0.45);
- outline-offset: 2px;
-}
-@media (max-width: 640px) {
- .save-slot-row {
- grid-template-columns: 1fr;
- }
- .save-slot-actions {
- justify-content: flex-start;
- }
- .visual-setting-row {
- grid-template-columns: 1fr;
- }
- .visual-setting-options {
- width: 100%;
- justify-content: stretch;
- }
- .visual-setting-options button {
- flex: 1 1 0;
- }
+.top-menu-item:hover,
+.top-menu-item:focus-visible { background: rgba(238,245,225,.88); outline: none; }
+.top-menu-sound { display: block; width: 100%; }
+.top-menu-sound .sound-menu-btn { display: block; border: 0; box-shadow: none; }
+.top-menu-sound .sound-panel {
+ position: static;
+ width: auto;
+ min-width: 0;
+ margin: 3px 3px 5px;
+ padding: 9px 10px;
+ border-radius: 12px;
+ box-shadow: none;
+ background: rgba(245,240,229,.78);
}
-.ground-stat {
- padding: 7px 8px;
+.top-menu-visual { display: block; width: 100%; }
+.sound-panel-subtitle {
+ padding: 2px 0 1px;
+ color: var(--muted);
+ font-size: 10px;
+ font-weight: 800;
+ letter-spacing: .05em;
}
-.ground-type-btn {
- width: 100%;
- min-height: 28px;
- border: 1px solid rgba(92, 142, 74, 0.28);
- border-radius: 999px;
- background: rgba(255,255,255,0.58);
- color: inherit;
- cursor: pointer;
- font: inherit;
- box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
-}
-.ground-type-btn:hover {
- background: rgba(255,255,255,0.82);
- transform: translateY(-1px);
-}
-.ground-type-btn strong {
- display: inline-block;
- font-size: 16px;
- line-height: 1.2;
-}
-.ground-stat[data-ground-toggle] {
+.top-menu-visual .sound-panel label { min-height: 26px; }
+
+.reset-top-btn {
+ color: #8e2424 !important;
+ border-color: rgba(182,69,69,.48) !important;
+ background: linear-gradient(180deg, rgba(255,245,245,.96), rgba(255,224,224,.92)) !important;
+ font-weight: 800;
+}
+.reset-top-btn:hover { background: linear-gradient(180deg, #fff4f4, #ffd6d6) !important; }
+
+
+.colony-settings-body { display: grid; gap: 0; }
+.colony-setting-section { padding: 10px; }
+.colony-setting-section + .colony-setting-section { border-top: 1px solid rgba(118,92,61,.12); }
+.colony-setting-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
+.colony-setting-section-head strong { font-size: 15px; }
+.colony-setting-section-head small { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 500; }
+
+.colony-setting-fold {
+ margin: 8px 0 4px;
+ border: 1px solid rgba(118,92,61,.16);
+ border-radius: 14px;
+ background: rgba(255,251,244,.56);
+ overflow: hidden;
+}
+.colony-setting-fold > summary {
+ min-height: 38px;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 11px;
+ color: rgba(68,55,41,.84);
+ font-size: 12px;
+ font-weight: 700;
cursor: pointer;
+ list-style: none;
user-select: none;
}
-.ground-stat[data-ground-toggle]:focus-visible,
-.ground-type-btn:focus-visible {
- outline: 2px solid rgba(103,178,44,0.58);
- outline-offset: 2px;
+.colony-setting-fold > summary::-webkit-details-marker { display: none; }
+.colony-setting-fold > summary::before { content: "\25b8"; color: var(--muted); width: 12px; }
+.colony-setting-fold[open] > summary::before { content: "\25be"; }
+.colony-setting-fold > summary strong { margin-left: auto; font-size: 15px; }
+.colony-setting-fold > summary small { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 500; }
+.colony-setting-fold[open] > summary { border-bottom: 1px solid rgba(118,92,61,.12); }
+.colony-setting-fold .temperature-control,
+.colony-setting-fold .colony-limit-control {
+ margin: 0;
+ border: 0;
+ border-radius: 0;
+ background: transparent;
}
-/* v36: pin only the operation tool category under the quick-scroll tabs. */
+.colony-setting-fold .temperature-control { display: grid; gap: 5px; }
+.colony-setting-fold .temperature-auto { margin-left: 0; justify-self: end; }
+
+/* v39.16.40: one unified colony settings fold. */
+.colony-settings-fold .temperature-control,
+.colony-settings-fold .colony-limit-control { padding: 0; border: 0; border-radius: 0; background: transparent; }
+
+
+/* v39.16.40: restore the compact sticky operation palette from the earlier UI. */
.tool-category[data-tool-category="operate"]:not(.collapsed) {
position: sticky;
top: 58px;
z-index: 11;
overflow: hidden;
- background: linear-gradient(180deg, rgba(238, 247, 255, 0.98), rgba(221, 237, 255, 0.98));
- border: 3px solid rgba(52,112,188,0.72);
- box-shadow: 0 9px 22px rgba(58, 82, 112, 0.18), inset 0 0 0 1px rgba(255,255,255,0.86);
+ background: linear-gradient(180deg, rgba(238,247,255,.98), rgba(221,237,255,.98));
+ border: 3px solid rgba(52,112,188,.72);
+ box-shadow: 0 9px 22px rgba(58,82,112,.18), inset 0 0 0 1px rgba(255,255,255,.86);
}
.tool-category[data-tool-category="operate"] .tool-category-toggle {
- background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(231, 243, 255, 0.98));
- border-bottom-color: rgba(82,128,190,0.30);
+ background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(231,243,255,.98));
+ border-bottom-color: rgba(82,128,190,.30);
}
.tool-category[data-tool-category="operate"] .tool-category-body {
- grid-template-columns: repeat(6, minmax(0, 1fr));
+ grid-template-columns: repeat(6, minmax(0,1fr));
gap: 5px;
- background: rgba(238, 247, 255, 0.98);
+ background: rgba(238,247,255,.98);
}
.tool-category[data-tool-category="operate"] .tool {
grid-template-columns: 1fr;
@@ -774,112 +790,454 @@
justify-items: center;
align-items: center;
text-align: center;
- background: rgba(255,255,255,0.96);
- border-color: rgba(82,128,190,0.28);
-}
-.tool-category[data-tool-category="operate"] .tool-label {
- display: none;
+ background: rgba(255,255,255,.96);
+ border-color: rgba(82,128,190,.28);
}
+.tool-category[data-tool-category="operate"] .tool-label { display: none; }
.tool-category[data-tool-category="operate"] .tool::before {
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%) scale(var(--tool-icon-zoom, 1));
+ left: 50%; top: 50%; transform: translate(-50%,-50%) scale(var(--tool-icon-zoom,1));
}
.tool-category[data-tool-category="operate"] .tool-sprite-preview {
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
+ left: 50%; top: 50%; transform: translate(-50%,-50%);
}
.tool-category[data-tool-category="operate"] .tool-shortcut {
+ position: absolute; right: 3px; bottom: 2px; min-width: 13px; height: 13px;
+ box-sizing: border-box; padding: 0 3px; border: 1px solid rgba(82,128,190,.26);
+ border-radius: 5px; background: rgba(255,255,255,.88); color: rgba(48,74,112,.86);
+ font: 700 9px/12px system-ui,sans-serif; text-align: center; pointer-events: none;
+}
+
+/* A trash can inside a selection square for range delete. */
+.tool[data-tool="area_delete"].tool-emoji-icon::before {
+ content: "";
+ box-sizing: border-box;
+ width: 30px;
+ height: 30px;
+ border: 2.5px solid #a8444d;
+ border-radius: 4px;
+ background: rgba(255,255,255,.40);
+ filter: none;
+}
+.tool[data-tool="area_delete"].tool-emoji-icon::after {
+ content: "";
+ display: block;
position: absolute;
- right: 3px;
- bottom: 2px;
- min-width: 13px;
+ left: 50%;
+ top: 52%;
+ width: 11px;
height: 13px;
box-sizing: border-box;
- padding: 0 3px;
- border: 1px solid rgba(82,128,190,0.26);
- border-radius: 5px;
- background: rgba(255,255,255,0.88);
- color: rgba(48,74,112,0.86);
- font: 700 9px/12px system-ui, sans-serif;
- text-align: center;
+ transform: translate(-50%,-50%);
+ border: 2px solid #a8444d;
+ border-top-width: 3px;
+ border-radius: 1px 1px 3px 3px;
+ background: repeating-linear-gradient(90deg, transparent 0 2px, rgba(168,68,77,.75) 2px 3px, transparent 3px 5px);
+ box-shadow: 0 -5px 0 -3px #a8444d;
+ z-index: 3;
pointer-events: none;
}
-/* Collapsed event card must shrink to its header.
- layout.css gives .log-card a min-height, which left a large blank panel when folded. */
-.log-card.collapsed { min-height: 0 !important; height: auto !important; flex: 0 0 auto !important; flex-basis: auto !important; }
-.log-card.collapsed .panel-card-body { display: none !important; }
-
-
-.temperature-control {
- margin: 10px 0 2px;
- padding: 10px 11px 11px;
- border: 1px solid rgba(118, 92, 61, 0.16);
- border-radius: 14px;
- background: rgba(255, 251, 244, 0.56);
+.tool-category[data-tool-category="operate"] .tool[data-tool="area_delete"].tool-emoji-icon::before {
+ top: 50% !important;
+ transform: translate(-50%,-50%) !important;
}
-.temperature-control-head {
+
+/* Colony settings use the colony card's own button palette. */
+.colony-card .colony-setting-fold {
+ border-color: var(--ui-theme-mid);
+ background: var(--ui-theme-soft);
+}
+.colony-card .colony-setting-fold > summary {
+ border-color: var(--ui-theme-mid);
+ background: linear-gradient(180deg, rgba(255,255,255,.78), var(--ui-theme-soft-2));
+ color: var(--ink);
+}
+.colony-card .colony-setting-fold[open] > summary { border-bottom-color: var(--ui-theme-mid); }
+.colony-card .colony-setting-section + .colony-setting-section { border-top-color: rgba(var(--ui-theme-rgb),.22); }
+.colony-stats { grid-template-columns: 1fr; }
+.ground-type-btn.colony-setting-action {
+ width: 100%;
+ min-height: 38px;
display: flex;
align-items: center;
- gap: 8px;
- font-size: 12px;
- color: rgba(68, 55, 41, 0.84);
+ justify-content: space-between;
+ gap: 10px;
+ padding: 7px 10px;
+ border: 1px solid var(--ui-theme-mid);
+ border-radius: 11px;
+ background: linear-gradient(180deg, rgba(255,255,255,.76), var(--ui-theme-soft-2));
+ color: var(--ink);
+ cursor: pointer;
+ font: inherit;
}
-.temperature-control-head strong {
- margin-left: auto;
- font-size: 15px;
+.ground-type-btn.colony-setting-action:hover { background: rgba(var(--ui-theme-rgb),.16); }
+.ground-type-btn.colony-setting-action strong { font-size: 15px; }
+.ground-type-btn.colony-setting-action span { color: var(--muted); font-size: 11px; font-weight: 700; }
+
+/* Shared panel-search primitives. */
+.panel-search-control {
+ grid-column: 1 / -1;
+ display: grid;
+ grid-template-columns: minmax(0,1fr) auto 32px;
+ align-items: center;
+ gap: 5px;
+ margin-top: 2px;
+ padding-top: 6px;
+ border-top: 1px solid rgba(82,128,190,.20);
}
-.temperature-auto {
- display: inline-flex;
+.panel-search-input {
+ width: 100%; min-width: 0; height: 32px; box-sizing: border-box;
+ padding: 6px 8px; border: 1px solid rgba(82,128,190,.34); border-radius: 9px;
+ background: rgba(255,255,255,.94); color: var(--ink); font: 12px/1.2 var(--font,sans-serif);
+}
+.panel-search-input:focus { outline: 2px solid rgba(40,112,180,.28); border-color: rgba(40,112,180,.58); }
+.panel-search-status { min-width: 23px; color: rgba(48,74,112,.86); font: 700 10px/1 system-ui,sans-serif; text-align: center; }
+.panel-search-next {
+ width: 32px; height: 32px; padding: 0; border: 1px solid rgba(82,128,190,.34); border-radius: 9px;
+ background: rgba(255,255,255,.94); color: #315f91; font: 800 17px/1 system-ui,sans-serif; cursor: pointer;
+}
+.panel-search-next:disabled { opacity: .36; cursor: default; }
+.panel-search-match {
+ position: relative;
+ outline: 3px solid rgba(255,190,38,.72) !important;
+ outline-offset: 1px;
+ background-color: rgba(255,235,135,.62) !important;
+ scroll-margin-block: 150px 80px;
+}
+.panel-search-current {
+ outline-color: rgba(225,91,38,.92) !important;
+ box-shadow: 0 0 0 4px rgba(255,160,70,.22) !important;
+}
+
+/* v39.16.40: header search uses partial matching and bidirectional navigation. */
+.top-panel-search {
+ flex: 0 1 270px;
+ width: clamp(190px, 21vw, 270px);
+ min-width: 190px;
+ display: grid;
+ grid-template-columns: minmax(92px, 1fr) auto 30px 30px;
align-items: center;
gap: 4px;
- margin-left: 4px;
+ margin: 0 2px 0 0;
+ padding: 0;
+ border: 0;
+}
+.top-panel-search .panel-search-input { height: 36px; }
+.panel-search-prev,
+.panel-search-next {
+ width: 30px;
+ height: 32px;
+ padding: 0;
+ border: 1px solid rgba(82,128,190,.34);
+ border-radius: 9px;
+ background: rgba(255,255,255,.94);
+ color: #315f91;
+ font: 800 16px/1 system-ui,sans-serif;
+ cursor: pointer;
+}
+.panel-search-prev:disabled,
+.panel-search-next:disabled { opacity: .36; cursor: default; }
+
+/* Match the expanded colony settings surface to the colony graph surface. */
+.colony-card .colony-setting-fold[open] {
+ background: linear-gradient(180deg, rgba(255,255,255,0.70), rgba(246,240,228,0.54));
+}
+
+
+/* Shared in-game confirmations */
+.game-confirm-dialog { z-index: 16000; }
+.game-confirm-panel { width: min(460px, 100%); }
+.game-confirm-message { white-space: pre-line; }
+.game-confirm-actions { justify-content: flex-end; }
+.game-confirm-actions .btn { width: auto; }
+
+/* Achievements */
+.achievement-top-btn {
+ border-color: rgba(177, 132, 38, .38);
+ color: #72521a;
+ background: linear-gradient(180deg, rgba(255, 251, 224, .96), rgba(247, 229, 153, .88));
+ font-weight: 800;
+}
+.achievement-top-btn.complete {
+ border-color: rgba(105, 158, 63, .44);
+ color: #456729;
+ background: linear-gradient(180deg, rgba(245, 255, 229, .98), rgba(213, 239, 173, .92));
+}
+.achievement-dialog-panel { width: min(720px, 100%); }
+.achievement-dialog-head {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 14px;
+}
+.achievement-dialog-head h2 { margin-bottom: 5px; }
+.achievement-dialog-kicker {
+ margin-bottom: 3px;
+ color: var(--muted);
+ font-size: 10px;
+ font-weight: 800;
+ letter-spacing: .08em;
+}
+.achievement-close-icon {
+ width: 34px;
+ height: 34px;
+ border: 1px solid rgba(84, 68, 48, .16);
+ border-radius: 999px;
+ background: rgba(255, 255, 255, .76);
+ color: var(--ink);
+ font-size: 22px;
+ line-height: 1;
+ cursor: pointer;
+}
+.achievement-shared-status {
+ margin: 10px 0;
+ padding: 8px 10px;
+ border: 1px solid rgba(104, 86, 61, .12);
+ border-radius: 10px;
+ background: rgba(241, 235, 222, .54);
+ color: var(--muted);
+ font-size: 11px;
+}
+.achievement-list { display: grid; gap: 10px; }
+.achievement-group {
+ overflow: hidden;
+ border: 1px solid rgba(105, 87, 60, .15);
+ border-radius: 13px;
+ background: rgba(247, 243, 234, .72);
+}
+.achievement-group-summary {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ padding: 10px 12px;
+ color: #554b3e;
+ cursor: pointer;
+ list-style: none;
user-select: none;
}
-.temperature-slider {
- width: 100%;
- margin-top: 8px;
+.achievement-group-summary::-webkit-details-marker { display: none; }
+.achievement-group-summary::before {
+ content: "\25b6";
+ flex: 0 0 auto;
+ color: #8b7657;
+ font-size: 10px;
+ transition: transform .16s ease;
}
-.temperature-slider:disabled {
- opacity: 0.52;
+.achievement-group[open] > .achievement-group-summary::before { transform: rotate(90deg); }
+.achievement-group-summary strong { margin-right: auto; font-size: 13px; }
+.achievement-group-count {
+ color: var(--muted);
+ font-size: 10px;
+ font-weight: 800;
+ font-variant-numeric: tabular-nums;
}
-
-.colony-limit-control {
- margin: 8px 0 4px;
- padding: 10px 11px;
- border: 1px solid rgba(118, 92, 61, 0.16);
- border-radius: 14px;
- background: rgba(255, 251, 244, 0.56);
+.achievement-group-body {
+ display: grid;
+ gap: 9px;
+ padding: 0 9px 9px;
}
-.colony-limit-head {
+.achievement-group-empty {
+ margin: 0;
+ padding: 12px;
+ border-radius: 10px;
+ background: rgba(255, 255, 255, .58);
+ color: var(--muted);
+ font-size: 11px;
+}
+.achievement-entry {
+ --achievement-rate: 0%;
+ position: relative;
+ isolation: isolate;
+ overflow: hidden;
+ display: grid;
+ grid-template-columns: 42px minmax(0, 1fr);
+ gap: 10px;
+ align-items: center;
+ min-height: 62px;
+ padding: 9px 11px;
+ border: 1px solid rgba(105, 87, 60, .15);
+ border-radius: 13px;
+ background: linear-gradient(180deg, rgba(255, 255, 255, .88), rgba(244, 238, 226, .78));
+ cursor: default;
+}
+.achievement-entry:focus-visible {
+ outline: 2px solid rgba(85, 119, 149, .58);
+ outline-offset: 2px;
+}
+.achievement-entry::before {
+ content: "";
+ position: absolute;
+ z-index: 0;
+ inset: 0 auto 0 0;
+ pointer-events: none;
+ width: var(--achievement-rate);
+ background: linear-gradient(90deg, rgba(129, 158, 188, .27), rgba(156, 184, 207, .17));
+ border-right: 1px solid rgba(85, 119, 149, .20);
+ transition: width .32s ease;
+}
+.achievement-entry > * {
+ position: relative;
+ z-index: 1;
+}
+.achievement-entry.unlocked {
+ border-color: rgba(173, 129, 35, .38);
+ background: linear-gradient(180deg, rgba(255, 253, 235, .96), rgba(248, 231, 163, .70));
+}
+.achievement-entry.unlocked::before {
+ background: linear-gradient(90deg, rgba(229, 179, 51, .34), rgba(244, 211, 102, .22));
+ border-right-color: rgba(173, 129, 35, .28);
+}
+.achievement-entry-icon {
+ width: 38px;
+ height: 38px;
+ display: grid;
+ place-items: center;
+ border-radius: 11px;
+ background: rgba(106, 91, 68, .09);
+ color: #8b7657;
+ font-size: 22px;
+}
+.achievement-entry.unlocked .achievement-entry-icon {
+ background: rgba(242, 196, 74, .22);
+ color: #b67b13;
+}
+.achievement-entry-copy { min-width: 0; }
+.achievement-entry-heading {
display: flex;
align-items: baseline;
+ gap: 9px;
+ min-width: 0;
+}
+.achievement-entry-copy strong {
+ flex: 0 0 auto;
+ display: block;
+ font-size: 14px;
+ line-height: 1.35;
+}
+.achievement-entry-description {
+ min-width: 0;
+ color: #665d50;
+ font-size: 11px;
+ line-height: 1.45;
+}
+.achievement-entry.locked .achievement-entry-description {
+ color: #8b8378;
+ font-style: italic;
+}
+.achievement-entry-progress {
+ margin-top: 4px;
+ color: #526b82;
+ font-size: 10px;
+ font-weight: 500;
+ font-variant-numeric: tabular-nums;
+}
+.achievement-entry-meta {
+ display: flex;
justify-content: space-between;
- gap: 8px;
- color: rgba(68, 55, 41, 0.84);
- font-size: 12px;
+ flex-wrap: wrap;
+ gap: 6px 12px;
+ margin-top: 5px;
+ color: var(--muted);
+ font-size: 10px;
+ font-weight: 700;
}
-.colony-limit-head small { color: var(--muted); font-size: 10px; }
-.colony-limit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 8px; }
-.colony-limit-row { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 5px 7px; align-items: center; min-width: 0; font-size: 11px; color: var(--muted); }
-.colony-limit-row span { grid-column: 1 / -1; min-width: 0; }
-.colony-limit-slider { width: 100%; min-width: 0; accent-color: rgba(84, 138, 72, 0.92); }
-.colony-limit-number { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid rgba(100, 78, 52, 0.22); border-radius: 8px; padding: 5px 6px; background: rgba(255,255,255,0.78); color: var(--ink); font: inherit; text-align: right; }
-.colony-limit-status { margin-top: 7px; color: rgba(68, 55, 41, 0.78); font-size: 10px; line-height: 1.35; }
+.achievement-entry-percentage {
+ flex: 0 0 auto;
+ margin-left: auto;
+ color: #5d6570;
+ font-variant-numeric: tabular-nums;
+}
+@media (max-width: 620px) {
+ .achievement-entry-heading { display: block; }
+ .achievement-entry-description { display: block; margin-top: 2px; }
+}
+.achievement-dialog-actions { justify-content: flex-end; flex-wrap: wrap; }
+.achievement-dialog-actions .btn { width: auto; }
+.achievement-dialog-actions .achievement-reset-btn { margin-right: auto; }
+.achievement-toast {
+ position: fixed;
+ top: 18px;
+ left: 18px;
+ right: auto;
+ z-index: 14000;
+ width: min(360px, calc(100vw - 36px));
+ display: grid;
+ grid-template-columns: 44px minmax(0, 1fr);
+ gap: 10px;
+ align-items: center;
+ padding: 11px 13px;
+ border: 1px solid rgba(184, 137, 37, .42);
+ border-radius: 14px;
+ background: rgba(255, 249, 220, .97);
+ color: #57401d;
+ box-shadow: 0 16px 44px rgba(45, 34, 20, .24);
+ transform-origin: center;
+ transition: opacity .18s ease, transform .18s ease, filter .18s ease, visibility .18s ease;
+}
+.achievement-toast.absorbing {
+ opacity: 0;
+ transform: translate(var(--achievement-toast-dx, 0px), var(--achievement-toast-dy, 0px)) scale(.08);
+ filter: blur(2px) saturate(1.4);
+ border-radius: 999px;
+ pointer-events: none;
+ transition: opacity .72s ease-in, transform .72s cubic-bezier(.55, .02, .86, .3), filter .72s ease-in, border-radius .72s ease-in;
+}
+.achievement-top-btn.achievement-absorb-target {
+ animation: achievement-target-pulse .22s ease-out .54s both;
+}
+@keyframes achievement-target-pulse {
+ 0% { transform: scale(1); }
+ 45% { transform: scale(1.09); }
+ 100% { transform: scale(1); }
+}
+.achievement-toast.hidden {
+ opacity: 0;
+ visibility: hidden;
+ pointer-events: none;
+ transform: translateY(-10px);
+}
+.achievement-toast-icon {
+ width: 40px;
+ height: 40px;
+ display: grid;
+ place-items: center;
+ border-radius: 12px;
+ background: #efc34c;
+ color: #fff8d8;
+ font-size: 24px;
+}
+.achievement-toast-copy { min-width: 0; }
+.achievement-toast-copy small { display: block; margin-bottom: 2px; color: #8a6b2c; font-size: 10px; font-weight: 800; }
+.achievement-toast-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
+.achievement-toast-condition { display: block; margin-top: 3px; max-width: 360px; color: #6f6248; font-size: 11px; line-height: 1.35; white-space: normal; }
+@media (max-width: 980px) {
+ .achievement-toast {
+ top: calc(env(safe-area-inset-top, 0px) + 10px);
+ left: 12px;
+ right: auto;
+ width: min(360px, calc(100vw - 24px));
+ }
+ .achievement-dialog-actions { flex-direction: column-reverse; }
+ .achievement-dialog-actions .btn { width: 100%; }
+}
-/* v39.15.131: keep the folded tool card usable when other right-side cards are expanded. */
-.tool-card.collapsed {
- min-height: 64px !important;
- height: auto !important;
- flex: 0 0 auto !important;
- flex-basis: auto !important;
- overflow: visible !important;
+@media (prefers-reduced-motion: reduce) {
+ .achievement-toast.absorbing { transition-duration: .12s; }
+ .achievement-top-btn.achievement-absorb-target { animation: none; }
}
-.tool-card.collapsed .panel-card-toggle {
- min-height: 46px;
-}
-.tool-card.collapsed .panel-card-body {
- display: none !important;
+
+/* v39.16.56: keep the upper-limit heading on one line in the compact panel. */
+.colony-limit-section .colony-setting-section-head > span { font-size: 10.8px; white-space: nowrap; }
+.colony-limit-section .colony-setting-section-head > small { font-size: 9px; white-space: nowrap; }
+
+/* v39.16.60: align both upper-limit sliders independently of label length. */
+.colony-limit-grid { display: grid; gap: 7px; }
+.colony-limit-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) 58px; align-items: center; gap: 8px; min-width: 0; }
+.colony-limit-row > span { min-width: 0; font-size: 11px; font-weight: 700; white-space: nowrap; }
+.colony-limit-slider { width: 100%; min-width: 0; margin: 0; }
+.colony-limit-number { width: 58px; min-width: 0; box-sizing: border-box; }
+@media (max-width: 520px) {
+ .colony-limit-row { grid-template-columns: 72px minmax(0, 1fr) 54px; gap: 6px; }
+ .colony-limit-number { width: 54px; }
}
diff --git a/css/layout.css b/css/layout.css
index 6515c70..18545dc 100644
--- a/css/layout.css
+++ b/css/layout.css
@@ -23,13 +23,13 @@
.tool[data-tool="undo"].tool-emoji-icon::before,
.tool[data-tool="redo"].tool-emoji-icon::before { font-size: 29px; font-family: var(--font, sans-serif); }
.tool[data-tool="delete"] { --tool-icon-zoom: 1.42; }
-.tool[data-tool="area_delete"] { --tool-icon-zoom: 1.20; }
+.tool[data-tool="area_delete"] { --tool-icon-zoom: 1; }
.tool[data-tool="pinch"].tool-emoji-icon::before { font-size: 22px; }
.tool[data-tool="area_delete"].tool-emoji-icon::before {
font-size: 31px;
line-height: 1;
- color: #5d7fb9;
- text-shadow: 0 1px 0 rgba(255,255,255,0.65), 0 2px 5px rgba(146,54,62,0.16);
+ color: #b14f58;
+ text-shadow: 0 1px 0 rgba(255,255,255,0.75), 0 2px 5px rgba(146,54,62,0.14);
filter: none;
transform: translateY(-54%) scale(var(--tool-icon-zoom, 1));
}
@@ -114,16 +114,17 @@
position: absolute;
right: 4px;
bottom: 3px;
- min-width: 16px;
+ min-width: 22px;
padding: 1px 4px;
border-radius: 999px;
background: rgba(42,36,29,0.72);
color: #fff;
- font-size: 8.5px;
+ font-size: 9.5px;
line-height: 1;
text-align: center;
box-shadow: 0 1px 4px rgba(42,36,29,0.16);
- pointer-events: none;
+ pointer-events: auto;
+ cursor: pointer;
}
.chart-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 3px 0 8px; }
.chart-tabs button { border: 1px solid var(--line); background: rgba(255,255,255,0.62); border-radius: 999px; padding: 5px 4px; font-size: 11px; cursor: pointer; }
@@ -307,3 +308,42 @@ meter {
@media (min-width: 921px) {
.mobile-mode-controls { display: none !important; }
}
+
+
+
+.tool-pick-mode-control.tool-emoji-icon::before {
+ opacity: 0.18;
+ color: #3b78a0;
+ font-size: 29px;
+ filter: none;
+}
+
+.tool-pick-mode-control {
+ --tool-icon-zoom: 1;
+ background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(235,246,255,0.88));
+ border-color: rgba(48,126,176,0.34);
+}
+.tool-pick-mode-control .tool-pick-mode-value {
+ position: absolute;
+ left: 50%;
+ right: auto;
+ bottom: 5px;
+ transform: translateX(-50%);
+ min-width: 38px;
+ padding: 3px 6px;
+ border-radius: 999px;
+ z-index: 4;
+ background: rgba(25,85,128,0.94);
+ color: #fff;
+ font-size: 8.5px;
+ line-height: 1;
+ text-align: center;
+ box-shadow: 0 1px 4px rgba(25,85,128,0.18);
+}
+.tool-pick-mode-control[data-pick-mode="grid20"],
+.tool-pick-mode-control[data-pick-mode="grid40"],
+.tool-pick-mode-control[data-pick-mode="grid60"] {
+ background: linear-gradient(180deg, #ffffff, #eaf7ff);
+ border-color: rgba(38,132,190,0.56);
+ box-shadow: inset 0 0 0 1px rgba(84,176,226,0.20), 0 8px 20px rgba(59,133,177,0.10);
+}
diff --git a/css/mobile.css b/css/mobile.css
index ca86dcc..fa953da 100644
--- a/css/mobile.css
+++ b/css/mobile.css
@@ -397,3 +397,35 @@ body.touch-mobile-ui.mobile-mode-tool #gameCanvas { cursor: crosshair; }
right: max(10px, env(safe-area-inset-right, 0px));
}
}
+
+/* v39.16.40: selected tool descriptions appear at the top on touch devices. */
+body.touch-mobile-ui .tool-tip-popover.mobile-selection-tip {
+ top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
+ left: 50% !important;
+ transform: translateX(-50%);
+ width: min(680px, calc(100vw - 18px));
+ max-width: calc(100vw - 18px);
+ padding: 10px 12px;
+ border-radius: 12px;
+ background: rgba(46,38,30,.90);
+ font-size: 12px;
+ line-height: 1.45;
+ text-align: left;
+}
+@media (max-width: 980px) {
+ .top-actions { overflow: visible; }
+ .top-menu { flex: 0 0 auto; }
+ .top-menu-panel { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 58px); right: max(10px, env(safe-area-inset-right, 0px)); }
+}
+
+@media (max-width: 980px) {
+ .top-panel-search {
+ flex: 0 0 220px;
+ width: 220px;
+ min-width: 220px;
+ }
+ .top-panel-search .panel-search-input { height: 34px; }
+}
+@media (max-width: 980px) {
+ .top-actions { overflow-x: auto; overflow-y: hidden; }
+}
diff --git a/css/panel.css b/css/panel.css
index a77d799..766acea 100644
--- a/css/panel.css
+++ b/css/panel.css
@@ -344,23 +344,35 @@ body::before {
color: var(--muted);
line-height: 1.25;
}
-.colony-chart-legend span {
+.colony-chart-legend .chart-series-toggle {
+ appearance: none;
display: inline-flex;
align-items: center;
gap: 4px;
+ min-width: 0;
+ margin: 0;
+ padding: 2px 4px;
+ border: 0;
+ border-radius: 6px;
+ background: transparent;
+ color: inherit;
+ font: inherit;
+ line-height: inherit;
white-space: nowrap;
+ cursor: pointer;
+ transition: opacity 120ms ease, background-color 120ms ease, transform 120ms ease;
}
-.colony-chart-legend i {
+.colony-chart-legend .chart-series-toggle:hover { background: rgba(255,255,255,0.56); }
+.colony-chart-legend .chart-series-toggle:focus-visible { outline: 2px solid rgba(103,178,44,0.58); outline-offset: 1px; }
+.colony-chart-legend .chart-series-toggle:active { transform: translateY(1px); }
+.colony-chart-legend .chart-series-toggle i {
width: 10px;
height: 10px;
+ flex: 0 0 10px;
border-radius: 999px;
display: inline-block;
box-shadow: 0 0 0 1px rgba(70, 52, 36, 0.10);
- cursor: pointer;
- transition: opacity 120ms ease, transform 120ms ease;
}
-.colony-chart-legend i:hover,
-.colony-chart-legend i:focus-visible { transform: scale(1.18); outline: none; }
.colony-chart-legend .series-hidden { opacity: 0.42; text-decoration: line-through; }
.colony-chart-legend .series-hidden i { background: transparent !important; box-shadow: inset 0 0 0 2px currentColor; }
diff --git a/index.html b/index.html
index 9144088..c00fce4 100644
--- a/index.html
+++ b/index.html
@@ -4,14 +4,14 @@
たりない観察
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -33,23 +33,46 @@
+
+
+ 0
+
+
+
-
-