:root {
  /* Plain green vertical gradient - same clean single-gradient structure as MC Icons' sky
     background, just green instead of blue (no hex-pattern texture layered on top). */
  --bg-gradient: linear-gradient(to bottom, #1f8f4f 0%, #12522c 100%);
  --card-bg: #ffffff;
  --card-border: #cfe3d6;
  --card-radius: 14px;
  --card-shadow: 0 5px 8px -5px rgba(13, 94, 51, 0.3), 0 5px 30px -5px rgba(13, 94, 51, 0.5);
  --text-primary: #1d2921;
  --text-muted: #63806f;
  --link-hover: #bb9a14;
  --btn-gold-bg: #d9b62e;
  --btn-gold-border: #b8931a;
  --btn-blue-bg: #009fdf;
  --btn-blue-border: #0086bd;
  --font-display: 'Fredoka One', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--bg-gradient);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo span { color: #fff; -webkit-text-stroke: 1.5px var(--text-primary); }
.logo-icon { width: 32px; height: 32px; image-rendering: pixelated; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:hover { background: #fff; }
.nav-toggle span { display: block; width: 20px; height: 3px; border-radius: 2px; background: var(--text-primary); }

.site-nav { display: flex; gap: 8px; position: relative; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.55);
  transition: background 0.15s ease;
}
.site-nav a:hover, .site-nav a.active { background: #fff; }
.nav-icon { width: 20px; height: 20px; image-rendering: pixelated; }

main { flex: 1; padding: 0 32px 60px; max-width: 1200px; margin: 0 auto; width: 100%; }

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.site-footer p { margin: 0; line-height: 1.5; }

/* Hero */
.hero { text-align: center; padding: 60px 20px 40px; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 3rem;
  margin: 0 0 12px;
  color: #fff;
  text-shadow: 0 3px 0 rgba(13, 94, 51, 0.4);
}
.hero p {
  font-size: 1.15rem;
  color: #eafff0;
  max-width: 560px;
  margin: 0 auto 30px;
  font-weight: 500;
}

.search-bar {
  max-width: 640px;
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  padding: 6px 6px 6px 20px;
  gap: 10px;
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 12px 0;
  color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); display: inline-flex; align-items: center; flex-shrink: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  text-align: center;
  background: var(--card-bg);
  border-color: var(--card-border);
  color: var(--text-primary);
}
.btn-icon { width: 18px; height: 18px; image-rendering: pixelated; flex-shrink: 0; }
.btn--gold { background: var(--btn-gold-bg); border-color: var(--btn-gold-border); color: var(--text-primary); }
.btn--blue { background: var(--btn-blue-bg); border-color: var(--btn-blue-border); color: #000; }
.btn:hover { filter: brightness(1.05); }

/* Section titles */
.section-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--text-primary);
  margin: 40px 0 18px;
  text-align: center;
}
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 40px 0 18px;
}
.section-heading-row .section-title { margin: 0; }
.load-sentinel { height: 1px; }

/* Item grid (browse + home) */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.icon-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 16px 10px;
  text-align: center;
  transition: transform 0.15s ease;
}
.icon-card:hover { transform: translateY(-3px); }
.icon-card img { width: 72px; height: 72px; image-rendering: pixelated; margin-bottom: 10px; }
.icon-card .name { font-size: 0.85rem; font-weight: 600; line-height: 1.3; }
.icon-card .recipe-count {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-primary); font-weight: 600; }

/* Browse page controls */
.browse-controls {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  margin-bottom: 24px;
}
.browse-controls .search-bar { margin: 0 0 16px; max-width: none; }
.category-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #eef8f1;
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  cursor: pointer;
}
.pill img { width: 18px; height: 18px; image-rendering: pixelated; }
.pill.active { background: var(--btn-gold-bg); border-color: var(--btn-gold-border); color: var(--text-primary); }
.results-count { color: var(--text-primary); font-weight: 600; margin: 0 0 14px; }

/* -------------------------------------------------------------------------
 * Tooltip — a small Minecraft-style dark box that appears above any element
 * with a [data-tooltip] attribute on hover, pure CSS (no JS needed).
 * ---------------------------------------------------------------------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1a1a2e;
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 40;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -------------------------------------------------------------------------
 * Recipe detail page
 * ---------------------------------------------------------------------- */
.recipe-detail-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 32px;
  margin-top: 20px;
  text-align: center;
}
.recipe-detail-image { width: 96px; height: 96px; image-rendering: pixelated; margin-bottom: 10px; }
.recipe-detail-card h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  margin: 4px 0 6px;
}
.recipe-detail-meta { color: var(--text-muted); margin: 0 0 10px; }
.badge {
  display: inline-block;
  background: var(--btn-blue-bg);
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.recipe-block { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--card-border); }
.recipe-block:first-of-type { margin-top: 26px; border-top: none; padding-top: 0; }
.recipe-block-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.crafting-table {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Colors and bevel sampled directly from the real gui/container/crafting_table.png texture:
   panel #c6c6c6, slot fill #8b8b8b, sunken-slot bevel (dark top/left, light bottom/right) for
   input slots, inverted (raised) bevel for the output slot since you take from it rather than
   place into it - same convention Minecraft itself uses. */
.crafting-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #c6c6c6;
  border: 3px solid #8b8b8b;
  border-radius: 4px;
  padding: 10px;
}
.crafting-slot {
  width: 56px;
  height: 56px;
  background: #8b8b8b;
  border-top: 3px solid #373737;
  border-left: 3px solid #373737;
  border-bottom: 3px solid #fff;
  border-right: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crafting-slot img { width: 40px; height: 40px; image-rendering: pixelated; }
.crafting-slot.empty { background: repeating-conic-gradient(#7a7a7a 0% 25%, #8b8b8b 0% 50%) 0 0 / 12px 12px; }
.crafting-arrow { color: var(--text-muted); flex-shrink: 0; }
.crafting-output {
  width: 72px;
  height: 72px;
  background: #8b8b8b;
  border-top: 3px solid #fff;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #373737;
  border-right: 3px solid #373737;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.crafting-output img { width: 52px; height: 52px; image-rendering: pixelated; }

/* Furnace-style layout for smelting recipes - single sunken input slot stacked over a small
   flame indicator, in place of the 3x3 crafting grid. */
.furnace-slots {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #c6c6c6;
  border: 3px solid #8b8b8b;
  border-radius: 4px;
  padding: 10px 16px;
}
.furnace-flame { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.furnace-flame img { width: 20px; height: 20px; image-rendering: pixelated; }

/* Smithing-table layout - base item + upgrade material side by side, in place of the furnace's
   single slot or the 3x3 crafting grid. */
.smithing-slots {
  display: flex;
  gap: 4px;
  background: #c6c6c6;
  border: 3px solid #8b8b8b;
  border-radius: 4px;
  padding: 10px;
}

/* Materials list - a plain-language ingredient summary under each crafting visual, so you don't
   have to decode the grid yourself. Craftable ingredients link to their own recipe page. */
.materials-list { margin-top: 18px; }
.materials-list-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.materials-list-items { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.material-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.material-chip img { width: 22px; height: 22px; image-rendering: pixelated; }
a.material-chip:hover { border-color: var(--btn-blue-border); background: #eef8f1; }
.material-chip--static { color: var(--text-muted); cursor: default; }
.crafting-output-count {
  position: absolute;
  bottom: 2px;
  right: 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
}

.notfound { text-align: center; padding: 100px 20px; }
.notfound h1 { font-family: var(--font-display); font-size: 4rem; margin: 0; color: #fff; }
.notfound p { color: #eafff0; }

/* Back to top */
.back-to-top {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: #fff; }
.back-to-top-arrow { width: 22px; height: 22px; image-rendering: pixelated; transform: rotate(-45deg); }
.back-to-top-bow {
  width: 26px;
  height: 26px;
  image-rendering: pixelated;
  transform: rotate(-45deg);
}
.back-to-top-bow.drawing { animation: bow-draw-tension 0.14s ease-in-out infinite; }
@keyframes bow-draw-tension {
  0%, 100% { transform: rotate(-45deg) scale(1); }
  50% { transform: rotate(-45deg) scale(0.9); }
}

/* The arrow that actually "shoots" on back-to-top click — cloned, fixed-positioned at the
   button, then animated flying straight up past the viewport top via an inline transform (set
   in app.js) while the real page scroll happens underneath it. */
.shot-arrow {
  position: fixed;
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  transform: rotate(-45deg);
  transition: transform 1.1s cubic-bezier(0.25, 0.55, 0.3, 1), opacity 0.9s ease-in 0.2s;
  pointer-events: none;
  z-index: 200;
}

@media (max-width: 768px) {
  .site-header { padding: 14px 16px; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    width: 100%;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: 10px;
  }
  .site-nav.nav-open { display: flex; }
  .site-nav a { width: 100%; justify-content: flex-start; }
}

@media (max-width: 640px) {
  main { padding: 0 16px 40px; }
  .hero h1 { font-size: 2.1rem; }
  .hero p { font-size: 1rem; }
  .search-bar { flex-wrap: wrap; padding: 10px; }
  .search-bar input { width: 100%; padding: 8px 0; }
  .search-bar .btn { width: 100%; }
  .crafting-table { gap: 16px; }
  .crafting-slot { width: 46px; height: 46px; }
  .crafting-slot img { width: 32px; height: 32px; }
  .back-to-top { width: 40px; height: 40px; left: 14px; bottom: 14px; }
}
