body {
	font-family:
		"Segoe UI", Tahoma, Geneva, Verdana, sans-serif; /* Font bawaan yang lebih modern dari sans-serif biasa */
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 2rem;
	background-color: #f8f9fa; /* Abu-abu sangat terang, lebih bersih dari #f0f0f0 */
	color: #334155; /* Abu-abu tua (slate), lebih nyaman dibaca daripada hitam pekat */
}
#header {
	/* position: fixed; */
	top: 0;
	width: 100%;
	z-index: 1000;
	background-color: white;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header {
	background: #4f46e5; /* Biru Indigo modern, menggantikan ungu terang #6200ea */
	color: #fff;
	padding: 1rem;
	text-align: center;
}

nav {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	margin: 0;
	padding: 1rem 0;
	background: #ffffff; /* Navigasi putih terlihat jauh lebih bersih dan modern */
	border-bottom: 1px solid #e2e8f0; /* Garis batas tipis di bawah navigasi */
}

nav > div {
	display: flex;
	flex-direction: column;
	align-items: center;
}

nav > div > div {
	display: flex;
	flex-direction: row;
	gap: 5px;
}

nav button {
	margin: 5px 0;
	padding: 10px 15px;
	border: 1px solid #e2e8f0; /* Tambahan garis pinggir tipis */
	border-radius: 8px; /* Sudut lebih melengkung */
	cursor: pointer;
	background: #f1f5f9; /* Latar tombol abu-abu sangat muda */
	color: #4f46e5; /* Teks disamakan dengan warna header */
	font-weight: bold;
	transition: all 0.2s ease;
}

nav button:hover {
	background: #4f46e5;
	color: white;
	border-color: #4f46e5;
}

#typeFilter {
	padding: 9px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background-color: #f8fafc;
	color: #334155;
	font-weight: 600;
	cursor: pointer;
}

.listkanji {
	width: 100%;
	max-width: 600px;
	background: #ffffff;
	border-radius: 12px;
	border: 1px solid #e2e8f0;
	padding: 1rem 1.5rem;
	box-sizing: border-box;
}

.listkanji > div {
	padding: 0.65rem 0;
	border-bottom: 1px solid #f1f5f9;
	line-height: 1.8; /* Menjaga jarak antarbaris tetap rapi meski ada furigana */
}

.listkanji > div:last-child {
	border-bottom: none;
}

@media (min-width: 600px) {
	nav {
		flex-direction: row; /* Kembali ke tata letak baris pada layar yang lebih lebar */
		justify-content: center;
		align-items: center;
	}

	nav > div {
		flex-direction: row;
	}

	nav > div > div {
		flex-direction: row;
	}

	nav button {
		margin: 0 5px; /* Kembali ke margin horizontal */
	}

	#typeFilter {
		margin-left: 10px;
	}
}

.content {
	display: flex;
	flex-direction: column;
	align-items: center;
}
.flipkanji {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.toggle-container {
	margin-bottom: 1rem;
	margin-top: 0.5rem;
	align-items: center;
	text-align: center;
}

.cards-container {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: center;
}

.card {
	width: 180px;
	height: 220px;
	perspective: 1000px;
}

.card-inner {
	position: relative;
	width: 100%;
	height: 100%;
	text-align: center;
	transition: transform 0.6s;
	transform-style: preserve-3d;
	cursor: pointer;
	border-radius: 12px;
}

.card.flipped .card-inner {
	transform: rotateY(180deg);
}

.card-front,
.card-back {
	position: absolute;
	width: 100%;
	height: 100%;
	box-sizing: border-box; /* Mencegah padding membuat kartu melebar keluar bingkai */
	padding: 0.75rem;
	backface-visibility: hidden;
	border-radius: 16px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 1px solid #e2e8f0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	background: #ffffff;
	color: #1e293b;
}

.card-front .kanji {
	font-size: 2.1rem; /* Sedikit diperkecil dari 2.5rem agar muat 4 kanji seperti 国際交流 */
	font-weight: bold;
	line-height: 1.5; /* Memberi ruang vertikal untuk furigana di atas kanji */
	word-break: keep-all;
}

.card-front .hiragana {
	font-size: 1rem;
	color: #64748b; /* Warna hiragana dilembutkan agar Kanji lebih menonjol */
	margin-top: 0.5rem;
}

.card-back {
	background-color: white;
	transform: rotateY(180deg);
	transform-style: preserve-3d; /* Wajib agar tombol anak tidak tenggelam di belakang background */
	font-size: 1.1rem;
	padding: 1rem;
}

.card-back .hiragana {
	font-size: 1.35rem;
	font-weight: bold;
	color: #4f46e5;
	margin-bottom: 0.6rem;
	line-height: 1.5;
}

.card-back .arti {
	font-size: 1rem;
	color: #334155;
	line-height: 1.4;
}

.card.selected .card-inner {
	border: 2px solid #10b981; /* Hijau Emerald elegan, menggantikan rgb(10, 218, 10) yang terlalu neon */
	border-radius: 16px;
}

.info-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: none;
	background: #4f46e5;
	color: white;
	font-weight: bold;
	font-size: 0.9rem;
	cursor: pointer;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	backface-visibility: hidden; /* Sembunyikan otomatis saat kartu menghadap depan */
	transform: translateZ(
		2px
	); /* Angkat tombol ke depan permukaan kartu belakang */
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 0.25s ease,
		background 0.2s ease;
}

.card.flipped .info-btn {
	opacity: 1;
	pointer-events: auto;
}

.info-btn:hover {
	background: #3730a3;
}
.modal {
	display: none;
	position: fixed;
	z-index: 9999;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background: rgba(
		15,
		23,
		42,
		0.6
	); /* Overlay biru kehitaman transparan, lebih elegan dari hitam murni */
	backdrop-filter: blur(
		4px
	); /* Efek blur pada latar belakang (opsional, sangat modern) */
}

.modal-content {
	background: white;
	margin: 5% auto;
	padding: 20px;
	width: 90%;
	max-width: 700px;
	max-height: 80vh;
	overflow-y: auto;
	border-radius: 12px;
}

.close-modal {
	float: right;
	font-size: 24px;
	cursor: pointer;
}

/* =========================================
   STYLING UNTUK BAGIAN QUIZ
   ========================================= */

.quizkanji {
	width: 100%;
	max-width: 600px;
	background: white;
	border-radius: 12px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
	padding: 2rem;
	margin-top: 1rem;
	text-align: center;
	box-sizing: border-box;
}

.quizkanji h2,
.quizkanji h3 {
	color: #4f46e5; /* Menyesuaikan tema */
	margin-top: 0;
	margin-bottom: 1rem;
}

.quizkanji p {
	font-size: 1.5rem;
	font-weight: bold;
	margin-bottom: 0.5rem;
	color: #1e293b;
}

.quizkanji small {
	display: block;
	color: #64748b;
	font-size: 1rem;
	margin-bottom: 1.5rem;
	font-style: italic;
}

/* Styling Tombol di Area Quiz & Setup */
#quizSetup button,
#quizArea button,
#quizResult > div > button {
	background: #ffffff; /* Latar putih */
	color: #475569; /* Teks kalem */
	border: 2px solid #cbd5e1; /* Border abu-abu */
	border-radius: 12px;
	padding: 12px 20px;
	margin: 8px;
	font-size: 1.1rem;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.2s ease;
	width: calc(100% - 16px);
	max-width: 250px;
}

#quizSetup button:hover,
#quizArea button:hover,
#quizResult > div > button:hover {
	background: #eef2ff; /* Efek biru muda saat disentuh */
	color: #4f46e5; /* Teks berubah biru indigo */
	border-color: #4f46e5; /* Border berubah biru */
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15); /* Bayangan biru halus */
}

/* Styling Card Hasil Quiz */
.result-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 1.5rem;
	margin-bottom: 1.5rem;
	text-align: left;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03); /* Bayangan sangat kalem */
}

.result-card h4 {
	margin-top: 0;
	color: #4f46e5;
	border-bottom: 2px solid #f1f5f9;
	padding-bottom: 10px;
}

.result-card p {
	font-size: 1.2rem;
	margin-bottom: 15px;
}

/* Memperbaiki tampilan pilihan jawaban di hasil */
.result-card div[style*="background"] {
	border-radius: 8px !important;
	font-weight: bold;
	font-size: 1.1rem;
	padding: 10px !important;
	margin: 8px 0 !important;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

ruby {
	ruby-align: center;
}

rt {
	font-size: 0.42em;
	color: #64748b;
	font-weight: normal;
	line-height: 1;
}

/* =========================================
   STYLING UNTUK MODE QUESTION (IRODORI)
   ========================================= */
.questionkanji {
	width: 100%;
	max-width: 650px;
	margin-top: 1rem;
}

.questionkanji .hidden {
	display: none !important;
}

.irodori-card {
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
	border: 1px solid #e2e8f0;
	padding: 1.5rem 2rem;
}

.irodori-header {
	border-bottom: 1px solid #e2e8f0;
	padding-bottom: 1rem;
	margin-bottom: 1.5rem;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}

.irodori-header h2 {
	margin: 0;
	font-size: 1.25rem;
	color: #1e293b;
}

.irodori-subtitle {
	margin: 4px 0 0 0;
	font-size: 0.875rem;
	color: #64748b;
}

#chapter-select {
	border: 1px solid #cbd5e1;
	border-radius: 10px;
	padding: 8px 12px;
	font-size: 0.9rem;
	font-weight: 600;
	color: #334155;
	background-color: #f8fafc;
	cursor: pointer;
}

.irodori-questions {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	font-size: 1.2rem;
	line-height: 1.8;
}

.question-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.question-no {
	font-weight: 600;
	color: #4f46e5;
}

.question-lines {
	flex: 1;
}

.line-block {
	margin-bottom: 0.75rem;
}

.line-block:last-child {
	margin-bottom: 0;
}

/* Kata target bergaris bawah yang diklik */
.target-word {
	border-bottom: 2px solid #4f46e5;
	padding: 0 3px;
	cursor: pointer;
	font-weight: 600;
	color: #1e293b;
	border-radius: 4px 4px 0 0;
	transition: background-color 0.2s;
}

.target-word:hover,
.target-word.active-slot {
	background-color: #eef2ff;
	color: #4f46e5;
}

.brackets-row {
	margin-top: 4px;
	margin-left: 6px;
	font-size: 1rem;
	color: #475569;
}

.ans-slot {
	font-weight: 700;
	color: #4f46e5;
	display: inline-block;
	min-width: 2.2rem;
	text-align: center;
}

.ans-correct {
	color: #16a34a !important;
}
.ans-wrong {
	color: #dc2626 !important;
}

.feedback-badge {
	margin-left: 4px;
	margin-right: 8px;
	font-size: 0.85rem;
	font-weight: bold;
}

.meaning-text {
	margin-top: 6px;
	margin-left: 6px;
	font-size: 0.9rem;
	color: #475569;
	background: #f1f5f9;
	border-left: 3px solid #4f46e5;
	padding: 6px 10px;
	border-radius: 0 6px 6px 0;
}

/* Modal Pilihan Kanji */
.irodori-modal {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(3px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 1rem;
}

.irodori-modal-box {
	background: #ffffff;
	border: 2px solid #4f46e5;
	border-radius: 20px;
	padding: 1.5rem;
	max-width: 500px;
	width: 100%;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.irodori-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: #64748b;
}

#close-choice-modal {
	background: none;
	border: none;
	font-size: 1.5rem;
	color: #64748b;
	cursor: pointer;
	line-height: 1;
}

#choices-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
}

@media (min-width: 600px) {
	#choices-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.choice-item-btn {
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid #cbd5e1;
	background: #ffffff;
	text-align: left;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 1rem;
	transition: all 0.15s ease;
}

.choice-item-btn:hover {
	border-color: #4f46e5;
	background: #eef2ff;
}

.choice-item-btn.selected-choice {
	border: 2px solid #4f46e5;
	background: #eef2ff;
	color: #4f46e5;
	font-weight: bold;
}

.choice-label {
	font-size: 0.85rem;
	color: #64748b;
}

.choice-used {
	text-decoration: line-through;
	text-decoration-thickness: 2px;
	text-decoration-color: #ef4444;
	color: #94a3b8;
}

/* Footer & Tombol Aksi */
.irodori-footer {
	margin-top: 2rem;
	padding-top: 1rem;
	border-top: 1px solid #e2e8f0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}

.irodori-actions {
	display: flex;
	gap: 10px;
}

#reset-btn {
	padding: 10px 16px;
	border-radius: 10px;
	border: 1px solid #cbd5e1;
	background: #ffffff;
	color: #475569;
	font-weight: 600;
	cursor: pointer;
}

#reset-btn:hover {
	background: #f1f5f9;
}

#submit-btn {
	padding: 10px 20px;
	border-radius: 10px;
	border: none;
	background: #4f46e5;
	color: #ffffff;
	font-weight: 600;
	cursor: pointer;
}

#submit-btn:hover:not(:disabled) {
	background: #4338ca;
}

#submit-btn:disabled {
	background: #cbd5e1;
	color: #64748b;
	cursor: not-allowed;
}

#next-btn {
	padding: 10px 18px;
	border-radius: 10px;
	border: none;
	background: #10b981;
	color: #ffffff;
	font-weight: 600;
	cursor: pointer;
}

#next-btn:hover {
	background: #059669;
}

#result-box {
	margin-top: 1.5rem;
	padding: 1rem;
	border-radius: 12px;
	background: #eef2ff;
	border: 1px solid #c7d2fe;
	text-align: center;
}

.result-label {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: #4f46e5;
}

#score-text {
	margin: 4px 0;
	font-size: 2rem;
	font-weight: 800;
	color: #1e1b4b;
}

#detail-text {
	margin: 0;
	font-size: 0.85rem;
	color: #4338ca;
}

.chapter-count-badge {
	display: inline-block;
	font-size: 0.78rem;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	margin-left: 6px;
	vertical-align: middle;
	border: 1px solid transparent;
}

.chapter-count-badge.tier-1 {
	background-color: #e0f2fe;
	color: #0369a1;
	border-color: #7dd3fc;
}

.chapter-count-badge.tier-2 {
	background-color: #dcfce7;
	color: #15803d;
	border-color: #86efac;
}

.chapter-count-badge.tier-3 {
	background-color: #fef3c7;
	color: #b45309;
	border-color: #fcd34d;
}

.chapter-count-badge.tier-5 {
	background-color: #f3e8ff;
	color: #7e22ce;
	border-color: #d8b4fe;
}
