.crafting-page {
    background:
        radial-gradient(ellipse at 15% -20%, #75654548, transparent 48%),
        radial-gradient(ellipse at 100% 0%, #48685530, transparent 46%),
        var(--background);
}
.crafting-page .masthead { border-bottom: 1px solid #ece9db25; }
.crafting { padding-block: clamp(20px, 4vw, 50px) 28px; }
.crafting-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 22px;
}
.crafting-title h1 { font-size: clamp(3.4rem, 8vw, 6.6rem); line-height: .87; letter-spacing: -.078em; }
.crafting-title h1 span { color: var(--accent); }
.crafting-title p { color: var(--muted); margin-top: .7rem; }
.search { position: relative; width: min(285px, 34vw); }
.search label { display: block; margin-bottom: 6px; color: var(--muted); font-weight: 600; font-size: .83rem; }
.search input {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    font: inherit;
    color: var(--paper);
    background: #1c241d;
    border: 1px solid var(--rule);
    border-radius: 8px;
}
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.results {
    position: absolute;
    z-index: 8;
    top: calc(100% + 5px);
    width: 100%;
    max-height: min(350px, 49vh);
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--rule);
    border-radius: 9px;
    background: #232a22;
    box-shadow: 0 16px 36px #0d120dc9;
}
.groups {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.groups button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 41px;
    padding: 6px 12px;
    border: 1px solid color-mix(in srgb, var(--group) 43%, #303730);
    border-radius: 8px;
    background: color-mix(in srgb, var(--group) 13%, #1b211c);
    font-size: .88rem;
    font-weight: 650;
}
.groups button::before, .item-link::before {
    width: 7px;
    height: 7px;
    flex: none;
    background: var(--group);
    border-radius: 2px;
    content: "";
}
.groups button:hover, .groups button[aria-pressed="true"] {
    border-color: var(--group);
    background: color-mix(in srgb, var(--group) 25%, #1b211c);
}
.workspace {
    --graph-height: clamp(470px, calc(100svh - 282px), 800px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(230px, 23vw, 300px);
    gap: 12px;
}
.graph-frame {
    position: relative;
    height: var(--graph-height);
    overflow: hidden;
    isolation: isolate;
    border: 1px solid #596456;
    border-radius: 12px;
    background:
        radial-gradient(#9fa89136 .9px, transparent 1px) 0 0 / 21px 21px,
        radial-gradient(ellipse at 55% 0%, #2a352d, #171f1c 70%);
}
#graph { position: absolute; inset: 0; }
.graph-tools {
    position: absolute;
    z-index: 2;
    right: 11px;
    bottom: 11px;
    display: flex;
    gap: 2px;
    padding: 3px;
    background: #131a17f2;
    border: 1px solid #596456;
    border-radius: 8px;
    box-shadow: 0 4px 15px #0b110e75;
}
.graph-tools button {
    min-width: 38px;
    min-height: 40px;
    padding: 5px 11px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    font-weight: 650;
}
.graph-tools button:not(#fit) { font-size: 1.2rem; line-height: 1; }
.graph-tools button:hover { background: #39463a; }
.details {
    min-width: 0;
    max-height: var(--graph-height);
    overflow: auto;
    scrollbar-width: thin;
    padding: 17px;
    border: 1px solid #464f43;
    border-radius: 12px;
    background: #202720;
}
.details:not([style]) { color: var(--muted); }
.details h2 { margin: 3px 0 10px; font-size: clamp(1.45rem, 2vw, 1.9rem); line-height: 1.03; letter-spacing: -.025em; }
.details p { margin: 0 0 8px; color: var(--muted); line-height: 1.43; }
.details .recipe-meta { color: var(--paper); padding: 8px 10px; border-radius: 5px; background: #e7e0c508; }
.recipe-meta small { display: block; margin-top: 4px; color: var(--muted); }
.results p { color: var(--muted); padding: 8px; }
.details h3 {
    margin: 18px 0 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f4eedc24;
    color: var(--muted);
    font-size: .86rem;
}
.detail-kind { color: var(--group); font-size: .81rem; font-weight: 750; }
.details ul { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.item-link {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 39px;
    padding: 6px 7px;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    font-size: .88rem;
    line-height: 1.27;
}
.item-link:hover { background: #e7e0c510; border-color: #e7e0c52c; }
.item-link small { color: var(--muted); }
.results .item-link { min-height: 44px; }
.crafting-page [hidden] { display: none !important; }
.view-switch { display: flex; gap: 5px; border-bottom: 1px solid var(--rule); margin-bottom: 15px; }
.view-switch button {
    background: transparent; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent;
    color: var(--muted); font: inherit; font-weight: 650;
}
.view-switch button[aria-pressed="true"] { border-color: var(--accent); color: var(--paper); }
.atlas-controls, .atlas-pager { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .86rem; }
.atlas-controls { justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.atlas-controls select, .atlas-pager button, .tree-jump, .sheet-close {
    border: 1px solid var(--rule); border-radius: 6px; padding: 7px 10px; color: var(--paper);
    background: #283329; font: inherit;
}
.atlas-controls select { margin-left: 5px; }
.atlas-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,134px),1fr)); gap: 8px; }
.atlas-card {
    display: grid; grid-template-rows: 76px 1fr auto; justify-items: start; gap: 5px;
    padding: 10px 12px; min-width: 0; text-align: left; color: var(--paper);
    background: radial-gradient(ellipse at 50% 7%, color-mix(in srgb,var(--group) 15%,#202720),#1d241e 85%);
    border: 1px solid color-mix(in srgb,var(--group) 24%,#303730); border-radius: 9px;
}
.atlas-card:hover, .atlas-card[aria-pressed="true"] { border-color: var(--group); }
.atlas-card[aria-pressed="true"] { box-shadow: inset 0 -2px var(--group); }
.atlas-card strong { line-height: 1.17; hyphens: auto; overflow-wrap: anywhere; }
.atlas-card small { max-width: 100%; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item-icon { display: inline-block; flex: none; width: 30px; height: 30px; background: var(--item-sheet) no-repeat; }
.atlas-card .item-icon { width: 76px; height: 76px; justify-self: center; }
.details > .item-icon { width: 88px; height: 88px; display: block; margin-bottom: 8px; }
.details:empty { visibility: hidden; }
.workspace[data-view="atlas"] { align-items: start; }
.workspace[data-view="atlas"] > .details { position: sticky; top: 12px; max-height: calc(100svh - 24px); }
.item-link.with-icon::before { display: none; }
.details .item-link:has(small) { grid-template-columns: auto minmax(0,1fr); column-gap: 9px; row-gap: 1px; }
.details .item-link:has(small) :is(.item-icon), .details .item-link:has(small)::before { grid-row: span 2; }
.details .item-link small { grid-column: 2; }
.tree-jump { margin-block: 4px; font-size: .86rem; }
.atlas-pager { justify-content: center; margin-top: 16px; }
.atlas-pager button { min-width: 42px; }
.atlas-pager button:disabled { opacity: .35; }
.detail-sheet { width: min(94vw, 430px); max-height: 82svh; margin: auto; padding: 10px; border: 1px solid var(--rule); border-radius: 12px; background: #202720; color: var(--paper); }
.detail-sheet::backdrop { background: #0c140ed4; }
.sheet-close { display: block; margin-left: auto; }
.detail-sheet .details { border: 0; }
.crafting :is(button,select):focus-visible, .detail-sheet button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 780px) {
    .workspace { --graph-height: clamp(360px, 57svh, 520px); grid-template-columns: 1fr; }
    .details { max-height: none; }
    .workspace[data-view="atlas"] > .details { display: none; }
}
@media (max-width: 490px) {
    .crafting-heading { align-items: stretch; flex-direction: column; gap: 13px; margin-bottom: 14px; }
    .crafting-title h1 { font-size: 3.3rem; }
    .crafting-title p { font-size: .92rem; margin-top: .45rem; }
    .search { width: 100%; }
    .groups { gap: 5px; }
    .groups button { padding-inline: 7px; min-height: 35px; font-size: .81rem; }
}
