/* キャラクター一覧のカード（斜めカード・左端にキャラカラーの帯）
   高さ120px（枠4px・内側112px）。メインアイコンは内側の高さいっぱいの正方形（112×112px）で表示します。
   スマホではカード全体を画面幅に合わせて縮小します。 */

.clist-inner {
  display: flex;
  flex-direction: column;
  gap: 25px;
  padding: 6px 18px 14px;
}

.clist-card {
  position: relative;
  display: flex;
  box-sizing: border-box;
  width: 100%;
  max-width: 900px;
  height: 120px;
  margin: 0 auto;
  overflow: hidden;
  border: 4px solid #080808;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(90deg, #13151c 0%, #13151c 68%, #361f70 100%);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
  text-decoration: none;
  transform: skewX(-15deg);
  cursor: pointer;
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}
.clist-card:hover,
.clist-card:focus-visible,
.clist-card:active {
  outline: none;
  transform: skewX(-15deg) translateY(-2px);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 0 10px 2px rgba(255, 255, 255, 0.6),
    0 12px 20px rgba(0, 0, 0, 0.7);
}

/* 左端：キャラカラーの帯 */
.clist-bar {
  position: relative;
  z-index: 2;
  flex: 0 0 65px;
  height: 100%;
  background: var(--clist-color, #7a8eff);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}
.clist-color-name {
  position: absolute;
  bottom: 12px;
  left: 15px;
  max-width: 210px;
  overflow: hidden;
  padding-bottom: 2px;
  border-bottom: 2px solid #fff;
  color: #fff;
  font: 700 14px/1.3 var(--font-sans, "Noto Sans JP", sans-serif);
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
  transform: skewX(15deg);
  transform-origin: left bottom;
}

/* 中身（斜めを打ち消して正立させる） */
.clist-content {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-width: 0;
  padding-left: 60px;
  padding-right: 40px;
  transform: skewX(15deg);
}

.clist-eno {
  display: flex;
  flex: 0 0 45px;
  flex-direction: column;
  justify-content: flex-start;
  margin-right: 20px;
  padding-top: 15px;
  font-family: var(--font-sans, "Noto Sans JP", sans-serif);
}
.clist-eno-label { color: #888d9e; font-size: 11px; font-weight: 700; font-style: italic; }
.clist-eno-num { margin-top: 2px; color: #fff; font-size: 22px; font-weight: 900; line-height: 1; }

/* メインアイコン：上下のふちに届く高さの正方形 */
.clist-icon {
  flex: 0 0 112px;
  width: 112px;
  height: 100%;
  margin-right: 35px;
}
.clist-icon img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center 10%;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 4px, #000 calc(100% - 4px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 4px, #000 calc(100% - 4px), transparent 100%);
}
/* 画像の映し方（characters.js で判定）：全体を映す／上半分が入るように上ぞろえ */
.clist-icon { position: relative; overflow: hidden; }
.clist-icon img.is-whole { object-fit: contain; object-position: center; }
.clist-icon img.is-top-half { position: absolute; top: 0; left: 50%; height: auto; object-fit: fill; transform: translateX(-50%); }
.clist-noimage {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #6a6d80;
  font: 700 10px/1.2 var(--font-sans, "Noto Sans JP", sans-serif);
  letter-spacing: 1px;
}

.clist-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  padding-right: 20px;
}
.clist-name {
  max-width: 100%;
  margin-bottom: 8px;
  overflow: hidden;
  color: #fff;
  font-family: var(--font-serif, "Noto Serif JP", serif);
  font-size: 32px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 4px;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}
.clist-unit-label {
  align-self: flex-start;
  margin-left: 10%;
  color: #a78bfa;
  font: 900 10px/1.4 var(--font-sans, "Noto Sans JP", sans-serif);
  letter-spacing: 2px;
}
.clist-unit-name {
  max-width: 100%;
  overflow: hidden;
  color: #e2e8f0;
  font-family: var(--font-serif, "Noto Serif JP", serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 1px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.clist-unit-name.is-empty { color: #6a6d80; }

/* ログ公開などの表示 */
.clist-status {
  display: flex;
  flex: 0 0 200px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
.clist-badge {
  box-sizing: border-box;
  width: 100%;
  padding: 4px 12px 4px 10px;
  color: #fff;
  font: 700 11px/1.4 var(--font-sans, "Noto Sans JP", sans-serif);
  overflow: hidden;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.clist-badge.is-ok { background: linear-gradient(to right, transparent 0, transparent 6px, rgba(74, 142, 127, 0.9) 6px, rgba(0, 0, 0, 0.5) 28%, rgba(0, 0, 0, 0.5) 78%, transparent 100%); }
.clist-badge.is-ng { background: linear-gradient(to right, transparent 0, transparent 6px, rgba(197, 43, 89, 0.9) 6px, rgba(0, 0, 0, 0.5) 28%, rgba(0, 0, 0, 0.5) 78%, transparent 100%); }
.clist-badge.is-other { background: linear-gradient(to right, transparent 0, transparent 6px, rgba(43, 58, 129, 0.9) 6px, rgba(0, 0, 0, 0.5) 28%, rgba(0, 0, 0, 0.5) 78%, transparent 100%); }

/* --- スマホ版：PCと同じ並びのカードを、画面幅に合わせてまるごと縮小して表示する（縮小率は characters.js） --- */
.clist.is-scaled { position: relative; padding: 0; overflow: hidden; }
.clist.is-scaled > .clist-inner {
  display: flex;
  flex-direction: column;
  gap: 25px;
  box-sizing: border-box;
  padding: 6px 18px 14px;
  transform-origin: top left;
}
/* 縮小表示のときは、名前が入るよう余白と表示欄を少し詰め、縮んでも読めるよう文字を少し大きめにする */
.clist.is-scaled .clist-bar { flex-basis: 56px; }
.clist.is-scaled .clist-content { padding-left: 44px; padding-right: 22px; }
.clist.is-scaled .clist-eno { flex-basis: 42px; margin-right: 10px; }
.clist.is-scaled .clist-eno-label { font-size: 13px; }
.clist.is-scaled .clist-eno-num { font-size: 24px; }
.clist.is-scaled .clist-icon { margin-right: 16px; }
.clist.is-scaled .clist-text { padding-right: 4px; }
.clist.is-scaled .clist-name { letter-spacing: 2px; }
.clist.is-scaled .clist-unit-label { margin-left: 4%; font-size: 12px; }
.clist.is-scaled .clist-unit-name { font-size: 16px; }
.clist.is-scaled .clist-status { flex-basis: 180px; gap: 4px; }
.clist.is-scaled .clist-badge { padding: 3px 10px 3px 12px; font-size: 14px; }
.clist.is-scaled .clist-color-name { font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  .clist-card { transition: none; }
}

/* ===== キャラクター一覧ページ全体（参考HTMLに合わせた背景・ヘッダー・タイトル・タブ） ===== */
body.characters-page { display: flow-root; background: #262938; }
/* 一覧が長くなったとき、ページの一番下に黒い帯（ページ全体の背景）が出ないよう、ページ全体も同じ灰色に */
html:has(body.characters-page) { background: #262938; }
body.characters-page::before { display: none; }
body.characters-page .site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(20, 22, 30, 0.9);
}

body.characters-page .characters-main {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 30px;
  width: 100%;
  max-width: 950px;
  margin: 50px auto 0;
  padding: 0 20px 110px;
}
body.characters-page .characters-main > * { margin-top: 0; margin-bottom: 0; }

/* タイトルエリア */
body.characters-page .characters-heading { display: flex; flex-direction: column; gap: 8px; margin: 0; }
body.characters-page .characters-heading .eyebrow {
  margin: 0;
  color: #a78bfa;
  font: 900 12px/1.4 var(--font-sans, "Noto Sans JP", sans-serif);
  letter-spacing: 3px;
}
body.characters-page .characters-heading h1 {
  margin: 0;
  color: #fff;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 2px;
}
body.characters-page .characters-heading > p:last-child {
  margin: 0;
  color: #888d9e;
  font: 13px/1.6 var(--font-sans, "Noto Sans JP", sans-serif);
}

/* タブ */
body.characters-page .characters-tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  background-color: #1a1c28;
}
body.characters-page .characters-tabs button {
  flex: 1;
  min-height: 0;
  padding: 16px 0;
  border: 0;
  border-radius: 0;
  color: #6a6d80;
  background: transparent;
  box-shadow: none;
  font: 700 14px/1.3 var(--font-sans, "Noto Sans JP", sans-serif);
  text-align: center;
  cursor: pointer;
}
body.characters-page .characters-tabs button[aria-selected="true"] {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  box-shadow: none;
}

/* カード一覧：参考HTMLと同じく最大900pxのカードを中央に（光る枠が切れない分だけ余白） */
body.characters-page .clist-inner { padding: 6px 5px 14px; }
/* 縮小表示では、斜めのカードの角が切れないよう左右に余白（左右の幅は characters.js で端から5px空くように調整） */
body.characters-page .clist.is-scaled > .clist-inner { padding: 6px 26px 14px; }

@media (max-width: 760px) {
  body.characters-page .characters-main { gap: 22px; margin: 28px auto 0; padding: 0 12px 80px; }
  body.characters-page .characters-heading h1 { font-size: 26px; }
  body.characters-page .characters-tabs button { padding: 13px 0; font-size: 13px; }
}

/* ===== 検索（キャラ名・ユニット名）：キャラクター一覧は見出しの右上、舞台メンバー一覧は枠内の右上 ===== */
body.characters-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
body.characters-page .characters-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
body.characters-page .characters-heading-row .characters-heading { min-width: 0; }
body.characters-page .clist-search {
  position: relative;
  display: block;
  flex: 0 0 260px;
  width: 260px;
  margin: 0;
}
body.characters-page .clist-search[hidden] { display: none; }
body.characters-page .clist-search::before {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 14px;
  height: 14px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888d9e' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E");
  content: "";
  transform: translateY(-50%);
  pointer-events: none;
}
body.characters-page .clist-search input {
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 11px 14px 11px 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #e2e8f0;
  background-color: #1a1c28;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  font: 700 13px/1.4 var(--font-sans, "Noto Sans JP", sans-serif);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.characters-page .clist-search input::placeholder { color: #6a6d80; opacity: 1; }
body.characters-page .clist-search input:focus {
  border-color: #7c3aed;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(124, 58, 237, 0.25);
}
body.characters-page .clist-search-empty { margin: 0; }

/* 舞台メンバー一覧：右上に検索、その下に並び順ボタン */
body.characters-page .stage-members-tools {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
body.characters-page .stage-members-heading { align-items: flex-start; }
body.characters-page .stage-members-tools .clist-search { flex: 0 0 auto; }

/* 舞台メンバー一覧のキャラ枠：キャラクター一覧と同じカードを縦に並べる */
body.characters-page .stage-member-list,
body.characters-page .stage-unit-group { grid-template-columns: minmax(0, 1fr); min-width: 0; }
body.characters-page .stage-unit-members.clist { display: block; min-width: 0; }

/* 舞台メンバー一覧（PC・スマホ共通）：ユニット名を省き、ENoの横（真ん中寄り）に名前、アイコンはログ公開などの表示のすぐ左へ */
body.characters-page .stage-unit-members.clist .clist-unit-label,
body.characters-page .stage-unit-members.clist .clist-unit-name { display: none; }
body.characters-page .stage-unit-members.clist .clist-text {
  order: 2;
  /* 名前は縦・横ともにENoとアイコンの間の真ん中に置く */
  justify-content: center;
  align-items: center;
  padding: 0 8px 0 0;
}
body.characters-page .stage-unit-members.clist .clist-name { margin-bottom: 0; line-height: 1.25; }
body.characters-page .stage-unit-members.clist .clist-icon {
  order: 3;
  /* ログ公開などの表示との間は、画面上で約3.5px */
  margin-right: calc(3.5px / var(--clist-scale, 1));
}
body.characters-page .stage-unit-members.clist .clist-status { order: 4; }

@media (max-width: 760px) {
  body.characters-page .characters-heading-row { flex-direction: column; align-items: stretch; gap: 14px; }
  body.characters-page .clist-search { flex-basis: auto; width: 100%; }
  body.characters-page .stage-members-heading { align-items: stretch; }
  body.characters-page .stage-members-tools { align-items: stretch; }
}

/* ===== フォロー：カード右上の星マークと、フォロー中／フォロワーの絞り込み ===== */
.clist-item { position: relative; width: 100%; max-width: 900px; margin: 0 auto; }
.clist-item > .clist-card { max-width: none; }
/* カード右上の角に寄せて配置。スマホで縮小表示されてもPCと同じ位置・同じ比率になるよう、カードと一緒に縮小する */
.clist-follow.follow-star {
  position: absolute;
  top: 10px;
  right: 4px;
  z-index: 3;
  width: 22px;
  height: 22px;
}

body.characters-page .characters-tools {
  display: flex;
  flex: 0 0 300px;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 300px;
}
body.characters-page .characters-tools[hidden] { display: none; }
body.characters-page .characters-tools .clist-search { flex: 0 0 auto; width: 100%; }
body.characters-page .stage-members-tools .clist-search { width: 300px; }

body.characters-page .follow-filter {
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  background: #1a1c28;
}
body.characters-page .follow-filter[hidden] { display: none; }
body.characters-page .stage-members-tools .follow-filter { width: 300px; }
body.characters-page .follow-filter button {
  flex: 1;
  min-height: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  color: #6a6d80;
  background: transparent;
  box-shadow: none;
  font: 700 12px/1.3 var(--font-sans, "Noto Sans JP", sans-serif);
  cursor: pointer;
}
body.characters-page .follow-filter button + button { border-left: 1px solid rgba(0, 0, 0, 0.45); }
body.characters-page .follow-filter button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, #7c3aed, #4f46e5); }

@media (max-width: 760px) {
  body.characters-page .characters-tools { flex-basis: auto; width: 100%; }
  body.characters-page .stage-members-tools .clist-search,
  body.characters-page .stage-members-tools .follow-filter { width: 100%; }
}
