:root {
  color-scheme: dark;
  --page: #101a16;
  --panel: #182720;
  --raised: #20322a;
  --line: #365044;
  --text: #f5f5e9;
  --muted: #b7c9bd;
  --lime: #c5ec8a;
  --dark-green: #172719;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-width: 280px; margin: 0; color: var(--text); background-color: var(--page);
  background-image: linear-gradient(180deg,#101a16f0,#101a16 560px), url("assets/cave.svg");
  background-size: auto, 100% 680px; background-repeat: no-repeat;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #f7de8e; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; object-fit: contain; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; z-index: 3; top: 10px; left: 10px; padding: 10px; color: var(--dark-green); background: var(--lime); }
.shell { width: min(1220px, calc(100% - 64px)); margin-inline: auto; }
.header { border-bottom: 1px solid #33483c; background: #14211bee; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 850; font-size: 19px; letter-spacing: -.04em; line-height: 1.05; }
.brand b { color: var(--lime); }
.brand small { display: block; margin-top: 5px; color: #a8c1ac; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .14em; white-space: nowrap; }
nav { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
nav a { position: relative; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: 1px solid transparent; border-radius: 7px; font-size: 14px; color: var(--muted); font-weight: 700; }
nav a:hover, nav a[aria-current] { background: #263a2d; color: var(--lime); border-color: #3b5542; }
nav a span[aria-hidden] { font-size: 20px; line-height: 1; }
.fav-count { min-width: 20px; padding: 2px 5px; background: var(--lime); color: var(--dark-green); border-radius: 4px; font-size: 11px; text-align: center; }
.sound-toggle { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid #4f6b58; border-radius: 7px; background: #1c2c23; color: var(--lime); font-size: 13px; font-weight: 750; }
.sound-toggle[aria-pressed="false"] { color: var(--muted); background: #17251e; }
.sound-toggle:hover { background: #304736; border-color: #80a472; }
.sound-toggle[aria-pressed="true"] .sound-off,
.sound-toggle[aria-pressed="false"] .sound-on { display: none; }
main { min-height: 65vh; }
.hero {
  isolation: isolate; position: relative; margin-top: 25px; min-height: 442px; display: flex; align-items: center; overflow: hidden;
  border: 1px solid #698367; border-radius: 14px;
  background: linear-gradient(90deg,#0c1b17 0%,#101f1be8 25%,#15251c62 57%,#0a1e1710 100%),
    linear-gradient(0deg,#13291ebf,transparent 43%), #52896a url("assets/overworld.svg") center 53% / cover;
  box-shadow: 0 18px 55px #080e0a6b;
}
.hero-content { position: relative; padding: 40px clamp(24px,5.5vw,76px) 51px; }
.eyebrow { display: flex; gap: 9px; align-items: center; color: var(--lime); font: 750 11px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .16em; }
.eyebrow span, .caption-dot { display: inline-block; width: 7px; height: 7px; background: var(--lime); box-shadow: 0 0 12px #a4f06670; }
.hero-eyebrow { width: fit-content; padding: 8px 11px; border-radius: 4px; border: 1px solid #678659; background: #1f3225cc; }
.hero h1 { margin: 15px 0 23px; font-weight: 1000; font-size: clamp(58px,8vw,112px); line-height: .88; letter-spacing: -.088em; text-shadow: 0 5px #14241c, 0 9px 24px #07150b; }
.hero h1 em { color: var(--lime); font-style: normal; }
.hero p { max-width: 380px; color: #e0ebe2; line-height: 1.55; font-size: 16px; }
#hero-search { margin-top: 23px; display: flex; align-items: center; gap: 10px; width: min(100%, 450px); padding: 5px 5px 5px 14px; border: 1px solid #688170; border-radius: 8px; background: #14241fec; }
#hero-search:focus-within { border-color: var(--lime); }
#hero-search input { min-width: 0; flex: 1; padding: 6px 0; border: 0; background: transparent; outline-offset: 0; }
.search-icon { display: inline-block; position: relative; flex: none; width: 13px; height: 13px; margin-right: 3px; border: 2px solid #bad1be; border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; top: 9px; left: 9px; width: 6px; height: 2px; transform: rotate(45deg); background: #bad1be; }
.hero-caption { position: absolute; right: 20px; bottom: 19px; display: flex; align-items: center; gap: 9px; padding: 8px 10px; background: #17281ddd; border: 1px solid #6c8f77; border-radius: 4px; color: #e1eddd; font: 700 10px/1 ui-monospace, monospace; letter-spacing: .09em; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 6px; font-size: 14px; font-weight: 800; line-height: 1.25; }
.primary { color: #14251b; border-color: #c5ec8a; background: #c5ec8a; box-shadow: inset 0 -3px #83ac58; }
.primary:hover { background: #dbf7a6; }
.subtle { background: #263b30; color: var(--text); border-color: #567161; }
.subtle:hover { background: #365442; }
.categories, .featured { margin-top: 42px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 7px 0 17px; }
.section-heading h2 { font-size: clamp(28px,4.4vw,43px); letter-spacing: -.05em; line-height: 1.12; }
.section-heading a { color: var(--lime); font-size: 14px; font-weight: 750; text-align: right; }
.section-heading a:hover, .back:hover, .footer-link:hover { text-decoration: underline; }
.category-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.category-tile { position: relative; min-height: 81px; display: flex; align-items: center; gap: 9px; padding: 10px 24px 10px 11px; background: linear-gradient(118deg,#22352a,#182720); border: 1px solid #3b5244; border-radius: 8px; }
.category-tile:hover { border-color: var(--accent); background: #293c31; }
.category-tile img { flex: 0 0 44px; filter: drop-shadow(0 3px 3px #08150b88); }
.category-tile strong { display: block; color: var(--accent); font-size: 16px; line-height: 1.2; }
.category-tile small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; margin-top: 4px; }
.tile-number { position: absolute; right: 8px; top: 8px; font: 10px ui-monospace, monospace; color: #92a89a; }
.card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.card { min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card:hover, .card:focus-within { border-color: var(--accent); }
.art-overworld { --art: url("assets/overworld.svg"); --fallback: #415f44; }
.art-cherry { --art: url("assets/cherry.svg"); --fallback: #614a62; }
.art-dawn { --art: url("assets/dawn.svg"); --fallback: #4e506f; }
.art-cave { --art: url("assets/cave.svg"); --fallback: #274354; }
.art-nether { --art: url("assets/nether.svg"); --fallback: #643442; }
.cover, .detail-hero { background: linear-gradient(0deg,#0e1d1a89,#10201a15), var(--fallback,#263b30) var(--art,none) center / cover; }
.cover { height: 133px; display: grid; place-items: center; border-bottom: 1px solid #456050; }
.cover img, .cover .item-sprite, .detail-hero img { filter: drop-shadow(0 5px 0 #12231f88) drop-shadow(0 5px 10px #0b1515aa); }
.cover .item-sprite { width: 65px; height: 65px; }
.item-sprite { image-rendering: pixelated; object-fit: contain; }
.star { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; padding: 0; border: 1px solid #8d9f90; border-radius: 8px; color: #fff6d9; background: #13241fe8; font-size: 25px; line-height: 1; }
.star:hover, [data-favorite][aria-pressed="true"] { color: #ffdf83; border-color: #ddba64; }
.star:focus-visible { outline-offset: -4px; }
.card-body { padding: 15px; display: flex; flex-direction: column; flex: 1; gap: 9px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { display: inline-flex; align-items: center; color: #dce7e0; font: 750 11px/1.2 ui-monospace, Consolas, monospace; border: 1px solid #52715f; border-radius: 4px; padding: 4px 6px; background: #16281f; }
.badge.type { color: var(--accent); }
.card h3 { font-size: 20px; line-height: 1.18; letter-spacing: -.025em; }
.card h3 a:hover { text-decoration: underline; }
.card h3 a:focus-visible { outline-offset: 2px; }
.card-body p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.card-foot { display: flex; justify-content: space-between; gap: 5px; margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; color: #c8dbcc; font: 12px/1.3 ui-monospace, Consolas, monospace; }
.card-foot span:last-child { color: var(--accent); }
#catalog, #detail { padding-top: 40px; }
.intro { color: var(--muted); line-height: 1.5; }
#filters { margin: 24px 0 14px; padding: 14px; display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) auto; gap: 12px; align-items: end; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
#filters label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); font-weight: 750; }
input, select { width: 100%; min-height: 42px; border: 1px solid #587365; border-radius: 6px; padding: 8px 10px; background: #0f1e17; color: var(--text); }
input::placeholder { color: #a8bbaf; opacity: 1; }
.results-meta { min-height: 20px; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.empty { grid-column: 1/-1; padding: 36px 16px; text-align: center; border: 1px dashed #627d68; border-radius: 10px; background: var(--panel); }
.empty strong { font-size: 20px; }
.empty p { margin: 8px 0; color: var(--muted); }
.empty .button { margin-top: 9px; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 10px; color: var(--lime); font-weight: 750; }
.detail-card { overflow: hidden; border: 1px solid #50705d; border-radius: 12px; background: var(--panel); }
.detail-hero { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 230px; padding: clamp(18px,5vw,54px); background-image: linear-gradient(90deg,#101e18fa,#101f1bd4 52%,#1a2a1e61), var(--art,none); }
.detail-hero h1 { margin: 10px 0; font-size: clamp(32px,6vw,62px); line-height: 1.02; letter-spacing: -.05em; overflow-wrap: anywhere; }
.detail-hero p { color: #e5f0e7; line-height: 1.45; }
.detail-hero img { flex: 0 0 min(22%,112px); }
.detail-hero .item-sprite { width: 112px; height: auto; }
.detail-body { max-width: 900px; padding: clamp(18px,5vw,54px); }
.detail-body h2 { font-size: clamp(22px,3vw,29px); letter-spacing: -.035em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-meta strong, .seed strong { display: block; margin-bottom: 4px; color: var(--accent); font-size: 13px; }
.detail-meta span { color: var(--text); }
.detail-favorite { margin-left: auto; }
.seed { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #12211a; }
.seed code { font-size: clamp(13px,3.6vw,20px); }
.steps { color: var(--muted); line-height: 1.65; padding-left: 25px; }
.steps li { margin-bottom: 10px; padding-left: 4px; }
.steps li::marker { color: var(--accent); font-weight: 800; }
.detail-links { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }
.load-more { display: flex; justify-content: center; margin-top: 22px; }
.recipe-title { margin-bottom: 13px; }
.recipe { margin-bottom: 27px; }
.workbench {
  width: fit-content; max-width: 100%; padding: 12px; margin-bottom: 16px;
  background: repeating-linear-gradient(0deg,#0000 0 27px,#572d1e55 27px 29px),linear-gradient(130deg,#885737,#553321);
  border: 2px solid #b98555; border-radius: 8px;
  box-shadow: 0 7px 0 -1px #68412a,0 10px 0 -1px #3c261d,0 15px 19px #080c095e,inset 0 2px #f0b9846b;
}
.workbench-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; color: #fff4df; }
.workbench-heading .item-sprite { flex: 0 0 30px; width: 30px; height: 30px; }
.workbench-heading span { margin-left: auto; color: #f4d6b3; font: 700 12px ui-monospace,monospace; white-space: nowrap; }
.workbench-layout { display: grid; grid-template-columns: minmax(0,auto) auto minmax(0,104px); align-items: center; gap: clamp(5px,2vw,15px); }
.recipe-grid { display: grid; grid-template-columns: repeat(var(--size),minmax(0,50px)); gap: 4px; padding: 5px; background: #3d271d; border: 1px solid #c89361; box-shadow: inset 0 2px #251910; border-radius: 4px; }
.recipe-slot {
  min-width: 0; padding: 4px; display: grid; place-items: center; aspect-ratio: 1;
  border: 1px solid #9a765b; border-radius: 3px;
  background: #4e382c; box-shadow: inset 2px 2px #2f211a,inset -1px -1px #91644a;
}
.recipe-slot.filled { background: #785b48; }
button.recipe-slot:hover,button.recipe-slot:focus-visible { background: #a47b56; border-color: #ffe5a6; }
button.recipe-slot:focus-visible { outline-offset: 0; }
.recipe-slot .item-sprite { width: 100%; max-width: 42px; height: auto; aspect-ratio: 1; display: block; filter: drop-shadow(0 2px 1px #2117129c); }
.recipe-arrow { color: #ffda9a; font-size: clamp(13px,4vw,25px); line-height: 1; }
.recipe-output { display: grid; justify-items: center; text-align: center; gap: 4px; color: #fff4df; font-size: 12px; line-height: 1.2; overflow-wrap: anywhere; }
.recipe-output .recipe-slot { width: min(100%,52px); background: #8b683b; border-color: #e4b66b; }
.recipe-output span { color: #fce1ab; font-weight: 800; }
.recipe-hint, .ingredient-version, .ingredient-obtain { color: var(--muted); font-size: 14px; line-height: 1.5; }
.ingredient-dialog { width: min(490px,calc(100% - 24px)); max-height: calc(100% - 24px); border: 1px solid #71916e; border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; box-shadow: 0 20px 80px #040905ad; }
.ingredient-dialog::backdrop { background: #080e0bcc; }
.ingredient-panel { padding: clamp(12px,4vw,23px); }
.ingredient-controls { display: flex; justify-content: space-between; gap: 8px; }
#ingredient-close { margin-left: auto; min-width: 44px; }
.ingredient-heading { display: flex; align-items: center; gap: 12px; margin: 10px 0 8px; }
.ingredient-heading h2 { margin-top: 4px; overflow-wrap: anywhere; line-height: 1.1; font-size: clamp(22px,5vw,32px); }
.ingredient-heading .item-sprite { flex: 0 0 44px; width: 44px; height: 44px; }
.ingredient-version { margin-bottom: 14px; }
.ingredient-obtain { margin: 6px 0 12px; }
.footer { margin-top: 48px; padding: 22px 0 30px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.footer p { max-width: 510px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.footer-brand { flex: none; font-size: 16px; }
.footer-link { flex: none; color: var(--lime); font-size: 12px; font-weight: 700; }
.toast { position: fixed; z-index: 4; right: 12px; bottom: 12px; max-width: calc(100% - 24px); padding: 10px 14px; border: 1px solid #729b63; background: #263f30; border-radius: 7px; opacity: 0; pointer-events: none; transform: translateY(8px); }
.toast.visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: no-preference) {
  :is(button, nav a, .category-tile, .brand, .badge, .section-heading a, .back, .footer-link, .card h3 a) {
    transition: transform 140ms ease, color 170ms ease, background-color 170ms ease,
      border-color 170ms ease, box-shadow 170ms ease;
  }
  :is(button, nav a, .category-tile, .brand, .badge, .section-heading a, .back, .footer-link, .card h3 a):active {
    transform: translateY(1px) scale(.97);
  }
  :is(.section-heading a, .footer-link, .card h3 a) { display: inline-block; }
  .card { transition: border-color 180ms ease, box-shadow 180ms ease; }
  .cover img, .cover .item-sprite, .category-tile img { transition: transform 210ms cubic-bezier(.2,.7,.25,1); }
  .cover:active :is(img,.item-sprite) { transform: scale(.94); }
  input, select { transition: border-color 170ms ease, background-color 170ms ease; }
  .toast { transition: opacity 190ms ease, transform 210ms cubic-bezier(.2,.7,.25,1); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .category-tile:hover img, .card:hover .cover :is(img,.item-sprite) { transform: translateY(-3px) scale(1.045); }
  .card:hover { box-shadow: 0 8px 24px #080f0b60; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transform: none; }
}
@media (max-width: 970px) {
  .category-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 750px) {
  .shell { width: calc(100% - 32px); }
  .hero { min-height: 400px; background-position: 59% center; }
  .card-grid, .category-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #filters .filter-search { grid-column: 1/-1; }
  #filters .button { justify-self: start; }
  .footer { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .topbar { flex-wrap: wrap; padding: 9px 0 5px; gap: 5px; }
  .topbar .brand { font-size: 18px; }
  .topbar .brand img { width: 33px; height: 33px; }
  nav { width: 100%; gap: 3px; order: 1; }
  nav a { flex: 1; justify-content: center; padding: 0 5px; font-size: 13px; }
  .hero { margin-top: 14px; min-height: 392px; background-image: linear-gradient(90deg,#101f1bed,#101f1b7d),linear-gradient(0deg,#101e17aa,transparent 40%),url("assets/overworld.svg"); }
  .hero-content { width: 100%; padding: 26px 15px 46px; }
  .hero h1 { font-size: clamp(49px,13vw,70px); }
  .hero p { font-size: 14px; }
  #hero-search { gap: 7px; padding-left: 9px; }
  #hero-search input { font-size: 14px; }
  #hero-search .button { padding-inline: 9px; }
  .hero-caption { right: 10px; bottom: 10px; }
  .categories, .featured { margin-top: 31px; }
  .section-heading a { font-size: 12px; }
  .category-grid { gap: 7px; }
  .category-tile { padding: 8px 5px; gap: 4px; min-height: 68px; }
  .category-tile img { width: 30px; height: 33px; flex-basis: 30px; }
  .category-tile strong { font-size: clamp(11px,3.4vw,15px); overflow-wrap: anywhere; }
  .category-tile small { font-size: 11px; }
  .tile-number { display: none; }
  .card-grid { grid-template-columns: minmax(0,1fr); }
  #catalog, #detail { padding-top: 24px; }
  #filters { padding: 10px; gap: 8px; }
  select { padding-inline: 5px; font-size: 14px; }
  .detail-favorite { margin-left: 0; }
  .detail-hero img { width: 60px; height: 60px; }
  .detail-hero .item-sprite { width: 60px; }
  .workbench { padding: 9px; }
  .workbench-layout { grid-template-columns: minmax(0,auto) auto minmax(0,73px); }
  .recipe-grid { grid-template-columns: repeat(var(--size),minmax(0,44px)); }
}
