/*  ヘッダー内アクションボタン  */
.header-action-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  padding: 4px 8px;
  background: linear-gradient(45deg, #007BFF, #00BFFF);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
  display: block;
  transition: .25s;
}

.header-action-btn img {
  width: 28px;
  height: 28px
}

.header-action-btn:hover {
  filter: brightness(1.1)
}

.header-action-btn:active {
  transform: scale(.94)
}

.header-action-btn.active {
  background: linear-gradient(45deg, #00BFFF, #007BFF)
}

#search-toggle-btn {
  top: 8px;
}

/*  お気に入りリスト  */
#header-favorites {
  width: 100%;
  background: var(--header-bg);
  padding: 8px 0;
  white-space: nowrap;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#header-favorites::-webkit-scrollbar {
  display: none;
}

#header-favorites #favorites-list {
  display: flex;
  padding: 0 12px;
  gap: 1px;
}

#header-favorites .favorite-item {
  display: inline-block;
  flex-shrink: 0;
}

#header-favorites .favorite-item img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #eee;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#header-favorites .favorite-item img:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

#header-favorites p {
  margin: 0;
  font-size: 13px;
  color: #999;
  width: 100%;
  text-align: center;
  padding: 20px 0;
}

/*  検索 UI  */
#header-search {
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--line-gold);
  border-radius: 5px;
  padding: 8px;
  margin-top: 8px;
}

.search-tabs {
  display: flex;
  margin: 0 0 8px 0
}

.search-tab {
  flex: 1;
  padding: 5px;
  font-size: 14px;
  border: 1px solid var(--line-gold-hi);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  text-align: center;
  transition: .25s;
}

.search-tab:first-child {
  border-radius: 3px 0 0 3px;
}

.search-tab:last-child {
  border-radius: 0 3px 3px 0;
}

.search-tab.active {
  background: var(--gold);
  color: #000;
  font-weight: bold
}

.search-content>div {
  display: none
}

.search-content>div.active {
  display: block
}

/* 50音順検索のリンク色 */
#kana-search a {
  color: var(--text-main);
  text-decoration: none;
}

#kana-search a:hover {
  color: var(--gold);
}

/* 検索フォームのスタイル */
#keyword-search .search-form {
  display: flex;
}

#keyword-search .search-field {
  font-size: 16px !important;
  width: 100%;
  padding: 12px;
  margin: 0;
  border: 1px solid var(--line-gold);
  border-right: none;
  border-radius: 3px 0 0 3px;
  -webkit-appearance: none;
  box-sizing: border-box;
  color: var(--text-main);
  background: var(--bg-card-hi);
}

#keyword-search .search-field::placeholder {
  color: var(--text-light);
}

#keyword-search .search-submit {
  flex-shrink: 0;
  padding: 0 15px;
  margin: 0;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #000;
  border-radius: 0 3px 3px 0;
  cursor: pointer;
  font-weight: 700;
  -webkit-appearance: none;
}

/* すべての検索入力フィールドで自動ズームを防止 */
#header-search input[type='text'],
#header-search input[type='search'],
#keyword-search input[type='text'],
#keyword-search input[type='search'],
#kana-search input[type='text'],
#kana-search input[type='search'],
.search-field {
  font-size: 16px !important;
  -webkit-text-size-adjust: 100%;
}

/*  スマホ調整  */
@media(max-width:480px) {
  .header-action-btn {
    padding: 4px 6px;
    right: 6px
  }

  .header-action-btn img {
    width: 22px;
    height: 22px
  }

  #header-search {
    width: 100%;
    max-width: calc(100% - 16px);
  }

  /* 検索入力フィールドの自動ズーム防止を強化 */
  #header-search input[type='text'],
  #header-search input[type='search'],
  #keyword-search input[type='text'],
  #keyword-search input[type='search'],
  #kana-search input[type='text'],
  #kana-search input[type='search'],
  .search-field {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
  }
}

/*  スマホ固定メニューバー（全デバイス共通）  */
#header-favorites,
#header-search {
  display: none !important;
}

/* ページコンテンツが固定ナビに隠れないよう余白確保（スマホのみ） */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

/* ---- ボトムナビゲーション ---- */
#mobile-fixed-menu {
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  transition: transform 0.25s ease;
}
/* 下スクロール時に画面外へスライド（パネル開いてる時は付与しない） */
#mobile-fixed-menu.nav-hidden {
  transform: translateY(100%);
}

.mobile-bottom-nav {
  display: flex;
  background: var(--bottom-nav-bg);
  border-top: 1px solid var(--bottom-nav-border);
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.mobile-nav-btn.active,
.mobile-nav-btn:active {
  color: var(--accent-color, #f5a623);
}

/* フローティングボタン廃止のため、デスクトップでも質問するボタンを表示 */

.mobile-nav-kana-icon {
  font-size: 18px;
  line-height: 1;
}

/* パネル（ボトムナビ直上に展開） */
.mobile-panel {
  background: transparent;
  border-top: none;
  padding: 12px 16px;
  max-height: 220px;
  overflow-y: auto;
}

/* 検索パネル内フォーム */
.mobile-panel-content form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mobile-panel-content input[type="search"] {
  flex: 1;
  height: 42px;
  font-size: 16px;
  padding: 0 12px;
  border: 2px solid var(--gold);
  border-radius: 4px 0 0 4px;
  border-right: none;
  box-sizing: border-box;
  min-width: 0;
  background: var(--bg-card-hi);
  color: var(--text-main);
  box-shadow: 0 0 0 2px rgba(245, 184, 0, 0.18), 0 0 12px rgba(245, 184, 0, 0.25);
  transition: box-shadow .15s ease, background .15s ease;
}

/* 未入力時はさらに強調（脈動なしの静的グロー） */
.mobile-panel-content input[type="search"]:placeholder-shown {
  background: var(--bg-subtle);
  box-shadow: 0 0 0 2px rgba(245, 184, 0, 0.28), 0 0 16px rgba(245, 184, 0, 0.35);
}

.mobile-panel-content input[type="search"]:focus {
  outline: none;
  background: var(--bg-card-hi);
  box-shadow: 0 0 0 2px rgba(245, 184, 0, 0.45), 0 0 14px rgba(245, 184, 0, 0.5);
}

.mobile-panel-content input[type="search"]::placeholder {
  color: var(--gold-soft);
  opacity: 0.9;
  font-weight: 600;
}

.mobile-panel-content button[type="submit"] {
  height: 42px;
  padding: 0 16px;
  background: var(--gold);
  color: #000;
  border: 2px solid var(--gold);
  border-left: none;
  border-radius: 0 4px 4px 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* お気に入りパネル */
#mobile-favorites-list {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mobile-favorite-item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-favorite-item img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line-gold);
  transition: transform 0.2s ease;
}

.mobile-favorite-item img:active {
  transform: scale(0.95);
}

.mobile-favorites-empty {
  color: #aaa;
  font-size: 13px;
}

/* 50音パネル */
.mobile-kana-scroll-wrap {
  position: relative;
}

.mobile-kana-scroll-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 56px;
  background: linear-gradient(to right, transparent, var(--overlay-fade));
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 1;
}

.mobile-kana-scroll-arrow {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  background: rgba(245,184,0,0.15);
  border: 1px solid rgba(245,184,0,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5b800;
  font-size: 0.95rem;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 2;
}

.mobile-kana-scroll-wrap.is-end::after,
.mobile-kana-scroll-wrap.is-end .mobile-kana-scroll-arrow {
  opacity: 0;
}

.mobile-kana-list {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mobile-kana-list::-webkit-scrollbar {
  display: none;
}

.mobile-kana-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-card-hi);
  color: var(--text-main);
  border: 1px solid rgba(245,184,0,0.3);
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mobile-kana-list a:hover,
.mobile-kana-list a:active {
  background: rgba(245,184,0,0.15);
  color: #f5b800;
  border-color: #f5b800;
}

