/**
 * Hebrew Kids Brick Breaker – Styles
 *
 * @package HebrewKidsBrickBreaker
 * @version 1.0.8
 */

:root {
	--hkbb-primary: #4a90d9;
	--hkbb-secondary: #f5a623;
	--hkbb-accent: #e74c3c;
	--hkbb-bg: #f0f7ff;
	--hkbb-card-bg: #ffffff;
	--hkbb-text: #1a2b3d;
	--hkbb-text-muted: #6b7c93;
	--hkbb-radius: 16px;
	--hkbb-radius-sm: 10px;
	--hkbb-shadow: 0 4px 24px rgba(74, 144, 217, 0.18);
	--hkbb-font: "Segoe UI", Tahoma, Arial, "Helvetica Neue", sans-serif;
	--hkbb-transition: 0.2s ease;
}

.hkbb-wrapper {
	direction: rtl;
	font-family: var(--hkbb-font);
	color: var(--hkbb-text);
	max-width: 720px;
	margin: 0 auto;
	padding: 16px;
	box-sizing: border-box;
	overflow-x: hidden;
}

.hkbb-wrapper *,
.hkbb-wrapper *::before,
.hkbb-wrapper *::after {
	box-sizing: border-box;
}

.hkbb-card {
	background: var(--hkbb-card-bg);
	border-radius: var(--hkbb-radius);
	box-shadow: var(--hkbb-shadow);
	padding: 20px 16px;
	overflow: hidden;
}

.hkbb-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	gap: 12px;
}

.hkbb-title {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--hkbb-primary);
	flex: 1;
	min-width: 0;
}

.hkbb-hud {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	margin-bottom: 10px;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--hkbb-text-muted);
}

.hkbb-hud-item strong {
	color: var(--hkbb-primary);
}

.hkbb-canvas-wrap {
	position: relative;
	width: 100%;
	border-radius: var(--hkbb-radius-sm);
	overflow: hidden;
	background: #1a1a2e;
	margin-bottom: 10px;
}

.hkbb-game-overlay {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: rgba(15, 23, 42, 0.78);
	z-index: 5;
	overflow: hidden;
}

.hkbb-game-overlay--menu {
	background: rgba(15, 23, 42, 0.5);
}

.hkbb-overlay-panel {
	background: var(--hkbb-card-bg);
	border-radius: var(--hkbb-radius);
	box-shadow: var(--hkbb-shadow);
	width: 90%;
	height: 90%;
	max-width: 90%;
	max-height: 90%;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: hkbb-overlay-in 0.35s ease;
}

.hkbb-overlay-panel--menu {
	padding: 10px 12px 8px;
}

.hkbb-overlay-panel--levels {
	padding: 8px 10px 8px;
}

.hkbb-overlay-panel .hkbb-btn--secondary,
.hkbb-overlay-panel .hkbb-btn--primary {
	width: 100%;
}

.hkbb-game-overlay .hkbb-result {
	background: var(--hkbb-card-bg);
	border-radius: var(--hkbb-radius);
	box-shadow: var(--hkbb-shadow);
	width: 90%;
	height: auto;
	max-width: 90%;
	max-height: 90%;
	overflow: hidden;
	padding: 20px 16px;
	animation: hkbb-overlay-in 0.35s ease;
}

.hkbb-game-overlay .hkbb-result .hkbb-btn {
	width: 100%;
	margin-top: 10px;
}

.hkbb-result-score {
	font-size: 1.05rem;
	margin: 8px 0 4px;
}

.hkbb-result-score strong {
	color: var(--hkbb-primary);
	font-size: 1.2rem;
}

@keyframes hkbb-overlay-in {
	from {
		opacity: 0;
		transform: scale(0.94) translateY(10px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hkbb-game-overlay .hkbb-result,
	.hkbb-overlay-panel {
		animation: none;
	}
}

.hkbb-canvas {
	display: block;
	width: 100%;
	touch-action: none;
}

.hkbb-touch-controls {
	display: flex;
	gap: 8px;
	margin-bottom: 10px;
}

.hkbb-touch-btn {
	flex: 1;
	padding: 14px 8px;
	border: 2px solid #6b7c93;
	border-radius: var(--hkbb-radius-sm);
	background: #fff;
	color: #111827;
	font-size: 1rem;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	min-height: 48px;
}

.hkbb-touch-btn:hover,
.hkbb-touch-btn:focus-visible {
	background: #fffbeb;
	border-color: #b45309;
	color: #111827;
	outline: none;
	box-shadow: 0 0 0 2px #f59e0b;
}

.hkbb-touch-btn--launch {
	flex: 1.5;
	background: var(--hkbb-primary);
	color: #fff;
	border-color: var(--hkbb-primary);
}

.hkbb-touch-btn--launch:hover,
.hkbb-touch-btn--launch:focus-visible {
	background: #3a7bc8;
	color: #fff;
	border-color: #2d6cb5;
}

.hkbb-effects-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	min-height: 28px;
	margin-bottom: 8px;
}

.hkbb-effect-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	color: #fff;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.hkbb-powerup-capsule {
	display: inline-block;
	width: 30px;
	height: 13px;
	border-radius: 999px;
	vertical-align: middle;
	position: relative;
	overflow: hidden;
	flex-shrink: 0;
	background: linear-gradient(135deg, var(--pu-color2, var(--pu-color)) 0%, var(--pu-color) 55%, var(--pu-color2, var(--pu-color)) 100%);
	box-shadow:
		0 0 5px color-mix(in srgb, var(--pu-color) 55%, transparent),
		inset 0 1px 2px rgba(255, 255, 255, 0.55),
		inset 0 -1px 2px rgba(0, 0, 0, 0.15);
}

.hkbb-powerup-capsule::before {
	content: '';
	position: absolute;
	top: 1px;
	bottom: 1px;
	left: -60%;
	width: 45%;
	border-radius: 999px;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
	animation: hkbb-capsule-shine 2.4s ease-in-out infinite;
	pointer-events: none;
}

.hkbb-powerup-capsule::after {
	content: '';
	position: absolute;
	width: 3px;
	height: 3px;
	top: 2px;
	right: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	box-shadow:
		-10px 4px 0 0 rgba(255, 255, 255, 0.55),
		6px 5px 0 0 rgba(255, 255, 255, 0.35);
	animation: hkbb-capsule-sparkle 1.8s ease-in-out infinite;
	pointer-events: none;
}

.hkbb-powerup-capsule--badge {
	width: auto;
	height: auto;
	min-height: 24px;
	padding: 4px 12px;
	font-size: 0.75rem;
	line-height: 1.2;
	color: #fff;
}

.hkbb-powerup-capsule--badge::after {
	top: 4px;
	right: 8px;
}

@keyframes hkbb-capsule-shine {
	0% { transform: translateX(0); opacity: 0; }
	20% { opacity: 1; }
	80% { opacity: 1; }
	100% { transform: translateX(260%); opacity: 0; }
}

@keyframes hkbb-capsule-sparkle {
	0%, 100% { opacity: 0.45; transform: scale(0.85); }
	50% { opacity: 1; transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
	.hkbb-powerup-capsule::before,
	.hkbb-powerup-capsule::after {
		animation: none;
	}
}

.hkbb-controls {
	display: flex;
	gap: 6px;
	margin-bottom: 6px;
	flex-wrap: wrap;
}

.hkbb-btn--compact {
	flex: 1 1 30%;
	min-width: 0;
	padding: 10px 8px;
	font-size: 0.88rem;
}

.hkbb-btn {
	padding: 12px 18px;
	border: none;
	border-radius: var(--hkbb-radius-sm);
	font-size: 1rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background var(--hkbb-transition), transform var(--hkbb-transition);
	line-height: 1.4;
}

.hkbb-btn:focus-visible {
	outline: 3px solid var(--hkbb-secondary);
	outline-offset: 2px;
}

.hkbb-btn--primary {
	background: var(--hkbb-primary);
	color: #fff;
}

.hkbb-btn--primary:hover {
	filter: brightness(1.08);
}

.hkbb-btn--secondary {
	background: #e8f2fc;
	color: var(--hkbb-primary);
}

.hkbb-btn--mode {
	width: 100%;
	background: linear-gradient(135deg, var(--hkbb-primary), #6ba8e5);
	color: #fff;
	padding: 14px;
	margin-bottom: 8px;
}

.hkbb-btn--menu {
	padding: 8px 10px;
	margin-bottom: 0;
	font-size: 0.82rem;
	line-height: 1.25;
	min-height: 36px;
}

.hkbb-btn--menu-text {
	font-size: 0.72rem;
	padding: 2px 6px;
	margin: 0;
	text-decoration: underline;
}

.hkbb-btn--text {
	background: transparent;
	color: var(--hkbb-text-muted);
	text-decoration: underline;
	font-size: 0.9rem;
}

.hkbb-btn--icon {
	width: auto;
	padding: 8px 12px;
	font-size: 1.3rem;
	background: #f0f4f8;
	border-radius: 50%;
	min-width: 44px;
	min-height: 44px;
}

.hkbb-menu {
	display: flex;
	flex-direction: column;
	gap: 6px;
	height: 100%;
	overflow: hidden;
}

.hkbb-menu-actions {
	display: flex;
	flex-direction: column;
	gap: 5px;
	flex-shrink: 0;
}

.hkbb-menu-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 2px 8px;
	flex-shrink: 0;
}

.hkbb-menu-title {
	margin: 0 0 2px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--hkbb-primary);
	text-align: center;
	flex-shrink: 0;
}

.hkbb-diff-wrap {
	margin: 2px 0;
	flex-shrink: 0;
}

.hkbb-label {
	display: block;
	margin-bottom: 2px;
	font-weight: 600;
	font-size: 0.78rem;
}

.hkbb-select {
	width: 100%;
	padding: 6px 8px;
	border: 2px solid #dce6f0;
	border-radius: var(--hkbb-radius-sm);
	font-family: inherit;
	font-size: 0.82rem;
	direction: rtl;
}

.hkbb-level-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 5px;
	margin-bottom: 6px;
	flex: 1;
	min-height: 0;
	overflow: hidden;
	align-content: start;
}

.hkbb-level-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 4px 2px;
	border: 2px solid #dce6f0;
	border-radius: var(--hkbb-radius-sm);
	background: #fff;
	cursor: pointer;
	font-family: inherit;
	min-height: 44px;
	position: relative;
}

.hkbb-level-card:hover:not(.hkbb-level-card--locked) {
	border-color: var(--hkbb-primary);
	background: #f0f7ff;
}

.hkbb-level-card--locked {
	opacity: 0.5;
	cursor: not-allowed;
}

.hkbb-level-num {
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--hkbb-primary);
	line-height: 1.1;
}

.hkbb-level-name {
	display: none;
}

.hkbb-level-stars {
	font-size: 0.62rem;
	color: var(--hkbb-secondary);
	line-height: 1;
}

.hkbb-lock {
	position: absolute;
	top: 2px;
	left: 2px;
	font-size: 0.65rem;
}

.hkbb-result {
	text-align: center;
	padding: 20px;
}

.hkbb-result h3 {
	color: var(--hkbb-primary);
	font-size: 1.4rem;
	margin: 0 0 12px;
}

.hkbb-result-stars {
	font-size: 2rem;
	color: var(--hkbb-secondary);
}

.hkbb-result--fail h3 {
	color: var(--hkbb-accent);
}

.hkbb-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	padding: 16px;
}

.hkbb-modal {
	background: #fff;
	border-radius: var(--hkbb-radius);
	padding: 24px;
	max-width: 400px;
	width: 100%;
	direction: rtl;
	text-align: right;
}

.hkbb-modal-title {
	margin: 0 0 12px;
	color: var(--hkbb-primary);
	text-align: right;
	width: 100%;
}

.hkbb-modal-text {
	line-height: 1.6;
	margin-bottom: 16px;
	text-align: right;
	width: 100%;
}

.hkbb-legend {
	direction: rtl;
	text-align: right;
	width: 100%;
}

.hkbb-legend-item {
	width: 100%;
	direction: rtl;
	text-align: right;
	padding: 6px 0;
	font-size: 0.95rem;
	line-height: 1.5;
}

.hkbb-legend-label {
	display: inline;
	vertical-align: middle;
}

.hkbb-legend-item .hkbb-powerup-capsule {
	margin-inline-start: 10px;
	vertical-align: middle;
}

.hkbb-legend-dot {
	display: none;
}

.hkbb-modal-close {
	margin-inline-start: auto;
	display: block;
}

.hkbb-live-region {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.hkbb-loading {
	text-align: center;
	padding: 40px;
	color: var(--hkbb-text-muted);
}

@media (max-width: 480px) {
	.hkbb-level-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.hkbb-title {
		font-size: 1.25rem;
	}
}

@media (min-width: 600px) {
	.hkbb-level-grid {
		grid-template-columns: repeat(5, 1fr);
	}

	.hkbb-touch-controls {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hkbb-btn,
	.hkbb-level-card,
	.hkbb-touch-btn {
		transition: none;
	}
}

@media (max-width: 600px) and (orientation: portrait) {
	.hkbb-wrapper::before {
		content: "לחוויה טובה יותר, נסו לסובב את המסך לרוחב.";
		display: block;
		text-align: center;
		font-size: 0.8rem;
		color: var(--hkbb-text-muted);
		margin-bottom: 8px;
		padding: 6px;
		background: #fff3cd;
		border-radius: 6px;
	}
}
