:root {
  --bg: #0e1013;
  --panel: #161a1f;
  --panel-2: #1d2228;
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.13);
  --text: #eef1f4;
  --muted: #8b94a0;
  --green: #5ccb4f;
  --green-d: #3a9a33;
  --gold: #f2c94c;
  /* GUI de Minecraft */
  --gui: #c6c6c6;
  --gui-hi: #ffffff;
  --gui-lo: #555555;
  --slot: #8b8b8b;
  --slot-hi: #ffffff;
  --slot-lo: #373737;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Manrope", system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(60% 40% at 50% -10%, rgba(92,203,79,.10), transparent 70%);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* Iconos desde la hoja de sprites */
.ico {
  --s: 32px;
  display: inline-block; width: var(--s); height: var(--s); flex: none;
  image-rendering: pixelated; background-repeat: no-repeat; background-image: url(sprites.webp);
  background-size: calc(var(--cols) * var(--s)) auto;
  background-position: calc(var(--x) * var(--s) * -1) calc(var(--y) * var(--s) * -1);
}
.ico:not([style]) { background-image: none; }

/* ---------- Cabecera ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px; padding: 14px 24px;
  background: rgba(14,16,19,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 24px var(--pixel); letter-spacing: 1px; }
.brand-icon { --s: 32px; }
.brand span:last-child { background: linear-gradient(180deg, #8ef07f, var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search {
  flex: 1; max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-2);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: rgba(92,203,79,.6); box-shadow: 0 0 0 4px rgba(92,203,79,.12); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15.5px; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.search kbd { font: 600 12px var(--pixel); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 7px; }
.version { font: 600 12.5px var(--pixel); color: var(--green); padding: 5px 10px; border: 1px solid rgba(92,203,79,.3); border-radius: 99px; background: rgba(92,203,79,.07); white-space: nowrap; }

/* ---------- Estructura ---------- */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; max-width: 1500px; margin: 0 auto; padding: 22px 24px 40px; }
.layout.with-detail { grid-template-columns: 240px minmax(0, 1fr) 470px; }

.filters { position: sticky; top: 92px; align-self: start; }
.filters h3 { margin: 0 0 10px; font: 600 12px var(--pixel); letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.filters h3:not(:first-child) { margin-top: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.col { flex-direction: column; }
.chip {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 8px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: #c9cfd6; font-weight: 600; font-size: 14px; text-align: left;
  transition: background .12s, border-color .12s;
}
.chips:not(.col) .chip { padding: 6px 12px; border-color: var(--line); border-radius: 99px; font-size: 13px; }
.chip:hover { background: var(--panel); }
.chip.active { background: rgba(92,203,79,.1); border-color: rgba(92,203,79,.35); color: #fff; }
.chip .n { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.toggle { display: flex; gap: 8px; align-items: center; margin-top: 22px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--green); }

.list-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.list-head h2 { margin: 0; font: 700 22px var(--pixel); letter-spacing: .5px; }
.count { color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 8px; }
.tile {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-width: 0;
  border-radius: 10px; background: var(--panel); border: 1px solid var(--line); text-align: left;
  transition: border-color .12s, transform .12s, background .12s;
}
.tile:hover { border-color: var(--line-2); background: var(--panel-2); transform: translateY(-1px); }
.tile.active { border-color: var(--green); background: rgba(92,203,79,.08); }
.tile span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; }

/* ---------- Detalle ---------- */
.detail {
  position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow: auto;
  padding: 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line);
  animation: slide .2s ease;
}
@keyframes slide { from { opacity: 0; transform: translateX(10px); } }
.close { position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
.close:hover { color: #fff; }
.detail { position: sticky; }
.d-head { display: flex; align-items: center; gap: 14px; padding-right: 40px; margin-bottom: 16px; }
.d-icon { display: grid; place-items: center; width: 80px; height: 80px; flex: none; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.d-icon .ico { --s: 64px; }
.d-head h2 { margin: 0; font: 700 21px/1.2 var(--pixel); }
.d-head code { font-size: 12.5px; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); margin-bottom: 16px; }
.tab { height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13.5px; }
.tab.active { background: var(--panel-2); color: #fff; }
.tab span { font-weight: 600; color: var(--green); margin-left: 4px; }
.recipes { display: grid; gap: 14px; }
.none { color: var(--muted); font-size: 14px; padding: 18px; border: 1px dashed var(--line-2); border-radius: 12px; text-align: center; }

/* Tarjeta de receta con aspecto de interfaz de Minecraft */
.recipe { border-radius: 4px; }
.r-label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.r-label .ico { --s: 32px; }
.r-label b { color: #dfe4ea; }
.gui {
  display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 14px; background: var(--gui); color: #3f3f3f;
  border: 3px solid; border-color: var(--gui-hi) var(--gui-lo) var(--gui-lo) var(--gui-hi);
  border-radius: 6px; box-shadow: 0 0 0 2px #000;
}
.g3 { display: grid; grid-template-columns: repeat(3, 40px); gap: 0; }
.slot {
  position: relative; width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--slot); border: 2px solid; border-color: var(--slot-lo) var(--slot-hi) var(--slot-hi) var(--slot-lo);
}
.slot.big { width: 56px; height: 56px; }
.slot .ico { --s: 32px; }
.slot.big .ico { --s: 48px; }
.slot.link { cursor: pointer; }
.slot.link:hover { background: #a5a5a5; }
.slot .qty { position: absolute; right: 1px; bottom: -2px; font: 700 15px var(--pixel); color: #fff; text-shadow: 2px 2px 0 #3e3e3e; pointer-events: none; }
.slot.multi::after { content: ""; position: absolute; left: 2px; top: 2px; width: 5px; height: 5px; background: var(--gold); box-shadow: 0 0 0 1px #6b5200; }
.arrow { width: 44px; height: 30px; display: grid; place-items: center; }
.arrow svg { width: 44px; height: 30px; }
.side { display: grid; justify-items: center; gap: 4px; font: 600 12px var(--pixel); color: #4b4b4b; text-align: center; }
.flame { width: 28px; height: 28px; }
.r-note { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.r-note b { color: #cfd5dc; font-weight: 600; }
.shapeless { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 99px; background: rgba(242,201,76,.1); color: var(--gold); font-size: 11.5px; font-weight: 700; margin-left: auto; }

/* Tooltip estilo Minecraft */
.tip {
  position: fixed; z-index: 100; pointer-events: none; max-width: 280px;
  padding: 6px 9px; background: rgba(16,0,16,.94); color: #fff; font: 500 15px/1.3 var(--pixel);
  border: 2px solid #28075e; box-shadow: inset 0 0 0 1px rgba(80,0,255,.35); border-radius: 3px;
}
.tip small { display: block; color: #a8a8ff; font-size: 13px; margin-top: 2px; }
.tip i { display: block; font-style: normal; color: #aaa; font-size: 12.5px; margin-top: 3px; }

footer { text-align: center; color: #555d67; font-size: 12.5px; padding: 20px 24px 36px; }

/* ---------- Responsive ---------- */
@media (max-width: 1250px) {
  .layout.with-detail { grid-template-columns: 220px minmax(0, 1fr); }
  .detail { position: fixed; inset: 0 0 0 auto; top: 0; width: min(500px, 100%); max-height: none; height: 100vh; border-radius: 0; z-index: 50; box-shadow: -20px 0 60px rgba(0,0,0,.6); }
}
@media (max-width: 860px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .search { order: 3; flex-basis: 100%; }
  .search kbd { display: none; }
  .version { margin-left: auto; }
  .layout, .layout.with-detail { grid-template-columns: 1fr; padding: 14px 16px 30px; }
  .filters { position: static; }
  .chips.col { flex-direction: row; flex-wrap: wrap; }
  .chips.col .chip { border-color: var(--line); }
  .chip .n { display: none; }
  .toggle { margin-top: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .detail { width: 100%; }
}

.nav-link { font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 10px; background: rgba(92,203,79,.12); border: 1px solid rgba(92,203,79,.35); color: #bff3b5; white-space: nowrap; }
.nav-link:hover { background: rgba(92,203,79,.2); }
