*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
	--bg: #09090b;
	--surface: #18181b;
	--border: #27272a;
	--text: #fafafa;
	--text-muted: #a1a1aa;
	--accent: #3b82f6;
	--accent-hover: #2563eb;
}

body {
	font-family: system-ui, -apple-system, sans-serif;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

#pwa-banner {
	background: var(--accent);
	color: #fff;
	padding: 0.75rem 1rem;
	text-align: center;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 1rem;
	font-weight: 500;
	font-size: 0.9rem;
}

#pwa-banner.hidden {
	display: none;
}

#install-btn {
	background: rgba(0,0,0,0.2);
	border: none;
	color: #fff;
	padding: 0.4rem 0.8rem;
	border-radius: 6px;
	cursor: pointer;
	font-weight: bold;
	transition: background 0.2s;
}
#install-btn:hover { background: rgba(0,0,0,0.3); }

header {
	text-align: center;
	padding: 4rem 1rem 2rem;
}
header h1 {
	font-size: 3rem;
	font-weight: 800;
	letter-spacing: -0.05em;
	margin-bottom: 0.5rem;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
}
header h1 i { color: var(--accent); }
header p {
	color: var(--text-muted);
	font-size: 1.2rem;
}

.header-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2rem;
	margin: 1.5rem auto 0;
	max-width: 640px;
}

.search-wrap {
	position: relative;
	flex: 1;
	max-width: 360px;
}

.search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-muted);
	font-size: 0.9rem;
	pointer-events: none;
}

.search-input {
	width: 100%;
	background: var(--surface);
	border: 1px solid var(--border);
	color: var(--text);
	padding: 0.6rem 0.75rem 0.6rem 2.25rem;
	border-radius: 8px;
	font-size: 0.95rem;
	outline: none;
	transition: border-color 0.2s;
}

.search-input:focus {
	border-color: var(--accent);
}

.search-input::placeholder {
	color: var(--text-muted);
	font-size: 0.85rem;
}

.nav-links {
	display: flex;
	gap: 0.5rem;
}

.nav-link {
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 1rem;
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--text-muted);
	transition: all 0.2s;
}

.nav-link:hover {
	color: var(--text);
	background: rgba(255,255,255,0.05);
}

.nav-link.active {
	color: var(--text);
	background: var(--accent);
}

#game-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 2rem;
	padding: 0 2rem 4rem;
	max-width: 1200px;
	margin: 0 auto;
	flex: 1;
}

.game-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	overflow: hidden;
	transition: transform 0.2s, border-color 0.2s;
	display: flex;
	flex-direction: column;
	position: relative;
}

.game-card:hover {
	transform: translateY(-4px);
	border-color: var(--text-muted);
}

.game-card-img {
	width: 100%;
	aspect-ratio: 16/9;
	object-fit: cover;
	border-bottom: 1px solid var(--border);
}

.game-card-body {
	padding: 1.5rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.game-card h2 {
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 0.5rem;
}

.game-card p {
	color: var(--text-muted);
	font-size: 1rem;
	line-height: 1.5;
	margin-bottom: 1.5rem;
	flex: 1;
}

.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}

.tag {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 0.75rem;
	padding: 0.2rem 0.6rem;
	border-radius: 9999px;
}

.game-card-footer {
	display: flex;
	gap: 0.75rem;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s;
	flex: 1;
}

.btn-primary {
	background: var(--text);
	color: var(--bg);
}
.btn-primary:hover { background: #e5e5e5; }

.btn-secondary {
	background: transparent;
	color: var(--text);
	border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.05); }

.modal {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	align-items: center;
	justify-content: center;
	z-index: 1000;
}
.modal:not(.hidden) {
	display: flex;
}
.modal-content {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 2rem;
	max-width: 400px;
	width: 90%;
	text-align: center;
}
.modal-content p {
	margin-bottom: 1.5rem;
	font-size: 1.1rem;
	line-height: 1.5;
}
.modal-actions {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
}
.btn-danger {
	background: #ef4444;
	color: #fff;
	border: none;
}
.btn-danger:hover {
	background: #dc2626;
}

.clear-cache-btn {
	margin-top: 1.5rem;
	background: transparent;
	border: 1px solid #ef4444;
	color: #ef4444;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 600;
	transition: all 0.2s;
}
.clear-cache-btn:hover {
	background: #ef4444;
	color: #fff;
}

footer {
	text-align: center;
	padding: 2rem;
	color: var(--text-muted);
	border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
	header h1 { font-size: 2rem; }
	#game-grid { grid-template-columns: 1fr; padding: 0 1rem 2rem; }
	#pwa-banner { flex-direction: column; gap: 0.5rem; }
}
