/**
 * 2択のクイズの問題1問（template-parts/quiz-card.php）。
 * クイズのページで、ページ用の CSS（tools/yasai-quiz.css）より先に読む。1rem = 10px。
 *
 * トップのツール欄のカードに合わせ、淡いタイルに白い丸を置いた線画アイコン・左そろえにする。
 * アイコンの色は難易度ごと（初級は黄緑・中級は青・上級はピンク。ツール欄の3色と同じ）。
 * 正解・不正解の印だけ、黄緑とコーラルを使う。
 * 答えと解説は、JS が動くとき（html に .js があるとき）だけ答えるまで隠す。
 */

.qz-card {
	--qz-tile: var(--c-tint-lime);
	--qz-icon: #5fae14;
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	padding: clamp(18px, 3vw, 28px);
	border-radius: var(--radius);
	background: #fff;
	box-shadow: 0 0 0 1px var(--c-line);
	scroll-margin-top: calc(var(--header-h) + 92px); /* 「次の問題へ」で移ったとき、上のバーに隠れないように */
}

.qz-card--blue {
	--qz-tile: var(--c-tint-blue);
	--qz-icon: var(--c-blue-ink);
}

.qz-card--coral {
	--qz-tile: var(--c-tint-coral);
	--qz-icon: #e86a9a;
}

.qz-card :where(p) {
	margin: 0;
}

.qz-card__head {
	display: flex;
	align-items: center;
	gap: 14px;
}

/* トップのツール欄（.tool-card__icon）と同じ、淡いタイルに白い丸のアイコン。 */
.qz-card__icon {
	display: grid;
	flex: none;
	place-items: center;
	width: 60px;
	aspect-ratio: 1;
	border-radius: 14px;
	background: var(--qz-tile);
}

.qz-card__badge {
	display: grid;
	place-items: center;
	width: 66%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 6px 14px rgba(30, 35, 40, 0.07);
	rotate: -6deg;
}

.qz-card__badge svg {
	width: 58%;
	height: 58%;
	fill: none;
	stroke: var(--qz-icon);
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.qz-card__meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.qz-card__tag {
	color: var(--c-ink-3);
	font-size: 1.2rem;
	line-height: 1.6;
	letter-spacing: 0.06em;
}

.qz-card__num {
	font-family: var(--font-en);
	font-size: 1.8rem;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.02em;
}

.qz-card__q {
	font-size: clamp(1.7rem, 2vw, 1.9rem);
	font-weight: 700;
	line-height: 1.7;
	letter-spacing: 0.02em;
}

/* Choices
   -------------------------------------------------------------------------- */
.qz-card__choices {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.qz-card__choice {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 56px;
	margin: 0;
	padding: 10px 16px 10px 12px;
	border: 1px solid var(--c-line-2);
	border-radius: var(--radius-s);
	background: #fff;
	color: var(--c-ink);
	font: 500 1.5rem/1.5 var(--font-ja);
	text-align: left;
	cursor: pointer;
	touch-action: manipulation;
	transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.qz-card__key {
	display: grid;
	flex: none;
	place-items: center;
	width: 30px;
	height: 30px;
	border: 1px solid var(--c-line-2);
	border-radius: 50%;
	font-family: var(--font-en);
	font-size: 1.4rem;
	font-weight: 600;
	transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.qz-card__text {
	flex: 1;
	min-width: 0;
}

.qz-card__mark {
	flex: none;
	font-size: 1.2rem;
	font-weight: 700;
	letter-spacing: 0.06em;
}

.qz-card__mark:empty {
	display: none;
}

.qz-card:not([data-result]) .qz-card__choice:hover {
	border-color: var(--c-ink);
	box-shadow: var(--shadow);
}

.qz-card:not([data-result]) .qz-card__choice:hover .qz-card__key {
	border-color: var(--c-ink);
	background: var(--c-ink);
	color: #fff;
}

/* 答えたあと：正解の選択肢を黄緑、選んだまちがいをコーラルにして、ほかは薄くする。 */
.qz-card[data-result] .qz-card__choice {
	cursor: default;
}

.qz-card[data-result] .qz-card__choice:not(.is-correct, .is-wrong) {
	opacity: 0.5;
}

.qz-card__choice.is-correct {
	border-color: var(--c-lime-ink);
	background: var(--c-tint-lime);
}

.qz-card__choice.is-correct :is(.qz-card__key, .qz-card__mark) {
	color: var(--c-lime-ink);
}

.qz-card__choice.is-correct .qz-card__key {
	border-color: var(--c-lime-ink);
	background: var(--c-lime-ink);
	color: #fff;
}

.qz-card__choice.is-wrong {
	border-color: var(--c-coral-ink);
	background: var(--c-tint-coral);
}

.qz-card__choice.is-wrong .qz-card__mark {
	color: var(--c-coral-ink);
}

.qz-card__choice.is-wrong .qz-card__key {
	border-color: var(--c-coral-ink);
	background: var(--c-coral-ink);
	color: #fff;
}

/* Result (answer and comment)
   -------------------------------------------------------------------------- */
.qz-card__result {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 16px;
	border-top: 1px solid var(--c-line);
}

.js .qz-card__result:not(.is-open) {
	display: none;
}

.js .qz-card__result.is-open {
	animation: qz-open 0.4s var(--ease);
}

@keyframes qz-open {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
}

.qz-card__result:focus {
	outline: none;
}

.qz-card__verdict {
	color: var(--c-ink-3);
	font-size: 1.3rem;
	font-weight: 700;
	letter-spacing: 0.08em;
}

.qz-card[data-result="ok"] .qz-card__verdict {
	color: var(--c-lime-ink);
}

.qz-card[data-result="ng"] .qz-card__verdict {
	color: var(--c-coral-ink);
}

.qz-card__answer {
	display: flex;
	align-items: baseline;
	gap: 12px;
	font-size: clamp(1.9rem, 2.2vw, 2.2rem);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.02em;
}

.qz-card__answer-key {
	flex: none;
	font-family: var(--font-en);
	font-weight: 600;
}

.qz-card__comment {
	color: var(--c-ink-2);
	font-size: 1.5rem;
	line-height: 1.9;
}

.qz-card .qz-card__next {
	display: inline-flex;
	align-items: center;
	align-self: flex-end;
	gap: 10px;
	margin-top: 4px;
	padding-bottom: 4px;
	border-bottom: 1px solid var(--c-line-2);
	color: var(--c-ink);
	font-size: 1.4rem;
	font-weight: 500;
	text-decoration: none;
	transition: border-color 0.3s var(--ease);
}

.qz-card__next .icon {
	width: 16px;
	height: 16px;
	rotate: 90deg; /* 下の問題へ進むので下向き */
	transition: translate 0.35s var(--ease);
}

.qz-card .qz-card__next:hover {
	border-color: var(--c-ink);
	color: var(--c-ink);
}

.qz-card__next:hover .icon {
	translate: 0 3px;
}

html:not(.js) .qz-card__next {
	display: none;
}

.qz-card :is(button, a):focus-visible {
	outline: 2px solid var(--c-blue);
	outline-offset: 2px;
}

/* 問題の並び（1列） */
.qz-list {
	display: grid;
	gap: 20px;
}

@media (max-width: 599px) {
	.qz-card {
		gap: 14px;
	}

	.qz-card__icon {
		width: 52px;
		border-radius: 12px;
	}

	.qz-card__choices {
		grid-template-columns: minmax(0, 1fr);
		gap: 8px;
	}

	.qz-card__choice {
		min-height: 52px;
	}
}
