:root {
	--bg: linear-gradient(135deg, #ffecd2 0%, #fcb69f 50%, #ff9a9e 100%);
	--bg-solid: #fff0e6;
	--text: #2d3436;
	--muted: #636e72;
	--accent: #ff6b9d;
	--accent-2: #c44569;
	--accent-3: #f8b500;
	--accent-4: #00d2ff;
	--accent-5: #a8e063;
	--card: #ffffff;
	--shadow: 0 8px 24px rgba(255, 107, 157, 0.25);
	--shadow-hover: 0 12px 32px rgba(255, 107, 157, 0.35);
	--radius: 24px;
	--radius-sm: 18px;
	--tap: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { 
	height: 100%; 
	margin: 0; 
	padding: 0; 
	overflow-x: hidden;
}
body {
	font-family: "Comic Neue", "Baloo 2", "Nunito", system-ui, -apple-system, sans-serif;
	background: var(--bg);
	background-attachment: fixed;
	color: var(--text);
	position: relative;
	overflow-y: auto;
}
body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: 
		radial-gradient(circle at 20% 30%, rgba(255, 182, 193, 0.3) 0%, transparent 50%),
		radial-gradient(circle at 80% 70%, rgba(255, 218, 185, 0.3) 0%, transparent 50%),
		radial-gradient(circle at 50% 50%, rgba(255, 250, 205, 0.2) 0%, transparent 50%);
	pointer-events: none;
	z-index: 0;
}

#app {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
	position: relative;
	z-index: 1;
	min-height: 100vh;
	padding-top: 60px; /* Space for ad banner at top (exactly 60px) */
}

.container {
	width: 100%;
	max-width: 980px;
	padding: 20px;
	padding-bottom: 100px; /* Extra padding at bottom to ensure content is never hidden */
	flex: 1;
}

.header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	gap: 12px;
	margin: 12px 0 20px;
}
.title {
	font-size: 36px;
	font-weight: 900;
	letter-spacing: 1px;
	background: linear-gradient(135deg, #ff6b9d, #c44569, #f8b500);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
	animation: titleBounce 2s ease-in-out infinite;
}
@keyframes titleBounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-3px); }
}
.lang {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--card);
	border-radius: 999px;
	padding: 8px 14px;
	box-shadow: 0 4px 12px rgba(255, 107, 157, 0.2);
	border: 3px solid #ff6b9d;
}
.lang button {
	border: 0;
	background: transparent;
	padding: 8px 14px;
	border-radius: 999px;
	font-weight: 800;
	font-size: 16px;
	color: var(--muted);
	transition: all 0.2s ease;
}
.lang button.active {
	background: linear-gradient(135deg, #ff6b9d, #c44569);
	color: white;
	transform: scale(1.05);
	box-shadow: 0 2px 8px rgba(255, 107, 157, 0.4);
}

.grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}
.board {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}
/* Override grid columns for menu board - always 2 columns */
.board[role="menu"] {
	grid-template-columns: repeat(2, 1fr) !important;
}
@media (min-width: 480px) {
	.grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
	.grid { grid-template-columns: repeat(4, 1fr); }
}

.card {
	background: var(--card);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 12px;
	min-height: 130px;
	user-select: none;
	border: 4px solid transparent;
	transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
	cursor: pointer;
	position: relative;
	overflow: hidden;
}
.card::before {
	content: '';
	position: absolute;
	top: -50%;
	left: -50%;
	width: 200%;
	height: 200%;
	background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
	opacity: 0;
	transition: opacity 0.3s ease;
}
.card:active {
	transform: scale(0.95);
}
.card:hover::before {
	opacity: 1;
}
.card .emoji { 
	font-size: 48px; 
	animation: emojiFloat 3s ease-in-out infinite;
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}
@keyframes emojiFloat {
	0%, 100% { transform: translateY(0) rotate(0deg); }
	50% { transform: translateY(-8px) rotate(5deg); }
}
.card .label { 
	font-size: 18px; 
	font-weight: 800;
	color: var(--text);
}
.card.accent-1 { 
	border-color: #ff6b9d;
	background: linear-gradient(135deg, #fff5f8, #ffffff);
}
.card.accent-1:hover {
	box-shadow: 0 12px 32px rgba(255, 107, 157, 0.4);
	transform: translateY(-4px) scale(1.02);
}
.card.accent-2 { 
	border-color: #00d2ff;
	background: linear-gradient(135deg, #e6f7ff, #ffffff);
}
.card.accent-2:hover {
	box-shadow: 0 12px 32px rgba(0, 210, 255, 0.4);
	transform: translateY(-4px) scale(1.02);
}
.card.accent-3 { 
	border-color: #a8e063;
	background: linear-gradient(135deg, #f0fce8, #ffffff);
}
.card.accent-3:hover {
	box-shadow: 0 12px 32px rgba(168, 224, 99, 0.4);
	transform: translateY(-4px) scale(1.02);
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: 0;
	border-radius: 18px;
	font-size: 20px;
	font-weight: 900;
	padding: 16px 20px;
	background: linear-gradient(135deg, #ff6b9d, #c44569);
	color: white;
	box-shadow: var(--shadow);
	min-height: 64px;
	transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
	cursor: pointer;
	position: relative;
	overflow: hidden;
}
.btn::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	background: rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	transform: translate(-50%, -50%);
	transition: width 0.6s, height 0.6s;
}
.btn:active::before {
	width: 300px;
	height: 300px;
}
.btn:hover {
	transform: translateY(-2px) scale(1.05);
	box-shadow: var(--shadow-hover);
}
.btn:active {
	transform: scale(0.98);
}
.btn.secondary { 
	background: linear-gradient(135deg, #00d2ff, #3a7bd5);
}
.btn.ghost {
	background: linear-gradient(135deg, #fff5f8, #ffeef2);
	color: #ff6b9d;
	border: 3px solid #ff6b9d;
}
.btn.ghost:hover {
	background: linear-gradient(135deg, #ff6b9d, #c44569);
	color: white;
}

.toolbar {
	position: fixed;
	left: env(safe-area-inset-left);
	right: env(safe-area-inset-right);
	bottom: env(safe-area-inset-bottom);
	display: flex;
	justify-content: center;
	padding: 12px;
	z-index: 1001; /* Above ad banner */
}
.toolbar-inner {
	display: flex;
	gap: 10px;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(10px);
	border-radius: 24px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	padding: 10px;
	border: 3px solid #ff6b9d;
}
.toolbar .btn { 
	min-width: 60px; 
	min-height: 60px; 
	padding: 12px 16px; 
	font-size: 18px; 
}

.tiles {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
}
.tile {
	background: linear-gradient(135deg, #ffffff, #fff5f8);
	border-radius: var(--radius-sm);
	box-shadow: 0 4px 12px rgba(255, 107, 157, 0.2);
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	font-weight: 900;
	user-select: none;
	border: 4px solid transparent;
	transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
	cursor: pointer;
}
.tile:active {
	transform: scale(0.9);
}
.tile.tap {
	border-color: #f8b500;
	background: linear-gradient(135deg, #fffbf0, #fff8e1);
	animation: tilePulse 2s ease-in-out infinite;
}
@keyframes tilePulse {
	0%, 100% { box-shadow: 0 4px 12px rgba(248, 181, 0, 0.3); }
	50% { box-shadow: 0 6px 20px rgba(248, 181, 0, 0.5); }
}
.tile.correct { 
	border-color: #a8e063; 
	background: linear-gradient(135deg, #f0fce8, #e8f5e9);
	animation: correctPop 0.4s ease;
}
@keyframes correctPop {
	0% { transform: scale(1); }
	50% { transform: scale(1.15) rotate(5deg); }
	100% { transform: scale(1); }
}
.tile.wrong { 
	border-color: #ff6b9d; 
	background: linear-gradient(135deg, #fff5f8, #ffeef2);
	animation: wrongShake 0.4s ease;
}
@keyframes wrongShake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-8px); }
	75% { transform: translateX(8px); }
}
.tile.selected { 
	border-color: #00d2ff; 
	background: linear-gradient(135deg, #e6f7ff, #e0f2fe);
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(0, 210, 255, 0.4);
}

.msg {
	border-left: 8px solid #e5e7eb;
	border-radius: 12px;
	padding: 12px;
	background: rgba(255, 255, 255, 0.8);
}
.msg.success {
	border-left-color: #a8e063;
	background: linear-gradient(135deg, #f0fce8, #ffffff);
}
.msg.error {
	border-left-color: #ff6b9d;
	background: linear-gradient(135deg, #fff5f8, #ffffff);
}

.board {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}
.bins {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}
.bin {
	background: linear-gradient(135deg, #ffffff, #fff5f8);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	min-height: 140px;
	padding: 16px;
	border: 4px dashed #ff6b9d;
	transition: all 0.3s ease;
}
.bin:hover {
	border-color: #c44569;
	background: linear-gradient(135deg, #fff5f8, #ffeef2);
}
.bin-title {
	font-weight: 900;
	font-size: 20px;
	margin-bottom: 12px;
	text-align: center;
	color: var(--accent);
}

.canvas-wrap {
	background: linear-gradient(135deg, #ffffff, #fff5f8);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 16px;
	border: 4px solid #ff6b9d;
}
canvas {
	width: 100%;
	touch-action: none;
	background: #fff;
	border-radius: 18px;
	box-shadow: inset 0 0 0 3px #ffeef2;
}
.trace-target {
	text-align: center;
	font-size: 72px;
	font-weight: 900;
	margin: 12px 0;
	opacity: 0.25;
	color: #ff6b9d;
}

.story {
	display: grid;
	gap: 16px;
}
.story-card {
	background: linear-gradient(135deg, #ffffff, #fff5f8);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px;
	border: 4px solid #ff6b9d;
}
.story-choices {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.slots {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
	gap: 8px;
}
.slot {
	background: linear-gradient(135deg, #fffbf0, #ffffff);
	border: 3px dashed #f8b500;
	border-radius: 14px;
	min-height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	font-weight: 900;
	transition: all 0.2s ease;
}
.slot:hover {
	border-color: #ff6b9d;
	background: linear-gradient(135deg, #fff5f8, #ffffff);
}
.celebrate {
	text-align: center;
	font-size: 28px;
	font-weight: 900;
	color: #ff6b9d;
	animation: celebrateBounce 0.6s ease;
}
@keyframes celebrateBounce {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.2); }
}

.ws-grid {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 8px;
}
.ws-cell {
	background: linear-gradient(135deg, #ffffff, #fff5f8);
	border-radius: 14px;
	box-shadow: 0 2px 8px rgba(255, 107, 157, 0.15);
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	font-weight: 900;
	user-select: none;
	border: 3px solid transparent;
	transition: all 0.2s ease;
}
.ws-cell.selected { 
	background: linear-gradient(135deg, #e6f7ff, #e0f2fe); 
	border-color: #00d2ff;
	transform: scale(1.1);
}
.ws-cell.found { 
	background: linear-gradient(135deg, #f0fce8, #e8f5e9); 
	border-color: #a8e063;
	animation: ws-pop .4s ease;
}
.ws-celebrate {
	animation: ws-bounce 0.6s ease;
}
.ws-controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ws-controls .btn { width: 100%; }
.ws-controls-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

@keyframes ws-pop {
	0% { transform: scale(1); }
	50% { transform: scale(1.15) rotate(5deg); }
	100% { transform: scale(1); }
}
@keyframes ws-bounce {
	0% { transform: translateY(0); }
	30% { transform: translateY(-8px); }
	60% { transform: translateY(0); }
	80% { transform: translateY(-4px); }
	100% { transform: translateY(0); }
}
.ws-list { display: flex; flex-wrap: wrap; gap: 10px; }
.ws-word { 
	padding: 10px 16px; 
	border-radius: 999px; 
	background: linear-gradient(135deg, #fff5f8, #ffeef2);
	font-weight: 900;
	border: 3px solid #ff6b9d;
	transition: all 0.2s ease;
}
.ws-word.found { 
	background: linear-gradient(135deg, #f0fce8, #e8f5e9);
	border-color: #a8e063;
	transform: scale(1.05);
}

.celebration-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 107, 157, 0.7);
	backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2000;
	animation: fadeIn 0.3s ease;
}
.celebration-content {
	background: linear-gradient(135deg, #ffffff, #fff5f8);
	border-radius: var(--radius);
	box-shadow: 0 16px 48px rgba(255, 107, 157, 0.4);
	padding: 40px;
	text-align: center;
	animation: celebrationPop 0.5s ease;
	border: 6px solid #ff6b9d;
}
.celebration-emoji {
	font-size: 100px;
	margin-bottom: 20px;
	animation: celebrationBounce 0.6s ease infinite;
	filter: drop-shadow(0 4px 12px rgba(255, 107, 157, 0.3));
}
.celebration-text {
	font-size: 40px;
	font-weight: 900;
	background: linear-gradient(135deg, #ff6b9d, #c44569, #f8b500);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	margin-bottom: 12px;
}
.celebration-subtext {
	font-size: 24px;
	color: var(--accent);
	font-weight: 800;
}
@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}
@keyframes celebrationPop {
	0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
	50% { transform: scale(1.15) rotate(5deg); }
	100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes celebrationBounce {
	0%, 100% { transform: translateY(0) scale(1); }
	25% { transform: translateY(-15px) scale(1.1); }
	50% { transform: translateY(-25px) scale(1.2); }
	75% { transform: translateY(-15px) scale(1.1); }
}

/* Big touch targets */
button, .card, .tile { min-height: 70px; }
button, .card, .tile { padding: var(--tap); }

/* Additional playful elements */
.card:hover .emoji {
	animation: emojiSpin 0.5s ease;
}
@keyframes emojiSpin {
	0% { transform: rotate(0deg) scale(1); }
	50% { transform: rotate(180deg) scale(1.2); }
	100% { transform: rotate(360deg) scale(1); }
}

/* Ad container - Horizontal banner at top */
#ad-container {
	position: fixed;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 468px;
	height: 60px;
	max-width: 468px;
	max-height: 60px;
	z-index: 1000; /* High z-index to stay on top */
	background: rgba(255, 255, 255, 0.98);
	border-radius: 0 0 12px 12px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	overflow: hidden;
	transition: opacity 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}
#ad-container iframe {
	width: 468px;
	height: 60px;
	max-width: 468px;
	max-height: 60px;
	border: 0;
	display: block;
	flex-shrink: 0;
}
@media (max-width: 768px) {
	#ad-container {
		width: 100%;
		height: 60px;
		left: 0;
		right: 0;
		transform: none;
		border-radius: 0;
	}
	#ad-container iframe {
		width: 100%;
		height: 60px;
		max-width: 100%;
	}
	#app {
		padding-top: 60px; /* Space for ad at top on mobile */
	}
}
@media (min-width: 769px) {
	#app {
		padding-top: 60px; /* Space for ad at top on all screens */
	}
}
