/* ==========================================================================
   ランキングカード表示 CSS
   ========================================================================== */

.rk-ranking-wrap {
	--rk-line:      #e4e0d6;
	--rk-head-bg:   #faf6ec;
	--rk-bubble-bg: #26374a;
	--rk-green:     #4caf50;
	--rk-green-dk:  #3d8b40;
	--rk-text:      #333;
	--rk-muted:     #666;

	margin: 24px 0;
}

/* ==========================================================================
   上部コメント（吹き出し）
   ========================================================================== */
.rk-headline {
	display: flex;
	justify-content: center;
	margin: 0 0 20px;
}

.rk-headline__inner {
	position: relative;
	display: inline-block;
	max-width: 100%;
	margin: 0 !important;
	padding: 11px 26px;
	background: var(--rk-bubble-bg);
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: .02em;
	text-align: center;
	border-radius: 6px;
}

/* 吹き出しの尻尾 */
.rk-headline__inner::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 11px 11px 0 11px;
	border-color: var(--rk-bubble-bg) transparent transparent transparent;
	transform: translateX(-50%);
}

.rk-headline__sep {
	margin: 0 .05em;
	opacity: .6;
	font-weight: 400;
}

/* ==========================================================================
   ランキング本体
   ========================================================================== */
.rk-ranking {
	--rk-cols: 3;
	background: #fff;
	border: 1px solid var(--rk-line);
	border-radius: 8px;
	overflow: hidden;
}

.rk-ranking__grid {
	display: grid;
	grid-template-columns: repeat(var(--rk-cols), minmax(0, 1fr));
	grid-template-rows: auto auto auto auto;
}

/* 各カードは4行分のサブグリッド＝列をまたいで行の高さが揃う */
.rk-card {
	display: grid;
	grid-row: 1 / -1;
	grid-template-rows: subgrid;
	min-width: 0;
}

.rk-card + .rk-card {
	border-left: 1px solid var(--rk-line);
}

/* --- 1段目：王冠バッジ＋サイト名 --- */
.rk-card__head {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 4px;
	padding: 14px 10px 12px;
	background: var(--rk-head-bg);
	border-bottom: 1px solid var(--rk-line);
}

.rk-card__badge {
	display: block;
	width: auto;
	height: 52px;
}

.rk-card__name {
	margin: 0 !important;
	padding: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	text-align: center;
	color: var(--rk-text);
}

.rk-card__name-link {
	color: inherit !important;
	text-decoration: none !important;
}

.rk-card__name-link:hover {
	text-decoration: underline !important;
}

/* --- 2段目：バナー＋ボタン --- */
.rk-card__body {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 14px 12px 16px;
}

.rk-card__banner {
	display: block;
	width: 100%;
	max-width: 260px;
	line-height: 0;
}

.rk-card__banner-img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

.rk-card__banner--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	background: #f4f4f4;
	border: 1px dashed #d5d5d5;
	border-radius: 4px;
	color: #aaa;
	font-size: 12px;
	line-height: 1.4;
}

.rk-card__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: auto;
	padding: 11px 22px;
	max-width: 100%;
	background: var(--rk-green);
	color: #fff !important;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	text-decoration: none !important;
	border-radius: 999px;
	box-shadow: 0 3px 6px rgba(0, 0, 0, .22);
	transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.rk-card__btn:hover,
.rk-card__btn:focus-visible {
	background: var(--rk-green-dk);
	color: #fff !important;
	transform: translateY(2px);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
}

.rk-card__btn-arrow {
	font-size: 20px;
	line-height: 1;
	margin-top: -2px;
}

/* --- 3・4段目：スペック --- */
.rk-card__stat {
	padding: 9px 8px;
	border-top: 1px solid var(--rk-line);
	text-align: center;
	color: var(--rk-text);
	line-height: 1.5;
}

.rk-card__stat--rate {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	font-size: 15px;
	font-weight: 500;
}

.rk-card__stat-text {
	display: inline-block;
}

/* 数値＋固定単位（% / 分）の強調。
   「90%」と「5分」で同じサイズになるよう固定値で指定している。
   テーマ側の span へのフォント指定に負けないよう詳細度を上げている */
.rk-ranking-wrap .rk-card__stat-em {
	display: inline-block;
	font-size: 20px !important;
	font-weight: 700 !important;
	line-height: 1.1;
	vertical-align: -.05em;
	letter-spacing: 0;
}

.rk-card__stat-icon {
	display: inline-flex;
	align-items: center;
	color: #4a5b6b;
}

.rk-card__stat-icon svg {
	display: block;
}

.rk-card__stat-head {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	margin: 0 0 2px !important;
	font-size: 14px;
	color: var(--rk-text);
}

.rk-card__stat-value {
	margin: 0 !important;
}

.rk-card__stat-value--lg {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.35;
}

.rk-card__stat-empty {
	color: #bbb;
}

/* --- 下部注釈（表の外に配置） --- */
.rk-ranking__note {
	margin: 12px 0 0 !important;
	padding: 0 2px;
	font-size: 12px;
	line-height: 1.6;
	text-align: center;
	color: var(--rk-muted);
}

/* --- ドットナビ（SPのみ表示） --- */
.rk-dots {
	display: none;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
}

.rk-dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #ccc;
	cursor: pointer;
	transition: background-color .2s ease, transform .2s ease;
}

.rk-dot.is-active {
	background: var(--rk-green);
	transform: scale(1.25);
}

/* --- エラー --- */
.rk-error {
	padding: 8px 12px;
	background: #fff0f0;
	border-left: 3px solid #c00;
	color: #c00;
	font-size: 13px;
}

/* ==========================================================================
   subgrid 非対応ブラウザ向けフォールバック
   ========================================================================== */
@supports not (grid-template-rows: subgrid) {
	.rk-card {
		display: flex;
		flex-direction: column;
	}
	.rk-card__body {
		flex: 1 1 auto;
	}
}

/* ==========================================================================
   SP：横スクロールスライダー
   ========================================================================== */
@media (max-width: 600px) {
	.rk-ranking {
		background: transparent;
		border: none;
		border-radius: 0;
		overflow: visible;
	}

	.rk-ranking__grid {
		display: flex;
		flex-wrap: nowrap;
		gap: 12px;
		overflow-x: auto;
		padding: 2px 2px 8px;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.rk-ranking__grid::-webkit-scrollbar {
		display: none;
	}

	.rk-card {
		display: flex;
		flex-direction: column;
		flex: 0 0 83%;
		max-width: 83%;
		min-width: 0;
		background: #fff;
		border: 1px solid var(--rk-line);
		border-radius: 8px;
		overflow: hidden;
		scroll-snap-align: start;
	}

	.rk-card + .rk-card {
		border-left: 1px solid var(--rk-line);
	}

	.rk-card__body {
		flex: 1 1 auto;
	}

	.rk-ranking__note {
		margin-top: 10px !important;
		text-align: left;
	}

	.rk-headline__inner {
		font-size: 14px;
		padding: 10px 18px;
	}

	.rk-card__name {
		font-size: 15px;
	}

	.rk-dots {
		display: flex;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rk-card__btn,
	.rk-dot {
		transition: none;
	}
	.rk-card__btn:hover,
	.rk-card__btn:focus-visible {
		transform: none;
	}
}
