:root{
  --bg:#12201a;
  --panel:#1b2c22;
  --panel-strong:#223828;
  --wood:#7a5233;
  --wood-dark:#5b3c26;
  --chalk:#f4f1e4;
  --chalk-dim:#a9bdb0;
  --yellow:#e8c547;
  --red:#d1495b;
  --mint:#6fae7f;
  --blue:#6a93c2;
}
*{box-sizing:border-box;}
html,body{height:100% !important;margin:0 !important;padding:0 !important;overflow:hidden !important;background:var(--bg) !important;}
/* 画面内のテキストを選択不可にする(長押しでの選択・iOSのコールアウトメニューを防ぐ)。
   bodyだけでなく*にも明示しておく(動的に生成されるメッセージログ等も含め漏れなく)。 */
body.trivi-dungeon-page, body.trivi-dungeon-page *{
  -webkit-user-select:none;-moz-user-select:none;user-select:none;
  -webkit-touch-callout:none;
}
body.trivi-dungeon-page{
  font-family:'Noto Sans JP',system-ui,sans-serif;
  color:var(--chalk);
  -webkit-tap-highlight-color:transparent;
}
#gameCanvas{position:fixed;inset:0;width:100%;height:100%;display:block;background:var(--bg);touch-action:none;}

#ui{position:fixed;inset:0;display:flex;flex-direction:column;justify-content:space-between;padding:12px;pointer-events:none;gap:8px;z-index:2;}
/* ボタンの連打でブラウザ標準のダブルタップズームが起きないようにする(viewportの
   user-scalable=noと合わせた二重の対策)。300msのタップ遅延も無くなり反応も良くなる。 */
#ui button, .screen button{touch-action:manipulation;}
.hud-row{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;flex-wrap:wrap;}

.panel{
  background:linear-gradient(180deg,var(--panel-strong),var(--panel));
  border:2px solid rgba(244,241,228,0.18);
  border-radius:10px;
  box-shadow:0 6px 16px rgba(0,0,0,0.35);
  pointer-events:auto;
}

/* 視点の角度切り替え: 左上(階数チップの下)に十字に並べた小さなボタン */
.view-ctrl{
  position:fixed;left:12px;top:84px;z-index:3;
  display:grid;grid-template-columns:repeat(3,30px);grid-template-rows:repeat(3,30px);gap:3px;
  pointer-events:auto;opacity:0.72;
}
.view-ctrl button{
  background:rgba(10,16,13,0.6);border:1px solid rgba(244,241,228,0.28);color:var(--chalk);
  border-radius:8px;font-size:calc(12px * var(--ts,1));line-height:1;padding:0;cursor:pointer;touch-action:manipulation;
}
.view-ctrl button:active{background:rgba(244,241,228,0.22);}
.view-ctrl .vc-up{grid-column:2;grid-row:1;}
.view-ctrl .vc-left{grid-column:1;grid-row:2;}
.view-ctrl .vc-reset{grid-column:2;grid-row:2;}
.view-ctrl .vc-right{grid-column:3;grid-row:2;}
.view-ctrl .vc-down{grid-column:2;grid-row:3;}
.view-ctrl button.is-off{opacity:0.35;}
.floor-chip{padding:7px 14px;}
.floor-chip .floor{font-size:calc(12px * var(--ts,1));color:var(--chalk-dim);}
.stat-line{display:flex;align-items:center;gap:6px;font-size:calc(11px * var(--ts,1));margin-top:5px;}
.stat-line:first-child{margin-top:0;}
.stat-label{width:46px;flex:none;color:var(--chalk-dim);letter-spacing:0.5px;}
.bar-track{position:relative;flex:1;height:16px;border-radius:5px;background:rgba(0,0,0,0.35);overflow:hidden;border:1px solid rgba(244,241,228,0.15);}
.bar-fill{height:100%;border-radius:5px;transition:width 0.25s ease;}
.bar-fill.hp{background:linear-gradient(90deg,#8fd19e,var(--mint));}
.bar-fill.hp.low{background:linear-gradient(90deg,#e08a95,var(--red));}
.bar-fill.focus{background:linear-gradient(90deg,#f3da8b,var(--yellow));}
.bar-fill.focus.low{background:linear-gradient(90deg,#e08a95,var(--red));}
.bar-fill.exp{background:linear-gradient(90deg,#8fb4dd,var(--blue));}
/* ゲージの幅に関わらず常に中央に読める、ゲージ内に埋め込んだ現在地/最大値の数字 */
.bar-num-inline{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  font-variant-numeric:tabular-nums;font-size:calc(10px * var(--ts,1));color:var(--chalk);
  text-shadow:0 1px 2px rgba(0,0,0,0.7);pointer-events:none;
}

/* キャラクターの頭上(カメラが映すキャラの位置の少し上)に常時浮かせる、ごく小さい
   HP/満腹度ゲージ。#uiのflexレイアウトの影響を受けないよう独立して固定配置する。 */
.vitals-hud{
  position:fixed;left:50%;top:40%;transform:translateX(-50%);
  width:140px;pointer-events:none;z-index:2;
  display:flex;flex-direction:column;gap:3px;
  background:rgba(10,16,13,0.5);border:1px solid rgba(244,241,228,0.1);
  border-radius:8px;padding:4px 6px;
}
.vitals-hud .stat-label{width:calc(30px * var(--ts,1));white-space:nowrap;font-size:calc(9px * var(--ts,1));}
.vitals-hud .bar-track{height:12px;}
.vitals-hud .bar-num-inline{font-size:calc(8.5px * var(--ts,1));}

.hud-top-right{display:none;flex-direction:column;align-items:flex-end;gap:8px;}
@media (min-width:760px){
  /* ショートカットの数字キーなど、キーボード操作前提の補助パネルはデスクトップ幅でだけ
     常時表示する(スマホでは画面下のメニューボタンで代替する)。 */
  .hud-top-right{display:flex;}
}
.inventory-panel{padding:8px;display:flex;flex-direction:column;gap:5px;width:198px;}

/* デフォルトで画面全体に重ねておく半透明のミニマップ(常時表示)。操作対象ではないので
   pointer-events:noneにし、ゲーム画面側のタップ/スワイプを妨げないようにする。
   「マップ」ボタンで開く#mapScreen(黒背景の拡大表示)とは別物。 */
#minimapOverlay{
  position:fixed;inset:0;z-index:1;
  display:flex;align-items:center;justify-content:center;
  pointer-events:none;opacity:0.26;
}
#minimapOverlay #minimapCanvas{
  max-width:94vw;max-height:94vh;image-rendering:pixelated;
}
.inventory-title{font-size:calc(10px * var(--ts,1));color:var(--chalk-dim);letter-spacing:1px;padding:0 4px 2px;display:flex;justify-content:space-between;gap:6px;}
.inventory-title #invCountLabel{font-variant-numeric:tabular-nums;color:var(--chalk);}
.inventory-hint{font-size:calc(9.5px * var(--ts,1));color:rgba(169,189,176,0.6);padding:2px 4px 0;text-align:right;}
.inv-slot{
  display:flex;align-items:center;gap:8px;
  background:rgba(0,0,0,0.22);border:1px solid rgba(244,241,228,0.14);
  border-radius:7px;padding:5px 8px;cursor:pointer;font-size:calc(11px * var(--ts,1));
}
.inv-slot:hover{background:rgba(244,241,228,0.1);}
.inv-slot.empty{color:rgba(169,189,176,0.45);cursor:default;}
.inv-slot.empty:hover{background:rgba(0,0,0,0.22);}
.inv-num{width:14px;flex:none;color:var(--chalk-dim);font-variant-numeric:tabular-nums;}
.inv-swatch{width:14px;height:14px;border-radius:4px;flex:none;}
.item-icon{display:inline-flex;align-items:center;justify-content:center;width:18px !important;height:18px !important;background:none !important;border-radius:0 !important;}
.item-icon svg{display:block;filter:drop-shadow(0 0 1px rgba(0,0,0,.6));}
.item-popup{position:fixed;inset:0;z-index:3000;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,0.55);}
.item-popup-card{width:100%;max-width:360px;max-height:86vh;overflow:auto;background:#1d2b25;border:1px solid rgba(244,241,228,0.25);border-radius:12px;padding:14px 16px;box-shadow:0 8px 28px rgba(0,0,0,0.5);color:#f4f1e4;font-size:calc(13px * var(--ts,1));}
.item-popup-head{display:flex;align-items:center;gap:8px;margin-bottom:8px;}
.item-popup-name{font-size:calc(16px * var(--ts,1));font-weight:bold;}
.item-popup-swatch{width:22px;height:22px;border-radius:5px;flex:none;}
.item-popup-swatch.item-icon{width:26px !important;height:26px !important;}
.item-popup-swatch.item-icon svg{width:26px;height:26px;}
.item-popup-desc{margin:0 0 8px;line-height:1.7;}
.item-popup-line{margin:0 0 6px;font-size:calc(12px * var(--ts,1));color:#a9bdb0;}
.item-popup-actions{display:flex;flex-direction:column;gap:6px;margin:10px 0 8px;}
.item-popup-actions .inv-actions{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;background:none;border:none;}
.item-popup-actions .shop-btn:disabled{opacity:0.4;cursor:not-allowed;}
.item-popup .item-popup-close{width:100%;background:transparent;color:#a9bdb0;border:1px solid rgba(244,241,228,0.25);}
.inv-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.inv-slot:focus-visible{outline:2px solid var(--yellow);outline-offset:2px;}

.bottom-left-cluster{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0;max-width:520px;}
.bottom-nav{display:flex;gap:6px;pointer-events:auto;}
.bottom-nav button{
  flex:1;background:var(--panel-strong);border:2px solid rgba(244,241,228,0.18);border-radius:8px;
  color:var(--chalk);font-size:calc(9.5px * var(--ts,1));line-height:1.4;padding:5px 4px;text-align:center;
  box-shadow:0 3px 0 rgba(0,0,0,0.35);
}
.bottom-nav button:active{transform:translateY(2px);box-shadow:0 1px 0 rgba(0,0,0,0.35);}
.bottom-nav button:focus-visible{outline:2px solid var(--yellow);outline-offset:2px;}

.hud-bottom-stack{display:flex;flex-direction:column;gap:6px;width:100%;}
/* メッセージ: 画面下部UIの最上段に端から端まで、常に4行ぶんの高さ(新しいものが下。古い行は上へ送られる) */
.message-log{
  box-sizing:border-box;width:100%;min-width:0;padding:6px 12px;
  height:calc(4 * 1.6em + 12px);overflow:hidden;font-size:calc(12px * var(--ts,1));line-height:1.6;
  color:var(--chalk-dim);cursor:pointer;
}
.message-log p{margin:0;}
.message-log p.recent{color:var(--chalk);}
.message-log::-webkit-scrollbar{width:6px;}
.message-log::-webkit-scrollbar-thumb{background:rgba(244,241,228,0.25);border-radius:3px;}

.controls-cluster{display:flex;flex-direction:column;align-items:flex-end;gap:8px;pointer-events:auto;}
.action-buttons{display:flex;gap:6px;}
.action-btn{
  background:var(--panel-strong);border:2px solid rgba(244,241,228,0.18);border-radius:8px;
  color:var(--chalk);font-size:calc(11px * var(--ts,1));line-height:1.3;padding:7px 14px;text-align:center;
  box-shadow:0 3px 0 rgba(0,0,0,0.35);
}
.action-btn:active{transform:translateY(2px);box-shadow:0 1px 0 rgba(0,0,0,0.35);}
.action-btn:focus-visible{outline:2px solid var(--yellow);outline-offset:2px;}
.action-btn.attack-btn{border-color:var(--red);color:var(--red);}
.action-btn.wait-btn{border-color:var(--yellow);color:var(--yellow);}
.action-btn.look-btn{border-color:var(--blue,#6a93c2);color:var(--blue,#6a93c2);}

.facing-ring{position:fixed;left:0;top:0;width:0;height:0;z-index:6;pointer-events:none;}
.facing-ring.hidden{display:none;}
.facing-btn{
  position:absolute;width:36px;height:36px;margin:-18px 0 0 -18px;
  border-radius:50%;background:var(--panel-strong);border:2px solid var(--yellow);
  color:var(--yellow);font-size:calc(16px * var(--ts,1));display:flex;align-items:center;justify-content:center;
  pointer-events:auto;box-shadow:0 3px 8px rgba(0,0,0,0.4);
}
.facing-btn:active{transform:scale(0.9);}
.facing-btn:focus-visible{outline:2px solid var(--chalk);outline-offset:2px;}
.dpad{
  display:grid;grid-template-columns:repeat(3,38px);grid-template-rows:repeat(3,38px);gap:4px;
  touch-action:none; /* 押しっぱなし判定をJS側で行うため、ブラウザの既定のタッチ挙動を無効にする */
}
.dpad button{
  background:var(--panel-strong);border:2px solid rgba(244,241,228,0.18);border-radius:8px;
  color:var(--chalk);font-size:calc(15px * var(--ts,1));display:flex;align-items:center;justify-content:center;
  box-shadow:0 3px 0 rgba(0,0,0,0.35);
}
.dpad button:active{transform:translateY(2px);box-shadow:0 1px 0 rgba(0,0,0,0.35);}
.dpad button:focus-visible{outline:2px solid var(--yellow);outline-offset:2px;}
.dpad .cell-upleft{grid-column:1;grid-row:1;}
.dpad .cell-up{grid-column:2;grid-row:1;}
.dpad .cell-upright{grid-column:3;grid-row:1;}
.dpad .cell-left{grid-column:1;grid-row:2;}
.dpad .cell-face{grid-column:2;grid-row:2;color:var(--yellow);font-size:calc(13px * var(--ts,1));}
.dpad .cell-face.facing-armed{background:var(--yellow);color:#2a2410;}
.dpad .cell-right{grid-column:3;grid-row:2;}
.dpad .cell-downleft{grid-column:1;grid-row:3;}
.dpad .cell-down{grid-column:2;grid-row:3;}
.dpad .cell-downright{grid-column:3;grid-row:3;}

.screen{
  position:fixed;inset:0;display:flex;align-items:center;justify-content:center;
  background:rgba(10,16,13,0.82);backdrop-filter:blur(2px);pointer-events:auto;padding:24px;z-index:5;
}
.screen.hidden{display:none;}
/* ステータス・持ち物はプレイ中に頻繁に開閉するため、下のゲーム画面が透けて見える
   半透明にしておく(タイトル画面・ゲームオーバー画面のような、じっくり読ませたい
   画面とは違い、さっと確認してすぐ閉じる用途のため)。 */
#statusScreen, #inventoryScreen, #stairScreen{background:rgba(10,16,13,0.4);backdrop-filter:blur(1px);}
.card{
  background:linear-gradient(180deg,var(--panel-strong),var(--panel));
  border:3px solid var(--wood);border-radius:16px;
  padding:32px 28px;max-width:440px;width:100%;text-align:center;
  box-shadow:0 20px 50px rgba(0,0,0,0.5);
}
/* 探索のリザルトは項目が多いので、画面に収まらない時はカードの中でスクロールする */
.run-result-card{max-height:calc(100vh - 48px);overflow-y:auto;}
.card h1{
  font-family:'Yomogi',sans-serif;font-size:clamp(28px,7vw,38px);color:var(--yellow);
  margin:0 0 4px;text-wrap:balance;
}
.card .sub{font-size:calc(12px * var(--ts,1));color:var(--chalk-dim);margin:0 0 18px;letter-spacing:1px;}
.card h1.menu-heading{font-family:'Yomogi',sans-serif;font-size:calc(22px * var(--ts,1));color:var(--chalk);margin:0 0 16px;padding-bottom:10px;border-bottom:1px dashed rgba(244,241,228,0.25);letter-spacing:1px;}
.card p.flavor{font-size:calc(13px * var(--ts,1));line-height:1.8;color:var(--chalk);text-align:left;margin:0 0 18px;padding:12px 14px;background:rgba(0,0,0,0.22);border-radius:10px;border:1px dashed rgba(244,241,228,0.3);}
.card .howto{text-align:left;font-size:calc(11.5px * var(--ts,1));color:var(--chalk-dim);line-height:1.9;margin:0 0 18px;padding:0 4px;}
.card .howto b{color:var(--chalk);}
.card .save-policy{text-align:left;font-size:calc(11.5px * var(--ts,1));line-height:1.8;color:var(--chalk-dim);margin:0 0 10px;padding:8px 10px;background:rgba(106,147,194,0.12);border:1px solid rgba(106,147,194,0.35);border-radius:8px;}
.card .save-policy b{color:var(--blue);}
.card .auth-status{font-size:calc(11.5px * var(--ts,1));color:var(--chalk-dim);margin:0 0 16px;line-height:1.7;}
.card .auth-status a{color:var(--yellow);}
.card .save-note{font-size:calc(11px * var(--ts,1));color:var(--chalk-dim);margin:-6px 0 18px;}
#titleLoginBtn{text-decoration:none;display:inline-block;}
.hub-status{text-align:left;font-size:calc(13px * var(--ts,1));line-height:2;color:var(--chalk);margin:0 0 16px;padding:10px 12px;background:rgba(0,0,0,0.2);border-radius:8px;}
.dungeon-select-wrap{text-align:left;font-size:calc(12.5px * var(--ts,1));color:var(--chalk-dim);margin:0 0 16px;}
.dungeon-select-wrap.hidden{display:none;}
.dungeon-select-wrap select{
  background:rgba(0,0,0,0.25);color:var(--chalk);border:1px solid rgba(244,241,228,0.25);
  border-radius:6px;padding:6px 8px;font-size:calc(12.5px * var(--ts,1));margin-left:6px;
}
.hub-status b{color:var(--yellow);}
.card-wide{max-width:560px;}
.shop-coin{text-align:left;font-size:calc(14px * var(--ts,1));color:var(--chalk);margin:0 0 14px;}
.shop-coin b{color:var(--yellow);}
.shop-heading{font-family:'Yomogi',sans-serif;font-size:calc(16px * var(--ts,1));color:var(--chalk);text-align:left;margin:18px 0 8px;}
.equip-list{text-align:left;font-size:calc(12.5px * var(--ts,1));color:var(--chalk-dim);margin:0 0 8px;display:flex;flex-direction:column;gap:6px;}
.equip-item{display:flex;align-items:center;gap:8px;}
.equip-item span{color:var(--chalk);}
.btn-unequip{background:transparent;border:1px solid rgba(244,241,228,0.3);color:var(--chalk-dim);border-radius:6px;font-size:calc(10.5px * var(--ts,1));padding:2px 8px;cursor:pointer;}
.btn-unequip.hidden{display:none;}
/* 装備欄: 項目名(中央揃え)と装備名(左揃え)の縦列をそろえるための透明なテーブル */
.equip-table{border-collapse:collapse;background:transparent;border:none;margin:0 auto 8px;font-size:calc(12.5px * var(--ts,1));}
.equip-table th,.equip-table td{background:transparent;border:none;padding:3px 8px;vertical-align:middle;}
.equip-table th{text-align:center;font-weight:normal;color:var(--chalk-dim);white-space:nowrap;}
.equip-table td{text-align:left;color:var(--chalk);font-weight:700;}
.shop-list{display:flex;flex-direction:column;gap:6px;max-height:180px;overflow-y:auto;margin-bottom:6px;}
.shop-empty{font-size:calc(12px * var(--ts,1));color:var(--chalk-dim);text-align:left;margin:0;}
.shop-row{
  display:flex;align-items:center;gap:8px;text-align:left;
  background:rgba(0,0,0,0.2);border:1px solid rgba(244,241,228,0.12);
  border-radius:8px;padding:6px 10px;font-size:calc(12px * var(--ts,1));
}
.shop-swatch{width:14px;height:14px;border-radius:4px;flex:none;}
.shop-name{flex:1;min-width:0;color:var(--chalk);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.shop-name small{display:block;color:var(--chalk-dim);font-size:calc(10px * var(--ts,1));}
.shop-price{flex:none;font-variant-numeric:tabular-nums;color:var(--chalk-dim);font-size:calc(11px * var(--ts,1));}
.shop-btn{
  flex:none;background:var(--yellow);color:#2a2410;border:none;border-radius:6px;
  font-size:calc(11px * var(--ts,1));font-weight:700;padding:5px 10px;cursor:pointer;
}
.shop-btn:disabled{background:rgba(244,241,228,0.15);color:rgba(244,241,228,0.4);cursor:not-allowed;}
.shop-btn-sell{background:transparent;border:1px solid var(--red);color:var(--red);}
.shop-btn-equip{background:transparent;border:1px solid var(--blue);color:var(--blue);}
.inv-full-list{max-height:min(560px,60vh);}
.inv-row{cursor:pointer;}
.inv-row.selected{border-color:var(--yellow);background:rgba(232,197,71,0.12);}
.inv-row.inv-floor{border-style:dashed;border-color:rgba(106,147,194,0.6);}
.inv-floor-badge{display:inline-block;margin-right:6px;padding:0 6px;border-radius:999px;font-size:calc(10px * var(--ts,1));line-height:16px;font-weight:700;color:#0d1a14;background:var(--blue,#6a93c2);vertical-align:middle;}
.inv-actions{display:flex;flex-wrap:wrap;gap:6px;margin:-2px 0 8px;padding:8px 10px;background:rgba(232,197,71,0.08);border:1px solid rgba(232,197,71,0.35);border-radius:8px;}
.inv-actions .shop-btn:disabled{opacity:0.4;cursor:not-allowed;}
.inv-shortcut-badge{
  flex:none;width:18px;height:18px;border-radius:5px;background:var(--yellow);color:#2a2410;
  font-size:calc(10px * var(--ts,1));font-weight:700;display:flex;align-items:center;justify-content:center;
}
.inv-hint{font-size:calc(11px * var(--ts,1));color:var(--chalk-dim);text-align:left;margin:4px 0 16px;}
.card .stats-final{text-align:left;font-size:calc(13px * var(--ts,1));line-height:2;color:var(--chalk);margin:0 0 14px;}
.card .stats-final b{color:var(--yellow);float:right;font-variant-numeric:tabular-nums;}
.title-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;}
.back-to-site{margin:16px 0 0;text-align:center;}
.back-to-site a{color:var(--chalk-dim);font-size:calc(11.5px * var(--ts,1));text-decoration:none;}
.back-to-site a:hover{color:var(--chalk);text-decoration:underline;}
.btn-main{
  font-family:'Noto Sans JP',sans-serif;font-weight:700;font-size:calc(16px * var(--ts,1));
  background:var(--yellow);color:#2a2410;border:none;border-radius:10px;
  padding:13px 30px;cursor:pointer;box-shadow:0 4px 0 #b89530;
}
.btn-main:active{transform:translateY(3px);box-shadow:0 1px 0 #b89530;}
.btn-main:focus-visible{outline:3px solid var(--chalk);outline-offset:2px;}
.btn-main.btn-ghost{background:transparent;color:var(--yellow);border:2px solid var(--yellow);box-shadow:none;padding:11px 24px;}
.btn-main.btn-ghost:active{transform:translateY(2px);}
.btn-main.hidden{display:none;}

/* ダンジョンマップ(「マップ」ボタン/Mキー)は、常時表示の半透明ミニマップ(#minimapOverlay)
   とは違い、ゲーム画面を完全に隠した黒背景でミニマップだけに集中できる画面にする。 */
#mapScreen{background:#050a07;backdrop-filter:none;}
.map-overlay-content{text-align:center;display:flex;flex-direction:column;align-items:center;gap:14px;max-width:96vw;}
.map-heading{border-bottom:none;margin:0;text-shadow:0 2px 8px rgba(0,0,0,0.8);}
.map-overlay-content #mapFullCanvas{
  image-rendering:pixelated;border:3px solid var(--wood);border-radius:10px;
  box-shadow:0 20px 50px rgba(0,0,0,0.5);max-width:92vw;max-height:62vh;
  background:#0c1712;
}
.map-hint{font-size:calc(12px * var(--ts,1));color:var(--chalk-dim);margin:0;text-shadow:0 2px 8px rgba(0,0,0,0.8);}

.toast{
  position:fixed;top:38%;left:50%;transform:translate(-50%,-50%);
  font-family:'Yomogi',sans-serif;font-size:clamp(26px,6vw,40px);color:var(--yellow);
  text-shadow:0 2px 12px rgba(0,0,0,0.6);pointer-events:none;z-index:4;
  opacity:0;transition:opacity 0.5s ease;
}
.toast.show{opacity:1;}

@media (max-width:480px){
  .message-log{font-size:calc(11px * var(--ts,1));}
  .bottom-nav button{font-size:calc(8.5px * var(--ts,1));}
}
@media (prefers-reduced-motion: reduce){
  .bar-fill{transition:none;}
  .toast{transition:none;}
}

/* ---------- 図鑑(ずかん) ---------- */
.zukan-tabs{display:flex;gap:8px;margin-bottom:10px;}
.zukan-tab{
  flex:none;background:rgba(0,0,0,0.2);border:1px solid rgba(244,241,228,0.18);
  color:var(--chalk-dim);border-radius:8px;padding:6px 16px;font-size:calc(12px * var(--ts,1));cursor:pointer;
}
.zukan-tab.active{background:var(--yellow);color:#2a2410;font-weight:700;border-color:transparent;}
.zukan-list{max-height:400px;}
.zukan-row{align-items:flex-start;}
.zukan-row .shop-name{white-space:normal;overflow:visible;text-overflow:clip;}
.zukan-desc{margin:4px 0 0;font-size:calc(11px * var(--ts,1));color:var(--chalk-dim);line-height:1.5;}
.zukan-location{margin:4px 0 0;font-size:calc(10px * var(--ts,1));color:var(--mint);line-height:1.5;}
.zukan-unknown .shop-name{color:var(--chalk-dim);letter-spacing:2px;}
.zukan-swatch-unknown{background:rgba(244,241,228,0.12) !important;}

/* 名物タグ(「東京都の名物」): アイテム名の横に付く小さなラベル */
.specialty-tag{display:inline-block;margin-left:6px;padding:0 7px;border-radius:999px;font-size:calc(10px * var(--ts,1));font-weight:500;line-height:17px;
  color:#e8c547;background:rgba(232,197,71,0.16);border:1px solid rgba(232,197,71,0.45);vertical-align:middle;white-space:nowrap;}

/* 探索記録(リザルト)の表示と、死亡ペナルティの一覧。ダンジョン内の結果画面・ワールドマップの記録/ダンジョン情報で共通 */
.rr{text-align:left;}
.rr-title{font-size:calc(18px * var(--ts,1));line-height:1.45;margin:0 0 4px;text-align:center;font-weight:700;}
.rr-title.rr-death{color:#ff7b72;}
.rr-title.rr-clear{color:#7ee787;}
.rr-meta{font-size:calc(11px * var(--ts,1));color:var(--chalk-dim);text-align:center;margin:0 0 10px;}
.rr h3{font-size:calc(12px * var(--ts,1));color:var(--yellow,#e8c547);margin:12px 0 4px;font-weight:700;}
.rr .equip-table{margin:0;}
.rr .equip-table td{min-width:3em;}
.rr-items{list-style:none;margin:0;padding:0;font-size:calc(12.5px * var(--ts,1));display:flex;flex-direction:column;gap:2px;}
.rr-lost{color:var(--chalk-dim);text-decoration:line-through;}
.rr-none{color:var(--chalk-dim);}
.rr-sub{font-size:calc(11px * var(--ts,1));color:var(--chalk-dim);}
.rr-note{font-size:calc(11px * var(--ts,1));font-weight:400;color:#ff7b72;margin-left:6px;}
.rr-coins{margin:0;font-size:calc(13px * var(--ts,1));}
.rr-penalty p{margin:0 0 2px;font-size:calc(12.5px * var(--ts,1));line-height:1.55;}
.penalty-list{margin:6px 0 0;padding:0 0 0 1.2em;font-size:calc(12px * var(--ts,1));line-height:1.6;color:var(--chalk);}
.penalty-heading{margin:8px 0 0;font-size:calc(12px * var(--ts,1));font-weight:700;color:#ff7b72;}
.run-result-card{padding:22px 22px 20px;}
.run-result-card .save-note{margin:12px 0 10px;}

/* 状態異常・能力アップ/ダウンの表示(HP/満腹度ゲージの下)と、敵の技の予告メッセージ */
.status-chips{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px;min-height:0;}
.status-chips .chip{font-size:calc(10px * var(--ts,1));line-height:16px;padding:0 7px;border-radius:999px;font-weight:700;}
.status-chips .chip-bad{background:rgba(209,73,91,0.88);color:#fff;}
.status-chips .chip-good{background:rgba(111,174,127,0.9);color:#0d1a14;}
#messageLog p.warn{color:#ffab9e;font-weight:700;}
.stat-sub{color:var(--chalk-dim);font-weight:400;font-size:calc(11px * var(--ts,1));}
.action-btn.shoot-btn{border-color:var(--green,#7fbf7a);color:var(--green,#7fbf7a);}
.action-btn.shoot-btn.hidden{display:none;}
.action-btn.shoot-btn.disabled{opacity:.45;}

/* ダメージ・回復の数字ポップアップ(源ノ角ゴシック=Noto Sans JP。白縁取りではなく暗い縁取りで、どの背景でも読める) */
#popupLayer{position:fixed;left:0;top:0;width:0;height:0;z-index:20;pointer-events:none;}
.dmg-popup{position:fixed;transform:translate(-50%,-50%);font-family:'Source Han Sans JP','源ノ角ゴシック','Noto Sans JP',sans-serif;font-weight:900;line-height:1;white-space:nowrap;
  text-shadow:-1px -1px 0 #1a1410,1px -1px 0 #1a1410,-1px 1px 0 #1a1410,1px 1px 0 #1a1410,0 2px 4px rgba(0,0,0,.6);animation:dmgPopup 1s ease-out forwards;}
.dmg-popup.dmg-miss{font-weight:700;opacity:.9;}
@keyframes dmgPopup{0%{opacity:0;transform:translate(-50%,-30%) scale(.6);}15%{opacity:1;transform:translate(-50%,-60%) scale(1.15);}30%{transform:translate(-50%,-80%) scale(1);}100%{opacity:0;transform:translate(-50%,-190%) scale(1);}}
.setting-block{margin:14px 0 4px;padding-top:10px;border-top:1px dashed rgba(244,241,228,0.25);}
.setting-heading{font-size:calc(14px * var(--ts,1));margin:0 0 8px;color:var(--chalk);}
.setting-row{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;font-size:calc(13px * var(--ts,1));}
.setting-label{min-width:6em;}
.setting-row label{cursor:pointer;}

/* HP/満腹度ゲージ: 小さめ・ゲージの隙間は狭く。表示位置は設定(data-pos): head=頭上(既定) / top=画面上部 / bottom=画面下部(外側の余白2px) */
.vitals-hud{width:calc(120px * var(--ts,1));gap:1px;padding:2px 4px;} /* 文字を大きくした時は、ゲージの窓も同じ比率で広げる(満腹度が改行されないように) */
.vitals-hud .stat-line{margin-top:0;}
.vitals-hud .stat-label{width:calc(26px * var(--ts,1));white-space:nowrap;font-size:calc(8px * var(--ts,1));}
.vitals-hud .bar-track{height:10px;}
.vitals-hud .bar-num-inline{font-size:calc(7.5px * var(--ts,1));}
.vitals-hud .status-chips{margin-top:2px;}
.vitals-hud[data-pos="top"]{top:2px;}
.vitals-hud[data-pos="bottom"]{top:auto;bottom:2px;}
.status-stat-note{font-size:calc(10px * var(--ts,1));opacity:.7;margin:2px 0 8px;}
.setting-block{border-top:0;margin-top:6px;padding-top:0;}
.setting-row + .setting-row{margin-top:10px;}

.run-share{margin:10px 0 0;text-align:center;}
.run-share .btn-share{padding:8px 16px;font-size:calc(13px * var(--ts,1));}
.run-share .share-out{display:flex;gap:6px;align-items:center;margin-top:8px;flex-wrap:wrap;justify-content:center;}
.run-share .share-url{flex:1;min-width:180px;font-size:calc(12px * var(--ts,1));padding:7px 8px;border-radius:6px;border:1px solid rgba(244,241,228,.3);background:rgba(0,0,0,.35);color:var(--chalk,#f4f1e4);}
.run-share .share-out .btn-main{padding:7px 12px;font-size:calc(12px * var(--ts,1));}
.run-share .share-note{font-size:calc(11px * var(--ts,1));opacity:.75;margin:6px 0 0;}

/* 環境ルールのチップと、デバッグメニュー */
.env-chips{display:flex;flex-wrap:wrap;gap:3px;margin-top:3px;}
.env-chips:empty{display:none;}
.env-chip{font-size:calc(9.5px * var(--ts,1));line-height:15px;padding:0 6px;border-radius:999px;background:rgba(232,197,71,.88);color:#241c0c;font-weight:700;}
.debug-note{font-size:calc(12px * var(--ts,1));opacity:.8;margin:0 0 6px;}
.debug-enemy-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:6px;max-height:36vh;overflow:auto;margin:8px 0;}
.debug-enemy-list .debug-enemy{display:flex;flex-direction:column;align-items:center;font-size:calc(12px * var(--ts,1));padding:7px 6px;}
.debug-enemy-list small{opacity:.7;font-size:calc(10px * var(--ts,1));}
.debug-actions{flex-wrap:wrap;gap:6px;}
.run-share .hidden{display:none !important;}

/* HP/満腹度の下の、ボウガンの装填状態(矢のアイコン) */
.bow-state{display:flex;align-items:center;gap:3px;margin-top:2px;font-size:calc(9px * var(--ts,1));line-height:1;}
.bow-state.hidden{display:none;}
.bow-state .bow-icon{font-size:calc(11px * var(--ts,1));}
.bow-arrow.loaded{color:#ffd45a;filter:drop-shadow(0 0 2px rgba(255,212,90,.7));}
.bow-arrow.empty{color:rgba(244,241,228,.3);}
.bow-text.loaded{color:#ffd45a;font-weight:700;}
.bow-text.empty{color:rgba(244,241,228,.55);}
.bow-count{margin-left:auto;opacity:.8;}
.item-popup-actions .shop-btn,.item-popup .item-popup-close{padding:10px 18px;font-size:calc(14px * var(--ts,1));border-radius:8px;min-height:43px;}
.item-popup-actions .shop-btn{width:100%;}
/* キーボードが使えない端末(タッチ主体)では、キー操作の案内を隠し、タッチ向けの案内だけ出す */
.touch-only{display:none;}
.no-kbd .kbd-only{display:none !important;}
.no-kbd .touch-only{display:inline;}
/* スマホ(キーボードが使えない端末)では、1〜9のショートカットを廃止(押せないため)。道具は持ち物ボタンから使う */
.no-kbd .inventory-panel,.no-kbd .inv-shortcut-badge{display:none !important;}
.info-icon{width:24px;height:24px;border-radius:50%;border:1px solid rgba(244,241,228,0.4);background:transparent;color:var(--chalk-dim);font-size:calc(14px * var(--ts,1));line-height:1;cursor:pointer;padding:0;vertical-align:middle;}
/* 持ち物の1行は倉庫と同じ大きさ(行の高さ+3px・文字14px)。装備中の「E」は行の右端 */
#inventoryFullList .shop-row{font-size:calc(14px * var(--ts,1));padding:7px 10px;min-height:40px;}
.storage-equipped-badge{flex:none;width:20px;height:20px;border-radius:5px;background:var(--yellow);color:#2a2410;font-size:calc(11px * var(--ts,1));font-weight:700;display:flex;align-items:center;justify-content:center;}

/* スマホ(タッチ端末): 持ち物は20行(上限)が1画面に収まるように、行・余白を詰める */
@media (max-width:600px){
  #inventoryScreen{padding:6px;}
  #inventoryScreen .card{padding:8px 10px;max-height:calc(100dvh - 12px);overflow-y:auto;}
  #inventoryScreen .menu-heading{font-size:calc(15px * var(--ts,1));margin:0 0 2px;}
  #inventoryScreen .shop-coin{margin:0 0 4px;font-size:calc(12px * var(--ts,1));}
  #inventoryFullList{gap:2px;max-height:none;overflow:visible;margin-bottom:0;}
  #inventoryFullList .shop-row{box-sizing:border-box;flex:none;min-height:0;height:min(40px, calc((100dvh - 132px) / 20 + 1px));padding:0 8px;font-size:calc(13px * var(--ts,1));}
  #inventoryScreen .title-actions{margin-top:6px;}
  #inventoryScreen .title-actions .btn-main{padding:6px 14px;font-size:calc(13px * var(--ts,1));}
}
.bottom-left-cluster{max-width:none;}
/* メッセージ履歴(全画面) */
.log-card{display:flex;flex-direction:column;max-height:calc(100dvh - 48px);height:calc(100dvh - 48px);}
.log-history{flex:1;min-height:0;overflow-y:auto;text-align:left;font-size:calc(13px * var(--ts,1));line-height:1.7;color:var(--chalk);padding:4px 6px;-webkit-overflow-scrolling:touch;}
.log-history p{margin:0 0 4px;}
.log-history p.warn{color:var(--yellow);}
/* スマホ(タッチ端末)は、移動をスワイプで行うので方向ボタンは出さない(攻撃・足下・待機のボタンは残す) */
.no-kbd .dpad{display:none;}
/* スマホ(タッチ端末・狭い画面)の操作: 移動はスワイプ。方向キーは出さず、向き変更・方向の制限・ダッシュのトグルを出す */
.touch-ctrls{display:none;gap:6px;}
.no-kbd .touch-ctrls{display:flex;}
.tc-btn{min-width:54px;}
.tc-btn.facing-armed,.tc-btn.tc-on{background:var(--yellow);color:#2a2410;border-color:var(--yellow);}
.tc-btn.tc-restricted{border-color:var(--blue,#6a93c2);color:var(--blue,#6a93c2);}
@media (max-width:760px){
  .dpad{display:none;}
  .touch-ctrls{display:flex;}
}
/* メッセージ欄は画面の端から端まで(#uiの左右の余白を打ち消す)。操作ボタンの行には余白を戻す */
.hud-bottom-stack{margin:0 -12px -12px;width:calc(100% + 24px);gap:8px;}
.hud-bottom-stack .message-log{border-radius:0;border-left:none;border-right:none;}
.hud-bottom-stack .hud-row.hud-bottom{padding:0 12px 12px;box-sizing:border-box;}


/* =====================================================================
   スマホ(タッチ端末・狭い画面)のUI配置  ※ html.mobile-ui は game.js の applyMobileUi() が付ける
   画面下にUIを寄せる: 一番下がメッセージ、その上にボタンが2段(7列の均等グリッド)。
   上段: マップ/ステータス/攻撃/撃つ(装填)/持ち物/足下/待機
   下段: 設定/デバッグ/(空き)/(空き)/向き/方向固定/ダッシュ
   各ボタンを押した時のウインドウ(マップ以外)は画面下から、下のUI全体を少し超える高さの固定サイズで出し、中はスクロールする。
   ===================================================================== */
.mobile-ui{--bar-h:198px;--popup-h:250px;}
.mobile-ui #ui{padding:8px 8px 0;}
.mobile-ui .hud-bottom-stack{flex-direction:column-reverse;gap:0;margin:0 -8px;width:calc(100% + 16px);}
.mobile-ui .hud-bottom-stack .message-log{height:89px;flex:none;}
.mobile-ui .hud-bottom-stack .hud-row.hud-bottom{display:grid;grid-template-columns:repeat(6,1fr);grid-template-rows:47px 47px;gap:4px;padding:6px 8px 5px;flex-wrap:nowrap;background:linear-gradient(180deg,rgba(10,16,13,0),rgba(10,16,13,0.55));}
.mobile-ui .bottom-left-cluster,.mobile-ui .bottom-nav,.mobile-ui .controls-cluster,.mobile-ui .action-buttons,.mobile-ui .touch-ctrls{display:contents;}
.mobile-ui .dpad{display:none;}
.mobile-ui .hud-bottom button{pointer-events:auto;min-width:0;width:100%;height:47px;padding:1px 0;margin:0;font-size:min(calc(9px * var(--ts,1)), 9.5px);line-height:1.25;letter-spacing:0;border-radius:7px;overflow:hidden;white-space:nowrap;display:flex;align-items:center;justify-content:center;flex-direction:column;}
.mobile-ui .hud-bottom .action-btn.shoot-btn.hidden,.mobile-ui .hud-bottom #debugBtn.hidden{display:none;}
.mobile-ui .bottom-nav button[data-open="mapScreen"]{grid-area:1/1;}
.mobile-ui .bottom-nav button[data-open="statusScreen"]{grid-area:1/2;}
/* 横6個。上段: マップ・ステータス・(空き)・持ち物・足下・待機 / 下段: 設定・(空き)・(空き)・攻撃・撃つ(装填)・移動制限 */
.mobile-ui .bottom-nav button[data-open="inventoryScreen"]{grid-area:1/4;}
.mobile-ui .action-btn.look-btn{grid-area:1/5;}
.mobile-ui .action-btn.wait-btn{grid-area:1/6;}
.mobile-ui .action-btn.attack-btn{grid-area:2/4;}
.mobile-ui .action-btn.shoot-btn{grid-area:2/5;}
.mobile-ui .bottom-nav button[data-open="settingsScreen"]{grid-area:2/1;}
.mobile-ui #missionBtn{grid-area:2/2;}
.mobile-ui #debugBtn{grid-area:2/3;}
.mobile-ui #tcMove{grid-area:2/6;}
.mobile-ui .tc-btn{min-width:0;}
/* HP/満腹度は、1マス上へ移したキャラクターの頭上に合わせる */
.mobile-ui .vitals-hud{top:calc(40% - 17vw);}

/* 押した時のウインドウ: 画面下から、固定サイズ(下のUI全体を少し超える高さ)。中はスクロール。マップ・階段の確認・メッセージ履歴は従来どおり */
.mobile-ui #statusScreen,.mobile-ui #inventoryScreen,.mobile-ui #settingsScreen,.mobile-ui #debugScreen{align-items:flex-end;padding:0;background:transparent;backdrop-filter:none;}
.mobile-ui #statusScreen .card,.mobile-ui #inventoryScreen .card,.mobile-ui #settingsScreen .card,.mobile-ui #debugScreen .card{
  position:relative;max-width:none;width:100%;height:var(--popup-h);max-height:var(--popup-h);margin:0;
  border-radius:14px 14px 0 0;border-width:2px 0 0;padding:6px 10px 8px;overflow-y:auto;text-align:left;
  background:linear-gradient(180deg,rgba(34,56,40,0.97),rgba(27,44,34,0.98));-webkit-overflow-scrolling:touch;
}
.mobile-ui #statusScreen .menu-heading,.mobile-ui #inventoryScreen .menu-heading,.mobile-ui #settingsScreen .menu-heading,.mobile-ui #debugScreen .menu-heading{font-size:calc(14px * var(--ts,1));margin:0 0 4px;padding-bottom:3px;}
/* 閉じるボタンが1つだけのウインドウは、右上に小さく置く(中身の領域を広く使う) */
.mobile-ui #statusScreen .title-actions,.mobile-ui #inventoryScreen .title-actions,.mobile-ui #settingsScreen .title-actions{position:absolute;top:5px;right:8px;margin:0;}
.mobile-ui #statusScreen .title-actions .btn-main,.mobile-ui #inventoryScreen .title-actions .btn-main,.mobile-ui #settingsScreen .title-actions .btn-main{padding:2px 12px;font-size:calc(12px * var(--ts,1));min-height:0;}
.mobile-ui #inventoryScreen .menu-heading{padding-right:64px;}
.mobile-ui #statusScreen .menu-heading{padding-right:64px;}

/* 持ち物: 2列。1画面に12個(6行)が収まる。ヘッダーは固定、一覧が中でスクロール */
.mobile-ui #inventoryScreen .card{display:flex;flex-direction:column;overflow:hidden;}
.mobile-ui #inventoryScreen .shop-coin{margin:0 0 3px;font-size:calc(11px * var(--ts,1));}
.mobile-ui #inventoryFullList{flex:1;min-height:0;max-height:none;overflow-y:auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:3px;align-content:start;margin:0;-webkit-overflow-scrolling:touch;}
.mobile-ui #inventoryFullList .shop-row{height:31px;min-height:0;padding:0 6px;font-size:calc(12px * var(--ts,1));gap:5px;box-sizing:border-box;}
.mobile-ui #inventoryFullList .shop-empty{grid-column:1/-1;}

/* ステータス: スクロールなしで収まる。左半分にHP・満腹度・経験値・能力値、右半分に装備一式 */
.mobile-ui #statusScreen .card{display:grid;grid-template-columns:1fr 1fr;column-gap:12px;grid-auto-rows:min-content;align-content:start;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;}
.mobile-ui #statusScreen .menu-heading{grid-column:1/-1;}
.mobile-ui #statusScreen .card > .stat-line{grid-column:1;margin:0 0 4px;font-size:calc(11px * var(--ts,1));}
.mobile-ui #statusScreen .stat-label{width:40px;font-size:calc(10px * var(--ts,1));}
.mobile-ui #statusScreen .bar-track{height:15px;}
.mobile-ui #statusScreen #statTable{grid-column:1;margin:2px 0 0;font-size:calc(11px * var(--ts,1));width:100%;}
.mobile-ui #statusScreen .equip-table:not(#statTable){grid-column:2;grid-row:2 / span 6;margin:0;font-size:calc(11px * var(--ts,1));width:100%;align-self:start;}
.mobile-ui #statusScreen .equip-table th,.mobile-ui #statusScreen .equip-table td{padding:2px 5px;}
.mobile-ui #statusScreen .equip-table td{overflow-wrap:anywhere;}
/* 持ち物ウインドウの見出し・所持数の行を詰めて、一覧に6行(12個)が収まるようにする */
.mobile-ui #inventoryScreen .menu-heading{margin:0 0 2px;padding-bottom:2px;display:flex;align-items:center;gap:6px;line-height:1.2;}
.mobile-ui #inventoryScreen .info-icon{width:20px;height:20px;font-size:calc(12px * var(--ts,1));}
.mobile-ui #inventoryScreen .shop-coin{margin:0 0 3px;font-size:calc(11px * var(--ts,1));line-height:1.2;}
.mobile-ui #inventoryFullList{gap:2px;}
.mobile-ui #inventoryFullList .shop-row{height:30px;}
.mobile-ui #statusScreen .title-actions .btn-main,.mobile-ui #inventoryScreen .title-actions .btn-main,.mobile-ui #settingsScreen .title-actions .btn-main{padding:1px 10px;font-size:calc(11px * var(--ts,1));border-width:1px;}

/* スマホ: アイテムのポップアップ(持ち物・足下)は、画面を隠しすぎないよう、画面下のUIの範囲(--bar-h)内にコンパクトに出す */
.mobile-ui .item-popup{align-items:flex-end;padding:0;background:transparent;}
.mobile-ui .item-popup-card{position:relative;max-width:none;width:100%;max-height:var(--bar-h);overflow-y:auto;border-radius:12px 12px 0 0;border-width:2px 0 0;padding:8px 12px 10px;font-size:calc(12px * var(--ts,1));-webkit-overflow-scrolling:touch;}
.mobile-ui .item-popup-head{margin:0 0 4px;padding-right:60px;}
.mobile-ui .item-popup-name{font-size:calc(14px * var(--ts,1));}
.mobile-ui .item-popup-swatch.item-icon{width:20px !important;height:20px !important;}
.mobile-ui .item-popup-swatch.item-icon svg{width:20px;height:20px;}
.mobile-ui .item-popup-desc{margin:0 0 4px;line-height:1.5;font-size:calc(12px * var(--ts,1));}
.mobile-ui .item-popup-line{margin:0 0 3px;font-size:calc(11px * var(--ts,1));}
.mobile-ui .item-popup-actions{flex-direction:row;flex-wrap:nowrap;gap:6px;margin:6px 0 0;}
.mobile-ui .item-popup-actions .inv-actions{flex-direction:row;flex-wrap:nowrap;flex:1 1 auto;min-width:0;}
.mobile-ui .item-popup-actions .shop-btn{width:auto;flex:1 1 0;min-width:0;overflow-wrap:anywhere;min-height:37px;padding:6px 10px;font-size:calc(12px * var(--ts,1));}
.mobile-ui .item-popup .item-popup-close{position:absolute;top:6px;right:10px;width:auto;min-height:0;padding:2px 12px;font-size:calc(11px * var(--ts,1));}

/* リザルト画面: 記録・保存メッセージ・共有・ボタンの間隔をあける(ボタンが近すぎて崩れていた) */
.run-result-card .save-note{margin:16px 0 14px;}
.run-result-card .run-share{margin:14px 0 18px;}
.run-result-card .run-share .share-out{margin-top:10px;gap:10px;}
.run-result-card .title-actions{margin-top:20px;gap:14px;}
.run-result-card .title-actions .btn-main{min-width:200px;}
.run-result-card .back-to-site{margin-top:16px;}
/* 階段・ワープポイントの確認: ボタンを縦に並べ、間隔をあける */
#stairScreen .title-actions{flex-direction:column;align-items:center;gap:16px;margin-top:6px;}
#stairScreen .title-actions .btn-main{min-width:220px;}
/* リザルトの所持品の文字が暗い背景で読めなかったので、白系にする */
.rr .rr-items,.rr .rr-items li{color:var(--chalk);}

/* 使えないコマンド(dungeons.disabled_commands)のボタンは出さない */
.cmd-off-attack .attack-btn{display:none !important;}
.cmd-off-shoot .shoot-btn{display:none !important;}

/* 拠点から開く、図鑑・探索記録・倉庫などのパネル(ワールドマップ側の画面を重ねて表示) */
.embed-panel-overlay{position:fixed;inset:0;z-index:60;background:rgba(0,0,0,0.55);}
.embed-panel-frame{position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;}
.embed-panel-overlay.is-hidden{visibility:hidden;pointer-events:none;}

/* ウインドウのヘッダー行(画面タイトル+閉じるボタン)は、中身がスクロールしても上に残す(JS: buildStickyHeads) */
.card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;position:sticky;top:0;z-index:4;background:var(--panel-strong);margin:-32px -28px 14px;padding:18px 28px 8px;border-bottom:1px dashed rgba(244,241,228,0.25);}
.card-head .menu-heading{margin:0;padding:0;border-bottom:0;flex:1 1 auto;min-width:0;text-align:left;}
.card-head .btn-main{flex:none;padding:6px 16px;font-size:calc(13px * var(--ts,1));}
#statusScreen .card,#inventoryScreen .card,#settingsScreen .card,#debugScreen .card,#logScreen .card{max-height:calc(100dvh - 48px);overflow-y:auto;}
.mobile-ui .card-head{margin:-6px -10px 4px;padding:6px 10px 3px;}
.mobile-ui .card-head .btn-main{padding:1px 12px;min-height:0;font-size:calc(12px * var(--ts,1));border-width:1px;}
.mobile-ui #statusScreen .card-head{grid-column:1/-1;}
.mobile-ui #inventoryScreen .card-head .menu-heading{padding-right:0;}
.mobile-ui #statusScreen .card-head .menu-heading{padding-right:0;}
/* 常時表示の操作ボタンは、文字を書かずアイコンだけ(意味は aria-label / title)。大きく表示する */
.bottom-nav button,.action-btn{font-size:calc(26px * var(--ts,1));line-height:1;position:relative;}
.mobile-ui .hud-bottom button{font-size:min(calc(26px * var(--ts,1)), 32px);line-height:1;}
.btn-badge{position:absolute;right:3px;bottom:2px;min-width:16px;padding:0 4px;border-radius:8px;background:rgba(0,0,0,0.65);color:var(--chalk);font-size:11px;line-height:16px;font-weight:700;}
html:not(.mobile-ui) .bottom-nav button{flex:0 0 auto;width:56px;height:46px;padding:0;}
html:not(.mobile-ui) .action-btn{min-width:56px;height:46px;}

/* 持ち物のカード: 名前(+「東京都名物」)が収まらない時は、枠の中で左右にスクロール(JS: applyNameMarquee)。操作を減らす設定の端末では、指で左右にスクロール */
.shop-name .name-scroll{display:inline-block;white-space:nowrap;}
.shop-name.is-marquee{text-overflow:clip;}
.shop-name.is-marquee .name-scroll{animation:nameMarquee var(--marquee-dur,6s) ease-in-out infinite alternate;}
@keyframes nameMarquee{0%,18%{transform:translateX(0);}82%,100%{transform:translateX(var(--marquee-dx,0px));}}
@media (prefers-reduced-motion:reduce){
  .shop-name.is-marquee{overflow-x:auto;scrollbar-width:none;}
  .shop-name.is-marquee::-webkit-scrollbar{display:none;}
  .shop-name.is-marquee .name-scroll{animation:none;}
}
.mobile-ui #inventoryFullList .shop-row{min-width:0;overflow:hidden;}

/* 移動の切り替えボタン(南京錠/十字の矢印のSVG)。向き固定=黄色、4方向・斜め4方向=青 */
.tc-btn .mv-icon{width:62%;height:62%;display:block;margin:auto;}
.tc-btn.tc-on .mv-icon{color:#2a2410;}
/* トリーの周りの矢印: 少し離して、ひとまわり大きく。向き固定の間は黄色く、4方向・斜め4方向の間は案内(青っぽく半透明で、押せない) */
.facing-btn{width:46px;height:46px;margin:-23px 0 0 -23px;font-size:calc(22px * var(--ts,1));}
.facing-ring.ring-face .facing-btn{background:var(--yellow);color:#2a2410;border-color:#fff3b0;}
.facing-ring.ring-guide .facing-btn{pointer-events:none;background:rgba(27,44,34,0.55);border-color:var(--blue,#6a93c2);color:var(--blue,#6a93c2);opacity:0.8;}

/* 画面上部のダンジョン名: 上のマージンを減らす。加護の右に「経過ターン XX」 */
#ui{padding-top:4px;}
.mobile-ui #ui{padding-top:2px;}
.env-line{display:flex;flex-wrap:wrap;align-items:center;gap:3px 8px;margin-top:3px;}
.env-line .env-chips{margin-top:0;}
.turn-count{font-size:calc(10px * var(--ts,1));color:var(--chalk-dim);white-space:nowrap;}
.turn-count:empty{display:none;}
/* ステータス画面の装備: アイテム名の下に、耐久力のゲージ */
.gear-name{line-height:1.3;}
.dur-gauge{position:relative;height:11px;margin-top:3px;border-radius:4px;background:rgba(0,0,0,0.35);border:1px solid rgba(244,241,228,0.15);overflow:hidden;min-width:70px;}
.dur-gauge .dur-fill{height:100%;background:linear-gradient(90deg,#6fae7f,#9bd48f);}
.dur-gauge.broken .dur-fill{background:var(--red);}
.dur-gauge .dur-num{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:calc(8.5px * var(--ts,1));font-weight:700;color:#fff;text-shadow:0 0 2px rgba(0,0,0,0.9);line-height:1;}
/* ステータスのアイコン(装備なしのトリーを正面から描いた絵) */
.btn-icon-img{width:74%;height:74%;object-fit:contain;display:block;margin:auto;pointer-events:none;}
.map-heading{line-height:1.4;}

.choice-list{display:flex;flex-direction:column;gap:6px;}
.choice-note{font-size:calc(11px * var(--ts,1));color:var(--chalk-dim);margin:-2px 0 2px 4px;}

.action-btn .act-icon{width:62%;height:62%;display:block;margin:auto;pointer-events:none;}
/* ステータスのアイコン(トリー)は、ボタンいっぱいに大きく */
.btn-icon-img{width:100%;height:100%;}

/* マップ画面: 左上のUI(ダンジョン名・フロア・経過ターン)だけをマップの上に残す。ほかのUIは隠す */
body.map-open #ui{z-index:6;}
body.map-open #ui .hud-bottom-stack,body.map-open #ui .hud-top-right,body.map-open .view-ctrl,body.map-open .vitals-hud{visibility:hidden;}

/* 状態異常・能力アップ/ダウンの表示は、HP/満腹度ゲージの右側に横へ並べる(下へ積むとトリーの姿が隠れるため)。多い時は右側で折り返す */
.vitals-hud .status-chips{position:absolute;left:100%;top:0;margin:0 0 0 4px;width:max-content;max-width:calc(50vw - 80px);flex-direction:row;flex-wrap:wrap;align-content:flex-start;}
