:root {
	--bg: #0f1420;
	--panel: #161e2d;
	--panel-2: #1b2536;
	--line: #2a3448;
	--text: #e7eef9;
	--muted: #9fb0c9;
	--accent: #5cd6e8;
	--accent-2: #b06ce8;
	--good: #7ee0a6;
	--radius: 12px;
	--maxw: 1020px;
}

html[data-theme="light"] {
	--bg: #f5f8fc;
	--panel: #ffffff;
	--panel-2: #f0f4fa;
	--line: #dbe3ef;
	--text: #16202e;
	--muted: #56657a;
	--accent: #0d7f93;
	--accent-2: #7a3fbe;
	--good: #1f7a4d;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd {
	font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
	font-size: 0.88em;
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 0.08em 0.35em;
}

/* ---------- top bar ---------- */
.topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	padding: 10px 20px;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); }
.brand span { color: var(--muted); font-weight: 500; }
.brand img { border-radius: 7px; image-rendering: pixelated; }

nav.main { display: flex; gap: 15px; flex-wrap: wrap; font-size: 0.95rem; }
nav.main a { color: var(--muted); }
nav.main a:hover { color: var(--text); text-decoration: none; }
nav.main a[aria-current="page"] { color: var(--text); font-weight: 650; }

.search { position: relative; margin-left: auto; }
.search input {
	width: 210px;
	padding: 8px 11px;
	border-radius: 9px;
	border: 1px solid var(--line);
	background: var(--panel);
	color: var(--text);
	font-size: 0.92rem;
}
.search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }

.results {
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	width: 330px;
	max-height: 330px;
	overflow: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 10px;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.results li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.results li a:hover, .results li a:focus { background: var(--panel-2); text-decoration: none; }
.results small { display: block; color: var(--muted); font-size: 0.8rem; }
.results .empty { padding: 10px; color: var(--muted); font-size: 0.9rem; }

.theme, .nav-toggle {
	border: 1px solid var(--line);
	background: var(--panel);
	color: var(--text);
	border-radius: 9px;
	padding: 7px 11px;
	cursor: pointer;
	font-size: 0.9rem;
}
.theme:hover, .nav-toggle:hover { background: var(--panel-2); }
.nav-toggle { display: none; }

/* ---------- content ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 34px 20px 90px; }

h1 { font-size: clamp(1.7rem, 3vw, 2.1rem); line-height: 1.2; margin: 0 0 10px; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; margin: 40px 0 12px; }
h3 { font-size: 1.02rem; margin: 26px 0 8px; }
p { margin: 0 0 14px; }

.lede { color: var(--muted); font-size: 1.06rem; max-width: 70ch; margin: 0 0 26px; }
.crumbs { color: var(--muted); font-size: 0.85rem; margin: 0 0 14px; }
.crumbs a { color: var(--muted); }

ul, ol { margin: 0 0 16px; padding-left: 1.25rem; }
li { margin: 0 0 6px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 650; }
tbody tr:hover { background: var(--panel); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- cards ---------- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); margin: 20px 0; }
.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 15px;
	display: flex;
	gap: 13px;
	align-items: flex-start;
}
.card img { image-rendering: pixelated; flex: 0 0 auto; margin-top: 2px; }
.card h3 { margin: 0; font-size: 1rem; }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.card .meta { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.pill {
	display: inline-block;
	font-size: 0.75rem;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--panel-2);
	border: 1px solid var(--line);
	color: var(--muted);
}
.pill.hot { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.id { font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; color: var(--muted); }

/* ---------- callouts ---------- */
.note {
	border-left: 3px solid var(--accent);
	background: var(--panel);
	padding: 12px 15px;
	border-radius: 0 9px 9px 0;
	margin: 18px 0;
}
.note.warn { border-left-color: #e8b45c; }
.note strong { color: var(--text); }

/* ---------- recipes ---------- */
.recipe { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 14px 0 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 50px); gap: 4px; }
.slot {
	width: 50px; height: 50px;
	border: 1px solid var(--line);
	border-radius: 7px;
	background: var(--panel-2);
	display: grid; place-items: center;
}
.slot img { width: 34px; height: 34px; image-rendering: pixelated; }
.arrow { color: var(--muted); font-size: 1.3rem; }
.recipe-out { display: flex; align-items: center; gap: 10px; }
.recipe-out .slot { width: 58px; height: 58px; }
.recipe-out .slot img { width: 40px; height: 40px; }

pre {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 14px 16px;
	overflow: auto;
	font-size: 0.88rem;
}

footer {
	border-top: 1px solid var(--line);
	padding: 22px 20px 30px;
	color: var(--muted);
	font-size: 0.88rem;
	text-align: center;
}
footer a { color: var(--muted); }

@media (max-width: 820px) {
	nav.main { display: none; width: 100%; }
	body.menu-open nav.main { display: flex; }
	.nav-toggle { display: inline-block; }
	.search { margin-left: auto; }
	.search input { width: 150px; }
}
