/* =========================================
  Google CSE 検索ボックス 205x29 / ボタン 62x29
  - 重複セレクタの統合
  - 特異性の順序整理（#___gcse_0 と .gsc-control-cse-ja を後段で補強）
  - 目的別ブロック化
========================================= */

/* --- コンテナ周りの基本リセット --- */
.gsc-control-cse,
.gsc-control-cse.gsc-control-cse-ja {
  display: inline-block !important;
  width: auto !important;
  height: 29px !important;
  line-height: normal !important;
  padding: 0 !important;
  margin: 0 !important;
  vertical-align: middle !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* 内側ラッパー（横並び＆高さ揃え） */
.gsc-control-cse .gsc-control-wrapper-cse {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;               /* 入力とボタンの間隔 6px */
  width: auto !important;
  height: 29px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: content-box !important; /* 余計な拡張を防ぐ */
  padding-top: 2px !important;        /* 上余白の調整 */
}

/* 背景が乗る可能性のある要素を透明化 */
.gsc-control-cse .gsc-results-wrapper-overlay,
.gsc-control-cse .gsc-wrapper,
.gsc-control-cse .gsc-resultsbox-visible,
.gsc-control-cse .gsc-resultsbox-invisible,
.gsc-above-wrapper-area-container,
.gsc-tabsArea,
.gsc-refinementsArea,
.gsc-above-wrapper-area-invisible {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* --- テーブルレイアウト由来の崩れ対策 --- */
.gsc-control-cse table.gsc-search-box {
  width: auto !important;
  max-width: none !important;
  border-spacing: 0 !important;
  border-collapse: separate !important;
  margin: 0 !important;
  padding: 0 !important;
}

.gsc-control-cse table.gsc-search-box td {
  padding: 0 !important;
  margin: 0 !important;
}

.gsc-control-cse td.gsc-input {
  width: 205px !important;
}

.gsc-control-cse td.gsc-search-button {
  width: 62px !important;
  padding-left: 6px !important;      /* 入力との間隔 6px（後段で5pxに補正可） */
}

/* --- 入力ボックス（205x29） --- */
.gsc-control-cse .gsc-input-box {
  width: 205px !important;
  height: 29px !important;
  border: 1px solid #a5acb2 !important;
  border-radius: 6px !important;
  background: #fff !important;
  padding: 0 0 0 6px !important;     /* 左余白 */
  display: flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

.gsc-control-cse .gsc-input-box input.gsc-input {
  width: 100% !important;
  height: 100% !important;
  line-height: 27px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: #fff !important;
  background-image: none !important;
  font-size: 14px !important;
  outline: none !important;
}

/* クリアボタンは非表示 */
.gsc-clear-button {
  display: none !important;
}

/* --- 検索ボタン（62x29） --- */
.gsc-control-cse td.gsc-search-button {
  width: 62px !important;
  padding: 0 !important;             /* テーブルセルの余白抑制 */
}

.gsc-control-cse .gsc-search-button-v2 {
  width: 62px !important;            /* 幅固定 */
  height: 29px !important;           /* 高さ指定 */
  background: #222 !important;
  color: #fff !important;
  border: 1px solid #000 !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.gsc-control-cse .gsc-search-button-v2:hover {
  background: #2c2c2c !important;
}

/* アイコンを中央に収める */
.gsc-control-cse .gsc-search-button-v2 svg {
  width: 14px !important;
  height: 14px !important;
}

/* --- 特定インスタンス（#___gcse_0 / 日本語ロケール）での上書きと「消しルール」対抗 --- */

/* ボタンセル（td）左パディングを 5px に統一 */
#___gcse_0.gsc-control-cse td.gsc-search-button,
.gsc-control-cse.gsc-control-cse-ja td.gsc-search-button {
  display: table-cell !important;
  padding-left: 5px !important;   /* 以前のご指定どおり 5px */
  width: 62px !important;         /* 幅の固定再保証 */
  vertical-align: middle !important;
}

/* ボタン本体の表示強制＆中央寄せ（Googleの display:none 対策） */
#___gcse_0.gsc-control-cse td.gsc-search-button > button.gsc-search-button.gsc-search-button-v2,
.gsc-control-cse.gsc-control-cse-ja td.gsc-search-button > button.gsc-search-button.gsc-search-button-v2 {
  display: inline-flex !important;    /* または inline-block */
  align-items: center !important;
  justify-content: center !important;
  height: 29px !important;
  width: 62px !important;
  padding: 0 !important;
  border-radius: 6px !important;
  background: #222 !important;
  color: #fff !important;
  border: 1px solid #000 !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
}

/* 消しルールへの保険（より強いスコープで再表示） */
#___gcse_0.gsc-control-cse .gsc-search-button {
  display: initial !important;
}

/* アイコンサイズの再保証（任意） */
#___gcse_0.gsc-control-cse td.gsc-search-button > button.gsc-search-button.gsc-search-button-v2 svg {
  width: 14px !important;
  height: 14px !important;
}

/* form.gsc-search-box の左右マージン調整 */
form.gsc-search-box {
    margin-left: 0 !important;
    margin-right: 24px !important;
}

/* .gsib_a のアイコン背景を完全に消す */
td.gsib_a {
    background: none !important;
    background-image: none !important;
}
