:root {
  --ink: #050805;
  --panel: #0a100a;
  --panel-2: #101910;
  --line: rgba(120, 255, 79, 0.17);
  --muted: #829482;
  --white: #f1f8ef;
  --cyan: #78ff4f;
  --cyan-dim: rgba(120, 255, 79, 0.12);
  font-family: Inter, system-ui, sans-serif;
  color: var(--white);
  background: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% 15%, #132413 0, #070b07 43%, #020402 100%); overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }

.ambient { position: fixed; width: 520px; height: 520px; filter: blur(120px); opacity: .1; border-radius: 50%; pointer-events: none; }
.ambient-one { background: var(--cyan); top: -300px; left: -180px; }
.ambient-two { background: #2cbd42; right: -300px; top: 420px; }

.site-header { height: 82px; padding: 0 clamp(24px, 5vw, 76px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 5; background: rgba(2, 5, 2, .72); backdrop-filter: blur(18px); }
.brand { display: flex; gap: 13px; align-items: center; color: var(--white); text-decoration: none; font: 700 20px "Chakra Petch", sans-serif; letter-spacing: .14em; }
.brand-mark { width: 31px; height: 31px; border: 2px solid var(--cyan); transform: rotate(45deg); display: grid; place-items: center; box-shadow: 0 0 18px rgba(120,255,79,.25); }
.brand-mark span { width: 10px; height: 10px; background: var(--cyan); }
.header-tag { margin: 0; color: #61778a; font: 600 10px "Chakra Petch", sans-serif; letter-spacing: .18em; }
.header-tag span { color: var(--cyan); margin: 0 8px; }

main { position: relative; z-index: 1; }
.hero { max-width: 1120px; margin: 0 auto; padding: 100px 24px 58px; text-align: center; }
.eyebrow { color: var(--cyan); font: 600 11px "Chakra Petch", sans-serif; letter-spacing: .18em; display: flex; gap: 10px; align-items: center; justify-content: center; }
.eyebrow span { width: 19px; height: 1px; background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }
h1, h2, h3 { font-family: "Chakra Petch", sans-serif; }
h1 { margin: 20px 0 17px; font-size: clamp(48px, 7vw, 78px); line-height: .98; letter-spacing: -.035em; text-transform: uppercase; }
h1 em { font-style: normal; color: transparent; -webkit-text-stroke: 1px #77a2ad; }
.hero-copy { max-width: 630px; margin: 0 auto; color: #9aaa98; line-height: 1.75; font-size: 14px; }

.calculator-shell { margin-top: 50px; padding: 20px; display: grid; grid-template-columns: minmax(280px, 1fr) 174px 190px; gap: 14px; align-items: end; text-align: left; border: 1px solid var(--line); background: rgba(8, 14, 8, .86); box-shadow: 0 20px 70px rgba(0,0,0,.48); backdrop-filter: blur(14px); }
.input-group label { display: block; color: #849b81; font: 600 9px "Chakra Petch", sans-serif; letter-spacing: .16em; margin: 0 0 9px 2px; }
.search-wrap { position: relative; }
.search-wrap > svg { position: absolute; z-index: 1; left: 16px; top: 17px; width: 18px; fill: none; stroke: var(--cyan); stroke-width: 1.8; }
input { width: 100%; height: 52px; background: #050905; color: var(--white); border: 1px solid #253825; outline: none; transition: .2s; }
input:focus { border-color: rgba(120,255,79,.7); box-shadow: 0 0 0 3px rgba(120,255,79,.08); }
#item-search { padding: 0 50px; }
input::placeholder { color: #526750; }
kbd { position: absolute; right: 14px; top: 15px; border: 1px solid #314530; color: #6e846b; font: 11px Inter; padding: 3px 7px; }
.stepper { display: grid; grid-template-columns: 42px 1fr 42px; }
.stepper button { height: 52px; background: #0a100a; border: 1px solid #253825; cursor: pointer; font-size: 20px; color: #93a993; }
.stepper button:hover { color: var(--cyan); border-color: var(--cyan); }
.stepper input { border-left: 0; border-right: 0; text-align: center; padding: 0 5px; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { display: none; }
.calculate-button { height: 52px; background: var(--cyan); color: #071006; border: 0; cursor: pointer; font: 700 12px "Chakra Petch", sans-serif; letter-spacing: .13em; display: flex; align-items: center; justify-content: center; gap: 21px; transition: .2s; box-shadow: 0 0 24px rgba(120,255,79,.17); }
.calculate-button:hover { background: #a0ff82; transform: translateY(-2px); box-shadow: 0 7px 28px rgba(120,255,79,.28); }
.calculate-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.form-error { color: #ff8990; font-size: 12px; min-height: 18px; margin: 10px 0 0; }

.search-results { position: absolute; z-index: 10; top: calc(100% + 8px); width: 100%; border: 1px solid #2a432a; background: #080e08; max-height: 352px; overflow-y: auto; box-shadow: 0 22px 40px rgba(0,0,0,.55); }
.search-results button { width: 100%; display: flex; align-items: center; text-align: left; gap: 12px; padding: 11px 14px; background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-results button:hover { background: var(--cyan-dim); }
.search-results strong, .search-results small { display: block; }
.search-results strong { font-size: 13px; }
.search-results small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.mini-icon { width: 36px; height: 36px; display: grid; place-items: center; background: #122012; color: var(--cyan); font: 700 10px "Chakra Petch"; border: 1px solid #2c482b; }
.mini-icon, .item-icon { position: relative; overflow: hidden; }
.mini-icon img, .item-icon img { width: 100%; height: 100%; object-fit: contain; }
.mini-icon .icon-fallback, .item-icon .icon-fallback { display: none; }
.mini-icon.image-missing .icon-fallback, .item-icon.image-missing .icon-fallback { display: grid; position: absolute; inset: 0; place-items: center; }
.no-match { padding: 13px; color: var(--muted); font-size: 12px; margin: 0; }

.results-section { max-width: 1120px; margin: 0 auto; padding: 50px 24px 90px; scroll-margin-top: 30px; }
.results-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 26px; }
.results-heading .eyebrow { justify-content: flex-start; }
.results-heading h2 { font-size: 32px; text-transform: uppercase; margin: 9px 0 0; }
.target-chip { text-align: right; }
.target-chip span { display: block; color: var(--muted); font: 600 9px "Chakra Petch"; letter-spacing: .15em; margin-bottom: 6px; }
.target-chip strong { font: 600 14px "Chakra Petch"; color: var(--cyan); }
.results-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.recipe-panel, .summary-panel { border: 1px solid var(--line); background: rgba(8, 14, 8, .9); }
.panel-title { min-height: 91px; padding: 22px 25px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-kicker { color: var(--cyan); font: 600 9px "Chakra Petch"; letter-spacing: .16em; }
.panel-title h3, .summary-panel h3 { margin: 6px 0 0; text-transform: uppercase; font-size: 18px; }
.text-button { border: 0; background: transparent; color: #779174; font: 600 9px "Chakra Petch"; letter-spacing: .12em; cursor: pointer; }
.text-button:hover { color: var(--cyan); }
.recipe-tree { padding: 10px 0; }
.tree-row { min-height: 65px; padding: 8px 22px; display: flex; align-items: center; gap: 13px; position: relative; }
.tree-row:hover { background: rgba(255,255,255,.018); }
.tree-children { display: none; margin-left: 41px; border-left: 1px solid #263b25; }
.node-toggle[aria-expanded="true"] + .item-icon { border-color: var(--cyan); }
.tree-node:has(> .tree-row > .node-toggle[aria-expanded="true"]) > .tree-children { display: block; }
.node-toggle { width: 19px; height: 24px; border: 0; padding: 0; background: transparent; cursor: pointer; flex: 0 0 auto; }
.node-toggle svg { width: 16px; fill: none; stroke: #6f896c; stroke-width: 1.8; transition: .2s; }
.node-toggle[aria-expanded="true"] svg { transform: rotate(90deg); stroke: var(--cyan); }
.node-dot { width: 19px; position: relative; }
.node-dot::after { content: ""; position: absolute; width: 5px; height: 5px; border: 1px solid #557152; border-radius: 50%; top: -3px; left: 5px; }
.item-icon { width: 39px; height: 39px; flex: 0 0 auto; border: 1px solid #3b5838; background: linear-gradient(135deg, #1b301a, #0c170c); display: grid; place-items: center; color: #b3d8ae; font: 700 10px "Chakra Petch"; clip-path: polygon(10% 0, 90% 0, 100% 10%, 100% 90%, 90% 100%, 10% 100%, 0 90%, 0 10%); }
.item-icon.blue { color: #74d8ff; background: #12334b; }.item-icon.rust { color: #f7a16c; background: #3a2824; }.item-icon.dark { color: #9ba9b3; background: #1c252c; }.item-icon.gray { color: #c0c6cc; background: #30383e; }.item-icon.bone { color: #efe1bb; background: #3c382c; }.item-icon.aqua { color: #5ff5eb; background: #0c3d43; }.item-icon.gold { color: #ffd46c; background: #48381a; }
.item-info { min-width: 0; flex: 1; }
.item-info strong, .item-info span { display: block; }
.item-info strong { font-size: 13px; }
.item-info span { color: #70876d; font-size: 10px; margin-top: 4px; }
.craft-badge { color: var(--cyan); border: 1px solid rgba(120,255,79,.22); background: var(--cyan-dim); padding: 5px 7px; font: 600 8px "Chakra Petch"; letter-spacing: .1em; }
.item-count { margin-left: auto; color: #dbe7e9; font: 600 12px "Chakra Petch"; }

.summary-panel { padding: 27px; border-top: 2px solid var(--cyan); }
.summary-icon { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(120,255,79,.25); background: var(--cyan-dim); margin-bottom: 21px; }
.summary-icon svg { width: 22px; fill: none; stroke: var(--cyan); stroke-width: 1.4; }
.summary-panel > p { color: #788f75; font-size: 11px; line-height: 1.65; margin: 12px 0 23px; }
.raw-list { border-top: 1px solid var(--line); }
.raw-row { min-height: 58px; display: flex; gap: 11px; align-items: center; border-bottom: 1px solid var(--line); }
.raw-row .item-icon { width: 38px; height: 38px; flex: 0 0 38px; padding: 2px; font-size: 8px; clip-path: none; border-radius: 4px; }
.raw-row .item-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.raw-row > span:not(.item-icon) { flex: 1; font-size: 11px; color: #acbbaa; }
.raw-row strong { color: var(--cyan); font: 600 12px "Chakra Petch"; }
.summary-total { display: flex; justify-content: space-between; align-items: end; padding-top: 23px; }
.summary-total span { color: #70896d; font: 600 9px "Chakra Petch"; letter-spacing: .13em; }
.summary-total strong { color: var(--white); font: 700 24px "Chakra Petch"; }

.empty-state { max-width: 1072px; height: 280px; margin: 0 auto 90px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.empty-orbit { width: 46px; height: 46px; border: 1px solid #284227; transform: rotate(45deg); display: grid; place-items: center; margin-bottom: 21px; }
.empty-orbit span { width: 12px; height: 12px; border: 1px solid var(--cyan); }
.empty-state p { margin: 0 0 8px; color: #687f65; font: 600 10px "Chakra Petch"; letter-spacing: .18em; }
.empty-state > span { color: #465b44; font-size: 11px; }
footer { border-top: 1px solid var(--line); padding: 25px clamp(24px, 5vw, 76px); display: flex; justify-content: space-between; color: #475b45; font: 500 8px "Chakra Petch"; letter-spacing: .13em; }
[hidden] { display: none !important; }

@media (max-width: 800px) {
  .hero { padding-top: 70px; }
  .calculator-shell { grid-template-columns: 1fr 160px; }
  .calculate-button { grid-column: 1 / -1; }
  .results-layout { grid-template-columns: 1fr; }
  .summary-panel { order: -1; }
  .header-tag { display: none; }
}
@media (max-width: 540px) {
  .site-header { height: 68px; }
  .brand { gap: 10px; font-size: 12px; letter-spacing: .08em; }
  .brand-mark { width: 25px; height: 25px; }
  .brand-mark span { width: 8px; height: 8px; }
  .hero { padding: 58px 16px 40px; }
  h1 { font-size: 43px; }
  .calculator-shell { grid-template-columns: 1fr; padding: 15px; }
  .calculate-button { grid-column: auto; }
  .results-section { padding-left: 16px; padding-right: 16px; }
  .results-heading { align-items: flex-start; gap: 18px; flex-direction: column; }
  .target-chip { text-align: left; }
  .tree-row { padding-left: 13px; padding-right: 13px; gap: 9px; }
  .tree-children { margin-left: 22px; }
  .craft-badge { display: none; }
  .summary-panel { padding: 22px; }
  footer { flex-direction: column; gap: 9px; }
}
