/* ==============================
   分数花火ゲーム - スタイル
   修正: 単体HTML版から移植する際、グローバルセレクタ（*, html, body）を
   .ffg-app にスコープし直し、他ページ・他プラグインへの影響を排除。
   Cocoonテーマ対策として、レイアウトに直結するプロパティに !important を付与。
   ============================== */

  /* ==============================
     倍数花火ゲームと同じ骨格（固定ヘッダー + 全画面キャンバス + 右下ツールバー + モーダル）
     モードが3つ（はじめの一歩/チャレンジ/マスター）なので、モーダルはカード選択形式に調整
     紺 #1e3a5f / 金 #d4af37 のブランド配色
     ============================== */
  /* 修正: 全称セレクタは .ffg-app 内だけに限定（サイト全体を壊さないため） */
.ffg-app, .ffg-app * { box-sizing: border-box; margin: 0; padding: 0; }

  /* 修正: html/bodyへの適用をやめ、.ffg-app自体を全画面固定オーバーレイにする */
  .ffg-app {
    position: fixed !important;
    inset: 0 !important;
    height: 100%;
    overflow: hidden;
    font-family: "BIZ UDGothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
    background: #0b1020;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    z-index: 999999; /* Cocoonのヘッダー等より前面に */
  }

  .ffg-app canvas {
    position: fixed !important;
    inset: 0;
    display: block;
  }

  /* ---------- 固定ヘッダー ---------- */
  .ffg-header {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(10, 18, 38, 0.72);
    border-bottom: 1px solid rgba(212, 175, 55, 0.35);
    z-index: 10;
  }

  .ffg-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  .ffg-status { display: flex; gap: 8px; align-items: center; }

  .ffg-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 13px;
    white-space: nowrap;
  }
  .ffg-chip b { font-size: 17px; }
  .ffg-chip-target {
    background: linear-gradient(180deg, #e3c04c, #d4af37);
    border-color: #d4af37;
    color: #16324f;
    font-weight: 700;
  }
  .ffg-chip-score b { color: #f4cf5f; }
  .ffg-chip-combo b { color: #f4cf5f; }

  /* 分数のミニ表示（分子/分母スタック） */
  .ffg-fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    font-size: 14px;
    vertical-align: middle;
  }
  .ffg-fraction .ffg-num { border-bottom: 1.5px solid currentColor; padding: 0 5px 2px; }
  .ffg-fraction .ffg-den { padding: 2px 5px 0; }

  /* ---------- 進捗ドット ---------- */
  .ffg-progress {
    position: fixed !important;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
  }
  .ffg-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
  }
  .ffg-dot.ffg-filled {
    background: linear-gradient(135deg, #f4cf5f, #d4af37);
    border-color: #d4af37;
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
  }

  /* ---------- 右下ツールバー ---------- */
  .ffg-toolbar {
    position: fixed !important;
    right: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
  }
  .ffg-tool {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #1e3a5f;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
  }
  .ffg-tool:active { transform: scale(0.92); }
  .ffg-tool:disabled { opacity: 0.4; cursor: not-allowed; }
  .ffg-tool-main { background: #d4af37; color: #16324f; }

  /* ---------- トースト ---------- */
  .ffg-msg {
    position: fixed !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 30, 58, 0.92);
    padding: 16px 24px;
    border-radius: 18px;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    border: 2px solid rgba(212, 175, 55, 0.5);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    z-index: 60;
    max-width: 340px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .ffg-msg.ffg-show { opacity: 1; }
  .ffg-msg.ffg-success { border-color: #2e9e5b; background: rgba(20, 70, 45, 0.92); }
  .ffg-msg.ffg-error { border-color: #c0392b; background: rgba(90, 25, 20, 0.92); }

  /* ---------- ゲーム終了オーバーレイ ---------- */
  .ffg-overlay {
    position: fixed !important;
    inset: 0;
    background: rgba(10, 18, 38, 0.78);
    display: none !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    padding: 20px;
    z-index: 50;
  }
  .ffg-overlay.ffg-show { display: flex !important; }
  .ffg-overlay h2 { font-size: 26px; color: #f4cf5f; }
  .ffg-overlay p { font-size: 16px; }

  /* ---------- モーダル（モード選択） ---------- */
  .ffg-modal {
    position: fixed !important;
    inset: 0;
    background: rgba(10, 18, 38, 0.78);
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
  }
  .ffg-modal.ffg-show { display: flex !important; }

  .ffg-modal-card {
    background: #fff;
    color: #1e3a5f;
    border-radius: 20px;
    padding: 28px 26px;
    width: 100%;
    max-width: 480px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
  .ffg-modal-title {
    font-size: 20px;
    font-weight: 700;
    border-left: 6px solid #d4af37;
    padding-left: 10px;
    margin-bottom: 18px;
  }

  /* モードカード（3択・縦積み） */
  .ffg-mode-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
  }
  .ffg-mode-card {
    text-align: left;
    padding: 14px 16px;
    border: 2px solid #c6d3e0;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
  }
  .ffg-mode-card .ffg-mode-title { font-size: 16px; font-weight: 700; color: #1e3a5f; margin-bottom: 4px; }
  .ffg-mode-card .ffg-mode-desc { font-size: 12px; color: #5b7186; line-height: 1.6; }
  .ffg-mode-card.ffg-selected {
    border-color: #d4af37;
    background: #fdf8ea;
  }
  .ffg-mode-card.ffg-selected .ffg-mode-title { color: #b8941f; }

  .ffg-start-btn {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #e3c04c, #d4af37);
    color: #16324f;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.15em;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  }
  .ffg-start-btn:active { transform: scale(0.98); }
  .ffg-overlay .ffg-start-btn { width: auto; padding: 12px 32px; margin-top: 8px; }

  .hidden { display: none !important; }

  /* ---------- レスポンシブ ---------- */
  @media (max-width: 700px) {
    .ffg-title { font-size: 14px; }
    .ffg-chip { padding: 4px 10px; font-size: 11px; }
    .ffg-chip b { font-size: 14px; }
    .ffg-status { gap: 4px; }
    .ffg-tool { width: 48px; height: 48px; font-size: 20px; }
    .ffg-dot { width: 13px; height: 13px; }
  }


.hidden { display: none !important; }
