*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --brawl-border: rgba(154, 176, 143, 0.25);
  --brawl-surface: #fff;
  --brawl-accent-muted: rgba(154, 176, 143, 0.15);
}

/* ---- ステータス行 ---- */
.brawl-status {
  min-height: 1.2rem;
  margin: 4px 0 12px;
  color: var(--clr-sage);
  font-size: 0.88rem;
  font-family: var(--font-main);
}

/* ---- 認証・管理ツールバー ---- */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(154, 176, 143, 0.12);
  border: 1.5px solid var(--clr-sage);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tag-explanation-box {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(248, 246, 242, 0.95);
  border: 1px solid rgba(106, 86, 74, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.tag-explanation-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  background: var(--clr-brown);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
}

.tag-explanation-text {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--clr-brown);
  line-height: 1.35;
  transition: color 0.15s ease;
}

.tag-explanation-text.highlight {
  color: #c0392b;
  font-weight: 700;
}

/* 選択中タグ表示バナー */
.active-tag-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(106, 86, 74, 0.2);
  border-radius: 8px;
  animation: fadeInDown 0.15s ease;
}

.active-tag-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.active-tag-desc {
  font-size: 0.74rem;
  color: rgba(106, 86, 74, 0.85);
  font-weight: 600;
  line-height: 1.3;
}

.active-tag-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--clr-brown);
  font-family: var(--font-main);
}

.admin-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--clr-brown);
  font-family: var(--font-main);
}

.admin-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--brawl-border);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.admin-user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.admin-btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---- フィルター行（検索バー ＋ タグ絞り込み） ---- */
.brawl-filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.brawl-search-wrap {
  flex: 1;
  min-width: 0;
}

.brawl-search-wrap input {
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  border: 1.5px solid var(--brawl-border);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: var(--font-main);
  background: var(--brawl-surface);
  color: var(--clr-brown);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.brawl-search-wrap input:focus {
  border-color: var(--clr-sage);
  box-shadow: 0 0 0 3px rgba(154, 176, 143, 0.2);
}

.tag-filter-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.sort-select,
.tag-filter-select {
  height: 40px;
  padding: 6px 10px;
  border: 1.5px solid var(--brawl-border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-main);
  background: var(--brawl-surface);
  color: var(--clr-brown);
  outline: none;
  cursor: pointer;
  max-width: 170px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sort-select:focus,
.tag-filter-select:focus {
  border-color: var(--clr-sage);
  box-shadow: 0 0 0 3px rgba(154, 176, 143, 0.2);
}

.tag-filter-toggle-btn {
  height: 40px;
  padding: 6px 12px;
  border: 1.5px solid var(--brawl-border);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-main);
  background: rgba(154, 176, 143, 0.15);
  color: var(--clr-brown);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tag-filter-toggle-btn:hover {
  background: rgba(154, 176, 143, 0.28);
}

.tag-filter-toggle-btn.is-active {
  background: var(--clr-sage);
  color: #fff;
  border-color: var(--clr-sage);
}

.tag-filter-toggle-btn.has-filter {
  border-color: #3c7099;
  color: #2a5f85;
  background: rgba(60, 112, 153, 0.15);
}

.tier-generator-btn {
  height: 40px;
  padding: 6px 14px;
  border: 1.5px solid rgba(194, 114, 23, 0.35);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-main);
  background: rgba(194, 114, 23, 0.12);
  color: #824700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tier-generator-btn:hover {
  background: rgba(194, 114, 23, 0.22);
  border-color: #c27217;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(194, 114, 23, 0.2);
}

.year-generator-btn {
  height: 40px;
  padding: 6px 14px;
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-main);
  background: rgba(59, 130, 246, 0.12);
  color: #1e40af;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.year-generator-btn:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* ---- タグクイックフィルターパネル ---- */
.tag-filter-panel[hidden] {
  display: none !important;
}

.tag-filter-panel {
  background: #ffffff;
  border: 1.5px solid var(--brawl-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(106, 86, 74, 0.08);
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tag-filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(106, 86, 74, 0.15);
}

.tag-filter-panel-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--clr-brown);
  font-family: var(--font-main);
}

.tag-filter-reset-btn {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-main);
  background: rgba(106, 86, 74, 0.08);
  border: 1px solid rgba(106, 86, 74, 0.15);
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--clr-brown);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-filter-reset-btn:hover {
  background: rgba(230, 80, 80, 0.15);
  color: #c0392b;
  border-color: rgba(230, 80, 80, 0.3);
}

.tag-filter-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-filter-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tag-filter-group-label {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-main);
  min-width: 80px;
  flex-shrink: 0;
  color: rgba(106, 86, 74, 0.85);
}

.tag-filter-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.tag-filter-chip {
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-main);
  border-radius: 999px;
  border: 1px solid rgba(106, 86, 74, 0.2);
  background: rgba(255, 255, 255, 0.9);
  color: var(--clr-brown);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-filter-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.tag-filter-chip.is-selected {
  background: #3c7099 !important;
  color: #ffffff !important;
  border-color: #2a5f85 !important;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(60, 112, 153, 0.35);
}

/* 選択中タグバナー */
.active-tag-banner[hidden] {
  display: none !important;
}

.active-tag-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(60, 112, 153, 0.1);
  border: 1px solid rgba(60, 112, 153, 0.25);
  border-radius: 8px;
  padding: 3px 8px;
  margin-bottom: 8px;
}

.active-tag-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2a5f85;
  font-family: var(--font-main);
}

.active-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #2a5f85;
  background: #ffffff;
  padding: 1px 6px 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(60, 112, 153, 0.2);
}

.active-tag-chip button {
  background: none;
  border: none;
  font-size: 0.9rem;
  line-height: 1;
  color: rgba(106, 86, 74, 0.6);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
}

.active-tag-chip button:hover {
  color: #c0392b;
}

/* ---- ビューパネル ---- */
.view-panel {
  min-height: 100px;
}

/* ---- テーブル ---- */
.table-wrap {
  overflow-x: hidden;
  width: 100%;
  touch-action: pan-y;
  /* タッチデバイスでの横方向のスワイプ/スクロールを無効化 */
}

.rating-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: auto;
}

.rating-table td {
  border: 1px solid var(--brawl-border);
  padding: 1px 2px;
  text-align: left;
  vertical-align: middle;
  font-family: var(--font-main);
}

.rating-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.7);
}

.rating-table tbody tr:nth-child(even) {
  background: rgba(154, 176, 143, 0.05);
}

.table-image-wrap {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 65px;
  height: 48px;
  margin: 0;
  padding: 0;
  line-height: 0;
  cursor: pointer;
}

.table-char-name {
  position: absolute;
  bottom: 1px;
  left: 0;
  right: 0;
  padding: 11px 2px 2px;
  pointer-events: none;
  line-height: 1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.46) 0%, rgba(0, 0, 0, 0.08) 64%, transparent 100%);
  font-size: 0.5rem;
  font-weight: 700;
  font-family: var(--font-main);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-char-image {
  width: 65px;
  height: 48px;
  object-fit: cover;
  display: block;
}

.gear-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.table-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.table-gear-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.table-sg-icon {
  width: 54px;
  height: 54px;
  object-fit: contain;
  display: block;
}

.rating-table td.cell-image,
.rating-table th.cell-image {
  padding: 0;
  line-height: 0;
  width: 65px;
  min-width: 65px;
  max-width: 65px;
}

.rating-table td.cell-date,
.rating-table th.cell-date {
  padding: 0 4px;
  width: 82px;
  min-width: 82px;
  max-width: 86px;
  text-align: center;
  white-space: nowrap;
}

.table-date-text {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-main);
  color: rgba(106, 86, 74, 0.85);
  letter-spacing: -0.2px;
}

.rating-table td.cell-strength,
.rating-table th.cell-strength {
  white-space: nowrap;
  padding: 0 4px;
  width: 70px;
  min-width: 70px;
  max-width: 70px;
  text-align: center;
}

.rating-table td.cell-difficulty,
.rating-table th.cell-difficulty {
  padding: 0 4px;
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  text-align: center;
  white-space: nowrap;
}

.rating-table td.cell-icon,
.rating-table th.cell-icon {
  padding: 0 2px;
  line-height: 0;
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  text-align: center;
}

.rating-table td.cell-gears,
.rating-table th.cell-gears {
  padding: 0 4px;
  line-height: 0;
  width: 120px;
  min-width: 120px;
  max-width: 124px;
}

.rating-table th.cell-build {
  text-align: center;
}

.rating-table td.cell-modes,
.rating-table th.cell-modes {
  padding: 4px 10px;
  width: auto;
  min-width: 280px;
}

.rating-table td.cell-draft-steps,
.rating-table th.cell-draft-steps {
  padding: 4px 8px;
  width: auto;
  min-width: 176px;
  text-align: center;
}

.rating-table td.cell-action {
  padding: 2px 6px;
  white-space: nowrap;
}

.rating-table th {
  padding: 5px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--clr-brown);
  background: rgba(154, 176, 143, 0.15);
  border-bottom: 2px solid var(--clr-sage);
  text-align: left;
  white-space: nowrap;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sortable-th:hover {
  background: rgba(154, 176, 143, 0.35);
}

.sortable-th.is-active {
  color: var(--clr-sage);
  font-weight: 800;
}

.sort-indicator {
  font-size: 0.68rem;
  margin-left: 2px;
  opacity: 0.75;
}

/* ---- 強さバー ---- */
.strength-wrap {
  display: inline-flex;
  align-items: center;
}

.strength-meter {
  display: inline-flex;
  gap: 2px;
}

.strength-bar {
  width: 8px;
  height: 9px;
  border-radius: 999px;
  background: rgba(154, 176, 143, 0.3);
}

.strength-bar.is-on {
  background: rgb(154, 176, 143);
}

.strength-wrap.strength-level-4 .strength-bar.is-on {
  background: rgb(240, 180, 60);
}

.strength-wrap.strength-level-5 .strength-bar.is-on {
  background: rgb(230, 80, 80);
}

/* ---- モーダル ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 59, 50, 0.55);
  backdrop-filter: blur(4px);
}

.modal-body {
  position: relative;
  width: min(1080px, 96vw);
  margin: 3vh auto;
  background: var(--clr-cream);
  border-radius: 24px;
  padding: 20px 26px;
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(106, 86, 74, 0.2);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.2rem;
  z-index: 2;
  background: rgba(106, 86, 74, 0.15);
  color: var(--clr-brown);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: rgba(106, 86, 74, 0.25);
  transform: scale(1.05);
}

/* 詳細モーダル ワイドグリッドレイアウト (PC: 2カラム - 左上:Hero, 右上:Draft, 左下:Build/Modes, 右下:Tags) */
.modal-detail-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  grid-template-areas:
    "hero  draft"
    "build tags";
  column-gap: 24px;
  row-gap: 10px;
  align-items: start;
}

.modal-grid-hero {
  grid-area: hero;
  display: flex;
  flex-direction: column;
}

.modal-grid-draft {
  grid-area: draft;
  display: flex;
  flex-direction: column;
}

.modal-grid-build-modes {
  grid-area: build;
  display: flex;
  flex-direction: column;
}

.modal-grid-tags {
  grid-area: tags;
  display: flex;
  flex-direction: column;
}

.modal-grid-draft .modal-draft-card {
  margin: 0;
}

.modal-tags-heading {
  margin-top: 0 !important;
}

/* キャラクター アバター画像 */
.modal-char-avatar {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 18px;
  display: block;
  box-shadow: 0 4px 14px rgba(106, 86, 74, 0.14);
  border: 2.5px solid rgba(106, 86, 74, 0.2);
}

/* モーダル上部：左=画像、右=名前＋バッジ＋ステータス */
.modal-hero-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.modal-hero-image-wrap {
  flex-shrink: 0;
}

.modal-hero-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  flex: 1;
}

.modal-hero-name {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--clr-brown);
  line-height: 1.2;
}

/* ============================================================
   レア度バッジ & 実装日バッジ (詳細モーダル - フラットデザイン)
============================================================ */
.modal-rarity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 0.74rem;
  font-weight: 800;
  font-family: var(--font-main);
  border-radius: 999px;
  letter-spacing: 0.02em;
  border: 1px solid rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

/* レア (Rare) */
.rarity-theme-rare {
  background: #97ee8d;
  color: #2e5926;
}

/* スーパーレア (Super Rare) */
.rarity-theme-super {
  background: #80c3fd;
  color: #174b75;
}

/* ハイパーレア (Epic / Hyper Rare) */
.rarity-theme-hyper {
  background: #d88bf6;
  color: #551c6b;
}

/* ウルトラレア (Mythic / Ultra Rare) */
.rarity-theme-ultra {
  background: #ff8090;
  color: #ffffff;
}

/* レジェンドレア (Legendary) */
.rarity-theme-legend {
  background: #fff88f;
  color: #665000;
  border-color: rgba(106, 86, 74, 0.2);
}

/* ウルトラレジェンドレア (Ultra Legend) */
.rarity-theme-ultra_legend {
  background: #2c0249;
  color: #ffffff;
}

/* デフォルト */
.rarity-theme-default {
  background: rgba(154, 176, 143, 0.2);
  color: var(--clr-brown);
}

.modal-date-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(106, 86, 74, 0.75);
  background: rgba(154, 176, 143, 0.14);
  border: 1px solid rgba(154, 176, 143, 0.3);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* 編集モーダル ヘッダーアバター */
.editor-hero-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(154, 176, 143, 0.35);
}

.editor-char-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--brawl-border);
  box-shadow: 0 2px 6px rgba(106, 86, 74, 0.1);
  flex-shrink: 0;
}

.editor-hero-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.editor-char-subtitle {
  font-size: 0.8rem;
  color: rgba(106, 86, 74, 0.7);
  font-weight: 600;
}

.modal-stats-row {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.modal-meta-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  background: #fff;
  border: 1px solid rgba(106, 86, 74, 0.12);
  border-radius: 8px;
  padding: 4px 10px;
  box-shadow: 0 2px 4px rgba(106, 86, 74, 0.05);
  min-width: 0;
}

.modal-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(106, 86, 74, 0.7);
  font-family: var(--font-main);
  letter-spacing: 0.03em;
  text-align: center;
  width: 100%;
  display: block;
}

/* 難易度バッジ (低/中/高) */
.diff-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-main);
  border: 1px solid rgba(106, 86, 74, 0.15);
  margin: 0 auto;
}

.diff-badge.diff-1 {
  background: rgba(154, 176, 143, 0.22);
  color: #2e5926;
  border-color: rgba(154, 176, 143, 0.4);
}

.diff-badge.diff-2 {
  background: rgba(240, 180, 60, 0.22);
  color: #785200;
  border-color: rgba(240, 180, 60, 0.4);
}

.diff-badge.diff-3 {
  background: rgba(230, 80, 80, 0.22);
  color: #8c1d1d;
  border-color: rgba(230, 80, 80, 0.4);
}

.modal-meta-title {
  margin: 16px 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-brown);
  padding-left: 4px;
  border-left: 4px solid var(--clr-peach);
  line-height: 1.2;
  font-family: var(--font-main);
}

.modal-meta-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-brown);
  margin: 16px 0 8px;
  padding-left: 4px;
  border-left: 4px solid var(--clr-peach);
  line-height: 1.2;
}

.modal-com {
  background: rgba(154, 176, 143, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
  border-left: 3px solid var(--clr-sage);
}

.modal-com p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--clr-brown);
  font-family: var(--font-main);
}

/* おすすめビルドのスロットデザイン */
.modal-icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}

.build-slot {
  width: 56px;
  height: 56px;
  background: rgba(106, 86, 74, 0.04);
  border: 1px solid rgba(106, 86, 74, 0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.build-slot.empty {
  background: rgba(106, 86, 74, 0.02);
  border-style: dashed;
  box-shadow: none;
}

.build-slot.text {
  padding: 2px;
}

.build-slot.gears-slot {
  width: fit-content;
  min-width: 56px;
  padding: 0 8px;
}

/* モーダル用スタパ・ガジェットアイコン (48px) */
.modal-icon-row .icon-sg {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

/* モーダル用ギアアイコン (24px) */
.modal-icon-row .table-gear-icon {
  width: 24px !important;
  height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

.gear-icon-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* テーブル一覧用アイコン */
.icon-sg {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

tbody .table-gear-icon {
  width: 24px !important;
  height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  object-fit: contain !important;
}

.modal-strength-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--clr-brown);
  font-family: var(--font-main);
}

.modal-strength-wrap,
.modal-mode-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  /* 少し離す */
}

.modal-strength-meter {
  display: inline-flex;
  gap: 4px;
}

.modal-strength-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: rgba(154, 176, 143, 0.12);
  border: 2px solid rgba(154, 176, 143, 0.55);
  box-sizing: border-box;
}

.modal-strength-dot.is-on {
  background: rgb(154, 176, 143);
  border-color: rgb(154, 176, 143);
}

.modal-strength-wrap.modal-strength-level-4 .modal-strength-dot.is-on {
  background: rgb(240, 180, 60);
  border-color: rgb(240, 180, 60);
}

.modal-strength-wrap.modal-strength-level-5 .modal-strength-dot.is-on {
  background: rgb(230, 80, 80);
  border-color: rgb(230, 80, 80);
}

.modal-strength-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--clr-brown);
}

.modal-mode-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: rgba(154, 176, 143, 0.12);
  border: 2px solid rgba(154, 176, 143, 0.55);
  box-sizing: border-box;
}

.modal-mode-dot.is-on {
  background: rgb(154, 176, 143);
  border-color: rgb(154, 176, 143);
}

.modal-mode-wrap.modal-mode-level-2 .modal-mode-dot.is-on {
  background: rgb(240, 180, 60);
  border-color: rgb(240, 180, 60);
}

.modal-mode-wrap.modal-mode-level-3 .modal-mode-dot.is-on {
  background: rgb(230, 80, 80);
  border-color: rgb(230, 80, 80);
}

.modal-tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

/* 外部リンクボタン（Brawl Insights / Fandom Wiki） */
.link-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.guide-link {
  flex: 1;
  min-width: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(251, 246, 234, 0.9);
  border: 1.5px solid var(--clr-sage);
  border-radius: 10px;
  color: var(--clr-brown);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  font-family: var(--font-main);
  transition: background 0.15s, transform 0.15s;
}

.guide-link:hover {
  background: rgba(154, 176, 143, 0.25);
  transform: translateY(-1px);
}

/* 詳細モーダル用 モード別5段階評価 */
.modal-mode-ratings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(154, 176, 143, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 6px 0 10px;
}

.mode-rating-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mode-rating-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--brawl-border);
  border-radius: 8px;
  padding: 4px 6px;
}

.mode-rating-icon {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}

.mode-rating-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--clr-brown);
  white-space: nowrap;
  flex-shrink: 0;
}

.mode-rating-item .modal-strength-wrap {
  margin-left: auto;
}

.mode-rating-item .modal-strength-dot {
  width: 9px;
  height: 9px;
}

.mode-rating-item .modal-strength-value {
  font-size: 0.72rem;
}

/* 編集モーダル用 モード評価トグル */
.mode-edit-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.mode-edit-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mode-edit-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid var(--brawl-border);
  border-radius: 10px;
  padding: 6px 8px;
}

.mode-edit-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--clr-brown);
}

.mode-edit-label img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.mode-toggle-group {
  display: flex;
  gap: 2px;
}

.mode-toggle-group .meter-toggle-btn {
  flex: 1;
  padding: 3px 0;
  font-size: 0.72rem;
  border-radius: 4px;
  text-align: center;
}

/* 編集モーダル 2カラムダッシュボードグリッド */
.editor-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
  align-items: flex-start;
  margin-top: 8px;
}

.editor-col-left,
.editor-col-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-row-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.editor-btn-group {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

/* スタパ・ガジェットを横並びにするレイアウト */
.form-group.sg-row {
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
}

.sg-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

/* 難易度バッジ (Brawlディレクトリと同じスタイル) */
.diff-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-main);
  letter-spacing: 0.04em;
}

.diff-1 {
  background: rgba(154, 176, 143, 0.25);
  color: #4a7c59;
}

.diff-2 {
  background: rgba(240, 180, 60, 0.2);
  color: #8a6200;
}

.diff-3 {
  background: rgba(230, 80, 80, 0.18);
  color: #b03030;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--clr-brown);
  font-family: var(--font-main);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border: 1.5px solid var(--brawl-border);
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  background: #fff;
  color: var(--clr-brown);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--clr-sage);
}

/* ---- ギアスロット方式 ---- */
.gear-slots {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.gear-slot {
  position: relative;
  width: 52px;
  height: 52px;
  border: 2px dashed rgba(154, 176, 143, 0.5);
  border-radius: 10px;
  background: rgba(154, 176, 143, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.gear-slot:hover {
  border-color: var(--clr-sage);
  background: rgba(154, 176, 143, 0.18);
}

.gear-slot.has-gear {
  border-style: solid;
  border-color: var(--clr-sage);
  background: rgba(154, 176, 143, 0.15);
}

.gear-slot img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.gear-slot-empty {
  font-size: 1.3rem;
  color: rgba(154, 176, 143, 0.5);
  line-height: 1;
}

.gear-slot-num {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--clr-sage);
  opacity: 0.8;
  line-height: 1;
}

/* ギア選択ピッカー */
.gear-picker {
  margin-top: 8px;
  padding: 10px;
  background: rgba(154, 176, 143, 0.1);
  border: 1.5px solid var(--brawl-border);
  border-radius: 10px;
}

.gear-picker-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--clr-brown);
  opacity: 0.7;
  margin-bottom: 8px;
}

.gear-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.gear-pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 4px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  font-family: var(--font-main);
}

.gear-pick-btn:hover {
  border-color: var(--clr-sage);
  background: rgba(154, 176, 143, 0.2);
}

.gear-pick-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.gear-pick-btn span {
  font-size: 0.56rem;
  color: var(--clr-brown);
  text-align: center;
  line-height: 1.1;
  word-break: keep-all;
}

.gear-pick-none {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(106, 86, 74, 0.5);
  height: 100%;
  min-height: 52px;
}

.gear-pick-btn.is-selected {
  border-color: var(--clr-sage);
  background: rgba(154, 176, 143, 0.25);
}

.checkbox-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* 画像トグルボタン群 */
.img-toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.img-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 2px solid var(--brawl-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0.45;
  filter: grayscale(0.5);
  user-select: none;
}

.img-toggle-btn:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

/* 横長スタパ・ガジェット & 5x2ギアグリッド */
#sutapaToggleGroup,
#gajeToggleGroup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

#sutapaToggleGroup .img-toggle-btn.icon-only,
#gajeToggleGroup .img-toggle-btn.icon-only {
  width: 100%;
  height: 64px;
  border-radius: 14px;
  justify-content: center;
  align-items: center;
}

#sutapaToggleGroup .img-toggle-btn.icon-only img,
#gajeToggleGroup .img-toggle-btn.icon-only img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

#gearToggleGroup {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 4px;
}

#gearToggleGroup .img-toggle-btn.gear-btn.icon-only {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  justify-content: center;
  align-items: center;
}

#gearToggleGroup .img-toggle-btn.gear-btn.icon-only img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.img-toggle-btn.active {
  opacity: 1;
  filter: none;
  border-color: var(--clr-sage);
  background: rgba(154, 176, 143, 0.15);
  box-shadow: 0 0 0 2px rgba(154, 176, 143, 0.35);
}

/* レアリティトグル */
.rare-toggle-btn {
  padding: 6px 12px;
  border: 2px solid var(--brawl-border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--clr-brown);
  transition: all 0.15s ease;
  opacity: 0.5;
  user-select: none;
}

.rare-toggle-btn.active {
  opacity: 1;
  border-color: var(--rare-color, var(--clr-sage));
  background: var(--rare-color, var(--clr-sage));
  color: #111;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 強さ・難易度トグル */
.meter-toggle-btn {
  padding: 6px 14px;
  border: 1.5px solid var(--brawl-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--clr-brown);
  opacity: 0.5;
  transition: all 0.15s ease;
}

.meter-toggle-btn.active {
  opacity: 1;
  border-color: var(--clr-sage);
  background: rgba(154, 176, 143, 0.2);
}

/* 強さ (Strength) */
#tuyosaToggleGroup .meter-toggle-btn[data-tuyosa="4"].active {
  border-color: rgb(240, 180, 60);
  background: rgba(240, 180, 60, 0.2);
}
#tuyosaToggleGroup .meter-toggle-btn[data-tuyosa="5"].active {
  border-color: rgb(230, 80, 80);
  background: rgba(230, 80, 80, 0.2);
}

/* 難易度 (Difficulty) */
#difficultyToggleGroup .meter-toggle-btn[data-diff="2"].active {
  border-color: rgb(240, 180, 60);
  background: rgba(240, 180, 60, 0.2);
}
#difficultyToggleGroup .meter-toggle-btn[data-diff="3"].active {
  border-color: rgb(230, 80, 80);
  background: rgba(230, 80, 80, 0.2);
}

/* モード別評価 (Mode Ratings) */
.mode-toggle-group .meter-toggle-btn[data-val="2"].active {
  border-color: rgb(240, 180, 60);
  background: rgba(240, 180, 60, 0.2);
}
.mode-toggle-group .meter-toggle-btn[data-val="3"].active {
  border-color: rgb(230, 80, 80);
  background: rgba(230, 80, 80, 0.2);
}

body.modal-open {
  overflow: hidden;
}

/* PC用テーブル内 モード別評価 */
.table-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 4px 8px;
  padding: 4px 8px;
}
.table-mode-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.table-mode-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

/* PC・タブレット用テーブル内 ピック順 */
.table-draft-steps-track {
  display: inline-flex;
  align-items: center;
  background: rgba(106, 86, 74, 0.08);
  border: 1px solid rgba(106, 86, 74, 0.16);
  border-radius: 999px;
  padding: 2px 3px;
  gap: 2px;
}

.table-draft-step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-main);
  border-radius: 999px;
  transition: all 0.2s ease;
  user-select: none;
  line-height: 1.2;
}

.table-draft-step-chip.is-active {
  background: #3c7099;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(60, 112, 153, 0.35);
}

.table-draft-step-chip.is-inactive {
  background: transparent;
  color: rgba(106, 86, 74, 0.3);
  font-weight: 600;
}

/* ピック列セル全体：2行構造 */
.table-draft-steps-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* 1行目：先出し / 後出しバッジ（横並び） */
.table-draft-timing-row {
  display: inline-flex;
  gap: 4px;
}

/* 2行目：ピック順チップ */
.table-draft-steps-col {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-draft-timing-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  font-size: 0.64rem;
  font-weight: 800;
  font-family: var(--font-main);
  border-radius: 4px;
  border: 1px solid transparent;
  line-height: 1.4;
  transition: all 0.15s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.table-draft-timing-badge.is-active {
  background: rgba(99, 160, 65, 0.18);
  color: #2c7c10;
  border-color: rgba(99, 160, 65, 0.4);
}

.table-draft-timing-badge.is-active-last {
  background: rgba(200, 105, 30, 0.15);
  color: #8c4200;
  border-color: rgba(200, 105, 30, 0.4);
}

.table-draft-timing-badge.is-inactive {
  background: transparent;
  color: rgba(106, 86, 74, 0.25);
  border-color: rgba(106, 86, 74, 0.12);
}

.desktop-only {
  display: table-cell;
}

/* 編集モーダルのボタンの高さ統一 */
#charEditorForm hl-button {
  height: 44px;
}
#charEditorForm hl-button .hl-btn {
  height: 100%;
}

/* 編集モーダル内の詳細情報折りたたみアコーディオン */
.edit-extra-details {
  border: 1px solid var(--brawl-border);
  border-radius: 10px;
  background: rgba(154, 176, 143, 0.08);
  padding: 8px 12px;
  margin-top: 4px;
}

.edit-extra-summary {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-main);
  color: var(--clr-brown);
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
}

.edit-extra-summary:hover {
  color: var(--clr-sage);
}

.edit-extra-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px dashed rgba(154, 176, 143, 0.35);
}

/* ============================================================
   タグ表示（詳細モーダル） & タグ設定（編集モーダル）
============================================================ */

/* 詳細モーダル用タグ表示（カテゴリ別グループ化） */
.modal-tags-grouped-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 14px;
  background: rgba(154, 176, 143, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--brawl-border);
}

.modal-tag-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.modal-tag-group-label {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-main);
  min-width: 104px;
  flex-shrink: 0;
  color: rgba(106, 86, 74, 0.85);
  letter-spacing: 0.04em;
}

.modal-tag-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
}

/* ドラフト専用ハイライトカード（詳細モーダル左カラム特等席 - フラットデザイン） */
.modal-draft-card {
  background: rgba(60, 112, 153, 0.08);
  border: 1px solid rgba(60, 112, 153, 0.25);
  border-radius: 12px;
  padding: 8px 12px;
  margin: 6px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-draft-card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.modal-draft-card-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #2a5f85;
  letter-spacing: 0.03em;
  font-family: var(--font-main);
}

.modal-draft-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}

.modal-draft-track-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-draft-track-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(60, 112, 153, 0.85);
  font-family: var(--font-main);
  min-width: 28px;
}

/* ドラフト手番特殊トラック（1/2-3/4-5/6手目を常時全表示し、アクティブのみ点灯） */
.draft-special-chips {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}

.draft-normal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.draft-steps-track {
  display: inline-flex;
  background: rgba(106, 86, 74, 0.08);
  border: 1px solid rgba(106, 86, 74, 0.16);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.draft-step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-main);
  border-radius: 999px;
  transition: all 0.2s ease;
  user-select: none;
}

.draft-step-chip.is-active {
  background: #3c7099;
  color: #ffffff;
  font-weight: 800;
}

.draft-step-chip.is-inactive {
  background: transparent;
  color: rgba(106, 86, 74, 0.35);
  font-weight: 600;
}

/* ドラフトカード内：全選択肢を常に表示するチップ（ポジション・タイミング共通） */
.draft-all-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-main);
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
  line-height: 1.35;
}

/* ポジション（ミッド/サイド/キャリー）アクティブ */
.draft-all-chip-role.is-active {
  background: rgba(60, 112, 153, 0.15);
  color: #2a5f85;
  border-color: rgba(60, 112, 153, 0.4);
  font-weight: 800;
}

/* タイミング（先出し/後出し）アクティブ：先出し=緑、後出し=オレンジ */
.draft-all-chip-timing.is-active {
  background: rgba(99, 160, 65, 0.15);
  color: #2c7c10;
  border-color: rgba(99, 160, 65, 0.4);
  font-weight: 800;
}

/* 非アクティブ：手目チップと同じ薄グレー */
.draft-all-chip.is-inactive {
  background: transparent;
  color: rgba(106, 86, 74, 0.3);
  border-color: rgba(106, 86, 74, 0.15);
  font-weight: 600;
}

.char-tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: var(--font-main);
  background: rgba(154, 176, 143, 0.16);
  color: var(--clr-brown);
  border: 1px solid rgba(154, 176, 143, 0.4);
  letter-spacing: 0.02em;
}

.modal-tags-empty {
  font-size: 0.8rem;
  color: rgba(106, 86, 74, 0.5);
  font-style: italic;
  margin: 4px 0 14px;
}

/* 編集モーダル用タグセレクター（全表示・スクロールなし） */
.tag-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.tag-editor-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--clr-sage);
  margin-left: auto;
}

.tag-clear-btn {
  font-size: 0.72rem;
  padding: 2px 8px;
  background: #fff;
  border: 1px solid rgba(106, 86, 74, 0.25);
  border-radius: 4px;
  color: var(--clr-brown);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-clear-btn:hover {
  background: rgba(154, 176, 143, 0.15);
  border-color: var(--clr-sage);
}

.tag-editor-categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
  background: rgba(154, 176, 143, 0.08);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--brawl-border);
}

.tag-cat-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.5);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(106, 86, 74, 0.08);
}

.tag-cat-title {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: rgba(106, 86, 74, 0.9);
  border-bottom: 1px dashed rgba(154, 176, 143, 0.4);
  padding-bottom: 3px;
  margin-bottom: 2px;
}

.tag-cat-subgroups,
.tag-cat-chips {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tag-subgroup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.tag-select-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-main);
  border: 1.5px solid rgba(154, 176, 143, 0.4);
  background: #fff;
  color: var(--clr-brown);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

/* ------------------------------------------------------------
   6カテゴリ別カラーバリエーション（詳細バッジ ＆ 編集チップ）
------------------------------------------------------------ */

/* 1. 基本クラス (エメラルドグリーン) */
.char-tag-badge.tag-cat-class {
  background: rgba(74, 124, 89, 0.15);
  border-color: rgba(74, 124, 89, 0.45);
  color: #2d5437;
}
.tag-label-class { color: #2d5437; }
.tag-cat-group-class .tag-cat-title { color: #2d5437; border-bottom-color: rgba(74, 124, 89, 0.35); }
.tag-select-chip.tag-chip-class { border-color: rgba(74, 124, 89, 0.35); }
.tag-select-chip.tag-chip-class:hover { background: rgba(74, 124, 89, 0.12); border-color: #2d5437; }
.tag-select-chip.tag-chip-class.active { background: #4a7c59; border-color: #4a7c59; color: #fff; box-shadow: 0 2px 4px rgba(74, 124, 89, 0.35); }

/* 2. 役割・ドラフト (インディゴブルー) */
.char-tag-badge.tag-cat-role {
  background: rgba(60, 112, 153, 0.15);
  border-color: rgba(60, 112, 153, 0.45);
  color: #244b6b;
}
.tag-label-role { color: #244b6b; }
.tag-cat-group-role .tag-cat-title { color: #244b6b; border-bottom-color: rgba(60, 112, 153, 0.35); }
.tag-select-chip.tag-chip-role { border-color: rgba(60, 112, 153, 0.35); }
.tag-select-chip.tag-chip-role:hover { background: rgba(60, 112, 153, 0.12); border-color: #244b6b; }
.tag-select-chip.tag-chip-role.active { background: #3c7099; border-color: #3c7099; color: #fff; box-shadow: 0 2px 4px rgba(60, 112, 153, 0.35); }

/* 3. 射程・攻撃タイプ (アンバーオレンジ) */
.char-tag-badge.tag-cat-combat {
  background: rgba(194, 114, 23, 0.15);
  border-color: rgba(194, 114, 23, 0.45);
  color: #824700;
}
.tag-label-combat { color: #824700; }
.tag-cat-group-combat .tag-cat-title { color: #824700; border-bottom-color: rgba(194, 114, 23, 0.35); }
.tag-select-chip.tag-chip-combat { border-color: rgba(194, 114, 23, 0.35); }
.tag-select-chip.tag-chip-combat:hover { background: rgba(194, 114, 23, 0.12); border-color: #824700; }
.tag-select-chip.tag-chip-combat.active { background: #c27217; border-color: #c27217; color: #fff; box-shadow: 0 2px 4px rgba(194, 114, 23, 0.35); }

/* 4. メタ対策 (クリムゾンレッド) */
.char-tag-badge.tag-cat-meta {
  background: rgba(184, 58, 58, 0.14);
  border-color: rgba(184, 58, 58, 0.45);
  color: #8c2525;
}
.tag-label-meta { color: #8c2525; }
.tag-cat-group-meta .tag-cat-title { color: #8c2525; border-bottom-color: rgba(184, 58, 58, 0.35); }
.tag-select-chip.tag-chip-meta { border-color: rgba(184, 58, 58, 0.35); }
.tag-select-chip.tag-chip-meta:hover { background: rgba(184, 58, 58, 0.12); border-color: #8c2525; }
.tag-select-chip.tag-chip-meta.active { background: #b83a3a; border-color: #b83a3a; color: #fff; box-shadow: 0 2px 4px rgba(184, 58, 58, 0.35); }

/* 5. 妨害 (CC) (マスタードゴールド) */
.char-tag-badge.tag-cat-cc {
  background: rgba(184, 134, 11, 0.16);
  border-color: rgba(184, 134, 11, 0.45);
  color: #735200;
}
.tag-label-cc { color: #735200; }
.tag-cat-group-cc .tag-cat-title { color: #735200; border-bottom-color: rgba(184, 134, 11, 0.35); }
.tag-select-chip.tag-chip-cc { border-color: rgba(184, 134, 11, 0.35); }
.tag-select-chip.tag-chip-cc:hover { background: rgba(184, 134, 11, 0.12); border-color: #735200; }
.tag-select-chip.tag-chip-cc.active { background: #b8860b; border-color: #b8860b; color: #fff; box-shadow: 0 2px 4px rgba(184, 134, 11, 0.35); }

/* 6. ユーティリティ・適性 (ティール・エメラルド) */
.char-tag-badge.tag-cat-util {
  background: rgba(30, 144, 140, 0.15);
  border-color: rgba(30, 144, 140, 0.45);
  color: #0e5451;
}
.tag-label-util { color: #0e5451; }
.tag-cat-group-util .tag-cat-title { color: #0e5451; border-bottom-color: rgba(30, 144, 140, 0.35); }
.tag-select-chip.tag-chip-util { border-color: rgba(30, 144, 140, 0.35); }
.tag-select-chip.tag-chip-util:hover { background: rgba(30, 144, 140, 0.12); border-color: #0e5451; }
.tag-select-chip.tag-chip-util.active { background: #1e908c; border-color: #1e908c; color: #fff; box-shadow: 0 2px 4px rgba(30, 144, 140, 0.35); }

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  
  .editor-form {
    grid-template-columns: 1fr;
  }

  /* スマホ表示：テーブルを一画面に収めるレイアウト */
  .table-wrap {
    overflow-x: hidden;
  }

  .rating-table th.desktop-only,
  .rating-table td.desktop-only {
    display: none !important;
  }

  .rating-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
  }

  .rating-table tbody,
  .rating-table thead {
    display: block;
    width: 100%;
  }

  .rating-table thead tr {
    display: grid;
    width: 100%;
    grid-template-columns: 49px 60px 46px minmax(0, 1fr);
    column-gap: 2px;
    align-items: center;
    border-bottom: 2px solid var(--clr-sage);
    box-sizing: border-box;
  }

  .rating-table thead th {
    padding: 4px 0;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--clr-brown);
    text-align: left;
    white-space: nowrap;
  }

  .rating-table tbody tr {
    display: grid;
    width: 100%;
    grid-template-columns: 49px 60px 46px 34px 34px minmax(0, 1fr);
    column-gap: 2px;
    align-items: center;
    border-bottom: 1px solid var(--brawl-border);
    box-sizing: border-box;
    padding: 1px 0;
  }

  .rating-table td,
  .rating-table th {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .table-image-wrap {
    width: 49px;
    height: 36px;
    overflow: hidden;
  }

  .table-char-image {
    width: 49px;
    height: 36px;
    object-fit: cover;
    display: block;
  }

  .table-char-name {
    bottom: 0;
    padding: 9px 2px 2px;
    font-size: 0.46rem;
  }

  .rating-table td.cell-image,
  .rating-table th.cell-image {
    width: 49px;
  }

  .rating-table td.cell-icon,
  .rating-table th.cell-icon {
    width: 34px;
    min-width: 34px;
    padding: 0 1px;
  }

  .rating-table td.cell-gears,
  .rating-table th.cell-gears {
    width: auto;
    min-width: 0;
    padding-left: 2px;
    overflow: hidden;
  }

  .rating-table td.cell-strength,
  .rating-table th.cell-strength {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding: 0 8px;
    overflow: visible;
  }

  .rating-table td.cell-difficulty,
  .rating-table th.cell-difficulty {
    text-align: center;
    padding: 0 2px;
    width: 46px;
    min-width: 46px;
    max-width: 46px;
  }

  .table-icon-wrap {
    width: 34px;
    height: 34px;
  }

  .table-sg-icon {
    width: 34px;
    height: 34px;
  }

  .table-gear-icon,
  tbody .table-gear-icon {
    width: 16px !important;
    height: 16px !important;
  }

  .rating-table td.cell-gears .gear-icon-wrap {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1px;
  }

  .rating-table .strength-wrap.strength-table {
    gap: 1px;
  }

  .rating-table .strength-wrap.strength-table .strength-meter {
    gap: 1px;
  }

  .rating-table .strength-wrap.strength-table .strength-bar {
    width: 6px;
    height: 6px;
  }

  .diff-badge {
    padding: 1px 5px;
    font-size: 0.68rem;
  }

  .rating-table td.cell-action {
    padding: 0 2px;
  }

  /* モバイル時の検索・タグフィルター行 */
  .brawl-filter-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .brawl-search-wrap {
    width: 100%;
    flex: 1 1 100%;
  }

  .tag-filter-wrap {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .sort-select,
  .tag-filter-select {
    flex: 1;
    min-width: 130px;
    max-width: none;
  }

  .tag-filter-toggle-btn {
    flex-shrink: 0;
  }

  /* モバイル時のモーダル調整 */
  .modal-body {
    width: min(560px, 94vw);
    padding: 16px;
    margin: 4vh auto;
  }

  .modal-char-avatar {
    width: 68px;
    height: 68px;
    border-radius: 14px;
  }

  .modal-hero-row {
    gap: 12px;
    align-items: center;
  }

  .modal-hero-name {
    font-size: 1.25rem;
  }

  .modal-stats-row {
    gap: 6px;
    flex-wrap: wrap;
  }

  .modal-meta-stat {
    padding: 3px 8px;
  }

  .modal-strength-dot {
    width: 8px;
    height: 8px;
  }

  .modal-detail-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "draft"
      "build"
      "tags";
    gap: 14px;
  }

  .modal-tags-heading {
    margin-top: 16px !important;
  }

  .editor-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tag-editor-categories {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Tier表モーダル & キャプチャ用デザイン
============================================================ */
.tier-modal-body {
  width: min(1140px, 96vw);
  background: #fdfbf7;
  padding: 22px 24px;
}

.tier-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px dashed rgba(106, 86, 74, 0.2);
}

.tier-modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--clr-brown);
  font-family: var(--font-main);
  line-height: 1.2;
}

.tier-modal-subtitle {
  font-size: 0.78rem;
  color: rgba(106, 86, 74, 0.7);
  font-weight: 600;
  font-family: var(--font-main);
}

.tier-modal-notice {
  font-size: 0.74rem;
  font-weight: 700;
  color: #c0392b;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 4px;
  font-family: var(--font-main);
}

.tier-action-btns {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.tier-action-btn {
  height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: none;
}

.btn-export-img {
  background: #2a5f85;
  color: #fff;
  box-shadow: 0 2px 8px rgba(42, 95, 133, 0.3);
}

.btn-export-img:hover {
  background: #1e4764;
  transform: translateY(-1px);
}

.btn-export-pdf {
  background: #4a7c59;
  color: #fff;
  box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

.btn-export-pdf:hover {
  background: #365c41;
  transform: translateY(-1px);
}

/* キャプチャ対象となるTier表ボード本体 */
.tier-capture-area {
  background: #1e2029;
  color: #ffffff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-family: var(--font-main);
  overflow-x: auto;
}

.tier-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tier-board-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tier-board-logo {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffa502;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.tier-board-sub {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
}

.tier-board-meta {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.tier-rows-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Tier行 */
.tier-row {
  display: flex;
  align-items: stretch;
  background: #282b37;
  border: 1.5px solid #14151b;
  border-radius: 8px;
  min-height: 66px;
  overflow: hidden;
}

.tier-label-box {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  padding: 4px;
  user-select: none;
}

.tier-label-main {
  font-size: 1.7rem;
  line-height: 1;
}

.tier-label-sub {
  font-size: 0.62rem;
  opacity: 0.9;
  margin-top: 2px;
  font-weight: 700;
}

/* 各Tierのテーマカラー */
.tier-row-s .tier-label-box { background: #ff4757; }
.tier-row-a .tier-label-box { background: #ff7f50; }
.tier-row-b .tier-label-box { background: #ffa502; }
.tier-row-c .tier-label-box { background: #2ed573; }
.tier-row-d .tier-label-box { background: #747d8c; }

.tier-chars-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 8px;
  flex: 1;
  align-items: center;
  align-content: center;
}

.tier-chars-empty {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.78rem;
  padding-left: 8px;
}

/* Tier / 実装年キャラカード（正方形） */
.tier-char-card {
  position: relative;
  width: 58px;
  height: 58px;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.tier-char-card:hover {
  transform: scale(1.12);
  z-index: 3;
}

.tier-char-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 右上に浮かせるバッジ（難易度 / 実装月日） */
.tier-card-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
  font-size: 0.40rem;
  font-weight: 900;
  padding: 0.5px 3px;
  border-radius: 3px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.tier-diff-badge.diff-1 {
  background: #2e7d32;
  color: #ffffff;
}

.tier-diff-badge.diff-2 {
  background: #d97706;
  color: #ffffff;
}

.tier-diff-badge.diff-3 {
  background: #dc2626;
  color: #ffffff;
}

.year-date-badge {
  background: rgba(15, 23, 42, 0.85);
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.4);
}

/* 下部全体を使ったキャラクター名表示 */
.tier-char-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 1px 1px;
  font-size: 0.46rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 65%, transparent 100%);
  text-shadow: 0 1px 2px #000;
  line-height: 1;
  letter-spacing: -0.3px;
}

.tier-board-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: right;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   実装年別表 デザイン
============================================================ */
.year-row {
  display: flex;
  align-items: stretch;
  background: #282b37;
  border: 1.5px solid #14151b;
  border-radius: 8px;
  min-height: 66px;
  overflow: hidden;
}

.year-label-box {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  padding: 4px;
  user-select: none;
  background: #475569;
}

.year-label-main {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.5px;
}

.year-label-sub {
  font-size: 0.6rem;
  opacity: 0.9;
  margin-top: 3px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 999px;
}

/* 年別カラーテーマ */
.year-row-2017 .year-label-box { background: #b8860b; }
.year-row-2018 .year-label-box { background: #cd853f; }
.year-row-2019 .year-label-box { background: #2b7a78; }
.year-row-2020 .year-label-box { background: #3a506b; }
.year-row-2021 .year-label-box { background: #5c3d75; }
.year-row-2022 .year-label-box { background: #2a9d8f; }
.year-row-2023 .year-label-box { background: #e76f51; }
.year-row-2024 .year-label-box { background: #e63946; }
.year-row-2025 .year-label-box { background: #6366f1; }
.year-row-2026 .year-label-box { background: #0ea5e9; }

/* キャラカード内の実装月日バッジ */
.year-char-date-badge {
  font-size: 0.42rem;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 2px;
  background: rgba(30, 41, 59, 0.75);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.35);
  line-height: 1;
  text-shadow: none;
  flex-shrink: 0;
}

/* 印刷用スタイル */
@media print {
  body * {
    visibility: hidden;
  }
  #tierModal:not([hidden]),
  #tierModal:not([hidden]) *,
  #yearModal:not([hidden]),
  #yearModal:not([hidden]) * {
    visibility: visible;
  }
  #tierModal,
  #yearModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: transparent;
    padding: 0;
    margin: 0;
  }
  .modal-backdrop,
  .modal-close,
  .tier-modal-header {
    display: none !important;
  }
  .tier-capture-area,
  .year-capture-area {
    box-shadow: none;
    padding: 10px;
    border-radius: 0;
  }
}