/* Amenium（試作）— RPG のメニューの並び・明るい色（草色の地、生成りの窓、こげ茶の輪郭、ミントのボタン）
   窓・タブ・ボタン・コマ・色の粒・カーソル・アイコンは、ドット絵として描いた画像（../img/ui/、作るのは tools/ui.mjs）を
   border-image（9 分割）や背景で 2 倍に拡大して貼る。色の値は tools/ui.mjs の C と合わせる。 */
:root {
	--k: #5b4636;      /* 輪郭・文字（こげ茶） */
	--w: #fffdf5;      /* 白 */
	--n: #fff6e0;      /* 窓の地（生成り） */
	--d: #f3e6c9;      /* 窓より少し濃い */
	--l: #e6d4ad;      /* 線・乗せたときの地 */
	--y: #ffd75e;      /* 選んでいる色 */
	--acc: #2f9e77;    /* 選んでいるカテゴリの文字（濃いミント） */
	--note: #8a7360;   /* 説明の文字 */
	--page: #cfe8b0;   /* ページの地（草色）。デスクトップ版の作る画面・配信の設定の画面 */
	--sky: #a9defa;    /* Web の作る画面の地（空色） */
	/* 専用のカーソル（ドット絵。作るのは tools/ui.mjs）: ふつうの矢印と、押せるものの上の指さし */
	--cur: url(../img/ui/cur-arrow.png) 0 0, default;
	--cur-p: url(../img/ui/cur-hand.png) 9 0, pointer;
}

/* 画面の細かい端末では、4 画素の絵を使う */
@supports (cursor: image-set(url(a.png) 1x, url(b.png) 2x) 0 0, default) {
	:root {
		--cur: image-set(url(../img/ui/cur-arrow.png) 1x, url(../img/ui/cur-arrow-2x.png) 2x) 0 0, default;
		--cur-p: image-set(url(../img/ui/cur-hand.png) 1x, url(../img/ui/cur-hand-2x.png) 2x) 9 0, pointer;
	}
}

.px-body {
	cursor: var(--cur);
	margin: 0;
	background: var(--page) url(../img/ui/bg.png) 0 0 / 32px 32px;
	color: var(--k);
	font-family: 'DotGothic16', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
	-webkit-text-size-adjust: 100%;
}

/* Web の作る画面: 草色の代わりに、うすい空色の空と、ゆっくり流れる雲（下の地面が「地面」に見えるように。ユーザー 2026-11-24）。
   デスクトップ版の作る画面は地面を出さないので、草色のまま */
.px-make:not(.px-is-app) { background: var(--sky); }
/* 空は 1 色（光のすじ・色の帯のグラデーションは、背景に目が行きすぎるのでやめた。ユーザー 2026-11-24）。地面のすぐ後ろに、遠くの山なみ hills.png。その手前を、雲 clouds.png（::before）が流れる */
.px-make:not(.px-is-app)::after {
	content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
	background: url(../img/ui/hills.png) 0 100% / 960px 180px repeat-x;
	image-rendering: pixelated; image-rendering: crisp-edges;
}
.px-make:not(.px-is-app)::before {
	content: ""; position: fixed; left: 0; top: 24px; width: calc(100% + 720px); height: 200px; z-index: -1; pointer-events: none;
	background: url(../img/ui/clouds.png) 0 0 / 720px 200px repeat-x;
	image-rendering: pixelated; image-rendering: crisp-edges;
	animation: px-clouds 240s steps(360) infinite;
}
@keyframes px-clouds { to { transform: translateX(-720px); } }
@media (prefers-reduced-motion: reduce) { .px-make:not(.px-is-app)::before { animation: none; } }
/* 空の時間: 見ている人の時刻で、朝・昼・夕方・夜に変わる（body の data-sky は、ページの頭の script が決める。昼は上の決まりのまま）。
   変えるのは、空の色と、雲・山なみ・地面の絵だけ。本体・窓・キャラの色は変えない（色を見ながら作る画面なので） */
.px-make[data-sky="morning"]:not(.px-is-app) { --sky: #ffe6d8; }
.px-make[data-sky="evening"]:not(.px-is-app) { --sky: #ffb98a; }
.px-make[data-sky="night"]:not(.px-is-app) { --sky: #2f3e78; }
.px-make[data-sky="morning"]:not(.px-is-app)::before { background-image: url(../img/ui/clouds-morning.png); }
.px-make[data-sky="evening"]:not(.px-is-app)::before { background-image: url(../img/ui/clouds-evening.png); }
.px-make[data-sky="night"]:not(.px-is-app)::before { background-image: url(../img/ui/clouds-night.png); }
.px-make[data-sky="morning"]:not(.px-is-app)::after { background-image: url(../img/ui/hills-morning.png); }
.px-make[data-sky="evening"]:not(.px-is-app)::after { background-image: url(../img/ui/hills-evening.png); }
/* 夜は、山なみの後ろに、月と星 */
.px-make[data-sky="night"]:not(.px-is-app)::after {
	background:
		url(../img/ui/hills-night.png) 0 100% / 960px 180px repeat-x,
		url(../img/ui/moon.png) right 9% top 150px / 32px 32px no-repeat,
		url(../img/ui/stars.png) 0 0 / 480px 360px repeat;
}
.px-make[data-sky="morning"] .px-parade { background-image: url(../img/ui/ground-morning.png); }
.px-make[data-sky="evening"] .px-parade { background-image: url(../img/ui/ground-evening.png); }
.px-make[data-sky="night"] .px-parade { background-image: url(../img/ui/ground-night.png); }

/* よみこみ中（作る画面を開いてすぐ、app.js が動き出すまで）: 画面をページの地の色でおおって、まん中の小さな窓の中で空が歩く。
   ページにはじめから書いてあって、CSS だけで動く（app.js が最後に消す）。すぐ開けたときにちらつかないように、窓は少し遅れて出す。
   長くかかっているとき（12 秒）は、よみこみなおしの案内を出す */
.px-loading { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: var(--sky); cursor: var(--cur); }
.px-is-app .px-loading { background: var(--page); }
.px-loading-win {
	width: 220px; max-width: calc(100vw - 32px); text-align: center; border: 16px solid transparent; border-image: url(../img/ui/win.png) 8 fill / 16px; padding: 2px 4px 6px;
	image-rendering: pixelated; image-rendering: crisp-edges; opacity: 0; animation: px-loading-in .15s .35s forwards;
}
.px-loading-chara { width: 120px; height: 120px; margin: 0 auto; background: url(../img/loading.png) 0 0 / 960px 120px no-repeat; image-rendering: pixelated; image-rendering: crisp-edges; animation: px-loading-walk 1s steps(8) infinite; }
.px-loading-text { margin: 2px 0 0; font-size: 16px; line-height: 20px; color: var(--k); }
.px-loading-dots { display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; white-space: nowrap; text-align: left; animation: px-loading-dots 1.2s steps(4, jump-none) infinite; }
.px-loading-late { margin: 8px 0 0; font-size: 12px; line-height: 1.6; color: var(--note); opacity: 0; animation: px-loading-in .3s 12s forwards; }
@keyframes px-loading-in { to { opacity: 1; } }
@keyframes px-loading-walk { to { background-position: -960px 0; } }
@keyframes px-loading-dots { from { width: 0; } to { width: 1.5em; } }
@media (prefers-reduced-motion: reduce) { .px-loading-chara, .px-loading-dots { animation: none; } .px-loading-dots { width: auto; } }

.px {
	max-width: 1060px;
	margin: 0 auto;
	padding: 20px 16px 48px;
	box-sizing: border-box;
	font-size: 16px;
	line-height: 1.4;
}
.px *, .px *::before, .px *::after { box-sizing: border-box; }
/* ドット絵の画像を貼る部品は、にじませずに拡大する */
.px-left, .px-rwin, .px-save, .px-cap, .px-save-head, .px-btn, .px-chip, .px-group, .px-ctab, .px-scale button, .px-opt, .px-slot, .px-colors,
.px *::before, .px *::after {
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}

.px-title { text-align: center; margin: 4px 0 18px; }
.px-title h1 {
	margin: 0;
	font-size: 32px;
	letter-spacing: .1em;
	font-weight: 400;
	color: var(--k);
	text-shadow: 3px 3px 0 var(--w);
}
.px-title h1 small {
	display: inline-block;
	vertical-align: middle;
	margin-left: 6px;
	padding: 2px 8px;
	font-size: 16px;
	letter-spacing: 0;
	background: var(--y);
	color: var(--k);
	text-shadow: none;
}
.px-title p { margin: 8px 0 0; font-size: 16px; color: var(--note); }

/* PC: 左にキャラと保存、右にそうび（パーツ） / スマホ: キャラ → パーツ → 保存 */
.px-wrap {
	display: grid;
	grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	grid-template-areas: "stage parts" "save parts";
	gap: 12px;
	align-items: start;
}
.px-left { grid-area: stage; }
.px-right { grid-area: parts; }
.px-savebox { grid-area: save; }

/* 窓: こげ茶の輪郭・白い帯・生成りの地（win.png を 9 分割・2 倍） */
.px-left, .px-rwin, .px-save {
	border: 16px solid transparent;
	border-image: url(../img/ui/win.png) 8 fill / 16px;
	padding: 0 2px 4px;
}
/* 窓の見出しの帯（cap.png）。右に丸い粒のかざり */
.px-cap, .px-save-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	margin: -4px -2px 10px;
	min-height: 32px;
	border: 10px solid transparent;
	border-image: url(../img/ui/cap.png) 5 fill / 10px;
	padding: 0 4px;
	line-height: 16px;
	color: var(--k);
}
.px-cap::after {
	content: "";
	flex: none;
	width: 30px;
	height: 10px;
	background: url(../img/ui/capdeco.png) 0 0 / 30px 10px no-repeat;
}

/* キャラの画面（枠はキャンバスにぴったり。倍率は外側の幅から決める） */
.px-stage-box { display: flex; justify-content: center; align-items: center; }
/* ランダムで決まったときに、ぴょんとはねる（ドットらしく、段をつけて動かす） */
.px-stage-box.is-pop .px-stage canvas { animation: px-pop .28s steps(1, end); }
@keyframes px-pop { 0% { transform: translateY(-6px); } 35% { transform: translateY(-10px); } 60% { transform: translateY(-4px); } 80% { transform: translateY(2px); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .px-stage-box.is-pop .px-stage canvas { animation: none; } }

.px-stage {
	display: inline-block;
	overflow: hidden;
	line-height: 0;
	background: var(--d);
	background-clip: padding-box;
	border: 12px solid transparent;
	border-image: url(../img/ui/stage.png) 6 fill / 12px;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}
.px-stage canvas {
	display: block;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
	max-width: 100%;
	height: auto;
}

/* ボタン（btn.png を 9 分割・2 倍）: 丸みと厚みがあって、おすと 2 画素沈む。選んでいるものは黄 */
.px-btn, .px-chip, .px-ctab, .px-scale button {
	appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font: inherit;
	font-size: 16px;
	line-height: 16px;
	color: var(--k);
	background: none;
	border: 10px solid transparent;
	border-image: url(../img/ui/btn.png) 5 fill / 10px;
	padding: 0 4px 2px;
	cursor: var(--cur-p);
}
.px-btn:active, .px-chip:active, .px-ctab:active, .px-scale button:active { border-image-source: url(../img/ui/btn-down.png); transform: translateY(2px); }
.px-chip.is-on { border-image-source: url(../img/ui/btn-on.png); }
/* どれか 1 つを選ぶ切りかえ（色の組・ひだり/みぎ・大きさ）: 選んでいないものは白、選んでいるものは黄色で、押しこんだままの形（厚みなし・2 画素下）。緑と黄色が並ぶと、どちらが選んだ側か分かりにくいので */
.px-ctab, .px-scale button { border-image-source: url(../img/ui/btn-main.png); }
.px-ctab:active, .px-scale button:active { border-image-source: url(../img/ui/btn-main-down.png); }
.px-ctab.is-on, .px-scale button.is-on { border-image-source: url(../img/ui/btn-on-down.png); transform: translateY(2px); }
.px-btn-main { border-image-source: url(../img/ui/btn-main.png); }
.px-btn.is-on { border-image-source: url(../img/ui/btn-on.png); }
/* 外へのリンクは水色 */
.px-btn.px-btn-blue { border-image-source: url(../img/ui/btn-blue.png); }
/* 消すボタンは赤（押しまちがえないように） */
.px-btn.px-btn-red, #pxSlotDel { border-image-source: url(../img/ui/btn-red.png); color: var(--k); }
a.px-btn { text-decoration: none; }
.px-btn-sub { color: var(--note); }
.px-btn:disabled { opacity: .5; cursor: wait; }
.px-hist .px-btn:disabled, #pxSlotActs .px-btn:disabled { opacity: .35; cursor: var(--cur); }
.px-btn:focus-visible, .px-chip:focus-visible, .px-group:focus-visible, .px-ctab:focus-visible, .px-tab:focus-visible, .px-opt:focus-visible, .px-slot:focus-visible, .px-sw:focus-visible {
	outline: 2px solid var(--acc);
	outline-offset: 2px;
}
/* ボタンの絵（i-*.png、18px） */
.px-btn[id]::before {
	content: "";
	flex: none;
	width: 18px;
	height: 18px;
	background: 0 0 / 18px 18px no-repeat;
}
#pxMode::before { background-image: url(../img/ui/i-idle.png); }
#pxMode[data-mode="walk"]::before { background-image: url(../img/ui/i-walk.png); }
#pxMode[data-mode="stop"]::before { background-image: url(../img/ui/i-stop.png); }
#pxPlay[aria-pressed="true"]::before { background-image: url(../img/ui/i-play.png); }
#pxUndo::before { background-image: url(../img/ui/i-undo.png); }
#pxRedo::before { background-image: url(../img/ui/i-redo.png); }
#pxRandom::before { background-image: url(../img/ui/i-dice.png); }
#pxReset::before { background-image: url(../img/ui/i-reset.png); }
#pxPair::before { background-image: url(../img/ui/i-buddy.png); }
#pxGif::before { background-image: url(../img/ui/i-gif.png); }
#pxPng::before { background-image: url(../img/ui/i-png.png); }
#pxIcon::before { background-image: url(../img/ui/i-icon.png); }
#pxShare::before, #pxShareGif::before { background-image: url(../img/ui/i-share.png); }
#pxSheet::before { background-image: url(../img/ui/i-sheet.png); }
#pxCodeOut::before { background-image: url(../img/ui/i-share.png); }
#pxCodeIn::before { background-image: url(../img/ui/i-load.png); }
#pxSlotLoad::before { background-image: url(../img/ui/i-load.png); }
#pxSlotBuddy::before { background-image: url(../img/ui/i-buddy.png); }
#pxSlotSave::before { background-image: url(../img/ui/i-over.png); }
#pxSlotWalk::before { background-image: url(../img/ui/i-walk.png); }
#pxSlotDel::before { background-image: url(../img/ui/i-del.png); }
#pxBack::before { background-image: url(../img/ui/i-back.png); }
#pxOpenOut::before { background-image: url(../img/ui/i-export.png); }
#pxOpenSlots::before { background-image: url(../img/ui/i-disk.png); }
#pxLinkSite::before { background-image: url(../img/ui/i-home.png); }
#pxLinkX::before, #pxLinkThreads::before, #pxLinkInsta::before { background-image: url(../img/ui/i-ext.png); }
#pxHowto::before { background-image: url(../img/ui/i-help.png); }
#pxCredit::before { background-image: url(../img/ui/i-info.png); }
#pxLang::before { background-image: url(../img/ui/i-lang.png); }
#pxRandSet::before { background-image: url(../img/ui/i-dice.png); }
#pxApp::before { background-image: url(../img/ui/i-walk.png); }
#pxGuideApp::before { background-image: url(../img/ui/i-walk.png); }
.px-guide-app { margin-top: 10px; }
/* ランダムのせってい（ダイアログの中）: まとまりごとのカテゴリのならび。長いので、中だけ送る */
.px-dlg-msg p { margin: 0 0 8px; }
.px-randset { max-height: min(46vh, 380px); overflow-y: auto; margin-bottom: 10px; padding-right: 4px; }
.px-randset-g { font-size: 13px; color: var(--note); margin: 6px 0 4px; }
.px-randset-row { display: flex; flex-wrap: wrap; gap: 6px; }
/* ここのボタンは入・切の切りかえなので、ほかの「選んでいる所は黄色」とは別: かけていないものは白、かぎをかけたものはミント＋かぎの絵 */
.px-randset .px-chip { font-size: 13px; gap: 4px; border-image-source: url(../img/ui/btn-main.png); }
.px-randset .px-chip.is-on { border-image-source: url(../img/ui/btn.png); }
.px-randset .px-chip:active { border-image-source: url(../img/ui/btn-down.png); }
.px-randset .px-chip::before { content: ""; flex: none; width: 18px; height: 18px; margin: -1px 0; background: url(../img/ui/i-unlock.png) 0 0 / 18px 18px no-repeat; opacity: .3; }
.px-randset .px-chip.is-on::before { background-image: url(../img/ui/i-lock.png); opacity: 1; }
#pxRandClear::before { display: none; }
/* 言語の一覧（メニューの「Language」を押したダイアログの中）。いまの言語は黄色 */
.px-langs { display: grid; gap: 8px; }
.px-langs .px-btn { justify-content: center; color: var(--k); }
#pxToStream::before { background-image: url(../img/ui/i-share.png); }
#pxOpenMenu::before { background-image: url(../img/ui/i-menu.png); }
#pxCloseOut::before, #pxCloseSlots::before, #pxCloseMenu::before { background-image: url(../img/ui/i-close.png); }
/* スマホだけのボタン（ほぞん・セーブを呼び出す／とじる）と、呼び出したときの後ろの幕 */
.px .px-only-sp, .px-sheet-bg, .px-savebox .px-save { display: none; }
/* メニューの窓（スマホだけ）: こまかいボタンを縦にならべる。中身は app.js の placeMenu が移してくる */
.px-menu { display: grid; gap: 8px; }
.px-menu .px-btn { justify-content: center; padding-top: 4px; padding-bottom: 6px; }
.px-menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* ほぞん・セーブ・メニューの窓は、ふだん出さずにボタンで呼び出す。PC は画面のまん中の窓、スマホは下から出る窓 */
.px-sheet-bg:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(91, 70, 54, .45); }
.px-savebox .px-save.is-open { display: block; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 440px; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); z-index: 30; }
.px-savebox .px-menubox.is-open { width: 340px; }
/* 窓の「とじる」は絵だけの小さなボタン */
.px-close { font-size: 0; gap: 0; border-width: 8px; border-image-width: 8px; padding: 0; margin: -6px -6px -6px 0; }
.px-dlg-msg ol, .px-dlg-msg ul { margin: 0; padding-left: 1.4em; }
.px-dlg-msg li + li { margin-top: 4px; }
.px-dlg-msg a { color: var(--acc); }
.px-dlg-msg small { font-size: 12px; color: var(--note); }

/* 確認のダイアログ（ブラウザの確認の窓の代わり。app.js の ask）: 画面のまん中に小さな窓 */
.px-dlg-bg:not([hidden]) { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(91, 70, 54, .45); }
.px-dlg { width: 100%; max-width: 340px; border: 16px solid transparent; border-image: url(../img/ui/win.png) 8 fill / 16px; padding: 0 2px 4px; image-rendering: pixelated; }
.px-dlg:focus { outline: none; }
.px-dlg-msg { margin: 4px 2px 14px; font-size: 16px; line-height: 1.6; }
.px-dlg-btns { justify-content: flex-end; }
/* キャラのコードを出す・入れる欄 */
.px-dlg-text { display: block; width: 100%; margin: 0 0 12px; padding: 6px; font: 12px/1.4 ui-monospace, Consolas, monospace; color: var(--k); background: var(--w); border: 2px solid var(--k); border-radius: 0; resize: none; word-break: break-all; }
.px-dlg-text[hidden] { display: none; }
.px-code { margin-top: 8px; }

/* アニメ切り替え・ボタンの行 */
.px-anims { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.px-row { display: flex; flex-wrap: wrap; gap: 6px; }
.px-row + .px-row { margin-top: 6px; }
.px-row[hidden], .px-btn[hidden] { display: none; }

.px-scale { display: inline-flex; gap: 2px; margin: -6px -6px -6px 0; }
.px-scale button { font-size: 12px; line-height: 12px; padding: 0; border-width: 8px; border-image-width: 8px; }
.px-note { margin: 8px 0 0; font-size: 12px; line-height: 1.6; color: var(--note); }
/* メニューのいちばん下の、サイトの名前とアドレス・コピーライト（画面を写した絵からでも、検索でたどれるように） */
.px-copy { text-align: center; }

/* セーブのわく（cell.png のコマ） */
.px-slots {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 4px;
	margin-bottom: 8px;
	align-items: start;
	/* アプリ版はわくが 100 個までふえるので、ここだけ送る */
	max-height: min(44vh, 320px);
	overflow-y: auto;
}
.px-slot-count { margin: 0 0 8px; }
/* わくは正方形。高さは幅から決める（下の余白 = 幅 − ふち。aspect-ratio と中の絵の高さ 100% の組み合わせは、
   iPhone で絵に合わせて縦に伸びた）。絵と「＋」は中に重ねて置き、わくの大きさには関わらせない */
.px-slot {
	appearance: none;
	position: relative;
	display: block;
	width: 100%;
	height: 0;
	box-sizing: content-box;
	width: calc(100% - 16px);
	padding: 0 0 calc(100% - 16px);
	line-height: 0;
	font: inherit;
	font-size: 16px;
	color: #c9b48a;
	background: none;
	border: 8px solid transparent;
	border-image: url(../img/ui/cell.png) 4 fill / 8px;
	cursor: var(--cur-p);
}
.px-slot canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; }
.px-slot:not(.is-full)::before { content: "＋"; position: absolute; left: 0; right: 0; top: 50%; line-height: 16px; margin-top: -8px; text-align: center; }
.px-slot.is-on { border-image-source: url(../img/ui/cell-on.png); }
/* デスクトップ版: 歩かせていない（おやすみの）キャラは、うすく見せる */
.px-slot.is-rest canvas { opacity: .4; }

/* そうびの窓: 左にまとまりのタブが飛び出す（選んでいるタブは窓の白い帯とつながる） */
.px-right { display: flex; align-items: flex-start; }
.px-rwin { flex: 1; min-width: 0; }
.px-groups { display: flex; flex-direction: column; gap: 4px; flex: none; width: 64px; padding-top: 20px; margin-right: -2px; position: relative; z-index: 1; }
.px-group {
	appearance: none;
	font: inherit;
	font-size: 12px;
	line-height: 14px;
	color: var(--note);
	background: none;
	border: 8px solid transparent;
	border-image: url(../img/ui/tab-l.png) 4 fill / 8px;
	padding: 2px 0;
	margin-left: 8px;
	cursor: var(--cur-p);
	white-space: nowrap;
}
.px-group.is-on { border-image-source: url(../img/ui/tab-l-on.png); margin-left: 0; color: var(--k); }
.px-group::before {
	content: "";
	display: block;
	width: 22px;
	height: 22px;
	margin: 0 auto 2px;
	background: center / 22px 22px no-repeat;
	opacity: .6;
}
.px-group.is-on::before { opacity: 1; }
.px-group[data-id="face"]::before { background-image: url(../img/ui/g-face.png); }
.px-group[data-id="hair"]::before { background-image: url(../img/ui/g-hair.png); }
.px-group[data-id="clothes"]::before { background-image: url(../img/ui/g-clothes.png); }
.px-group[data-id="items"]::before { background-image: url(../img/ui/g-items.png); }
.px-group[data-id="bg"]::before { background-image: url(../img/ui/g-bg.png); }

/* そうびの欄: 左にカテゴリのならび（▶ のカーソル）、右にパーツと色 */
.px-pick { display: grid; grid-template-columns: 146px minmax(0, 1fr); gap: 12px; align-items: start; }
.px-tabs { display: flex; flex-direction: column; gap: 0; padding-right: 8px; border-right: 2px dotted var(--l); }
.px-tab {
	appearance: none;
	position: relative;
	font: inherit;
	font-size: 16px;
	line-height: 20px;
	text-align: left;
	padding: 5px 4px 5px 22px;
	background: none;
	color: var(--k);
	border: 0;
	cursor: var(--cur-p);
	white-space: nowrap;
}
.px-tab:hover { background: var(--d); }
.px-tab.is-on { color: var(--acc); }
.px-tab.is-on::before {
	content: "";
	position: absolute;
	left: 4px;
	top: 8px;
	width: 14px;
	height: 14px;
	background: url(../img/ui/cursor.png) 0 0 / 14px 14px no-repeat;
	animation: px-cursor .8s steps(2, jump-none) infinite;
}
@keyframes px-cursor { to { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .px-tab.is-on::before { animation: none; } }

/* パーツ（cell.png のくぼんだコマ） */
.px-opts {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 4px;
}
.px-opt {
	appearance: none;
	padding: 0;
	background: none;
	border: 8px solid transparent;
	border-image: url(../img/ui/cell.png) 4 fill / 8px;
	cursor: var(--cur-p);
}
.px-opt canvas {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	object-fit: contain;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
	background: #faf3e3;
}
.px-opt.is-on { border-image-source: url(../img/ui/cell-on.png); }
.px-opt:hover { transform: translateY(-2px); }

/* 色: くぼんだトレイ（win-s.png）に、丸い粒をならべる */
.px-colors {
	margin-top: 10px;
	border: 12px solid transparent;
	border-image: url(../img/ui/win-s.png) 6 fill / 12px;
	padding: 0 0 2px;
}
.px-ctabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.px-ctabs:empty, .px-ctabs[hidden] { display: none; }
.px-side { flex: none; }
.px-ctab { font-size: 12px; line-height: 12px; border-width: 8px; border-image-width: 8px; padding: 0 2px; }
.px-ctab i { width: 12px; height: 12px; border: 2px solid var(--k); border-radius: 50%; }
.px-swatches {
	display: grid;
	grid-template-columns: repeat(auto-fill, 28px);
	gap: 6px;
}
/* 粒は、色の四角の上に輪の絵（sw.png。外がわはトレイの色）を重ねて丸く見せる */
.px-sw {
	appearance: none;
	position: relative;
	display: block;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	cursor: var(--cur-p);
}
.px-sw::after {
	content: "";
	position: absolute;
	inset: 0;
	background: url(../img/ui/sw.png) 0 0 / 28px 28px no-repeat;
	pointer-events: none;
}
.px-sw.is-on::after { background-image: url(../img/ui/sw-on.png); }
.px-sw:hover { transform: translateY(-2px); }
.px-sw-free { background: conic-gradient(#ff5f6d, #ffc371, #b6f36b, #4cc9f0, #7b5cd6, #ff6fa8, #ff5f6d); }
.px-sw-free input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: var(--cur-p);
	border: 0;
	padding: 0;
}
/* 元の色（描いたときの色のまま）: 粒のまん中に小さな印 */
.px-sw-orig::before {
	content: "";
	position: absolute;
	left: 10px;
	top: 10px;
	width: 8px;
	height: 8px;
	background: var(--w);
	border: 2px solid var(--k);
	z-index: 1;
}

/* 専用のスクロールバー（マウスで使う端末だけ。指で送る端末は、ふだん出ない標準のまま）: 点線のみぞと、ドットのつまみ（SVG） */
@media (hover: hover) and (pointer: fine) {
	.px ::-webkit-scrollbar { width: 12px; height: 12px; }
	.px ::-webkit-scrollbar-track { background: url(../img/ui/sb-track.svg) 0 0 / 12px 8px repeat-y; }
	.px ::-webkit-scrollbar-track:horizontal { background: url(../img/ui/sb-track-h.svg) 0 0 / 8px 12px repeat-x; }
	/* つまみは、上のはし・下のはし・のびるまん中の 3 枚を重ねる（スクロールバーの部品には border-image が効かない） */
	.px ::-webkit-scrollbar-thumb {
		min-height: 24px;
		background: url(../img/ui/sb-top.svg) 0 0 / 12px 4px no-repeat, url(../img/ui/sb-bottom.svg) 0 100% / 12px 4px no-repeat, url(../img/ui/sb-mid.svg) 0 4px / 12px calc(100% - 8px) no-repeat;
	}
	.px ::-webkit-scrollbar-thumb:horizontal {
		min-width: 24px;
		background: url(../img/ui/sb-left.svg) 0 0 / 4px 12px no-repeat, url(../img/ui/sb-right.svg) 100% 0 / 4px 12px no-repeat, url(../img/ui/sb-mid-h.svg) 4px 0 / calc(100% - 8px) 12px no-repeat;
	}
	.px ::-webkit-scrollbar-corner { background: none; }
	/* ::-webkit-scrollbar の無いブラウザ（Firefox）は、色だけ合わせる */
	@supports not selector(::-webkit-scrollbar) {
		.px * { scrollbar-width: thin; scrollbar-color: #5fb08c #f3e6c9; }
	}
}

/* ---- 2 画面の携帯ゲーム機風（2026-11-24）----
   上の本体（.px-left）にキャラの画面と丸いボタン、下の本体（.px-right）にパーツの画面と小さな横長ボタン。間にちょうつがい。
   スマホは上下に、PC は本を開いたように左右にならべる。特定の実在のゲーム機の形・色は写さない */
.px-left, .px-right {
	border: 14px solid transparent;
	border-image: url(../img/ui/shell.png) 7 fill / 14px;
	padding: 0 0 2px;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}
.px-right { position: relative; }
.px-savebox { display: contents; }
/* 本体に彫った名前 */
.px-left > .px-cap {
	border: 0;
	border-image: none;
	min-height: 0;
	margin: 0 0 6px;
	padding: 0;
	justify-content: center;
	font-size: 12px;
	line-height: 12px;
	letter-spacing: .3em;
	color: #3d8a69;
	text-shadow: 0 1px 0 #c4eed9;
}
.px-left > .px-cap::after { display: none; }
/* パーツの画面（タブとパーツの窓を、画面のふちの中に入れる） */
.px-screen2 {
	display: flex;
	flex: 1;
	min-width: 0;
	min-height: 0;
	border: 12px solid transparent;
	border-image: url(../img/ui/stage.png) 6 fill / 12px;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
}
/* 本体の丸いボタン（うごき・ランダム・もどす・やりなおす）: 絵だけ */
.px-cmd .px-btn, .px-hist .px-btn {
	flex: none;
	width: 40px;
	height: 40px;
	font-size: 0;
	gap: 0;
	padding: 0 0 4px;
	border: 0;
	border-image: none;
	background: url(../img/ui/round.png) 0 0 / 40px 40px no-repeat;
	justify-content: center;
}
.px-cmd .px-btn[aria-pressed="true"] { background-image: url(../img/ui/round-on.png); }
.px-cmd .px-btn:active, .px-hist .px-btn:active { background-image: url(../img/ui/round-down.png); }
/* 本体の下の小さな横長ボタン（メニュー・ほぞん・セーブ） */
.px-task { display: flex; justify-content: center; gap: 10px; flex: none; margin-top: 8px; }
.px-task .px-btn { white-space: nowrap; font-size: 12px; line-height: 12px; border-width: 8px; border-image: url(../img/ui/btn-main.png) 5 fill / 8px; padding: 0 6px; }
.px-task .px-btn:active { border-image-source: url(../img/ui/btn-down.png); }
/* 配信にだす（配信者のリンクから来た人にだけ出る）は黄色で目立たせる */
.px-task #pxToStream { border-image-source: url(../img/ui/btn-on.png); }
.px-task .px-btn::before { width: 12px; height: 12px; background-size: 12px 12px; }
/* ちょうつがい（下の本体の、上の本体がわのふちに重ねる） */
.px-right::before, .px-right::after {
	content: "";
	position: absolute;
	background: #5fb08c;
	border: 2px solid var(--k);
}

/* PC: 本を開いたように、左にキャラの本体・右にパーツの本体。高さは画面に合わせて決め、送るのはパーツの一覧だけ */
@media (min-width: 761px) {
	.px { max-width: 1100px; min-height: 100vh; padding: 16px 16px 116px; display: flex; flex-direction: column; justify-content: center; }
	.px-wrap {
		grid-template-columns: 424px minmax(0, 1fr);
		grid-template-rows: minmax(0, 1fr);
		grid-template-areas: "stage parts";
		gap: 0 12px;
		align-items: stretch;
		height: min(660px, calc(100vh - 132px));
		min-height: 500px;
	}
	.px-left {
		display: grid;
		grid-template-columns: 1fr 1fr;
		grid-template-rows: auto minmax(0, 1fr) auto auto;
		grid-template-areas: "cap cap" "stage stage" "hist cmd" "cmd2 cmd2";
		column-gap: 36px;
		padding: 2px 4px 10px;
	}
	.px-left > .px-cap { grid-area: cap; }
	.px-left .px-stage-box { grid-area: stage; }
	.px-row.px-hist { grid-area: hist; justify-content: flex-end; gap: 10px; margin-top: 0; }
	.px-cmd { grid-area: cmd; justify-content: flex-start; gap: 10px; }
	.px-cmd2 { grid-area: cmd2; justify-content: center; }
	.px-right { flex-direction: column; align-items: stretch; min-height: 0; padding: 4px 4px 6px; }
	/* ちょうつがい: 左右の本体の間に、上と下の 2 か所 */
	.px-right::before, .px-right::after { left: -29px; width: 18px; height: 22%; box-shadow: inset 2px 0 0 #8fd6b4; }
	.px-right::before { top: 12%; }
	.px-right::after { bottom: 12%; }
	.px-screen2 { padding: 8px 6px 6px 2px; }
	.px-groups { align-self: flex-start; }
	.px-rwin, .px-list { display: flex; flex-direction: column; min-height: 0; }
	.px-pick { flex: 1; min-height: 0; align-items: stretch; }
	.px-tabs { overflow-y: auto; min-height: 0; }
	/* 背の低い窓では、一覧が 2 段ぶんより縮まないようにして、足りない分は色の欄ごと送る */
	.px-list { overflow-y: auto; }
	/* スクロールバーの場所はいつも空けておく（出たり消えたりで、パーツの列の数が変わらないように） */
	.px-opts { flex: 1 0 auto; height: 0; min-height: 160px; overflow-y: auto; scrollbar-gutter: stable; align-content: start; padding-right: 2px; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
	.px-colors, .px-side { flex: none; }
	/* 画面の下の地面と、その上を歩くキャラ（app.js の「地面を歩くキャラ」）。絵そのものは押せない重ね方で、キャラの上のときだけ app.js がマウスを受ける（つまむ・押す）。
	   だれかが宙にいる間は、app.js が絵の高さを画面の上まで広げる */
	.px-parade {
		position: fixed; left: 0; right: 0; bottom: 0; height: 130px; z-index: 2; pointer-events: none;
		background: url(../img/ui/ground.png) 0 100% / 32px 26px repeat-x;
		image-rendering: pixelated; image-rendering: crisp-edges;
	}
	.px-parade canvas { position: absolute; left: 0; bottom: 10px; width: 100%; height: 120px; image-rendering: pixelated; image-rendering: crisp-edges; }
	/* 地面の案内板（押すと、案内のメッセージ＝app.js）。キャラは案内板の手前を歩く */
	.px-sign {
		position: fixed; right: 4%; bottom: 46px; z-index: 1; min-width: 64px; padding: 0 6px 2px; text-align: center; background: none; font: inherit;
		color: var(--k); font-size: 15px; line-height: 20px; cursor: var(--cur-p);
		border: 6px solid transparent; border-image: url(../img/ui/sign.png) 3 fill / 6px; image-rendering: pixelated; image-rendering: crisp-edges;
	}
	.px-sign::after { content: ''; position: absolute; left: 50%; top: 100%; width: 10px; height: 34px; margin: 6px 0 0 -5px; background: url(../img/ui/sign-post.png) 0 0 / 10px 4px repeat-y; z-index: -1; }
	.px-sign:hover, .px-sign:focus-visible { transform: translateY(-2px); }
	.px-sign:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }
	.px-is-app .px-sign { display: none; }
	/* いつもいるキャラ（空）の上に重ねる、見えない押せる所（押すとよろこぶ。場所は app.js が毎コマ合わせる） */
	.px-over, .px-over * { cursor: var(--cur-p) !important; }
	.px-grab, .px-grab * { cursor: var(--cur-p) !important; user-select: none; -webkit-user-select: none; }
	.px-mascot { position: fixed; z-index: 3; padding: 0; border: 0; background: none; cursor: var(--cur-p); }
	.px-mascot[hidden] { display: none; }
	.px-mascot:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
	/* デスクトップ版のアプリの中（desktop/）: セーブしたキャラはデスクトップを歩くので、ページの下の地面は出さない */
	.px-is-app .px-parade, .px-is-app .px-mascot { display: none; }
	.px-is-app .px { padding-bottom: 16px; }
	.px-is-app .px-wrap { height: min(700px, calc(100vh - 32px)); }
}

@media (max-width: 760px) {
	/* スマホでは、サイト共通のヘッダー・フッターと題を出さない（画面をメーカーだけに使う） */
	.px-chrome, .px-title { display: none; }
	.px-body { padding-top: 0; }
	/* 画面 1 枚に収めて、送るのはパーツの一覧だけにする（ページごと動くと、タブやカテゴリが流れていく）。
	   背の低い画面では一覧が 2 段ぶんより縮まないようにして、足りない分だけページを送る */
	.px { padding: 4px; height: 100vh; height: 100dvh; min-height: 590px; display: flex; flex-direction: column; }
	.px-wrap { flex: 1; min-height: 0; }
	.px-right, .px-rwin, .px-pick, .px-list { display: flex; flex-direction: column; min-height: 0; }
	.px-right, .px-pick { align-items: stretch; }
	.px-rwin, .px-list { min-width: 0; }
	.px-right { align-self: stretch; }
	.px-rwin, .px-pick, .px-list, .px-opts { flex: 1; }
	.px-opts { min-height: 0; overflow-y: auto; overscroll-behavior: contain; align-content: start; -webkit-overflow-scrolling: touch; }
	.px-tabs, .px-colors { flex: none; }
	/* キャラの窓は上に固定。見ながらパーツを選べる。キャラの右に、絵だけのボタンを縦にならべる */
	.px-left {
		position: sticky;
		top: 0;
		z-index: 5;
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto;
		grid-template-areas: "cap cap cap" "hist stage cmd" "cmd2 cmd2 cmd2";
		column-gap: 4px;
	}
	/* いちばん上は見出しのバー（メニューバーの代わり）。うごきのボタンは右の 1 つにまとめたので、下のならびは出さない */
	.px .px-only-pc, .px-rwin > .px-cap, .px-mascot { display: none; }
	.px-left .px-cap { grid-area: cap; }
	.px-left .px-stage-box { grid-area: stage; }
	.px-cmd { grid-area: cmd; flex-direction: column; flex-wrap: nowrap; justify-content: center; }
	/* キャラの左に、もどす・やりなおす */
	.px-row.px-hist { grid-area: hist; flex-direction: column; flex-wrap: nowrap; justify-content: center; margin-top: 0; }
	.px .px-only-sp { display: inline-flex; }
	/* ほぞん・セーブはふだん出さず、キャラの右のボタンで下から呼び出す */
	.px-savebox .px-save.is-open { display: block; position: fixed; left: 6px; right: 6px; top: auto; bottom: 6px; transform: none; width: auto; max-width: none; z-index: 30; max-height: 84vh; overflow-y: auto; margin: 0; }
	.px-sheet-bg:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(91, 70, 54, .45); }
	/* 呼び出した窓は中を送れるようにするので、見出しを枠の上にはみ出させない（はみ出した分が切れる） */
	.px-savebox .px-save.is-open .px-save-head { margin-top: 0; }
	.px-cmd2 { grid-area: cmd2; margin-top: 0; }
	.px-row + .px-cmd2 { margin-top: 0; }
	.px-cmd2 .px-btn { margin-top: 6px; }
	.px-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "stage" "parts"; gap: 10px; }
	/* ちょうつがい: 上下の本体の間に、横に 1 本 */
	.px-right::before { left: 30px; right: 30px; top: -27px; height: 16px; box-shadow: inset 0 2px 0 #8fd6b4; }
	.px-right::after { display: none; }
	.px-screen2 { flex-direction: column; padding: 6px 4px 4px; }
	/* 下のボタンが 4 つになっても 1 行に収まるように、間を詰める */
	.px-task { gap: 6px; }
	.px-task .px-btn { padding: 0 3px; }
	.px-rwin, .px-save { padding: 0 0 2px; }
	.px-cap, .px-save-head { margin: -4px 0 8px; }
	/* まとまりのタブは窓の上に飛び出す */
	.px-groups { flex-direction: row; width: auto; padding: 0 12px; margin: 0 0 -2px; gap: 2px; }
	.px-group { flex: 1; min-width: 0; margin: 8px 0 0; border-image-source: url(../img/ui/tab-t.png); }
	.px-group.is-on { margin: 0; padding-bottom: 10px; border-image-source: url(../img/ui/tab-t-on.png); }
	/* カテゴリは横にならべて送る */
	.px-pick { gap: 0; position: relative; }
	/* カテゴリのならびに続きがある側には、窓の地の色のぼかしと矢印を出す（app.js が more-l・more-r を付ける） */
	.px-pick::before, .px-pick::after {
		content: ""; position: absolute; top: 0; width: 34px; height: 30px; pointer-events: none; opacity: 0;
		background: url(../img/ui/i-more.png) right 0 center / 18px 18px no-repeat, linear-gradient(90deg, rgba(255, 246, 224, 0), var(--n) 35%);
	}
	.px-pick::after { right: 0; }
	.px-pick::before { left: 0; transform: scaleX(-1); }
	.px-pick.more-r::after, .px-pick.more-l::before { opacity: 1; }
	.px-tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 0 0 6px; margin-bottom: 8px; border-right: 0; border-bottom: 2px dotted var(--l); -webkit-overflow-scrolling: touch; }
	.px-tab { flex: none; }
	.px-opts { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
	/* 色はカテゴリのすぐ下（パーツが増えても見える）。高さを取らないように 1 段にして横に送る */
	.px-colors { order: -1; margin: 0 0 8px; }
	.px-ctabs { margin-bottom: 6px; }
	.px-swatches { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 28px; overflow-x: auto; padding: 2px 0 4px; -webkit-overflow-scrolling: touch; }
}
