    /* ヘッダー */
    header {
      margin-bottom: 1.5rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    @media (min-width: 640px) {
      header { flex-direction: row; }
    }

    /* 検索バー */
    .search-bar { margin-bottom: 1.5rem; }
    #search-input {
      width: 100%;
      padding: 0.75rem 1.25rem;
      border-radius: 0.75rem;
      border: 1px solid #d1d5db;
      outline: none;
      transition: all 300ms;
      box-shadow: 0 1px 2px rgba(0,0,0,0.05);
      box-sizing: border-box;
    }
    #search-input:focus {
      ring-color: #10b981;
      ring-width: 2px;
    }

    /* 検索結果なし */
    .no-search-results {
      color:#6b7280;
      max-width: 100%;
    }
    
    /* メインのコンテナはグリッド（アイテム一覧用） */
/* スクロールバーのデザインを改良 */
#content-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;

  /* スクロール用の追加 */
  max-height: 80vh; /* ビューポートの高さに合わせて動的に調整 */
  overflow-y: auto;

  /* 横スクロール対策（ツールチップが広いとスクロールが発生するため）*/
  overflow-x: clip; /* または hidden */

  /* 境界を追加 */
  border: 1px solid #e5e7eb; /* 控えめな境界線 */
  border-radius: 0.5rem; /* 角を少し丸く */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 柔らかい影 */
  padding: 1rem; /* 内部のパディング */
  
  /* WebKit系ブラウザのスクロールバーのスタイル */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #d1d5db #f3f4f6; /* Firefox */
}

#content-container::-webkit-scrollbar {
  width: 8px; /* スクロールバーの幅 */
}

#content-container::-webkit-scrollbar-track {
  background: transparent; /* 背景を透明に */
}

#content-container::-webkit-scrollbar-thumb {
  /* 通常時のツマミの色をより控えめに */
  background-color: #d1d5db; /* ライトグレー */
  border-radius: 4px; /* ツマミの角を丸く */
  border: 2px solid transparent; /* ツマミと背景の間に隙間を作成 */
  background-clip: content-box; /* 枠線内のみ背景を描画 */
  transition: background-color 0.3s ease; /* ホバー時の変化を滑らかに */
}

#content-container::-webkit-scrollbar-thumb:hover {
  /* ホバーで少し色が濃くなるように */
  background-color: #9ca3af; /* ホバー時のツマミの色 */
}

    @media (min-width: 640px) {
      #content-container { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (min-width: 768px) {
      #content-container { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    }
    @media (min-width: 1024px) {
      #content-container { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    }

    /* レシピセクションはグリッドを全幅で占有 */
    .recipe-section {
      grid-column: 1 / -1;
      margin-bottom: 1.5rem;
      display: flex;
      flex-direction: column;
    }

    /* レシピグリッドは横並びのフレックス */
    .recipe-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      justify-content: flex-start;
      width: 100%;
    }

    /* カード */
    .item-card, .recipe-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      background-color: rgba(255, 255, 255, 0.7);
      border-radius: 0.75rem;
      box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
      transition: all 200ms;
      border: 1px solid #e5e7eb;
    }

    /* レシピカードの背景 */
    .recipe-card {
      background-image: url('/myApps/img/minecraft/gui/craft_gui.png');
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      background-color: rgba(255, 255, 255, 0.7);
    }

    .item-card:hover, .recipe-card:hover {
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }

    /* レシピカードのサイズ（背景に合わせる） */
    .recipe-card {
      flex: 0 0 auto;
      width: 216px;
      height: 124px;
      box-sizing: border-box;
      padding: 0;
      background-color: transparent;
      box-shadow: none;
      border: none;
      border-radius: 0;
      position: relative; /* 子要素の絶対配置に必要 */
    }

    .item-card, .recipe-card .result-item-link {
      cursor: pointer;
    }

    /* クリック可能なアイテムにのみポインターを適用 */
    .recipe-card .ingredient-item,
    .recipe-card .result-item-link {
        cursor: pointer;
        position: relative; /* ツールチップのために相対位置を指定 */
    }
    
    /* 画像のピクセル補間を無効にして、きれいに拡大表示する */
    .card-icon img,
    .recipe-card .result-icon img,
    .recipe-card .ingredient-icon img,
    .smelt-recipe-card .smelt-icon img,
    .stonecutter-recipe-card .stonecutter-icon img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      image-rendering: -moz-crisp-edges; /* Firefox */
      image-rendering: -webkit-crisp-edges; /* Webkit (Old) */
      image-rendering: pixelated; /* Standard */
      image-rendering: crisp-edges;
    }

    .card-icon {
      width: 4rem;
      height: 4rem;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 0.5rem;
    }

    .card-name {
      text-align: center;
      font-weight: 500;
      color: #374151;
      font-size: 0.875rem;
    }

    /* 結果アイテムの位置 */
    .recipe-card .result-item-link {
      position: absolute;
      top: 46px;
      right: 18px;
    }
    .recipe-card .result-icon, .recipe-card .ingredient-icon {
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    /* レシピ結果の個数表示 */
    .recipe-card .result-count,
    .smelt-recipe-card .result-count,
    .stonecutter-recipe-card .result-count {
      position: absolute;
      bottom: 0;
      right: 0;
      background-color: #1f2937;
      color: #fff;
      font-size: 0.75rem;
      font-weight: bold;
      padding: 2px 4px;
      border-radius: 4px;
      line-height: 1;
      transform: translate(50%, 50%); /* アイコンの右下角に配置 */
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    .recipe-card .result-name {
      font-size: 1.125rem;
      font-weight: 700;
      color: #1f2937;
      text-align: center;
    }

    /* 材料グリッドの位置と間隔（高さ固定化） */
    .recipe-card .ingredients-list {
      display: grid;
      grid-template-columns: repeat(3, 32px); /* 幅固定 */
      grid-template-rows: repeat(3, 32px); /* 高さ固定 */
      gap: 4px; /* 間隔 */
      position: absolute;
      top: 10px;
      left: 10px;
    }

    /* 空でも潰れないように各マスを固定サイズに */
    .recipe-card .ingredient-item {
      width: 32px;
      height: 32px;
      padding: 0px;
      box-sizing: border-box;
      display: grid; /* 既存のflexを上書き */
      place-items: center;
      border-radius: 0px;
    }
    .recipe-card .ingredient-name {
      font-size: 0.75rem;
      color: #4b5563;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      max-width: 4rem;
      margin-top: 0.25rem;
    }

    /* カードごとのツールチップ最大幅（上限）をCSS変数で与える */
    .recipe-card { --tooltip-max-width: 216px; }
    .smelt-recipe-card { --tooltip-max-width: 180px; }
    .stonecutter-recipe-card { --tooltip-max-width: 170px; }

    /* 既存 .item-tooltip を置き換え */
    .item-tooltip {
      position: absolute;
      bottom: 100%;           /* アイテムの上に表示 */
      left: 50%;              /* アイテム中央を基準に */
      transform: translateX(-50%);
      margin-bottom: 8px;

      padding: 6px 8px;
      background-color: #333;
      color: #fff;
      font-size: 0.75rem;
      border-radius: 4px;
      z-index: 10;
      pointer-events: none;   /* ホバー途切れ防止 */

      /* ここが肝: カード幅を上限にし、内部で折り返す */
      width: max-content;                 /* 中身に応じて広がる */
      max-width: var(--tooltip-max-width, 216px);  /* でもカード幅まで */
      white-space: pre-line;              /* \n を改行、他は通常折り返し */
      overflow-wrap: anywhere;            /* 長い単語/連結語も折り返し */
      word-break: normal;                 /* 日本語は自然に改行 */
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.2s ease;
    }

    /* ▼を下向きに（ツールチップ下縁からアイテムへ向ける） */
    .item-tooltip::after {
      content: '';
      position: absolute;
      top: 100%; /* ツールチップの下端に配置 */
      left: 50%;
      transform: translateX(-50%);
      border-width: 6px;
      border-style: solid;
      /* 下向きにする場合は下側に色を付ける */
      border-color: #333 transparent transparent transparent;
    }

    /* セットされたアイテム表示 */
    .set-item-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      background-color: #f1f5f9;
      border: 2px dashed #cbd5e1;
      border-radius: 1rem;
      padding: 1rem;
      margin-bottom: 1.5rem;
      text-align: center;
    }
    .set-item-container.hidden {
      display: none;
    }
    .set-item-container .item-card {
      background-color: #e2e8f0;
      border: 1px solid #94a3b8;
    }
    .set-item-container .clear-btn {
      margin-top: 1rem;
      background-color: #ef4444;
      color: white;
      padding: 0.5rem 1rem;
      border-radius: 0.5rem;
      cursor: pointer;
      font-weight: 600;
      transition: background-color 200ms;
    }
    .set-item-container .clear-btn:hover {
      background-color: #dc2626;
    }

    /* セクション見出し */
    .recipe-section-title {
      font-size: 1.125rem;
      font-weight: 600;
      color: #374151;
      margin-bottom: 0.5rem;
    }
    .recipe-section-title::before {
      content: '▶';
      font-size: 0.8rem;
      margin-right: 0.5rem;
      color: #10b981;
    }
    .recipe-section-title.sub::before {
      content: '└';
      margin-right: 0.5rem;
      color: #9ca3af;
    }

    /* 精錬レシピのスタイル */
    .smelt-recipe-card {
      flex: 0 0 auto;
      width: 180px;
      height: 124px;
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      background-color: transparent;
      box-shadow: none;
      border: none;
      border-radius: 0;
      position: relative;
    }

    /* 精錬元アイテムの位置 */
    .smelt-recipe-card .smelt-input {
      position: absolute;
      top: 10px;
      left: 10px;
    }

    /* 結果アイテムの位置 */
    .smelt-recipe-card .smelt-output {
      position: absolute;
      top: 46px;
      right: 18px;
    }

    .smelt-recipe-card .smelt-icon {
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .smelt-recipe-card .result-count {
      position: absolute;
      bottom: 0;
      right: 0;
      background-color: #1f2937;
      color: #fff;
      font-size: 0.75rem;
      font-weight: bold;
      padding: 2px 4px;
      border-radius: 4px;
      line-height: 1;
      transform: translate(50%, 50%);
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }

    /* 石切台用 */
    .stonecutter-recipe-card {
      position: relative;
      width: 170px;
      height: 124px;
      background-size: cover;
      background-repeat: no-repeat;
    }

    /* 入力スロット */
    .stonecutter-input {
      position: absolute;
      top: 47px;
      left: 10px;
      width: 32px;
      height: 32px;
    }

    /* 出力スロット */
    .stonecutter-output {
      position: absolute;
      top: 46px;
      right: 18px;
      width: 32px;
      height: 32px;
    }

    /* 選択スロット（例: 出力の下に配置） */
    .stonecutter-select {
      position: absolute;
      top: 21px;
      left: 53px;
      width: 32px;
      height: 32px;
    }