body {
  font-family: sans-serif;
  background: #f7f7f7;
  margin: 0;
  padding: 20px;
}

/* スクロールバーのカスタムスタイル（デフォルト・ライトテーマ） */
/* Webkit（Chrome, Safari, Edge） */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4a88a2 0%, #3a7088 100%);
  border-radius: 6px;
  border: 2px solid #f0f0f0;
  transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #5a98b2 0%, #4a8098 100%);
}

::-webkit-scrollbar-corner {
  background: #f0f0f0;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #4a88a2 #f0f0f0;
}

/* 詳細画面表示時の背景スクロール防止 */
body.modal-open {
  overflow: hidden;
  height: 100vh;
}

h1 {
  text-align: center;
  margin-bottom: 20px;
}

strong {
  color: skyblue;
}

.search-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  padding: 16px 24px;
  position: relative;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  gap: 10px;
  z-index: 1;
}

/* フィルターボタンの位置調整 */
.filter-button-with-info {
  position: relative;
}

.filter-button-with-info.has-info {
  padding-right: 40px !important;
}

.filter-button-with-info .buttonOutlineGradient_item {
  padding-right: 0;
  transition: padding-right 0.2s;
}

.filter-button-with-info.has-info .buttonOutlineGradient_item {
  padding-right: 10px;
}

/* フィルター情報アイコンボタン（インライン） */
.filter-info-btn-inline {
  position: absolute;
  right: 30px;
  top: 2px;
  bottom: 2px;
  margin: auto 0;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 22px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
  z-index: 2;
}

@media (max-width: 900px) {
  .filter-info-btn-inline {
    top: 100px;
    right: 20px;
  }
}


.filter-info-btn-inline svg {
  stroke: currentColor;
  width: 14px;
  height: 14px;
  display: block;
}

.filter-info-btn-inline:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* フィルター情報ミニポップアップ */
.filter-info-popup {
  position: fixed;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 16px;
  min-width: 250px;
  max-width: 350px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.18s ease-out;
  pointer-events: none;
}

.filter-info-popup.visible {
  opacity: 1;
  pointer-events: auto;
}

.filter-info-content h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #555;
  font-weight: 600;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

.filter-info-content #filterInfoList {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
}

.filter-info-item {
  margin-bottom: 10px;
  line-height: 1.5;
}

.filter-info-item:last-child {
  margin-bottom: 0;
}

.filter-info-label {
  font-weight: 600;
  color: #1976d2;
  display: block;
  margin-bottom: 4px;
}

.filter-info-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-info-tag {
  background: #e3f2fd;
  color: #1565c0;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

.attribute-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.attribute-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 50%;
  vertical-align: middle;
}

.filter-info-tag.custom-tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: white;
}

/* フィルタークリアボタン */
.filter-clear-btn {
  width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(238, 90, 111, 0.2);
}

.filter-clear-btn:hover {
  background: linear-gradient(135deg, #ff5252, #e63946);
  box-shadow: 0 4px 8px rgba(238, 90, 111, 0.3);
  transform: translateY(-1px);
}

.filter-clear-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(238, 90, 111, 0.2);
}

.filter-clear-btn svg {
  flex-shrink: 0;
}

.search-input-wrapper {
  position: relative;
  width: 540px;
  margin-bottom: 0;
  display: block;
  vertical-align: top;
}

/* ▼追加: 検索クリアボタン */
.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0; /* ←下げる */
  border-radius: 50%;
  transition: background 0.15s;
}
.search-clear-btn:hover {
  background: #e0f7fa;
}
.search-clear-btn svg {
  pointer-events: none;
  display: block;
}

/* 検索ボックス内の虫メガネアイコン用ボタン */
.search-icon-btn {
  position: absolute;
  right: 38px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0; /* ←下げる */
  border-radius: 50%;
  transition: background 0.15s, right 0.2s ease; /* rightのトランジションを追加 */
}
/* 初期読み込み時のトランジションを無効化 */
.search-icon-btn.no-transition {
  transition: none;
}
/* クリアボタン非表示時は右寄せ */
.search-icon-btn.right-aligned {
  right: 8px;
}
.search-icon-btn:hover {
  background: #e0f7fa;
}
.search-icon-btn svg {
  display: block;
  pointer-events: none;
}

input[type="text"] {
  padding: 12px 18px;
  width: 100%;
  font-size: 17px;
  border: 1.5px solid #00ffa6;
  border-radius: 24px;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
  background: #f9f9f9;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  box-sizing: border-box;
  user-select: none;
}

/* placeholderも選択不可 */
input[type="text"]::placeholder {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  color: #bbb;
  opacity: 1;
}

input[type="text"]:focus {
  border: 1.5px solid #15a1cc;
  background: #fff;
  box-shadow: 0 2px 8px rgba(21,161,204,0.08);
}

/* 検索候補表示時に下部の角丸を切る */
input[type="text"].suggestions-active {
  border-radius: 24px 24px 0 0;
  border-bottom-color: transparent;
}

button {
  padding: 0;
  font-family: inherit;
  appearance: none;
  cursor: pointer;
  background-color: transparent;
  border: none;
}

/* ボタンのスタイル */
.buttonOutlineGradient {
  position: relative;
  display: block;
  width: 100%;
  max-width: 180px;
  height: 48px;
  padding: 2px;
  font-family: sans-serif;
  font-size: 16px;
  text-align: center;
  overflow-wrap: anywhere;
  background: linear-gradient(135deg, #00ffa6, #15a1cc);
  border-radius: 32px; /* (buttonの高さ / 2) の値 */
  min-width: 110px;
  max-width: 160px;
  height: 44px;
  margin-left: 0;
  margin-right: 0;
}

.buttonOutlineGradient::before {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  content: "";
  background: linear-gradient(135deg, #4a50a2, #156acc);
  border-radius: 32px; /* (buttonの高さ / 2) の値 */
  opacity: 0;
  filter: blur(8px);
}

.buttonOutlineGradient_item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #fff;
  background-color: #222;
  border-radius: 32px; /* (buttonの高さ / 2) の値 */
  font-size: 1em;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* ボタン選択不可 */
button,
.buttonOutlineGradient,
.buttonOutlineGradient_item,
.buttonRound {
  user-select: none;
}

@media (any-hover: hover) {
  .buttonOutlineGradient::before {
    transition: opacity 0.2s;
  }

  .buttonOutlineGradient:hover::before {
    opacity: 1;
  }
}

/* ボタンのスタイル */
.buttonRound {
  /* display: flex; */
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100px;
  height: 32px;
  padding: 5px 10px;
  font-family: sans-serif;
  font-size: 16px;
  color: #fff;
  text-align: center;
  overflow-wrap: anywhere;
  background-color: #4a88a2;
  border-radius: 32px; /* (buttonの高さ / 2) の値 */
}

@media (any-hover: hover) {
  .buttonRound {
    transition: background-color 0.2s;
  }

  .buttonRound:hover {
    background-color: #2f5180;
  }
}

.card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  justify-content: center;
  user-select: none;
  z-index: auto;
}

.card {
  width: 200px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  overflow: visible; /* 武器アイコン等の子要素がはみ出し可能 */
  transition: transform 0.2s ease;
  text-align: center;
  cursor: pointer; /* カーソルをポインターに変更 */
  position: relative; /* 下端バー用 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

.card-container.is-loading {
  min-height: 260px;
}

.card-skeleton {
  cursor: default;
  pointer-events: none;
  overflow: hidden;
}

.card-skeleton:hover {
  transform: none;
}

.skeleton-block {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #eef2f7 0%, #f8fafc 50%, #eef2f7 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.card-skeleton .imgframe {
  background: #eef2f7;
}

.card-skeleton-title {
  height: 18px;
  margin: 12px 16px 18px;
  border-radius: 999px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.card:hover {
  transform: scale(1.05);
}

.card .imgframe {
  width: 200px;
  height: 200px;
  /* 画像を固定した幅からはみ出さないようにクリップ */
  overflow: hidden;
  border-radius: 8px 8px 0 0; /* カードの上部の角丸に合わせる */
}

.imgframe img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* カード画像・カード名選択不可 */
.card .imgframe,
.card .imgframe img,
.card h2 {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.card h2 {
  font-size: 18px;
  margin: 10px 0;
  padding: 0 10px;
}

/* カード並び替えモード */
.card.sortable-card {
  cursor: move;
}

.card.sortable-card:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

/* 世界線ごとの下端バー */
.card-world-0::after,
.card-world-1::after,
.card-world-2::after,
.card-world-3::after {
  content: "";
  display: block;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 8px;
  border-radius: 0 0 8px 8px;
}
.card-world-0::after { background: linear-gradient(90deg, #666666, #999999); }
.card-world-1::after { background: linear-gradient(90deg, #00c3ff, #ffff1c); }
.card-world-2::after { background: linear-gradient(90deg, #ff7e5f, #feb47b); }
.card-world-3::after { background: linear-gradient(90deg, #43e97b, #38f9d7); }

/* フィルターポップアップスタイル (変更なし) */
.popup {
  display: none;
  position: fixed;
  z-index: 1020; /* 詳細画面より上に表示されるように大幅に上げる */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  overflow: auto; /* スクロール可能にする */
}

.popup-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* キャラクター詳細表示のスタイルを画面全体表示に修正 */
#detailsPopup {
  display: none;
  position: fixed;
  z-index: 100; /* 武器アイコンやハンバーガーメニューより上に */
  left: 0;
  top: 0;
  width: 100%; /* 画面幅いっぱいに */
  height: 100%; /* 画面高さいっぱいに */
  background-color: #ffffff; /* bodyと同じ背景色にするか、白にする */
  overflow: auto; /* スクロール可能にする */
  padding: 0px; /* 全体のパディングを追加 */
  box-sizing: border-box; /* パディングを幅と高さに含める */
  /* スクロールバー非表示 */
  scrollbar-width: none; /* Firefox */
}
#detailsPopup::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

#detailsPopup .popup-content {
  background-color: #fefefe; /* コンテンツの背景色 */
  margin: 0 auto; /* 中央寄せ */
  height: auto; /* 高さはコンテンツに合わせる */
  min-height: 100vh; /* 最小高さをビューポートの高さに合わせる (パディング考慮) */
  padding: 30px; /* 詳細コンテンツのパディングを増やす */
  box-sizing: border-box;
  /* ポップアップの中央配置に関する指定を削除または変更 */
  top: auto;
  left: auto;
  transform: none; /* 中央配置のtransformを削除 */
  position: relative; /* transformがないのでrelativeでOK */
  box-shadow: none; /* ポップアップの影を削除 */
  border: none; /* ポップアップの枠線を削除 */
  border-radius: 0; /* 角丸を削除 */
}

#comparisonOverlay {
  display: none;
  position: fixed;
  z-index: 101;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: #f7fafc;
  overflow: auto;
  scrollbar-width: none;
}

#comparisonOverlay::-webkit-scrollbar {
  display: none;
}

.comparison-overlay-content {
  position: relative;
  min-height: 100vh;
  max-width: 1540px;
  margin: 0 auto;
  padding: 30px;
  box-sizing: border-box;
}

.comparison-overlay-content > .close {
  position: absolute;
  top: 22px;
  right: 24px;
  float: none;
  z-index: 2;
}

.comparison-overlay-content.is-add-picker-open .comparison-overlay-header,
.comparison-overlay-content.is-add-picker-open .comparison-overlay-body {
  display: none;
}

.comparison-add-picker {
  position: relative;
  display: none;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100vh - 60px);
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.comparison-add-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.comparison-add-picker-header h3 {
  margin: 0;
}

.comparison-add-picker-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.comparison-add-picker-search {
  display: block;
  min-width: 260px;
}

.comparison-add-picker-search input {
  width: 100%;
  user-select: text;
}

.comparison-add-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #475569;
}

.comparison-add-picker-count {
  font-size: 15px;
  color: #0f172a;
}

.comparison-add-picker-helper {
  font-size: 13px;
  color: #64748b;
}

.comparison-add-picker-grid {
  flex: 1;
  align-content: flex-start;
  justify-content: flex-start;
  overflow: auto;
  margin-top: 0;
  padding: 8px 4px 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.72) 0%, rgba(226, 232, 240, 0.46) 100%);
}

.comparison-add-card {
  overflow: hidden;
}

.comparison-add-card .imgframe {
  width: 200px;
  height: 200px;
}

.comparison-add-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0 12px 14px;
}

.comparison-add-card-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.78);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.comparison-add-card.is-disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.comparison-add-card.is-disabled:hover {
  transform: none;
}

.comparison-add-card.is-disabled::before,
.comparison-add-card.is-disabled .edit-checkbox {
  border-color: rgba(148, 163, 184, 0.4);
}

body.comparison-add-picker-open #hamburgerMenu {
  display: none !important;
}

.comparison-overlay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-right: 54px;
}

.comparison-overlay-header h2,
.comparison-list-header h3 {
  margin: 0;
}

.comparison-overlay-note {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
}

.comparison-overlay-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.comparison-zoom-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.comparison-zoom-control span {
  white-space: nowrap;
  font-size: 14px;
  color: #475569;
}

.comparison-zoom-control input[type="range"] {
  width: 140px;
}

.comparison-overlay-body {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.comparison-preview-panel,
.comparison-list-panel {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.comparison-preview-panel {
  order: 2;
  padding: 18px;
}

.comparison-stage-shell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  min-height: 680px;
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.82) 0%, rgba(226, 232, 240, 0.62) 100%);
}

.comparison-stage-ruler {
  position: relative;
  min-height: 640px;
  overflow: hidden;
}

.comparison-stage-ruler-content {
  position: relative;
  min-height: 640px;
  will-change: transform;
}

.comparison-stage-ruler-label {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.comparison-stage-scroll {
  overflow: auto;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 252, 0.88) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.comparison-stage-canvas {
  position: relative;
  min-height: 640px;
}

.comparison-stage-guide {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(100, 116, 139, 0.28);
}

.comparison-stage-guide.is-ground {
  border-top: 2px solid rgba(31, 122, 89, 0.48);
}

.comparison-stage-entry {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: stretch;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  touch-action: none;
}

.comparison-stage-fixed-entry {
  position: absolute;
  pointer-events: none;
  opacity: 0.45;
  z-index: 1;
}

.comparison-stage-fixed-figure {
  width: 100%;
  height: 100%;
}

.comparison-stage-fixed-figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comparison-stage-entry.is-selected {
  cursor: grab;
}

.comparison-stage-entry.is-dragging,
.comparison-stage-entry.is-selected:active {
  cursor: grabbing;
}

.comparison-stage-figure {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  border: 0;
  background: none;
  transition: transform 0.2s ease;
  overflow: visible;
}

.comparison-stage-entry:hover .comparison-stage-figure,
.comparison-stage-entry.is-selected .comparison-stage-figure {
  transform: translateY(-2px);
}

.comparison-stage-figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.comparison-stage-title {
  position: absolute;
  left: 50%;
  bottom: -52px;
  transform: translateX(-50%);
  min-width: 140px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.45;
  pointer-events: none;
}

.comparison-stage-title small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

.comparison-context-menu {
  position: fixed;
  min-width: 180px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  z-index: 9999;
}

.comparison-context-menu-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #1e293b;
  text-align: left;
  padding: 10px 12px;
  font-size: 14px;
}

.comparison-context-menu-item:hover,
.comparison-context-menu-item.is-active {
  background: rgba(226, 232, 240, 0.72);
}

.comparison-context-menu-item:disabled {
  color: #94a3b8;
  background: transparent;
}

.comparison-export-preview {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  z-index: 10000;
}

.comparison-export-preview-dialog {
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.comparison-export-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.comparison-export-preview-header h3 {
  margin: 0;
  color: #1e293b;
}

.comparison-export-preview-close {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 28px;
  line-height: 1;
}

.comparison-export-preview-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: #fff;
}

.comparison-export-preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.comparison-stage-empty,
.comparison-stage-loading,
.comparison-entry-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 20px;
  border-radius: 18px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(148, 163, 184, 0.35);
  text-align: center;
  line-height: 1.8;
}

.comparison-list-panel {
  order: 1;
  padding: 16px;
}

.comparison-list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.comparison-entry-list {
  display: grid;
  gap: 12px;
}

.comparison-entry-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.comparison-entry-card:hover,
.comparison-entry-card.is-selected {
  border-color: rgba(74, 136, 162, 0.56);
  box-shadow: 0 14px 26px rgba(74, 136, 162, 0.12);
  transform: translateY(-1px);
}

.comparison-entry-card.drag-target {
  border-color: rgba(31, 122, 89, 0.65);
}

.comparison-entry-thumb {
  position: relative;
  overflow: hidden;
  height: 84px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.95) 0%, rgba(226, 232, 240, 0.78) 100%);
}

.comparison-entry-thumb img {
  display: block;
  height: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.comparison-entry-main {
  min-width: 0;
}

.comparison-entry-name {
  font-weight: 700;
  color: #1e293b;
  line-height: 1.5;
}

.comparison-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.comparison-entry-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.72);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.comparison-entry-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 88px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.comparison-entry-controls label {
  font-weight: 700;
  color: #475569;
  font-size: 13px;
}

.comparison-entry-controls input[type="range"] {
  width: 100%;
}

.comparison-entry-controls input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.94);
}

.comparison-entry-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comparison-entry-remove,
.comparison-entry-handle {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #475569;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.comparison-entry-handle {
  cursor: grab;
}

.comparison-entry-handle:active {
  cursor: grabbing;
}

.comparison-entry-remove:hover,
.comparison-entry-handle:hover {
  background: rgba(241, 245, 249, 0.98);
}

body.theme-dark #comparisonOverlay {
  background: #0f172a;
}

body.theme-dark .comparison-preview-panel,
body.theme-dark .comparison-list-panel,
body.theme-dark .comparison-stage-scroll,
body.theme-dark .comparison-zoom-control,
body.theme-dark .comparison-stage-title,
body.theme-dark .comparison-entry-card,
body.theme-dark .comparison-stage-empty,
body.theme-dark .comparison-stage-loading,
body.theme-dark .comparison-entry-empty,
body.theme-dark .comparison-entry-controls input[type="number"] {
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.25);
}

body.theme-dark .comparison-stage-shell,
body.theme-dark .comparison-entry-thumb {
  background: rgba(30, 41, 59, 0.78);
}

body.theme-dark .comparison-overlay-note,
body.theme-dark .comparison-stage-ruler-label,
body.theme-dark .comparison-entry-chip,
body.theme-dark .comparison-entry-controls label,
body.theme-dark .comparison-stage-title small {
  color: #94a3b8;
}

body.theme-dark .comparison-stage-title,
body.theme-dark .comparison-entry-name,
body.theme-dark .comparison-overlay-header h2,
body.theme-dark .comparison-list-header h3 {
  color: #f8fafc;
}

body.theme-dark .comparison-add-picker {
  background: rgba(15, 23, 42, 0.94);
  border-color: rgba(148, 163, 184, 0.18);
}

body.theme-dark .comparison-add-picker-count,
body.theme-dark .comparison-add-picker-header h3 {
  color: #f8fafc;
}

body.theme-dark .comparison-add-picker-helper,
body.theme-dark .comparison-add-card-chip {
  color: #cbd5e1;
}

body.theme-dark .comparison-add-card-chip {
  background: rgba(51, 65, 85, 0.82);
}

body.theme-modern #comparisonOverlay {
  background: linear-gradient(180deg, rgba(230, 247, 255, 0.96) 0%, rgba(215, 247, 238, 0.96) 100%);
}

body.theme-aquamarine #comparisonOverlay {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.98) 0%, rgba(207, 250, 254, 0.96) 100%);
}

@media (max-width: 900px) {
  .comparison-overlay-content {
    padding: 20px 16px 24px;
  }

  .comparison-add-picker {
    min-height: auto;
    padding: 18px;
  }

  .comparison-overlay-header {
    flex-direction: column;
    padding-right: 0;
  }

  .comparison-add-picker-header,
  .comparison-add-picker-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .comparison-overlay-actions {
    width: 100%;
    justify-content: space-between;
  }

  .comparison-add-picker-actions {
    justify-content: stretch;
  }

  .comparison-add-picker-search {
    min-width: 0;
  }

  .comparison-overlay-body {
    grid-template-columns: 1fr;
  }

  .comparison-stage-shell {
    grid-template-columns: 54px minmax(0, 1fr);
    min-height: 520px;
    padding: 10px;
  }

  .comparison-entry-card {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .comparison-entry-actions {
    grid-column: 2;
    flex-direction: row;
    justify-content: flex-end;
  }

  .comparison-entry-controls {
    grid-template-columns: auto 1fr 78px;
  }
}


.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: black;
}

.filter-section {
  margin-bottom: 15px;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* PC版でフィルターポップアップを2列表示 */
@media (min-width: 768px) {
  #filterPopup .popup-content {
    max-width: 800px;
    width: 90%;
  }
  
  #filterPopup .filter-sections-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

/* フィルタータブナビゲーション */
.filter-tab-nav {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
  position: relative;
  top: -10px; /* ポップアップの上にはみ出させる */
}

.filter-tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: #f5f5f5;
  border: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  transition: all 0.2s ease;
  margin-right: 2px;
  position: relative;
  z-index: 1;
}

.filter-tab-btn:last-child {
  margin-right: 0;
}

.filter-tab-btn:hover {
  background: #e8f4f8;
  color: #4a88a2;
}

.filter-tab-btn.active {
  background: #fff;
  color: #333;
  border-bottom: 2px solid #4a88a2;
  box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

/* フィルタータブコンテンツ */
.filter-tab-content {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.filter-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* モバイル版でのタブ調整 */
@media (max-width: 767px) {
  .filter-tab-nav {
    top: -5px; /* モバイルでははみ出しを少なく */
  }
  
  .filter-tab-btn {
    font-size: 13px;
    padding: 10px 12px;
  }
  
  /* モバイル版でメインタブとその他タブをフレックスコンテナに(アクティブ時のみ) */
  #filterTabMain.active,
  #filterTabOther.active {
    display: flex !important;
    gap: 0;
    min-height: 300px;
    max-height: 400px;
  }
  
  /* 非アクティブなタブは非表示 */
  #filterTabMain:not(.active),
  #filterTabOther:not(.active) {
    display: none !important;
  }
  
  /* モバイル用縦タブナビゲーション */
  .mobile-category-tabs {
    display: flex;
    flex-direction: column;
    width: 70px;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 2px solid #e0e0e0;
    background: #f9f9f9;
  }
  
  .mobile-cat-tab {
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    text-align: center;
    writing-mode: horizontal-tb;
    transition: all 0.2s ease;
    white-space: nowrap;
  }
  
  .mobile-cat-tab:hover {
    background: #e8f4f8;
    color: #4a88a2;
  }
  
  .mobile-cat-tab.active {
    background: #fff;
    color: #4a88a2;
    border-right: 3px solid #4a88a2;
    font-weight: 600;
  }
  
  /* モバイル用コンテンツエリア */
  .mobile-category-content {
    flex: 1;
    overflow-y: auto;
    padding-left: 12px;
  }
  
  /* デスクトップ専用要素を非表示 */
  .desktop-only {
    display: none;
  }
  
  /* モバイルではカテゴリごとに表示切り替え */
  #filterTabMain .filter-section,
  #filterTabOther .filter-section {
    display: none;
  }
  
  #filterTabMain .filter-section.active,
  #filterTabOther .filter-section.active {
    display: block;
  }
  
  /* モバイル版ではカスタムタグフィルターを自動表示 */
  #filterTabOther .filter-section.active #customTagsFilters {
    display: flex !important;
  }
}

/* PC版では縦タブを非表示 */
@media (min-width: 768px) {
  .mobile-category-tabs {
    display: none;
  }
  
  .mobile-category-content {
    display: block;
  }
  
  .desktop-only {
    display: block;
  }
  
  #filterTabMain .filter-section,
  #filterTabOther .filter-section {
    display: block !important;
  }
  
  /* PC版でもカスタムタグを常時表示 */
  #customTagsFilters {
    display: flex;
  }
}

/* カスタムタグフィルターコンテナ */
#customTagsFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-option {
  background: #e0e0e0;
  padding: 5px 10px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-option.selected {
  background: #4CAF50;
  color: white;
}

/* キャラクター詳細のスタイル */
#characterDetails {
  text-align: left;
  line-height: 1.6;
  margin-bottom: 20px; /* 関連キャラとの区切り */
}

#characterDetails h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 2em; /* タイトルを大きく */
}

#characterDetails p {
  margin: 10px 0; /* 行間を広げる */
  font-size: 1.1em; /* フォントサイズを少し大きく */
}

/* キャラクター詳細内の画像スタイル */
.detail-image {
  max-width: 90%; /* 画像の最大幅 */
  max-height: 90%; /* 画像の高さを固定し、object-fitが機能するようにする */
  display: block; /* 中央寄せのためにブロック要素にする */
  margin: 0 auto 20px auto; /* 上下にマージン、左右中央寄せ */
  user-select: none;
}

.character-detail-content .detail-image {
  margin-bottom: 16px;
}

#relatedCharacters {
  margin-top: 30px; /* 関連キャラセクションの上マージン */
}

#relatedCharacters .card {
  width: 150px; /* 関連キャラカードのサイズを少し小さく */
}

/* フィルター結果が0件の場合のメッセージ */
.no-characters-message {
  text-align: center;
  color: #888; /* グレー色 */
  font-size: 1.2em;
  padding: 50px 0;
  width: 100%;
  box-sizing: border-box;
}

/* サムネイルスタイル追加 */
.thumbnail-list {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.thumbnail-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #ccc;
  box-sizing: border-box;
  cursor: pointer;
  transition: border 0.2s;
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumbnail-circle.selected {
  border: 3px solid #00ffa6;
}
.thumbnail-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* display: block; */
  user-select: none;
}

/* 予測候補リストのスタイル */
.name-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #00ffa6;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  z-index: 1000; /* 武器アイコンやカード要素より確実に前面に表示 */
  width: auto;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  /* 検索ボックスの下に重ならず表示されるように */
  /* pointer-events: auto; */
}
@media (max-width: 900px) {
  .name-suggestions {
    width: 100%;
    left: 0;
    top: 44px;
  }
}
.name-suggestions .suggestion-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 1em;
  color: #222;
}
.name-suggestions .suggestion-item:hover,
.name-suggestions .suggestion-item.active {
  background: #e0f7fa;
  color: #00796b;
}

/* レスポンシブ対応 */
@media (max-width: 900px) {
  .search-container {
    flex-direction: column;
    gap: 12px;
    padding: 14px 10px;
    max-width: 98vw;
  }
  .search-input-wrapper {
    width: 100%;
  }
  input[type="text"] {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }
  .buttonOutlineGradient, .buttonRound {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  body {
    padding: 6px;
  }
  h1 {
    font-size: 1.3em;
    margin-bottom: 12px;
  }
  .search-container {
    padding: 10px 2vw;
    border-radius: 18px;
    gap: 8px;
  }
  input[type="text"] {
    padding: 10px 10px;
    font-size: 15px;
  }
  .card-container {
    gap: 8px;
    margin-top: 10px;
  }
  .card {
    width: 120px;
  }
  .card .imgframe {
    width: 120px;
    height: 120px;
  }
  .card h2 {
    font-size: 14px;
    margin: 6px 0;
    padding: 0 4px;
  }
  #detailsPopup .popup-content {
    width: auto;
    max-width: 99vw;
    padding: 10px;
    min-height: unset;
  }
  .character-detail-content .detail-image {
    width: 100%;
    height: 100%;
  }
  #characterDetails h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
  }
  #characterDetails p {
    font-size: 1em;
    margin: 6px 0;
  }
  #relatedCharacters .card {
    width: 120px;
  }
  /* .relationCharacters .card-container .card {
    width: 120px;
  } */
  .filter-section h4 {
    font-size: 1em;
  }
  .popup-content {
    width: auto;
    max-width: 99vw;
    padding: 10px;
  }
  .no-characters-message {
    font-size: 1em;
    padding: 20px 0;
  }
}

/* SVGコピーアイコン用ボタンスタイル */
.buttonCopyIcon {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.buttonCopyIcon:hover {
  background: #e0f7fa;
}
.buttonCopyIcon svg {
  display: block;
  width: 26px;
  height: 26px;
}

/* お気に入りボタンがfavoritedクラスを持つ場合の追加スタイル */
.buttonCopyIcon.favorited:hover {
  background: rgba(255, 107, 0, 0.1);
}

/* 右端の閉じるボタン */
.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 32px;
  font-weight: bold;
  color: #4a88a2;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 10;
  line-height: 1;
}

.close:hover {
  background: rgba(74, 136, 162, 0.1);
  color: #2a5f78;
  transform: scale(1.1);
}

/* ミニポップアップ */
.mini-popup {
  position: absolute;
  min-width: 160px;
  max-width: 240px;
  background: #fff;
  color: #222;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  border: 1.5px solid #00ffa6;
  padding: 14px 18px 12px 18px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(.4,0,.2,1);
  font-size: 1.08em;
  left: 100%;
  top: 0;
  margin-left: 18px;
  margin-top: 0;
  box-sizing: border-box;
  white-space: pre-line;
}
.mini-popup.visible {
  opacity: 1;
  pointer-events: auto;
}
@media (max-width: 900px) {
  .mini-popup {
    left: 0;
    top: 100%;
    margin-left: 0;
    margin-top: 10px;
  }
}

/* 画像の右クリック・長押し禁止 */
img, .imgframe img, .detail-image, .thumbnail-circle img {
  -webkit-user-drag: none;
  pointer-events: none;
  /* 既存のuser-select: none;があればそのまま */
}

/* ▼ハンバーガーメニュー */
.hamburger-menu {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 10; /* 武器アイコンより上に表示 */
  display: block;
}
.hamburger-btn {
  width: 38px;
  height: 38px;
  background: #fff;
  border: 1.5px solid #00ffa6;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 0;
  margin: 0;
  transition: background 0.18s;
}
.hamburger-btn:hover {
  background: #e0f7fa;
}
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 3px;
  background: #4a88a2;
  margin: 2.5px 0;
  border-radius: 2px;
  transition: all 0.2s;
}
/* ハンバーガーメニュー用オーバーレイ */
.hamburger-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 14; /* ドロワーの下 */
  opacity: 0;
  transition: opacity 0.28s cubic-bezier(.4,0,.2,1);
}
.hamburger-overlay.open {
  display: block;
  opacity: 1;
}

.hamburger-drawer {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: #fff;
  border-radius: 0 16px 16px 0;
  box-shadow: 2px 0 16px rgba(0,0,0,0.13);
  padding: 32px 18px 18px 18px;
  z-index: 15; /* ハンバーガーメニューより更に上 */
  transform: translateX(-110%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  /* スクロール対応 */
  overflow-y: auto;
  /* タッチスクロール制御を追加 */
  touch-action: pan-y; /* 縦方向のスクロールのみ許可 */
  overscroll-behavior: contain; /* オーバースクロール時の背景スクロールを防ぐ */
}
.hamburger-drawer.open {
  transform: translateX(0);
}
.hamburger-drawer:not(.open) {
  pointer-events: none;
}

/* ハンバーガーメニュー開時の背景スクロール防止 */
body.hamburger-open {
  overflow: hidden;
  touch-action: none; /* タッチスクロールを完全に無効化 */
}
.hamburger-lang-btn {
  width: 100%;
  padding: 10px 0;
  background: linear-gradient(135deg, #00ffa6, #15a1cc);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
  font-weight: 500;
  transition: background 0.18s;
}
.hamburger-lang-btn:hover {
  background: linear-gradient(135deg, #4a50a2, #156acc);
}

/* もっと表示ボタン */
.load-more-btn {
  padding: 12px 40px;
  font-size: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  font-weight: 600;
}

.load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.load-more-btn:active {
  transform: translateY(0);
}

/* 閲覧履歴コンテンツ */
.history-content {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  margin-bottom: 8px;
  max-height: 300px;
  overflow-y: auto;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.history-content.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  opacity: 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  color: #666;
  font-size: 13px;
}

.history-item {
  background: white;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInHistory 0.3s ease-out;
  transform-origin: top;
}

@keyframes slideInHistory {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.history-item:hover {
  background: #e3f2fd;
  transform: translateX(4px);
}

.history-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-clear-btn {
  width: 100%;
  padding: 6px;
  background: #ff6b6b;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}

.history-clear-btn:hover {
  background: #ff5252;
}

.update-history-content {
  max-width: 720px;
}

.update-history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.update-history-item {
  padding: 16px 18px;
  border-radius: 12px;
  background: #f7fbff;
  border: 1px solid #d7ebf8;
  box-shadow: 0 8px 20px rgba(21, 106, 204, 0.08);
}

.update-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.update-history-version {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #00ffa6, #15a1cc);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.update-history-date {
  font-size: 12px;
  color: #6b7b8f;
}

.update-history-title {
  margin: 0 0 8px;
  color: #19324d;
  font-size: 18px;
}

.update-history-description {
  margin: 0;
  color: #44566c;
  line-height: 1.7;
  white-space: pre-line;
}

.update-history-empty {
  margin: 0;
  padding: 20px;
  text-align: center;
  color: #7c8a99;
}

/* カードサイズ調整 */
body.card-size-small .card {
  width: 120px;
}
body.card-size-small .card .imgframe {
  width: 120px;
  height: 120px;
}
body.card-size-small .card h2 {
  font-size: 14px;
  margin: 6px 0;
  padding: 0 4px;
}

body.card-size-small .card-skeleton-title {
  height: 14px;
  margin: 8px 10px 12px;
}

/* モバイル版ではカードサイズ調整ボタンを非表示 */
@media (max-width: 900px) {
  #cardSizeToggleBtn {
    display: none;
  }
}

/* キャラ詳細表示時はハンバーガーメニュー非表示 */
#detailsPopup[style*="block"] ~ .hamburger-menu,
#detailsPopup[style*="block"] + .hamburger-menu {
  display: none !important;
}

/* ハンバーガーメニュー内閉じるボタンスタイル */
.hamburger-close-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  right: auto;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 16; /* ドロワーより上 */
  border-radius: 50%;
  transition: background 0.15s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hamburger-close-btn:hover {
  background: #e0f7fa;
}
.hamburger-close-btn svg {
  display: block;
  pointer-events: none;
}

/* ▼紺色基調のダークテーマ */
body.theme-dark {
  background: #14213d;
  color: #e9eaf6;
}

/* ダークテーマのスクロールバースタイル */
body.theme-dark ::-webkit-scrollbar-track {
  background: #1a2540;
}

body.theme-dark ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3a86ff 0%, #2a76ef 100%);
  border: 2px solid #1a2540;
}

body.theme-dark ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4a96ff 0%, #3a86ff 100%);
}

body.theme-dark ::-webkit-scrollbar-corner {
  background: #1a2540;
}

body.theme-dark * {
  scrollbar-color: #3a86ff #1a2540;
}

body.theme-dark h1,
body.theme-dark #characterDetails h2 {
  color: #e9eaf6;
}
body.theme-dark .search-container {
  background: #1a2540;
  box-shadow: 0 2px 12px rgba(20,33,61,0.18);
}
body.theme-dark .card {
  background: #1a2540;
  color: #e9eaf6;
  box-shadow: 0 4px 10px rgba(20,33,61,0.18);
}
body.theme-dark .card h2 {
  color: #e9eaf6;
}
body.theme-dark .card-world-0::after { background: linear-gradient(90deg, #4a4a4a, #6a6a6a); }
body.theme-dark .card-world-1::after { background: linear-gradient(90deg, #1e3a5c, #3a86ff); }
body.theme-dark .card-world-2::after { background: linear-gradient(90deg, #2d3142, #ef476f); }
body.theme-dark .card-world-3::after { background: linear-gradient(90deg, #20639b, #00b4d8); }
body.theme-dark .popup-content,
body.theme-dark #detailsPopup .popup-content {
  background: #1a2540;
  color: #e9eaf6;
  border: 1px solid #22305c;
  box-shadow: 0 4px 8px rgba(20,33,61,0.18);
}
body.theme-dark .filter-option {
  background: #22305c;
  color: #e9eaf6;
}
body.theme-dark .filter-option.selected {
  background: #3a86ff;
  color: #fff;
}

/* ダークテーマ用タブスタイル */
body.theme-dark .filter-tab-nav {
  border-bottom: 2px solid #22305c;
}

body.theme-dark .filter-tab-btn {
  background: #1a2540;
  color: #b0c2e0;
}

body.theme-dark .filter-tab-btn:hover {
  background: #22305c;
  color: #3a86ff;
}

body.theme-dark .filter-tab-btn.active {
  background: #2c3e50;
  color: #e9eaf6;
  border-bottom: 2px solid #3a86ff;
}

body.theme-dark .mobile-category-tabs {
  background: #1a2540;
  border-right: 2px solid #3a86ff;
}

body.theme-dark .mobile-cat-tab {
  color: #b0c2e0;
  border-bottom: 1px solid #3a86ff;
}

body.theme-dark .mobile-cat-tab:hover {
  background: #22305c;
  color: #3a86ff;
}

body.theme-dark .mobile-cat-tab.active {
  background: #2c3e50;
  color: #e9eaf6;
  border-right: 3px solid #3a86ff;
}
body.theme-dark .buttonOutlineGradient_item,
body.theme-dark .buttonRound {
  background-color: #22305c;
  color: #fff;
}
body.theme-dark .buttonOutlineGradient {
  background: linear-gradient(135deg, #22305c, #3a86ff);
}
body.theme-dark .buttonOutlineGradient::before {
  background: linear-gradient(135deg, #14213d, #22305c);
}

/* ダークテーマ用閲覧履歴 */
body.theme-dark .history-content {
  background: #1a2540;
}

body.theme-dark .history-list {
  color: #b0c2e0;
}

body.theme-dark .history-item {
  background: #22305c;
  color: #e9eaf6;
}

body.theme-dark .history-item:hover {
  background: #2c3e50;
}

body.theme-dark .history-clear-btn {
  background: #ef476f;
}

body.theme-dark .history-clear-btn:hover {
  background: #d63759;
}

body.theme-dark .update-history-item {
  background: #26303a;
  border-color: #3b4c5c;
  box-shadow: none;
}

body.theme-dark .update-history-title {
  color: #eef6ff;
}

body.theme-dark .update-history-description,
body.theme-dark .update-history-date,
body.theme-dark .update-history-empty {
  color: #b7c6d8;
}
body.theme-dark .buttonOutlineGradient_item {
  color: #fff;
}
body.theme-dark .buttonOutlineGradient:hover::before {
  opacity: 1;
}
body.theme-dark .buttonRound:hover {
  background-color: #14213d;
}
body.theme-dark .search-clear-btn:hover,
body.theme-dark .buttonCopyIcon:hover,
body.theme-dark .hamburger-close-btn:hover {
  background: #22305c;
}

/* ダークテーマでのお気に入りボタンホバー */
body.theme-dark .buttonCopyIcon.favorited:hover {
  background: rgba(255, 215, 0, 0.2);
}

/* ダークテーマの閉じるボタン */
body.theme-dark .close {
  color: #3a86ff;
}

body.theme-dark .close:hover {
  background: rgba(58, 134, 255, 0.1);
  color: #4a88a2;
}
body.theme-dark .name-suggestions {
  background: #1a2540;
  color: #e9eaf6;
  border: 1px solid #3a86ff;
}
body.theme-dark .name-suggestions .suggestion-item {
  color: #e9eaf6;
}
body.theme-dark .name-suggestions .suggestion-item:hover,
body.theme-dark .name-suggestions .suggestion-item.active {
  background: #22305c;
  color: #3a86ff;
}
body.theme-dark .thumbnail-circle {
  background: #22305c;
  border: 2px solid #3a86ff;
}
body.theme-dark .thumbnail-circle.selected {
  border: 3px solid #fff;
}
body.theme-dark .mini-popup {
  background: #22305c;
  color: #e9eaf6;
  border: 1.5px solid #3a86ff;
}
body.theme-dark .hamburger-drawer {
  background: #1a2540;
  color: #e9eaf6;
  box-shadow: 2px 0 16px rgba(20,33,61,0.18);
}
body.theme-dark .hamburger-lang-btn,
body.theme-dark .hamburger-theme-btn {
  background: linear-gradient(135deg, #22305c, #3a86ff);
  color: #fff;
}
body.theme-dark .hamburger-lang-btn:hover,
body.theme-dark .hamburger-theme-btn:hover {
  background: linear-gradient(135deg, #14213d, #22305c);
}
body.theme-dark .theme-dropdown-menu {
  background: #1a2540;
  border-color: #3a86ff;
  box-shadow: 0 4px 12px rgba(58,134,255,0.3);
}
body.theme-dark .theme-option {
  color: #e9eaf6;
}
body.theme-dark .theme-option:hover {
  background: linear-gradient(135deg, rgba(34,48,92,0.3), rgba(58,134,255,0.3));
}
body.theme-dark .theme-option:active {
  background: linear-gradient(135deg, rgba(34,48,92,0.5), rgba(58,134,255,0.5));
}
body.theme-dark .hamburger-data-btn {
  background: linear-gradient(135deg, #d68910, #ca6f1e);
  color: #fff;
}
body.theme-dark .hamburger-data-btn:hover {
  background: linear-gradient(135deg, #b7790f, #a05b1a);
}
body.theme-dark .hamburger-close-btn {
  background: none;
}
body.theme-dark .hamburger-close-btn:hover {
  background: #22305c;
}
body.theme-dark .no-characters-message {
  color: #bfc8e6;
}
body.theme-dark input[type="text"] {
  background: #22305c;
  color: #e9eaf6;
  border: 1.5px solid #3a86ff;
}
body.theme-dark input[type="text"]:focus {
  border: 1.5px solid #fff;
  background: #1a2540;
}
body.theme-dark input[type="text"]::placeholder {
  color: #bfc8e6;
}
body.theme-dark .filter-section h4 {
  color: #e9eaf6;
}

/* ダークテーマでのハンバーガーメニューボタンテキスト */
body.theme-dark .hamburger-lang-btn {
  color: #e9eaf6;
}

body.theme-dark .hamburger-lang-btn span {
  color: #bfc8e6;
}

/* ▼テーマ切替ドロップダウン */
.theme-dropdown-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

.hamburger-theme-btn {
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, #00ffa6, #156acc);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.18s;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hamburger-theme-btn:hover {
  background: linear-gradient(135deg, #22305c, #3a86ff);
}

.theme-dropdown-menu {
  display: none;
  position: absolute;
  width: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  margin-top: 4px;
  overflow: hidden;
}

.theme-dropdown-menu.show {
  display: block;
}

.theme-option {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  color: #333;
  font-weight: 500;
}

.theme-option:hover {
  background: linear-gradient(135deg, rgba(0,255,166,0.1), rgba(21,106,204,0.1));
}

.theme-option:active {
  background: linear-gradient(135deg, rgba(0,255,166,0.2), rgba(21,106,204,0.2));
}


/* ▼データ管理ボタン */
.hamburger-data-btn {
  width: 100%;
  padding: 10px 0;
  background: linear-gradient(135deg, #ff9500, #e67e22);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
  font-weight: 500;
  transition: background 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.hamburger-data-btn:hover {
  background: linear-gradient(135deg, #d68910, #ca6f1e);
}
.hamburger-data-btn svg {
  width: 16px;
  height: 16px;
}

/* ▼モダン(斜め水色ストライプ)テーマ */
body.theme-modern {
  background: repeating-linear-gradient(
    135deg,
    #e0faff 0px,
    #e0faff 32px,
    #b2eaff 32px,
    #b2eaff 64px
  );
  color: #1a2540;
}

/* モダンテーマのスクロールバースタイル */
body.theme-modern ::-webkit-scrollbar-track {
  background: rgba(178, 234, 255, 0.3);
}

body.theme-modern ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00c3ff 0%, #00a3df 100%);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

body.theme-modern ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #00d3ff 0%, #00b3ef 100%);
}

body.theme-modern ::-webkit-scrollbar-corner {
  background: rgba(178, 234, 255, 0.3);
}

body.theme-modern * {
  scrollbar-color: #00c3ff rgba(178, 234, 255, 0.3);
}

body.theme-modern h1,
body.theme-modern #characterDetails h2 {
  color: #156acc;
}
body.theme-modern .search-container {
  background: rgba(255,255,255,0.92);
  box-shadow: 0 2px 12px rgba(21,106,204,0.10);
}
body.theme-modern .card {
  background: rgba(255,255,255,0.98);
  color: #156acc;
  box-shadow: 0 4px 10px rgba(21,106,204,0.10);
}
body.theme-modern .card h2 {
  color: #156acc;
}
body.theme-modern .card-world-0::after { background: linear-gradient(90deg, #888888, #b0b0b0); }
body.theme-modern .card-world-1::after { background: linear-gradient(90deg, #00c3ff, #b2eaff); }
body.theme-modern .card-world-2::after { background: linear-gradient(90deg, #00ffa6, #b2eaff); }
body.theme-modern .card-world-3::after { background: linear-gradient(90deg, #43e97b, #b2eaff); }
body.theme-modern .popup-content,
body.theme-modern #detailsPopup .popup-content {
  background: rgba(255,255,255,0.98);
  color: #156acc;
  border: 1.5px solid #b2eaff;
  box-shadow: 0 4px 8px rgba(21,106,204,0.10);
}
body.theme-modern .filter-option {
  background: #e0faff;
  color: #156acc;
  border: 1px solid #b2eaff;
}
body.theme-modern .filter-option.selected {
  background: #00c3ff;
  color: #fff;
}

/* モダンテーマ用タブスタイル */
body.theme-modern .filter-tab-nav {
  border-bottom: 2px solid #b2eaff;
}

body.theme-modern .filter-tab-btn {
  background: #e0faff;
  color: #156acc;
  border: 1px solid #b2eaff;
}

body.theme-modern .filter-tab-btn:hover {
  background: #b2eaff;
  color: #0d4b99;
}

body.theme-modern .filter-tab-btn.active {
  background: #00c3ff;
  color: #fff;
  border-bottom: 2px solid #0d4b99;
}

body.theme-modern .mobile-category-tabs {
  background: repeating-linear-gradient(
    90deg,
    #e0faff 0px,
    #e0faff 2px,
    #b2eaff 2px,
    #b2eaff 4px
  );
  border-right: 2px solid #00c3ff;
}

body.theme-modern .mobile-cat-tab {
  color: #156acc;
  border-bottom: 1px solid #00c3ff;
}

body.theme-modern .mobile-cat-tab:hover {
  background: rgba(0, 195, 255, 0.2);
  color: #00c3ff;
}

body.theme-modern .mobile-cat-tab.active {
  background: #ffffff;
  color: #00c3ff;
  border-right: 3px solid #00c3ff;
  font-weight: 600;
}
body.theme-modern .buttonOutlineGradient_item,
body.theme-modern .buttonRound {
  background-color: #b2eaff;
  color: #156acc;
}
body.theme-modern .buttonOutlineGradient {
  background: linear-gradient(135deg, #00c3ff, #b2eaff);
}
body.theme-modern .buttonOutlineGradient::before {
  background: linear-gradient(135deg, #e0faff, #b2eaff);
}
body.theme-modern .buttonOutlineGradient_item {
  color: #156acc;
}
body.theme-modern .buttonOutlineGradient:hover::before {
  opacity: 1;
}
body.theme-modern .buttonRound:hover {
  background-color: #00c3ff;
  color: #fff;
}
body.theme-modern .search-clear-btn:hover,
body.theme-modern .buttonCopyIcon:hover,
body.theme-modern .hamburger-close-btn:hover {
  background: #b2eaff;
}

/* モダンテーマでのお気に入りボタンホバー */
body.theme-modern .buttonCopyIcon.favorited:hover {
  background: rgba(0, 195, 255, 0.2);
}

/* モダンテーマの閉じるボタン */
body.theme-modern .close {
  color: #00ff88;
}

body.theme-modern .close:hover {
  background: rgba(0, 255, 136, 0.1);
  color: #00cc6a;
}
body.theme-modern .name-suggestions {
  background: #e0faff;
  color: #156acc;
  border: 1px solid #00c3ff;
}
body.theme-modern .name-suggestions .suggestion-item {
  color: #156acc;
}
body.theme-modern .name-suggestions .suggestion-item:hover,
body.theme-modern .name-suggestions .suggestion-item.active {
  background: #b2eaff;
  color: #00c3ff;
}
body.theme-modern .thumbnail-circle {
  background: #e0faff;
  border: 2px solid #b2eaff;
}
body.theme-modern .thumbnail-circle.selected {
  border: 3px solid #00c3ff;
}
body.theme-modern .mini-popup {
  background: #e0faff;
  color: #156acc;
  border: 1.5px solid #00c3ff;
}
body.theme-modern .hamburger-drawer {
  background: rgba(255,255,255,0.98);
  color: #156acc;
  box-shadow: 2px 0 16px rgba(21,106,204,0.10);
}
body.theme-modern .hamburger-lang-btn,
body.theme-modern .hamburger-theme-btn {
  background: linear-gradient(135deg, #00c3ff, #b2eaff);
  color: #156acc;
}
body.theme-modern .hamburger-lang-btn:hover,
body.theme-modern .hamburger-theme-btn:hover {
  background: linear-gradient(135deg, #b2eaff, #00c3ff);
  color: #fff;
}
body.theme-modern .theme-dropdown-menu {
  background: #ffffff;
  border-color: #00c3ff;
  box-shadow: 0 4px 12px rgba(0,195,255,0.3);
}
body.theme-modern .theme-option {
  color: #156acc;
}
body.theme-modern .theme-option:hover {
  background: linear-gradient(135deg, rgba(0,195,255,0.1), rgba(178,234,255,0.2));
  color: #00c3ff;
}
body.theme-modern .theme-option:active {
  background: linear-gradient(135deg, rgba(0,195,255,0.2), rgba(178,234,255,0.4));
}
body.theme-modern .hamburger-data-btn {
  background: linear-gradient(135deg, #ff9500, #ffcc80);
  color: #d68910;
}
body.theme-modern .hamburger-data-btn:hover {
  background: linear-gradient(135deg, #ffcc80, #ff9500);
  color: #fff;
}
body.theme-modern .hamburger-close-btn {
  background: none;
}
body.theme-modern .hamburger-close-btn:hover {
  background: #b2eaff;
}

body.theme-modern .update-history-item {
  background: #141c22;
  border-color: #1e8ab3;
  box-shadow: 0 0 18px rgba(0, 255, 136, 0.08);
}

body.theme-modern .update-history-title {
  color: #b7ffe3;
}

body.theme-modern .update-history-description,
body.theme-modern .update-history-date,
body.theme-modern .update-history-empty {
  color: #b3d8e6;
}
body.theme-modern .no-characters-message {
  color: #156acc;
}
body.theme-modern input[type="text"] {
  background: #e0faff;
  color: #156acc;
  border: 1.5px solid #00c3ff;
}
body.theme-modern input[type="text"]:focus {
  border: 1.5px solid #156acc;
  background: #fff;
}
body.theme-modern input[type="text"]::placeholder {
  color: #7ec9e6;
}
body.theme-modern .filter-section h4 {
  color: #156acc;
}

/* モダンテーマでのハンバーガーメニューボタンテキスト */
body.theme-modern .hamburger-lang-btn {
  color: #156acc;
}

body.theme-modern .hamburger-lang-btn span {
  color: #7ec9e6;
}

/* キャラ名＋コピーアイコン横並び */
.character-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.character-title-row h2 {
  transition: color 0.3s ease, transform 0.3s ease;
}

.character-title-row h2.weapon-title {
  color: #4a88a2;
  transform: scale(1.05);
}

/* コピー通知ミニポップアップ */
.copy-popup {
  position: fixed;
  left: 50%;
  top: 60px;
  transform: translateX(-50%);
  background: #00ffa6;
  color: #fff;
  padding: 12px 28px;
  border-radius: 18px;
  font-size: 1.08em;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(.4,0,.2,1);
}
.copy-popup.visible {
  opacity: 1;
  pointer-events: auto;
}
body.theme-dark .copy-popup {
  background: #3a86ff;
  color: #fff;
}
body.theme-modern .copy-popup {
  background: #00c3ff;
  color: #fff;
}

/* ===============================================
   お気に入り機能のスタイル
   =============================================== */

/* カード上のお気に入りボタン */
.favorite-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4; /* カード内の要素として適切なレイヤーに配置 */
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0; /* デフォルトは非表示 */
}

/* カードホバー時にお気に入りボタンを表示 */
.card:hover .favorite-btn {
  opacity: 1;
}

.favorite-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.favorite-btn.favorited {
  background: rgba(255, 235, 200, 0.9);
  opacity: 0;
}

.favorite-btn.favorited:hover {
  background: rgba(255, 235, 200, 1);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

/* お気に入りボタンのSVGスタイル */
.favorite-btn svg {
  display: block;
}

/* 武器アイコン */
.weapon-icon {
  position: absolute;
  top: -5px;
  left: -5px;
  background: rgba(74, 136, 162, 0.9);
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.weapon-icon:hover {
  background: rgba(74, 136, 162, 1);
  transform: scale(1.05);
}

.weapon-icon svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* 属性アイコン（カード左下） */
.attribute-card-icon {
  position: absolute;
  top: 160px; /* imgframe(200px) - icon(45px) + 5px overhang = 160px */
  left: -5px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.attribute-card-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  display: block;
}

.attribute-card-icon-multi .attribute-card-icon-img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.55s ease;
}

.attribute-card-icon-multi .attribute-card-icon-img.active {
  opacity: 1;
}

body.card-size-small .attribute-card-icon {
  top: 100px;
  width: 30px;
  height: 30px;
}

body.card-size-small .attribute-card-icon-img {
  width: 30px;
  height: 30px;
}

@media  (max-width: 900px) {
  .attribute-card-icon{
    top: 100px;
    width: 30px;
    height: 30px;
  }

  .attribute-card-icon-img{
    width: 30px;
    height: 30px;
  }
}

/* 武器画像のスタイル */
.weapon-image {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* SVGフォールバックのスタイル */
.weapon-fallback {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* 詳細画面のお気に入りボタン */
.detail-favorite-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.detail-favorite-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.detail-favorite-btn.favorited {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #333;
}

.detail-favorite-btn.favorited:hover {
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* 詳細画面のお気に入りSVGボタン */
.detail-favorite-svg-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-left: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-favorite-svg-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 1);
}

.detail-favorite-svg-btn.favorited {
  background: rgba(255, 235, 200, 0.9);
  border-color: #ff6b00;
}

.detail-favorite-svg-btn.favorited:hover {
  background: rgba(255, 235, 200, 1);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

/* タイトル行のボタン配置 */
.title-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* お気に入りのみ表示ボタンのアクティブ状態 */
.favorite-filter-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.favorite-filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.favorite-filter-btn.active {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #333;
}

/* お気に入り数の強調 */
#favoritesCount {
  font-weight: bold;
  color: #ff6b00;
}

/* ダークテーマでのお気に入りボタン */
body.theme-dark .favorite-btn {
  background: rgba(60, 60, 60, 0.9);
}

body.theme-dark .favorite-btn:hover {
  background: rgba(80, 80, 80, 1);
}

body.theme-dark .favorite-btn.favorited {
  background: rgba(255, 215, 0, 0.2);
}

body.theme-dark .favorite-btn.favorited:hover {
  background: rgba(255, 215, 0, 0.3);
}

/* ダークテーマの武器アイコン */
body.theme-dark .weapon-icon {
  background: rgba(58, 134, 255, 0.9);
}

body.theme-dark .weapon-icon:hover {
  background: rgba(58, 134, 255, 1);
}

body.theme-dark .weapon-icon svg {
  stroke: #ffffff;
}

body.theme-dark .weapon-fallback {
  stroke: #ffffff;
}

/* ダークテーマでのハンバーガーメニュー内SVGアイコン */
body.theme-dark .hamburger-lang-btn svg {
  stroke: #e9eaf6 !important;
}

body.theme-dark .hamburger-lang-btn svg path {
  stroke: #e9eaf6 !important;
  fill: #e9eaf6 !important;
}

body.theme-dark .hamburger-lang-btn svg .st0 {
  fill: #e9eaf6 !important;
}

body.theme-dark .detail-favorite-svg-btn {
  background: rgba(60, 60, 60, 0.9);
  border-color: #555;
}

body.theme-dark .detail-favorite-svg-btn:hover {
  background: rgba(80, 80, 80, 1);
}

body.theme-dark .detail-favorite-svg-btn.favorited {
  background: rgba(255, 215, 0, 0.2);
  border-color: #ffd700;
}

/* モダンテーマでのお気に入りボタン */
body.theme-modern .favorite-btn {
  background: rgba(255, 255, 255, 0.9);
}

body.theme-modern .favorite-btn.favorited {
  background: rgba(0, 195, 255, 0.2);
}

body.theme-modern .favorite-btn.favorited:hover {
  background: rgba(0, 195, 255, 0.3);
}

body.theme-modern .detail-favorite-btn {
  background: linear-gradient(135deg, #00c3ff 0%, #0077ff 100%);
}

body.theme-modern .detail-favorite-btn.favorited {
  background: linear-gradient(135deg, #00ff88 0%, #00c3ff 100%);
  color: #fff;
}

/* モダンテーマの武器アイコン */
body.theme-modern .weapon-icon {
  background: rgba(0, 255, 136, 0.9);
}

body.theme-modern .weapon-icon:hover {
  background: rgba(0, 255, 136, 1);
}

body.theme-modern .weapon-icon svg {
  stroke: #ffffff;
}

body.theme-modern .weapon-fallback {
  stroke: #ffffff;
}

/* モダンテーマでのハンバーガーメニュー内SVGアイコン */
body.theme-modern .hamburger-lang-btn svg {
  stroke: #156acc !important;
}

body.theme-modern .hamburger-lang-btn svg path {
  stroke: #156acc !important;
  fill: #156acc !important;
}

body.theme-modern .hamburger-lang-btn svg .st0 {
  fill: #156acc !important;
}

body.theme-modern .detail-favorite-svg-btn {
  background: rgba(255, 255, 255, 0.9);
  border-color: #00c3ff;
}

body.theme-modern .detail-favorite-svg-btn:hover {
  background: rgba(240, 250, 255, 1);
}

body.theme-modern .detail-favorite-svg-btn.favorited {
  background: rgba(224, 250, 255, 0.9);
  border-color: #00c3ff;
}

/* ===============================================
   Aquamarineテーマ（ホームページスタイル）
   =============================================== */

body.theme-aquamarine {
  background-color: aquamarine;
  color: #000000;
}

/* Aquamarineテーマのスクロールバースタイル */
body.theme-aquamarine ::-webkit-scrollbar-track {
  background: rgba(102, 205, 170, 0.3);
}

body.theme-aquamarine ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #66cdaa 0%, #4eb99a 100%);
  border: 2px solid rgba(102, 205, 170, 0.3);
}

body.theme-aquamarine ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #76ddba 0%, #5ec9aa 100%);
}

body.theme-aquamarine ::-webkit-scrollbar-corner {
  background: rgba(102, 205, 170, 0.3);
}

body.theme-aquamarine * {
  scrollbar-color: #66cdaa rgba(102, 205, 170, 0.3);
}

body.theme-aquamarine h1,
body.theme-aquamarine #characterDetails h2 {
  color: #000000;
}

body.theme-aquamarine .search-container {
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(102, 205, 170, 0.2);
  border: 1px solid #cccccc;
}

body.theme-aquamarine .card {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 0px solid #cccccc;
  border-radius: 12px;
}

body.theme-aquamarine .card h2 {
  color: #000000;
}

body.theme-aquamarine .card-world-0::after { 
  background: linear-gradient(90deg, #777777, #aaaaaa); 
}

body.theme-aquamarine .card-world-1::after { 
  background: linear-gradient(90deg, #66cdaa, #7fd4b8); 
}

body.theme-aquamarine .card-world-2::after { 
  background: linear-gradient(90deg, #45528b, #090780); 
}

body.theme-aquamarine .card-world-3::after { 
  background: linear-gradient(90deg, #6b4693, #760598); 
}

body.theme-aquamarine .popup-content,
body.theme-aquamarine #detailsPopup .popup-content {
  background: #ffffff;
  color: #000000;
  border: 1px solid #cccccc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border-radius: 12px;
}

body.theme-aquamarine .filter-option {
  background: #ffffff;
  color: #000000;
  border: 1px solid #cccccc;
}

body.theme-aquamarine .filter-option.selected {
  background: #66cdaa;
  color: #ffffff;
}

body.theme-aquamarine .filter-tab-nav {
  border-bottom: 2px solid #66cdaa;
}

body.theme-aquamarine .filter-tab-btn {
  background: #ffffff;
  color: #000000;
  border: 1px solid #cccccc;
}

body.theme-aquamarine .filter-tab-btn:hover {
  background: #f0f0f0;
  color: #000000;
}

body.theme-aquamarine .filter-tab-btn.active {
  background: #66cdaa;
  color: #ffffff;
  border-bottom: 2px solid #4eb99a;
}

body.theme-aquamarine .mobile-category-tabs {
  background: #f0f0f0;
  border-right: 2px solid #66cdaa;
}

body.theme-aquamarine .mobile-cat-tab {
  color: #000000;
  border-bottom: 1px solid #cccccc;
}

body.theme-aquamarine .mobile-cat-tab:hover {
  background: rgba(102, 205, 170, 0.1);
  color: #4eb99a;
}

body.theme-aquamarine .mobile-cat-tab.active {
  background: #ffffff;
  color: #4eb99a;
  border-right: 3px solid #66cdaa;
  font-weight: 600;
}

body.theme-aquamarine .buttonOutlineGradient_item,
body.theme-aquamarine .buttonRound {
  background-color: aquamarine;
  color: #000000;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

body.theme-aquamarine .buttonOutlineGradient_item:hover,
body.theme-aquamarine .buttonRound:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

body.theme-aquamarine .buttonOutlineGradient {
  background: aquamarine;
}

body.theme-aquamarine .hamburger-close-btn:hover {
  background: #66cdaa;
  color: #ffffff;
}

body.theme-aquamarine .buttonCopyIcon.favorited:hover {
  background: rgba(102, 205, 170, 0.3);
}

body.theme-aquamarine .close {
  color: #000000;
}

body.theme-aquamarine .close:hover {
  color: #66cdaa;
}

body.theme-aquamarine .name-suggestions {
  background: #ffffff;
  border: 1px solid #66cdaa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.theme-aquamarine .name-suggestions .suggestion-item {
  color: #000000;
}

body.theme-aquamarine .name-suggestions .suggestion-item:hover,
body.theme-aquamarine .name-suggestions .suggestion-item.active {
  background: #e0f7f0;
  color: #4eb99a;
}

body.theme-aquamarine .thumbnail-circle {
  background: #ffffff;
  border: 2px solid #cccccc;
}

body.theme-aquamarine .thumbnail-circle.selected {
  border: 3px solid #66cdaa;
}

body.theme-aquamarine .mini-popup {
  background: #ffffff;
  color: #000000;
  border: 1px solid #66cdaa;
}

body.theme-aquamarine .hamburger-drawer {
  background: #ffffff;
  color: #000000;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.1);
}

body.theme-aquamarine .hamburger-lang-btn,
body.theme-aquamarine .hamburger-theme-btn {
  background: #66cdaa;
  color: #ffffff;
}

body.theme-aquamarine .hamburger-lang-btn:hover,
body.theme-aquamarine .hamburger-theme-btn:hover {
  background: #4eb99a;
  color: #ffffff;
}

/* Aquamarineテーマ用閲覧履歴 */
body.theme-aquamarine .history-content {
  background: #ffffff;
  border: 1px solid #cccccc;
}

body.theme-aquamarine .history-list {
  color: #333333;
}

body.theme-aquamarine .history-item {
  background: #f5f5f5;
  color: #000000;
}

body.theme-aquamarine .history-item:hover {
  background: #e0f7f0;
}

body.theme-aquamarine .history-clear-btn {
  background: #ff6b6b;
}

body.theme-aquamarine .history-clear-btn:hover {
  background: #ff5252;
}

body.theme-aquamarine .update-history-item {
  background: #f2fffd;
  border-color: #97d9d1;
  box-shadow: 0 10px 24px rgba(33, 143, 129, 0.08);
}

body.theme-aquamarine .update-history-title {
  color: #125d57;
}

body.theme-aquamarine .update-history-description,
body.theme-aquamarine .update-history-date,
body.theme-aquamarine .update-history-empty {
  color: #356b66;
}

body.theme-aquamarine .theme-dropdown-menu {
  background: #ffffff;
  border-color: #66cdaa;
  box-shadow: 0 4px 12px rgba(102,205,170,0.3);
}

body.theme-aquamarine .theme-option {
  color: #000000;
}

body.theme-aquamarine .theme-option:hover {
  background: rgba(102,205,170,0.1);
  color: #4eb99a;
}

body.theme-aquamarine .theme-option:active {
  background: rgba(102,205,170,0.2);
}

body.theme-aquamarine .hamburger-data-btn {
  background: #ffa500;
  color: #ffffff;
}

body.theme-aquamarine .hamburger-data-btn:hover {
  background: #ff8c00;
  color: #ffffff;
}

body.theme-aquamarine .hamburger-close-btn {
  background: #f0f0f0;
  color: #000000;
}

body.theme-aquamarine .hamburger-close-btn:hover {
  background: #66cdaa;
  color: #ffffff;
}

body.theme-aquamarine .no-characters-message {
  color: #000000;
}

body.theme-aquamarine input[type="text"] {
  background: #ffffff;
  border: 1px solid #cccccc;
  color: #000000;
}

body.theme-aquamarine input[type="text"]:focus {
  border-color: #66cdaa;
  box-shadow: 0 0 5px rgba(102, 205, 170, 0.3);
}

body.theme-aquamarine input[type="text"]::placeholder {
  color: #999999;
}

body.theme-aquamarine .filter-section h4 {
  color: #000000;
  border-bottom: 2px solid #66cdaa;
}

body.theme-aquamarine .hamburger-lang-btn {
  background: #66cdaa;
  color: #ffffff;
}

body.theme-aquamarine .hamburger-lang-btn span {
  color: #ffffff;
}

body.theme-aquamarine .copy-popup {
  background: #66cdaa;
  color: #ffffff;
}

body.theme-aquamarine .favorite-btn {
  background: rgba(255, 255, 255, 0.9);
}

body.theme-aquamarine .favorite-btn.favorited {
  background: rgba(102, 205, 170, 0.2);
}

body.theme-aquamarine .favorite-btn.favorited:hover {
  background: rgba(102, 205, 170, 0.3);
}

body.theme-aquamarine .detail-favorite-btn {
  background: #66cdaa;
  color: #ffffff;
}

body.theme-aquamarine .detail-favorite-btn.favorited {
  background: #4eb99a;
  color: #ffffff;
}

body.theme-aquamarine .weapon-icon {
  background: rgba(102, 205, 170, 0.9);
}

body.theme-aquamarine .weapon-icon:hover {
  background: rgba(102, 205, 170, 1);
}

body.theme-aquamarine .weapon-icon svg {
  stroke: #ffffff;
}

body.theme-aquamarine .weapon-fallback {
  stroke: #ffffff;
}

body.theme-aquamarine .hamburger-lang-btn svg {
  stroke: #ffffff !important;
}

body.theme-aquamarine .hamburger-lang-btn svg path {
  stroke: #ffffff !important;
  fill: #ffffff !important;
}

body.theme-aquamarine .hamburger-lang-btn svg .st0 {
  fill: #ffffff !important;
}

body.theme-aquamarine .detail-favorite-svg-btn {
  background: rgba(255, 255, 255, 0.9);
  border-color: #66cdaa;
}

body.theme-aquamarine .detail-favorite-svg-btn:hover {
  background: rgba(240, 255, 250, 1);
}

body.theme-aquamarine .detail-favorite-svg-btn.favorited {
  background: rgba(230, 250, 240, 0.9);
  border-color: #66cdaa;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .favorite-btn {
    width: 28px;
    height: 28px;
    top: 6px;
    right: 6px;
  }
  
  .favorite-btn svg {
    width: 16px;
    height: 16px;
  }
  
  .detail-favorite-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .title-buttons {
    gap: 2px;
  }
  
  .buttonCopyIcon {
    width: 32px;
    height: 32px;
  }
  
  .buttonCopyIcon svg {
    width: 22px;
    height: 22px;
  }
}

/* ===============================================
   キーボードショートカット説明
   =============================================== */

.keyboard-shortcuts-info {
  margin-top: 40px;
  text-align: center;
  opacity: 0.7;
}

.keyboard-shortcuts-info summary {
  cursor: pointer;
  font-size: 14px;
  color: #666;
  user-select: none;
}

.keyboard-shortcuts-info summary:hover {
  color: #333;
}

.shortcuts-list {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  font-size: 13px;
  color: #555;
}

.shortcuts-list kbd {
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.shortcuts-detail {
  grid-column: 1 / -1;
  font-weight: bold;
  margin-top: 8px;
  color: #333;
}

/* ダークテーマ対応 */
body.theme-dark .keyboard-shortcuts-info summary {
  color: #bbb;
}

body.theme-dark .keyboard-shortcuts-info summary:hover {
  color: #fff;
}

body.theme-dark .shortcuts-list {
  color: #ccc;
}

body.theme-dark .shortcuts-list kbd {
  background: #444;
  border-color: #666;
  color: #fff;
}

body.theme-dark .shortcuts-detail {
  color: #fff;
}

/* ===============================================
   メモ機能のスタイル
   =============================================== */

/* メモセクション */
.memo-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.character-skills-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.character-skills-section p {
  margin-bottom: 10px;
}

.character-skills-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.character-skill-item {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
}

.character-skill-name {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-color, #333);
}

.character-skill-description {
  color: #000000;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.character-skill-empty {
  color: #999;
  font-style: italic;
}

.memo-section p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* メモ編集ボタン */
.memo-edit-btn {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.memo-edit-btn:hover {
  background: #e0f7fa;
}

.memo-edit-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* メモ表示エリア */
.note-display {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  min-height: 40px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.note-display:empty::before {
  content: "メモがありません";
  color: #999;
  font-style: italic;
}

/* モーダルオーバーレイ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* メモエディターモーダル */
.note-editor-modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px 24px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #f0f0f0;
  color: #666;
}

.modal-body {
  padding: 20px 24px;
  flex: 1;
}

.modal-body textarea {
  width: 100%;
  height: 200px;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.modal-body textarea:focus {
  border-color: #4a88a2;
  box-shadow: 0 0 0 3px rgba(74, 136, 162, 0.1);
}

.modal-body textarea::placeholder {
  color: #999;
}

.modal-footer {
  padding: 16px 24px 20px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid #eee;
}

.btn-save,
.btn-cancel {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save {
  background: #4a88a2;
  color: white;
}

.btn-save:hover {
  background: #3a7088;
  transform: translateY(-1px);
}

.btn-cancel {
  background: #f0f0f0;
  color: #666;
}

.btn-cancel:hover {
  background: #e0e0e0;
  color: #444;
}

/* ダークテーマでのメモ機能 */
body.theme-dark .memo-section {
  border-top-color: #444;
}

body.theme-dark .memo-edit-btn:hover {
  background: #22305c;
}

body.theme-dark .note-display {
  background: #22305c;
  border-color: #444;
  color: #e9eaf6;
}

body.theme-dark .note-editor-modal {
  background: #1a2540;
  color: #e9eaf6;
}

body.theme-dark .modal-header {
  border-bottom-color: #444;
}

body.theme-dark .modal-header h3 {
  color: #e9eaf6;
}

body.theme-dark .modal-close {
  color: #bbb;
}

body.theme-dark .modal-close:hover {
  background: #22305c;
  color: #e9eaf6;
}

body.theme-dark .modal-body textarea {
  background: #22305c;
  border-color: #444;
  color: #e9eaf6;
}

body.theme-dark .modal-body textarea:focus {
  border-color: #3a86ff;
  box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.1);
}

body.theme-dark .modal-body textarea::placeholder {
  color: #bbb;
}

body.theme-dark .modal-footer {
  border-top-color: #444;
}

body.theme-dark .btn-save {
  background: #3a86ff;
}

body.theme-dark .btn-save:hover {
  background: #2970cc;
}

body.theme-dark .btn-cancel {
  background: #22305c;
  color: #e9eaf6;
}

body.theme-dark .btn-cancel:hover {
  background: #14213d;
}

/* モダンテーマでのメモ機能 */
body.theme-modern .memo-section {
  border-top-color: #b2eaff;
}

body.theme-modern .memo-edit-btn:hover {
  background: #b2eaff;
}

body.theme-modern .note-display {
  background: #e0faff;
  border-color: #b2eaff;
  color: #156acc;
}

body.theme-modern .note-editor-modal {
  background: rgba(255, 255, 255, 0.98);
  color: #156acc;
}

body.theme-modern .modal-header {
  border-bottom-color: #b2eaff;
}

body.theme-modern .modal-header h3 {
  color: #156acc;
}

body.theme-modern .modal-body textarea {
  background: #e0faff;
  border-color: #b2eaff;
  color: #156acc;
}

body.theme-modern .modal-body textarea:focus {
  border-color: #00c3ff;
  box-shadow: 0 0 0 3px rgba(0, 195, 255, 0.1);
}

body.theme-modern .modal-footer {
  border-top-color: #b2eaff;
}

body.theme-modern .btn-save {
  background: #00c3ff;
}

body.theme-modern .btn-save:hover {
  background: #0090cc;
}

body.theme-modern .btn-cancel {
  background: #b2eaff;
  color: #156acc;
}

body.theme-modern .btn-cancel:hover {
  background: #90d5ff;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .note-editor-modal {
    width: 95%;
    max-height: 90vh;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .modal-body textarea {
    height: 150px;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .btn-save,
  .btn-cancel {
    width: 100%;
  }
}

/* ===== カスタムタグ機能のスタイル ===== */

/* ハンバーガーメニュー内のSVGアイコン（デフォルトテーマ） */
.hamburger-lang-btn svg {
  stroke: #ffffff !important;
}

.hamburger-lang-btn svg path {
  stroke: #ffffff !important;
  fill: #ffffff !important;
}

.hamburger-lang-btn svg .st0 {
  fill: #ffffff !important;
}

/* ハンバーガーメニュー内のカスタムタグボタン */
.hamburger-tags-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-color, #333);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.hamburger-tags-btn:hover {
  background-color: var(--hover-color, rgba(0, 0, 0, 0.05));
}

/* カスタムタグポップアップ */
#customTagsPopup .popup-content {
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

/* 新規タグ作成ボタン */
.custom-tag-create {
  margin-bottom: 20px;
  text-align: center;
}

.tag-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tag-create-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* タグ作成フォーム */
.tag-create-form {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.tag-input-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tag-input-group input[type="text"] {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.tag-input-group input[type="color"] {
  width: 40px;
  height: 38px;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
}

.tag-save-btn, .tag-cancel-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tag-save-btn {
  background: #28a745;
  color: white;
}

.tag-save-btn:hover {
  background: #218838;
}

.tag-cancel-btn {
  background: #6c757d;
  color: white;
}

.tag-cancel-btn:hover {
  background: #5a6268;
}

/* カスタムタグ一覧 */
.custom-tags-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.custom-tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  transition: box-shadow 0.2s ease;
}

.custom-tag-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tag-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.tag-color-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #ddd;
}

.tag-name {
  font-weight: 500;
  font-size: 14px;
}

.tag-count {
  font-size: 12px;
  color: #666;
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 10px;
}

.tag-actions {
  display: flex;
  gap: 8px;
}

.tag-edit-btn, .tag-delete-btn, .tag-sort-btn {
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s ease;
}

.tag-edit-btn {
  background: #007bff;
  color: white;
}

.tag-edit-btn:hover {
  background: #0056b3;
}

.tag-sort-btn {
  background: #28a745;
  color: white;
  padding: 6px 6px;
}

.tag-sort-btn:hover {
  background: #218838;
}

.tag-sort-btn svg {
  display: block;
}

.tag-delete-btn {
  background: #dc3545;
  color: white;
}

.tag-delete-btn:hover {
  background: #c82333;
}

/* タグ選択ポップアップ */
.tag-selection-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.tag-selection-item,
.tag-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tag-selection-item:hover,
.tag-item:hover {
  background: #f8f9fa;
  border-color: #007bff;
}

.tag-selection-item.selected,
.tag-item.selected {
  background: #e3f2fd;
  border-color: #007bff;
}

/* タグ色表示 */
.tag-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #ddd;
}

.tag-name {
  font-weight: 500;
  color: #333;
}

/* キャラクター詳細でのタグ表示 */
.character-tags {
  margin-top: 15px;
}

.character-tags h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--text-color, #333);
}

.character-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.character-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: white;
  border-radius: 12px;
  font-weight: 500;
}

.character-tag-remove {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.character-tag-remove:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

/* キャラクター詳細のタグ管理ボタン */
.character-tag-manage {
  margin-top: 10px;
}

.add-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 15px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.add-tag-btn:hover {
  background: #0056b3;
}

/* テーマ対応 */
:root[data-theme="dark"] .hamburger-tags-btn {
  color: #e9ecef;
}

:root[data-theme="dark"] .hamburger-tags-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .custom-tag-item {
  background: #2d3748;
  border-color: #4a5568;
}

:root[data-theme="dark"] .tag-selection-item {
  background: #2d3748;
  border-color: #4a5568;
  color: #e9ecef;
}

:root[data-theme="dark"] .tag-selection-item:hover {
  background: #4a5568;
  border-color: #007bff;
}

:root[data-theme="neon"] .hamburger-tags-btn {
  color: #00ff88;
}

:root[data-theme="neon"] .hamburger-tags-btn:hover {
  background-color: rgba(0, 255, 136, 0.1);
}

:root[data-theme="neon"] .custom-tag-item {
  background: #1a1a2e;
  border-color: #00ff88;
}

:root[data-theme="neon"] .tag-selection-item {
  background: #1a1a2e;
  border-color: #00ff88;
  color: #e9ecef;
}

:root[data-theme="neon"] .tag-selection-item:hover {
  background: #16213e;
  border-color: #00ff88;
}

/* Neonテーマ用閲覧履歴 */
:root[data-theme="neon"] .history-content {
  background: #1a1a2e;
  border: 1px solid #00ff88;
}

:root[data-theme="neon"] .history-list {
  color: #b0ffde;
}

:root[data-theme="neon"] .history-item {
  background: #16213e;
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

:root[data-theme="neon"] .history-item:hover {
  background: #0f3460;
  border-color: #00ff88;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

:root[data-theme="neon"] .history-clear-btn {
  background: #ff006e;
  border: 1px solid #ff006e;
}

:root[data-theme="neon"] .history-clear-btn:hover {
  background: #e5005e;
  box-shadow: 0 0 10px rgba(255, 0, 110, 0.5);
}

.filter-option span {
  vertical-align: middle;
}

.tag-container {
  margin: 0;
  padding: 0;
  display: flex; 
  align-items: center; 
  gap: 8px;
}

/* データ管理ポップアップのスタイル */
.data-manager-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 2px solid #ddd;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 10000;
  min-width: 280px;
  max-width: 400px;
}

.data-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.data-manager-title {
  margin: 0;
  color: #333;
  font-size: 1.2em;
}

.data-manager-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.data-manager-close:hover {
  color: #666;
}

.data-manager-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s;
  margin-bottom: 8px;
}

.export-btn {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
}

.export-btn:hover {
  background: linear-gradient(135deg, #0056b3, #004085);
  transform: translateY(-1px);
}

.import-btn {
  background: linear-gradient(135deg, #28a745, #1e7e34);
  color: white;
}

.import-btn:hover {
  background: linear-gradient(135deg, #1e7e34, #155724);
  transform: translateY(-1px);
}

.data-manager-description {
  font-size: 12px;
  color: #666;
  margin: 0;
  text-align: center;
  line-height: 1.4;
}

/* ダークテーマ対応 */
body.theme-dark .data-manager-popup {
  background: #2c3e50;
  border-color: #4a5568;
}

body.theme-dark .data-manager-title {
  color: #e9ecef;
}

body.theme-dark .data-manager-close {
  color: #a0aec0;
}

body.theme-dark .data-manager-close:hover {
  color: #e9ecef;
}

body.theme-dark .data-manager-description {
  color: #a0aec0;
}

/* ネオン/モダンテーマ対応 */
body.theme-modern .data-manager-popup {
  background: #1a1a2e;
  border: 2px solid #00ff88;
  box-shadow: 0 8px 24px rgba(0, 255, 136, 0.3);
}

body.theme-modern .data-manager-title {
  color: #00ff88;
}

body.theme-modern .data-manager-close {
  color: #ff6b9d;
}

body.theme-modern .data-manager-close:hover {
  color: #ff8fb3;
}

body.theme-modern .export-btn {
  background: linear-gradient(135deg, #00ff88, #00cc6a);
  color: #1a1a2e;
}

body.theme-modern .export-btn:hover {
  background: linear-gradient(135deg, #00cc6a, #00a855);
  box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

body.theme-modern .import-btn {
  background: linear-gradient(135deg, #ff6b9d, #ff4757);
  color: #1a1a2e;
}

body.theme-modern .import-btn:hover {
  background: linear-gradient(135deg, #ff4757, #ff3742);
  box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

body.theme-modern .data-manager-description {
  color: #c792ea;
}

/* コンテキストメニューのスタイル */
.context-menu {
  position: fixed; /* 確実にビューポート基準で配置 */
  z-index: 100001; /* 詳細画面(z-index:100)より確実に上に表示 */
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 180px;
  padding: 8px 0;
  font-size: 14px;
  background: white;
  border: 1px solid #ddd;
  backdrop-filter: blur(8px);
  display: none;
  user-select: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.15s ease, transform 0.15s ease;
  /* スクロール時の表示位置固定のための設定 */
  will-change: transform, opacity;
  pointer-events: auto;
}

.context-menu.show {
  opacity: 1;
  transform: scale(1);
}

.context-menu-item {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
  color: #333;
}

.context-menu-item:hover {
  background: #f5f5f5;
  transform: translateX(2px);
}

.context-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.context-menu-separator {
  height: 1px;
  background: #e0e0e0;
  margin: 4px 0;
  opacity: 0.6;
}

/* ダークテーマ */
body.theme-dark .context-menu {
  background: #2a2a2a;
  border: 1px solid #444;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body.theme-dark .context-menu-item {
  color: #e0e0e0;
}

body.theme-dark .context-menu-item:hover {
  background: #404040;
}

body.theme-dark .context-menu-separator {
  background: #555;
}

/* モダンテーマ */
body.theme-modern .context-menu {
  background: rgba(26, 26, 46, 0.95);
  border: 1px solid #00ff88;
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

body.theme-modern .context-menu-item {
  color: #e0e0e0;
}

body.theme-modern .context-menu-item:hover {
  background: rgba(0, 255, 136, 0.1);
  color: #00ff88;
}

/* タブスタイル（武器情報用） */
.character-tabs {
  margin: 20px 0;
  border-bottom: 2px solid #e0e0e0;
}

.tab-nav {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tab-nav-item {
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
}

.tab-nav-item:hover {
  color: #4a88a2;
  background: rgba(74, 136, 162, 0.05);
}

.tab-nav-item.active {
  color: #4a88a2;
  border-bottom-color: #4a88a2;
  background: rgba(74, 136, 162, 0.1);
}

.tab-content {
  display: none;
  padding: 20px 0;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 武器情報スタイル */
.weapon-info {
  background: #f9f9f9;
  border-radius: 12px;
  padding: 20px;
  margin: 15px 0;
  border-left: 4px solid #4a88a2;
}

.weapon-name {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.weapon-link {
  color: #4a88a2;
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
}

.weapon-link:hover {
  color: #2d5a6e;
  text-decoration: underline;
}

.weapon-description {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 15px;
}

.weapon-image {
  max-width: 200px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
  margin: 0 auto;
}

.no-weapon {
  text-align: center;
  color: #888;
  font-style: italic;
  padding: 40px 20px;
}

/* 武器表示時のメイン画像スタイル */
.detail-image.weapon-display-image {
  max-width: 300px;
  max-height: 300px;
  object-fit: contain;
  background: #f9f9f9;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ダークテーマでのタブスタイル */
body.theme-dark .character-tabs {
  border-bottom-color: #444;
}

body.theme-dark .tab-nav-item {
  color: #ccc;
}

body.theme-dark .tab-nav-item:hover {
  color: #81c784;
  background: rgba(129, 199, 132, 0.1);
}

body.theme-dark .tab-nav-item.active {
  color: #81c784;
  border-bottom-color: #81c784;
  background: rgba(129, 199, 132, 0.15);
}

body.theme-dark .weapon-info {
  background: #2a2a2a;
  border-left-color: #81c784;
}

body.theme-dark .weapon-name {
  color: #e0e0e0;
}

body.theme-dark .weapon-link {
  color: #81c784;
}

body.theme-dark .weapon-link:hover {
  color: #a5d6a7;
  text-decoration: underline;
}

body.theme-dark .weapon-description {
  color: #ccc;
}

body.theme-dark .detail-image.weapon-display-image {
  background: #2a2a2a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

body.theme-dark .character-title-row h2.weapon-title {
  color: #81c784;
}

/* モダンテーマでのタブスタイル */
body.theme-modern .character-tabs {
  border-bottom-color: #00ff88;
}

body.theme-modern .tab-nav-item {
  color: #c792ea;
}

body.theme-modern .tab-nav-item:hover {
  color: #00ff88;
  background: rgba(0, 255, 136, 0.1);
}

body.theme-modern .tab-nav-item.active {
  color: #00ff88;
  border-bottom-color: #00ff88;
  background: rgba(0, 255, 136, 0.15);
}

body.theme-modern .weapon-info {
  background: rgba(26, 26, 46, 0.8);
  border-left-color: #00ff88;
}

body.theme-modern .weapon-name {
  color: #00ff88;
}

body.theme-modern .weapon-link {
  color: #00ff88;
}

body.theme-modern .weapon-link:hover {
  color: #33ff99;
  text-decoration: underline;
}

body.theme-modern .weapon-description {
  color: #e0e0e0;
}

body.theme-modern .detail-image.weapon-display-image {
  background: rgba(26, 26, 46, 0.8);
  box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

body.theme-modern .character-title-row h2.weapon-title {
  color: #00ff88;
}

/* PC版専用レイアウト（1024px以上） */
@media (min-width: 1024px) {

  .popup-content[data-v-12839f6c] {
    max-width: 100%;
    width: 100vw;
    max-height: 90vh;
  }

  #detailsPopup {
    max-height: 100vh;
    height: auto;
  }

  [data-v-12831233] {
    display: none;
  }

  #characterDetails h2 {
    font-size: 1em;
  }

  #relatedCharacters>.card {
    width: 150px;
  }

  #relatedCharacters>.card .imgframe {
    width: 150px;
    height: 150px;
  }

  /* 関連キャラクターの画像はモバイル版と同じ設定を使用 */
  #relatedCharacters .card .imgframe img {
    width: var(--imgsize-mobile, 100%);
    height: var(--imgsize-mobile, 100%);
    object-position: var(--image-zoom-position-mobile, center);
  }

  .character-detail-content {
    display: grid;
    grid-template-columns: 500px 1fr;
    grid-template-rows: auto 1fr;
    gap: 20px;
    height: calc(100vh - 70px);
    max-width: 100vw;
    width: 100%;
    margin: 0 auto;
  }

  .detail-left-section {
    grid-column: 1;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    align-self: start;
  }

  .detail-right-top {
    grid-column: 2;
    grid-row: 1;
    min-height: 120px;
  }

  .detail-right-bottom {
    grid-column: 2;
    grid-row: 2;
    overflow-y: auto;
    padding-right: 10px;
    max-height: 100%;
    min-height: 0;
  }

  /* スクロールバーのスタイリング */
  .detail-right-bottom::-webkit-scrollbar {
    width: 8px;
  }

  .detail-right-bottom::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  .detail-right-bottom::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
  }

  .detail-right-bottom::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }

  /* タイトル行をPC版では右上に配置 */
  .character-title-row {
    justify-content: flex-start;
    margin-bottom: 20px;
  }

  /* 画像を左側に固定配置 */
  .detail-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin-bottom: 15px;
  }

  /* サムネイルリストも左側 */
  .thumbnail-list {
    margin-top: 10px;
  }

  /* 関連キャラクターセクション */
  .related-characters-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
  }

  .related-characters-section h3 {
    margin-bottom: 15px;
    color: #333;
  }
  

  .related-characters-section .card-container {
    /* display: flex; */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .related-characters-section .card {
    margin: 0;
  }

  /* PC版では外部の関連キャラクターエリアを非表示 */
  #relatedCharacters:not(.related-characters-section .card-container) {
    display: none;
  }

  /* 関係関連キャラクターはPC版でも表示 */
  #relationCharacters {
    display: block;
  }

  #relationCharacters .card {
    width: 150px;
  }

  #relationCharacters .card .imgframe {
    width: 150px;
    height: 150px;
  }

  /* 関係関連の画像もモバイル版と同じ設定を使用 */
  #relationCharacters .card .imgframe img {
    width: var(--imgsize-mobile, 100%);
    height: var(--imgsize-mobile, 100%);
    object-position: var(--image-zoom-position-mobile, center);
  }




  /* ダークテーマのスクロールバー */
  body.theme-dark .detail-right-bottom::-webkit-scrollbar-track {
    background: #333;
  }

  body.theme-dark .detail-right-bottom::-webkit-scrollbar-thumb {
    background: #666;
  }

  body.theme-dark .detail-right-bottom::-webkit-scrollbar-thumb:hover {
    background: #777;
  }

  body.theme-dark .related-characters-section {
    border-top-color: #444;
  }

  body.theme-dark .related-characters-section h3 {
    color: #e0e0e0;
  }

  /* モダンテーマのスクロールバー */
  body.theme-modern .detail-right-bottom::-webkit-scrollbar-track {
    background: rgba(26, 26, 46, 0.8);
  }

  body.theme-modern .detail-right-bottom::-webkit-scrollbar-thumb {
    background: #00ff88;
  }

  body.theme-modern .detail-right-bottom::-webkit-scrollbar-thumb:hover {
    background: #00cc6a;
  }

  body.theme-modern .related-characters-section {
    border-top-color: #00ff88;
  }

  body.theme-modern .related-characters-section h3 {
    color: #00ff88;
  }
}

@media  (max-width: 900px) {
  /* 武器画像のスタイル */
  .weapon-image {
    width: 22px;
    height: 22px;
  }

  .weapon-icon {
    width: 30px;
    height: 30px;
  }
}

/* モバイル版では従来のレイアウトを維持 */
@media (max-width: 1023px) {

  .character-detail-content {
    display: block;
  }
  
  .detail-left-section,
  .detail-right-top,
  .detail-right-bottom {
    display: block;
    position: static;
    overflow: visible;
    height: auto;
    max-height: none;
  }
}

body.theme-modern .context-menu-separator {
  background: #00ff88;
  opacity: 0.3;
}

/* ===============================================
   編集モードのスタイル
   =============================================== */

/* 編集モードボタン */
.hamburger-edit-btn {
  width: 100%;
  padding: 10px 0;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
  font-weight: 500;
  transition: background 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hamburger-edit-btn:hover {
  background: linear-gradient(135deg, #e55a2b, #e8851a);
}

.hamburger-edit-btn.active {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* 編集ツールバー */
.edit-toolbar {
  background: #fff;
  border: 2px solid #ff6b35;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.15);
  margin: 0 auto 20px auto;
  max-width: 700px;
  padding: 16px 20px;
}

.edit-toolbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.edit-info {
  font-weight: 600;
  color: #ff6b35;
  font-size: 1.1em;
}

.edit-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.edit-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-btn-select {
  background: #3498db;
  color: white;
}

.edit-btn-select:hover {
  background: #2980b9;
  transform: translateY(-1px);
}

.edit-btn-clear {
  background: #95a5a6;
  color: white;
}

.edit-btn-clear:hover {
  background: #7f8c8d;
  transform: translateY(-1px);
}

.edit-btn-tag {
  background: #e74c3c;
  color: white;
}

.edit-btn-tag:hover:not(:disabled) {
  background: #c0392b;
  transform: translateY(-1px);
}

.edit-btn-tag:disabled {
  background: #bdc3c7;
  color: #7f8c8d;
  cursor: not-allowed;
}

/* サブモード切り替えボタン */
.edit-submode-btn {
  padding: 8px 16px;
  border: 2px solid #ddd;
  border-radius: 6px;
  background: white;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-submode-btn:hover {
  background: #f5f5f5;
  border-color: #ff6b35;
}

.edit-submode-btn.active {
  background: #ff6b35;
  color: white;
  border-color: #ff6b35;
}

.edit-submode-btn svg {
  width: 16px;
  height: 16px;
}

/* 並び替えモード用のボタン */
.edit-btn-apply {
  background: #2ecc71;
  color: white;
}

.edit-btn-apply:hover {
  background: #27ae60;
  transform: translateY(-1px);
}

.edit-btn-cancel {
  background: #e74c3c;
  color: white;
}

.edit-btn-cancel:hover {
  background: #c0392b;
  transform: translateY(-1px);
}

/* 編集モード時のカード選択状態 */
.card.edit-mode {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.card.edit-mode::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 3px solid transparent;
  border-radius: 8px;
  transition: border-color 0.2s;
  pointer-events: none;
  z-index: 1;
}

.card.edit-mode:hover::before {
  border-color: #3498db;
}

.card.edit-mode.selected::before {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

/* 編集モード時の選択チェックボックス */
.edit-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3; /* 武器アイコンより下、ハンバーガーメニューより下 */
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #e74c3c;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0;
}

.card.edit-mode .edit-checkbox {
  opacity: 1;
}

.card.edit-mode.selected .edit-checkbox {
  background: #e74c3c;
  border-color: #e74c3c;
}

.edit-checkbox svg {
  width: 14px;
  height: 14px;
  stroke: white;
  opacity: 0;
  transition: opacity 0.2s;
}

.card.edit-mode.selected .edit-checkbox svg {
  opacity: 1;
}

/* 一括タグ編集ポップアップ */
.bulk-tag-section {
  margin: 20px 0;
}

.bulk-tag-section h4 {
  margin-bottom: 12px;
  color: #333;
  font-size: 1.1em;
}

.bulk-tag-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ダークテーマでの編集モード */
body.theme-dark .hamburger-edit-btn {
  background: linear-gradient(135deg, #e67e22, #f39c12);
}

body.theme-dark .hamburger-edit-btn:hover {
  background: linear-gradient(135deg, #d35400, #e67e22);
}

body.theme-dark .hamburger-edit-btn.active {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
}

body.theme-dark .edit-toolbar {
  background: #1a2540;
  border-color: #f39c12;
  box-shadow: 0 4px 16px rgba(243, 156, 18, 0.15);
}

body.theme-dark .edit-info {
  color: #f39c12;
}

body.theme-dark .edit-submode-btn {
  background: #34495e;
  color: #ecf0f1;
  border-color: #546e7a;
}

body.theme-dark .edit-submode-btn:hover {
  background: #3d566e;
  border-color: #f39c12;
}

body.theme-dark .edit-submode-btn.active {
  background: #f39c12;
  color: white;
  border-color: #f39c12;
}

body.theme-dark .bulk-tag-section h4 {
  color: #e9eaf6;
}

/* モダンテーマでの編集モード */
body.theme-modern .hamburger-edit-btn {
  background: linear-gradient(135deg, #ff8a65, #ffab40);
}

body.theme-modern .hamburger-edit-btn:hover {
  background: linear-gradient(135deg, #ff7043, #ff9800);
}

body.theme-modern .hamburger-edit-btn.active {
  background: linear-gradient(135deg, #66bb6a, #81c784);
}

body.theme-modern .edit-toolbar {
  background: rgba(255, 255, 255, 0.98);
  border-color: #ffab40;
  box-shadow: 0 4px 16px rgba(255, 171, 64, 0.15);
}

body.theme-modern .edit-info {
  color: #ff8a65;
}

body.theme-modern .edit-submode-btn {
  background: rgba(255, 138, 101, 0.1);
  color: #ff8a65;
  border-color: #ffab40;
}

body.theme-modern .edit-submode-btn:hover {
  background: rgba(255, 138, 101, 0.2);
  border-color: #ff7043;
}

body.theme-modern .edit-submode-btn.active {
  background: #ff8a65;
  color: white;
  border-color: #ff8a65;
}

body.theme-modern .bulk-tag-section h4 {
  color: #156acc;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .edit-toolbar-content {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .edit-info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .edit-submode-btn {
    flex: 1;
    justify-content: center;
    min-width: 100px;
  }
  
  .edit-actions {
    justify-content: center;
  }
  
  .edit-btn {
    flex: 1;
    justify-content: center;
  }
  
  .bulk-tag-actions {
    flex-direction: column;
  }
  
  .bulk-tag-actions .btn-save,
  .bulk-tag-actions .btn-cancel {
    width: 100%;
  }
}

/* 使い方ガイドポップアップ */
#usageGuidePopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.usage-guide-content {
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 30px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

.usage-guide-content h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  font-size: 1.8em;
}

.usage-section {
  margin-bottom: 25px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid #4a88a2;
}

.usage-section h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #4a88a2;
  font-size: 1.2em;
}

.usage-section ul {
  margin: 0;
  padding-left: 20px;
}

.usage-section li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.usage-section strong {
  color: #333;
  font-weight: 600;
}

.usage-section kbd {
  background-color: #333;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  margin: 0 2px;
}

/* ダークテーマ用 */
body.theme-dark .usage-guide-content h2 {
  color: #e0e0e0;
}

body.theme-dark .usage-section {
  background: #2a2a2a;
  border-left-color: #66a3c7;
}

body.theme-dark .usage-section h3 {
  color: #66a3c7;
}

body.theme-dark .usage-section strong {
  color: #e0e0e0;
}

body.theme-dark .usage-section kbd {
  background-color: #555;
  color: #e0e0e0;
}

/* モダンテーマ用 */
body.theme-modern .usage-guide-content h2 {
  color: #00ff88;
}

body.theme-modern .usage-section {
  background: #1a1a1a;
  border-left-color: #00ff88;
}

body.theme-modern .usage-section h3 {
  color: #00ff88;
}

body.theme-modern .usage-section strong {
  color: #e0e0e0;
}

body.theme-modern .usage-section kbd {
  background-color: #333;
  color: #00ff88;
  border: 1px solid #00ff88;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .usage-guide-content {
    padding: 20px;
    max-height: 85vh;
  }
  
  .usage-guide-content h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
  }
  
  .usage-section {
    padding: 15px;
    margin-bottom: 20px;
  }
  
  .usage-section h3 {
    font-size: 1.1em;
  }
}

/* ===============================================
   一括タグ編集のスタイル
   =============================================== */

/* 一括タグ選択リスト */
.bulk-tag-selection-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  background: #f9f9f9;
}

.bulk-tag-selection-list .tag-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.bulk-tag-selection-list .tag-item:hover {
  background: #e8f4fd;
}

.bulk-tag-selection-list .tag-item.selected {
  background: #e3f2fd;
  border-color: #2196f3;
}

.bulk-tag-selection-list .tag-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 12px;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.bulk-tag-selection-list .tag-name {
  flex: 1;
  font-weight: 500;
}

/* 一括タグ作成セクション */
.bulk-tag-create-section {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px dashed #ccc;
  border-radius: 8px;
  background: #f8f9fa;
}

/* 一括実行ボタン */
.bulk-tag-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.bulk-apply-btn {
  background: #4caf50;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.bulk-apply-btn:hover:not(:disabled) {
  background: #45a049;
  transform: translateY(-1px);
}

.bulk-apply-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.bulk-cancel-btn {
  background: #f0f0f0;
  color: #666;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bulk-cancel-btn:hover {
  background: #e0e0e0;
  color: #444;
}

/* ダークテーマでの一括タグ編集 */
body.theme-dark .bulk-tag-selection-list {
  background: #22305c;
  border-color: #444;
}

body.theme-dark .bulk-tag-selection-list .tag-item:hover {
  background: #2a3f6a;
}

body.theme-dark .bulk-tag-selection-list .tag-item.selected {
  background: #1e3a5c;
  border-color: #3a86ff;
}

body.theme-dark .bulk-tag-create-section {
  background: #1a2540;
  border-color: #444;
}

body.theme-dark .bulk-apply-btn {
  background: #3a86ff;
}

body.theme-dark .bulk-apply-btn:hover:not(:disabled) {
  background: #2970cc;
}

body.theme-dark .bulk-cancel-btn {
  background: #22305c;
  color: #e9eaf6;
}

body.theme-dark .bulk-cancel-btn:hover {
  background: #14213d;
}

/* モダンテーマでの一括タグ編集 */
body.theme-modern .bulk-tag-selection-list {
  background: #e0faff;
  border-color: #b2eaff;
}

body.theme-modern .bulk-tag-selection-list .tag-item:hover {
  background: #b2eaff;
}

body.theme-modern .bulk-tag-selection-list .tag-item.selected {
  background: #90d5ff;
  border-color: #00c3ff;
}

body.theme-modern .bulk-tag-create-section {
  background: rgba(255, 255, 255, 0.8);
  border-color: #b2eaff;
}

body.theme-modern .bulk-apply-btn {
  background: #00c3ff;
}

body.theme-modern .bulk-apply-btn:hover:not(:disabled) {
  background: #0090cc;
}

body.theme-modern .bulk-cancel-btn {
  background: #b2eaff;
  color: #156acc;
}

body.theme-modern .bulk-cancel-btn:hover {
  background: #90d5ff;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .bulk-tag-selection-list {
    max-height: 200px;
    padding: 8px;
  }
  
  .bulk-tag-selection-list .tag-item {
    padding: 8px 10px;
    margin-bottom: 6px;
  }
  
  .bulk-tag-create-section {
    padding: 12px;
  }
  
  .bulk-tag-actions {
    flex-direction: column;
  }
  
  .bulk-apply-btn,
  .bulk-cancel-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ポップアップ z-index 階層設定 */
#tagSelectionPopup {
  z-index: 1030;
}

#customTagsPopup {
  z-index: 1025;
}

#bulkTagEditPopup {
  z-index: 1035;
}

/* カスタムタグ並び替え機能のスタイル */
.custom-tag-item {
  position: relative;
  user-select: none;
  transition: transform 0.15s ease;
  cursor: move;
  transform: translate3d(0, 0, 0); /* GPUアクセラレーション有効化 */
  will-change: transform; /* ブラウザに最適化のヒント */
}

.custom-tag-item[draggable="true"] {
  cursor: grab;
}

.custom-tag-item[draggable="true"]:active {
  cursor: grabbing;
}

.custom-tag-item.dragging {
  transform: scale3d(1.02, 1.02, 1) translate3d(0, 0, 0);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0.9;
  transition: none; /* ドラッグ中はtransitionを無効化 */
}

.custom-tag-item.placeholder {
  opacity: 0.3;
  border: 2px dashed #ccc;
  background: transparent !important;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.1s ease;
  pointer-events: none; /* プレースホルダーはクリック不可 */
}

.drag-handle {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  cursor: grab;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.drag-handle:hover {
  color: #666;
  background: rgba(0, 0, 0, 0.05);
}

.drag-handle:active {
  cursor: grabbing;
}

.custom-tag-item .tag-info {
  margin-left: 32px; /* ドラッグハンドルのスペースを確保 */
}

/* タッチデバイス向けの調整 */
@media (pointer: coarse) {
  .drag-handle {
    padding: 8px;
    left: 4px;
  }
  
  .custom-tag-item .tag-info {
    margin-left: 36px;
  }
  
  .custom-tag-item {
    padding: 12px 8px;
  }
}

/* ドラッグ中のアニメーション */
.custom-tag-item {
  transform-origin: center;
  backface-visibility: hidden; /* パフォーマンス向上 */
}

.custom-tags-list {
  position: relative;
  contain: layout style; /* レイアウト最適化 */
}

.custom-tags-list .custom-tag-item:not(.dragging):not(.placeholder) {
  transition: transform 0.15s ease;
}