/**
 * Minesweeper Arcade — Educational Practice Mode Styling
 */

/* Persistent Didactic Header Banner */
.didactic-banner {
	display: none;
	align-items: center;
	justify-content: space-between;
	background: linear-gradient(135deg, rgba(30, 58, 138, 0.9), rgba(15, 23, 42, 0.95));
	border: 1px solid rgba(56, 189, 248, 0.4);
	border-radius: 12px;
	padding: 8px 14px;
	margin-bottom: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	animation: slideDown 0.3s ease;
}

body.didactic-mode .didactic-banner {
	display: flex;
}

@keyframes slideDown {
	from { opacity: 0; transform: translateY(-8px); }
	to { opacity: 1; transform: translateY(0); }
}

.didactic-banner-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.didactic-badge {
	background: #38bdf8;
	color: #0b1120;
	font-size: 0.72rem;
	font-weight: 900;
	letter-spacing: 0.5px;
	padding: 3px 8px;
	border-radius: 999px;
	text-transform: uppercase;
}

.didactic-desc {
	font-size: 0.78rem;
	color: #e2e8f0;
	font-weight: 600;
}

.didactic-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.btn-didactic-heatmap {
	background: rgba(56, 189, 248, 0.18);
	color: #38bdf8;
	border: 1px solid rgba(56, 189, 248, 0.4);
	border-radius: 999px;
	padding: 6px 13px;
	font-size: 0.82rem;
	font-weight: 800;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	transition: all 0.18s ease;
	font-family: inherit;
}

.btn-didactic-heatmap:hover {
	background: rgba(56, 189, 248, 0.3);
	border-color: #38bdf8;
	color: #fff;
	transform: translateY(-1px);
}

.btn-didactic-action {
	background: rgba(148, 163, 184, 0.15);
	color: #e2e8f0;
	border: 1px solid rgba(148, 163, 184, 0.3);
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 0.8rem;
	font-weight: 800;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	transition: all 0.18s ease;
	font-family: inherit;
}

.btn-didactic-action:hover:not(:disabled) {
	background: rgba(148, 163, 184, 0.28);
	border-color: #94a3b8;
	color: #fff;
	transform: translateY(-1px);
}

.btn-didactic-action:disabled {
	opacity: 0.38;
	cursor: not-allowed;
	filter: grayscale(1);
	transform: none !important;
}

.btn-didactic-heatmap.active {
	background: #38bdf8;
	color: #0b1120;
	border-color: #38bdf8;
	box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.btn-didactic-patterns.active {
	background: #c084fc;
	color: #0b1120;
	border-color: #c084fc;
	box-shadow: 0 0 12px rgba(192, 132, 252, 0.6);
}

.btn-didactic-hint {
	background: linear-gradient(135deg, #f59e0b, #d97706);
	color: #0b1120;
	border: none;
	border-radius: 999px;
	padding: 6px 14px;
	font-size: 0.82rem;
	font-weight: 800;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
	transition: all 0.18s ease;
	font-family: inherit;
}

.btn-didactic-hint:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 14px rgba(245, 158, 11, 0.6);
}

.btn-didactic-hint:active {
	transform: translateY(1px);
}

/* Pill selector Inspect Mode button - only displayed in didactic mode */
body.didactic-mode #btn-mode-inspect {
	display: inline-flex !important;
}

.pill-btn.inspect-btn.active {
	background: #38bdf8;
	color: #0b1120;
	border-color: #38bdf8;
	box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Floating Didactic Explanation Toast */
.didactic-toast {
	position: fixed;
	bottom: 80px;
	left: 50%;
	transform: translate(-50%, 20px);
	background: rgba(15, 23, 42, 0.95);
	border: 1.5px solid #38bdf8;
	border-radius: 16px;
	padding: 10px 18px 14px 18px;
	max-width: 420px;
	width: 90%;
	z-index: 150;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.25);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	text-align: center;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	cursor: grab;
}

.didactic-toast.show {
	opacity: 1;
	pointer-events: auto;
	transform: translate(-50%, 0);
}

.didactic-toast.is-dragged {
	transition: none !important;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.5);
	cursor: grabbing !important;
}

/* Indicatore di trascinamento superiore */
.didactic-toast-handle {
	width: 100%;
	padding: 2px 0 6px 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.didactic-toast-handle-bar {
	display: block;
	width: 46px;
	height: 4px;
	background: rgba(148, 163, 184, 0.45);
	border-radius: 999px;
	transition: background 0.2s ease, width 0.2s ease;
}

.didactic-toast:hover .didactic-toast-handle-bar,
.didactic-toast.is-dragged .didactic-toast-handle-bar {
	background: #38bdf8;
	width: 60px;
}

.didactic-toast-title {
	font-size: 0.88rem;
	font-weight: 800;
	color: #38bdf8;
	margin-bottom: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.didactic-toast-text {
	font-size: 0.82rem;
	color: #f1f5f9;
	line-height: 1.4;
	margin-bottom: 8px;
	cursor: grab;
}

.didactic-toast-close {
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: #cbd5e1;
	border-radius: 999px;
	padding: 4px 12px;
	font-size: 0.75rem;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s ease;
	font-family: inherit;
}

.didactic-toast-close:hover {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}

/* Board Cell Highlights in Tutor Mode */
.cell.cell-hint-safe {
	background: #065f46 !important;
	border-color: #34d399 !important;
	box-shadow: 0 0 16px rgba(52, 211, 153, 0.8), inset 0 0 8px rgba(52, 211, 153, 0.4) !important;
	animation: pulseSafe 1.4s infinite alternate;
	z-index: 5;
}

.cell.cell-hint-mine {
	background: #991b1b !important;
	border-color: #f87171 !important;
	box-shadow: 0 0 16px rgba(248, 113, 113, 0.8), inset 0 0 8px rgba(248, 113, 113, 0.4) !important;
	animation: pulseMine 1.4s infinite alternate;
	z-index: 5;
}

.cell.cell-hint-cause {
	border-color: #fbbf24 !important;
	background: rgba(245, 158, 11, 0.25) !important;
	box-shadow: 0 0 14px rgba(245, 158, 11, 0.8) !important;
	z-index: 4;
}

.cell.cell-hint-guess {
	background: #312e81 !important;
	border-color: #818cf8 !important;
	box-shadow: 0 0 16px rgba(129, 140, 248, 0.8), inset 0 0 8px rgba(129, 140, 248, 0.4) !important;
	animation: pulseGuess 1.4s infinite alternate;
	z-index: 5;
}

.cell.cell-hint-inspect {
	border-color: #38bdf8 !important;
	box-shadow: 0 0 16px #38bdf8, inset 0 0 6px rgba(56, 189, 248, 0.6) !important;
	z-index: 6;
	animation: pulseInspect 1.2s infinite alternate;
}

/* Didactic Mode: Clearly mark mistakenly placed flags with cross badge and warning glow */
body.didactic-mode .cell.flagged.didactic-wrong-flag {
	background: #450a0a !important;
	border-color: #ef4444 !important;
	box-shadow: 0 0 14px rgba(239, 68, 68, 0.9), inset 0 0 6px rgba(239, 68, 68, 0.6) !important;
	animation: pulseWrongFlag 1.2s infinite alternate;
}

@keyframes pulseWrongFlag {
	from { transform: scale(1); box-shadow: 0 0 8px rgba(239, 68, 68, 0.7); }
	to { transform: scale(1.06); box-shadow: 0 0 20px rgba(239, 68, 68, 1); }
}

@keyframes pulseInspect {
	from { box-shadow: 0 0 8px #38bdf8; transform: scale(1); }
	to { box-shadow: 0 0 20px #38bdf8; transform: scale(1.08); }
}

@keyframes pulseSafe {
	from { box-shadow: 0 0 8px rgba(52, 211, 153, 0.5); transform: scale(1); }
	to { box-shadow: 0 0 20px rgba(52, 211, 153, 0.95); transform: scale(1.06); }
}

@keyframes pulseMine {
	from { box-shadow: 0 0 8px rgba(248, 113, 113, 0.5); transform: scale(1); }
	to { box-shadow: 0 0 20px rgba(248, 113, 113, 0.95); transform: scale(1.06); }
}

@keyframes pulseGuess {
	from { box-shadow: 0 0 8px rgba(129, 140, 248, 0.5); transform: scale(1); }
	to { box-shadow: 0 0 20px rgba(129, 140, 248, 0.95); transform: scale(1.06); }
}

/* Tactical Pattern Highlights */
.cell.cell-pattern-clue {
	border-color: #c084fc !important;
	background: rgba(192, 132, 252, 0.28) !important;
	box-shadow: 0 0 16px rgba(192, 132, 252, 0.9), inset 0 0 8px rgba(192, 132, 252, 0.45) !important;
	z-index: 7;
	cursor: pointer;
	animation: pulsePatternClue 1.3s infinite alternate;
	transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

.cell.cell-pattern-safe {
	background: #065f46 !important;
	border-color: #34d399 !important;
	box-shadow: 0 0 14px rgba(52, 211, 153, 0.85), inset 0 0 6px rgba(52, 211, 153, 0.4) !important;
	z-index: 6;
	cursor: pointer;
	animation: pulseSafe 1.4s infinite alternate;
	transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

.cell.cell-pattern-mine {
	background: #991b1b !important;
	border-color: #f87171 !important;
	box-shadow: 0 0 14px rgba(248, 113, 113, 0.85), inset 0 0 6px rgba(248, 113, 113, 0.4) !important;
	z-index: 6;
	cursor: pointer;
	animation: pulseMine 1.4s infinite alternate;
	transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

.cell.cell-pattern-chord {
	border-color: #38bdf8 !important;
	box-shadow: 0 0 16px rgba(56, 189, 248, 0.95), inset 0 0 8px rgba(56, 189, 248, 0.5) !important;
	z-index: 8;
	cursor: pointer;
	animation: pulseChord 1.3s infinite alternate;
	transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}

@keyframes pulseChord {
	from { box-shadow: 0 0 8px rgba(56, 189, 248, 0.6); transform: scale(1); }
	to { box-shadow: 0 0 22px rgba(56, 189, 248, 1); transform: scale(1.08); }
}

/* Spotlight Focus: subtle contrast when a specific pattern is focused/inspected */
.board.pattern-focus-active .cell:not(.cell-pattern-focus) {
	opacity: 0.82;
	transition: opacity 0.25s ease;
}

/* Flagged cells and number clues must NEVER be dimmed or obscured */
.board .cell.flagged,
.board.pattern-focus-active .cell.flagged,
.board .cell.revealed.has-number {
	opacity: 1 !important;
	filter: none !important;
}


.cell.cell-pattern-focus {
	opacity: 1 !important;
	filter: none !important;
	z-index: 10 !important;
	transform: scale(1.06);
	box-shadow: 0 0 24px #38bdf8, 0 0 10px #c084fc, inset 0 0 10px rgba(56, 189, 248, 0.7) !important;
	border-color: #38bdf8 !important;
}

.cell.cell-pattern-focus.cell-pattern-clue {
	border-color: #e879f9 !important;
	box-shadow: 0 0 24px #e879f9, 0 0 12px #c084fc, inset 0 0 8px rgba(232, 121, 249, 0.6) !important;
}

.cell.cell-pattern-focus.cell-pattern-safe {
	border-color: #34d399 !important;
	box-shadow: 0 0 24px #34d399, 0 0 12px #10b981, inset 0 0 8px rgba(52, 211, 153, 0.6) !important;
}

.cell.cell-pattern-focus.cell-pattern-mine {
	border-color: #f87171 !important;
	box-shadow: 0 0 24px #f87171, 0 0 12px #ef4444, inset 0 0 8px rgba(248, 113, 113, 0.6) !important;
}

@keyframes pulsePatternClue {
	from { box-shadow: 0 0 8px rgba(192, 132, 252, 0.6); transform: scale(1); }
	to { box-shadow: 0 0 20px rgba(192, 132, 252, 1); transform: scale(1.08); }
}

/* Academy & Didactic: Context numbers kept clearly legible */
.cell.cell-didactic-muted {
	opacity: 0.8 !important;
	filter: none;
	transition: opacity 0.2s ease;
}

.cell.cell-didactic-muted:hover {
	opacity: 1 !important;
}

/* ============================================================
   DIDACTIC BANNER RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
	.didactic-banner {
		flex-direction: column;
		align-items: stretch;
		gap: 6px;
		padding: 6px 10px;
		margin-bottom: 6px;
	}

	.didactic-banner-left {
		justify-content: space-between;
	}

	.didactic-actions {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 4px;
	}

	.btn-didactic-action,
	.btn-didactic-heatmap,
	.btn-didactic-hint {
		padding: 5px 8px;
		font-size: 0.74rem;
	}
}

@media (max-width: 400px) {
	.didactic-desc {
		display: none;
	}

	.didactic-actions {
		gap: 3px;
	}

	.btn-didactic-action span,
	.btn-didactic-heatmap span {
		display: none;
	}

	.btn-didactic-action,
	.btn-didactic-heatmap {
		padding: 5px 7px;
		font-size: 0.85rem;
		min-width: 32px;
		justify-content: center;
	}

	.btn-didactic-hint {
		padding: 5px 10px;
		font-size: 0.72rem;
	}
}

/* Academy controls highlight */
.pill-btn-tutorial-pulse {
	animation: pillBtnPulse 1.2s ease-in-out infinite !important;
	border: 1px solid #f59e0b !important;
	box-shadow: 0 0 16px rgba(245, 158, 11, 0.8), 0 0 30px rgba(245, 158, 11, 0.4) !important;
}

@keyframes pillBtnPulse {
	0%, 100% {
		transform: scale(1);
		box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
	}
	50% {
		transform: scale(1.08);
		box-shadow: 0 0 24px rgba(245, 158, 11, 1), 0 0 35px rgba(245, 158, 11, 0.6);
	}
}
