
/* =====================================================
   クエストマップ キーボードナビゲーション選択表示
   ===================================================== */
.quest-map-node-selected {
  outline: 2px solid #00ffff !important;
  outline-offset: 2px !important;
}

.quest-map-world-focus {
  outline: 2px solid #00ffff !important;
  outline-offset: 2px !important;
}
.quest-map-world-focus .world-name-area {
  color: #00ffff !important;
  font-weight: bold !important;
}

.quest-map-node-desc {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #444;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  display: none;
}


/* =====================================================
   メニューキーボードナビゲーションフォーカス
   マウスホバーと同じ見た目にするため、枠線・グローは削除。
   各ボタンの :focus で :hover と同じスタイルを適用する。
   ===================================================== */
.menu-nav-focus {
  outline: none !important;
}


/* =====================================================
style.css
   ・ページ全体のフォント / 背景 / 基本色
   ===================================================== */
/* 全OSで共通表示するためのフォント変数
   （assets/fonts/fonts.css で self-host したフォントを使用） */
:root {
  color-scheme: dark;  /* ネイティブUI（スクロールバー等）をダーク仕様に */

  /* =====================================================
     ステージ（アプリ全体）の設定
     デザインサイズは 1600×900（16:9）で固定し、js/stageScale.js が
     計算した --stage-scale でフルスクリーン / 大 / 中 / 小 に合わせて
     全体を等倍拡大縮小する。
     --dvw / --dvh はデザイン基準の 1vw / 1vh 相当
     （1600×900 基準で固定 → ウィンドウサイズで見た目が変わらない）。
     ===================================================== */
  --stage-scale: 1;
  /* レターボックス中央寄せの原点オフセット。js/stageScale.js が
     デバイスピクセル整数に丸めて設定する（小数DPR環境の文字にじみ対策） */
  --stage-ox: 0px;
  --stage-oy: 0px;
  --dvw: 16px;   /* 1600px / 100 */
  --dvh: 9px;    /* 900px / 100 */

  /* 英字UI（ラテン）用: Inter を最優先、和文フォールバックは M PLUS Rounded 1c / BIZ UDPGothic / Meiryo */
  --font-ui: 'Inter', 'M PLUS Rounded 1c', 'Noto Sans JP', 'BIZ UDPGothic',
             'Meiryo', 'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  /* 日本語UI・タイピング表示用（丸ゴ寄りで統一、Windowsでも文字が潰れないUDゴシック・Meiryoをフォールバック） */
  --font-ja: 'M PLUS Rounded 1c', 'Noto Sans JP', 'BIZ UDPGothic', 'Meiryo',
             'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  /* 数字・等幅表示用: 和文フォールバックも含めてMSゴシックビットマップへの落下を防止 */
  --font-mono: 'Noto Sans Mono', 'Consolas', 'Courier New', monospace;

  /* =====================================================
     クエスト系モーダルのタイトル文字サイズ
     DIFFICULTY / SKILL TREE / SKILL(EQUIP) / STAR UPGRADE /
     SAVE・LOAD / KEY BIND / CLEAR REWARD の全画面で統一する。
     ※個別に font-size を書かず、必ずこの変数を使用すること。
     ===================================================== */
  --quest-modal-title-size: 26px;
}

html {
  height: 100%;
  background: #05080a;   /* ステージ外（レターボックス）の背景 */
}

/* =====================================================
   スクロールバー共通設定（全要素）
   全スクロール領域を Safari 風の黒系の細いバーに統一する。
   ※ overflow: auto なので、内容が収まっている場合は
      スクロールバー自体が表示されない。
   ※ 個別にバーを消している箇所（#kana-scroll 等）は
      詳細度が高いためそのまま優先される。
===================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}
::-webkit-scrollbar-corner {
  background: transparent;
}
/* =====================================================
   ステージ：アプリ全体をデザインサイズ 1600×900（16:9）に固定し、
   --stage-scale でフルスクリーン / 大 / 中 / 小 に合わせて等倍拡大縮小する。
   16:9 モニターのフルスクリーンでは余白ゼロで表示される。
   ※ スケール適用は2モード（js/stageScale.js が決定）:
      transform モード … body が transform を持つため position: fixed の各画面は
        ビューポートではなくステージ（1600×900）を基準に配置される（従来方式）。
      zoom モード（Windows 既定）… zoom は包含ブロックを作らないため fixed は
        ビューポート基準になる。16:9 ウィンドウではステージと一致するため実害なし。
   ※ container-type により body がサイズクエリのコンテナになり、
     下記の @container（旧 @media）は常に 1600×900 基準で評価される
     （= 小さいウィンドウでもレイアウトが切り替わらない）。
   ===================================================== */
body {
  position: fixed;
  left: 0;
  top: 0;
  width: 1600px;
  height: 900px;
  /* ※原点オフセット（--stage-ox/oy）とスケールは stageScale.js が
     デバイスピクセル整数にスナップして設定する。
     以前の translate(-50%,-50%) 中央寄せだと原点が端数デバイスpxに落ち、
     ステージレイヤー全体がバイリニア再サンプリングされて
     Windows の小数DPR環境で文字がにじむため廃止。 */
  transform: translate(var(--stage-ox, 0px), var(--stage-oy, 0px)) scale(var(--stage-scale, 1));
  transform-origin: 0 0;
  container-type: size;
  container-name: stage;

  text-align: center;
  font-family: var(--font-ja);
  background: transparent;   /* 背景は html 側のパターンでウィンドウ全体に敷く */
  color: #a3c8e4;        /* R-TYPE風の淡いブルー */
  margin: 0;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

/* =====================================================
   zoom ステージモード（js/stageScale.js が Windows で付与）
   body の transform を無効化し、CSS zoom で拡大縮小する。
   理由: Chromium は「Webフォント＋transform 合成レイヤー」上の文字を常に
   グレースケールAAで描画し ClearType（サブピクセルAA）を無効にする
   （既知仕様 issues.chromium.org/issues/40199005）。zoom はレイヤー合成を
   起こさないため、LCD AA ＋ ヒンティングが効いた描画に戻すのが目的。
   ===================================================== */
body.zoom-stage {
  transform: none;
}

/* =====================================================
   Windows のみ: UI全体の文字のにじみ・潰れ・ギザギザ対策
   ・v1.0.86: OS標準のヒンティング済みUD系を最優先に切替。
     M PLUS Rounded 1c(webfont)はClearTypeが効かずDPR 1.0で潰れるため
     後方フォールバックへ。Mac(:root)は丸ゴのまま不変。
     'Noto Sans JP' に @font-face が無い(死に指定)のも整理し、
     実在する BIZ UDPGothic / Meiryo のみ指定する。
   ・Yu Gothic UI のような極小サイズで線がくっついて潰れるフォントを排除(継続)
   ・UD系は実ウェイト500が無い環境で疑似ボールド化＝汚れの元になるため
     weight は 400 に戻し、stroke も 0 にする(ヒンティング済み素描が最鮮明)。
     太さが必要な見出し・タイピング大文字は個別に bold で指定する。
   ・手動ブースト body.win.win-text-heavy は残す(実機比較用)。
   ===================================================== */
body.win {
  --font-ui: 'Inter', 'BIZ UDPGothic', 'Meiryo', 'M PLUS Rounded 1c', system-ui, sans-serif;
  --font-ja: 'BIZ UDPGothic', 'Meiryo', 'M PLUS Rounded 1c', system-ui, sans-serif;

  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
  /* v1.0.86: optimizeLegibility → auto。UD系はヒンティングで読ませるのが最優先で、
     カーニング強制は小サイズの詰まりよりヒンティング無効化の害が大きいため戻す */
  text-rendering: auto;
  /* v1.0.86: ヒンティング済みUD素描が最鮮明。stroke はフリンジにしかならないため 0。
     ギザギザ対策の太さは font-weight ではなく個別の bold 指定で確保する。 */
  -webkit-text-stroke: 0;
  /* v1.0.86: BIZ/Meiryo に500実ウェイトが無い環境での疑似ボールド(輪郭の二重描画＝汚れ)
     を避けるため 400 に戻す。見出し・タイピング等の太字は個別 bold が効く。 */
  font-weight: 400;
}

/* 【調整用・既定は無効】さらに文字の輪郭を太くして段差を目立たなくする。
   有効化は DevTools の Console から:
     document.body.classList.add('win-text-heavy')
   （v1.0.86: UD素描が既定のため通常は不要。強すぎ/弱すぎなら
     -webkit-text-stroke の 0.2px を 0.15〜0.25px で調整） */
body.win.win-text-heavy {
  -webkit-text-stroke: 0.2px currentColor;
}

body.win #word, body.win #word-long, body.win #jp,
body.win #roma, body.win #kana-scroll, body.win #roma-scroll {
  /* v1.0.86: タイピング大文字もUD優先に統一。太さはUD正規の bold で確保し、
     stroke はヒンティングを殺すため 0(フリンジ防止)。 */
  --font-ja: 'BIZ UDPGothic', 'Meiryo', 'M PLUS Rounded 1c', system-ui, sans-serif;
  -webkit-text-stroke: 0;
  font-weight: 700;
}

/* =====================================================
   Windows のみ: 小さいUI文字（10〜11px）のサイズ底上げ（v1.0.82）
   症状「小さすぎて潰れる」への根治療。小さいグリッドに文字を詰め込むほど
   グレースケールAAの階段と墨のへばりが目立つため、1段（+1px）持ち上げる。
   ※ スタイルシートの !important はインライン style に勝つため、
     index.html / js 内でインライン指定されている説明文も一括で対象になる。
   ===================================================== */

/* --- B-1: インライン指定の10px / 11px を一括で +1px --- */
body.win [style*="font-size: 10px"] { font-size: 11px !important; }
body.win [style*="font-size:10px"]  { font-size: 11px !important; }
body.win [style*="font-size: 11px"] { font-size: 12px !important; }
body.win [style*="font-size:11px"]  { font-size: 12px !important; }

/* --- B-2: スタイルシート側（流動レイアウトのラベル・説明文のみを選定） ---
   意図的に除外したもの:
   ・border-radius:999px のピルバッジ / .skill-tag（幅が見た目に効く）
   ・.ach-name（width:100% + white-space:nowrap ＝はみ出しリスク）
   ・14px円の数字（固定サイズ）/ .map-label（absolute配置で隣接ノードと衝突）
   ・.quest-side-menu::before（疑似要素）/ devPanel・dev-*（開発用）
   ・.star-upgrade-rebuild-btn などのボタン（padding付きで横幅が変化） */
body.win #time-circle .label,
body.win #chainLabel,
body.win .enemy-sound-toggle,
body.win .global-fs-toggle,
body.win .stock-label,
body.win .active-stock-row,
body.win .slot-title-detail,
body.win .slot-breakdown,
body.win .skill-grid-name,
body.win .log-chapter-status,
body.win .quest-modal-box.quest-modal-skill .skill-equip h3,
body.win .quest-modal-box.quest-modal-skill .active-skill-desc-container .skill-desc,
body.win .quest-modal-box.quest-modal-skill .active-skill-desc-container .skill-cooldown {
  font-size: 11px;
}

/* =====================================================
   Windows のみ: 低コントラスト「グレー系」文字の stroke 除外（v1.0.83）
   body.win の -webkit-text-stroke: 0.06px は輪郭の両側に半透明フリンジを作る。
   白系文字では「締まる」が、暗背景のグレー文字（#8b949e 等）では
   フリンジ自体がグレーの霞として広がり「にじむ」見た目になる。
   ⇒ 設定画面・モード設定画面の説明文など灰色テキストに限定して無効化する。
   font-weight: 500 は維持（実ウェイトなので輪郭はクリスプなまま）。
   ===================================================== */
/* v1.0.84: 上記に加え、Windows で見にくい全要素を一括で stroke 除外。
   対象は opacity→色アルファ化・低コントラストグレー・背景透過テキスト。 */
body.win .setting-description,
body.win [style*="color: #8b949e"],
body.win [style*="color:#8b949e"],
body.win .log-chapter-title,
body.win .log-chapter-status,
body.win .character-name,
body.win .map-label,
body.win .map-label.cleared,
body.win .map-label.locked,
body.win .dialogue-close-btn,
body.win #dialogueSkipToEndBtn,
body.win #dialogueSkipToChoiceBtn {
  -webkit-text-stroke: 0;
}

body.win .skill-equip h3,
body.win .active-skill-desc-container .skill-desc,
body.win .active-skill-desc-container .skill-cooldown,
body.win .skill-tag-note,
body.win .slot-date,
body.win .music-modal-note,
body.win .music-progress-time,
body.win .music-row-composer,
body.win .calc-item .label,
body.win .offline-dl-progress-text,
body.win .offline-dl-note p,
body.win .offline-dl-detail,
body.win .star-upgrade-item-desc,
body.win .star-upgrade-item-cooldown,
body.win .star-upgrade-flash,
body.win .star-upgrade-item-stats,
body.win .star-upgrade-rebuild-tickets,
body.win .setting-description,
body.win #remainingLoadIndicator {
  font-size: 12px;
}

/* R-TYPE風タクティカル背景
   ※ html 側に敷くことでステージ（16:9フレーム）外の余白にも
     背景が続いて見え、フレームの境界が目立たなくなる */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  background: 
    linear-gradient(rgba(18, 25, 33, 0.6), rgba(5, 8, 10, 0.7)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15) 0px, rgba(0, 0, 0, 0.15) 1px, transparent 1px, transparent 2px); /* スキャンライン */
  /* z-index: -2; */ /* → 画面階層セクションへ移動 */
}

/* ヘックスパターン背景 */
html::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iMTA0IiB2aWV3Qm94PSIwIDAgNjAgMTA0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik02MCA5NEwzMCAxMDQgMCA5NFY2NEwzMCA1NEw2MCA2NFY5NFpNMzAgNDRMMCAzNFY0TDMwIDBMMTYwIDRMNjAgMzRWMzRaIiBmaWxsPSJub25lIiBzdHJva2U9IiMxNDI4MzUiIHN0cm9rZS13aWR0aD0iMC41Ii8+PC9zdmc+');
  opacity: 0.3;
  /* z-index: -1; */ /* → 画面階層セクションへ移動 */
  mask-image: radial-gradient(circle at center, black, transparent 80%);
}

h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
  color: #58a6ff;        /* サイバーブルー */
  text-transform: uppercase;
}

/* 汎用ボタン（デフォルト）
   各UI専用ボタンは下で上書きする */
button {
  margin: 5px;
  padding: 5px 10px;
  font-size: 16px;
}

/* =====================================================
   画面階層
   ===================================================== */
/* --- 背景 --- */
html::before              { z-index: -2; }    /* 背景: スキャンライン */
html::after               { z-index: -1; }    /* 背景: ヘックスパターン */
#menuBackground           { z-index: -1; }    /* 背景: メニュー画面の背景画像 */

/* --- ゲーム要素 (クエストマップなど) --- */
#mapCanvas                { z-index: 0; }     /* クエストマップ: 背景Canvas */
#time-circle              { z-index: 0; }     /* ゲーム画面: 時間サークル(リング) */
#time-circle::before      { z-index: 0; }     /* ゲーム画面: 時間サークル(内側) */
#mapNodes                 { z-index: 1; }     /* クエストマップ: ノード群 */
#time-circle .label, 
#time-circle .count       { z-index: 2; }     /* ゲーム画面: 時間サークル(テキスト) */
#history th               { z-index: 5; }     /* 記録画面: 履歴テーブルヘッダー */
#mapBackBtn               { z-index: 10; }    /* クエストマップ: 戻るボタン */
#records th               { z-index: 10; }    /* 記録画面: テーブルヘッダー */
.quest-side-menu          { z-index: 20; }    /* クエストマップ: サイドメニュー */
#statsCloseQuest          { z-index: 20; }    /* クエストステータス: 閉じるボタン */

/* --- UIコンテナ (メニュー、ゲームモードなど) --- */
.world-selector           { z-index: 100; }   /* クエストマップ: ワールドセレクター */
#menu                     { z-index: 500; }   /* メインメニュー画面 */
#bootScreen               { z-index: 1000; }  /* 起動画面 (Click to Start) */
#enemyModeContainer       { z-index: 1000; }  /* エネミーモード: 全体コンテナ */
.enemy-sound-toggle       { z-index: 1100; }  /* エネミーモード: サウンドトグル */

/* --- ゲーム中モーダル / UI --- */
.game-modal               { z-index: 8000; }  /* ゲーム画面: モーダル背景 */
#time-bar                 { z-index: 9000; }  /* ゲーム画面: タイムバー */
#timeLeft                 { z-index: 9100; }  /* ゲーム画面: 残り時間テキスト */
.result-modal             { z-index: 9500; }  /* 結果画面: モーダル背景 */
#enemyResult              { z-index: 9500; }  /* エネミーモード: 結果画面 */

/* --- 上位モーダル (クエスト、設定など) --- */
.quest-modal              { z-index: 10000; } /* クエストマップ: モーダル背景 */
.quest-modal-box          { z-index: 10001; } /* クエストマップ: モーダル本体 */
.save-modal               { z-index: 10010; } /* クエスト: セーブモーダル（MUSIC 等で使用） */
/* ★SAVE/LOAD・CLEAR REWARD・KEY BIND は .quest-modal の見た目で実装しているが、
   従来の重なり順（.save-modal と同じ 10010）を維持する */
#saveModal, #clearRewardModal, #keybindConfigModal { z-index: 10010; }
.end-intro, #endIntro     { z-index: 10400; }  /* 結果画面: 表示前イントロ */
.stage-intro              { z-index: 10400; } /* クエスト開始イントロ */
#playerHud                { z-index: 10500; } /* プレイヤーHUD */
#skillUnlockHint          { z-index: 10500; } /* スキルアンロックヒント */
.free-config-container    { z-index: 10550; } /* フリーモード: 詳細設定画面 */
#records                  { z-index: 10550; } /* 記録画面 */
.modal, .stats-modal, .quest-stats-modal, .ach-modal-content, #settings { z-index: 10600; } /* 汎用モーダル (ステータス, 勲章, 設定) */
#globalUiBar              { z-index: 10700; } /* グローバルUIバー: メニュー左上の共通切替ボタン群 */
.free-skill-modal         { z-index: 10850; } /* フリーモード: スキル選択/星強化モーダル（設定パネル10550・汎用10600・globalUiBar 10700より上） */

/* --- 最前面系 (カウントダウン、ローディングなど) --- */
#countdown                { z-index: 11000; } /* ゲーム開始: カウントダウン */
.pause-overlay            { z-index: 11000; } /* ポーズ画面 */
#loadingScreen            { z-index: 12000; } /* ローディング画面 */
.ach-popup-container      { z-index: 13000; } /* 勲章獲得ポップアップ */
#devPanel                 { z-index: 20000; } /* 開発者パネル */

/* =====================================================
   画面レイアウト切替（メニュー / ゲーム / 統計）
   ===================================================== */
#game, #stats {
  margin-top: 20px;
}
#menu { display: block; }
#game, #stats, #startMenu, #freeStartMenu, #questMenu { display: none; }

/* =====================================================
   ローディング
   ===================================================== */
#loadingScreen {
  position: fixed;
  inset: 0;
  background: #111;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Boot Screen 全体を覆う設定 */
#bootScreen {
    position: fixed; /* 画面に固定 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #333;
    /* z-index: 1000; */ /* → 画面階層セクションへ移動 */

    /* Flexbox を使って子要素を中央に配置 */
    display: flex;
    justify-content: center; /* 水平方向の中央揃え */
    align-items: center;   /* 垂直方向の中央揃え */
    /* cursor: pointer; は main.js で設定済みですが、ここでも設定可能です */
}

/* 「Click to Start」メッセージのスタイル */
.boot-message {
    font-size: 2rem;       /* フォントサイズ */
    font-weight: bold;     /* 太字 */
    color: white;          /* 文字色 */
    text-align: center;    /* 念のため中央揃え */
}


/* =====================================================
   カウントダウン表示（中央固定・枠なし）
   ===================================================== */
#countdown {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* z-index: 11000; */ /* → 画面階層セクションへ移動 */

  font-size: 12rem; /* さらに大きく、シンプルに */
  font-weight: 900;
  color: #ffffff;  /* 確実に見える白 */
  text-shadow: 0 0 30px rgba(0, 0, 0, 0.5); /* 視認性向上のための影 */

  text-align: center;
  display: none;

  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
}



/* =====================================================
   ポーズメニュー
   ===================================================== */
.pause-overlay {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.6);
}

.pause-menu {
  color: white;
  font-size: 24px;
  text-align: center;
}


/* =====================================================
   共通モーダル（ゲーム / 結果 / ステータス等）
   ===================================================== */
.game-modal,
.result-modal,
.stats-modal,
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* カウントダウン中はモーダルの「枠」と「背景」を消す */
.game-modal.is-counting .game-modal-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

/* モーダル背景の違いは個別で指定 */
.game-modal { 
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
}

.result-modal {
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(3px);
  /* 内容が画面より高い場合（小さいウィンドウ・拡大表示など）でも
     スクロールですべての結果・ボタンにアクセスできるようにする */
  overflow-y: auto;
  overflow-x: hidden;
}

/* 結果カードのはみ出し安全な上下中央寄せ：
   autoマージンで中央寄せしつつ、内容が画面より高い場合は
   マージンが0になって上端から表示＋スクロール可能になる。
   （align-items:center のままでは上方向にはみ出した部分へスクロールできない） */
.result-modal > .result-card {
  margin: auto 0;
  max-width: 100%;
}

.stats-modal,
.modal {
  background: rgba(0,0,0,0.55);
  display: none;
}

/* =====================================================
   メニュー画面
   ===================================================== */
#menu {
  position: fixed;
  inset: 0;
  /* z-index: 500; */ /* → 画面階層セクションへ移動 */
}

#startMenu, #freeStartMenu, #questMenu, .menu-inner {
  position: absolute;
  /* 装飾ライン（左20px）をboxの外にはみ出させないため、
     boxを20px左へずらしてpaddingで位置を補正している（ボタン位置・幅は不変） */
  left: calc(5% - 20px);
  top: 30%; /* 固定位置（画面上部から30%の位置） */
  width: 370px;             /* 350px + 装飾ライン分の20px */
  padding: 0 0 0 20px;
  box-sizing: content-box;  /* ボタン(width:100%)の実質幅を従来どおり350pxに保つ */
  text-align: left;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  margin: 0;

  /* 下端の見切れ対策：
     boxの高さを「top:30% の位置〜下端24pxの余白」までに制限し、
     あふれた場合は内側のスクロール領域（#menuButtons / .menu-scroll-area）で
     スクロールできるようにする。
     ※ box自体はクリップしない（overflow: visible のまま）ため、
        nowrap のタイトル（MAME TYPE / DAILY MODE など）が
        右へはみ出すオリジナルのデザインが維持される */
  max-height: calc(70% - 24px);
  display: flex;
  flex-direction: column;
}

/* ヘッダー（タイトル）はスクロール領域の外に固定。
   これによりboxがどんなに狭くなってもタイトルは見切れない */
#menuHeader,
#startMenu h2, #freeStartMenu h2, #questMenu h2 {
  flex: 0 0 auto;
}

/* ボタン領域のみスクロールする */
#menuButtons, .menu-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 装飾用のサイドライン
   （スクロール可能化に伴い、boxの外にはみ出さないよう内側に収めた。
     グラデーションは両端で透明にフェードするため見た目の変化は最小限） */
.menu-inner::before, #startMenu::before, #freeStartMenu::before, #questMenu::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(transparent, #58a6ff, transparent);
  box-shadow: 0 0 15px rgba(88, 166, 255, 0.8);
}

/* 短い画面（ノートPCの小さめウィンドウ等）では開始位置を上げて
   下端ボタンの見切れを防ぐ（それでも収まらない場合は内部スクロールで対処） */
@container (max-height: 780px) {
  #startMenu, #freeStartMenu, #questMenu, .menu-inner {
    top: 16%;
    max-height: calc(84% - 24px);
  }
}

@container (max-height: 560px) {
  #startMenu, #freeStartMenu, #questMenu, .menu-inner {
    top: 4%;
    max-height: calc(96% - 16px);
  }
  #menu h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
  }
  #menuHeader {
    margin-bottom: 16px;
  }
  #menu button, #startMenu button, #freeStartMenu button, #questMenu button {
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 14px;
  }
  #startMenu h2, #freeStartMenu h2, #questMenu h2 {
    font-size: clamp(1.7rem, 5vw, 2.6rem);
  }
}

/* 幅が狭い画面ではメニューbox自体を画面内に収める
   （content-boxのため、padding20px＋左右マージン16px×2を差し引いた幅） */
@container (max-width: 440px) {
  #startMenu, #freeStartMenu, #questMenu, .menu-inner {
    left: 16px;
    width: calc(100vw - 52px);
  }
}

#menuHeader {
  margin-bottom: 40px; /* ←ここで間隔調整 */
}

/* タイトルロゴ（でっかいロゴ風）--- フォントは self-host(Inter)で全OS共通表示 */
#menu h1 {
  font-family: var(--font-ui);       /* Inter → 全OS共通 */
  font-size: clamp(2.2rem, calc(var(--dvw) * 5.5), 4.5rem); /* 5.5vw @デザイン1600で固定 */
  margin: 0 0 6px 0;
  font-weight: 800;
  font-style: italic; 
  color: #e1edff;
  text-align: left;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;               /* 1行で保持し、右へ伸びる大きなロゴとして表示 */
  text-transform: uppercase;
  text-shadow:
    0 0 3px rgba(88, 166, 255, 0.7),
    0 0 18px rgba(88, 166, 255, 0.45),
    0 0 55px rgba(88, 166, 255, 0.25),
    3px 3px 0 rgba(0, 0, 0, 0.55);
}

#startMenu h2, #freeStartMenu h2, #questMenu h2 {
  font-family: var(--font-ui);       /* Inter → 全OS共通 */
  font-size: clamp(2.1rem, calc(var(--dvw) * 5), 4rem);
  margin-top: 0;                     /* ブラウザデフォルトの余白をリセットして位置を固定 */
  margin-bottom: 5px;
  font-weight: 800;
  font-style: italic;
  color: #e1edff;
  text-align: left;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;               /* 切替アイコンと1行に保持 */
  text-shadow:
    0 0 3px rgba(88, 166, 255, 0.7),
    0 0 16px rgba(88, 166, 255, 0.4),
    0 0 45px rgba(88, 166, 255, 0.22),
    2px 2px 0 rgba(0, 0, 0, 0.55);
}

#menu h1,
#startMenu h2, #freeStartMenu h2, #questMenu h2 {
  position: relative;
  display: inline-block;
}
#gameTitle {
  margin: 0;
}

/* バージョン表示 */
#versionWrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(88, 166, 255, 0.3);
  padding-top: 4px;
  white-space: nowrap;
}

#versionLabel {
  font-size: 12px;
  color: #58a6ff;
  letter-spacing: 2px;
}

#versionSep {
  font-size: 12px;
  color: rgba(88, 166, 255, 0.4);
  letter-spacing: 2px;
}

#offlineVersionLabel {
  font-size: 12px;
  color: #58a6ff;
  letter-spacing: 2px;
  transition: color 0.3s ease;
}

/* オフライン版がない場合のスタイリッシュな表記 */
#offlineVersionLabel.no-offline {
  color: #4a5568;
  font-weight: 300;
  letter-spacing: 1px;
}

#menu button, #startMenu button, #freeStartMenu button, #questMenu button {
  display: block;
  width: 100%;
  margin: 5px 0;
  border-radius: 6px;
  text-align: left;
  padding-left: 20px;
  background: rgba(88, 166, 255, 0.05);
  border-left: 4px solid #58a6ff;
  border-right: none;
  border-top: none;
  border-bottom: none;
  text-transform: uppercase;
  color: #7b8892e8; /* 未選択時の視認性を向上させる */
  font-weight: bold;
  letter-spacing: 2px;
  transition: 0.3s;
}
/* キーボードナビゲーション中はマウス hover のハイライトを無効化（最後に触った方を優先） */
body.menu-keyboard-nav #menu button:hover,
body.menu-keyboard-nav #startMenu button:hover,
body.menu-keyboard-nav #freeStartMenu button:hover,
body.menu-keyboard-nav #questMenu button:hover {
  background: rgba(88, 166, 255, 0.05);
  padding-left: 20px;
  color: #7b8892e8;
  text-shadow: none;
  border-left-width: 4px;
}



#menu button:hover, #startMenu button:hover, #freeStartMenu button:hover, #questMenu button:hover,
#menu button:focus, #startMenu button:focus, #freeStartMenu button:focus, #questMenu button:focus {
  background: rgba(88, 166, 255, 0.2);
  padding-left: 35px;
  color: #ffffff;
  text-shadow: 0 0 10px #fff;
  border-left-width: 8px;
  outline: none;
}

/* フリーモード等で選択中のボタンを維持するスタイル */
#freeStartMenu button.active {
  background: rgba(88, 166, 255, 0.35); /* ホバーより少し濃い青 */
  padding-left: 35px;                  /* ホバー時と同じ位置を維持 */
  color: #ffffff;                      /* 文字を白く */
  text-shadow: 0 0 15px #fff;          /* 発光を強めに */
  border-left-width: 8px;              /* 太い左線を維持 */
  box-shadow: inset 0 0 15px rgba(88, 166, 255, 0.3); /* 内側に青いグロー */
}

#menu button:active, #startMenu button:active, #freeStartMenu button:active, #questMenu button:active {
  transform: scale(0.98);
  background: #161b22;
}

#menuBackground {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  opacity: 0.45;
  filter: brightness(1.2);
  /* z-index: -1; */ /* → 画面階層セクションへ移動 */
  pointer-events: none;
}

/* =========================
   タイトル横モード切替
   ========================= */
#startMenu h2,
#freeStartMenu h2 {
  display: inline-block;
  position: relative;
}

/* 切替アイコン */
#switchToFreeBtn,
#switchToNormalBtn {
  margin-left: 10px;           /* ← 少し右に離す */
  font-size: 14px;             /* 控えめサイズ */
  opacity: 0.65;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

/* ホバー時：軽く回転 */
#switchToFreeBtn:hover,
#switchToNormalBtn:hover {
  opacity: 1;
  transform: rotate(20deg) scale(1.05);
}

/* クリック時：小さく戻る */
#switchToFreeBtn:active,
#switchToNormalBtn:active {
  transform: rotate(0deg) scale(0.92);
}

/* =====================================================
   ゲームモーダル本体カード
   ===================================================== */
.game-modal-content {
  background: rgba(13, 17, 23, 0.95);
  color: #f0f6fc;
  border-radius: 14px;
  padding: 28px 32px;

  /* コンパクト設計：内容にフィットさせ、大きくなりすぎないよう上限のみ制約する。
     （16:9固定の大きな枠ではなく、タイピングUIのサイズに合わせて収まる） */
  box-sizing: border-box;
  width: min(calc(var(--dvw) * 94), 820px);
  max-height: calc(var(--dvh) * 100 - 60px);
  overflow: auto;

  border: 1px solid rgba(88, 166, 255, 0.4);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(88, 166, 255, 0.05);

  /* タイピング入力画面（STANDARD / TIME ATTACK 等）を上下中央に配置するため縦flexに */
  display: flex;
  flex-direction: column;
}

/* 入力UI一式（#game）をカード内の上下中央に配置。
   上下 auto マージン方式なので、内容がカードより大きい場合は
   マージンが 0 になり上詰め表示＋スクロールで対処できる（はみ出し安全）。 */
.game-modal-content > #game {
  margin-top: auto;
  margin-bottom: auto;
}

/* 様々な画面サイズ / アスペクト比に対応：
   ノートPCや低解像度・縦長ウィンドウでは余白を詰めて内容を優先表示する */
@container (max-width: 960px) or (max-height: 720px) {
  .game-modal-content {
    padding: 18px 20px;
    border-radius: 10px;
    width: min(94vw, 720px);
  }
}

@container (max-width: 640px) or (max-height: 520px) {
  .game-modal-content {
    /* 極端に小さい画面では幅を優先し、はみ出しはスクロールで対処 */
    width: 96vw;
    max-height: 94dvh;
    padding: 14px 16px;
  }
}

/* モーダル内テキスト色調整 */
.game-modal-content #word { color: #f0f6fc; }
.game-modal-content #jp { color: #b7c0c9; }
.game-modal-content #roma { color: #8ebff7; }
.game-modal-content .time-left { color: #f0f6fc; }



/* =====================================================
  結果前の共通イントロ（全モード共通）
===================================================== */
#endIntro {
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.9);

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;

  transition: opacity 0.4s ease;

  /* z-index: 9999; */ /* → 画面階層セクションへ移動 */
}

/* 表示状態 */
#endIntro.show {
  opacity: 1;
  pointer-events: auto;
}

/* テキスト */
.introText {
  color: white;
  font-size: clamp(1.5rem, calc(var(--dvw) * 6), 44px); /* デザイン基準(1600)で固定 */
  letter-spacing: 4px;
  padding: 0 12px;       /* 端に張り付かないように */
  box-sizing: border-box;
  max-width: 100%;

  opacity: 0;
  transform: translateY(10px);

  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

/* テキスト表示 */
#endIntro.show .introText {
  opacity: 1;
  transform: translateY(0);
}


/* daily mode======================================== */
.end-intro {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);

  display: none;
  align-items: center;
  justify-content: center;

  font-size: clamp(1.5rem, calc(var(--dvw) * 6), 42px); /* デザイン基準(1600)で固定 */
  font-weight: bold;
  color: white;
  letter-spacing: 2px;
  padding: 0 16px;       /* 端に張り付かないように */
  box-sizing: border-box;

  /* z-index: 9999; */ /* → 画面階層セクションへ移動 */
}

/* =====================================================
   デイリー結果画面：全体の中央寄せと横幅制限
   ===================================================== */
.quest-result-inner,
.enemy-result-container,
.skill-result-container,
.result-container-centered {
  width: 100%;
  max-width: 760px; /* 広がりすぎない適度な幅 */
  margin: 0 auto;   /* 左右中央寄せ */
  text-align: center;
}

/* 左（ラベル） */
.result-label {
    color: #8b949e;
}

/* 右（値） */
.result-value {
  font-weight: bold;
  color: #c9d1d9;
}

/* 結果バッジ */
.r-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  margin: 6px 3px 0 3px;
}
.r-badge.rank   { background: #10b981; color: #fff; }
.r-badge.online { background: #2563eb; color: #fff; }

/* 結果の記録更新表示(バッジではなくシンプルなテキスト) */
.result-note {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 6px 4px 0;
}
.result-note.new    { color: #10b981; } /* ★ NEW RECORD(RANK IN と同じ緑) */
.result-note.online { color: #3b82f6; } /* ↑ ONLINE RECORD UPDATED */


.result-free-badge {
  display: inline-block;
  margin: 8px auto 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 999px;
  background: #4caf50;
  color: white;
  letter-spacing: 1px;

}

.ranking-season {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}

/*  */
.ranking-disabled {
  margin-top: 12px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  text-align: center;
  color: #8d8d8d;
  font-size: 0.8rem;
  line-height: 1.6;
}

.ranking-disabled h3 {
  margin: 0 0 5px;
  font-size: 0.7rem;
  color: #787878;
}

/* リザルト画面全体のカードスタイル */
.menu-style-card {
    background: rgba(13, 17, 23, 0.92);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(88, 166, 255, 0.05);
    backdrop-filter: blur(10px);
}

/* ワイドレイアウトの設定 */
.result-container-centered.wider {
    width: 90%;
    max-width: 760px;
    padding: 30px 40px;
}

/* 狭い画面では結果カードの余白・間隔を詰めて横方向のはみ出しを防ぐ */
@container (max-width: 560px) {
  .result-container-centered.wider {
    padding: 20px 16px;
  }
  .result-header-row {
    gap: 20px 32px;
    padding: 10px;
    flex-wrap: wrap;
  }
  .result-header-item .r-value.big {
    font-size: 28px;
  }
  .result-stats-grid {
    gap: 8px 20px;
    padding: 12px;
  }
}

.result-title-main {
    font-size: 14px;
    color: #8b949e;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(48, 54, 61, 1);
    padding-bottom: 10px;
}

/* スコアとランクの横並びヘッダー */
.result-header-row {
    display: flex;
    justify-content: center;
    gap: 80px;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(88, 166, 255, 0.05);
    border: 1px solid rgba(88, 166, 255, 0.1);
    border-radius: 4px;
}

.result-header-item {
    text-align: center;
}

.result-header-item .r-label {
    font-size: 12px;
    color: #8b949e;
    margin-bottom: 5px;
}

.result-header-item .r-value.big {
    font-size: 36px;
    font-weight: bold;
    font-family: var(--font-mono);
}

.result-header-item .accent {
    color: #58a6ff;
    text-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
}

/* 統計情報の2列グリッド */
.result-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 60px;
    margin: 15px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.result-stats-grid .r-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

/* ボタンの横並び制御 */
.result-buttons.horizontal {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 25px;
    width: 100%;
}

.result-buttons.horizontal button {
    min-width: 140px;
    padding: 10px 20px;
    margin: 0 !important; /* JSで付与されるマージンをリセット */
    font-size: 13px;
}

/* バッジエリア */
.result-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

/* ONLINE RECORD UPDATED をランキングの左横に並べる */
.online-ranking-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}

.online-ranking-container .result-online-ranking {
  max-width: 400px; /* 幅はコンテンツに合わせる(上限のみ) */
}

.online-ranking-container .result-note.online {
  flex-shrink: 0;
  margin: 0;
  padding-top: 4px; /* ランキング先頭行と縦位置を合わせる 4px*/
}

/* ボタン群 */
.result-btn {
  margin: 4px;
  padding: 8px 15px;
  clip-path: none; /* 多角形を解除 */
  background: rgba(88, 166, 255, 0.1); /* Blueish background */
  border: 1px solid rgba(88, 166, 255, 0.4); /* Blue border */
  border-radius: 8px; /* More rounded corners */
  color: #f0f6fc; /* Light text */
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); /* Subtle shadow */
}

.result-btn:hover {
  background: rgba(88, 166, 255, 0.2); /* Lighter blue on hover */
  color: #fff; /* White text on hover */
  border-color: #58a6ff; /* Brighter border on hover */
  box-shadow: 0 4px 12px rgba(0,0,0,0.4); /* Stronger shadow on hover */
}



/* =====================================================
   フォント（日本語表示系を丸ゴ寄りに統一）
   ===================================================== */
#word, #word-long, #jp, #roma, #kana-scroll, #roma-scroll, #progress-text, #timeLeft  {
  font-family: var(--font-ja);
}

/* =====================================================
   単語・入力表示（中央メインUI）
   ===================================================== */
#modeBadges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px; /* バッジ間の余白 */
  margin: 8px auto;
}

#modeBadges > div {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#freeModeBadge,
#missModeBadge {
  display: none; /* 初期非表示 */
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 999px;
  color: white;
  letter-spacing: 1px;
}

#freeModeBadge {
  background: #4caf50;
}

#missModeBadge {
  background: #dc5353;
}


#word {
  font-size: 2.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #f0f6fc;
  letter-spacing: 0.02em;
}

#jp { font-size:1.6rem; }

#roma {
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  color:#5e57d0;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* 表示ラップ */
#jp-wrap, #roma-wrap {
  width: 100%;
  text-align: center;
  min-height: 40px;
}

#jp, #roma {
  display: inline-block;
  text-align: center;
  word-break: break-all;
}

.done { 
  color: #4a4d50; /* 少し暗めにして未入力との差を強調 */
  text-shadow: none;
}

/* =====================================================
   残り時間表示
   ===================================================== */
.time-left {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 8px 0;
  color: #f0f6fc;
}

/* =====================================================
   長文表示 / スクロール表示
   ===================================================== */
#word-long-wrap {
    display: none;
    height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(88, 166, 255, 0.2);
    margin-bottom: 10px;
    padding: 16px 20px;
    line-height: 1.6; /* フォントサイズに対して行間を広げる */
    font-size: 34px;
    text-align: left; /* 長文は左揃えを基本とする */
}

#word-long {
    font-size: 1.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #f0f6fc;
    letter-spacing: 0.02em;
}

#word-scroll-wrap {
  height: 120px;
  overflow-y: auto;
  overflow-x: hidden;
}

#word-scroll {
  white-space: normal;
  line-height: 1.8;
  font-size: 28px;
}

#word-scroll span.done { opacity: 0.35; }

#scroll-wrap {
  display: none;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid rgba(88, 166, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
}

#kana-scroll, #roma-scroll {
  white-space: nowrap;
  overflow-x: auto;
  padding: 6px 10px;
  border-radius: 10px;
  box-sizing: border-box;
  scrollbar-width: none;
  font-weight: 500;
}

#kana-scroll {
  font-size: 23px;
  color: #b7c0c9;
  margin-bottom: 2px;
}

#roma-scroll {
  font-size: 23px;
  color: #679bd6;
  margin-top: 0;
  padding: 0 10px;
}

#kana-scroll::-webkit-scrollbar,
#roma-scroll::-webkit-scrollbar { display: none; }

/* =====================================================
   スコア / プログレス / スピード / タイムバー
   ===================================================== */
#scoreValue {
  font-size: 3rem;
  font-weight: 700;
  color: #4f46e5;
}

#progress-container,
#speed-container,
#time-bar-container {
  width: 90%;
  max-width: 600px;
  margin: 10px auto;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(88, 166, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}
#progress-container { height: 12px; }
#progress-container {
  position: relative;
  overflow: visible;  /* ←これ重要 */
}

#progress-blocks { display: flex; height: 100%; }
#progress-blocks {
  overflow: hidden;   /* ←バーだけ閉じ込める */
}
.progress-block.done { background: rgba(88, 166, 255, 0.15); }
.progress-block {
  flex: 1;
  background: rgba(88, 166, 255, 0.6);
  border-right: 1px solid rgba(88, 166, 255, 0.1);
}
.progress-block:last-child { border-right: none; }

#progress-text {
  position: absolute;
  top: -20px;        /* ←バーの上に出す */
  right: 0;
  font-size: 20px;
  color: #f0f6fc;
  pointer-events: none;
  font-weight: bold;
}

#time-bar-container {
  height: 12px;
  display: none;
  position: relative;
  overflow: visible;
}

#time-bar {
  position: relative;
  width: 100%;
  height: 100%;
  background: #ff9d00; /* 紺色の補色であるサイバーオレンジ */
  transform-origin: left center;
  transform: scaleX(1);
  border-radius: 6px;
  z-index: 9000;
}

#timeLeft {
  position: absolute;
  top: -28px;        /* ←バーの上に出す */
  right: 0;
  font-size: 20px;
  color: #f0f6fc;
  pointer-events: none;
  font-weight: bold;
  z-index: 9100;
}

.time-num {
  font-size: 30px;   /* 大きく */
  font-weight: bold;
}

.time-unit {
  font-size: 16px;   /* 小さく */
  margin-left: 2px;
}



#speed-container { height: 12px; margin-bottom: 6px; }

#speed-bar {
  height: 100%;
  width: 0%;
  background: #60a162;
  transition: width 0.15s linear;
}

#speed-label {
  font-size: 0.9rem;
  color: #8b949e;
  margin-bottom: 10px;
}

.clear-circle {
  position: relative;   /* ← fixedやめる */
  display: block;

  width: 100px;
  height: 100px;

  margin: 10px auto 6px auto; /* ← 中央寄せ＋日本語の上 */

  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  font-family: var(--font-ja);
  transform: scale(0.6);   /* ← 全体を縮小 */
  transform-origin: center;
}

/* 上の CLEAR */
.clear-circle .label {
  font-size: 13px;
  color: #8b949e;
  letter-spacing: 2px;
  opacity: 0.7;
}

/* 下の数字 */
.clear-circle .count {
  color: #f0f6fc;
  font-size: 28px;
  font-weight: bold;
}
#time-circle-container {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 10px auto;
  display: none;
}

/* ===== 外側リング ===== */
#time-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: conic-gradient(
    rgba(88, 166, 255, 0.6) 0deg,
    rgba(88, 166, 255, 0.1) 0deg
  );

  /* z-index: 0; */ /* → 画面階層セクションへ移動 */
}

/* ===== 空洞（ドーナツの内側） ===== */
#time-circle::before {
  content: "";
  position: absolute;
  inset: 6px;
  background: #0d1117;
  border-radius: 50%;
  /* z-index: 0; */ /* → 画面階層セクションへ移動 */
}

/* ===== テキスト共通 ===== */
#time-circle .label,
#time-circle .count {
  position: relative;
  /* z-index: 2; */ /* → 画面階層セクションへ移動 */
  color: #f0f6fc;
}

/* 上：TIME */
#time-circle .label {
  font-size: 10px;
  letter-spacing: 1px;
  opacity: 0.7;
  line-height: 1;
}

/* 下：秒数 */
#time-circle .count {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.2;
}

/* =====================================================
   ゲーム画面内 戻るボタン
   ===================================================== */
.game-back-btn {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.4);
  border-radius: 8px;
  color: #f0f6fc;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.15s;
  margin-top: 15px;
}
.game-back-btn:hover {
  background: rgba(88, 166, 255, 0.2);
  color: #fff;
  border-color: #58a6ff;
}

/* =====================================================
   フリーモード難易度説明
   ===================================================== */


.difficulty-info{
    margin-top:2px;
    margin-bottom:6px;
    padding:0px 14px 12px;

    font-size:11px;
    line-height:1.5;

    background:rgba(255,255,255,0.05);
    border-radius:6px;

    white-space:pre-line;
    color: #e6edf3;
}

.difficulty-buttons{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
    align-items:center;
}

/* ===============================
   フリーモード詳細設定
   =============================== */

/* フリーモード内の全select */
#freeModeConfig select {
    background: #000;
    color: #fff;
    border: 1px solid #666;
    border-radius: 6px;
    padding: 6px 10px;
}

/* 開いた候補リスト */
#freeModeConfig select option {
    background: #000;
    color: #fff;
}

.free-config-container {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* z-index: 10550; */ /* → 画面階層セクションへ移動 */
  width: 500px;
  margin-top: 0;
  padding: 24px;
  max-height: calc(var(--dvh) * 85); /* 項目が増えても画面内に収まるように制限 */
  overflow-y: auto; /* はみ出す場合はスクロール可能にする */
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  text-align: left;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(88, 166, 255, 0.05);
}

/* スクロールバーは style.css 冒頭の共通設定（黒系）に統一 */

.config-section-title {
  font-size: 11px;
  color: #58a6ff;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(88, 166, 255, 0.2);
  padding-bottom: 6px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-section-title::before {
  content: "▶";
  font-size: 10px;
}

/* パターン選択ボタン（エネミーモード等） */
.pattern-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pattern-btn {
  padding: 8px 16px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
  margin: 0 !important;
  width: auto !important;
  background: rgba(88, 166, 255, 0.05) !important;
  border: 1px solid rgba(88, 166, 255, 0.3) !important;
  color: #8b949e !important;
  cursor: pointer;
  transition: 0.2s;
  text-align: center !important;
  font-weight: bold !important;
}

.pattern-btn:hover {
  background: rgba(88, 166, 255, 0.15) !important;
  color: #f0f6fc !important;
}

.pattern-btn.active {
  background: rgba(88, 166, 255, 0.3) !important;
  border-color: #58a6ff !important;
  color: #ffffff !important;
  text-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.3);
}

/* 難易度ボタン（EASY/NORMAL/HARD/MASTER）は4つ並んでも1行に収める
   ※ createDifficultySelector で付与される .pattern-selector（wrap+gap:10px）より
     後に宣言して、ラップされないように上書きする */
.difficulty-buttons.pattern-selector {
  flex-wrap: nowrap;
  gap: 6px;
}

.difficulty-buttons .pattern-btn {
  padding: 8px 8px !important;
  white-space: nowrap;
}

/* 設定項目行（スライダー） */
.config-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 4px 0;
}

.config-row:hover {
  background: rgba(88, 166, 255, 0.03);
}

.config-row label {
  flex: 0 0 140px; /* 文字が折り返されないように幅を拡張 */
  font-size: 12px;
  color: #c9d1d9;
  white-space: nowrap; /* 確実に1行に収める */
  width: 80px;
  flex-shrink: 0;
}

/* ROMAJI 設定行だけラベル幅を広げてコントロールを少し離す */
.config-row.romaji-row label {
  flex: 0 0 220px;
}

.romaji-keybind-controls {
  display: inline-flex;
  gap: 10px;
  margin-left:30px;
  margin-top: 5px;
}

.config-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 2px;
  background: rgba(88, 166, 255, 0.2);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

.config-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 18px;
  background: #58a6ff;
  border-radius: 1px;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
  transition: 0.2s;
}

.config-value {
  flex: 0 0 55px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 14px;
  color: #58a6ff;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(88, 166, 255, 0.4);
}

/* LV（レベル）設定値の特別色（黄緑系） */
.config-value.level-color {
  color: #9fe870; 
  text-shadow: 0 0 8px rgba(159, 232, 112, 0.4);
}

/* パターンの詳細エリアのアニメーション */
.pattern-detail {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ジャンル複数選択チェックボックス */
.genre-checkbox-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  flex: 1; /* 残りの幅を埋める */
}

.genre-checkbox-container label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  flex: initial !important; /* .config-row label のスタイルを上書き */
  width: auto !important;
}
/* ===============================
   Chain UI
================================ */


#chainUI{
    position:absolute;
    top:20px;
    left:50%;
    transform:translateX(-50%);
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:6px;
    pointer-events:none;
}


/* ===============================
   上段
================================ */
#chainTopLine{

    width:240px;
    height:21px; 
    position:relative;
}

/* chain text */

#chainLabel{
  font-size: 10px;   /* 小さく */
  opacity: 0.7;
  letter-spacing: 1px;
}
#chainValue{

    line-height: 1.1;
    font-size:24px;
    font-weight: bold;
    letter-spacing:1px;
    color:rgb(137, 137, 137);
    transition:transform 0.15s;
}

#chainCount{

    position:absolute;

    left:50%;
    bottom:0%;

    transform:translateX(-50%);

    text-align:center;
}

/* ===============================
   multiplier
================================ */

#chainMultiplier {
    position:absolute;
    right:0;
    bottom:0%;

    text-align: right;
    font-size: 12px;
    color: rgba(116, 116, 116, 0.828);
    /* 改行なし */
    white-space:nowrap; 

}

/* bar container */

#chainBarContainer{
    position: relative;
    width:240px;
    height:8px;
    border-radius:0px;
    background:rgba(218, 218, 218, 0.329);
    overflow:visible;
    backdrop-filter:blur(4px);
}

/* bar */

#chainBar{
    height:100%;
    width:100%;
    border-radius:0px;
    background:linear-gradient(90deg,#4ecdc4,#44aaff);
    transition:width 0.1s linear;
}


/* =====================
   左右ブラケット
===================== */

#chainBarContainer::before,
#chainBarContainer::after {

    position: absolute;

    top: 50%;

    transform: translateY(-50%);

    font-size: 12px;

    font-weight: bold;

    line-height: 1;

    color:
        rgba(160, 160, 160, 0.75);

    text-shadow:
        0 0 8px rgba(103, 103, 103, 0.126);

    pointer-events: none;
}

#chainBarContainer::before {

    content: "[";

    left: -8px;
}

#chainBarContainer::after {

    content: "]";

    right: -8px;
}


/* =====================
   Combo Tier Bar
===================== */

#comboTierWrapper {

    display: flex;

    gap: 3px;

    width: 100%;

    height: 6px;

    margin-top: 4px;
}

.combo-tier-block {

    position: relative;

    flex: 1;

    overflow: hidden;

    background:
        rgba(174, 174, 174, 0.808);

    border:
        1px solid rgba(255,255,255,0.08);
}

/* =====================
   達成済みTier
===================== */

.combo-tier-block.filled {

    background:
        #ffd9ae;

    border-color:
        #fec273;
}

/* =====================
   現在進行中Tier
===================== */

.combo-tier-block.active::before {

    content: "";

    position: absolute;

    left: 0;
    top: 0;
    bottom: 0;

    width: var(--fill);

    background:
        #fff2d7;

    transition:
        width 0.08s linear;
}

.combo-tier-block.overdrive-all.active::before {

    background:
        #ffce6b;
}

/* =====================
   Tier達成時Flash
===================== */

.combo-tier-block.flash {

    animation:
        comboTierFlash 0.35s ease-out;
}

@keyframes comboTierFlash {

    0% {

        transform: scaleY(1);

        filter:
            brightness(1);
    }

    40% {

        transform: scaleY(2.6);

        filter:
            brightness(2.4);
    }

    100% {

        transform: scaleY(1);

        filter:
            brightness(1);
    }
}

/* コンボ全てマックス時OVERDRIVE */
.combo-tier-block.overdrive-all {

    background:
        #ffce6b;
     

    border-color:
        #ffe08a;

    box-shadow:
        0 0 4px rgba(255, 220, 120, 0.28),
        0 0 8px rgba(255, 210, 80, 0.16);

    animation:
        overdrivePulse 1.8s ease-in-out infinite;

    transform-origin: center;    

    filter:
        brightness(1.05);
}



@keyframes overdrivePulse {

    0% {

        transform:
            scale(1);

        filter:
            brightness(1);

        box-shadow:
            0 0 4px rgba(255,220,120,0.24),
            0 0 8px rgba(255,210,80,0.12);
    }

    50% {

        transform:
            scale(1.05);

        filter:
            brightness(1.12);

        box-shadow:
            0 0 6px rgba(255,235,150,0.35),
            0 0 14px rgba(255,215,90,0.22);
    }

    100% {

        transform:
            scale(1);

        filter:
            brightness(1);

        box-shadow:
            0 0 4px rgba(255,220,120,0.24),
            0 0 8px rgba(255,210,80,0.12);
    }
}


/* =====================================================
   設定画面
   ===================================================== */
#settings {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 900px; /* Wider to match stats-window */
  max-height: calc(var(--dvh) * 80); /* Shorter to match stats-window */
  overflow-y: auto; 
  /* z-index: 10600; */ /* → 画面階層セクションへ移動 */
  margin: 0;
  padding: 20px 25px; /* More padding */

  background: rgba(13, 17, 23, 0.95); /* Dark background from stats-window */
  border: 1px solid rgba(88, 166, 255, 0.4); /* Blue border from stats-window */
  border-radius: 14px; /* Rounded corners from stats-window */
  box-shadow: 0 8px 32px rgba(0,0,0,0.6); /* Shadow from stats-window */

  font-family: var(--font-ja);
}
/* Backdrop filter for settings screen */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px; /* 狭く */
  margin-bottom: 5px; /* 狭く */
}

/* 描画品質セレクト（いろいろな画面環境に対応） */
.quality-select {
  width: 100%;
  max-width: 340px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(88, 166, 255, 0.4);
  background: #0d1117;
  color: #f0f6fc;
  font-family: var(--font-ja);
  font-size: 13px;
  cursor: pointer;
}
.quality-select:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 8px rgba(88, 166, 255, 0.35);
}

/* SETTING の×は常にモーダル枠の右上に固定する。
   #settings は transform を持つため、子の position:fixed の基準は
   モーダル枠（#settings の padding box）になり、内部スクロールでも
   位置が動かない。
   また #settings button（背景・枠・角丸・影・余白・文字サイズ）を
   ここで打ち消し、装飾なしのシンプルな×だけを表示する。 */
#settings #settingsBackBtn {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 20;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: #fff;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  text-transform: none;
}

/* 装飾なしのまま、色のフィードバックだけ残す */
#settings #settingsBackBtn:hover,
#settings #settingsBackBtn:focus {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #ff9800;
  outline: none;
}

#settings h2 {
  margin-top: 0;
  margin-bottom: 5px; /* 狭く */
  /* clear: both; は右上×が position:fixed（float なし）になったため不要 */
  font-size: clamp(1.6rem, 4vw, 2rem); /* ★RECORDS/MUSIC/オンラインと統一 */
  font-weight: 900;
  font-style: bold;
  color: #85a8d3; /* Blueish header from stats-header */
  letter-spacing: -1px;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.3); /* Blue shadow */
  text-align: center; /* Center align title */
  text-transform: uppercase; /* Uppercase */
}

/* セクション */
#settings fieldset { /* Similar to .daily-stats-card */
  background: rgba(13, 17, 23, 0.92); /* Dark background from daily-stats-card */
  border: 1px solid rgba(88, 166, 255, 0.3); /* Blue border from daily-stats-card */
  border-radius: 12px; /* Rounded corners from daily-stats-card */
  padding: 12px; /* 狭く */
  margin-bottom: 10px; /* 狭く */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(88, 166, 255, 0.05); /* Shadow from daily-stats-card */
  backdrop-filter: blur(5px); /* Blur effect */
}

#settings legend { /* Similar to .daily-stats-section */
  padding: 0 6px; /* Slightly more padding */
  font-weight: 900; /* Bolder */
  color: #83abd9; /* Blueish color from daily-stats-section */
  font-size: 0.9em; /* Slightly smaller */
  text-transform: uppercase; /* Uppercase */
  letter-spacing: 1px; /* Letter spacing */
  text-shadow: 0 0 8px rgba(88, 166, 255, 0.4); /* Blue shadow */
  border-bottom: 1px solid rgba(88, 166, 255, 0.2); /* Bottom border */
  margin-bottom: 8px; /* 狭く */
}

/* チェック行 */
#settings label {
  display: flex;
  align-items: center;
  gap: 6px; /* 狭く */
  margin: 6px 0; /* Slightly more margin */
  font-weight: normal; /* Less bold */
  color: #c0c0c0; /* Softer color from daily-stats-row */
  cursor: pointer;
  font-size: 0.85rem;
}

/* サウンド設定行のレイアウト */
.sound-setting-row {
  display: flex;
  align-items: center;
  gap: 10px; /* 狭く */
  margin: 8px 0; /* 狭く */
}

.sound-setting-row label {
  flex: 0 0 80px;
  margin: 0 !important;
  font-size: 0.8rem;
  color: #8b949e;
  letter-spacing: 0.5px;
}

.sound-setting-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 2px;
  background: rgba(88, 166, 255, 0.2);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

.sound-setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 18px;
  background: #58a6ff;
  border-radius: 1px;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
  cursor: pointer;
  margin-top: -8px;
  transition: background 0.2s, transform 0.1s;
}

.sound-setting-row input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 18px;
  background: #58a6ff;
  border: none;
  border-radius: 1px;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
  cursor: pointer;
}

.sound-setting-row input[type="range"]:hover::-webkit-slider-thumb {
  background: #fff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.sound-value {
  flex: 0 0 45px;
  text-align: right;
  font-family: var(--font-mono); /* 等幅フォントで数字の揺れを防止 */
  font-size: 0.8rem;
  color: #58a6ff;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.5);
}

/* チェック */
#settings input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #58a6ff;
  cursor: pointer;
}

/* ボタン群 */
#settings button {
  margin: 2px; /* 少し詰める */
  padding: 6px 12px; /* 小さいサイズに合わせる */
  clip-path: none; /* 多角形を解除 */
  background: rgba(88, 166, 255, 0.1); /* Blueish background */
  font-size: 12px; /* 小さいサイズに合わせる */
  border: 1px solid rgba(88, 166, 255, 0.4); /* Blue border */
  border-radius: 8px; /* More rounded corners */
  color: #f0f6fc; /* Light text */
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); /* Subtle shadow */
}

#settings button:hover,
#settings button:focus {
  background: rgba(88, 166, 255, 0.2); /* Lighter blue on hover */
  color: #fff; /* White text on hover */
  border-color: #58a6ff; /* Brighter border on hover */
  box-shadow: 0 4px 12px rgba(0,0,0,0.4); /* Stronger shadow on hover */
  outline: none;
}

.data-btn-row {
  display: flex;
  gap: 2px;
  flex-wrap: wrap; /* Allow buttons to wrap */
  justify-content: center; /* Center buttons */
}

/* Resetは不可逆操作のため、Export / Importと視覚的に区別する。 */
#settings .backup-reset-button {
  background: rgba(248, 81, 73, 0.12);
  border-color: rgba(248, 81, 73, 0.55);
  color: #ffb4ae;
}

#settings .backup-reset-button:hover:not(:disabled),
#settings .backup-reset-button:focus:not(:disabled) {
  background: rgba(248, 81, 73, 0.25);
  border-color: #f85149;
  color: #fff;
  outline: none;
}

#settings .backup-reset-button:disabled {
  background: rgba(248, 81, 73, 0.08);
  border-color: rgba(248, 81, 73, 0.25);
  color: rgba(255, 180, 174, 0.55);
  opacity: 0.7;
  cursor: not-allowed;
}

.backup-reset-warning {
  color: #ffb4ae;
}

.slot-cleared {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: linear-gradient(90deg,#28a745,#1e7b34);
  color: #fff;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

/* ★EXTRA CLEAR バッジ（EXTRAワールド全クリア。CLEARED バッジの横に表示） */
.slot-extra-cleared {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: linear-gradient(90deg,#a855f7,#6d28d9);
  color: #fff;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

.slot-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 危険系 */
#settings button[id*="reset"] {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ea6969; /* Red border */
  color: #eb7e7e; /* Red text */
}

#settings button[id*="reset"]:hover,
#settings button[id*="reset"]:focus {
  background: rgba(239, 68, 68, 0.3);
  outline: none;
}

/* 戻るボタンだけ強調（旧：下部BACKボタン用。右上×に移行済みのため無効化） */
/*
#settingsBackBtn {
  margin-top: 8px;
  width: auto;
  padding: 10px 30px;
  background: #4b5563 !important;
  color: #ffffff !important;
  border: 1px solid #6b7280 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}
*/

/* 音量リセットボタンのスタイル */
.reset-btn {
  flex-shrink: 0; /* 縮まないようにする */
  width: 24px !important;
  height: 24px !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 12px !important;
  line-height: 22px; /* 中央揃え */
  text-align: center;
  border-radius: 50% !important; /* 円形にする */
  background: rgba(139, 148, 158, 0.2) !important;
  border: 1px solid rgba(139, 148, 158, 0.4) !important;
  color: #8b949e !important;
  font-weight: bold;
}

/* keybind */
/* フィールドセット全体を中央寄せ */
.keybind-fieldset {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* タイトルと中身を横並び */
.keybind-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px; /* 狭く */
  margin-top: 8px; /* 狭く */
  margin-bottom: 8px; /* 狭く */
}

/* 左ラベル縦並び */
.keybind-labels {
  display: flex;
  flex-direction: column;
  gap: 0px;
  text-align: right;
  font-size: 0.85rem;
  color: #c0c0c0; /* Softer color */
}

/* 右セレクト縦並び */
.keybind-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* セレクトを少し大きく */
.keybind-controls select {
  font-size: 14px;
  padding: 2px 4px;
  min-width: 100px;
  background: #0d1117;
  color: white;
  border: 1px solid #30363d;
  border-radius: 4px; /* Rounded corners for select */
}

/* 例: main.css など、スタイルシートに追加 */
.setting-item.setting-item-select > select {
  margin-left: 12px; /* 左側に余白を追加 */
}


.romaji-keybind-controls select {
  font-size: 14px;
  padding: 2px 4px;
  min-width: 100px;
  background: #0d1117;
  color: white;
  border: 1px solid #30363d;
  border-radius: 4px; /* Rounded corners for select */
}
.config-row {
  margin-right: 16px;
}

/* 保存ボタンも中央 */
#saveKeybindBtn {
  margin-top: 5px;
  /* width: 100%; を削除して他のボタンと合わせる */
}

/* Player Name Box */
.player-name-box {
  display: flex;
  gap: 8px;
  margin: 0; /* setting-rowで制御するためリセット */
  align-items: center;
  flex-grow: 1; /* 残りの幅をすべて使用 */
}

#playerNameInput {
  flex-grow: 1; /* Allow input to take available space */
  padding: 6px 10px; /* Adjusted padding */
  font-size: 0.9rem; /* Adjusted font size */
  border-radius: 6px; /* Rounded corners */
  border: 1px solid #30363d; /* Darker border */
  background: #0d1117; /* Dark background */
  color: #f0f6fc; /* Light text */
}

#savePlayerNameBtn {
  flex-shrink: 0; /* Player IDのボタンと挙動を合わせる */
}

/* 設定項目を横並びにするための行 */
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px; /* 狭く */
  margin: 8px 0; /* 狭く */
  flex-wrap: nowrap; /* 折り返しを禁止 */
}

/* 設定項目のタイトル */
.setting-item-title {
  font-size: 12px;
  color: #c9d1d9;
  margin-bottom: 4px;
  font-weight: bold;
  text-align: left;
  white-space: nowrap; /* ラベルの折り返しを禁止 */
}

/* Player ID Box */
.player-id-box {
  display: flex;
  gap: 6px;
  margin: 0; /* setting-rowで制御するためリセット */
  align-items: center;
  flex-grow: 1; /* 残りの幅をすべて使用 */
}

.player-id-display {
  flex-grow: 1;
  padding: 6px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  background: #0d1117;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#copyPlayerIdBtn,
#importPlayerIdBtn {
  flex-shrink: 0;
}

#importPlayerIdBtn {
  background: rgba(76, 175, 80, 0.1) !important;
  border-color: rgba(76, 175, 80, 0.5) !important;
}

/* 設定画面の説明文 */
.setting-description {
  font-size: 11px;
  color: #8b949e;
  margin-top: 8px; /* 狭く */
  line-height: 1.5;
  text-align: left;
  background: rgba(13, 17, 23, 0.5);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #30363d;
}


/* Responsive adjustments for smaller screens */
@container (max-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr; /* Single column on smaller screens */
  }
  #settings fieldset {
    margin-bottom: 10px; /* Slightly less margin for single column */
  }
  .keybind-row {
    flex-direction: column; /* Stack keybind labels and controls vertically */
    gap: 10px;
  }
  .keybind-labels {
    text-align: center; /* Center align labels when stacked */
  }
  .keybind-controls select {
    min-width: 150px; /* Wider select on small screens */
  }
  .data-btn-row button {
    flex-grow: 1; /* Allow buttons to grow */
  }
}

/* =====================================================
   記録画面 全体
   ===================================================== */
#records {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  /* z-index: 10550; */ /* → 画面階層セクションへ移動 */
  font-family: var(--font-ja);
  color: #d1d5db;
  background: #05080a; /* bodyの背景色に合わせる */
  background-image: 
    linear-gradient(rgba(18, 25, 33, 0.6), rgba(5, 8, 10, 0.7)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15) 0px, rgba(0, 0, 0, 0.15) 1px, transparent 1px, transparent 2px);
  padding: 20px;
}

/* RECORDS の×（右上）はコンテンツをスクロールしても
   見失わないように fixed で画面右上へ固定する。
   top/right は #records の padding(20px) + 8px で位置を揃えている。
   ※装飾はなくし、シンプルな×のみ。余白は 0 にして top/right を
     そのまま効かせる（SETTING の×と同じ見た目）。 */
#records #recordsBackBtn {
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 20;
  margin: 0;
  padding: 0;
}

/* 全体幅 */
#records-container {
  max-width: 1000px;
  margin: 0 auto;
}

/* records-top は block 的に使う（flex崩れ防止） */
#records-top {
  width: 100%;
}

/* =====================================================
    記録画面 ヘッダー
   ===================================================== */

#records-header {
  text-align: center;
  margin-bottom: 14px;
}

#records-header h2 {
  font-size: clamp(1.6rem, 4vw, 2rem); /* ★SETTING/MUSIC/オンラインと統一 */
  font-weight: 900;
  color: #668ebc; /* サイバーブルー */
  text-shadow: 0 0 10px rgba(95, 153, 219, 0.446); /* サイバーブルーのシャドウ */
  margin-bottom: 15px;
}

/* モードボタン中央 */
#records-controls {
  display: flex;
  justify-content: center; /* 中央寄せ */
  gap: 8px; /* ボタン間の隙間 */
  margin-bottom: 18px; /* 下に余白 */
}

/* モードボタン */
#records .mode-buttons button {
  background: rgba(88, 166, 255, 0.1); /* 青系の背景 */
  border: 1px solid rgba(88, 166, 255, 0.4); /* 青系のボーダー */
  color: #f0f6fc; /* 明るいテキスト */
  font-weight: 600;
  padding: 6px 14px;
  transition: 0.15s;
  cursor: pointer;
  border-radius: 8px; /* 角丸 */
}

#records .mode-buttons button:hover,
#records .mode-buttons button:focus {
  background: rgba(88, 166, 255, 0.2); /* ホバーで少し明るく */
  color: #fff;
  border-color: #72acee;
  outline: none;
}

#records .mode-buttons button.active {
  background: #579eef; /* アクティブは強調 */
  color: #0d1117; /* 暗いテキスト */
  border-color: #6ca8ed;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.6); /* アクティブなシャドウ */
}

/* =====================================================
    記録画面 サマリーカード
   ===================================================== */

#recordsSummary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* 最小幅を少し狭く */
  gap: 12px;
  margin-bottom: 18px;
  width: 100%;
}

.summary-card {
  background: rgba(13, 17, 23, 0.8); /* 少し透明度を上げる */
  border: 1px solid rgba(88, 166, 255, 0.2); /* 全体を囲むボーダーに変更 */
  border-top: 3px solid #7a9ec8; /* 上部にアクセントライン */
  padding: 12px 16px; /* パディングを少し減らす */
  text-align: center;
  border-radius: 8px; /* 角丸を少し小さく */
}

.summary-label {
  font-size: 0.75rem; /* 少し小さく */
  color: #8b949e; /* リザルトラベルと統一 */
  margin-bottom: 4px; /* 間隔を詰める */
  text-transform: uppercase; /* 大文字に */
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f0f6fc; /* HUDの数値と統一 */
}

/* =====================================================
    記録画面 メインエリア（縦並び）
   ===================================================== */

#records-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

/* 共通カード */
.records-section {
  width: 100%;
  box-sizing: border-box;

  background: rgba(13, 17, 23, 0.92); /* メニューカードと統一 */
  border: 1px solid rgba(88, 166, 255, 0.3); /* サイバーブルーのボーダー */
  border-radius: 12px; /* 角丸 */
  padding: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(88, 166, 255, 0.05); /* シャドウ */
}

.records-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #83abd9; /* デイリー統計セクションと統一 */
  text-transform: uppercase;
}

/* =====================================================
    記録画面 グラフ
   ===================================================== */

#records-left {
  width: 100%;
}

#bestScoreGraph {
  min-height: 420px;
  width: 100%;
  background: rgba(0, 0, 0, 0.3); /* 少し透明な黒 */
  border-radius: 12px; /* 角丸 */
  border: 1px solid rgba(88, 166, 255, 0.2); /* 青系のボーダー */
  box-shadow: none;
}

/* =====================================================
    記録画面 ランキング
   ===================================================== */

#records-ranking {
  width: 100%;
}
#ranking {
  background: rgba(13, 17, 23, 0.92); /* メニューカードと統一 */
  padding: 14px;
  border: 1px solid rgba(88, 166, 255, 0.3); /* サイバーブルーのボーダー */
  border-radius: 12px; /* 角丸 */
}

/* =====================================================
    記録画面 履歴
   ===================================================== */

#records-bottom {
  margin-top: 16px;
}

#history {
  
  max-height: 240px;
  overflow-y: auto;

  background: rgba(13, 17, 23, 0.92); /* メニューカードと統一 */
  border: 1px solid rgba(88, 166, 255, 0.3); /* サイバーブルーのボーダー */
  border-radius: 12px; /* 角丸 */
  overflow-x: auto;
}

/* スクロールバーは style.css 冒頭の共通設定（黒系）に統一 */

#history table {
  font-size: 0.68rem;
  line-height: 1.15;
}

#history th,
#history td {
  padding: 3px 5px;
}

#history table {
  border-collapse: separate;
  border-spacing: 0;
}

#history th {
  position: sticky; /* スクロールしてもヘッダーを固定 */
  top: 0; /* 上部に固定 */
  /* z-index: 5; */ /* → 画面階層セクションへ移動 */
  background: #0d1117; /* 背景を不透明にして透過を防止 */
} 

/* =====================================================
    記録画面 テーブル共通
   ===================================================== */

#records table {
  width: 100%;
  border-collapse: separate; /* stickyな境界線を正しく表示するために変更 */
  border-spacing: 0;        /* セル間の隙間をなくしてcollapse風に見せる */
  background: transparent;
  color: #c9d1d9;
}

#records th {
  position: sticky;
  top: 0;
  /* z-index: 10; */ /* → 画面階層セクションへ移動 */
  background: #11151c; /* 完全に不透明な色を指定して内容が透けないようにする */
  color: #f0f6fc; /* 明るいテキスト */
  padding: 8px;
  font-weight: 700;
  border-bottom: 2px solid rgba(88, 166, 255, 0.4); /* 青系のボーダー */
}

#records td {
  padding: 8px;
  border-bottom: 1px solid rgba(88, 166, 255, 0.1); /* 青系のボーダー */
}

#ranking th,
#ranking td {
  padding: 3px 6px;
  font-size: 0.9rem;
  line-height: 1.2;
}

/* 偶数行 */
#records tr:nth-child(even) td {
  background: rgba(88, 166, 255, 0.01); /* より薄い青系の背景 */
}

/* hover */
#records tr:hover td {
  background: rgba(88, 166, 255, 0.05) !important; /* ホバーで青系の背景 */
}

/* =====================================================
    記録画面 下部ボタン
   ===================================================== */

#records-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

/* 旧：戻るボタンだけ強調（グレーの角丸ボタン）。
   装飾なしのシンプルな×（SETTING と統一）に変更したため無効化。
   位置と余白は上の「RECORDS の×（右上）」ブロックで指定している。
#records #recordsBackBtn {
  margin-top: 8px;
  flex: none;
  width: auto;
  padding: 6px 16px !important;
  background: #4b5563;
  color: #ffffff;
  border: 1px solid #6b7280;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  font-size: 12px;
  transition: 0.15s;
  cursor: pointer;
  font-weight: 700;
}

#records #recordsBackBtn:hover {
  background: #5a6573;
  border-color: #7c8694;
}
*/

#records-buttons button {
  flex: 1;
  max-width: 200px;
  padding: 10px 0;
  border: 1px solid rgba(88, 166, 255, 0.4);
  border-radius: 8px;
  background: rgba(88, 166, 255, 0.1);
  color: #f0f6fc;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}

#records-buttons button:hover,
#records-buttons button:focus {
  background: rgba(88, 166, 255, 0.2);
  outline: none;
}

.records-more-btn {
  flex: 1;
  max-width: 150px;

  padding: 3px 10px;
  border: none;
  border-radius: 10px;
  
  background: rgba(88, 166, 255, 0.1); /* 青系の背景 */
  border: 1px solid rgba(88, 166, 255, 0.4); /* 青系のボーダー */
  color: #f0f6fc; /* 明るいテキスト */
  font-weight: 700;
  font-size: 12px; /* フォントサイズを調整 */
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); /* Subtle shadow */
}
/* =====================================================
    記録画面 NEWバッジ
   ===================================================== */

/* ランキングの順位番号を囲む */
.rank-number {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    font-weight: bold;
}

/* ランキングの順位セル調整 */
.rank-cell {
    position: relative;
    display: flex;
    justify-content: center; /* 数字を中央に配置 */
    align-items: center;
    min-width: 100px; /* バッジを左端に置いても数字が中央に留まる幅を確保 */
}

/* ランキングテーブルのNEWバッジ */
.ranking-new-badge {
    position: absolute;
    left: 4px; /* セルの左端に固定 */ 
    background-color: #f59e0b; /* result-badge.new と統一 */
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6em;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none; /* クリックを阻害しない */
    animation: pulse-new 1.5s infinite; /* 点滅アニメーション */
}

 /* 一番最新の記録のNEWバッジ */
.ranking-new-badge.latest-record {
  background-color: #f85149; /* 赤系やゴールドなど、目立つ色 */
  animation: pulse-latest 1.5s infinite; /* より強調した点滅 */
  box-shadow: 0 0 10px rgba(248, 81, 73, 0.6); /* 赤い発光効果 */
}

@keyframes pulse-latest {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.4); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* @keyframes pulse-new {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
} */


/* =====================================================
  オンラインランキング表示
   ===================================================== */

#onlineRankingScreen {
  text-align: center;
  color: #222;
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;

  height: 100%;          /* ステージ（1600×900）基準 */
  overflow: hidden; /* 外側はスクロールさせない */
  background: #f4f6f8;
}

.ranking-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

/* タブは固定 */
.ranking-tabs {
  flex: 0 0 auto;
}

.ranking-tab {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #f3f3f3;
  color: #222;
  font-weight: 700;
  cursor: pointer;
}

.ranking-tab.active {
  background: #222;
  color: white;
}

#onlineRankingScreen > * {
  flex: 0 0 auto;   /* ヘッダー・タブ・自分の順位・ボタンは縮まず確実に表示 */
}

/* ここがスクロール領域（残り高さすべてを使用。
   固定60vhだとウィンドウが短いときに下のBACKボタンが見切れるため） */
#rankingList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;

  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px;
}


.rank-row {
  display: grid;
  grid-template-columns: 50px 1fr 90px;

  padding: 6px 10px;     /* ←ここ小さく */
  margin-bottom: 4px;    /* ←間隔減らす */

  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;    /* 少し小さく */
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);

  font-size: 13px;       /* ←ここ重要 */
  font-weight: 600;
}

.rank-row.my-rank {
  background: #e0e8f6; /* 少し青みがかった背景色 */
  border: 1px solid #a8c5f1;
  box-shadow: 0 2px 8px rgba(74, 124, 194, 0.2);
}

.rank-row.my-rank span {
  color: #1c3d6b; /* 濃い青色の文字 */
  font-weight: 700;
}


.rank-row span {
  color: #222;
}

.rank-row span:first-child {
  text-align: center;
  font-weight: 700;
  color: #444;
}

.rank-row span:nth-child(2) {
  text-align: center;
}

.rank-row span:last-child {
  text-align: center;
  font-weight: 700;
  color: #111;
}

/* ONLINE RANKING のタイトル（サイズのみ RECORDS/SETTING/MUSIC と統一。色はライトテーマの黒のまま） */
#onlineRankingScreen h2 {
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 900;
  color: #222;
  text-align: center;
}

/* ONLINE RANKING 右上の閉じるボタン（×）。
   他モーダルの ×（.save-modal-close-btn／.quest-modal-close-btn）と統一。
   #onlineRankingScreen は position: fixed なので絶対配置の基準になる。
   ※オンライン画面はライトテーマのため文字色だけ濃色にしている。 */
#onlineRankingScreen .ranking-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #333;
}

#onlineRankingScreen .ranking-close-btn:hover {
  color: #ff9800;
}

/* 旧：下部BACKボタン用スタイル（#rankingBackBtn は右上×に移行済み） */
#loadMoreRanking {
  margin-top: 16px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: #f0f0f0;
  color: #222;
  font-weight: 700;
  cursor: pointer;
}

#onlineRankingScreen {
  min-height: 0;
}

/* style.css に追加 */
.my-online-rank {
  margin: 15px 0;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  color: #232323;
}

.my-rank-position {
  font-weight: bold;
  color: #506f93;
  margin-left: 8px;
}


/* =====================================================
   プレイヤーHUD
   ===================================================== */
#playerHud {
  position: fixed;
  top: 10px;
  right: 10px;
  /* メニューカードと同じデザイン */
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(88, 166, 255, 0.3);
  color: #f0f6fc;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-family: var(--font-ui);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  width: 232px;
  display: none; /* 初期状態は非表示（メインメニュー表示時にJSで解除） */
  transition: all 0.25s ease;
}

.hud-header {
  text-align: center;
  font-weight: bold;
  margin-bottom: 10px;
  letter-spacing: 1.5px;
  color: #82a4cb; /* メニュータイトルと同じサイバーブルー */
  text-transform: uppercase;
  font-size: 12px;
  font-family: var(--font-ui);
}

.hud-row {
  display: flex;
  justify-content: flex-start; /* ラベルのすぐ横にランクを表示 */
  align-items: center;
  margin-top: 6px;
  margin-bottom: 4px;
  gap: 8px;
  font-family: var(--font-ui);
}

/* ラベル（KPM等）の色を薄く */
.hud-row > span:first-child {
  color: #ffffff;
}

.hud-rank {
  font-size: 12px;
  color: #b0bdc8; /* ランクもアクセントブルーにしてタイトルと合わせる */
  margin-left: 4px; /* ラベルとの隙間 */
  font-family: var(--font-ui);
  font-weight: 600;
}

/* バーと数値を横に並べるコンテナ */
.hud-bar-wrap {
  display: flex;
  align-items: center;
  gap: 15px; /* バーの ] と数値の間の距離 */
}

.hud-bar {
  flex: 1;
  position: relative;
  height: 10px;
  background: transparent;
  border: none;
  margin: 4px 8px 2px 8px; /* ブラケットのための左右余白 */
  overflow: visible;
}

/* [ */
.hud-bar::before {
  content: "[";
  position: absolute;
  left: -8px;
  top: -3px;
  color: #cececece;
  font-size: 12px;
  line-height: 10px;
}

/* ] */
.hud-bar::after {
  content: "]";
  position: absolute;
  right: -8px;
  top: -3px;
  color: #8b949e;
  font-size: 12px;
  line-height: 10px;
}

/* 数値表示 */
.hud-value {
  color: #f0f6fc;
  font-weight: bold;
  font-size: 13px;
  min-width: 45px;
  text-align: left;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hud-bar-fill {
  height: 100%;
  width: 0%;
  background: #cecece;
  transition: width 0.3s ease;
}
.hud-bar {
  height: 4px;
}

.hud-bar::before,
.hud-bar::after {
  top: -5px;
  font-size: 14px;
}

.hud-bar-fill.speed { background: #cecece; }
.hud-bar-fill.acc   { background: #cecece;}

.hud-buttons {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  align-items: center; 
}

.hud-detail-btn,
#hudAchievementsBtn {
  width: 22px;
  height: 22px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #666;
  background: #222;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-detail-btn:hover,
#hudAchievementsBtn:hover {
  opacity: 1;
  background: #444;
}

/* ===============================
   HUD縮小ボタン
================================ */
.hud-mini-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  padding: 0;
}

.hud-mini-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* ===============================
   縮小状態
================================ */
.hud-window.compact {
  height: 32px;
  overflow: hidden;
  padding: 6px 8px;
}

/* ヘッダーとボタン以外を非表示 */
.hud-window.compact > *:not(.hud-header):not(.hud-mini-btn) {
  display: none;
}

/* HUD非表示用 */
.hud-hidden {
  display: none !important;
}


/* ===============================
   デイリーステータス詳細
================================ */

/* playerStatsModal のコンテンツ全体 */
#playerStatsModal .modal-content {
    padding: 20px;
    max-width: 900px; /* 必要に応じて調整 */
    width: 90%;
}

/* デイリー詳細ステータスタイトル */
.stats-header {
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px;
  color: #8ab6ec;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
  position: relative;
}

/* 各統計カードを配置するグリッドコンテナ */
.daily-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* 280pxを最小幅として自動調整 */
    gap: 20px; /* カード間のスペース */
    margin-top: 20px;
}

/* 各統計カテゴリのカードスタイル */
.daily-stats-card {
    background: rgba(13, 17, 23, 0.92); /* メニューカードと統一 */
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 12px; /* 角丸 */
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(88, 166, 255, 0.05);
    backdrop-filter: blur(5px); /* 背景のぼかし効果 */
    transition: transform 0.2s ease-in-out;
}

.daily-stats-card:hover {
    border-color: rgba(123, 153, 187, 0.6);
}

/* 各セクションのタイトル */
.daily-stats-section {
    font-size: 0.9em;
    font-weight: 900;
    color: #64788f; /* サイバーブルーに統一 */
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(88, 166, 255, 0.2);
    text-shadow: 0 0 8px rgba(88, 166, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 各統計行 */
.daily-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 5px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08); /* 点線の区切り */
    font-size: 0.8em;
    color: #c0c0c0; /* やや暗めの色 */
}

.daily-stats-row:last-child {
    border-bottom: none; /* 最後の行は区切り線なし */
}

.daily-stats-row span:first-child {
    font-weight: normal;
    color: #b7c0c9; /* リザルトのラベル色と統一 */
}

.daily-stats-row span:last-child {
    font-weight: bold;
    color: #f0f6fc; /* HUDの数値色と統一 */
}

/* サブカテゴリの行 */
.daily-stats-row.sub {
    padding-left: 1.5rem; /* インデントを少し深くして視認性を確保 */
    font-size: 0.7em;
}

.daily-stats-row.sub span:first-child {
    color: #7b8892;
}

.daily-stats-row.sub span:last-child {
    color: #c9d1d9;
}

/* 日付表示のスタイル */
.daily-stats-row span:last-child span {
    font-size: 0.8em;
    color: #808080;
    margin-left: 5px;
}


/* ===============================
   グローバル音量トグルボタン
================================ */
.sound-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  color: #fff;
  font-size: 11px;
  transition: background 0.2s;
  white-space: nowrap;
}
.sound-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.6);
}
.sound-toggle-btn img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.hud-sound-ctrl {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

/* メインメニュー内（タイトルカード等）の重複したサウンドトグル用クラス（あれば）のみ非表示 */
#menu .sound-toggle-btn {
  display: none !important;
}

/* エネミーモード専用サウンドトグル（スコアの上） */
.enemy-sound-toggle {
  position: absolute;
  top: 8px;
  right: 12px;
  /* z-index: 1100; */ /* → 画面階層セクションへ移動 */
  padding: 2px 6px;
  font-size: 10px;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}
.enemy-sound-toggle img {
  width: 12px;
  height: 12px;
}

/* フルスクリーン切替ボタン（サウンドトグルの左隣に配置） */
.fs-toggle-btn {
  right: 118px;
  cursor: pointer;
  color: #e4e4e4;
  letter-spacing: 0.5px;
  /* <button> のデフォルトスタイルをリセットしてサウンドトグルと外観を揃える */
  margin: 0;
  border: none;
  line-height: 1.2;
}
.fs-toggle-btn:hover {
  background: rgba(88, 166, 255, 0.25);
}

/* =====================================================
   グローバルUIバー（全メニュー共通・ステージ左上）
   フルスクリーン ⇔ ウィンドウ切替ボタン。
   body（ステージ）直下の fixed 配置のため、表示中のメニューに
   関係なく常にゲーム画面の左上に表示される。
   ゲームプレイ中・起動オーバーレイ中は js 側から hidden クラスで
   非表示にする。
   ===================================================== */
#globalUiBar {
  position: fixed;
  top: 8px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}
#globalUiBar.hidden {
  display: none;
}

/* アプリ全体のフルスクリーン ⇔ ウィンドウ切替ボタン */
.global-fs-toggle {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-family: var(--font-ui);
  letter-spacing: 0.5px;
  color: #e4e4e4;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.global-fs-toggle:hover {
  background: rgba(88, 166, 255, 0.25);
}



/* ===============================
   HUD縮小ボタン
================================ */
.hud-mini-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  padding: 0;
}

.hud-mini-btn:hover {
  background: rgba(0, 0, 0, 0.4);
}

/* ===============================
   縮小状態
================================ */
.hud-window.compact {
  height: 32px;
  overflow: hidden;
  padding: 6px 8px;
}

/* 縮小時に中身を非表示にし、タイトルと開閉ボタン（ミニボタン）だけを残す */
.hud-window.compact > .hud-buttons,
.hud-window.compact .hud-sound-ctrl,
.hud-window.compact #normalHud > *:not(.hud-header),
.hud-window.compact #questHud > *:not(.hud-header) 
{
  display: none;
}

/* HUD非表示用 */
.hud-hidden {
  display: none !important;
}

/* ===============================
   クエストHUD
================================ */
#questHud {
  display: none; /* 初期状態だけ */
}

#hudClear {
  white-space: nowrap;
  font-size: 10.5px;
  color: #8b949e;
  line-height: 1.35;
  font-family: var(--font-ui);
  flex-shrink: 0;
}

.bar {
  width: 120px;
  height: 6px;
  background: #333;
}

.bar-inner {
  height: 100%;
  background: lime;
}

.hud-bar-fill.exp {
  background: linear-gradient(90deg, #ffd700, #ff9900);
}
/* =====================================================
   クエストステータスウィンドウ
   ===================================================== */

.quest-stats-modal {
  position: fixed;
  inset: 0;

  display: none;

  align-items: center;
  justify-content: center;

  /* 背景を濃くして（透明度を下げて）中身を見やすく */
  background: rgba(0, 0, 0, 0.88);

  padding-bottom: 2rem;
}

.hud-panel.right {
  padding-top: 28px;

  /* Equip skills / Passive skills のリストが長い場合、
     パネル内部でスクロールさせて収める（はみ出し防止） */
  min-height: 0;
  overflow-y: auto;
}

.stats-window {
  width: 98%;
  max-width: 1200px; /* allow larger skill screen to show */
  max-height: calc(var(--dvh) * 92);
  overflow: auto;
  max-height: calc(var(--dvh) * 90);
  overflow-y: auto;
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid rgba(88, 166, 255, 0.4);
  border-radius: 14px;
  color: #f0f6fc;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  padding: 12px 14px;
}

/* スクロールバーは style.css 冒頭の共通設定（黒系）に統一 */

#statsClose {
  position: absolute;
  right: 0;
  top: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

#statsCloseQuest {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 5;

  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.quest-stats-section {
  position: relative;
  margin-top: 14px;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 13px;
  color: #718dad;
  letter-spacing: 0.05em;
  padding-bottom: 6px;

  border-bottom: 1px solid rgba(0,255,255,0.18);
}

.hud-panel.left {
  position: relative;
}

/* 左パネル → 中央円 接続ライン
   ・中央コアとの間に余白を設けたため、従来より短くする
   ・細めの1本線＋フェードイン→先端が淡く輝くシンプルなグラデーションで
     スタイリッシュに（サイバー系UIの雰囲気に合わせたシアン系） */
.hud-panel.left::after {
  content: "";
  position: absolute;

  top: 50%;
  right: -40px;

  width: 40px;
  height: 1.5px;

  transform: translateY(-50%);

  background: linear-gradient(
    90deg,
    rgba(0, 255, 255, 0.04) 0%,
    rgba(0, 255, 255, 0.32) 60%,
    rgba(0, 255, 255, 0.85) 100%
  );

  box-shadow:
    0 0 4px rgba(0, 255, 255, 0.22);
}

.hud-panel.left::before {
  content: "";
  position: absolute;

  top: 50%;
  right: -42px;

  width: 6px;
  height: 6px;
  border-radius: 50%;

  transform: translateY(-50%);

  background: rgba(0,255,255,0.95);

  box-shadow:
    0 0 6px rgba(0,255,255,0.7),
    0 0 14px rgba(0,255,255,0.2);
}

.hud-panel.left .connector-ring {
  position: absolute;
  top: 50%;
  right: -48px;

  width: 18px;
  height: 18px;

  border-radius: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.hud-panel.left .connector-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;

  border: 2px solid rgba(0, 255, 255, 0.48);

  box-shadow:
    0 0 5px rgba(0,255,255,0.10),
    inset 0 0 3px rgba(0,255,255,0.05);
}

.hud-panel.left .connector-ring::after {
  content: "";
  position: absolute;

  left: -5px;
  top: 50%;

  width: 11px;
  height: 8px;

  transform: translateY(-50%);

  background: rgba(10,10,15,1);
}

.quest-stats-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 13px;
  color: #e6edf3;
  font-family: var(--font-ui);
}

.quest-stats-row.sub {
  padding-left: 18px;
  font-size: 12.5px;
  color: #b8c2cc;
}

.quest-stats-row span:last-child {
  color: #9fe870;
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.quest-stats-row:hover {
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
}

.quest-left,
.quest-right {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(0,255,255,0.15);
  padding: 8px;
  font-size: 12px;
}

.quest-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* クエストモードステータスサイズはこれ */
.quest-stats-hud {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));

  /* 行をコンテナの高さに固定する。
     （auto のままでは装備スキル等の長いリストで行が伸び、
       下端が overflow:hidden により切れてしまうため） */
  grid-template-rows: minmax(0, 1fr);

  /* 左パネルと中央コアの間に余白を設ける
     （中央↔右も同じ間隔で空け、円が中央に収まるバランスを維持） */
  column-gap: 24px;

  width: min(1000px, calc(var(--dvw) * 95));
  height: calc(var(--dvh) * 90);

  /* border を幅に含める。content-box のままだと実幅が 1000px+2px となり
     親の .quest-page からわずかに横はみ出し → 横スクロールバーが出てしまう */
  box-sizing: border-box;

  background: rgba(10,10,15,0.97);
  border: 1px solid rgba(0,255,255,0.15);
  box-shadow: 0 0 30px rgba(0,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
}

.hud-panel {
  padding: 16px;
  color: #bff;
  font-size: 12px;
}

.hud-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-section-title {
  font-size: 13px;
  margin-bottom: 8px;
  color: #7ff;
}

.skill-item {
  display: flex;
  gap: 8px;
  padding: 4px 8px; /* 上下のパディングを減らす */
  margin-bottom: 4px; /* カード間のマージンを減らす */

  background: rgba(0, 255, 255, 0.05);
  border: 1px solid rgba(0, 255, 255, 0.1);
  border-radius: 6px;
}
.skill-icon-wrap {
  flex-shrink: 0; /* アイコン部分が縮まないようにする */
  width: 46px;    /* アイコン部分の幅を固定 */
  text-align: center; /* アイコンを中央揃え */
}

.skill-item.equipped {
  box-shadow: 0 0 10px rgba(0,255,255,0.15);
}
/* スキルノードオンマウスとスキル詳細ステータスのスキルアイコンサイズ */
.skill-icon {
  width: 40px;
  height: 40px;
}

.skill-name {
  font-size: 12px;
  color: #8ff;
}

.skill-desc {
  font-size: 11px;
  line-height: 1.35;
  opacity: 0.85;
}

.skill-empty {
  opacity: 0.5;
  font-size: 12px;
}
.skill-main {
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* 残りの幅をすべて埋める */
}

/* =========================
   右側アクティブストック
========================= */

.stock-row {
  display: flex;
  align-items: center;
  gap: 10px;

  margin: 10px 0 12px 0;

  padding: 2px 0;
}

.stock-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255,180,120,0.75);
  width: 60px; /* 左寄せ固定 */
}

.stock-inline-bars {
  display: flex;
  gap: 5px;
  align-items: center;
}

.stock-mini-bar {
  width: 4px;
  height: 12px; /* ← かなり小さく（文字サイズに合わせる） */

  border-radius: 1px;

  background: rgba(255, 140, 40, 0.21);
  border: 1px solid rgba(255, 181, 120, 0.306);
  position: relative;
}

/* 中央ライン */
.stock-mini-bar::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 1px;
  width: 2px;

  background: rgba(255, 199, 140, 0.658);
}

/* =========================
   右側アクティブスキル
========================= */
#questActiveSkills {
  margin-bottom: 18px;
}

.passive-title {
  margin-top: 8px;
}


.active-name {
  color: rgba(120,255,255,0.95);
}

.active-stock-row {
  margin-top: 6px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  font-size: 10px;
  letter-spacing: 1px;

  color: rgba(180,255,255,0.7);
}

.active-stock-value {
  color: rgba(255,255,255,0.95);
  font-weight: bold;
}


/* ボトム部分のデザイン クエストステータス */
.quest-bottom {
  grid-column: 1 / 4;
  padding: 14px 18px;

  background:
    linear-gradient(
      180deg,
      rgba(0,255,255,0.04),
      rgba(0,0,0,0.42)
    );

  border-top: 1px solid rgba(0,255,255,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  color: #cff;
}

/* 下部全体 */
.quest-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* 各カード */
.quest-bottom-card {
  padding: 12px;
  border-radius: 10px;

  background:
    linear-gradient(
      180deg,
      rgba(0,255,255,0.05),
      rgba(255,255,255,0.015)
    );

  border: 1px solid rgba(0,255,255,0.12);

  box-shadow:
    inset 0 0 12px rgba(0,255,255,0.03),
    0 0 10px rgba(0,0,0,0.25);
}

/* カードタイトル */
.quest-bottom-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #7ff;
  margin-bottom: 10px;
  font-weight: 700;
}

/* クエスト詳細ページ内のカードタイトル：
   カードが flex-direction: column のflexアイテムであり、
   行高が逼迫する条件（リストが長くスクロールが出る等）で
   flex収縮によりグリフの下部が欠けて見えるのを防ぐ */
.quest-page .quest-bottom-title {
  flex: 0 0 auto;
  line-height: 1.6;
  padding-bottom: 2px;
  overflow: visible;
}

/* 各行 */
.quest-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 5px 0;
  font-size: 12px;

  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.quest-bottom-row:last-child {
  border-bottom: none;
}

/* 左ラベル */
.quest-bottom-label {
  color: #8ba7b8;
  display:flex;
  align-items:center;
  gap:4px;
}

/* RECORDタブ: アイテム使用回数の内訳（インデント付きサブ行） */
.quest-bottom-label.item-use-sub {
  color: #6c8798;
  font-size: 11px;
  padding-left: 10px;
}

/* 右数値 */
.quest-bottom-value {
  font-weight: 700;
  font-size: 13px;
  color: #9dffb3;

  text-shadow: 0 0 6px rgba(0,255,180,0.3);
}

/* 強調用 */
.quest-bottom-value.gold {
  color: #ffd166;
  text-shadow: 0 0 8px rgba(255,209,102,0.35);
}

.quest-skill-bottom-icon{
    width:14px;
    height:14px;

    object-fit:cover;
    border-radius:3px;

    display:inline-block;
    vertical-align:middle;

    margin-right:4px;

    transform:translateY(-1px);

    flex-shrink:0;
}

#questBottom {
  display: flex;
  flex-direction: column;
}

.quest-log {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* クエストステータスボトムタブ */

.quest-tabs{
    display:flex;
    gap:6px;
    margin-bottom:10px;
}

.quest-tab{
    flex:1;
    padding:6px;
    font-size:12px;
    background:#111;
    border:1px solid rgba(0,255,255,0.2);
    color:#aaa;
    cursor:pointer;
}

.quest-tab.active{
    color:#0ff;
    border-color:#0ff;
}

.quest-tab-content {
  flex: 1;
  overflow-y: auto;   /* ←ここがポイント */
  padding-right: 6px;
}

/* タブコンテンツを囲むラッパーを追加 */
.quest-tab-content-wrapper {
  flex: 1; /* 残りの高さをすべて埋める */
  min-height: 0; /* flexアイテムが縮みすぎるのを防ぐ */
  overflow-y: auto;
}

/* =====================================================
   クエストステータス ページ切替
   （MAIN / STATUS / PROGRESSION / SKILL）
   ・モーダルのサイズは従来のメインと同じまま、中身だけ切替える
   ===================================================== */

/* 上部ページ切替バー */
.quest-page-nav {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;

  display: flex;
  gap: 6px;
}

.quest-page-btn {
  padding: 6px 16px;
  font-size: 12px;
  letter-spacing: 0.06em;

  background: #111;
  border: 1px solid rgba(0, 255, 255, 0.25);
  border-radius: 6px;
  color: #9ab;

  cursor: pointer;
}

.quest-page-btn:hover {
  color: #cfe;
}

.quest-page-btn.active {
  color: #0ff;
  border-color: #0ff;
  background: rgba(0, 255, 255, 0.08);
}

/* 各ページ共通（active のものだけ表示。縦flexで高さを親に揃える） */
.quest-page {
  display: none;
}

.quest-page.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* コンテンツボックス：✕・ページバー・各ページの基準枠 */
.quest-stats-box {
  position: relative;

  display: flex;
  flex-direction: column;

  width: min(1000px, calc(var(--dvw) * 95));
  margin: 0 auto;
}

/* MAINページ：従来どおりのHUDカードを中央に */
#questPageMain .quest-stats-hud {
  margin: 56px auto 0;
}

/* STATUS / PROGRESSION / SKILL ページ：
   ボックス幅いっぱい＋MAINと同じ高さまで引き伸ばす */
.quest-page.quest-bottom {
  flex: 1 1 auto;

  margin: 56px 14px 18px;

  background: rgba(10,10,15,0.97);
  border: 1px solid rgba(0,255,255,0.15);
  box-shadow: 0 0 30px rgba(0,255,255,0.1);
  border-radius: 12px;
}

/* ページ内のカードグリッド（RECORD / ACTIVITY / STAGE LOG 等）を
   ページ最下部まで伸ばす。行は高さを均等分割し、
   内容が多いカードは内部スクロールで対処する */
.quest-page.quest-bottom.active > .quest-bottom-grid {
  flex: 1 1 auto;
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
}


/* EXPバー関連 クエストステータス */
.quest-exp-wrap {
  margin: 6px 0 14px;
}

.quest-exp-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0,255,255,0.2);
}

.quest-exp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e5ff, #00ff95);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(0,255,255,0.7);
}

/* スキル関連 クエストステータス */
.quest-skill-row {
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 12px;
  font-family: var(--font-ui);
}

/* ラベル（Chain増加など） */
.quest-skill-row span:first-child {
  color: #fff;
  font-weight: normal;
  text-align: left;
}

/* 数値（x1.00など） */
.quest-skill-row span:last-child {
  color: #9fe870;
  font-weight: 600;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.quest-skill-bar {
  position: relative;
  width: 100%;
  /* 細めのシンプルなバー（スキル装備画面の .skill-bar と同じ6px） */
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}

.quest-skill-bar-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(255,255,255,0.35);
}

.quest-skill-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
}

.quest-skill-bar-fill.up {
  background: linear-gradient(90deg, #00d2ff, #00ff9d);
}

.quest-skill-bar-fill.down {
  background: linear-gradient(90deg, #ff7b7b, #ff4747);
}

/* =========================
   中央サイバーコア
========================= */
.hud-center,
.quest-center {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at center,
      rgba(0,255,255,0.08) 0%,
      rgba(0,120,255,0.06) 25%,
      rgba(0,0,0,0) 70%);
}

/* 外リング */
.hud-center::before,
.quest-center::before {
  content: "";
  position: absolute;

  width: 180px;
  height: 180px;
  border-radius: 50%;

  border: 2px solid rgba(0,255,255,0.28);
  box-shadow:
    0 0 18px rgba(0,255,255,0.18),
    inset 0 0 18px rgba(0,255,255,0.08);

  animation: rotateRing 16s linear infinite;
  pointer-events: none;
}

/* 内リング */
.hud-center::after,
.quest-center::after {
  content: "";
  position: absolute;

  width: 110px;
  height: 110px;
  border-radius: 50%;

  border: 1px solid rgba(255,255,255,0.12);

  background:
    radial-gradient(circle,
      rgba(0,255,255,0.12) 0%,
      rgba(0,255,255,0.04) 45%,
      transparent 75%);

  box-shadow:
    0 0 20px rgba(0,255,255,0.18),
    inset 0 0 14px rgba(0,255,255,0.08);

  animation:
    pulseCore 3s ease-in-out infinite alternate,
    rotateRingReverse 10s linear infinite;

  pointer-events: none;
}

.hud-center,
.quest-center {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* 六角形グリッドっぽいオーバーレイ */
.hud-center .hex-grid,
.quest-center .hex-grid {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image:
    linear-gradient(30deg, #00ffff22 12%, transparent 12.5%, transparent 87%, #00ffff22 87.5%, #00ffff22),
    linear-gradient(150deg, #00ffff22 12%, transparent 12.5%, transparent 87%, #00ffff22 87.5%, #00ffff22),
    linear-gradient(90deg, #00ffff22 2%, transparent 2.5%, transparent 97%, #00ffff22 97.5%, #00ffff22);
  background-size: 34px 60px;
}

.cyber-core-dot {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff, #00ffff 40%, transparent 75%);
  box-shadow:
    0 0 15px #00ffff,
    0 0 35px rgba(0,255,255,0.6);
  animation: pulseCore 1.4s ease-in-out infinite alternate;
}

#questCoreCanvas {
  position: relative;
  /* z-index: 10; */ /* → 画面階層セクションへ移動 */
  pointer-events: auto;
}

/* アニメーション */
@keyframes rotateRing {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes rotateRingReverse {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0deg); }
}

@keyframes pulseCore {
  from {
    transform: scale(0.96);
    opacity: 0.75;
  }
  to {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes scanMove {
  0% {
    top: 8%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  50% {
    top: 50%;
    opacity: 1;
  }
  100% {
    top: 92%;
    opacity: 0;
  }
}

/* =====================================================
   勲章グリッド / 勲章ポップアップ
   ===================================================== */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
}

.ach-item {
  background: #0f172a;
  border-radius: 8px;
  padding: 6px;
  text-align: center;
  opacity: 0.35;
  position: relative;
}

.ach-item.unlocked {
  opacity: 1;
  border-color: #facc15;
  box-shadow: 0 0 6px rgba(250,204,21,0.6);
  background: linear-gradient(#1f2937, #020617);
}

/* 勲章アイテム内の各要素のスタイル */
.ach-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.ach-name {
  font-weight: bold;
  font-size: 10px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* 縮小ではなく省略に戻します */
}

.ach-desc {
  font-size: 9px;
  color: #9ca3af;
}

/* ★未取得でも条件に到達した勲章の進捗表示（現在の回数/必要回数） */
.ach-progress {
  font-size: 9px;
  font-weight: bold;
  color: #facc15;
  margin-top: 2px;
}

/* ★未取得でも条件に到達した勲章（進捗表示あり）は少し明るくして区別しやすく */
.ach-item.locked.revealed,
.ach-modal-content .ach-item.locked.revealed {
  opacity: 0.65;
}

.ach-new {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 6px;
  background: #ef4444;
  color: #fff;
  font-weight: bold;
  animation: achBlink 1s infinite;
  box-shadow: 0 0 4px rgba(239,68,68,0.8);
}

@keyframes achBlink {
  0%,100% { opacity:1; }
  50% { opacity:0.2; }
}

.ach-popup-container {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ach-popup {
  background: #222;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  animation: achPop 0.4s ease;
}

@keyframes achPop {
  from { transform: translateX(40px); opacity:0; }
  to   { transform: translateX(0); opacity:1; }
}

/* =====================
   勲章モーダル（中央確認画面）
   ===================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
}

.ach-modal-content {
  background: #1e293b;
  color: #fff;
  padding: 16px;
  border-radius: 12px;
  width: 90%; /* 固定幅を削除し、可変幅に変更 */
  max-width: 1100px; /* 最大幅を設定 */
  max-height: calc(var(--dvh) * 70);
  overflow-y: auto;
  position: relative; /* 閉じるボタンの基準点にする */
}

/* 勲章モーダル内のタイトル部分 */
.ach-modal-content .daily-stats-section {
  margin-bottom: 24px; /* タイトルとグリッドの間の余白をさらに広げる */
}

.ach-title {
  margin-bottom: 12px;
}

.achClose {
  /* クエストステータスモーダルの閉じるボタンと同様のスタイルを適用 */
  position: absolute;
  top: 4px;
  right: 10px;
  z-index: 10601; /* モーダルコンテンツより手前に表示 */

  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}

.achClose:hover {
  opacity: 1;
}

/* 中央モーダル内の勲章グリッド */
.ach-modal-content .ach-grid {
  display: grid;
  /* アイテムの最小幅を少し狭め、より多くの列が表示されるように調整 */
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px; /* 勲章アイテム間の縦横の隙間を広げる */
  justify-items: center;
  margin-top: 8px;
}

.ach-modal-content .ach-item {
  background: #0f172a;
  border-radius: 8px;
  padding: 6px;
  text-align: center;
  opacity: 0.35;
  transition: 0.2s;
  width: 110px;  /* 説明文が入るように幅を広げる */
  min-height: 72px;  /* 最小の高さを設定 */
  display: flex; /* flexboxを維持 */
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* 上から詰めて配置するように変更 */
}

.ach-modal-content .ach-item.unlocked {
  opacity: 1;
  border-color: #facc15;
  box-shadow: 0 0 6px rgba(250,204,21,0.6);
  background: linear-gradient(#1f2937, #020617);
}

.ach-modal-content .ach-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.ach-modal-content .ach-name {
  font-weight: bold;
  font-size: 10px;
  margin-top: 4px; /* アイコンとの間隔 */
  margin-bottom: 2px; /* 説明文との間隔 */
  width: 100%; /* 幅を100%に設定 */
  white-space: nowrap; /* 折り返し禁止 */
  overflow: hidden; /* はみ出しを隠す */
  text-overflow: ellipsis; /* はみ出しを「...」で省略 */
}

.ach-modal-content .ach-desc {
  font-size: 9px;
  color: #9ca3af;
  white-space: normal; /* 説明文の折り返しを許可 */
  word-wrap: break-word; /* 長い単語でも折り返す */
  line-height: 1.3;
}
/* =====================================================
   enemymode
   ===================================================== */
#enemyModeContainer{
  display:none;
  position:absolute;  /* v1.0.83: fixed→absolute。zoomモード（Windows）で
     fixed の包含ブロックがビューポート基準になり、ステージ座標で配置される
     子要素（chainUI・comboTierWrapper等）が画面外に出る問題の修正。
     body が position:fixed でステージ位置にいるため見た目は同一。 */
  inset:0;
  align-items:center;
  justify-content:center;
}

#defenseModeContainer{
  display:none;
  position:absolute;  /* v1.0.83: fixed→absolute。zoomモード（Windows）で
     fixed の包含ブロックがビューポート基準になり、ステージ座標で配置される
     子要素（コンボバー等）が画面外に出て表示されない問題の修正。
     body 自身が position:fixed でステージ位置にいるため見た目は同一。 */
  inset:0;
  align-items:center;
  justify-content:center;
  background:#020a17;
}

/* v1.0.83: 防衛UIコンテナ（コンボバーラッパー）の包含ブロックをステージに統一。
   定義が無いと子の #defenseComboTierWrapper（absolute）の基準が body の
   座標系（zoomモードではビューポート）に依存し、コンボバーがズレる。
   inset:0 でステージ全体を覆い、pointer-events:none でクリックを阻害しない。 */
#defense-ui-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#enemyModeCanvas{
  display:block;
  margin:auto;
}

#enemyResult{
  position:fixed;
  inset:0;
  background:black;
  color:white;
  display:none;
  flex-direction:column;
  /* 内容が画面より高い場合はスクロールできるようにする */
  overflow-y:auto;
  /* はみ出し安全な中央寄せ（内容が高いときは上端から表示されスクロール可能）。
     safe非対応ブラウザ用に通常のcenterを先に宣言しておく */
  justify-content:center;
  justify-content:safe center;
  align-items:center;
}

#chainUI{
  display:none;
}

.result-failed{
    color: #ff8383;
    animation: fadeIn 0.4s ease;
    display: inline-block;
    padding: 8px 20px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 2px;
    border: 2px solid #ff8383;
    border-radius: 999px;
    background: rgba(198, 199, 199, 0.08);
    margin: 12px auto;
}

.result-calc {
    margin-top: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.calc-grid {
    display: flex;
    gap: 16px;
}

.calc-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.calc-item .label {
    font-size: 11px;
    color: #686868;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.calc-item .value {
    font-size: 18px;
    font-weight: bold;
    color: #9c9c9c;
}

/* スコア倍率ボーナス表示 */
/* 上段（そのまま） */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* 下段（新規） */
.calc-bonus-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

/* ボーナス見た目ちょい強調 */
.calc-item.bonus {
    min-width: 80px;
}

/* 結果アニメーション*/
.calc-item {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
}

.calc-item.show {
    animation: popIn 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.4) forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateY(-6px) scale(1.08); /* ←少し強化 */
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-score.score-pop {
    animation: scorePop 0.8s ease;
}

@keyframes scorePop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* =========================
   攻撃ヒットエフェクト
   ========================= */
.enemy-hit {
  animation: enemyHitFlash 180ms ease-out;
}

@keyframes enemyHitFlash {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  30% {
    transform: scale(1.04);
    filter: brightness(1.35);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

/* ダメージスパーク */
.hit-spark {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  pointer-events: none;
  animation: sparkFade 300ms ease-out forwards;
}

@keyframes sparkFade {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* =====================================================
   クエストモード結果
   ===================================================== */

#questSkillResult {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    /* はみ出し安全な中央寄せ（内容が高いときは上端から表示されスクロール可能。
       単純な center では上方向にはみ出した部分へスクロールできない）。
       safe非対応ブラウザ用に通常のcenterを先に宣言しておく */
    justify-content: center;
    justify-content: safe center;
    align-items: center;
    background: rgba(0, 0, 0, 0.84);
    backdrop-filter: blur(6px);
}

#questSkillResult .quest-skill-card {
    color: #fff;
    width: 90%;
    max-width: none;
    background: transparent;
    border-radius: 0;
    padding: 16px 24px;
}

/* タイトル */
#questSkillResult .quest-skill-title {
    font-size: 30px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

/* スコア計算 */
#questSkillResult .result-calc {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 16px;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

#questSkillResult .result-calc .label {
    color: #fff;
    opacity: 0.8;
    font-size: 12px;
}

#questSkillResult .result-calc .value {
    color: #fff;
    font-weight: bold;
    font-size: 16px;
}

#questSkillResult .calc-bonus-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

#questSkillResult .calc-item {
    text-align: center;
}

/* ブロック */
#questSkillResult .quest-skill-block {
    padding: 4px 12px;
    border-radius: 10px;
}

#questSkillResult .quest-skill-label2 {
    font-size: 14px;
    opacity: 0.7;
    margin: 12px 0 4px;
}

#questSkillResult .quest-skill-label {
    font-size: 13px;
    opacity: 0.8;
}

#questSkillResult .quest-skill-value {
    font-size: 16px;
    font-weight: bold;
    row-gap: 8px;
}

/* SCORE */
#questSkillResult .score-row {
    display: grid;
    /* 中央のスコアが太いほど左右の余白が減るため、両端は潰せる列にして
       はみ出しを防ぐ。最低の余白は column-gap が保証する */
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    column-gap: clamp(12px, 3%, 40px);
    align-items: baseline;
}

#questSkillResult .score-side {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

#questSkillResult .score-left {
    justify-content: flex-end;
}

#questSkillResult .score-right {
    justify-content: flex-start;
    /* 中央のスコアと / RANK (eScore) の最低ア NEXT */
    padding-left: 10px;
}

#questSkillResult .score-center {
    text-align: center;
}

#questSkillResult .score-value {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
}

/* 桁数が増えるほど中央のスコアだけ縮め、右側の / RANK (eScore) と詰まらないようにする */
#questSkillResult .score-value--small {
    font-size: 26px;
}

#questSkillResult .score-value--tiny {
    font-size: 20px;
}

/* 防衛戦結果：スコアと「/ RANK (eScore)」を横並びにする。
   絶対配置（left:50% + margin-left:2.5em）で配置すると、スコアが 15,700 のように
   桁数が増えたときにスコア本体へ重なってしまうため、通常フローのフレックスに変更 */
#questSkillResult .score-value-container {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

/* 旧インライン指定（絶対配置）の無効化 */
#questSkillResult .score-value-container .score-rank {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    margin-left: 0;
    white-space: nowrap;
}

#questSkillResult .score-value-container .score-value {
    white-space: nowrap;
}

#questSkillResult .score-base {
    font-size: 20px;
    opacity: 0.8;
    color: #e1e1e1;
}

#questSkillResult .score-arrow {
    font-size: 14px;
    opacity: 0.6;
}

#questSkillResult .score-rank {
    font-size: 16px;
    opacity: 0.8;
    margin-left: 6px;
}

/* ステータス */
#questSkillResult .quest-skill-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    column-gap: 8px;
    row-gap: 10px;
    max-width: 800px;
    margin: 0 auto;
}

#questSkillResult .quest-skill-stat {
    text-align: center;
}

#questSkillResult .quest-skill-stat .label {
    font-size: 12px;
    opacity: 0.8;
}

#questSkillResult .quest-skill-stat .value {
    font-size: 16px;
    font-weight: bold;
}

/* ボタン */
#questSkillResult .quest-skill-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* EXP */
#questSkillResult .level-row {
    position: relative;
    text-align: center;
}

#questSkillResult .level-row .quest-skill-value {
    display: inline-block;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}

#questSkillResult .r-badge.levelup {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 8px;
    text-align: center;
    font-weight: bold;
}

#questSkillResult .exp-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#questSkillResult .level-gain {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    white-space: nowrap;
    margin-left: 8px;
}

#questSkillResult .exp-gain {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
}

#questSkillResult .exp-bar {
    flex: 1;
    width: 20%;
    height: 10px;
    background: #222;
    border-radius: 6px;
    overflow: hidden;
    margin: 6px auto 10px;
}

#questSkillResult .exp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    transition: width 0.6s ease;
}

#questSkillResult .exp-fill.exp-max {
    animation: expPulse 0.5s ease;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
}

/* エフェクト */
#questSkillResult .flash {
    background: white;
}

#questSkillResult .r-badge.levelup.pop {
    animation: levelPop 0.5s ease;
}

@keyframes levelPop {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes expPulse {
    0%   { transform: scaleX(1); }
    50%  { transform: scaleX(1.05); }
    100% { transform: scaleX(1); }
}

/* CLEAR */
#questSkillResult .result-clear {
    display: inline-block;
    padding: 8px 20px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #419ef6;
    border: 2px solid #419ef6;
    border-radius: 999px;
    background: rgba(198, 199, 199, 0.08);
    margin: 12px auto;
}

/* 星 */
#questSkillResult .quest-skill-stars {
    font-size: 24px;
    letter-spacing: 3px;
    margin-bottom: 4px;
}

/* SLOT */
#questSkillResult .r-badge.slotup {
    background: #2196f3;
    color: #fff;
    padding: 6px 10px;
    margin-top: 18px;
    border-radius: 6px;
    font-weight: bold;
    animation: pop 0.5s;
}

/* STOCK */
#questSkillResult .r-badge.stockup {
    background: #ff8d0a;
    color: #fff;
    padding: 6px 10px;
    margin-top: 18px;
    border-radius: 6px;
    font-weight: bold;
    animation: pop 0.5s;
}

/* 途中レベルアップ演出 */
.r-badge.levelup.levelup-effect {
    color: #ffd700;
}


/* =====================================================
   クエストモードmap
   ===================================================== */

#questMapScreen{
  position: relative;   /* ← これ追加が最重要 */
  inset: 0;          /* 画面全体に広げる */
  width: 100%;
  height: 100%;    /* ステージ（1600×900）基準 */
}

#mapContainer{
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  transform: none;
  zoom: 1;
}

#mapCanvas{
  pointer-events: none;
}

#mapCanvas,
#mapNodes{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.map-node-wrapper{
  position: absolute;
}

/* ● ノード（丸） */
.map-node{
  position: absolute;   /* ← 追加 */
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #9d9d9d;
  transition: 0.2s;
}

/* ● ラベル（名前） */
.map-label{
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 11px;
  color: #9a9a9a;
  white-space: nowrap;
  pointer-events: none;
}

/* v1.0.84: Windows でマップラベルが見にくい問題への対策。
   背景透過テキストのため黒フチ（text-shadow）を追加して視認性を確保する。
   body.win スコープで Mac の見た目は変更なし。 */
body.win .map-label {
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.7);
}

/* クリア済み */
.map-node.cleared {
    background: #bdbdbd;
    box-shadow: 0 0 8px rgba(188, 188, 188, 0.8);
    transform: scale(1.1);
}
.map-node.cleared::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f5f5f5e6;
}

/* ラベル */
.map-label.cleared {
    color: #bababa;
    font-weight: bold;
}

/* ロック状態 */
.map-node.locked{
  background: #454545;
}

.map-label.locked{
  color: #585858;
}

.hard-fog-node { opacity: 0.0; }
.hard-fog-label { opacity: 0.0; }

/* ホバー */
.map-node:hover{
  transform: scale(1.4);
}
/* マップ上の戻るボタン（非表示） */
#mapBackBtn {
  display: none;
  left: 50%;
  bottom: 30px;          /* 下からの距離（調整OK） */
  transform: translateX(-50%);

  z-index: 10;           /* canvasより前に出す */
  
  padding: 10px 20px;
  font-size: 16px;
}

/* ブルっと */
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

.map-node.shake {
  animation: shake 0.3s;
}

/* ツールチップ */
.lock-tooltip {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  opacity: 0;
  transition: 0.2s;
}

.lock-tooltip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.map-node.locked {
  cursor: not-allowed;
}

.quest-tooltip {
  position: fixed;
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 8px 10px;
  font-size: 14px; 
  border-radius: 6px;
  pointer-events: none;
  z-index: 21000;
}

.tooltip-mission-title {
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 2px;
}

.tooltip-title {
    color: #9bb1ca;
    font-weight: bold;
}

.stage-intro {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  /* 内容が画面より高い場合（小さいウィンドウ等）でも
     スクロールですべての項目（終了条件・クリア条件・★条件・報酬など）を
     確認できるようにする */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 16px;
  box-sizing: border-box;
  /* z-index: 9999; */ /* → 画面階層セクションへ移動 */
}

.stage-intro-box {
  color: white;
  text-align: center;
  /* autoマージンによるはみ出し安全な上下中央寄せ。
     内容が画面より高い場合は上端から表示されスクロール可能になる。
     max-widthで長い行を折り返して横のはみ出しも防ぐ */
  margin: auto 0;
  max-width: min(760px, 100%);
}

.stage-intro h2 {
  font-size: 32px;
  margin-bottom: 10px;
}

.mission-desc-main {
  margin-bottom: 90px
}

.intro-section {
  margin: 16px 0;
  margin-top: 30px;
}

.intro-section h3{
  margin-bottom: 5px;
  color:#9bb1ca;
}

.intro-start {
  margin-top: 60px;
  font-size: 18px;
  opacity: 0.7;
}

/* 短い/狭い画面ではイントロの余白と文字を詰めて、
   全項目が一望しやすいようにする（それでも収まらない場合はスクロール） */
@container (max-height: 700px) or (max-width: 640px) {
  .mission-desc-main {
    margin-bottom: 24px;
  }
  .intro-section {
    margin-top: 14px;
    margin-bottom: 8px;
  }
  .intro-start {
    margin-top: 24px;
    font-size: 14px;
  }
  .stage-intro h2 {
    font-size: clamp(1.2rem, 4.5vw, 32px);
  }
}

/* クエストモードイントロ内報酬情報 */
.reward-done {
  color: #aaa;
  font-size: 12px;
  margin-left: 6px;
}

/* クエストマップの星表示 */
.map-star {
  position: absolute;

  /* ▼ノード中央基準 */
  left: 50%;
  transform: translateX(-50%);

  /* ▼タイトルより上 */
  top: -38px;

  font-size: 9px;

  /* ▼マットな黄色（ギラつき防止） */
  color: #d6c56f;

  letter-spacing: 1px;

  pointer-events: none;
}

.map-dialogue-badge {
  position: absolute;
  color: #b0b0b0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* クエストマップの報酬表示 */
.map-reward-inline {
    margin-left: 6px;

    font-size: 6px;
    color: #e0e0e0;

    opacity: 0.9;

    display: inline-block;
    transform: translateY(-1px);
}



/* =====================================================
   クエストモードマップ サイドメニュー
   ===================================================== */
/* サイドメニュー */
.quest-side-menu{
    position:absolute;
    left:16px;        /* 端に貼り付けない */
    top:52px;         /* 左上固定のフルスクリーン切替バー（#globalUiBar）と重ならないよう下げる
                         ※ステージは拡大縮小されるため、縮小時(scale≈0.6)でもバーの下端(≈26px)をクリアする値 */

    width:140px;

    /* ★変更ポイント */
    height:auto;      /* ←100%やめる */
    
    background:rgba(20,20,20,0.8);
    backdrop-filter: blur(6px);

    display:flex;
    flex-direction:column;
    padding:10px;
    gap:8px;

    border-radius:12px; /* ★HUD風 */
    box-shadow:0 8px 20px rgba(0,0,0,0.4);
}

/* ボタン */
.quest-side-btn{
    background:#1e1e1e;
    color:#ccc;
    border:none;

    padding:6px 8px;   /* ↓小さく */
    font-size:12px;    /* ↓文字小さく */

    border-radius:6px;
    cursor:pointer;
    transition:0.2s;
}

.quest-side-btn:hover{
    background:#2a2a2a;
    color:#fff;
}

/* モーダル */
.quest-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.6);
  display:flex;
  /* 画面高さを超えるモーダルで下部が見切れる問題を防ぐ */
  align-items:flex-start;
  justify-content:center;
  overflow-y:auto;
  padding-top:20px;
}

/* ★非表示制御：.quest-modal は display:flex のため .hidden 単体では
   隠れない。main.js / questResult.js が add/remove する hidden クラスを
   .quest-modal でも有効にする（キー処理の display 判定とも整合）。 */
.quest-modal.hidden{
  display:none;
}

.quest-modal-box{
    width: min(1000px, calc(var(--dvw) * 92));
    max-height: calc(var(--dvh) * 90);
    background:#111;
    border-radius:14px;
    padding:20px;
    color:#fff;
    box-shadow:0 10px 40px rgba(0,0,0,0.5);
    position: relative;
}

.quest-modal-title{
    /* ★サイズは :root の --quest-modal-title-size に統一（個別指定しない） */
    font-size:var(--quest-modal-title-size);
    margin-bottom:12px;
}

.quest-modal-content{
    margin-top:10px;
}

.quest-side-menu::before{
    content:"MENU";
    font-size:10px;
    color:#888;
    margin-bottom:4px;
    letter-spacing:1px;
}

.quest-modal-btn{
    background:#1e1e1e;
    color:#ccc;
    border:none;
    padding:8px;
    border-radius:8px;
    cursor:pointer;
    transition:0.2s;
}

.quest-modal-btn.active{
    background:#ffb84d;   /* 青系で分かりやすく */
    color:#fff;
    font-weight:bold;
    box-shadow:0 0 8px rgba(255, 184, 77, 0.6);
}

.quest-modal-btn:hover{
    background:#2a2a2a;
    color:#fff;
}

.quest-modal-btn.active:hover{
    background:#ffc15d; /* アクティブはちょい明るく */
}

.quest-difficulty-list{
    display:flex;
    gap:8px;
    justify-content:center;
}

.quest-side-difficulty-btn{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:2px;
    line-height:1.2;
}

.quest-side-difficulty-title{
    font-size:12px;      /* 他ボタン(.quest-side-btn)と同じ */
    font-weight:normal;  /* 他ボタンと揃える */
    color:inherit;       /* 他ボタンと同じ文字色 */
}

.quest-side-difficulty-val{
    font-size:10px;
    font-weight:bold;
    color:#ffb84d;
    letter-spacing:0.5px;
}

.quest-modal-btn:active{
    transform:scale(0.95);
}

.quest-modal-close-btn{
    position:absolute;
    top:8px;
    right:8px;

    width:28px;
    height:28px;

    display:flex;
    align-items:center;
    justify-content:center;

    /* z-index: 100; */ /* → 画面階層セクションへ移動 */

    font-size:18px;
    line-height:1;

    cursor:pointer;

    border: none;
    background: transparent;
    color: #fff;
}

.quest-modal-close-btn:hover{
    color:#ff9800;
}
/* =====================================================
   中ボスノードの装飾（以前のスタート/ゴールの見た目を継承）
   ===================================================== */
.map-node.mid-boss-node::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px; /* ノード(14px)より一回り大きく */
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    pointer-events: none;
    box-sizing: border-box;
    animation: nodePulse 3s infinite ease-in-out;
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1.0); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

/* =====================================================
   クエストマップ：ターゲットマーク装飾（真のスタート/ゴール用）
   ===================================================== */
.node-target-decor {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px; /* 外円のサイズ */
    height: 28px;
    pointer-events: none;
    z-index: -1;
}

/* 一重の輪っか（内側） */
.ring-inner {
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(189, 189, 189, 0.6); /* ノード同系色（グレー） */
    border-radius: 50%;
    box-sizing: border-box;
    animation: ringRotate 8s linear infinite;
}

/* ターゲット三角形 */
.target-tri {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4));
    animation-duration: 2s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
}

/* 上：下向き */
.tri-t {
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 4px 0 4px;
    border-color: #bdbdbd transparent transparent transparent;
    animation-name: triMove-t;
}

/* 下：上向き */
.tri-b {
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 4px 5px 4px;
    border-color: transparent transparent #bdbdbd transparent;
    animation-name: triMove-b;
}

/* 左：右向き */
.tri-l {
    top: 50%;
    transform: translateY(-50%);
    border-width: 4px 0 4px 5px;
    border-color: transparent transparent transparent #bdbdbd;
    animation-name: triMove-l;
}

/* 右：左向き */
.tri-r {
    top: 50%;
    transform: translateY(-50%);
    border-width: 4px 5px 4px 0;
    border-color: transparent #bdbdbd transparent transparent;
    animation-name: triMove-r;
}

/* ターゲットマーク用アニメーション */
@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes triMove-t {
    0%, 100% { top: -4px; filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4)); }
    50% { top: -8px; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9)); }
}

@keyframes triMove-b {
    0%, 100% { bottom: -4px; filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4)); }
    50% { bottom: -8px; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9)); }
}

@keyframes triMove-l {
    0%, 100% { left: -4px; filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4)); }
    50% { left: -8px; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9)); }
}

@keyframes triMove-r {
    0%, 100% { right: -4px; filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4)); }
    50% { right: -8px; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9)); }
}

/* 中ボスノードの強調 */
.mid-boss-node {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    background: #e0e0e0 !important; /* 中ボスは少し明るく */
}

/* =====================================================
   防衛モードノードの装飾
   ===================================================== */
/* 未クリア時の防衛ノード (薄い色) */
.map-node.defense-node {
    background: #4a688c !important; /* 彩度を落とした青 */
    border-radius: 0; /* clip-path を使うためリセット */
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.2);
}

/* クリア済みの防衛ノード (鮮やかな色) */
.map-node.defense-node.cleared {
    background: #58a6ff !important; /* 鮮やかな青 */
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.7);
}

.map-label.defense-label {
    color: #7792b0 !important; /* 彩度を落とした青系のテキスト色 */
    font-weight: bold;
    text-shadow: none;
}

.map-label.defense-label.cleared {
    color: #82c0ff !important; /* 鮮やかな青 */
    text-shadow: 0 0 8px rgba(88, 166, 255, 0.6);
}

/* =====================================================
   ワールドセレクター（中央上部）
   ===================================================== */
.world-selector {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    padding: 4px 16px;
    border-radius: 40px;
    border: 1px solid rgba(88, 166, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(88, 166, 255, 0.1);
    /* z-index: 100; */ /* → 画面階層セクションへ移動 */
    pointer-events: auto;
}

.world-nav-btn {
    background: transparent;
    border: none;
    color: #aaafb5;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.world-nav-btn:hover:not(.disabled) {
    color: #fff;
    text-shadow: 0 0 12px #9bb1ca;
    transform: scale(1.2);
}

.world-nav-btn.disabled {
    color: #444;
    cursor: not-allowed;
    opacity: 0.3;
}

.world-name-area {
    font-size: 13px;
    font-weight: 800;
    color: #e6edf3;
    letter-spacing: 0.15em;
    text-align: center;
    min-width: 120px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(88, 166, 255, 0.4);
}

/* =====================================================
   クエストモードスキル関連
   ===================================================== */

/* =====================================================
   EQUIP SKILLS モーダル（quest-modal-skill）
   ・レイアウト（2カラム・左カラムの縦積み）は維持したまま、
     余白・フォント・行間・カード内パディングを圧縮して縦を短くする。
   ・ボックス幅は従来どおり（広げない）。
   ・はみ出しは従来どおり各領域の内部スクロールで吸収。
   ===================================================== */
.quest-modal-box.quest-modal-skill {
  display: flex;
  flex-direction: column;

  /* 縦圧縮：モーダル上部・下部の余白を削る（幅・位置は不変） */
  padding: 14px 20px;
}

/* タイトル：サイズは --quest-modal-title-size に統一（上書きしない）。
   余白だけ従来どおり詰めて上部の縦を削る。 */
.quest-modal-box.quest-modal-skill .quest-modal-title {
  margin-bottom: 8px;
}

.quest-modal-box.quest-modal-skill .quest-modal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-top: 4px;
}

/* 左カラム：要素間の間隔を詰めて縦を削る（並び順は不変） */
.quest-modal-box.quest-modal-skill .skill-left-column {
  min-height: 0;
  overflow-y: auto;
  gap: 12px;
}

/* ---- ステータス：行間・フォントを縮めて縦を削る（並びは不変） ---- */
.quest-modal-box.quest-modal-skill .skill-stats {
  padding: 10px 12px;
  font-size: 13px;
}

.quest-modal-box.quest-modal-skill .skill-stats .skill-stat-row {
  grid-template-columns: 106px 52px minmax(48px, 1fr) 58px;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 13px;
}

.quest-modal-box.quest-modal-skill .skill-stats .skill-stat-current,
.quest-modal-box.quest-modal-skill .skill-stats .skill-stat-value {
  font-size: 12px;
  min-width: 0;
}

.quest-modal-box.quest-modal-skill .skill-bar {
  height: 6px;
}

/* ---- スロット情報：パディングを詰めて縦を削る ---- */
.quest-modal-box.quest-modal-skill .skill-slot-info.compact {
  margin-top: 4px;
  padding: 4px 8px 6px;
}

.quest-modal-box.quest-modal-skill .skill-slot-info.compact .slot-card {
  padding: 5px 10px 6px;
}

.quest-modal-box.quest-modal-skill .skill-slot-info.compact .slot-total {
  font-size: 15px;
}

/* ---- 装備枠：縦積みのままカード内パディングを圧縮 ---- */
.quest-modal-box.quest-modal-skill .skill-equip-area {
  flex-direction: column;
  gap: 8px;
  margin-bottom: 0;
}

.quest-modal-box.quest-modal-skill .skill-equip {
  padding: 9px 12px;
}

.quest-modal-box.quest-modal-skill .skill-equip h3 {
  margin: 0 0 8px;
  padding-bottom: 4px;
  font-size: 10px;
}

.quest-modal-box.quest-modal-skill .active-skill-container {
  gap: 12px;
}

.quest-modal-box.quest-modal-skill .active-skill-desc-container .skill-name {
  font-size: 12px;
  margin-bottom: 3px;
}

.quest-modal-box.quest-modal-skill .active-skill-desc-container .skill-desc {
  font-size: 10px;
  line-height: 1.35;
}

.quest-modal-box.quest-modal-skill .active-skill-desc-container .skill-cooldown {
  font-size: 10px;
  margin-top: 1px;
}

/* AUTO枠：親gapの圧縮に合わせて負マージンを調整（実質10px余白を維持） */
.quest-modal-box.quest-modal-skill .auto-skill-box {
  margin-top: -2px;
}

/* ---- 右カラム（スキル一覧）：タブ・グリッドまわりを圧縮 ---- */
.quest-modal-box.quest-modal-skill .skill-wrapper {
  gap: 20px;
}

.quest-modal-box.quest-modal-skill .skill-list {
  gap: 10px;
}

.quest-modal-box.quest-modal-skill .skill-tabs {
  margin-bottom: 10px;
}

.quest-modal-box.quest-modal-skill .skill-tab-btn {
  padding: 6px 14px;
  font-size: 12px;
}

.quest-modal-box.quest-modal-skill .skill-grid {
  gap: 8px;
}

.quest-modal-box.quest-modal-skill .skill-grid-name {
  min-height: 22px;
  margin-top: 1px;
}

/* =====================================================
   横スクロールバー表示制御（クエストステータス / スキル装備画面）
   ・基本は横スクロールバーを表示しない
     （わずかな横はみ出しはクリップして吸収する）
   ・モーダルboxの幅が縮んで内容が収まらなくなった時だけ
     横スクロール（=横スクロールバー）を許可する
     ※ box側をインラインサイズコンテナにして、
       コンテナクエリで切り替えている
   ===================================================== */

/* モーダルboxを幅基準のサイズコンテナにする（縮み判定用） */
.quest-stats-box {
  container-type: inline-size;
  container-name: quest-stats-box;
}

.quest-modal-box.quest-modal-skill {
  container-type: inline-size;
  container-name: quest-skill-modal;
}

/* ---- 基本：横スクロールしない ---- */
/* クエストステータス画面（各ページ・右HUDパネル） */
.quest-stats-modal .quest-page.active,
.quest-stats-modal .hud-panel.right {
  overflow-x: hidden;
}

/* カード内容はインラインで overflow-y 指定されているため、
   横方向だけ important で上書きする */
.quest-stats-modal .quest-bottom-card > div {
  overflow-x: hidden !important;
}

/* スキル装備画面（コンテンツ領域・左カラム・スキル一覧） */
.quest-modal-box.quest-modal-skill .quest-modal-content,
.quest-modal-box.quest-modal-skill .skill-left-column,
.quest-modal-box.quest-modal-skill .skill-list {
  overflow-x: hidden;
}

/* ---- 縮んだ時だけ横スクロールを許可 ---- */
@container quest-stats-box (max-width: 900px) {
  .quest-stats-modal .quest-page.active,
  .quest-stats-modal .hud-panel.right {
    overflow-x: auto;
  }

  .quest-stats-modal .quest-bottom-card > div {
    overflow-x: auto !important;
  }
}

@container quest-skill-modal (max-width: 900px) {
  .quest-modal-box.quest-modal-skill .quest-modal-content,
  .quest-modal-box.quest-modal-skill .skill-left-column,
  .quest-modal-box.quest-modal-skill .skill-list {
    overflow-x: auto;
  }
}

.skill-wrapper {
  /* display: flex; は2カラムレイアウト側で再定義 */
  gap: 18px;
  max-width: 1400px; /* allow larger tree and lists */
  margin: 0 auto;
}

/* =========================
   ステータス
========================= */
.skill-stats {
  padding: 16px;
  font-size: 14px;
  /* 他のカードとデザインを統一 */
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 12px;
}

.skill-slot-breakdown {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

.stat-up{
    color: #4caf50;   /* 緑 */
    font-weight: 700;
}

.stat-down{
    color: #e57373;   /* 赤系 */
    font-weight: 700;
}

/* =========================
   スキル ステータスバー
========================= */
.skill-stat-row {
  display: grid;
  grid-template-columns: 140px 60px 1fr 70px;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 15px;
}

.skill-stat-current {
  font-size: 14px;
  text-align: right;
  justify-self: end;
  color: #fff;
  min-width: 56px;
}

.skill-stat-name {
  text-align: left;
  color: #eee;
  font-weight: 600;
}

.skill-stat-value {
  font-size: 14px;
  text-align: right;
  min-width: 72px;
}

/* バー全体 */
.skill-bar {
    position: relative;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: #222;
    border: 1px solid #444;
}

/* 中央線 = 1.00 */
.skill-bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #999;
    z-index: 3;
}

/* ベース値バー */
.skill-bar-fill {
    position: absolute;
    top: 0;
    height: 100%;
    z-index: 1;
}

/* 変化量バー */
.skill-bar-diff {
    position: absolute;
    top: 1px;
    height: calc(100% - 2px);
    border-radius: 999px;
    z-index: 2;
}

/* 右(上昇) */
.skill-bar-fill.up {
    background: rgba(76, 175, 80, 0.45);
}

.skill-bar-diff.up {
    background: #7cff83;
}

/* 左(下降) */
.skill-bar-fill.down {
    background: rgba(229, 115, 115, 0.45);
}

.skill-bar-diff.down {
    background: #ff8a8a;
}

/* スキルスロット情報  */
.skill-slot-info.compact {
    margin-top: 10px;
    padding: 6px 10px;
    border: 1px solid #333;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
}

/* 横1行レイアウト */
.slot-row {
  display: grid;
  grid-template-columns: 1fr 1fr; /* ← 横並び */
  gap: 12px;
}

/* カード */
.slot-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
}

/* 左タイトル */
.slot-title {
    font-size: 12px;
    color: #c8c8c8;
    font-weight: bold;
}

/* カード内の左右配置 */
.slot-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* タイトルと詳細のグループ */
.slot-title-group {
  text-align: left;
}

.slot-title-group span,
.slot-value-group span {
  display: block;
}

.slot-title-detail {
  font-size: 10px;
  color: #888;
}

/* 数値と内訳のグループ */
.slot-value-group {
  text-align: right;
}

/* 合計 */
.slot-total {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    margin-right:2px;
}

/* 内訳 */
.slot-breakdown {
    font-size: 10px;
    color: #999;
    font-weight: normal;
    margin-right:2px;
}

/* =========================
   共通レイアウト
========================= */
.skill-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.skill-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skill-list h3 {
    margin-top: 12px;
    font-size: 14px;
    color: #aaa;
}

/* =========================
   装備スロットレイアウト
========================= */

.skill-equip-area {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

/* 左: active */
.skill-equip-area .skill-equip:first-child {
    width: 250px; /* 幅を90pxから200pxに拡張 */
    flex-shrink: 0;
}

/* 右: passive */
.skill-equip-area .skill-equip:last-child {
    flex: 1;
}

/* 共通box */
.skill-equip {
    padding: 12px;
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
}

/* オートスキル装備カードの上の余白を短縮 */
.auto-skill-box {
  margin-top: -10px; /* 親のgap: 20pxから10px短縮し、実質10pxの余白にする */
}

.skill-equip h3 {
    margin: 0 0 12px;
    font-size: 11px;
    text-align: left;
    color: #58a6ff;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 800;
    border-bottom: 1px solid rgba(88, 166, 255, 0.2);
    padding-bottom: 6px;
}

/* slot grid */
.equip-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

/* slot */
.equip-slot {
    width: 42px;
    height: 42px;
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
}

.equip-slot:hover {
    background: rgba(88, 166, 255, 0.15);
    border-color: rgba(88, 166, 255, 0.6);
}

/* スキルがセットされているスロット */
.equip-slot:has(.equip-slot-icon) {
    background: rgba(88, 166, 255, 0.2);
    border-color: rgba(88, 166, 255, 0.7);
}

/* アクティブスキル装備欄のコンテナ */
.active-skill-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* アクティブスキル説明文のコンテナ */
.active-skill-desc-container {
  flex: 1;
  text-align: left;
}

/* アクティブスキル名 */
.active-skill-desc-container .skill-name {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
}

/* アクティブスキル説明文 */
.active-skill-desc-container .skill-desc {
  font-size: 11px;
  color: #ccc;
  line-height: 1.4;
}

/* アクティブスキルクールダウン */
.active-skill-desc-container .skill-cooldown {
  font-size: 11px;
  color: #8b949e;
  margin-top: 2px;
}

/* icon 少し小さく */
.equip-slot-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

/* =========================
   スキル一覧
========================= */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 12px 10px;
  justify-content: start;
}

.skill-grid-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 4px;
  border-radius: 8px;
}

/* アイコン枠 */
/* アイコン枠を六角形に */
.skill-grid-icon-wrap {
  width: 42px;
  height: 42px;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.15s;
  position: relative;
}

.skill-grid-item:hover .skill-grid-icon-wrap {
    border-color: #aaa;
    transform: scale(1.05);
}

.skill-grid-item.equipped .skill-grid-icon-wrap {
    border-color: gold;
    box-shadow: 0 0 8px rgba(255,215,0,0.5);
}

.skill-grid-item.passive .skill-grid-icon-wrap {
    border-color: #4caf50;
    opacity: 0.7;
}

.skill-grid-name {
  font-size: 10px;
  text-align: center;
  line-height: 1.1;
  color: #fff;
  word-break: break-word;
  min-height: 28px;
  margin-top:2px;
}

.skill-grid-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: auto;
}
/* =========================
   Tooltip
========================= */
.skill-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px; 
  pointer-events: none;
  display: none;
  z-index: 21000;
  max-width: 320px;
}

.skill-tooltip .title{
    display:flex;
    align-items:center;
    gap:8px;
    font-weight:bold;
    font-size:14px;
}



.skill-tooltip .icon{
    font-size:22px;
    line-height:1;
}

.skill-icon-img{
    width:48px;
    height:48px;
    object-fit:contain;
}

.skill-tooltip .desc {
    opacity: 0.85;
}

.skill-tooltip .challenge,
.skill-tooltip .unlock {
    margin-top: 8px;
}

.skill-tooltip .label {
    font-weight: bold;
    margin-bottom: 4px;
}

.skill-tooltip .value {
    opacity: 0.85;
    padding-left: 4px;
}

/* ===================================
   スキル画面 2カラムレイアウト
   =================================== */

/* スキルモーダル全体のラッパー */
.skill-wrapper {
  display: flex;
  gap: 24px; /* 左右カラム間の溝 */
  width: 100%;
  height: 100%; /* 親要素の高さを埋める */
}

/* 左カラム (ステータス・装備スロット) */
.skill-left-column {
  flex: 1; /* 利用可能な幅を均等に分け合う */
  min-width: 0; /* flexアイテムがコンテナからはみ出さないようにする */
  display: flex;
  flex-direction: column;
  gap: 20px; /* カラム内の要素間の隙間 */
}

/* 右カラム (スキル一覧) */
.skill-right-column {
  flex: 1; /* 利用可能な幅を均等に分け合う */
  display: flex;
  flex-direction: column;
  min-width: 0; /* flexアイテムがコンテナからはみ出さないようにする */
}

/* スキル一覧エリア */
.skill-list {
  flex-grow: 1; /* 右カラムの利用可能な高さをすべて使用する */
  overflow-y: auto; /* コンテンツがはみ出た場合に縦スクロールバーを表示 */
  padding-right: 10px; /* スクロールバー用の余白 */
  margin-right: -10px; /* 親要素のpaddingを相殺 */
}

/* 装備エリアのレイアウト調整 */
.skill-equip-area {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* 各スキルセクションの調整 */
.skill-section {
  margin-bottom: 20px;
}

/* ===================================
   スキル画面 タブUI
   =================================== */

.skill-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid #444;
}

.skill-tab-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: bold;
  color: #888;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -1px; /* 下線を親のborderに重ねる */
}

.skill-tab-btn:hover {
  color: #ccc;
}

.skill-tab-btn.active {
  color: #fff;
  border-bottom-color: #58a6ff;
}

.skill-tab-contents {
  flex-grow: 1;
  min-height: 0; /* flexコンテナ内での縮小問題を解決 */
}

.skill-tab-content {
  display: none; /* デフォルトは非表示 */
}

.skill-tab-content.active {
  display: block; /* アクティブなコンテンツのみ表示 */
}

/* =========================
   skill Map のロックされたノード
========================= */

.skill-tree-canvas.shake {
    animation: skillTreeShake 0.2s;
}

@keyframes skillTreeShake {

    0%   { transform: translateX(0); }
    25%  { transform: translateX(-2px); }
    50%  { transform: translateX(2px); }
    75%  { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

.skill-tooltip .locked {
    color: #ff7070;
    font-weight: bold;
    text-align: center;
}

/* =========================
   Badge
========================= */
.r-badge.slotup.level {
    background: #4caf50;
}

.r-badge.slotup.stage {
    background: #2196f3;
}

/* =====================================================
   クエストモードスキル問題中の達成条件
   ===================================================== */
#skillUnlockHint {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);

  display: none;

  padding: 10px 12px;
  max-width: 260px;
  width: max-content;

  background: rgba(20, 20, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;

  color: rgba(255, 255, 255, 0.9);

  font-size: 14px;
  line-height: 1.5;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);

  pointer-events: none;
}

/* スキルツリーのノードにオンマウスした時のタグバッチ */
.skill-tags{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    align-items:center;
    gap:4px;
    margin:4px 0 8px;
    width:100%;
}

.skill-tag{
    padding:2px 8px;
    border-radius:999px;
    background:#333;
    color:#fff;
    font-size:11px;
    border:1px solid #666;
}

/* 長文タグによるクリア条件補正の説明（プログラミング +50秒）
   ツールチップ（幅260pxで折り返す）とイントロの両方で使うため中央寄せ */
.skill-tag-note{
    margin:0 0 8px;
    width:100%;
    color:#ffcf87;
    font-size:11px;
    line-height:1.5;
    text-align:center;
}


/* skillツリーゲーム開始前のイントロ */
.skill-intro-name{
    font-size:22px;
    font-weight:900;
    color:#fff;

    margin-top:8px;
    margin-bottom:4px;

    text-shadow:
        0 0 4px rgba(0,0,0,0.8),
        0 2px 4px rgba(0,0,0,0.8);
}

.challenge-title{
    color:#9bb1ca;
    font-weight:700;
}

.unlock-title{
    color:#9bb1ca;
    font-weight:700;
}

/* スキルツリーオンマウス */
.requirement-onmouse-label{
    color:#9bb1ca;
    font-weight:700;
}

.challenge-onmouse-label{
    color:#9bb1ca;
    font-weight:700;
}

.unlock-onmouse-label{
    color:#9bb1ca;
    font-weight:700;
}

/* =====================================================
   クエストモード：スキル結果UI（整理版）
   ===================================================== */

#skillResult {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;

    /* はみ出し安全な中央寄せ（内容が高いときは上端から表示されスクロール可能）。
       safe非対応ブラウザ用に通常のcenterを先に宣言しておく */
    justify-content: center;
    justify-content: safe center;

    background: rgba(0, 0, 0, 0.734);
    backdrop-filter: blur(6px);
    border-radius: 12px;

    color: #fff;
}

/* タイトル */
.skill-result-title {
    font-size: 34px;
    font-weight: bold;
    text-align: center;
}

.skill-result-header{
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:8px;
}

.skill-result-icon{
    width:48px;
    height:48px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
}

.skill-result-icon img{
    width:100%;
    height:100%;
    object-fit:contain;
}


/* ===== ブロック ===== */
.result-block {
    padding: 12px;
    border-radius: 10px;
}

/* ラベル */
.block-title {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 4px;
    color: #c3d4ea;
}

/* 内容 */
.block-content {
    font-size: 16px;
    font-weight: bold;
}

/* ===== ステータス ===== */
.stats-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    padding: 10px;
}

/* ラベル */
.stat .label {
    font-size: 12px;
    opacity: 0.8;
    color: #f6f6f6;
}

/* 値 */
.stat .value {
    font-size: 18px;
    font-weight: bold;
}

/* ===== SLOT増加表示 ===== */
.slot-up {
    margin-top: 10px;
    color: #4fc3f7;
    font-weight: bold;
    animation: pop 0.4s ease;
}

/* ===== STOCK増加表示 ===== */
.stock-up {
    margin-top: 10px;
    color: #4fc3f7;
    font-weight: bold;
    animation: pop 0.4s ease;
}

/* ===== new、取得済みバッジ ===== */
.new-badge{
    display:inline-block;
    margin-left:8px;
    padding:2px 8px;
    border-radius:999px;
    font-size:11px;
    font-weight:bold;
    background:#ff9800;
    color:#fff;
}

.owned-badge{
    display:inline-block;
    margin-left:8px;
    padding:2px 8px;
    border-radius:999px;
    font-size:11px;
    font-weight:bold;
    background:#666;
    color:#fff;
}

/* ===== スキル説明 ===== */
.skill-desc {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

/* =====================================================
   クエストモード SAVE/LOAD スロット
   （★クエストモーダルUI：SKILL TREE / EQUIP SKILLS のカードと同トーン）
   ===================================================== */

/* スロットを縦に積む（枠は .quest-modal-box.quest-modal-save） */
.quest-slot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-slot-card {
  background: rgba(13, 17, 23, 0.92);      /* EQUIP SKILLS のカードと同じ配色 */
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0;
  color: #e6edf3;
  text-align: left;
  box-shadow: none;
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.slot-date {
  font-size: 11px;
  font-weight: normal;
  color: #8b949e;
}

.slot-body {
  display: block;
  margin-bottom: 8px;
}

.save-slot-row {
  display: block;
  font-size: 12px;
  color: #c9d1d9;
  margin: 2px 0;
}

.slot-actions {
  display: flex;
  gap: 8px;
}

/* LOAD / SAVE ボタン：.quest-modal-btn と同じ見た目に統一 */
.slot-actions button {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  background: #1e1e1e;
  color: #ccc;
}

.slot-actions button:hover {
  background: #2a2a2a;
  color: #fff;
}

.slot-empty {
  text-align: center;
  padding: 10px 0;
  color: #5b6672;
  font-size: 1em;
  font-weight: 900;
  letter-spacing: 0.2em;
  opacity: 0.8;
}

/* =====================================================
   SAVE/LOAD・CLEAR REWARD・KEY BIND モーダル
   （★クエストモーダルUI：SKILL TREE / EQUIP SKILLS と同スタイル）
   ・overlay / box / title / × / content は quest-modal の共通クラスを使用
   ・ここでは 3 モーダル固有の「幅・縦スクロール・カード」だけを定義する
   ・見た目を合わせるため font-size は書かず、余白と配色のみ指定する
   ===================================================== */

/* ボックス幅：STAR UPGRADE(720px) より控えめな同一サイズに揃える */
.quest-modal-box.quest-modal-save,
.quest-modal-box.quest-modal-reward,
.quest-modal-box.quest-modal-keybind {
  width: min(640px, calc(var(--dvw) * 92));
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}

/* 内容はボックス内でスクロール（縦はみ出し防止／階層は不変） */
.quest-modal-box.quest-modal-save .quest-modal-content,
.quest-modal-box.quest-modal-reward .quest-modal-content,
.quest-modal-box.quest-modal-keybind .quest-modal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* CLEAR REWARD：報酬テキストをカード化
   ※本文は JS が #clearRewardContent へ innerHTML で流し込む（カード用クラスを付与） */
.quest-reward-panel {
  padding: 14px 16px;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.9;
  color: #e6edf3;
}

/* KEY BIND：保存ボタンを中央寄せ */
.quest-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.save-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);

  display: flex;
  justify-content: center;
  align-items: center;

  /* z-index: 999; */ /* → 画面階層セクションへ移動 */
}

.save-modal.hidden {
  display: none;
}

.save-modal-content {
  position: relative;
  width: 420px;
  max-height: calc(var(--dvh) * 80);
  overflow-y: auto;

  background: linear-gradient(145deg, #2a2a2a, #121212);
  border: 2px solid #555;
  border-radius: 12px;
  padding: 15px;
  color: #fff;

  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

/* セーブ/ロードモーダル右上の閉じるボタン（×）。
   quest-modal の ×（.quest-modal-close-btn）と同一見た目で統一。 */
.save-modal-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #fff;
}

.save-modal-close-btn:hover,
.save-modal-close-btn:focus {
  color: #ff9800;
  outline: none;
}

/* =====================================================
   ミュージックプレイヤー（★EXTRA CLEAR 特典）
   UIは設定画面（fieldset + 行レイアウト）に合わせている。
   横スクロールは出さない（折り返しで対処）
   ===================================================== */
.music-modal-content {
  width: 560px;
  overflow-x: hidden;
  /* ★#settings 相当のボックス（.save-modal-content のグレーは上書きする） */
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid rgba(88, 166, 255, 0.4);
  border-radius: 14px;
  padding: 20px 25px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.music-modal-content h2 {
  margin: 0 0 12px;
  color: #85a8d3;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: -1px;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
}

/* 設定画面の fieldset と同じ見た目（#settings fieldset は別スコープのため新設） */
.music-fieldset {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 8px;
}

.music-fieldset legend {
  padding: 0 6px;
  color: #f0f6fc;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
}

.music-modal-note {
  margin-bottom: 10px;
  color: #b9b9b9;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

/* --- NOW PLAYING（進捗バー） --- */
.music-nowplaying {
  min-width: 0;
}

.music-now-title {
  margin-bottom: 10px;
  color: #f0f6fc;
  font-size: 15px;
  font-weight: 700;
  word-break: break-word;
}

.music-progress {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  touch-action: none; /* ドラッグがスクロールと競合しないように */
}

.music-progress.disabled {
  opacity: 0.55;
  cursor: default;
}

.music-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f81f7, #58a6ff);
  border-radius: inherit;
  transition: width 0.12s linear;
}

/* ドラッグ中はプレビューに即座に追従させる */
.music-progress.dragging .music-progress-fill {
  transition: none;
  background: linear-gradient(90deg, #58a6ff, #9ecbff);
}

.music-progress-knob {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.music-progress:hover .music-progress-knob,
.music-progress.dragging .music-progress-knob {
  opacity: 1;
}

.music-progress.disabled:hover .music-progress-knob {
  opacity: 0;
}

.music-progress-time-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.music-progress-time {
  color: #b9b9b9;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* --- TRACKS（曲リスト） --- */
#musicList {
  max-height: calc(var(--dvh) * 42);
  overflow-y: auto;
  overflow-x: hidden; /* 横スクロールは出さない */
}

.music-row {
  display: grid;
  grid-template-columns: 1fr auto; /* テキスト可変幅 / アイコン固定 */
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(88, 166, 255, 0.12);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.music-row:last-child {
  border-bottom: none;
}

.music-row:hover {
  background: rgba(88, 166, 255, 0.08);
}

.music-row.playing {
  background: rgba(88, 166, 255, 0.18);
}

.music-row.playing .music-row-title {
  color: #9ecbff;
}

.music-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* 長い曲名でも行を押し広げない */
}

.music-row-title {
  color: #f0f6fc;
  font-size: 14px;
  font-weight: 700;
  word-break: break-word; /* 横スクロールの代わりに折り返す */
}

.music-row-composer {
  color: #a9a9a9;
  font-size: 11px;
  word-break: break-word;
}

.music-row-icon {
  width: 22px;
  color: #58a6ff;
  font-size: 12px;
  text-align: center;
}

.music-modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.music-modal-actions button {
  min-width: 140px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: #444444;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.music-modal-actions button:hover:not(:disabled) {
  background: #666666;
}

.music-modal-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* =====================================================
   キーバインド設定モーダル（クエストマップ）
   ★クエストモーダルUI（SKILL TREE / EQUIP SKILLS）と同スタイル
   ※項目は main.js が .keybind-modal-item を生成して
     #keybindConfigContent(.keybind-modal-list) へ流し込む
   ===================================================== */

/* 項目の縦積みリスト（設定画面の .keybind-row とは別物） */
.keybind-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 1項目＝ラベル左／セレクト右の行型カード */
.keybind-modal-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(13, 17, 23, 0.92);      /* EQUIP SKILLS のカードと同じ配色 */
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 8px;
}

.keybind-modal-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: #e6edf3;
  text-align: left;
}

.keybind-modal-controls select {
  font-size: 13px;
  padding: 4px 6px;
  min-width: 110px;
  background: #0d1117;
  color: #fff;
  border: 1px solid #30363d;
  border-radius: 6px;
}

/* 保存ボタン（.quest-modal-btn を継承）。モーダル内の文字サイズに合わせる */
#keybindConfigSaveBtn {
  padding: 8px 18px;
  font-size: 13px;
}

/* =====================================================
   プレイヤー名入力
   ===================================================== */

.player-name-box {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 24px;
}

#playerNameInput {
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 8px;
  border: none;
  outline: none;
  width: 180px;
}

#savePlayerNameBtn {
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.player-name-box button:disabled,
.player-name-box input:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* =====================================================
   モバイル調整
   ===================================================== */
/* 中間幅（グリッドが2カラムに折り返す範囲）では、
   行の高さ固定を行わずパネル全体をスクロールで収める
   ※ 横スクロール制御のため .quest-stats-box をサイズコンテナにしているため、
     従来どおりステージ（body）基準で評価されるよう stage を明示 */
@container stage (min-width: 601px) and (max-width: 980px) {
  .quest-stats-hud {
    grid-template-rows: none;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* ※ このブロックには .quest-stats-box / スキルモーダルbox 内の要素も含まれるため、
   従来どおりステージ（body）基準で評価されるよう stage を明示 */
@container stage (max-width: 600px) {
  h1 {
    font-size: 2rem;
  }

  #word, #word-long {
    font-size: 1.6rem;
  }

  #jp {
    font-size: 1.2rem;
  }

  #roma {
    font-size: 1.2rem;
  }

  #scoreValue {
    font-size: 2.2rem;
  }

  #records table {
    min-width: 100%;
    font-size: 12px;
  }

  /* クエストHUDをスマホでは縦並びに */
  .quest-stats-hud {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  .hud-center, .quest-center {
    min-height: 200px;
  }

  .quest-bottom-grid {
    grid-template-columns: 1fr;
  }

  /* モバイルでのスキルグリッド調整 */
  .skill-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
    justify-content: center;
  }
}


/* =====================================================
   DEVパネル　管理者用画面
   ===================================================== */
#devPanel {
  position: fixed;
  left: 10px;
  top: 400px;
  width: 280px;
  background: rgba(0,0,0,0.88);
  color: white;
  padding: 8px;
  font-size: 11px;
  border-radius: 8px;
  /* z-index: 99999; */ /* → 画面階層セクションへ移動 */
  box-sizing: border-box;
}

#devPanelHeader {
  cursor: grab;
  user-select: none;
  padding: 4px 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  margin-bottom: 6px;
  position: relative;
  /* z-index: 2; */ /* → 画面階層セクションへ移動 */
}

#devPanelHeader:active {
  cursor: grabbing;
}

.dev-title {
  font-weight: bold;
  margin-bottom: 2px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dev-key {
  font-size: 9px;
  font-weight: normal;
  opacity: 0.6;
  letter-spacing: 0.5px;
}

/* QUICKセクション（星MAXトグル） */
.dev-quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
}

.dev-quick button {
  flex: none;
  font-weight: bold;
}

#devStarMaxBtn.on {
  color: #ffd76a;
}

.dev-quick-info {
  font-size: 10px;
  white-space: nowrap;
  opacity: 0.9;
}

/* 折りたたみセクション */
#devPanel details.dev-sec {
  margin: 3px 0;
}

#devPanel details.dev-sec summary {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
  opacity: 0.75;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

#devPanel details.dev-sec summary:hover {
  opacity: 1;
}

/* 超圧縮レイアウト */
.dev-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 3px 0;
}

.dev-row button {
  padding: 2px 6px;
  font-size: 11px;
}

#devPanel button {
  font-size: 9px;
  padding: 1px 3px;
}

#devPanel input {
  font-size: 9px;
  width: 48px;
  height: 14px;
}

#devPanel select {
  font-size: 9px;
  width: 100%;
}

#devPanel hr {
  margin: 3px 0;
  opacity: 0.3;
}

/* =====================================================
   モバイル警告画面
   ===================================================== */
#mobileWarning {
  position: fixed;
  inset: 0;
  background: #111;
  color: white;
  display: none; /* 初期は非表示 */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  z-index: 999999; /* 何よりも前面に */
  text-align: center;
}

#mobileWarning h2 {
  color: #ff4d4d;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

#mobileWarning p {
  line-height: 1.6;
  font-size: 14px;
}

#mobileWarning button {
  margin-top: 24px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: bold;
  color: #111;
  background: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#mobileWarning button:hover {
  background: #ddd;
}



/* =====================================================
   スタッフロール
   ===================================================== */
.staff-roll-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-start; /* ★上寄せアンカー：要素を追加しても既存表示が動かない（下に伸びるだけ） */
  overflow: hidden;
  z-index: 30000;
  font-family: var(--font-ja);
  opacity: 1;
  transition: opacity 1.5s ease-out;
}

.staff-roll-overlay.fade-out {
  opacity: 0;
}

.staff-roll-content {
  width: 80%;
  max-width: 600px;
  text-align: center;
  /* ★スクロールはJS(dialogue.js)がrAFでピクセル絶対指定する。
     以前の translate(%) ベースのCSSアニメーションは「要素の高さ」基準のため、
     ジョークスタッフを途中で追加すると高さが変わり表示位置が跳ねてしまう。
     JS駆動なら追加しても座標は変わらないため、自然な流れが保たれる。 */
  transform: translateY(100vh);
}

.staff-roll-line {
  margin-bottom: 5em;
  font-size: 18px;
  line-height: 2.2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.staff-roll-line .role {
  color: #aaa;
  text-align: left;
}

.staff-roll-line .name {
  font-weight: bold;
  text-align: right;
}

.staff-roll-line .role-center {
  width: 100%;
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
}

/* セクション見出し（Music / Sound Effect など） */
.staff-roll-line.staff-roll-section {
  display: block;
  margin-top: 9em;
  margin-bottom: 5em;
  padding-top: 2em;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.staff-roll-line.staff-roll-section .role-center {
  font-size: 1.35em;
  letter-spacing: 4px;
  color: #fff;
}

/* 名前の下に表示するHP（URL） ※右寄せ */
.staff-roll-line.staff-roll-hp {
  display: block;
  margin-top: -4.2em;
  margin-bottom: 4.8em;
  text-align: right;
  padding-right: 2%;
}

.staff-roll-line.staff-roll-hp .hp {
  font-size: 12px;
  color: #9a9a9a;
  word-break: break-all;
  letter-spacing: 0.5px;
}

/* 最後の Thank you 表示 */
.staff-roll-line.staff-roll-thanks {
  display: block;
  margin-top: 9em;
  padding-bottom: 5em;
}

.staff-roll-line.staff-roll-thanks .role-center {
  font-size: 1.8em;
  letter-spacing: 2px;
}

/* エンドロール最後の The End */
.staff-roll-line.staff-roll-end {
  display: block;
  margin-top: 7em;
  padding-bottom: 6em;
}

.staff-roll-line.staff-roll-end .role-center {
  font-size: 2em;
  letter-spacing: 8px;
  color: #fff;
}

/* Special Thanks セクション */
.staff-roll-thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5em;
  margin: 3em 0;
  padding: 2em 0;
}

/* ※ジョークスタッフは入力した行の直後に差し込まれるため、
     専用コンテナの高さ確保は不要（JSスクロール化により跳ねも解消済み） */

/* タイピング中の名前の強調表示（控えめだがほんの少し分かる程度） */
.name-right.typing {
  text-shadow: 0 0 10px rgba(255, 240, 200, 0.3);
}

/* 現在の入力対象の目印（うっすら金色がかって、少しだけ目立つ） */
.typing-name-line.current-target .name-right .name-text {
  color: #f7e9c8;
}

/* 対象行の未入力文字（同じく薄い金色） */
.typing-name-line.current-target .char-remain {
  color: #f7e9c8;
}

.typing-name-line.current-target .role-left {
  color: #d8c9a8;
  opacity: 0.9;
}

.typing-name-line.current-target .name-right .roma {
  color: #c4b896;
}

/* 入力失敗（スクロールアウト） */
.name-right.missed .name-text,
.name-right.missed .roma {
  color: #833;
  opacity: 0.4;
}

/* タイピング対象の名前行（横書き） */
.typing-name-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1.5em;
  width: 100%;
  text-align: center;
}

.role-left {
  color: #aaa;
  font-size: 14px;
  min-width: 120px;
  text-align: right;
  opacity: 0.8;
  writing-mode: horizontal-tb;
  direction: ltr;
}

.name-right {
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  position: relative;
  transition: all 0.2s;
  writing-mode: horizontal-tb;
  direction: ltr;
}

.name-right .roma {
  display: block;
  font-size: 12px;
  color: #888;
  font-family: 'Noto Sans Mono', monospace;
  margin-top: 4px;
  letter-spacing: 1px;
  writing-mode: horizontal-tb;
  direction: ltr;
}

.name-right.typing .roma {
  color: #88ff88;
}

.name-right.typed {
  color: #444;
}

.name-right.typed .roma {
  color: #333;
}

.name-right .typed-part {
  color: #666;
}

/* 名前の文字ごとの色（入力済みはうっすら緑、ほぼ目立たない程度） */
.char-typed {
  color: #6f9a6f;
}

.char-remain {
  color: #fff;
}

/* Thank you for playing! と The End の最終表示 */
.staff-roll-thank-you-final,
.staff-roll-the-end-final {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  z-index: 30002;
  pointer-events: none;
  animation: fadeInFinal 1s ease-in;
}

.staff-roll-the-end-final {
  font-size: 72px;
  letter-spacing: 8px;
}

@keyframes fadeInFinal {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ジョークスタッフ（タイピングで増殖）※色は控えめに：通常文字とあまり変わらない程度 */
.joke-staff {
  margin-bottom: 9em; /* ★ジョークスタッフ同士の間隔。本編行(.staff-roll-line)の5emより広めに取る。調整はここ def5em */
  animation: jokePopIn 0.3s ease-out;
}

.joke-staff .role-left {
  color: #a8bcd2;
  opacity: 0.85;
  writing-mode: horizontal-tb;
  direction: ltr;
}

.joke-staff .name-right {
  color: #ece4d4;
  writing-mode: horizontal-tb;
  direction: ltr;
}

.joke-staff .name-right.typed {
  color: #444;
}

@keyframes jokePopIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ジョークスタッフ上限警告（画面中央固定・スクロールの影響を受けない） */
.staff-roll-joke-warning {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  font-size: 2em;
  font-weight: bold;
  color: #ff4444;
  text-shadow: 0 0 12px rgba(255, 0, 0, 0.8);
  animation: warningPulse 0.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes warningPulse {
  from {
    opacity: 0.7;
    transform: scale(1);
  }
  to {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* =====================================================
   エンドロール
   ===================================================== */
.ending-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  overflow: hidden;
  z-index: 29000; /* スタッフロールより手前 */
  font-family: var(--font-ja);
  opacity: 1;
  transition: opacity 1.5s ease-out;
}

.ending-overlay.fade-out {
  opacity: 0;
}

.ending-content {
  width: 80%;
  max-width: 700px;
  text-align: center;
  animation: scrollUpEnding 25s linear forwards;
  transform: translateY(100%);
}

@keyframes scrollUpEnding {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(-110%);
  }
}

.ending-content p {
  font-size: 24px;
  line-height: 2;
  margin-bottom: 1.5em;
  color: #e0e0e0;
}

/* =====================================================
   真エンディング演出
   ===================================================== */
.true-ending-blackout {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 28000; /* エンドロールより手前 */
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.true-ending-message-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  z-index: 28500; /* 暗転より手前 */
  opacity: 0;
  transition: opacity 1.5s ease-out;
}

.true-ending-message-overlay p {
  color: #fff;
  font-size: 22px;
  font-family: var(--font-ja);
  letter-spacing: 1.5px;
}

/* エンディング冒頭のゲームタイトル表示 */
.true-ending-message-overlay p.staff-roll-title {
  font-size: 56px;
  font-weight: bold;
  letter-spacing: 12px;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.35);
}

/* =====================================================
   ★EXTRAクリア演出（暗転 → 台詞 → THE END）
   ===================================================== */
.extra-ending-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 28500; /* 暗転(.true-ending-blackout)より手前 */
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  pointer-events: none;
}

.extra-ending-text {
  margin: 0;
  color: #fff;
  font-size: 26px;
  font-family: var(--font-ja);
  line-height: 1.9;
  letter-spacing: 1.5px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.7s ease-out;
}

.extra-ending-text.show {
  opacity: 1;
}

.extra-ending-the-end {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 72px;
  font-weight: bold;
  letter-spacing: 8px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  opacity: 0;
  transition: opacity 1.4s ease-out;
}

.extra-ending-the-end.show {
  opacity: 1;
}

/* =====================================================
   オフラインデータダウンロード進捗モーダル
   ===================================================== */

.offline-download-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10900;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.offline-download-modal.hidden {
  display: none !important;
  pointer-events: none;
}

.offline-download-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: -1;
}

.offline-download-content {
  position: relative;
  z-index: 1;
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 8px;
  padding: 24px 28px 20px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  animation: offlineDlFadeIn 0.25s ease-out;
}

@keyframes offlineDlFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.offline-download-content .offline-dl-title {
  color: #c5d9f0;
  font-size: 14px;
  font-weight: bold;
  margin: 0 0 18px 0;
  letter-spacing: 0.5px;
  font-family: var(--font-ui);
}

.offline-dl-progress-wrapper {
  margin: 0 auto 14px;
  width: 220px;
}

.offline-dl-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}

.offline-dl-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #58a6ff, #9fe870);
  width: 0%;
  transition: width 0.2s linear;
}

.offline-dl-progress-text {
  color: #a3c8e4;
  font-size: 11px;
  margin-top: 6px;
  letter-spacing: 0.5px;
  font-family: var(--font-ui);
}

.offline-dl-status {
  color: #c5d9f0;
  font-size: 12px;
  margin: 12px 0 0;
  line-height: 1.5;
  font-family: var(--font-ja);
}

.offline-dl-note {
  margin: 14px auto 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  text-align: center;
}

.offline-dl-note p {
  color: #8a9bb0;
  font-size: 11px;
  margin: 0;
  line-height: 1.4;
  font-family: var(--font-ja);
}

.offline-dl-cancel-btn {
  margin-top: 20px;
  padding: 10px 20px;
  background-color: #333;
  color: #ff6666;
  border: 2px solid #ff6666;
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.2s ease;
}

.offline-dl-cancel-btn:hover:not(:disabled) {
  background-color: #ff6666;
  color: #1a1a1a;
}

.offline-dl-cancel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =====================================================
   ★v1.0.42: オフラインDLモーダルの詳細表示・操作ボタン
   ===================================================== */

.offline-dl-detail {
  color: #8a9bb0;
  font-size: 11px;
  margin: 8px auto 0;
  line-height: 1.5;
  font-family: var(--font-ui);
  max-width: 300px;
  overflow-wrap: break-word;
  word-break: break-all;
}

.offline-dl-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px auto 0;
}

.offline-dl-buttons:empty {
  display: none;
}

.offline-dl-action-btn {
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.06);
  color: #c5d9f0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.2s ease;
}

.offline-dl-action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.offline-dl-action-btn.primary {
  /* background: linear-gradient(90deg, #58a6ff, #3fb950); */
  color: #c5d9f0;
  border-color: transparent;
  font-weight: bold;
}

.offline-dl-action-btn.primary:hover:not(:disabled) {
  filter: brightness(1.12);
  /* background: linear-gradient(90deg, #58a6ff, #3fb950); */
}

.offline-dl-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}




/* defense combo tier wrapper */

#defenseComboTierWrapper {
  position: absolute;
  top: 50%;
  right: 230px; /* 入力文字の右側に配置 */
  transform: translateY(-50%);
  z-index: 10;
  pointer-events: none;
}

/* =====================================================
   防衛モード コンボバー (エヴァ風)
   ===================================================== */
#defenseComboTierWrapper {
  position: absolute;
  left: 50%;
}

.defense-combo-bar-container {
  display: flex;
  gap: 3px;
  width: 100%;
}

.defense-combo-bar-block {
  flex: 1;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: skewX(-30deg);
  position: relative;
  overflow: hidden;
  transition: background-color 0.3s, border-color 0.3s;
}

.defense-combo-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%; /* JSで制御 */
  background-color: #ffe082; /* Lighter Amber -> Even Lighter */
  transition: width 0.1s linear;
}

/* --- 状態 --- */

/* 達成済み */
.defense-combo-bar-block.filled {
  background-color: #ffc107; /* Lighter Amber Dark -> Amber */
  border-color: #ffe082;
}

/* 現在進行中 */
.defense-combo-bar-block.active {
  background-color: rgba(255, 193, 7, 0.2);
  border-color: #ffe082;
}

/* ティアアップ時のフラッシュ */
.defense-combo-bar-block.flash {
  animation: defenseBarFlash 0.4s ease-out;
}

@keyframes defenseBarFlash {
  0%, 100% {
    background-color: #ff8f00;
    transform: skewX(-30deg) scale(1);
  }
  50% {
    background-color: #ffffff;
    transform: skewX(-30deg) scale(1.1);
    box-shadow: 0 0 15px #fff;
  }
}

/* オーバードライブ */
.defense-combo-bar-block.overdrive {
  background-color: #d50000; /* Red */
  border-color: #ff5252;
  animation: defenseOverdrivePulse 0.8s infinite;
}

.defense-combo-bar-block.overdrive .defense-combo-bar-fill {
  width: 100% !important;
  background-color: #ff8a80;
}

@keyframes defenseOverdrivePulse {
  0%, 100% {
    background-color: #d50000;
    filter: brightness(1);
  }
  50% {
    background-color: #ff1744;
    filter: brightness(1.5);
  }
}


/* =====================================================
   防衛モード コンボバー (六角形)
   ===================================================== */
.defense-combo-hex-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.defense-combo-hex-container {
  position: relative;
  width: 32px;
  height: 36px;
  transition: transform 0.2s ease-out;
}

.defense-combo-hex {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.1);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: background-color 0.3s;
}

.defense-combo-hex-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%; /* JSで制御 */
  background-color: #4dd0e1; /* 明るいシアン */
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: height 0.15s linear, background-color 0.3s;
}

/* --- 状態 --- */

/* 達成済み */
.defense-combo-hex-container.filled .defense-combo-hex {
  background-color: #00acc1; /* 濃いシアン */
}

/* 現在進行中 */
.defense-combo-hex-container.active .defense-combo-hex {
  background-color: rgba(77, 208, 225, 0.3); /* 薄いシアン */
}

.defense-combo-hex-container.active .defense-combo-hex-fill {
  box-shadow: 0 0 12px rgba(77, 208, 225, 0.8);
}

/* ティアアップ時のフラッシュ */
.defense-combo-hex-container.flash {
  animation: defenseHexFlash 0.4s ease-out;
}

@keyframes defenseHexFlash {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.4);
  }
  100% {
    transform: scale(1);
  }
}

.defense-combo-hex-container.flash .defense-combo-hex {
  animation: defenseHexColorFlash 0.4s ease-out;
}

@keyframes defenseHexColorFlash {
  0%, 100% {
    background-color: #00acc1;
  }
  50% {
    background-color: #ffffff;
    box-shadow: 0 0 15px #fff;
  }
}

/* オーバードライブ */
.defense-combo-hex-container.overdrive .defense-combo-hex {
  background-color: #ffca28; /* ゴールド */
  animation: defenseOverdrivePulse 1.5s infinite ease-in-out;
}

.defense-combo-hex-container.overdrive .defense-combo-hex-fill {
  background-color: #ffecb3; /* 薄いゴールド */
  height: 100% !important; /* 常に満タン */
}

@keyframes defenseOverdrivePulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
    box-shadow: 0 0 8px rgba(255, 202, 40, 0.5);
  }
  50% {
    transform: scale(1.1);
    filter: brightness(1.3);
    box-shadow: 0 0 20px rgba(255, 202, 40, 1);
  }
}

/* =====================================================
   STAR UPGRADE（星でアクティブスキルのクールダウン短縮）
   ===================================================== */

/* サイドメニューの星表示 */
.quest-side-star {
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  color: #ffd700;
  padding: 8px 10px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 6px;
  margin-bottom: 6px;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* starUpgrade モーダルのサイズ調整
   ※ quest-modal-box と quest-modal-starUpgrade は同じ要素に付与されるため連結セレクタを使用 */
.quest-modal-box.quest-modal-starUpgrade {
  width: min(720px, calc(var(--dvw) * 92));
  max-height: calc(var(--dvh) * 85);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 枠からはみ出ないように */
}

.quest-modal-box.quest-modal-starUpgrade .quest-modal-content {
  display: flex;
  flex-direction: column;
  overflow: hidden; /* コンテンツ全体はスクロールしない */
  padding: 16px;
  min-height: 0;
  flex: 1;
}

/* ヘッダー（固定・スクロールしない） */
.star-upgrade-header {
  flex-shrink: 0;
  margin-bottom: 16px;
}

.star-upgrade-owned {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 10px;
}

.star-upgrade-label {
  font-size: 12px;
  color: #8b949e;
  letter-spacing: 1px;
}

.star-upgrade-value {
  font-size: 22px;
  font-weight: bold;
  color: #ffd700;
}

.star-upgrade-desc {
  font-size: 12px;
  color: #8b949e;
  line-height: 1.6;
  padding: 0 4px;
}

/* スキル一覧（ここだけスクロール） */
.star-upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}

/* スクロールバーは style.css 冒頭の共通設定（黒系）に統一 */

.star-upgrade-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: border-color 0.2s;
  cursor: default;
}

.star-upgrade-item:hover {
  border-color: rgba(255, 215, 0, 0.3);
}

.star-upgrade-item-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.star-upgrade-skill-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.star-upgrade-item-info {
  flex: 1;
  min-width: 0;
}

.star-upgrade-item-name {
  font-size: 14px;
  font-weight: bold;
  color: #f0f6fc;
}

.star-upgrade-item-desc {
  font-size: 11px;
  color: #8b949e;
  margin-top: 2px;
}

.star-upgrade-item-cooldown {
  font-size: 11px;
  color: #a3c8e4;
  margin-top: 2px;
}

/* 短縮後のクールダウン時間（常時表示・金色で強調） */
.star-upgrade-cd-reduced {
  color: #ffd700;
  font-weight: bold;
}

/* 進行バー（レベルごとのブロック表示） */
.star-upgrade-progress {
  display: flex;
  gap: 2px;
  height: 5px;
  margin-top: 5px;
}

.star-upgrade-progress-block {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  transition: background 0.3s ease;
}

.star-upgrade-progress-block.filled {
  background: linear-gradient(90deg, #ffb300, #ffd700);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* レベルアップ直後のクールダウン短縮表示（短縮前 → 短縮後） */
.star-upgrade-flash {
  margin-top: 3px;
  font-size: 11px;
  font-weight: bold;
  color: #ffd700;
  animation: star-upgrade-flash-pop 0.4s ease;
}

@keyframes star-upgrade-flash-pop {
  0% {
    opacity: 0;
    transform: translateY(-3px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.star-upgrade-item-stats {
  display: flex;
  gap: 12px;
  margin-top: 2px;
  font-size: 11px;
  color: #f0f6fc;
}

/* アクション */
.star-upgrade-item-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
}

.star-upgrade-btn {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 180, 0, 0.1));
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: #ffd700;
  font-weight: bold;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
  transition: all 0.2s;
}

.star-upgrade-btn:hover:not(.disabled) {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(255, 180, 0, 0.2));
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.star-upgrade-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(60%);
}

.star-upgrade-maxed {
  font-size: 18px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  letter-spacing: 1px;
}

/* =========================
   星の振り直し（REBUILD）※ OWNED STARS直下・コンパクト1行
   ========================= */
.star-upgrade-rebuild {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 8px;
  background: rgba(255, 215, 0, 0.05);
}

.star-upgrade-rebuild-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.star-upgrade-rebuild-title {
  font-size: 12px;
  font-weight: bold;
  color: #ffd700;
  letter-spacing: 1px;
  white-space: nowrap;
}

.star-upgrade-rebuild-tickets {
  font-size: 11px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
  white-space: nowrap;
}

.star-upgrade-rebuild-btn {
  flex-shrink: 0;
  padding: 4px 16px;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 180, 0, 0.1));
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.star-upgrade-rebuild-btn:hover:not(.disabled) {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(255, 180, 0, 0.2));
  transform: scale(1.03);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.star-upgrade-rebuild-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(60%);
}

/* =====================================================
   バックグラウンド読み込みインジケータ（中央下）
   body直下に置くため 1600×900 ステージ座標が基準になる。
   pointer-events: none でクリックを一切阻害しない。
   ===================================================== */
#remainingLoadIndicator {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 10800; /* グローバルUIバー(10700)より上・カウントダウン(11000)より下 */

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;

  min-width: 200px;
  padding: 7px 16px 9px;
  box-sizing: border-box;

  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 8px;

  color: #a3c8e4;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-align: center;

  opacity: 0;
  transform: translateX(-50%) translateY(6px);
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
  pointer-events: none;
  user-select: none;
}
#remainingLoadIndicator.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  visibility: visible;
}

/* 細いプログレスバー */
.remaining-load-bar {
  width: 168px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.remaining-load-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #58a6ff, #9fe870);
  transition: width 0.2s linear;
}


/* =====================================================
   モード説明エリア（startMenu ボタン下の説明文）
===================================================== */
.mode-desc-area {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: #c9d1d9;
  line-height: 1.7;
  text-align: left;
  border-left: 2px solid #30363d;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 4px 4px 0;
  animation: modeDescFadeIn 0.15s ease;
}

@keyframes modeDescFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dialogue-enemy-thumb {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin-left: 8px;
    vertical-align: middle;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
}

