/* ============================================================
   ranking.css  — ランキングページ専用スタイル
   ============================================================ */

.ranking_wrapper {
	flex: 1;
	overflow-y: auto;
}

.ranking_body {
	max-width: 640px;
	margin: 20px auto 40px;
	padding: 20px 14px 28px;
	border: 1px solid rgba(222, 216, 236, 0.86);
	border-radius: 16px;
}

@media (min-width: 601px) {
	.ranking_mode_score .ranking_body,
	.ranking_mode_steps .ranking_body {
		max-width: 860px;
	}
}

/* ---- ランキング操作 ---- */

.ranking_filter_form {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	flex-wrap: wrap;
	background: rgba(247, 245, 251, 0.78);
	border: 1px solid #9fc9dd;
	border-radius: 6px;
	padding: 10px 12px;
	margin-bottom: 16px;
	box-shadow: inset 0 1px 0 rgba(75, 161, 207, 0.12), 0 2px 6px rgba(65, 122, 145, 0.10);
}

.ranking_filter_form label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1 1 150px;
	min-width: 0;
}

.ranking_filter_form span {
	color: #4d8fb4;
	font-size: 0.85rem;
	font-weight: 600;
	white-space: nowrap;
}

.ranking_filter_form select {
	width: 100%;
	background: rgba(255, 255, 255, 0.74);
	color: #3f3a4d;
	border: 1px solid #9fc9dd;
	border-radius: 4px;
	padding: 7px 28px 7px 10px;
	font-size: 0.9rem;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234d8fb4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	transition: border-color 0.15s;
}

.ranking_filter_form select:hover,
.ranking_filter_form select:focus {
	border-color: #4d8fb4;
	outline: none;
}

.ranking_apply_btn {
	flex: 0 0 auto;
	background: #3ba7cf;
	color: #ffffff;
	border: 1px solid #2d8fb6;
	border-radius: 4px;
	padding: 7px 18px;
	font-size: 0.92rem;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.ranking_apply_btn:hover,
.ranking_apply_btn:focus {
	background: #2d8fb6;
	border-color: #247899;
}

/* ---- ランキングリスト ---- */

.ranking_list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ranking_my_box {
	margin-bottom: 18px;
}

.ranking_filter_box {
	margin-bottom: 16px;
}

.ranking_section_title {
	margin: 0 0 8px;
	color: #4d8fb4;
	font-size: 0.92rem;
	font-weight: 700;
}

.ranking_filter_heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.ranking_filter_toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	background: rgba(238, 250, 255, 0.94);
	border: 1px solid #9fc9dd;
	border-radius: 4px;
	color: #4d8fb4;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ranking_filter_toggle:hover {
	border-color: #2d8fb6;
	color: #2d8fb6;
}

.ranking_filter_toggle:focus {
	outline: none;
}

.ranking_filter_toggle[aria-expanded="true"] {
	background: #3ba7cf;
	border-color: #2d8fb6;
	color: #ffffff;
}

.ranking_filter_toggle svg {
	display: block;
}

.ranking_my_entry {
	border-color: rgba(59, 167, 207, 0.65);
	background: rgba(238, 250, 255, 0.94);
	box-shadow: 0 3px 12px rgba(59, 167, 207, 0.16);
}

.ranking_entry {
	position: relative;
	display: grid;
	grid-template-columns: 48px 60px minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 10px;
	row-gap: 0;
	padding: 12px 14px 12px 10px;
	border: 1px solid rgba(212, 235, 244, 0.86);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.78);
	box-shadow: 0 2px 8px rgba(83, 128, 145, 0.10);
	transition: background 0.12s, border-color 0.12s;
}

.ranking_entry_has_result {
	grid-template-columns: 48px 60px minmax(0, 1fr) minmax(170px, 0.8fr) auto;
	grid-template-areas: "rank icon info result score";
}

.ranking_entry_steps_result {
	grid-template-columns: 48px 60px minmax(0, 1fr) minmax(170px, 0.8fr) auto;
	grid-template-areas: "rank icon info result score";
}

.ranking_entry:hover {
	background: rgba(245, 253, 255, 0.92);
	border-color: rgba(80, 202, 216, 0.5);
}

/* ---- 順位バッジ ---- */

.ranking_badge {
	grid-column: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.75rem;
	font-weight: 900;
	font-style: italic;
	border-radius: 6px;
	width: 42px;
	height: 42px;
	color: #fff;
	letter-spacing: 0.02em;
	text-shadow:
		1px 2px 0 rgba(74, 61, 104, 0.14),
		2px 4px 6px rgba(74, 61, 104, 0.10);
}

.rank_1 .ranking_badge {
	background: linear-gradient(135deg, #e8c050 0%, #c8a030 50%, #a07820 100%);
	box-shadow: 0 0 12px rgba(200, 160, 48, 0.5), inset 0 1px 0 rgba(255, 240, 160, 0.4);
}

.rank_2 .ranking_badge {
	background: linear-gradient(135deg, #90a8c8 0%, #6e8ab0 50%, #4e6888 100%);
	box-shadow: 0 0 10px rgba(110, 138, 176, 0.4), inset 0 1px 0 rgba(200, 220, 255, 0.35);
}

.rank_3 .ranking_badge {
	background: linear-gradient(135deg, #d89858 0%, #c07840 50%, #905828 100%);
	box-shadow: 0 0 10px rgba(192, 120, 64, 0.4), inset 0 1px 0 rgba(255, 210, 160, 0.35);
}

.rank_other .ranking_badge {
	background: linear-gradient(135deg, #b8c8b5 0%, #8ca58b 50%, #6f8f72 100%);
	box-shadow: inset 0 1px 0 rgba(111, 143, 114, 0.18);
}

/* ---- アイコン ---- */

.ranking_icon {
	grid-column: 2;
	width: 56px;
	height: 56px;
}

.ranking_icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}

.ranking_icon_placeholder {
	width: 100%;
	height: 100%;
	border-radius: 4px;
	background: rgba(237, 233, 246, 0.78);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #aaa4b8;
	font-size: 2rem;
}

/* ---- 名前 + 称号 ---- */

.ranking_info {
	grid-column: 3;
	display: grid;
	grid-template-rows: auto auto;
	gap: 6px;
	align-content: center;
	min-width: 0;
}

.ranking_name {
	font-size: 1.22rem;
	font-weight: 700;
	color: #332f3f;
	line-height: 1.1;
	letter-spacing: 0.01em;
}

.ranking_title_btn {
	display: inline-block;
	align-self: flex-start;
	padding: 3px 18px;
	font-size: 0.82rem;
	background: #8e7cc3;
	border: none;
	border-radius: 4px;
	color: #fff;
	cursor: default;
}

.ranking_info .title_badge {
	--title_h: clamp(1.5rem, 2.1vw, 2rem);
	justify-self: start;
	max-width: 100%;
}

@media (max-width: 600px) {
	.ranking_info .title_badge {
		--title_h: clamp(1.15rem, 5vw, 1.45rem);
	}
}

/* ---- スコア ---- */

.ranking_score_wrap {
	grid-column: 4;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	min-width: 82px;
}

.ranking_score_label {
	font-size: 0.78rem;
	color: #7b7489;
}

.ranking_score {
	font-size: 1.5rem;
	font-weight: 700;
	color: #25bfc7;
	letter-spacing: 0.02em;
}

.ranking_entry_has_result .ranking_score_wrap {
	grid-area: score;
}

.ranking_steps_summary {
	min-width: 118px;
	gap: 0;
	line-height: 1;
}

.ranking_steps_line,
.ranking_floor_line {
	display: flex;
	align-items: baseline;
	justify-content: flex-end;
	gap: 7px;
	white-space: nowrap;
}

.ranking_steps_line {
	margin-bottom: 5px;
}

.ranking_steps_value {
	font-size: 0.92rem;
	font-weight: 500;
	color: #7b7489;
}

.ranking_steps_unit {
	font-size: 0.78rem;
	font-weight: 500;
	color: #7b7489;
}

.ranking_floor_value {
	font-size: 1.5rem;
	font-weight: 700;
	color: #25bfc7;
	letter-spacing: 0.01em;
	text-shadow: 0 2px 6px rgba(37, 191, 199, 0.16);
}

.ranking_floor_unit {
	font-size: 0.92rem;
	font-weight: 700;
	color: #5d9edb;
}

.ranking_summary_result {
	font-size: 0.92rem;
	font-weight: 700;
}

.ranking_result_clear {
	color: #32b46a;
}

.ranking_result_retreat {
	color: #7b8490;
}

.ranking_result_lose {
	color: #d44d5c;
}

.ranking_result_unknown {
	color: #7b7489;
}

/* ---- 結果表示 ---- */

.ranking_result_wrap {
	grid-column: 4;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	min-width: 0;
	color: #3f3a4d;
	line-height: 1.35;
}

.ranking_entry_has_result .ranking_result_wrap {
	grid-area: result;
}

.ranking_result_label {
	font-size: 0.78rem;
	color: #7b7489;
}

.ranking_result_text {
	font-size: 0.92rem;
	font-weight: 600;
	word-break: break-word;
}

.ranking_result_text b {
	color: #2d8fb6;
}

/* ---- 空状態 ---- */

.ranking_empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 64px 0;
	color: #7b7489;
}

.ranking_empty .bi {
	font-size: 3rem;
	opacity: 0.4;
}

.ranking_empty p {
	font-size: 1rem;
}

/* ---- モバイル対応 ---- */

@media (max-width: 600px) {
	.ranking_body {
		margin: 18px 10px 32px;
		padding: 14px 10px 24px;
	}

	.ranking_filter_form {
		align-items: stretch;
		gap: 8px;
		max-height: 0;
		overflow: hidden;
		padding-top: 0;
		padding-bottom: 0;
		margin-bottom: 0;
		border-width: 0;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: max-height 0.2s, padding 0.2s, margin 0.2s, border-width 0.2s, opacity 0.15s, visibility 0.2s;
	}

	.ranking_filter_form.ranking_filter_open {
		max-height: 260px;
		padding-top: 10px;
		padding-bottom: 10px;
		margin-bottom: 0;
		border-width: 1px;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.ranking_filter_form label {
		flex-basis: 100%;
	}

	.ranking_apply_btn {
		width: 100%;
	}

	.ranking_filter_toggle {
		display: flex;
	}

	.ranking_entry {
		grid-template-columns: 32px 48px minmax(0, 1fr) auto;
		column-gap: 8px;
		padding: 10px 10px 10px 8px;
	}

	.ranking_entry_has_result {
		grid-template-columns: 32px 48px minmax(0, 1fr) auto;
		grid-template-areas:
			"rank icon info score"
			"result result result result";
		row-gap: 8px;
	}

	.ranking_entry_steps_result {
		grid-template-areas:
			"rank icon info score"
			"result result result result";
	}

	.ranking_icon {
		grid-column: 2;
		position: relative;
		width: 48px;
		height: 48px;
	}

	.ranking_badge {
		position: static;
		width: 30px;
		height: 30px;
		font-size: 1rem;
		border-radius: 5px;
	}

	.ranking_info {
		grid-column: 3;
		gap: 3px;
	}

	.ranking_score_wrap {
		grid-column: 4;
		flex-direction: column;
		align-items: flex-end;
		gap: 2px;
		justify-content: flex-end;
		min-width: 58px;
	}

	.ranking_score_label {
		font-size: 0.72rem;
	}

	.ranking_score {
		font-size: 1.15rem;
	}

	.ranking_entry_has_result .ranking_score_wrap {
		grid-area: score;
	}

	.ranking_steps_summary {
		min-width: 76px;
	}

	.ranking_steps_line {
		margin-bottom: 3px;
		gap: 3px;
	}

	.ranking_floor_line {
		gap: 3px;
	}

	.ranking_steps_value {
		font-size: 0.7rem;
	}

	.ranking_steps_unit {
		font-size: 0.64rem;
	}

	.ranking_floor_value {
		font-size: 1.15rem;
	}

	.ranking_floor_unit,
	.ranking_summary_result {
		font-size: 0.72rem;
	}

	.ranking_entry_has_result .ranking_result_wrap {
		grid-area: result;
		flex-direction: row;
		align-items: center;
		gap: 8px;
		padding: 8px 10px;
		border-top: 1px solid rgba(159, 201, 221, 0.46);
		background: rgba(238, 250, 255, 0.46);
		border-radius: 4px;
	}

	.ranking_result_text {
		font-size: 0.86rem;
	}
}
