/* EMDB 共通カード一覧（inc/emdb_cards.php）
 * .emdb-cards            一覧ラッパー（data-per-page / data-total）
 * .emdb-cards--{variant} ページ別調整（creator / brand / game / game-list）
 * .emdb-cards--nothumb   サムネなし（music）
 * .emdb-card             1 枚。hidden 属性で 2 ページ目以降を隠す（JS が切替）
 */
.emdb-cards {
	--cards-gap: 12px;
	--cards-line: #e5e5e5;
	--cards-muted: #777;
	--cards-label-bg: #f2f2f2;
	--cards-accent: #e9608a;
	--cards-label-w: 5.5em;   /* 行ラベルの固定幅（そろえる） */
	margin: 0 0 2.2em;
}
.emdb-cards__heading .emdb-cards__count {
	display: inline-block;
	font-size: 0.6em;
	font-weight: normal;
	color: var(--cards-muted, #777);
	background: #f2f2f2;
	border-radius: 999px;
	padding: 2px 10px;
	vertical-align: middle;
	margin-left: 4px;
}
.emdb-cards__heading .emdb-cards__refresh {
	font-size: 0.5em;
	font-weight: normal;
	margin-left: 8px;
	vertical-align: middle;
	opacity: 0.6;
	text-decoration: none;
	border: 1px solid currentColor;
	border-radius: 3px;
	padding: 1px 6px;
}
.emdb-cards__empty { color: var(--cards-muted); }

/* グリッド: PC 3 列 / タブレット 2 列 / スマホ 1 列 */
.emdb-cards__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--cards-gap);
}
@media screen and (max-width: 1023px) { .emdb-cards__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media screen and (max-width: 560px)  { .emdb-cards__grid { grid-template-columns: minmax(0, 1fr); } }

/* カード */
.emdb-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: #fff;
	border: 1px solid var(--cards-line);
	border-radius: 6px;
	overflow: hidden;
}
/* ホバーで位置が動くアニメーションは入れない（影だけ） */
.emdb-card:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
/* サムネはリンクだと分かるように、ホバーで画像だけ少し拡大・明るく（枠は動かない） */
.emdb-card__thumb img { transition: transform .25s ease, filter .25s ease; }
.emdb-card__thumb:hover img { transform: scale(1.04); filter: brightness(1.06); }
.emdb-card[hidden] { display: none; }

/* ---- サムネ ---- */
.emdb-card__thumb {
	position: relative;
	display: block;
	background: #f3f3f3;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	text-decoration: none;
}
.emdb-card__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* ゲーム: パッケージ画像（707×1000 の縦長が多いが横長もある）。枠の比率を固定せず、画像の比率のまま幅いっぱいに出す
 * （縦長は高さ上限で止める。横長は幅いっぱいなので小さくならない） */
.emdb-card--game .emdb-card__thumb { aspect-ratio: auto; background: #ececec; display: flex; align-items: center; justify-content: center; }
.emdb-card--game .emdb-card__thumb img { width: 100%; height: auto; max-height: 440px; object-fit: contain; }
.emdb-card__thumb--contain img { object-fit: contain; }
/* 外部リンクのサムネ（ゲームページのパッケージ画像と同じ: 出典ドメインを下部に） */
.emdb-card__thumb--ext { cursor: alias; }
.emdb-card__ogp {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 5px 8px;
	font-size: 11px;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0));
}
.emdb-card__ogp img { width: 16px; height: 16px; border-radius: 2px; background: #fff; }
.emdb-card__ogp-domain { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
.emdb-card__ogp .fas { font-size: 10px; opacity: .9; }
.emdb-card__thumb--ext:hover .emdb-card__ogp { background: linear-gradient(to top, rgba(233, 96, 138, .85), rgba(233, 96, 138, 0)); }

/* サムネ四隅のオーバーレイ（動画: 種別 / 視聴サイト / 公開日 / 長さ） */
.emdb-card__ov { position: absolute; display: flex; gap: 4px; align-items: center; max-width: 70%; pointer-events: none; }
.emdb-card__ov--tl { top: 6px; left: 6px; }
.emdb-card__ov--tr { top: 6px; right: 6px; }
.emdb-card__ov--bl { bottom: 6px; left: 6px; }
.emdb-card__ov--br { bottom: 6px; right: 6px; }
.emdb-card__ovtext {
	font-size: 11px;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 3px;
	color: #fff;
	background: rgba(0, 0, 0, .65);
	white-space: nowrap;
}
.emdb-card__ov .emdb-badge { background: rgba(0, 0, 0, .65); color: #fff; }
.emdb-src {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 3px;
	background: rgba(0, 0, 0, .65);
	color: #fff;
	font-size: 13px;
}
.emdb-src--youtube i { color: #ff3333; }
.emdb-src img { width: 14px; height: 14px; border-radius: 2px; }
.emdb-src svg { width: 12px; height: 12px; }

/* ---- 本文 ---- */
.emdb-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 12px 12px;
	font-size: 12px;
	line-height: 1.5;
	color: #444;
}
.emdb-card__caption { font-size: 11px; color: var(--cards-muted); margin-bottom: 2px; }
.emdb-card__badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }

.emdb-card .emdb-card__title {
	font-size: 14px;
	line-height: 1.4;
	font-weight: bold;
	margin: 0 0 8px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
}
.emdb-card .emdb-card__title::before, .emdb-card .emdb-card__title::after { display: none; }
/* カード内のリンクは黒系（ホバーでサイトカラー）。本人の名前だけ色が付く（inline style: EMDB_CARDS_SELF_COLOR） */
.emdb-card .emdb-card__title a { color: #333; text-decoration: underline; text-decoration-color: #ccc; text-underline-offset: 3px; }
.emdb-card .emdb-card__title a:hover { color: var(--cards-accent); text-decoration: underline; }
.emdb-card .emdb-card__text a, .emdb-card .emdb-card__games a { color: #444; text-decoration: underline; text-decoration-color: #bbb; text-underline-offset: 2px; }
.emdb-card .emdb-card__text a:hover, .emdb-card .emdb-card__games a:hover { color: var(--cards-accent); text-decoration-color: var(--cards-accent); }

/* 行: ラベル列を固定幅にしてそろえる */
.emdb-card__meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.emdb-card__row { display: grid; grid-template-columns: var(--cards-label-w) minmax(0, 1fr); gap: 8px; align-items: start; min-width: 0; }
.emdb-card__label {
	font-size: 10px;
	line-height: 1.2;
	padding: 3px 5px;
	border-radius: 3px;
	background: var(--cards-label-bg);
	color: var(--cards-muted);
	margin-top: 2px;
	text-align: center;
	overflow-wrap: anywhere;   /* 長い役職名は折り返す */
	word-break: break-word;
}
.emdb-card__text { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.emdb-card__sub { color: var(--cards-muted); font-size: 11px; }
.emdb-card__role { color: var(--cards-muted); }
.emdb-card__na { color: #aaa; }
/* 本人（色は PHP 側の inline style: EMDB_CARDS_SELF_COLOR） */
/* 本人の名前は太字＋色のみ（PHP 側の inline style） */

/* クレジットの区切り。data-sep があればその記号（歌の＋ / × / ∞ など）、なければ「/」 */
.emdb-card__credits { display: inline; }
.emdb-card__credit { display: inline; }
.emdb-card__credit:not(:last-child)::after { content: "/"; color: #999; margin: 0 .45em; }
.emdb-card__credits[data-sep="＋"] .emdb-card__credit:not(:last-child)::after { content: "＋"; color: #444; margin: 0 .2em; }
.emdb-card__credits[data-sep="＆"] .emdb-card__credit:not(:last-child)::after { content: "＆"; color: #444; margin: 0 .2em; }
.emdb-card__credits[data-sep="×"]  .emdb-card__credit:not(:last-child)::after { content: "×";  color: #444; margin: 0 .2em; }
.emdb-card__credits[data-sep="∞"]  .emdb-card__credit:not(:last-child)::after { content: "∞";  color: #444; margin: 0 .2em; }
.emdb-card__credits[data-sep="、"] .emdb-card__credit:not(:last-child)::after { content: "、"; color: #444; margin: 0; }
.emdb-card__credits[data-sep=" "]  .emdb-card__credit:not(:last-child)::after { content: " ";  margin: 0 .2em; }

/* グループまとめ「SMEE（A／B／C）」・複数発売日の区切り */
.emdb-card__msep { color: #999; margin: 0 .15em; }
.emdb-card__credit--others { color: var(--cards-muted); }

/* ---- フッター: 補足情報 + 大きめの詳細ボタン ---- */
.emdb-card__footer { margin-top: auto; padding-top: 10px; }
.emdb-card__footinfo {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin-bottom: 8px;
	font-size: 11px;
	color: var(--cards-muted);
}
.emdb-card__footinfo .fa, .emdb-card__footinfo .fas, .emdb-card__footinfo .far { opacity: .7; }
.emdb-card__date { margin-left: auto; }
.emdb-card .emdb-card__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	min-height: 40px;
	padding: 8px 12px;
	border: 1px solid var(--cards-accent);
	border-radius: 4px;
	background: #fff;
	color: var(--cards-accent) !important;
	font-size: 13px;
	font-weight: bold;
	text-decoration: none;
	transition: background .15s, color .15s;
}
.emdb-card .emdb-card__btn:hover { background: var(--cards-accent); color: #fff !important; }

/* ---- バッジ（タイトル上: 種別 / R-18 / 機種 / フル無料） ---- */
.emdb-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 10px;
	line-height: 1;
	padding: 4px 6px;
	border-radius: 3px;
	background: #f2f2f2;
	color: #555;
	white-space: nowrap;
}
.emdb-badge--cat { background: #eef3f8; color: #3b5b7a; }
.emdb-badge--free { background: #e8f6ec; color: #2d7a43; }
.emdb-badge--rating-r18 { background: #fdecf2; color: #c2185b; font-weight: bold; }
.emdb-badge--rating-all { background: #e8f6ec; color: #2d7a43; font-weight: bold; }
.emdb-badge--rating-both, .emdb-badge--rating-patch { background: #fff4e0; color: #9a6400; font-weight: bold; }
.emdb-badge--pf { background: #fafafa; border: 1px solid var(--cards-line); color: #555; }

/* ---- ページネーション ---- */
.emdb-cards__nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 14px;
	font-size: 13px;
}
.emdb-cards__nav:empty { display: none; }
.emdb-cards__page, .emdb-cards__all {
	min-width: 34px;
	height: 34px;
	padding: 0 10px;
	border: 1px solid var(--cards-line);
	border-radius: 4px;
	background: #fff;
	color: #444;
	cursor: pointer;
	font: inherit;
	line-height: 32px;
}
.emdb-cards__page:hover, .emdb-cards__all:hover { border-color: var(--cards-accent); color: var(--cards-accent); }
.emdb-cards__page[aria-current="page"] { background: var(--cards-accent); border-color: var(--cards-accent); color: #fff; cursor: default; }
.emdb-cards__page:disabled { opacity: .35; cursor: default; }
.emdb-cards__gap { color: #999; padding: 0 2px; }
.emdb-cards__all { margin-left: 10px; }
.emdb-cards__nav-info { width: 100%; text-align: center; font-size: 11px; color: var(--cards-muted); }

/* ---- ページ別の調整（必要になったらここに足す） ---- */
/* .emdb-cards--creator {} */
/* .emdb-cards--brand {} */
/* .emdb-cards--game {} */
/* .emdb-cards--game-list {} */

/* ---- カード内の折りたたみ（スタッフ / 他のゲーム） ---- */
.emdb-card .emdb-card__toggle {
	display: inline-block;
	margin: 2px 0 0;
	padding: 2px 8px;
	border: 1px dashed #ccc;
	border-radius: 3px;
	background: #fff;
	color: var(--cards-muted);
	font: inherit;
	font-size: 11px;
	line-height: 1.4;
	cursor: pointer;
}
.emdb-card .emdb-card__toggle:hover { color: var(--cards-accent); border-color: var(--cards-accent); }
.emdb-card .emdb-card__toggle[aria-expanded="true"] { border-style: solid; }
.emdb-card .emdb-card__toggle--inline { margin: 0 0 0 6px; padding: 0 6px; }
.emdb-card__more { display: contents; }
.emdb-card__more[hidden] { display: none; }
.emdb-card__more .emdb-card__row { margin-top: 4px; }

/* 楽曲: 行の一番下に関連ゲーム（代表 1 件＋「他 n 件」、ラベルなし） */
.emdb-card__games { font-size: 11px; color: var(--cards-muted); margin-top: 6px; line-height: 1.5; }
.emdb-card__games .emdb-card__more .emdb-card__game { display: block; }
.emdb-card__game .emdb-card__sub { color: #999; }

/* ---- ツールバー（カード / リスト切替） ---- */
.emdb-cards__toolbar { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
.emdb-cards__viewbtns { display: inline-flex; border: 1px solid var(--cards-line); border-radius: 4px; overflow: hidden; }
.emdb-cards .emdb-cards__view {
	width: 34px; height: 30px;
	border: 0; background: #fff; color: #888;
	cursor: pointer; font-size: 13px; line-height: 30px; padding: 0;
}
.emdb-cards .emdb-cards__view + .emdb-cards__view { border-left: 1px solid var(--cards-line); }
.emdb-cards .emdb-cards__view[aria-pressed="true"] { background: var(--cards-accent); color: #fff; cursor: default; }

/* ---- リスト表示（PC で楽曲・ゲームの既定。横長カードを縦に並べる） ---- */
.emdb-cards[data-view="list"] .emdb-cards__grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.emdb-cards[data-view="list"] .emdb-card { flex-direction: row; align-items: stretch; }
.emdb-cards[data-view="list"] .emdb-card__thumb { flex: none; width: 200px; aspect-ratio: 16 / 9; align-self: stretch; }
.emdb-cards[data-view="list"] .emdb-card--game .emdb-card__thumb { width: 220px; min-height: 160px; aspect-ratio: auto; }
.emdb-cards[data-view="list"] .emdb-card--game .emdb-card__thumb img { max-height: 310px; }
.emdb-cards[data-view="list"] .emdb-card__body { padding: 10px 14px; }
/* 詳細ボタンは表示形式が変わっても常に本文の最下部・横幅いっぱい（位置が動かないように） */
.emdb-cards[data-view="list"] .emdb-card .emdb-card__btn { min-height: 34px; }
/* 楽曲の横形式: 歌・作詞・作曲…を横に並べ、ラベルは固定幅にしない */
.emdb-cards[data-view="list"] .emdb-card--music .emdb-card__meta { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
.emdb-cards[data-view="list"] .emdb-card--music .emdb-card__row { display: inline-flex; grid-template-columns: none; gap: 6px; }
.emdb-cards[data-view="list"] .emdb-card--music .emdb-card__label { width: auto; text-align: left; white-space: nowrap; }
/* リスト表示でもスマホは縦積み */
@media screen and (max-width: 560px) {
	.emdb-cards[data-view="list"] .emdb-card { flex-direction: column; }
	.emdb-cards[data-view="list"] .emdb-card__thumb { width: auto; }
	.emdb-cards[data-view="list"] .emdb-card--game .emdb-card__thumb { min-height: 0; }
	.emdb-cards[data-view="list"] .emdb-card--game .emdb-card__thumb img { max-height: 70vw; }
}

/* ---- creator ページ: セクション移動ナビ（追従） ---- */
.emdb-cards-jump {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 1.2em;
	padding: 8px 0;
	background: rgba(255, 255, 255, .96);
	border-bottom: 1px solid var(--cards-line, #e5e5e5);
}
.emdb-cards-jump a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid #e5e5e5;
	border-radius: 999px;
	background: #fff;
	color: #444;
	font-size: 13px;
	text-decoration: none;
}
.emdb-cards-jump a b { font-weight: bold; color: #e9608a; }
.emdb-cards-jump a:hover { border-color: #e9608a; color: #e9608a; }
.emdb-cards__heading { scroll-margin-top: 60px; }
