*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --rarity-0: #8b949e;
  --rarity-1: #58a6ff;
  --rarity-2: #3fb950;
  --rarity-3: #d29922;
  --rarity-4: #f47067;
  --rarity-5: #bc8cff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding: 0 1rem;
}

header { max-width: 720px; margin: 2rem auto 1rem; }
header nav a { color: var(--accent); text-decoration: none; font-size: 0.875rem; }
header h1 { font-size: 1.5rem; margin-top: 0.5rem; }
.subtitle { color: var(--text-dim); font-size: 0.875rem; }

main { max-width: 720px; margin: 0 auto 2rem; }

footer {
  max-width: 720px;
  margin: 3rem auto 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.75rem;
}
footer a { color: var(--text-dim); }

/* Item card */
.item-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; }
.item-header { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.5rem; }
.item-sprite { image-rendering: pixelated; background: var(--bg); border-radius: 4px; padding: 8px; }
.item-header h1 { font-size: 1.25rem; line-height: 1.2; }
.item-type { display: inline-block; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0.125rem 0.5rem; font-size: 0.75rem; color: var(--text-dim); margin-top: 0.25rem; }
.item-rarity { display: inline-block; font-size: 0.75rem; margin-left: 0.5rem; padding: 0.125rem 0.5rem; border-radius: 4px; }
.rarity-0 { color: var(--rarity-0); }
.rarity-1 { color: var(--rarity-1); }
.rarity-2 { color: var(--rarity-2); }
.rarity-3 { color: var(--rarity-3); }
.rarity-4 { color: var(--rarity-4); }
.rarity-5, .rarity-6, .rarity-7, .rarity-8, .rarity-9, .rarity-10, .rarity-11 { color: var(--rarity-5); }

.item-stats, .item-meta, .item-sources { margin-top: 1rem; }
.item-stats h2, .item-sources h2 { font-size: 0.875rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; }
dt { color: var(--text-dim); font-size: 0.875rem; }
dd { font-size: 0.875rem; }
.item-sources ul { list-style: none; }
.item-sources li { font-size: 0.875rem; padding: 0.25rem 0; color: var(--text-dim); }

/* Landing page */
.game-list h2 { font-size: 0.875rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.games { list-style: none; display: grid; gap: 0.75rem; }
.game-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.game-card:hover { border-color: var(--accent); }
.game-card strong { font-size: 1.125rem; display: block; }
.game-version { color: var(--text-dim); font-size: 0.8125rem; }

/* Crafting */
.item-crafting { margin-top: 1rem; }
.item-crafting h2 { font-size: 0.875rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.recipe { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem; margin-bottom: 0.5rem; }
.recipe-station { font-size: 0.8125rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.recipe-station strong { color: var(--text); }
.recipe-qty { font-size: 0.8125rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.ingredient-list { list-style: none; }
.ingredient-list li { font-size: 0.875rem; padding: 0.125rem 0; }
.ingredient-list a { color: var(--accent); text-decoration: none; }
.ingredient-list a:hover { text-decoration: underline; }

/* Used In */
.item-used-in { margin-top: 1rem; }
.item-used-in h2 { font-size: 0.875rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.used-in-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.used-in-list li a {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.8125rem;
}
.used-in-list li a:hover { border-color: var(--accent); }

/* Search */
.search-container { margin: 1.5rem 0; }
#search {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}
#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-dim); }

.search-results { list-style: none; margin-top: 0.5rem; }
.search-results li { border-bottom: 1px solid var(--border); }
.search-results a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  color: var(--text);
  text-decoration: none;
}
.search-results a:hover { background: var(--surface); }
.search-results img { image-rendering: pixelated; }
.result-name { flex: 1; }
.result-type { color: var(--text-dim); font-size: 0.75rem; }
.no-results { color: var(--text-dim); padding: 1rem 0; }

/* Categories */
.categories { margin-top: 2rem; }
.categories h2 { font-size: 0.875rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.category-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.category-list a {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
}
.category-list a:hover { border-color: var(--accent); }
.category-list .count { color: var(--text-dim); }
