:root {
  --ink: #eef2f8; --muted: #9aa6b8; --panel: rgba(16, 20, 30, 0.72); --panel-solid: #141a26; --line: rgba(255, 255, 255, 0.1);
  --field: rgba(255, 255, 255, 0.06); --accent: #76b900; --accent-deep: #3f6600; --on-accent: #0a0f00; --accent-2: #33d1c6; --ai: #33d1c6; --rec: #ff5d6c;
  --radius: 16px; --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", sans-serif; color: var(--ink); color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; min-height: 100vh; background: radial-gradient(900px 500px at 50% 42%, rgba(60, 110, 220, 0.28) 0%, transparent 70%), radial-gradient(700px 420px at 12% 8%, rgba(110, 70, 200, 0.22) 0%, transparent 65%), radial-gradient(800px 500px at 88% 96%, rgba(20, 120, 150, 0.22) 0%, transparent 65%), #03050c; }
#cosmos { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }
#stage canvas { display: block; touch-action: none; }
/* 水彩紙の粒（paper.ts、/rn-lab/ と同じ）: アニメ調の部屋だけ。 */
#paper-overlay { position: fixed; inset: 0; pointer-events: none; background-size: 512px 512px; mix-blend-mode: multiply; opacity: 0.22; display: none; }
body.anime #paper-overlay { display: block; }
#crosshair { position: fixed; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); pointer-events: none; }
body:has(#hud[hidden]) #crosshair { display: none; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); }
h1, h2 { letter-spacing: 0.01em; }
.note, .muted { color: var(--muted); font-size: 13px; }

/* --- 操作部品 --- */
button { font: inherit; font-size: 14px; color: var(--ink); padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
button:hover { background: rgba(255, 255, 255, 0.12); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button[type=submit] { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 700; }
button[type=submit]:hover { filter: brightness(1.1); }
button.on { background: var(--ai); color: #06241f; border-color: var(--ai); font-weight: 600; }
input:not([type=checkbox]), select, textarea { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; }
select option { background: var(--panel-solid); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=file] { font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-right: 10px; cursor: pointer; }
.inline { display: flex; gap: 8px; align-items: center; }

/* --- ログイン / ロビー --- */
.lobby { position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 28px; border-radius: 22px; }
.lobby.wide { width: min(860px, calc(100vw - 32px)); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--muted); }
.brand .org { margin-left: auto; font-weight: 500; font-size: 12px; letter-spacing: 0.02em; }
#lobby [hidden] { display: none !important; }
.demo-entry { display: flex; align-items: center; gap: 14px; margin: 14px 0 4px; }
.demo-entry .note { margin: 0; line-height: 1.6; }
.demo-button { flex: none; display: inline-block; padding: 10px 26px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 15px; text-decoration: none; }
.demo-button:hover { filter: brightness(1.1); }
.demo-join h2 { margin: 18px 0 6px; font-size: 18px; }
.demo-join > label { margin: 14px 0 6px; }
.demo-row { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
#demo-name { width: min(280px, calc(100vw - 96px)); margin: 0; }
.demo-row .enter-button { min-width: 140px; margin: 0; padding-top: 0; padding-bottom: 0; }
.login-demo { margin: 14px 0 0; text-align: center; }
.login-demo a { color: var(--accent-2); }
.site-footer { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .brand { flex-wrap: wrap; } .brand .org { margin-left: 36px; width: 100%; } .demo-entry { flex-direction: column; align-items: stretch; } .demo-button { text-align: center; } }
.logo { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent-deep), var(--accent)); box-shadow: 0 0 24px rgba(118, 185, 0, 0.5); }
.lobby h1 { margin: 18px 0 6px; font-weight: 700; }
.login h1 { font-size: 24px; line-height: 1.3; background: linear-gradient(90deg, #fff, #b8c7ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login h1 .abbr { white-space: nowrap; }
.tagline { margin: 6px 0 0; font-size: 14px; color: var(--muted); letter-spacing: 0.04em; }
.lobby h2 { font-weight: 600; }
.lobby label { display: block; margin: 12px 0; font-size: 13px; color: var(--muted); }
.lobby input:not([type=checkbox]):not([type=file]), .lobby select { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 15px; }
.lobby form > .note { margin: 0; font-size: 12px; line-height: 1.6; }

.login button[type=submit] { display: block; min-width: 160px; padding: 11px 28px; font-size: 15px; margin: 6px 0 0 auto; border-radius: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 12px 0 0; }
.card { display: grid; gap: 6px; text-align: left; padding: 16px; min-height: 96px; align-content: end; border-radius: 14px; background: linear-gradient(160deg, rgba(118, 185, 0, 0.18), rgba(51, 209, 198, 0.06)); }
a.card { color: var(--ink); text-decoration: none; border: 1px solid var(--line); transition: border-color 0.15s, transform 0.15s; }
.card.thumb { min-height: 190px; background-size: cover; background-position: center; }
.cards:has(.thumb) .card { min-height: 190px; }
.card span { line-height: 1.5; font-size: 12px; color: var(--muted); }
.card small { justify-self: start; padding: 2px 8px; border-radius: 999px; background: rgba(118, 185, 0, 0.85); color: var(--on-accent); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card b { font-size: 15px; }
.card[aria-checked=true] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 10px 30px rgba(118, 185, 0, 0.3); }
.card-slot { position: relative; display: grid; }
.card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.card-delete { padding: 3px 10px; font-size: 12px; border-radius: 999px; background: rgba(10, 13, 20, 0.72); }
.card-delete:hover { background: #b3261e; border-color: #b3261e; }
.card-rename:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.card-reopen:hover { background: var(--accent-2); border-color: var(--accent-2); color: #06241f; }
.card[data-id=workshop] { background: linear-gradient(160deg, rgba(51, 209, 198, 0.2), rgba(63, 102, 0, 0.08)); }
.lobby form { display: grid; gap: 14px; margin-top: 18px; }
.block { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, 0.035); }
.block h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; color: var(--ink); text-transform: none; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.block .lead { margin: 8px 0 0; line-height: 1.6; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.pair label { margin-bottom: 0; }
.builder-entry { margin: 10px 0 4px; }
.builder-entry summary { cursor: pointer; font-size: 13px; opacity: .8; }
.builder-entry label { margin-top: 8px; }
.block-button { width: 100%; padding: 12px; font-size: 15px; border-radius: 12px; background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 700; }
.block-button:disabled { background: var(--field); color: var(--muted); }

/* --- ルーム HUD --- */
.bar { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; padding: 8px 14px; border-radius: 14px; }
#space-name { font-weight: 700; font-size: 14px; }
#room-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.12em; padding: 4px 10px; border-radius: 8px; }
.bar b { color: var(--ink); font-weight: 600; }
.rec { margin-left: auto; color: var(--rec); font-size: 12px; font-weight: 600; }
.rec::before { content: "●"; margin-right: 6px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.status { position: fixed; left: 12px; bottom: 56px; width: min(360px, calc(100vw - 24px)); display: grid; gap: 8px; font-size: 13px; }
.status[hidden] { display: none; }
/* 操作パネルは最初は閉じている。T・G などのキーは閉じていても効く。 */
.status-toggle { position: fixed; left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.status-toggle[aria-expanded=true] { border-color: var(--accent-2); }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); display: inline-block; transition: background 0.1s, box-shadow 0.1s; }
.dot.on { background: #3ddc84; box-shadow: 0 0 12px #3ddc84; }
.bubble { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); border-color: rgba(51, 209, 198, 0.5); color: var(--ink); font-size: 15px; line-height: 1.6; padding: 12px 16px; }
.bubble::before { content: "AI"; display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 6px; background: var(--ai); color: #06241f; font-size: 11px; font-weight: 700; vertical-align: 2px; }
.chat { position: fixed; right: 12px; bottom: 12px; width: min(360px, calc(100vw - 24px)); font-size: 13px; }
#log { list-style: none; margin: 0 0 8px; padding: 0; max-height: 28vh; overflow-y: auto; display: grid; gap: 4px; }
#log li { padding: 5px 9px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); line-height: 1.5; }
#log li.ai { color: var(--ai); background: rgba(51, 209, 198, 0.1); }
#log li.sys { color: var(--muted); background: none; padding: 1px 9px; font-size: 12px; }
#chat-form { display: flex; gap: 6px; align-items: center; }
#chat-form input:not([type=checkbox]) { flex: 1; min-width: 0; padding: 8px 10px; }
#chat-form .inline { font-size: 12px; color: var(--muted); gap: 4px; }
.help { position: fixed; left: 50%; bottom: 8px; transform: translateX(-50%); margin: 0; pointer-events: none; font-size: 12px; white-space: nowrap; padding: 3px 12px; border-radius: 999px; background: rgba(10, 13, 20, 0.55); color: #cfd6e2; }
.credit { position: fixed; left: 12px; top: 72px; margin: 0; padding: 2px 8px; border-radius: 6px; background: rgba(10, 13, 20, 0.6); color: var(--muted); max-width: 40vw; font-size: 11px; pointer-events: none; }
.credit:empty { display: none; }
/* 退出（HUD の右端）。 */
.leave { padding: 4px 12px; border-radius: 8px; font-weight: 600; }
.leave:hover { background: #b3261e; border-color: #b3261e; }
/* 作成中のワールド（main.ts が body.building）: AI はいないので AI の画面は出さない。 */
body.building .ai-only { display: none !important; }
.toast { position: fixed; left: 50%; top: 50%; transform: translate(-50%, 48px); z-index: 10; font-size: 14px; padding: 10px 16px; border-radius: 999px; }

/* --- ドック・マップ・ヘルプ --- */
.dock { position: fixed; right: 12px; top: 50%; transform: translateY(-50%); display: grid; gap: 8px; }
.dock button { width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 12px; font-weight: 600; background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.dock button.on { background: var(--ai); color: #06241f; }
.dock button.unread { box-shadow: var(--shadow), 0 0 0 2px var(--ai); }
.chat[hidden] { display: none; }
body.demo #hud > .bar { display: none; }
.minimap { position: fixed; right: 76px; top: 72px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.help-panel { position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px)); z-index: 6; padding: 20px 22px; font-size: 14px; }
.help-panel h2 { margin: 0 0 10px; font-size: 18px; }
.help-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.help-panel dt { font-weight: 700; color: var(--accent-2); }
.help-panel dd { margin: 0; }

/* --- ワークショップ端末 --- */
.terminal-hint { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); font-weight: 600; border-radius: 999px; padding: 10px 18px; border-color: var(--accent-2); box-shadow: 0 0 24px rgba(51, 209, 198, 0.35); }
.terminal { position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; z-index: 5; font-size: 14px; padding: 24px; border-radius: 20px; background: rgba(12, 16, 24, 0.92); }
.terminal h2 { margin: 0 0 8px; font-size: 20px; }
.terminal ol { padding-left: 1.2em; display: grid; gap: 14px; line-height: 1.6; }
.terminal li button { margin-left: 6px; }
.terminal textarea { width: 100%; margin-top: 8px; padding: 10px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.terminal pre { white-space: pre-wrap; font-size: 12px; max-height: 30vh; overflow: auto; color: var(--muted); }
.terminal pre:empty { display: none; }

/* --- AI ボード（全画面パネル。元の AI ホワイトボードの画面）。色は svg-render.ts が属性で持つ（PNG と共通） --- */
.board-hint { bottom: 150px; }
.board-panel { position: fixed; inset: 0; z-index: 8; background: #101418; color: #e8edf2; }
.board-panel [hidden] { display: none !important; }
.board-wrap { position: absolute; inset: 0; overflow: auto; display: flex; }
#board-svg { display: block; margin: auto; flex: none; touch-action: pan-x pan-y; }
#board-svg g.node { touch-action: none; cursor: grab; animation: board-node-in 0.3s ease-out; }
#board-svg g.node.link-from { cursor: crosshair; }
#board-svg line.edge-hit { pointer-events: stroke; cursor: pointer; }
#board-svg .node-label, #board-svg .node-author { user-select: none; pointer-events: none; }
#board-svg g.note { touch-action: none; cursor: grab; animation: board-node-in 0.3s ease-out; }
#board-svg .note-text { user-select: none; pointer-events: none; }
@keyframes board-node-in { from { opacity: 0; } }
.board-topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: linear-gradient(rgba(16, 20, 24, 0.92), rgba(16, 20, 24, 0)); pointer-events: none; }
.board-topbar > * { pointer-events: auto; }
.board-topbar .spacer { flex: 1; }
.board-label { font-weight: 700; font-size: 15px; letter-spacing: 0.04em; }
.board-panel .board-danger { border-color: #7f3a3a; color: #f0b9b9; }
.board-panel .board-danger:hover { background: #462626; }
/* 閉じるは最重要の導線: 塗りつぶしで他のボタンより目立たせる */
.board-exit { background: #2e6da4; border-color: #7db4e0; color: #fff; font-weight: 700; }
.board-exit:hover { background: #3a82c2; }
.board-inputbar { position: absolute; bottom: 0; left: 0; right: 0; display: flex; gap: 8px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(16, 20, 24, 0), rgba(16, 20, 24, 0.92) 40%); }
.board-inputbar input { flex: 1; padding: 10px 14px; }
#board-mic { font-size: 18px; padding: 8px 12px; }
#board-mic.listening { background: #7f1d1d; border-color: #ef4444; animation: board-pulse 1.2s ease-in-out infinite; }
@keyframes board-pulse { 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25); } }
.board-interim { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); max-width: 80vw; padding: 6px 14px; border-radius: 16px; background: rgba(35, 43, 51, 0.9); color: #9fb4c7; font-size: 13px; visibility: hidden; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-interim.show { visibility: visible; }
.board-menu { position: fixed; z-index: 9; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: #1a2128; border: 1px solid #3a454f; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45); }
.board-menu button { font-size: 13px; padding: 7px 12px; text-align: left; }
.board-chip { position: absolute; bottom: 104px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 18px; font-size: 13px; background: #1c3a2a; border: 1px solid #3f7f5a; color: #b8f5cf; }
.board-chip button { padding: 2px 8px; font-size: 12px; border-radius: 10px; }
.board-dialog { margin: auto; min-width: 300px; color: var(--ink); }
.board-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.board-dialog h2 { margin: 0 0 6px; font-size: 18px; }
.board-dialog form { display: flex; flex-direction: column; gap: 10px; }
.board-dialog input { padding: 10px 12px; }
.board-note-text { min-width: min(360px, 80vw); padding: 10px 12px; resize: vertical; color: #33333b; line-height: 1.45; }
.board-note-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.board-note-colors { display: flex; gap: 6px; }
.board-note-swatch { width: 38px; height: 32px; padding: 0; border-radius: 8px; color: #33333b; font-size: 12px; border: 2px solid rgba(51, 51, 59, 0.25); }
.board-note-swatch.chosen { border-color: #e07a30; box-shadow: 0 0 0 2px rgba(224, 122, 48, 0.35); }
.board-note-count { font-size: 12px; opacity: 0.7; }

/* --- 資料ボード（全画面パネルは .board-panel と共通） --- */
.doc-hint { bottom: 204px; }
.seat-hint { bottom: 150px; }
.doc-view { position: absolute; inset: 56px 0 72px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.doc-page { display: block; background: #fff; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5); }
.doc-empty, .doc-note { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 80vw; margin: 0; text-align: center; color: #9fb4c7; }
.doc-note:empty { display: none; }
.doc-name { font-size: 13px; color: #9fb4c7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.doc-nav { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
.doc-nav button { font-size: 16px; padding: 8px 16px; }
#doc-pageinfo { min-width: 72px; text-align: center; font-variant-numeric: tabular-nums; }
/* --- 入ったまま建てる (build-mode.ts): 作成中のワールドだけ。左端の縦のパネル、置くもの・Text2Build はその右 --- */
.build-bar { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); display: grid; gap: 8px; width: 150px; padding: 10px; z-index: 3; }
.build-bar[hidden], .build-bar [hidden], .build-palette[hidden], .build-generate[hidden] { display: none; }
.build-bar h2 { margin: 0 0 2px; font-size: 13px; color: var(--muted); font-weight: 700; }
.build-bar button { border-radius: 10px; font-weight: 600; text-align: left; }
.build-bar button[aria-expanded=true] { background: var(--ai); color: #06241f; border-color: var(--ai); }
.build-bar .finish { margin-top: 6px; background: var(--accent); border-color: transparent; color: var(--on-accent); }
.build-palette { position: fixed; left: 174px; top: 50%; transform: translateY(-50%); display: grid; grid-template-columns: repeat(2, auto); gap: 6px; max-width: calc(100vw - 186px); z-index: 3; padding: 8px; }
.build-palette button { display: grid; justify-items: center; gap: 2px; min-width: 76px; padding: 8px 10px; font-size: 12px; }
.build-palette .icon { font-size: 22px; line-height: 1; }
.build-hint { position: fixed; left: 50%; top: calc(50% + 22px); transform: translateX(-50%); margin: 0; padding: 4px 12px; border-radius: 999px; background: rgba(10, 13, 20, 0.7); color: var(--accent-2); font-size: 13px; font-weight: 600; pointer-events: none; white-space: pre; }
.build-placing { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); margin: 0; font-size: 13px; border-radius: 999px; padding: 8px 16px; border-color: var(--accent-2); z-index: 3; }
/* 選んだ物の上に出るメニュー（build-select.ts が位置を決める）。 */
.build-select { position: fixed; left: 0; top: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 999px; border-color: var(--accent-2); }
.build-select[hidden] { display: none; }
.build-select .name { max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--accent-2); padding: 0 4px; }
.build-select button { font-size: 13px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.build-select .close { padding: 4px 8px; }
/* パネルの右に小さく（左下の操作パネルとは重ならない）。受け付けたら閉じ、進み具合は「🏗」のボタンに出る。 */
.build-generate { position: fixed; left: 174px; top: 50%; transform: translateY(-50%); width: min(360px, calc(100vw - 186px)); z-index: 4; display: grid; gap: 8px; padding: 12px; }
.build-generate h2 { margin: 0; font-size: 14px; }
.build-generate textarea { width: 100%; padding: 8px; font-size: 13px; resize: vertical; }
.build-generate .row { display: flex; gap: 8px; }
.build-generate .primary { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 700; }
.build-generate .primary:disabled { opacity: 0.5; cursor: progress; }
.build-generate p:empty { display: none; }
.build-generate p { margin: 0; }

/* スマホの移動ボタン（touch-controls.ts。rn-lab と同じ形）: 左下に触れた場所に出るジョイスティックと、右下の ↑。 */
.touch-controls { position: fixed; inset: 0; pointer-events: none; touch-action: none; }
.touch-zone { position: absolute; left: 0; width: 50%; top: 45%; bottom: 52px; pointer-events: auto; touch-action: none; }
.touch-stick { position: absolute; left: 84px; top: calc(100% - 150px); width: 128px; height: 128px; margin: -64px 0 0 -64px; border-radius: 50%; border: 2.5px solid rgba(51, 51, 59, 0.55); background: rgba(251, 248, 238, 0.32); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); opacity: 0.45; transition: opacity 0.14s ease; pointer-events: none; }
.touch-stick.active { opacity: 1; transition: none; }
.touch-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; border-radius: 50%; border: 2.5px solid rgba(51, 51, 59, 0.7); background: rgba(251, 248, 238, 0.75); box-shadow: 2px 2px 0 rgba(51, 51, 59, 0.4); transform: translate(-50%, -50%); pointer-events: none; }
.touch-jump { position: absolute; right: 24px; bottom: 40px; width: 60px; height: 60px; padding: 0; border-radius: 50%; border: 2.5px solid rgba(51, 51, 59, 0.62); background: rgba(251, 248, 238, 0.55); box-shadow: 3px 3px 0 rgba(51, 51, 59, 0.32); color: rgba(51, 51, 59, 0.78); font-size: 32px; font-weight: 800; opacity: 0.72; pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.touch-jump:hover { background: rgba(251, 248, 238, 0.55); }

@media (max-width: 720px) {
  .minimap { right: 12px; top: auto; bottom: 220px; }
  .dock { top: 110px; transform: none; }
  .pair { grid-template-columns: 1fr; }
  .card { min-height: 0; padding: 12px 14px; }
  .lobby { padding: 20px; }
  .chat { bottom: auto; top: 118px; }
  .help { display: none; }
}

/* ワールド × 介入デザイン (lobby.ts, design-cards.ts) */
.designs .card { min-height: 0; align-content: start; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--ink); cursor: pointer; }
.designs .card:disabled { opacity: 0.4; cursor: not-allowed; }
.designs .card small { background: rgba(51, 209, 198, 0.85); }
.knowledge { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.knowledge summary { cursor: pointer; }
.choice { margin: 10px 0 0; }
.choice b { color: var(--ink); }
.enter-button { display: block; min-width: 200px; margin: 14px 0 0 auto; padding: 11px 28px; font-size: 15px; border-radius: 12px; }

/* ページの目的と仕組み: 標準機能の上で ① ワールド × ② 介入デザイン → 実験。 */
.purpose { margin: 10px 0 0; font-size: 14px; line-height: 1.8; color: var(--ink); }
.scheme { margin: 16px 0 0; display: grid; gap: 8px; }
.scheme-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 8px; }
.scheme-box { display: grid; gap: 2px; align-content: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--accent); background: rgba(118, 185, 0, 0.12); }
.scheme-box small { color: var(--muted); font-size: 11px; }
.scheme-box b { font-size: 15px; }
.scheme-box span { color: var(--muted); font-size: 12px; }
.scheme-box.result { border-color: var(--accent-2); background: rgba(51, 209, 198, 0.1); }
.scheme-op { align-self: center; color: var(--muted); font-size: 18px; }
.scheme-base { padding: 10px 14px; border-radius: 14px; border: 1px dashed var(--line); background: rgba(255, 255, 255, 0.03); }
.scheme-base small { color: var(--muted); font-size: 11px; }
.scheme-base ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.scheme-base li { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); font-size: 12px; }
@media (max-width: 560px) {
  .scheme-row { grid-template-columns: 1fr; }
  .scheme-op { justify-self: center; transform: rotate(90deg); }
}

/* 「＋ 新しい空間をつくる」のウィンドウ (create-dialog.ts) */
.create-dialog { width: min(640px, calc(100vw - 32px)); }
.create-option { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.create-option h3 { margin: 0; font-size: 15px; }
.create-option ol { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 13px; }
.create-option textarea { width: 100%; margin-top: 6px; font-size: 12px; }
.create-option pre { margin: 0; white-space: pre-wrap; font-size: 12px; color: var(--muted); }
.create-option pre:empty { display: none; }
/* サンプルを選んでいる間、介入デザイン（手順 2）は使わない */
#design-block.inactive { opacity: 0.4; pointer-events: none; }

/* Text2Build: 研究者トークンなしで入った人がその場でトークンを入れる欄 */
.build-unlock { display: grid; gap: 6px; }
.build-unlock[hidden], .build-generate .build-can[hidden] { display: none; }
.build-unlock .row input { flex: 1; min-width: 0; padding: 8px; }
.build-unlock .note { margin: 0; font-size: 12px; line-height: 1.5; }

/* 作成中のワールドでは上部のワールド名を押して名前を変えられる (room-hud.ts) */
#space-name.renamable { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
#space-name.renamable::after { content: " ✏️"; font-size: 11px; opacity: 0.7; }

.create-style { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 10px; padding: 0; border: 0; }
.create-style legend { font-size: 13px; font-weight: 700; margin-bottom: 6px; padding: 0; }
.create-style .note { grid-column: 1 / -1; margin: 0; }
.style-card { position: relative; display: grid; gap: 2px; padding: 6px; border: 2px solid transparent; border-radius: 10px; background: rgba(255, 255, 255, 0.04); cursor: pointer; font-size: 13px; }
.style-card img { width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 4px; }
.style-card input { position: absolute; opacity: 0; pointer-events: none; }
.style-card:hover { border-color: rgba(255, 255, 255, 0.25); }
.style-card:has(input:checked) { border-color: var(--accent); background: rgba(255, 255, 255, 0.08); }
.style-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) { .create-style { grid-template-columns: 1fr; } }
