/**
 * EduGame front-end CSS — gaya ceria warna-warni 🌈
 */

:root {
	--eg-purple: #7c3aed;
	--eg-pink: #ec4899;
	--eg-orange: #f97316;
	--eg-green: #22c55e;
	--eg-blue: #3b82f6;
	--eg-yellow: #facc15;
	--eg-red: #ef4444;
	--eg-dark: #2b2344;
	--eg-bg: #faf5ff;
}

/* ============ WADAH GAME ============ */

.edugame-game {
	background: linear-gradient(160deg, #fdf2f8 0%, #ede9fe 45%, #ecfeff 100%);
	border: 3px solid #e9d5ff;
	border-radius: 28px;
	padding: 26px 22px;
	max-width: 760px;
	margin: 28px auto;
	font-family: 'Comic Sans MS', 'Segoe UI', 'Trebuchet MS', system-ui, sans-serif;
	color: var(--eg-dark);
	position: relative;
	overflow: hidden;
	box-shadow: 0 14px 40px rgba(124, 58, 237, 0.16);
}

.edugame-empty-note {
	text-align: center;
	color: #7c3aed;
	background: #fff;
	border-radius: 14px;
	padding: 14px;
}

/* ============ INTRO ============ */

.eg-intro { text-align: center; }

.eg-intro-icon {
	font-size: 52px;
	margin-bottom: 6px;
	animation: eg-bounce 1.6s ease-in-out infinite;
}

@keyframes eg-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-10px); }
}

.eg-title {
	font-size: 26px;
	margin: 8px 0;
	color: var(--eg-purple);
}

.eg-desc { font-size: 16px; color: #5b547a; margin: 8px auto 14px; max-width: 520px; }

.eg-intro-info { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }

.eg-chip {
	background: #fff;
	border: 2px solid #ddd6fe;
	border-radius: 999px;
	padding: 5px 14px;
	font-size: 14px;
	font-weight: 600;
}

.eg-name-input {
	display: block;
	width: min(420px, 90%);
	margin: 0 auto 14px;
	padding: 13px 18px;
	border: 3px solid #c4b5fd;
	border-radius: 999px;
	font-size: 16px;
	text-align: center;
	outline: none;
	background: #fff;
}

.eg-name-input:focus { border-color: var(--eg-purple); box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15); }

.eg-best { margin-top: 12px; color: #b45309; font-size: 14px; }

/* ============ TOMBOL ============ */

.eg-btn {
	display: inline-block;
	background: linear-gradient(135deg, var(--eg-purple), var(--eg-pink));
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 13px 30px;
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 5px 0 rgba(109, 40, 217, 0.4);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
	text-decoration: none;
	font-family: inherit;
}

.eg-btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(109, 40, 217, 0.4); }
.eg-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(109, 40, 217, 0.4); }
.eg-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.eg-btn-big { font-size: 20px; padding: 16px 44px; animation: eg-pulse 2s ease-in-out infinite; }

@keyframes eg-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.04); }
}

.eg-btn-ghost { background: #fff; color: var(--eg-purple); border: 2px solid #c4b5fd; box-shadow: 0 4px 0 #e9d5ff; }
.eg-btn-cert { background: linear-gradient(135deg, #f59e0b, #ef4444); box-shadow: 0 5px 0 rgba(180, 83, 9, 0.4); }

/* ============ HUD ============ */

.eg-hud {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	background: rgba(255, 255, 255, 0.85);
	border-radius: 18px;
	padding: 10px 16px;
	margin-bottom: 16px;
	font-size: 15px;
	flex-wrap: wrap;
}

.eg-hud-left, .eg-hud-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.eg-hud-score { font-size: 17px; }
.eg-hud-progress { color: #7c3aed; font-weight: 600; font-size: 13px; }

.eg-heart { transition: opacity 0.3s; }
.eg-heart-off { opacity: 0.25; filter: grayscale(1); }

.eg-hud-time {
	background: var(--eg-dark);
	color: #fff;
	border-radius: 999px;
	padding: 4px 12px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.eg-hud-time.danger { background: var(--eg-red); animation: eg-pulse 1s infinite; }

/* ============ AREA PERMAINAN ============ */

.eg-stage { min-height: 220px; }

.eg-question {
	text-align: center;
	font-size: 20px;
	line-height: 1.55;
	background: #fff;
	border-radius: 20px;
	padding: 20px 24px;
	margin-bottom: 18px;
	box-shadow: 0 4px 0 #e9d5ff;
}

.eg-question .eg-q-num { color: var(--eg-pink); font-weight: 700; margin-right: 6px; }

.eg-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 560px) {
	.eg-answers { grid-template-columns: 1fr; }
}

.eg-opt {
	background: #fff;
	border: 3px solid #ddd6fe;
	border-radius: 16px;
	padding: 14px 16px;
	font-size: 17px;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	transition: border-color 0.15s, transform 0.15s, background 0.15s;
	line-height: 1.45;
}

.eg-opt:hover:not(:disabled) { border-color: var(--eg-purple); transform: translateY(-2px); }
.eg-opt.ok { background: #dcfce7; border-color: var(--eg-green); }
.eg-opt.no { background: #fee2e2; border-color: var(--eg-red); animation: eg-shake 0.4s; }
.eg-opt:disabled { cursor: default; opacity: 0.92; }

.eg-opt-emoji { margin-right: 8px; }

@keyframes eg-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-6px); }
	75% { transform: translateX(6px); }
}

.eg-feedback { text-align: center; margin-top: 16px; min-height: 30px; font-size: 16px; font-weight: 600; }
.eg-feedback.ok { color: var(--eg-green); }
.eg-feedback.no { color: var(--eg-red); }

.eg-next-row { text-align: center; margin-top: 12px; }

.eg-expl {
	background: #fffbeb;
	border: 2px dashed #fcd34d;
	border-radius: 14px;
	padding: 12px 16px;
	margin-top: 12px;
	font-size: 15px;
	line-height: 1.6;
}

/* ============ BENAR/SALAH ============ */

.eg-tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.eg-tf-btn {
	font-size: 22px;
	font-weight: 800;
	padding: 22px;
	border-radius: 20px;
	border: none;
	cursor: pointer;
	color: #fff;
	font-family: inherit;
	transition: transform 0.12s;
}

.eg-tf-btn.true { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 5px 0 #15803d; }
.eg-tf-btn.false { background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 5px 0 #be123c; }
.eg-tf-btn:hover { transform: translateY(-3px); }
.eg-tf-btn:disabled { opacity: 0.65; cursor: default; }

/* ============ ISI TEGAK ============ */

.eg-fill-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.eg-fill-input {
	padding: 14px 18px;
	font-size: 18px;
	border: 3px solid #c4b5fd;
	border-radius: 14px;
	width: min(320px, 70%);
	text-align: center;
	font-family: inherit;
}

.eg-fill-input:focus { border-color: var(--eg-purple); outline: none; }

/* ============ TEBAK KATA ============ */

.eg-hang-word {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
	margin: 14px 0;
}

.eg-hang-cell {
	width: 46px;
	height: 54px;
	background: #fff;
	border-bottom: 4px solid var(--eg-purple);
	border-radius: 8px;
	font-size: 28px;
	font-weight: 800;
	text-transform: uppercase;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--eg-purple);
	animation: eg-pop 0.25s;
}

@keyframes eg-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.eg-keys {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	margin-top: 12px;
}

.eg-key {
	width: 40px;
	height: 42px;
	border: 2px solid #ddd6fe;
	background: #fff;
	border-radius: 10px;
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	text-transform: uppercase;
	font-family: inherit;
	transition: background 0.12s;
}

.eg-key:hover:not(:disabled) { background: #ede9fe; }
.eg-key.used-ok { background: #dcfce7; border-color: var(--eg-green); color: #166534; }
.eg-key.used-no { background: #fee2e2; border-color: var(--eg-red); color: #991b1b; opacity: 0.7; }
.eg-key:disabled { cursor: default; }

.eg-hang-hint { text-align: center; color: #5b547a; font-size: 15px; margin-bottom: 6px; }

/* ============ SUSUN KATA ============ */

.eg-scramble-slots {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
	min-height: 56px;
	margin-bottom: 14px;
}

.eg-scramble-slot {
	width: 46px;
	height: 54px;
	border: 3px dashed #c4b5fd;
	border-radius: 10px;
	background: #fff;
	font-size: 26px;
	font-weight: 800;
	text-transform: uppercase;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--eg-purple);
}

.eg-scramble-tiles { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.eg-tile {
	width: 46px;
	height: 54px;
	background: linear-gradient(135deg, var(--eg-yellow), var(--eg-orange));
	border: none;
	border-radius: 10px;
	font-size: 24px;
	font-weight: 800;
	cursor: pointer;
	color: #fff;
	text-transform: uppercase;
	font-family: inherit;
	box-shadow: 0 4px 0 #c2410c;
	transition: transform 0.12s;
}

.eg-tile:hover { transform: translateY(-3px); }
.eg-tile:disabled { opacity: 0.35; cursor: default; box-shadow: none; }

.eg-scramble-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ============ MEMORI ============ */

.eg-mem-grid {
	display: grid;
	gap: 10px;
	justify-content: center;
}

.eg-mem-card {
	width: 108px;
	height: 84px;
	border: none;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--eg-blue), var(--eg-purple));
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	padding: 8px;
	font-family: inherit;
	box-shadow: 0 4px 0 rgba(91, 33, 182, 0.4);
	transition: transform 0.15s;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	line-height: 1.25;
	overflow: hidden;
}

.eg-mem-card:hover:not(:disabled) { transform: scale(1.04); }
.eg-mem-card.open { background: #fff; color: var(--eg-dark); border: 3px solid var(--eg-purple); }
.eg-mem-card.done { background: #dcfce7; color: #166534; border: 3px solid var(--eg-green); cursor: default; }

@media (max-width: 560px) {
	.eg-mem-card { width: 44vw; max-width: 130px; }
}

/* ============ PASANGKAN ============ */

.eg-match-wrap {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}

@media (max-width: 560px) {
	.eg-match-wrap { grid-template-columns: 1fr; }
}

.eg-match-col { display: flex; flex-direction: column; gap: 10px; }

.eg-match-col-title { text-align: center; font-weight: 700; color: #7c3aed; font-size: 14px; margin-bottom: 2px; }

.eg-match-item {
	background: #fff;
	border: 3px solid #ddd6fe;
	border-radius: 14px;
	padding: 12px 14px;
	font-size: 15px;
	cursor: pointer;
	text-align: center;
	font-family: inherit;
	line-height: 1.4;
	transition: border-color 0.15s, background 0.15s;
	min-height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.eg-match-item.sel { border-color: var(--eg-purple); background: #ede9fe; transform: scale(1.03); }
.eg-match-item.ok { background: #dcfce7; border-color: var(--eg-green); cursor: default; opacity: 0.85; }
.eg-match-item.no { animation: eg-shake 0.4s; border-color: var(--eg-red); background: #fee2e2; }
.eg-match-item:disabled { cursor: default; }

/* ============ URUTKAN ============ */

.eg-order-slots { counter-reset: egslot; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.eg-order-slot {
	background: #fff;
	border: 3px dashed #c4b5fd;
	border-radius: 12px;
	padding: 10px 14px;
	min-height: 46px;
	font-size: 15px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.eg-order-slot::before {
	counter-increment: egslot;
	content: counter(egslot);
	background: var(--eg-purple);
	color: #fff;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	flex-shrink: 0;
}

.eg-order-slot.filled { border-style: solid; border-color: var(--eg-purple); background: #f5f3ff; }
.eg-order-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

.eg-order-chip {
	background: linear-gradient(135deg, #38bdf8, #6366f1);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	box-shadow: 0 3px 0 #4338ca;
}

.eg-order-chip:hover { transform: translateY(-2px); }
.eg-order-chip:disabled { opacity: 0.4; cursor: default; box-shadow: none; }

/* ============ RODA KUIS ============ */

.eg-wheel-wrap { text-align: center; }

.eg-wheel-canvas { max-width: 100%; height: auto; }

.eg-wheel-btn { margin-top: 12px; background: linear-gradient(135deg, var(--eg-orange), var(--eg-pink)); }

.eg-wheel-point {
	font-size: 20px;
	font-weight: 800;
	color: var(--eg-orange);
	margin: 10px 0;
}

.eg-spinning { animation: eg-spin-shake 0.4s infinite; }

@keyframes eg-spin-shake {
	0%, 100% { transform: rotate(-1.5deg); }
	50% { transform: rotate(1.5deg); }
}

/* ============ MATEMATIKA KILAT ============ */

.eg-math-q {
	font-size: 42px;
	font-weight: 800;
	text-align: center;
	background: #fff;
	border-radius: 20px;
	padding: 26px 16px;
	margin-bottom: 16px;
	letter-spacing: 2px;
}

/* ============ HASIL ============ */

.eg-result { text-align: center; }

.eg-stars { font-size: 44px; margin: 6px 0; letter-spacing: 6px; }
.eg-star-on { color: var(--eg-yellow); text-shadow: 0 0 14px rgba(250, 204, 21, 0.8); }
.eg-star-off { color: #d8d2f0; }

.eg-result-score { font-size: 32px; font-weight: 800; color: var(--eg-purple); margin: 8px 0; }

.eg-result-stats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0 18px; }

.eg-save-box { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.eg-save-box .eg-name-input { margin: 0; width: min(300px, 80%); }

.eg-msg { min-height: 24px; margin: 8px 0; font-size: 15px; }
.eg-msg-ok { color: var(--eg-green); font-weight: 700; display: block; margin-bottom: 8px; }
.eg-msg-warn { color: var(--eg-red); font-weight: 600; }
.eg-msg-info { color: #7c3aed; font-size: 14px; }

.eg-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ============ KONFETI ============ */

.eg-confetti-holder { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.eg-confetti {
	position: absolute;
	top: -14px;
	width: 10px;
	height: 14px;
	border-radius: 2px;
	animation: eg-fall linear forwards;
}

@keyframes eg-fall {
	to { transform: translateY(560px) rotate(660deg); opacity: 0.2; }
}

/* ============ PAPAN SKOR ============ */

.edugame-papan-skor {
	max-width: 760px;
	margin: 30px auto;
	background: #fff;
	border: 3px solid #fde68a;
	border-radius: 22px;
	padding: 22px;
	font-family: 'Segoe UI', system-ui, sans-serif;
}

.edugame-lb-title { text-align: center; color: #b45309; font-size: 24px; margin-bottom: 14px; }
.edugame-lb-empty { text-align: center; color: #94a3b8; }

.edugame-lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.edugame-lb-table th {
	background: linear-gradient(135deg, #fef3c7, #fce7f3);
	color: #78350f;
	padding: 10px 8px;
}

.edugame-lb-table td { padding: 10px 8px; border-bottom: 1px solid #f1f5f9; text-align: center; }
.edugame-lb-rank { font-size: 18px; }
.edugame-lb-name { font-weight: 700; text-align: left; }
.edugame-lb-score { font-weight: 800; color: var(--eg-purple); }

/* ============ KARTU DAFTAR GAME ============ */

.edugame-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 18px;
	margin: 24px 0;
	font-family: 'Segoe UI', system-ui, sans-serif;
}

.edugame-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	background: #fff;
	border-radius: 22px;
	padding: 22px 16px;
	text-align: center;
	text-decoration: none !important;
	color: var(--eg-dark) !important;
	border: 3px solid transparent;
	box-shadow: 0 8px 24px rgba(124, 58, 237, 0.12);
	transition: transform 0.15s, border-color 0.15s;
}

.edugame-card:nth-child(4n+1) { border-color: #fecdd3; }
.edugame-card:nth-child(4n+2) { border-color: #fef08a; }
.edugame-card:nth-child(4n+3) { border-color: #a7f3d0; }
.edugame-card:nth-child(4n+4) { border-color: #bfdbfe; }

.edugame-card:hover { transform: translateY(-5px) scale(1.02); }

.edugame-card-icon { font-size: 44px; }
.edugame-card-title { font-size: 17px; font-weight: 800; line-height: 1.35; }
.edugame-card-desc { font-size: 13px; color: #64748b; line-height: 1.5; }
.edugame-card-type { font-size: 12px; color: #7c3aed; background: #ede9fe; padding: 3px 12px; border-radius: 999px; }

.edugame-card-btn {
	margin-top: 6px;
	background: linear-gradient(135deg, var(--eg-purple), var(--eg-pink));
	color: #fff;
	padding: 9px 26px;
	border-radius: 999px;
	font-weight: 700;
	font-size: 14px;
}
