﻿/* ===================================================
   1. メインコンテンツ・検索・フィルター
=================================================== */
.operation-main {
  padding: 30px 20px;
  text-align: center;
}

h1 {
  font-size: 42px;
  color: #0094d8;
  font-weight: bold;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  margin-top: 18px;
  margin-bottom: 22px;
}

.main-title {
  font-size: 48px;
  font-weight: bold;
  color: #5d7ca3;
  border-bottom: 4px solid #46d4ff;
  display: inline-block;
  margin-bottom: 40px;
  padding-bottom: 10px;
}


.card-search-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 28px auto 14px;
  padding: 0 20px;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 170px;
  min-height: 48px;
  padding: 10px 22px;
  border: 2px solid #46d4ff;
  border-radius: 999px;
  background: #fff;
  color: #0094d8;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 174, 255, 0.16);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.filter-toggle:hover {
  transform: translateY(-1px);
  background: #f0fbff;
}

.filter-toggle.is-open {
  background: linear-gradient(135deg, #46d4ff, #0094d8);
  color: #fff;
  border-color: transparent;
}

.filter-toggle-icon {
  width: 26px;
  height: 26px;
  background: url('../img/filter.svg') center / contain no-repeat;
  display: inline-block;
  flex: 0 0 auto;
}

.filter-toggle-arrow {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.filter-toggle.is-open .filter-toggle-arrow {
  transform: rotate(180deg);
}

.card-filter-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease;
}

.card-filter-panel.is-open {
  max-height: 360px;
  opacity: 1;
  transform: translateY(0);
}

.skill-filter-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 auto 25px;
  max-width: 800px;
  padding: 0 20px;
}

.search-container {
  display: flex;
  justify-content: center;
  margin: 0;
  width: min(520px, 100%);
  max-width: 520px;
}

.sort-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: -10px auto 20px;
  gap: 10px;
  font-weight: bold;
  color: #333;
}

#sort-select {
  padding: 8px 15px;
  font-size: 16px;
  border: 2px solid #46d4ff;
  border-radius: 20px;
  outline: none;
  background-color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

#sort-select:focus {
  border-color: #0094d8;
  box-shadow: 0 0 8px rgba(70, 212, 255, 0.4);
}

.skill-btn {
  background-color: #fff;
  color: #333;
  border: 2px solid #46d4ff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.skill-btn:hover {
  background-color: #f0faff;
  border-color: #0094d8;
  transform: translateY(-1px);
}

.skill-btn.active {
  background: linear-gradient(135deg, #46d4ff, #0094d8);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(0, 148, 216, 0.3);
}

/* ===================================================
   4. カード一覧・アニメーション
=================================================== */
.card-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 25px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

.character-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: calc(25% - 25px);
  min-width: 250px;
  text-align: center;
  box-sizing: border-box;
  cursor: pointer;
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0; 
}

.card-image-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  background-color: #f0f0f0;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.character-card:hover .card-image-wrapper img {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.character-card p.list-card-name {
  display: block;
  margin: 12px 0 0 0;
  font-weight: bold;
  font-size: 14px;
  color: #333;
  word-break: break-all;
  transition: color 0.3s ease;
  width: 100%;
}

.character-card:hover p.list-card-name {
  color: #0094d8;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================================
   5. モーダル基本設定
=================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4); 
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 40px 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1600px;
}

.modal-content img {
  width: 90vw;
  height: calc(90vw * 9 / 16);
  max-height: 65vh;
  max-width: calc(65vh * 16 / 9);
  object-fit: cover;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  background-color: transparent;
}

#close-modal {
  background: #fff;
  color: #333;
  border: 2px solid #46d4ff;
  padding: 8px 24px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.3s ease;
}
#close-modal:hover {
  background-color: #0094d8;
  color: #fff;
  border-color: transparent;
}

/* ===================================================
   6. 【修正・確定版】半透明黒ボックス＆スキル4列横並び
=================================================== */

/* すべて（カード名・星・スキル）を囲う半透明黒ボックス */
.skill-wrapper {
  background-color: rgba(255, 255, 255, 0.219); /* 高級感のある75%の黒半透明 */
  padding: 25px 20px;
  border-radius: 20px;
  margin: 25px auto 10px auto;
  width: 95%;
  max-width: 960px; /* 【超重要】4つの日本語スキルが横並びで余裕を持って収まるように拡張 */
  box-sizing: border-box;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ボックス内のカード名 */
.modal-card-name {
  font-size: 22px;
  font-weight: bold;
  margin: 0 0 8px 0 !important;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* ボックス内のレアリティ（星） */
#modal-rarity {
  margin: 0 0 15px 0 !important;
  font-size: 22px;
  line-height: 1;
}

/* スキル詳細のタイトル見出し */
.skill-title {
  margin: 15px 0 15px 0;
  font-size: 15px;
  font-weight: bold;
  color: #46d4ff; 
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 15px;
  letter-spacing: 1px;
}

/* スキル横並びコンテナ */
.skill-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: nowrap; /* 【超重要】PC画面で絶対に折り返さないように固定 */
  width: 100%;
}

/* 個別のスキルカード（白背景ボックス） */
.skill-card {
  background: #eef7f9;
  border-radius: 12px;
  padding: 12px 10px;
  flex: 1;
  width: 25%; /* 4等分に均等配置 */
  min-width: 0; /* 折り返しを防止するための記述 */
  color: #333333;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 0 6px rgba(70, 212, 255, 0.1);
  box-sizing: border-box;
}

/* 各スキルのテーマカラーを「strong」に適用 */
.skill-card strong {
  margin-bottom: 8px;
  display: block;
  font-size: 11px; /* 【重要】日本語の〇〇スキルが1行にスッキリ収まるフォントサイズ */
  font-weight: bold;
  width: 100%;
  padding-bottom: 4px;
  text-align: center;
  white-space: nowrap; /* 文字の途中での意図しない改行を防ぐ */
}

/* リーダースキル（L）はピンク */
.leader-card strong {
  color: #ff5a79;
  border-bottom: 2px solid rgb(0, 171, 238);
}

/* スペシャル（SP）はゴールド */
.special-card strong {
  background: linear-gradient(to right, #ff3def, #2f00ff);
  -webkit-background-clip: text; /* これの下に波線が出ていたら… */
  background-clip: text;         /* 【これ】をすぐ下に追加してあげる */
  -webkit-text-fill-color: transparent;
  border-bottom: 2px solid rgb(0, 171, 238);
}

.active-card strong {
  color: #0094d8; 
  border-bottom: 2px solid rgb(0, 171, 238);
}

.parameter-card strong {
  color: #0094d8;
  border-bottom: 2px solid rgb(0, 171, 238);
}

.passive-card strong {
  color: #c99026;
  border-bottom: 2px solid rgb(0, 171, 238);
}

/* スキルカード内の効果テキスト */
.skill-card p {
  margin: 0;
  font-size: 12px; 
  line-height: 1.4;
  color: #444444;
  text-align: left; 
  width: 100%;
  word-break: break-all;
}

/* ===================================================
   7. レア度ごとの星の色（エフェクト）
=================================================== */
.star-group.rarity-6 { color: #ffffff; text-shadow: 0 0 10px rgb(19, 55, 255); }
.star-group.rarity-5 { color: #74faff; text-shadow: 0 0 10px rgb(103, 255, 255); }
.star-group.rarity-4 { color: #74faff; text-shadow: 0 0 10px rgb(103, 255, 255); }
.star-group.rarity-3 { color: #ffc219; }
.star-group.rarity-2 { color: #ffc219; }
.star-group.rarity-1 { color: #ffc219; }

/* ===================================================
   8. レスポンシブデザイン (画面幅ごとの調整)
=================================================== */
@media (max-width: 1024px) {
  .character-card { width: calc(33.33% - 25px); }
  .site-title { font-size: 32px; }
}

@media (max-width: 850px) {
  /* タブレット〜スマホ画面ではスキルを縦並びにして見やすくする */
  .skill-container {
    flex-wrap: wrap;
    flex-direction: column;
    gap: 10px;
  }
  .skill-card {
    width: 100%;
    min-width: 100%;
    padding: 12px 15px;
  }
  .skill-card strong {
    font-size: 13px; /* 縦並びの時は見出しを少し大きめに */
  }
  .skill-card p {
    font-size: 12px; 
  }
  .modal-card-name { font-size: 18px; }
  .skill-wrapper { padding: 20px 15px; }
}

@media (max-width: 768px) {
  .character-card { width: calc(50% - 20px); min-width: unset; }
  .character-card:hover .card-image-wrapper img { transform: none; }
  .main-title { font-size: 32px; }
}

@media (max-width: 480px) {
  .card-list { gap: 15px; padding: 10px; }
  .character-card { width: calc(50% - 15px); }
  .character-card p.list-card-name { font-size: 12px; }
  .search-input { font-size: 16px; height: 50px; }
}

.card-info-note {
  max-width: 980px;
  margin: 24px auto 28px;
  padding: 26px 32px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(70, 212, 255, 0.32);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 148, 216, 0.12);
  box-sizing: border-box;
}

.card-info-note p {
  margin: 8px 0;
  color: #333;
  font-weight: bold;
  line-height: 1.7;
}

.card-info-title {
  color: #0094d8;
  font-size: 22px;
}

/* 上部余白調整 */
main.fade-in-up {
  padding-top: 0;
}

main.fade-in-up h1:first-child {
  margin-top: 18px !important;
}
/* カード一覧ページの見出し位置調整 */
h1 {
  text-align: center;
}
/* ユニットページ導線 */
.unit-page-link-wrap {
  display: flex;
  justify-content: center;
  margin: 18px auto 28px;
}

.unit-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 320px;
  max-width: calc(100% - 32px);
  padding: 16px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #46d4ff, #0094d8);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(0, 148, 216, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.unit-page-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 148, 216, 0.3);
  filter: brightness(1.05);
}
.card-search-toolbar .search-container {
  flex: 1 1 520px;
}

.card-search-toolbar .filter-toggle {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .card-search-toolbar {
    flex-direction: column;
  }

  .card-search-toolbar .search-container {
    flex-basis: auto;
  }
}
/* Card search/filter final layout fix */
main .card-search-toolbar {
  display: grid !important;
  grid-template-columns: minmax(320px, 520px) auto !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 14px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 28px auto 16px !important;
  padding: 0 20px !important;
  box-sizing: border-box !important;
}

main .card-search-toolbar .search-container {
  display: flex !important;
  width: 100% !important;
  max-width: 520px !important;
  margin: 0 !important;
}

main .card-search-toolbar #search-input {
  width: 100% !important;
}

main .card-search-toolbar .filter-toggle {
  width: auto !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

main #card-filter-panel {
  width: 100% !important;
  max-width: 900px !important;
  margin: 0 auto !important;
}

@media (max-width: 720px) {
  main .card-search-toolbar {
    grid-template-columns: minmax(0, 520px) !important;
  }

  main .card-search-toolbar .filter-toggle {
    justify-self: center !important;
  }
}
/* End card search/filter final layout fix */

/* Card detail skill panels */
.skill-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-wrap: nowrap;
}

.skill-section {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  background: rgba(238, 247, 249, 0.94);
  box-sizing: border-box;
  color: #333;
  box-shadow: inset 0 0 0 1px rgba(70, 212, 255, 0.22);
}

.skill-section h3 {
  margin: 0 0 12px;
  color: #0094d8;
  font-size: 19px;
  font-weight: bold;
  text-align: left;
}

.connect-skill-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.connect-grid {
  display: grid;
  grid-template-columns: repeat(5, 15px);
  grid-template-rows: repeat(5, 15px);
  gap: 3px;
  padding: 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 1px rgba(0, 148, 216, 0.16);
}

.connect-cell {
  display: block;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: #e6edf1;
  box-shadow: inset 0 0 0 1px rgba(0, 148, 216, 0.1);
}

.connect-cell.is-yellow {
  background: #ffd84d;
  box-shadow: 0 0 8px rgba(255, 216, 77, 0.72);
}

.connect-cell.is-green {
  background: #65ff8a;
  box-shadow: 0 0 8px rgba(101, 255, 138, 0.68);
}

.connect-cell.is-center {
  border-radius: 50%;
}

.connect-skill-text {
  width: 100%;
  min-width: 0;
}

.skill-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}


/* Card detail modal viewport fit */
.modal-overlay.open {
  align-items: flex-start;
}

.modal-content {
  margin: 28px auto;
}

.modal-content > img#modal-image {
  width: min(90vw, 1120px);
  height: auto;
  max-height: 50vh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.18);
}

.skill-wrapper {
  max-width: min(920px, 92vw);
}

.connect-skill-layout {
  grid-template-columns: auto minmax(0, 1fr);
}

.connect-skill-text {
  min-width: 0;
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 78px 12px 24px;
  }

  .modal-content {
    margin: 0 auto;
  }

  .modal-content > img#modal-image {
    width: 100%;
    max-height: 32vh;
  }

  .skill-wrapper {
    width: 100%;
    padding: 16px 12px;
    margin-top: 14px;
  }
}

/* Card detail modal final fit fix */
.modal-overlay {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  align-items: flex-start !important;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 28px 16px 40px !important;
}

.modal-content {
  width: min(100%, 1120px) !important;
  max-width: calc(100vw - 32px) !important;
  margin: 0 auto !important;
  gap: 16px;
  box-sizing: border-box;
}

.modal-content > img#modal-image {
  width: min(100%, 980px) !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 44vh !important;
  max-height: 44dvh !important;
  object-fit: contain !important;
  display: block;
}

.skill-wrapper {
  width: min(100%, 920px) !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  box-sizing: border-box;
}

.skill-container {
  width: 100%;
  box-sizing: border-box;
}

.skill-section {
  overflow: hidden;
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 88px 12px 28px !important;
  }

  .modal-content {
    max-width: calc(100vw - 24px) !important;
    gap: 12px;
  }

  .modal-content > img#modal-image {
    max-height: 26vh !important;
    max-height: 26dvh !important;
  }

  .skill-wrapper {
    padding: 14px 10px !important;
  }

  .connect-skill-layout {
    grid-template-columns: 1fr !important;
    justify-items: center;
    text-align: center;
  }

  .skill-card-grid {
    grid-template-columns: 1fr !important;
  }

  .skill-section h3 {
    text-align: center;
    font-size: 17px;
  }
}


/* Card detail modal side-by-side layout */
.modal-content {
  display: grid !important;
  grid-template-columns: minmax(420px, 1.25fr) minmax(340px, 0.9fr) !important;
  align-items: stretch !important;
  width: min(96vw, 1480px) !important;
  max-width: calc(100vw - 32px) !important;
  max-height: calc(100dvh - 56px) !important;
  gap: 24px !important;
}

.modal-content > img#modal-image {
  width: 100% !important;
  height: auto !important;
  max-height: calc(100dvh - 56px) !important;
  aspect-ratio: 16 / 9;
  object-fit: contain !important;
  align-self: start;
}

.skill-wrapper {
  width: 100% !important;
  max-width: none !important;
  height: calc(100dvh - 56px) !important;
  max-height: calc(100dvh - 56px) !important;
  margin: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
}

.skill-wrapper::-webkit-scrollbar {
  width: 8px;
}

.skill-wrapper::-webkit-scrollbar-thumb {
  background: rgba(0, 148, 216, 0.45);
  border-radius: 999px;
}

.modal-card-name,
#modal-rarity {
  position: sticky;
  top: 0;
  z-index: 1;
}

@media (max-width: 900px) {
  .modal-content {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: calc(100vw - 24px) !important;
    max-height: none !important;
    gap: 12px !important;
  }

  .modal-content > img#modal-image {
    width: 100% !important;
    max-height: 26dvh !important;
  }

  .skill-wrapper {
    height: auto !important;
    max-height: 56dvh !important;
    margin: 0 auto !important;
  }
}

/* Card detail skill cards vertical layout */
.skill-card-grid {
  grid-template-columns: 1fr !important;
}

.skill-card {
  width: 100% !important;
  min-width: 0 !important;
}

/* Card detail skill section lower 2x2 layout */
.skill-wrapper {
  display: flex !important;
  flex-direction: column !important;
}

.skill-wrapper .skill-container {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.card-skill-section {
  margin-top: auto !important;
}

.card-skill-section .skill-card-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

.card-skill-section .skill-card {
  width: 100% !important;
  min-width: 0 !important;
}

@media (max-width: 520px) {
  .card-skill-section .skill-card-grid {
    gap: 10px !important;
  }

  .card-skill-section .skill-card {
    padding: 10px 8px !important;
  }

  .card-skill-section .skill-card strong {
    font-size: 12px !important;
  }

  .card-skill-section .skill-card p {
    font-size: 11px !important;
  }
}

/* Card detail panel matches card image height */
@media (min-width: 901px) {
  .modal-content {
    height: min(72dvh, 720px) !important;
    max-height: calc(100dvh - 56px) !important;
    align-items: stretch !important;
  }

  .modal-content > img#modal-image {
    height: 100% !important;
    max-height: none !important;
    width: 100% !important;
    object-fit: contain !important;
  }

  .skill-wrapper {
    height: 100% !important;
    max-height: none !important;
    align-self: stretch !important;
  }
}

/* Connect board shape: square cells, yellow cells only round */
.connect-cell,
.connect-cell.is-center,
.connect-cell.is-green,
.connect-cell.is-green.is-center {
  border-radius: 3px !important;
}

.connect-cell.is-yellow {
  border-radius: 50% !important;
}

/* Card type badge */
.card-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  padding: 4px 10px;
  border: 2px solid currentColor;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.72);
}
.card-type-badge.type-cute { color: #ff4f78; background: rgba(255, 96, 132, 0.18); }
.card-type-badge.type-pure { color: #25b965; background: rgba(101, 255, 70, 0.18); }
.card-type-badge.type-happy { color: #f4ad13; background: rgba(255, 215, 73, 0.22); }

.card-type-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 5px;
  flex: 0 0 16px;
}

.card-type-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Keep the small SVG icon from inheriting the modal card-image dimensions. */
#modal-rarity .card-type-icon {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.card-type-label {
  white-space: nowrap;
}

/* Performance / technique / sense badge */
.card-type2-badge {
  --type2-color: #ff00bf;
  --type2-bg: rgba(255, 0, 191, 0.1);
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 4px 10px;
  border: 2px solid currentColor;
  border-radius: 999px;
  color: var(--type2-color);
  background: var(--type2-bg);
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  vertical-align: middle;
}

.card-type2-badge.type2-technique {
  --type2-color: #007dff;
  --type2-bg: rgba(0, 125, 255, 0.1);
}

.card-type2-badge.type2-performance {
  --type2-color: #ff00bf;
  --type2-bg: rgba(255, 0, 191, 0.1);
}

.card-type2-badge.type2-sense {
  --type2-color: #ffbf00;
  --type2-bg: rgba(255, 191, 0, 0.14);
}

.card-type2-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 5px;
  flex: 0 0 16px;
}

.card-type2-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Keep the small SVG icon from inheriting the modal card-image dimensions. */
#modal-rarity .card-type2-icon {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.card-type2-label {
  white-space: nowrap;
}

@media (max-width: 520px) {
  .card-type-badge {
    margin-left: 6px;
    padding: 3px 8px;
    font-size: 11px;
  }

  .card-type-icon-wrap {
    width: 14px;
    height: 14px;
    margin-right: 4px;
    flex-basis: 14px;
  }

  .card-type2-badge {
    margin-left: 6px;
    padding: 3px 8px;
    font-size: 11px;
  }

  .card-type2-icon-wrap {
    width: 14px;
    height: 14px;
    margin-right: 4px;
    flex-basis: 14px;
  }
}

/* Card type filter controls */
.card-filter-panel {
  padding: 0 12px;
}
.card-filter-panel.is-open {
  max-height: 520px;
  padding-bottom: 18px;
}
.type-filter-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px auto 18px;
  max-width: 760px;
}
.type-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 116px;
  padding: 8px 16px;
  border: 2px solid #46d4ff;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #008dd2;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 8px 18px rgba(0, 148, 216, 0.12);
  cursor: pointer;
}
.type-filter-btn img {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  object-fit: contain;
}
.type-filter-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #46d4ff, #0094d8);
  border-color: transparent;
}
.type-filter-btn.type-cute.active { background: linear-gradient(135deg, #ff8fac, #ff4f78); }
.type-filter-btn.type-pure.active { background: linear-gradient(135deg, #65ff46, #20b85c); }
.type-filter-btn.type-happy.active { background: linear-gradient(135deg, #ffd95a, #f4ad13); }

.type2-filter-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: -6px auto 18px;
  max-width: 760px;
}

.type2-filter-btn {
  --filter-type2-color: #008dd2;
  --filter-type2-bg: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 140px;
  padding: 8px 16px;
  border: 2px solid var(--filter-type2-color);
  border-radius: 999px;
  background: var(--filter-type2-bg);
  color: var(--filter-type2-color);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 8px 18px rgba(0, 148, 216, 0.12);
  cursor: pointer;
}

.type2-filter-btn.type2-technique { --filter-type2-color: #007dff; --filter-type2-bg: rgba(0, 125, 255, 0.08); }
.type2-filter-btn.type2-performance { --filter-type2-color: #ff00bf; --filter-type2-bg: rgba(255, 0, 191, 0.08); }
.type2-filter-btn.type2-sense { --filter-type2-color: #e5a800; --filter-type2-bg: rgba(255, 191, 0, 0.12); }

.type2-filter-btn img {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  object-fit: contain;
}

.type2-filter-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #46d4ff, #0094d8);
  border-color: transparent;
}

.type2-filter-btn.type2-technique.active { background: linear-gradient(135deg, #54b1ff, #007dff); }
.type2-filter-btn.type2-performance.active { background: linear-gradient(135deg, #ff71dc, #ff00bf); }
.type2-filter-btn.type2-sense.active { background: linear-gradient(135deg, #ffd85f, #e5a800); }
main .sort-container {
  margin: 0 auto 4px !important;
  min-height: 46px;
  overflow: visible;
}
main #sort-select {
  min-width: 230px;
  height: 42px;
  padding: 8px 38px 8px 16px;
  line-height: 1.2;
  box-sizing: border-box;
}
@media (max-width: 520px) {
  .type-filter-container {
    gap: 8px;
    margin-bottom: 14px;
  }
  .type-filter-btn {
    min-width: 0;
    flex: 1 1 44%;
    padding: 8px 10px;
    font-size: 13px;
  }
  .type-filter-btn img {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }
  .type2-filter-container {
    gap: 8px;
    margin: -4px auto 14px;
  }
  .type2-filter-btn {
    min-width: 0;
    flex: 1 1 44%;
    padding: 8px 10px;
    font-size: 13px;
  }
  .type2-filter-btn img {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }
  main .sort-container {
    flex-wrap: wrap;
    gap: 8px;
  }
  main #sort-select {
    width: min(260px, 100%);
    min-width: 0;
  }
}

/* Unified white card detail modal */
.modal-overlay.open {
  padding: 28px 18px !important;
  align-items: center !important;
}

.modal-content {
  background: rgba(255, 255, 255, 0.96) !important;
  border: 2px solid rgba(70, 212, 255, 0.45) !important;
  border-radius: 22px !important;
  box-shadow: 0 22px 56px rgba(0, 38, 61, 0.28) !important;
  padding: 22px !important;
  color: #333 !important;
  overflow: hidden !important;
}

.modal-content > img#modal-image {
  background: #fff !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 24px rgba(0, 80, 120, 0.16) !important;
}

.skill-wrapper {
  background: transparent !important;
  box-shadow: none !important;
  color: #333 !important;
  padding: 4px 4px 4px 0 !important;
  border-radius: 0 !important;
}

.modal-card-name {
  color: #008dd2 !important;
  text-shadow: none !important;
}

#modal-rarity {
  color: #ffbf26 !important;
  text-shadow: none !important;
}

.skill-section {
  background: rgba(239, 251, 255, 0.88) !important;
  border: 1px solid rgba(70, 212, 255, 0.28) !important;
  box-shadow: none !important;
  color: #333 !important;
}

.skill-section h3,
.skill-card strong,
.connect-range-label {
  color: #008dd2 !important;
  text-shadow: none !important;
}

.skill-section p,
.skill-card p,
.connect-skill-text,
.connect-skill-text p {
  color: #333 !important;
  text-shadow: none !important;
}

.card-type-badge {
  background: #fff !important;
}

@media (min-width: 901px) {
  .modal-content {
    grid-template-columns: minmax(460px, 1.18fr) minmax(360px, 0.82fr) !important;
    height: auto !important;
    max-height: calc(100dvh - 56px) !important;
  }

  .modal-content > img#modal-image {
    align-self: center !important;
    max-height: calc(100dvh - 104px) !important;
  }

  .skill-wrapper {
    height: auto !important;
    max-height: calc(100dvh - 104px) !important;
  }
}

@media (max-width: 900px) {
  .modal-overlay.open {
    padding: 84px 12px 20px !important;
    align-items: flex-start !important;
  }

  .modal-content {
    padding: 14px !important;
    border-radius: 18px !important;
  }

  .skill-wrapper {
    padding: 0 !important;
  }
}

.modal-member-name {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.82em;
  color: #4f6f7d;
  font-weight: 800;
}

/* Remove glow from card detail rarity stars and connect board */
#modal-rarity .star-group,
#modal-rarity .star-group[class*="rarity-"] {
  text-shadow: none !important;
  filter: none !important;
}

.connect-grid,
.connect-cell,
.connect-cell.is-yellow,
.connect-cell.is-green,
.connect-cell.is-center {
  box-shadow: none !important;
  filter: none !important;
}

/* Bloom stage selector */
.bloom-stage-selector {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 0 auto 16px;
}

.bloom-stage-button,
.bloom-stage-label {
  min-height: 36px;
  border: 2px solid #36c9f4;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #008fd7;
  font-weight: bold;
  box-shadow: 0 8px 18px rgba(0, 160, 220, 0.12);
}

.bloom-stage-button {
  width: 42px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.bloom-stage-label {
  min-width: 112px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0 18px;
  font-size: 15px;
}

.bloom-stage-button:hover {
  background: #e9f9ff;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .bloom-stage-selector {
    margin-bottom: 12px;
  }

  .bloom-stage-button {
    width: 40px;
    min-height: 34px;
  }

  .bloom-stage-label {
    min-height: 34px;
    min-width: 100px;
    font-size: 14px;
  }
}

/* Keep the card information panel usable inside short mobile viewports. */
@media (max-width: 900px) {
  .modal-overlay.open {
    overflow: hidden !important;
  }

  .modal-card-name,
  #modal-rarity {
    position: static !important;
    top: auto !important;
  }

  .modal-content {
    height: calc(100vh - 104px) !important;
    height: calc(100dvh - 104px) !important;
    max-height: calc(100vh - 104px) !important;
    max-height: calc(100dvh - 104px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .modal-content > img#modal-image {
    flex: 0 0 auto !important;
    max-height: 24vh !important;
    max-height: 24dvh !important;
  }

  .skill-wrapper {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding-right: 4px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }

  /* Let every skill section contribute to the scrollable content height. */
  .skill-wrapper .skill-container {
    display: block !important;
    flex: none !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
  }

  .card-skill-section {
    margin-top: 14px !important;
  }
}

@media (max-width: 480px) {
  .modal-overlay.open {
    padding-right: 8px !important;
    padding-left: 8px !important;
  }

  .modal-content {
    max-width: calc(100vw - 16px) !important;
    padding: 10px !important;
    gap: 8px !important;
  }

  .modal-content > img#modal-image {
    max-height: 21vh !important;
    max-height: 21dvh !important;
  }
}

/* Tablet landscape keeps two columns, but the entire right panel must scroll. */
@media (min-width: 901px) and (max-width: 1366px) {
  .modal-card-name,
  #modal-rarity {
    position: static !important;
    top: auto !important;
  }

  .skill-wrapper {
    min-height: 0 !important;
    height: auto !important;
    max-height: calc(100vh - 104px) !important;
    max-height: calc(100dvh - 104px) !important;
    align-self: start !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }

  .skill-wrapper .skill-container {
    display: block !important;
    flex: none !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
  }

  .card-skill-section {
    margin-top: 14px !important;
  }
}
