/* 丸亀高校 プログラミング謎解き — ブロックワールド発展編 スタイルシート */
* { box-sizing: border-box; }
html, body {
  margin: 0; width: 100%; height: 100%; overflow: hidden;
  font-family: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16.5px; color: #1e293b; background: #f1f3f4;
}
body { display: flex; flex-direction: column; width: 100%; max-width: 100vw; min-width: 0; }

/* ===== ヘッダー（丸高ネイビー × 丸高オレンジアクセント） ===== */
#topbar {
  flex: 0 0 50px; width: 100%; min-width: 0;
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: linear-gradient(90deg, #162947 0%, #1f3a60 100%);
  border-bottom: 3px solid #ea580c;
  color: #fff; white-space: nowrap; overflow: hidden;
}
.brand { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.brand small {
  font-weight: 700; margin-left: 5px; font-size: 11px;
  padding: 2px 6px; border-radius: 10px;
  background: rgba(234, 88, 12, 0.90); color: #fff7ed;
}
.nav-group { display: flex; align-items: center; gap: 5px; min-width: 0; }
.nav-group.right { margin-left: auto; flex-shrink: 0; }
.nav-group label { font-size: 12px; opacity: .88; font-weight: 700; }
#topbar select {
  height: 32px; border-radius: 6px; border: 0; padding: 0 7px;
  font-size: 12.8px; max-width: 250px; min-width: 0; background: #fff; color: #202124; font-weight: 600;
}
#lessonSelect { width: clamp(115px, 18vw, 235px); }
.progress-wrap { display: flex; align-items: center; gap: 6px; font-size: 12px; flex-shrink: 0; }
.top-badge-pill {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 12px;
  background: rgba(250, 204, 21, 0.20); border: 1px solid #facc15;
  color: #fef08a; font-weight: 800; font-size: 11.8px;
}
.progress-bar { width: 68px; height: 8px; background: rgba(255,255,255,.25); border-radius: 4px; overflow: hidden; }
#progressFill { height: 100%; width: 0; background: #fb923c; transition: width .3s; }

.btn {
  height: 32px; padding: 0 11px; border: 1px solid #c7ccd1; border-radius: 6px;
  background: #fff; color: #202124; font-size: 12.8px; cursor: pointer; white-space: nowrap; font-weight: 600;
}
.btn:hover { background: #e8f0fe; }
.btn:disabled { opacity: .45; cursor: default; }
#topbar .btn { border-color: transparent; }
.btn-gate { background: #fef3c7; color: #92400e; font-weight: 800; }
.btn-gate:hover { background: #fde68a; }
.btn-run { background: #1e8e3e; color: #fff; border-color: #1e8e3e; font-weight: 700; }
.btn-run:hover { background: #188038; }
.btn-stop { background: #d93025; color: #fff; border-color: #d93025; font-weight: 700; }
.btn-stop:hover { background: #c5221f; }

.status { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.status.loading { background: #f9ab00; color: #202124; }
.status.ready { background: #34a853; color: #fff; }
.status.error { background: #d93025; color: #fff; }

/* ===== 2ペイン（拡大縮小・ウィンドウ幅変更でも3D画面と主人公が常に中央に収まるレスポンシブ構造） ===== */
#panes { flex: 1 1 auto; display: flex; width: 100%; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
#leftPane {
  flex: 0 0 65%; display: flex; flex-direction: column;
  min-width: 240px; max-width: calc(100% - 210px); min-height: 0; background: #0f172a;
}
#rightPane {
  flex: 1 1 0; display: flex; flex-direction: column;
  min-width: 202px; min-height: 0; background: #fff; position: relative;
}
#vresizer { flex: 0 0 8px; cursor: col-resize; background: #d7dbe0; border-left: 1px solid #bcc2c8; border-right: 1px solid #bcc2c8; }
#vresizer:hover, body.dragging #vresizer { background: #ea580c; }
body.dragging { user-select: none; }
#dragShield { display: none; position: absolute; inset: 0; z-index: 10; }
body.dragging #dragShield { display: block; }

/* ===== 世界パネル（3Dキャンパス画面 + 教室入室バナー + C/T/Hオーバーレイ） ===== */
#worldPanel {
  position: relative; flex: 1 1 100%; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden; background: #0f172a;
}
#canvasWrap { position: relative; flex: 1 1 100%; min-height: 0; background: #8ecbf9; overflow: hidden; cursor: crosshair; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hudCv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

/* 徒歩で教室に入ったときに表示するフローティング案内バー */
.room-banner {
  position: absolute; left: 8px; top: 112px; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 8px;
  background: rgba(22, 41, 71, 0.90);
  border: 1.5px solid #fb923c;
  color: #fff7ed; font-size: 12px; font-weight: 800;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}
.room-banner-btn {
  height: 24px; padding: 0 9px; border-radius: 5px;
  border: 1px solid #fdba74; background: #ea580c; color: #ffffff;
  font-size: 11.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.room-banner-btn:hover { background: #c2410c; }

.hud-top-btns {
  position: absolute; top: 8px; right: 10px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
}
.hud-key-btn {
  height: 32px; padding: 0 11px;
  border: 1.5px solid rgba(148, 163, 184, 0.85);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.84);
  color: #f8fafc;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: background .15s, border-color .15s, transform .1s;
}
.hud-key-btn:hover {
  background: #1d4ed8; border-color: #93c5fd; color: #ffffff;
  transform: translateY(-1px);
}
.hud-cam-btn.on {
  background: rgba(29, 78, 216, 0.90);
  border-color: #93c5fd;
  color: #fef08a;
}

/* チャットログ表示（3D画面左下トーストログ） */
#log {
  position: absolute; left: 10px; bottom: 58px; max-width: 54%; max-height: 38%;
  overflow: hidden; pointer-events: none; z-index: 4;
  display: flex; flex-direction: column; justify-content: flex-end;
}
#log div {
  background: rgba(14, 20, 32, 0.78); color: #f8fafc; padding: 4px 10px;
  border-left: 3px solid #38bdf8; border-radius: 0 5px 5px 0;
  margin-top: 3px; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  transition: opacity .5s ease;
}
#log div.fading { opacity: 0; }
#log div.chat-cmd { border-left-color: #fbbf24; color: #fef08a; font-family: Menlo, Consolas, monospace; font-weight: 700; }
#log div.err { background: rgba(165, 28, 24, 0.88); border-left-color: #fca5a5; color: #fff; }

/* ===== オーバーレイ共通 ===== */
.game-overlay {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.overlay-bar {
  flex: 0 0 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 14px; background: #162030; color: #f8fafc;
  border-bottom: 1px solid #2d3d54;
}
.overlay-title { font-weight: 800; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.overlay-sub { font-weight: 400; font-size: 12px; color: #94a3b8; }
.overlay-close-btn {
  flex-shrink: 0; height: 28px; padding: 0 11px;
  border: 1px solid #475569; border-radius: 6px;
  background: #334155; color: #f8fafc;
  font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.overlay-close-btn:hover { background: #dc2626; border-color: #ef4444; color: #fff; }

/* ===== Tキー：全画面チャットオーバーレイ ===== */
.chat-overlay {
  z-index: 31;
  background: rgba(11, 17, 28, 0.86);
  backdrop-filter: blur(3px);
}
.chat-history-list {
  flex: 1 1 0; min-height: 0; overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
}
.chat-hist-empty {
  color: #94a3b8; font-size: 13.5px; padding: 10px 12px;
  background: rgba(30, 41, 59, 0.55); border-radius: 8px; border: 1px dashed #334155;
}
.chat-hist-item {
  background: rgba(15, 23, 42, 0.85); color: #f1f5f9;
  padding: 6px 12px; border-left: 3px solid #38bdf8; border-radius: 0 6px 6px 0;
  font-size: 13.5px; line-height: 1.45;
}
.chat-hist-item.cmd {
  border-left-color: #fbbf24; color: #fef08a;
  font-family: Menlo, Consolas, monospace; font-weight: 700;
}
.chat-hist-item.err {
  background: rgba(153, 27, 27, 0.85); border-left-color: #fca5a5; color: #fff;
}
.chat-pills-row {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid #263449;
}
.chat-pills-label { font-size: 12px; font-weight: 700; color: #93c5fd; white-space: nowrap; }
.cmd-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmd-pill {
  height: 26px; padding: 0 10px; border-radius: 13px;
  border: 1px solid #3b82f6; background: rgba(37, 99, 235, 0.30);
  color: #dbeafe; font-family: Menlo, Consolas, monospace; font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s;
}
.cmd-pill:hover { background: #2563eb; color: #fff; transform: translateY(-1px); }
.cmd-pill small { font-weight: 400; opacity: .85; margin-left: 3px; font-family: sans-serif; }
.cmd-empty { font-size: 12px; color: #94a3b8; }
.chat-form-full {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #0f172a;
  border-top: 1px solid #334155;
}
.chat-form-full input {
  flex: 1; min-width: 120px; height: 38px; padding: 0 12px;
  border: 1.5px solid #475569; border-radius: 6px;
  background: #090e17; color: #fff; font-size: 15px;
  font-family: Menlo, Consolas, "Hiragino Sans", sans-serif;
}
.chat-form-full input::placeholder { color: #7c8da5; font-size: 13px; }
.chat-form-full input:focus { outline: none; border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35); }
.btn-chat {
  height: 38px; padding: 0 16px; background: #2563eb; color: #fff;
  border-color: #1d4ed8; font-weight: 700; font-size: 13.5px;
}
.btn-chat:hover { background: #1d4ed8; }

/* ===== Cキー：BPコードエディタ ===== */
#editorPanel { z-index: 32; background: #f2f4f8; }
#editorPanel[hidden] {
  display: flex !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}
.tabs {
  flex: 0 0 42px; display: flex; align-items: center; gap: 8px;
  padding: 0 10px; background: #162438; color: #e2e8f0;
  border-bottom: 2px solid #ea580c; overflow: hidden;
}
.mc-badge {
  flex-shrink: 0; font-weight: 800; font-size: 12px; letter-spacing: .03em;
  padding: 3px 8px; border-radius: 5px; background: #ea580c; color: #fff7ed; white-space: nowrap;
}
.mc-switch {
  flex-shrink: 0; display: inline-flex; background: #0f172a; padding: 3px; border-radius: 7px; border: 1px solid #303b4d;
}
.tab {
  height: 26px; padding: 0 11px; border: 0; border-radius: 5px;
  background: transparent; color: #cbd5e1; font-size: 12.5px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
}
.tab:hover { color: #fff; }
.tab.active { background: #2563eb; color: #fff; font-weight: 700; }
.tab-note { flex: 1 1 0; min-width: 0; text-align: right; font-size: 11.5px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-speed {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: #cbd5e1; white-space: nowrap;
}
.mc-speed select {
  height: 27px; padding: 0 6px; border-radius: 5px;
  border: 1px solid #475569; background: #0f172a; color: #f8fafc; font-size: 12px;
}
.btn-mc-run {
  flex-shrink: 0; height: 28px; padding: 0 13px; background: #22a047; color: #fff;
  border-color: #1b873b; font-weight: 700; font-size: 12.5px; border-radius: 14px;
}
.btn-mc-run:hover { background: #1b873b; }
#editorBody { position: relative; flex: 1 1 0; min-height: 0; }
#blocklyDiv { position: absolute; inset: 0; }
#codeView {
  position: absolute; inset: 0; margin: 0; padding: 12px 14px; overflow: auto;
  background: #1a1f2c; color: #e2e8f0; font-family: Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.55;
}

/* ===== ⌨ キーの詳細 ===== */
.keyhelp-overlay {
  z-index: 35;
  background: rgba(12, 19, 31, 0.94);
  backdrop-filter: blur(4px);
  color: #f1f5f9;
}
.keyhelp-body {
  flex: 1 1 0; min-height: 0; overflow-y: auto;
  padding: 14px 16px 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}
.keyhelp-card {
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px 14px;
}
.keyhelp-card-wide { grid-column: 1 / -1; }
.keyhelp-card h4 {
  margin: 0 0 9px; font-size: 14px; color: #fde047;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25); padding-bottom: 5px;
}
.keyhelp-list { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.keyhelp-list-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.keyhelp-list > div { display: flex; align-items: flex-start; gap: 10px; font-size: 12.5px; line-height: 1.45; }
.keyhelp-list dt { flex: 0 0 122px; font-weight: 700; color: #e2e8f0; }
.keyhelp-list dd { margin: 0; flex: 1; color: #cbd5e1; }
.keyhelp-list kbd, .keyhelp-tip kbd {
  display: inline-block; min-width: 22px; text-align: center;
  padding: 1px 6px; margin-right: 2px; border-radius: 4px;
  background: #0f172a; border: 1px solid #64748b; box-shadow: 0 1px 0 #475569;
  color: #f8fafc; font-family: Menlo, Consolas, monospace; font-size: 11.5px; font-weight: 700;
}
.keyhelp-list code {
  padding: 1px 5px; border-radius: 4px; background: #0f172a; color: #fef08a;
  font-family: Menlo, Consolas, monospace; font-size: 12px;
}
.keyhelp-tip {
  margin-top: 10px; padding: 8px 10px; border-radius: 7px;
  background: rgba(234, 88, 12, 0.22); border: 1px solid rgba(251, 146, 60, 0.55);
  font-size: 12px; color: #ffedd5; line-height: 1.5;
}

/* Blockly ツールボックス */
.blocklyToolboxDiv {
  background-color: #1a273b !important;
  color: #fff !important;
  border-right: 1px solid #0f172a;
  padding-top: 4px;
}
.blocklyTreeRow {
  height: 31px !important;
  line-height: 31px !important;
  margin: 2px 6px !important;
  padding-left: 8px !important;
  padding-right: 10px !important;
  border-radius: 6px;
}
.blocklyTreeRow:hover { background-color: rgba(255, 255, 255, 0.14) !important; }
.blocklyTreeLabel {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #fff !important;
}

/* ===== 右ペイン（教室ミッション＆クイック操作バー） ===== */
.pane-title {
  flex: 0 0 auto; min-height: 44px; display: flex; align-items: center; padding: 6px 14px;
  background: #eff3f8; border-bottom: 1px solid #cbd5e1;
  color: #162947; font-weight: 900; font-size: 16px; line-height: 1.5;
}
.puzzle-action-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 8px 12px; background: #fff7ed; border-bottom: 1px solid #fed7aa;
}
.btn-summon {
  min-height: 36px; height: auto; padding: 4px 12px; font-size: 14px; font-weight: 800; line-height: 1.4;
  background: #ea580c; color: #fff; border-color: #c2410c;
}
.btn-summon:hover { background: #c2410c; }
.btn-warp {
  min-height: 36px; height: auto; padding: 4px 11px; font-size: 13.8px; font-weight: 800; line-height: 1.4;
  background: #eff6ff; color: #1d4ed8; border-color: #93c5fd;
}
.btn-warp:hover { background: #dbeafe; }
.btn-reset-room {
  min-height: 36px; height: auto; padding: 4px 11px; font-size: 13.8px; font-weight: 800; line-height: 1.4;
  background: #f8fafc; color: #475569; border-color: #cbd5e1;
}
.btn-reset-room:hover { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

#lessonScroll { flex: 1 1 0; overflow-y: auto; padding: 13px 15px 24px; }

.room-loadout-box {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 11px;
  border-radius: 9px; background: #f8fafc; border: 1.5px solid #cbd5e1;
  font-size: 14px; line-height: 1.75; color: #334155;
}
.room-loadout-title { font-weight: 800; color: #1e293b; }
.loadout-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 12px;
  background: #fff; border: 1px solid #94a3b8;
  font-weight: 800; font-size: 13.5px; line-height: 1.5; color: #0f172a;
}
.loadout-chip img { width: 17px; height: 17px; }

#lessonBody { line-height: 1.92; font-size: 16.5px; color: #0f172a; }
#lessonBody p { margin: .5em 0; }
#lessonBody ol, #lessonBody ul { margin: .45em 0 .65em 1.35em; padding: 0; }
#lessonBody li { margin-bottom: .42em; }
#lessonBody code {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  background: #1e293b; color: #fef08a; font-family: Menlo, Consolas, monospace;
  font-size: 14.5px; font-weight: 800;
}
.stage-lead {
  padding: 12px 14px; margin-bottom: 12px;
  border-radius: 10px; background: #eff6ff; border: 2px solid #93c5fd;
  color: #1e3a8a; font-size: 16.5px; line-height: 1.9; font-weight: 700;
}
.stage-loc-badge {
  display: inline-block; padding: 5px 11px; margin-bottom: 9px;
  border-radius: 7px; background: #fff7ed; border: 1.5px solid #fb923c;
  color: #9a3412; font-size: 14px; line-height: 1.55; font-weight: 800;
}
.cmd-step-card {
  padding: 11px 13px; margin-bottom: 10px;
  border-radius: 10px; background: #f8fafc; border: 1.5px solid #cbd5e1;
  font-size: 16px; line-height: 1.88;
}
.cmd-step-card p { margin: 5px 0 0; }
.cmd-step-card.goal-card { background: #f0fdf4; border-color: #86efac; }
.cmd-step-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 16.5px; font-weight: 800; }
.cmd-tag {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  background: #2563eb; color: #ffffff; font-size: 12.5px; font-weight: 800; letter-spacing: .03em;
}
.cmd-tag.goal { background: #16a34a; }

.sec { margin: 16px 0 8px; font-size: 17px; font-weight: 900; color: #162947; line-height: 1.55; }
#goalList { list-style: none; margin: 0; padding: 0; }
#goalList li { padding: 8px 11px; margin-bottom: 6px; border-radius: 8px; background: #f1f3f4; font-size: 15.5px; line-height: 1.82; font-weight: 700; }
#goalList li.ok { background: #e6f4ea; color: #137333; font-weight: 800; }
#goalList li.ok::before { content: "✅ "; }
#goalList li:not(.ok)::before { content: "⬜ "; }
#result { margin-top: 12px; padding: 12px 14px; border-radius: 9px; font-weight: 800; display: none; font-size: 16px; line-height: 1.85; }
#result.ok { display: block; background: #e6f4ea; color: #137333; }
#result.info { display: block; background: #e8f0fe; color: #174ea6; }
#result.ng { display: block; background: #fce8e6; color: #c5221f; }
.lesson-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.lesson-actions .btn { min-height: 40px; height: auto; padding: 5px 14px; font-size: 14.5px; font-weight: 800; }
#hintText { background: #fff8e1; border: 1.5px solid #fde68a; border-radius: 9px; padding: 11px 13px; font-size: 15.5px; line-height: 1.88; font-weight: 700; }
.note { font-size: 13.5px; line-height: 1.75; color: #5f6368; margin-top: 16px; }

/* ===== 拡大画面 ＆ 画面ズーム・ウィンドウ縮小対応 ===== */
body.fs #topbar { flex-basis: 44px; }
body.pseudo-fs #topbar { display: none; }
#loadStatus:empty { display: none; }

@media (max-width: 980px) {
  #topbar { gap: 5px; padding: 0 8px; flex-basis: 44px; }
  .brand { font-size: 13.5px; }
  .brand small, .nav-group label, .progress-bar { display: none; }
  #topbar .btn { height: 29px; padding: 0 8px; font-size: 12px; }
  #topbar select { height: 29px; font-size: 12px; }
  .top-badge-pill { padding: 2px 6px; font-size: 11px; }
}

@media (max-width: 700px) {
  #panes { flex-direction: column; }
  #leftPane {
    flex: 0 0 58% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
  }
  #vresizer { display: none; }
  #rightPane {
    flex: 1 1 42%;
    width: 100%;
    min-width: 0;
    border-top: 2px solid #cbd5e1;
  }
  .brand { max-width: 130px; }
  #progressText { display: none; }
  .hud-key-btn { height: 28px; padding: 0 8px; font-size: 11px; }
  .keyhelp-body, .keyhelp-list-2col { grid-template-columns: 1fr; }
}

/* ===== インベントリ・トランク・看板モーダル ===== */
[hidden] { display: none !important; }

.inv-modal {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(10, 15, 24, 0.62);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  user-select: none;
}
.inv-dialog {
  width: 522px; max-width: 96vw; max-height: 94vh;
  display: flex; flex-direction: column;
  background: #c6c6c6;
  border: 3px solid #373737;
  box-shadow: inset 3px 3px 0 #ffffff, inset -3px -3px 0 #555555, 0 18px 42px rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  color: #1f2328;
  overflow: hidden;
}
.inv-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px;
  background: #1a2942; color: #f8fafc;
  border-bottom: 2px solid #ea580c;
}
.inv-title-wrap { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.inv-title { font-weight: 800; font-size: 14.5px; letter-spacing: .02em; }
.inv-treasure-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 12px;
  background: rgba(250, 204, 21, 0.18); border: 1px solid #facc15;
  color: #fde047; font-size: 12px; font-weight: 700;
}
.inv-tabs { display: inline-flex; gap: 3px; background: #0f172a; padding: 3px; border-radius: 6px; }
.inv-tab {
  height: 26px; padding: 0 9px; border: 0; border-radius: 4px;
  background: transparent; color: #cbd5e1; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.inv-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.inv-tab.active { background: #ea580c; color: #fff; }
.inv-close {
  width: 28px; height: 28px; border: 1px solid #475569; border-radius: 6px;
  background: #334155; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
}
.inv-close:hover { background: #dc2626; border-color: #b91c1c; }

.inv-body {
  padding: 10px 14px 8px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.inv-section {
  background: #b8b8b8;
  border: 2px solid #7a7a7a;
  box-shadow: inset 1px 1px 0 #dcdcdc;
  border-radius: 6px;
  padding: 7px 10px 9px;
}
.inv-player-sec { background: #bdbdbd; }
.inv-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 12px; font-weight: 700; color: #26292e;
  margin-bottom: 5px;
}
.hotbar-head { margin-top: 8px; }
.inv-subhint { font-size: 11px; font-weight: 400; color: #3f4650; }
.inv-hover-name {
  font-size: 12px; font-weight: 800; color: #0f4c81;
  background: rgba(255, 255, 255, 0.65); padding: 1px 7px; border-radius: 4px;
  min-height: 18px;
}
.inv-hover-name:empty { display: none; }
.inv-sec-tools { display: flex; align-items: center; gap: 5px; }
.btn-takeall {
  height: 25px; padding: 0 10px; font-size: 12px; font-weight: 700;
  background: #15803d; color: #fff; border-color: #166534;
}
.btn-takeall:hover { background: #166534; }
.btn-reset-inv {
  height: 24px; padding: 0 8px; font-size: 11.5px;
  background: #f1f5f9; color: #334155; border-color: #94a3b8;
}
.btn-reset-inv:hover { background: #e2e8f0; }

.mc-grid {
  display: grid;
  grid-template-columns: repeat(9, 46px);
  gap: 4px;
  justify-content: center;
}
.mc-slot {
  position: relative;
  width: 46px; height: 46px;
  background: #8b8b8b;
  border-top: 2px solid #373737;
  border-left: 2px solid #373737;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.mc-slot:hover { background: #a3b1c6; outline: 2px solid #f8fafc; z-index: 2; }
.mc-slot.active { background: #9aaec9; outline: 2.5px solid #facc15; z-index: 1; }
.mc-slot.agent-active { background: #8fb89d; outline: 2.5px solid #22c55e; z-index: 1; }
.mc-slot.treasure { background: #7c6f52; box-shadow: inset 0 0 8px rgba(250, 204, 21, 0.45); }
.mc-slot img {
  width: 34px; height: 34px;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.mc-count {
  position: absolute; right: 2px; bottom: 1px;
  font-family: Menlo, Consolas, monospace;
  font-size: 11.5px; font-weight: 800; line-height: 1;
  color: #ffffff;
  text-shadow: 1px 1px 0 #111827, -1px -1px 0 #111827, 1px -1px 0 #111827, -1px 1px 0 #111827;
  pointer-events: none;
}
.mc-key {
  position: absolute; left: 2px; top: 1px;
  padding: 0 3px; border-radius: 3px;
  font-family: Menlo, Consolas, monospace;
  font-size: 9.5px; font-weight: 700; line-height: 1.25;
  color: #e2e8f0; background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
}
.mc-key:hover { background: #2563eb; color: #fff; }
.mc-slot.agent-active .mc-key { background: #15803d; color: #fff; }
.mc-slot.active .mc-key { background: #ca8a04; color: #fff; }

.inv-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px;
  padding: 6px 12px;
  background: #1a2942; color: #cbd5e1;
  font-size: 11px;
  border-top: 1px solid #0f172a;
}
.inv-cursor {
  position: fixed; left: 0; top: 0;
  width: 42px; height: 42px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.inv-cursor img {
  width: 38px; height: 38px;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}

/* ===== 看板モーダル ===== */
.sign-modal {
  position: fixed; inset: 0; z-index: 1250;
  background: rgba(10, 15, 24, 0.58);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.sign-dialog {
  width: 450px; max-width: 94vw;
  display: flex; flex-direction: column;
  background: #3d2814;
  border: 3px solid #1f1308;
  box-shadow: inset 2px 2px 0 #704b27, inset -2px -2px 0 #261709, 0 20px 44px rgba(0, 0, 0, 0.58);
  border-radius: 10px;
  color: #fff8ee;
  overflow: hidden;
  animation: signPopIn 0.14s ease-out;
}
@keyframes signPopIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.sign-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  background: #2b1b0e;
  border-bottom: 2px solid #1a0f07;
}
.sign-title { font-weight: 800; font-size: 15px; color: #fde68a; letter-spacing: .03em; }
.sign-coord {
  margin-right: auto;
  font-family: Menlo, Consolas, monospace;
  font-size: 11.5px; color: #d6bfa2;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px; border-radius: 10px;
}
.sign-body {
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
  max-height: 70vh; overflow-y: auto;
}
.sign-board {
  position: relative;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(120, 74, 28, 0.0) 0px,
      rgba(120, 74, 28, 0.0) 31px,
      rgba(92, 54, 18, 0.22) 32px,
      rgba(255, 236, 198, 0.22) 33px
    ),
    linear-gradient(180deg, #e5bf82 0%, #d5a968 100%);
  border: 3px solid #6b441e;
  box-shadow: inset 2px 2px 0 #f4dbb0, inset -2px -2px 0 #a97b3f, 0 4px 10px rgba(0, 0, 0, 0.30);
  border-radius: 6px;
  padding: 16px 18px;
  text-align: center;
}
.sign-board.is-target { outline: 2px solid #facc15; }
.sign-line {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.65;
  color: #261406;
  text-shadow: 0 1px 0 rgba(255, 244, 220, 0.65);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.sign-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px;
  background: #2b1b0e;
  border-top: 1px solid #1a0f07;
}
.sign-footer-hint { font-size: 11.5px; color: #d6bfa2; }
.btn-sign-ok {
  height: 30px; padding: 0 14px;
  font-size: 12.5px; font-weight: 800;
  background: #f59e0b; color: #1f1308; border-color: #d97706;
}
.btn-sign-ok:hover { background: #fbbf24; }
