@font-face {
    font-family: "Minecraft Ten";
    src: url("../fonts/MCTenLowercaseAlt.woff2") format("woff2"), url("../fonts/MCTenLowercaseAlt.woff") format("woff");
    font-display: swap;
}

@font-face {
    font-family: "Minecraft Seven";
    src: url("../fonts/MinecraftSeven2.woff2") format("woff2"), url("../fonts/MinecraftSeven2.woff") format("woff");
    font-display: swap;
    size-adjust: 50%;
}

@font-face { font-family: "Minecraft Seven"; src: local("Segoe UI"), local("Helvetica Neue"), local("Arial"), local("Roboto"); unicode-range: U+003A; }
@font-face { font-family: "Minecraft Ten"; src: local("Segoe UI"), local("Helvetica Neue"), local("Arial"), local("Roboto"); unicode-range: U+003A; }

:root {
    --bg: #fbfbfd;
    --surface: #ffffff;
    --fill: #f2f2f5;
    --fill-2: #e8e8ed;
    --text: #1d1d1f;
    --secondary: #6e6e73;
    --tertiary: #a1a1a6;
    --hairline: #d2d2d7;
    --accent: #3c8527;
    --accent-hover: #2f6b1e;
    --danger: #d70015;
    --slot: #e3e3e8;
    --display: "Minecraft Ten", "Minecraft Seven", system-ui, sans-serif;
    --ui: "Minecraft Seven", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, "SF Mono", Consolas, monospace;
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --nav-h: 48px;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: rgba(0, 0, 0, 0.7);
        --surface: #161617;
        --fill: #1d1d1f;
        --fill-2: #2c2c2e;
        --text: #f5f5f7;
        --secondary: #a1a1a6;
        --tertiary: #6e6e73;
        --hairline: #38383a;
        --accent: #5bb445;
        --accent-hover: #72c75c;
        --danger: #ff453a;
        --slot: #2c2c2e;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 12px); 
    background-image: url("https://www.minecraft.net/content/dam/minecraftnet/games/minecraft/key-art/FGD-26_Video-Banner-A_Trailer-Thumbnail_1920x1080.jpg");
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

html { overflow-x: clip; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--ui);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1.1; letter-spacing: 0; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--fill); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent);
}
.nav-inner {
    max-width: 1080px;
    height: 100%;
    margin: 0 auto;
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); font-family: var(--display); font-size: 17px; }
.logo:hover { text-decoration: none; }
.logo-block {
    width: 18px; height: 18px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    image-rendering: pixelated;
}
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-links a { color: var(--secondary); font-size: 13px; transition: color 0.2s var(--ease); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); text-decoration: none; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 18px;
    border: 0;
    border-radius: 980px;
    font: inherit;
    font-size: 14px;
    color: #fff;
    background: var(--accent);
    cursor: pointer;
    transition: background 0.2s var(--ease), opacity 0.2s var(--ease), transform 0.1s var(--ease);
}
.button:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.button:active { transform: scale(0.97); }
.button[disabled] { opacity: 0.5; cursor: default; }
.button.secondary { color: var(--text); background: var(--fill-2); }
.button.secondary:hover { background: var(--hairline); color: var(--text); }
.button.small { height: 28px; padding: 0 12px; font-size: 12px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--danger); }
.chevron::after { content: " \203A"; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.intro { text-align: center; padding: 88px 0 56px; }
.intro h1 { font-size: clamp(40px, 7vw, 72px); }
.intro p { margin-top: 14px; font-size: clamp(17px, 2vw, 21px); color: var(--secondary); }
.intro .actions { margin-top: 26px; display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; font-size: 17px; }

.trades-bar {
    position: sticky;
    top: var(--nav-h);
    z-index: 20;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
}
.trades-bar::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent);
}
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.tab {
    flex: none;
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 980px;
    background: transparent;
    color: var(--secondary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); }
.search { position: relative; flex: 0 1 220px; }
.search input[type="search"] { padding-left: 32px; height: 32px; border-radius: 980px; font-size: 13px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--tertiary); pointer-events: none; }

.profession { padding: 28px 0 80px; animation: fade 0.35s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.profession-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.profession-title h2 { font-size: 34px; }
.workstation { display: inline-flex; align-items: center; gap: 10px; color: var(--secondary); font-size: 13px; }
.searching .profession { padding: 20px 0 8px; }
.searching .profession-title h2 { font-size: 24px; }

.level { margin-top: 26px; }
.level-name { font-size: 12px; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.level-name span { margin-left: 10px; text-transform: none; letter-spacing: 0; color: var(--tertiary); }
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--hairline) inset; }
@media (prefers-color-scheme: dark) { .rows { box-shadow: none; } }
.trade { display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.trade + .trade { box-shadow: 0 -1px 0 var(--hairline); }
.side { display: flex; gap: 6px; align-items: center; }
.slot { position: relative; width: 48px; height: 48px; flex: none; display: grid; place-items: center; background: var(--slot); border-radius: 7px; }
.slot img { width: 38px; height: 38px; image-rendering: pixelated; animation: icon-in 0.25s var(--ease); }
.slot.slot-small { width: 43px; height: 43px; }
.slot.missing i { font-style: normal; font-family: var(--display); font-size: 16px; color: var(--tertiary); }
.slot .glint {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38px;
    height: 38px;
    transform: translate(-50%, -50%);
    overflow: hidden;
    pointer-events: none;
    -webkit-mask: var(--icon) center / 100% 100% no-repeat;
    mask: var(--icon) center / 100% 100% no-repeat;
    mix-blend-mode: screen;
    mix-blend-mode: plus-lighter;
    opacity: 0.85;
}
.slot .glint::before {
    content: "";
    position: absolute;
    top: -100%;
    left: -100%;
    width: calc(300% + 77px);
    height: 300%;
    background: var(--glint) 0 0 / 77px 77px repeat;
    image-rendering: pixelated;
    transform: rotate(10deg) translate3d(0, 0, 0);
    will-change: transform;
    animation: glint-scroll 3.2s linear infinite;
}
@keyframes glint-scroll {
    from { transform: rotate(10deg) translate3d(0, 0, 0); }
    to { transform: rotate(10deg) translate3d(-77px, 0, 0); }
}
@keyframes icon-in { from { opacity: 0; } to { opacity: 1; } }
.slot b { position: absolute; right: 4px; bottom: 1px; font-weight: 400; font-size: 16px; line-height: 1; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
.arrow { color: var(--tertiary); font-size: 14px; }
.trade-text { margin-left: auto; text-align: right; min-width: 0; }
.trade-text strong { display: block; font-weight: 400; font-size: 14px; }
.trade-text > span { display: block; font-size: 12px; color: var(--secondary); }
.no-results { text-align: center; color: var(--secondary); padding: 80px 0; }

.footer { border-top: 1px solid var(--hairline); color: var(--secondary); font-size: 12px; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 20px; padding-bottom: 32px; }
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer a { color: var(--secondary); }
.footer a:hover { color: var(--text); }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
textarea { height: auto; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--tertiary); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
select {
    appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238e8e93' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
input[type="color"] { width: 36px; height: 36px; padding: 0; border: 1px solid var(--hairline); border-radius: 8px; background: none; cursor: pointer; flex: none; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--secondary); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.drop {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 92px; padding: 10px;
    border: 1px dashed var(--hairline); border-radius: 10px;
    background: var(--fill);
    color: var(--secondary); font-size: 12px; text-align: center;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img { width: 40px; height: 40px; image-rendering: pixelated; display: none; border-radius: 4px; }
.drop.filled img { display: block; }
.drop.filled { color: var(--text); }
.drop small { color: var(--tertiary); font-size: 11px; }

.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - var(--nav-h)); }
.sidebar {
    position: sticky; top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    display: flex; flex-direction: column;
    padding: 20px 12px;
    border-right: 1px solid var(--hairline);
    background: var(--bg);
}
.sidebar nav { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.group + .group { margin-top: 18px; }
.group p { padding: 0 10px 4px; font-size: 11px; color: var(--tertiary); text-transform: uppercase; letter-spacing: 0.08em; }
.item {
    display: flex; align-items: center; justify-content: space-between;
    height: 30px; padding: 0 10px; border-radius: 7px;
    color: var(--text); font-size: 13px;
    transition: background 0.15s var(--ease);
}
.item:hover { background: var(--fill); text-decoration: none; }
.item.active { background: var(--accent); color: #fff; }
.item em { font-style: normal; font-size: 12px; color: var(--tertiary); }
.item.active em { color: rgba(255, 255, 255, 0.8); }
.item em:empty { display: none; }

.export { padding: 14px 4px 0; border-top: 1px solid var(--hairline); display: grid; gap: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 2px; border-radius: 8px; background: var(--fill-2); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { text-align: center; padding: 4px 0; border-radius: 6px; font-size: 12px; color: var(--secondary); cursor: pointer; transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.segmented input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.segmented input:focus-visible + label { outline: 2px solid var(--accent); }

.main { padding: 44px clamp(22px, 5vw, 64px) 96px; max-width: 900px; width: 100%; min-width: 0; }
.sidebar { min-width: 0; }
input[type="file"] { width: 100%; max-width: 100%; min-width: 0; font: inherit; font-size: 12px; color: var(--secondary); }
.panel { display: none; }
.panel.active { display: block; animation: fade 0.3s var(--ease); }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.panel-head h1, .panel-head h2 { font-size: 34px; }
.panel-head p { margin-top: 6px; color: var(--secondary); font-size: 14px; max-width: 560px; }
.panel-head .aside { display: flex; gap: 16px; align-items: center; font-size: 13px; }

.card { background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--hairline) inset; }
@media (prefers-color-scheme: dark) { .card { box-shadow: none; } }
.card-body { padding: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }

.entries { display: grid; gap: 12px; }
.entries:empty::before { content: attr(data-empty); display: block; padding: 48px 0; text-align: center; color: var(--tertiary); font-size: 14px; }
.entry { animation: fade 0.3s var(--ease); }
.entry-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--hairline); }
.entry-head strong { font-weight: 400; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-head strong:empty::before { content: "Untitled"; color: var(--tertiary); }
.entry-head .link { margin-left: auto; font-size: 13px; }
.entry-body { padding: 18px; display: grid; gap: 16px; }
.label { font-size: 12px; color: var(--secondary); }
.json-state { font-size: 12px; min-height: 1em; }
.json-state.ok { color: var(--accent); }
.json-state.error { color: var(--danger); }
.inline { display: flex; gap: 8px; align-items: center; }

.subrows { display: grid; gap: 8px; }
.subrow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
    padding: 12px;
    border-radius: 10px;
    background: var(--fill);
}
.subrow .link { justify-self: start; padding-bottom: 9px; font-size: 13px; }
.subrow .file-state { grid-column: 1 / -1; font-size: 12px; color: var(--accent); }
.subrow .file-state:empty { display: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.stat { padding: 14px 16px; }
.stat strong { display: block; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--secondary); }

.report { margin-top: 16px; padding: 16px 18px; font-size: 13px; }
.report h3 { font-family: var(--ui); font-size: 14px; margin-bottom: 6px; }
.report ul { margin: 0; padding-left: 18px; color: var(--secondary); display: grid; gap: 4px; }
.report.error h3 { color: var(--danger); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 14px; padding: 14px 18px; font-size: 14px; }
.steps li + li { box-shadow: 0 -1px 0 var(--hairline); }
.steps li::before { content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); font-size: 12px; }
.downloads { list-style: none; margin: 16px 0 0; padding: 0; }
.downloads li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; font-size: 14px; }
.downloads li + li { box-shadow: 0 -1px 0 var(--hairline); }
.downloads span { color: var(--secondary); font-size: 13px; }

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100% - 32px); }
.toast {
    padding: 10px 18px; border-radius: 980px;
    background: color-mix(in srgb, var(--text) 88%, transparent); color: var(--bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    font-size: 13px; text-align: center;
    animation: toast-in 0.3s var(--ease);
}
.toast.error { background: var(--danger); color: #fff; }
.toast.out { animation: toast-out 0.25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.lost { min-height: calc(100vh - var(--nav-h)); display: grid; place-content: center; text-align: center; gap: 14px; padding: 40px 22px; }
.lost h1 { font-size: clamp(64px, 14vw, 120px); }
.lost p { color: var(--secondary); font-size: 17px; }

@media (max-width: 860px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: sticky; top: var(--nav-h); z-index: 20;
        height: auto; padding: 8px 12px;
        border-right: 0; border-bottom: 1px solid var(--hairline);
        background: color-mix(in srgb, var(--bg) 88%, transparent);
        backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    }
    .sidebar nav {
        display: flex;
        gap: 4px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
        padding-bottom: 6px;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent 100%);
    }
    .sidebar nav::-webkit-scrollbar { height: 4px; }
    .sidebar nav::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 4px; }
    .item { scroll-snap-align: start; }
    .group { display: contents; }
    .group p { display: none; }
    .item { flex: none; gap: 6px; }
    .export { grid-template-columns: 1fr auto; align-items: center; padding: 10px 0 2px; margin-top: 8px; }
    .main { padding-top: 28px; }
}

@media (max-width: 640px) {
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
        padding-bottom: 6px;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent 100%);
        mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent 100%);
    }
    .tabs::-webkit-scrollbar { height: 4px; }
    .tabs::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 4px; }
    .tab { scroll-snap-align: start; }
    .nav-links { gap: 16px; }
    .trades-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .search { flex-basis: auto; }
    .intro { padding: 56px 0 36px; }
    .trade { flex-wrap: wrap; row-gap: 6px; }
    .trade-text { margin-left: 0; text-align: left; flex: 1 1 100%; }
    .panel-head h1, .panel-head h2, .profession-title h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    *:not(.glint), *:not(.glint)::before, *::after { animation: none !important; transition: none !important; }
    .slot .glint::before { animation: glint-scroll 3.2s linear infinite !important; }
}

#loader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: var(--bg);
    color: var(--text);
    font-family: var(--ui);
    font-size: 20px;
    letter-spacing: 0.12em;
    transition: opacity 0.3s var(--ease), visibility 0.3s;
}
#loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
html.is-loading { overflow: hidden; }

.mc-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1100;
    pointer-events: none;
    padding: 6px 8px 5px;
    background: rgba(16, 0, 16, 0.94);
    box-shadow:
        0 -2px 0 rgba(16, 0, 16, 0.94),
        0 2px 0 rgba(16, 0, 16, 0.94),
        -2px 0 0 rgba(16, 0, 16, 0.94),
        2px 0 0 rgba(16, 0, 16, 0.94);
    font-family: "Minecraft Seven", var(--ui);
    font-size: 16px;
    line-height: 20px;
    letter-spacing: 0;
    white-space: normal;
    overflow-wrap: break-word;
    width: max-content;
    max-width: min(340px, calc(100vw - 16px));
    opacity: 0;
    visibility: hidden;
    -webkit-font-smoothing: none;
}
.mc-tooltip::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-image: linear-gradient(rgba(80, 0, 255, 0.31), rgba(40, 0, 127, 0.31)) 1;
    pointer-events: none;
}
.mc-tooltip.visible { opacity: 1; visibility: visible; }
.mc-tooltip-title { margin-bottom: 4px; }
.mc-tooltip-title:last-child { margin-bottom: 0; }
.slot[data-tip] { cursor: default; }

.pack-search { display: block; max-width: 420px; margin: 0 auto 28px; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; padding-bottom: 80px; }
.pack-card {
    display: flex; gap: 16px; align-items: center; padding: 16px;
    color: var(--text); background: var(--surface); border-radius: 16px;
    box-shadow: 0 0 0 1px var(--hairline) inset;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.pack-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 0 0 1px var(--accent) inset; }
.pack-icon { flex: none; width: 64px; height: 64px; border-radius: 10px; background: var(--slot); overflow: hidden; }
.pack-icon img, .pack-icon-large { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.pack-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pack-info strong { font-family: var(--display); font-weight: 400; font-size: 20px; }
.pack-info span { font-size: 13px; color: var(--secondary); }
.pack-info small { font-size: 12px; color: var(--tertiary); }

.pack-header { display: flex; gap: 20px; align-items: center; padding: 48px 0 24px; }
.pack-header h1 { font-size: clamp(32px, 6vw, 52px); }
.pack-header p { color: var(--secondary); margin-top: 6px; }
.pack-header small { display: block; margin-top: 6px; color: var(--tertiary); font-size: 12px; }
.pack-icon-large { width: 96px; height: 96px; flex: none; border-radius: 16px; background: var(--slot); }
.pack-tabs { margin-bottom: 24px; padding: 4px; border-radius: 999px; background: var(--fill); width: fit-content; max-width: 100%; }

.villager-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding-bottom: 80px; }
.villager-card { display: flex; gap: 14px; align-items: center; padding: 14px; background: var(--surface); border-radius: 16px; box-shadow: 0 0 0 1px var(--hairline) inset; }
.villager-render { flex: none; width: 120px; height: 120px; border-radius: 12px; background: var(--slot); display: grid; place-items: center; }
.villager-render img { width: 120px; height: 120px; image-rendering: pixelated; animation: icon-in 0.25s var(--ease); }
.villager-info { min-width: 0; }
.villager-info h3 { font-size: 22px; margin-bottom: 8px; }
.villager-info .label { font-size: 11px; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.villager-info .workstation { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--secondary); }
.biomes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.biomes li { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--fill-2); }
.biomes li.is-tag { font-family: var(--mono); font-size: 11px; }
.type-picker { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 13px; color: var(--secondary); }
.type-picker select { width: auto; min-width: 160px; }
.type-picker > span { flex: none; white-space: nowrap; }
.type-picker .ts-button { width: auto; min-width: 200px; }
.workstation .slot[data-item] { cursor: pointer; }
.workstation .slot[data-item]:hover { box-shadow: 0 0 0 2px var(--accent); }

.recipe-dialog { padding: 0; border: 0; background: transparent; max-width: calc(100vw - 24px); }
.recipe-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.recipe-panel {
    padding: 14px 16px 18px; color: #3f3f3f; background: #c6c6c6; border-radius: 4px;
    box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555, 0 0 0 2px #000, 0 20px 60px rgba(0, 0, 0, 0.4);
    font-family: "Minecraft Seven", var(--ui);
}
.recipe-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.recipe-head h2 { font-family: "Minecraft Seven", var(--ui); font-size: 16px; color: #3f3f3f; }
.dialog-close { border: 0; background: none; font-size: 24px; line-height: 1; color: #3f3f3f; cursor: pointer; }
.crafting { display: flex; align-items: center; gap: 18px; }
.crafting-grid { display: grid; grid-template-columns: repeat(3, 48px); gap: 2px; }
.crafting .slot { background: #8b8b8b; border-radius: 0; box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff; }
.crafting-result .slot { width: 64px; height: 64px; }
.crafting-arrow { width: 32px; height: 22px; background: linear-gradient(#8b8b8b, #8b8b8b) 0 7px / 20px 8px no-repeat, conic-gradient(from 225deg at 100% 50%, #8b8b8b 0 90deg, transparent 0) 16px 0 / 16px 22px no-repeat; }
.recipe-missing { margin-top: 12px; font-size: 13px; }

@media (max-width: 640px) {
    .pack-header { flex-direction: column; align-items: flex-start; padding-top: 28px; }
    .pack-tabs { width: 100%; }
    .villager-grid, .pack-grid { grid-template-columns: 1fr; }
    .villager-render, .villager-render img { width: 96px; height: 96px; }
    .crafting { gap: 10px; }
    .crafting-grid { grid-template-columns: repeat(3, 40px); }
    .crafting .slot { width: 40px; height: 40px; }
    .crafting .slot img { width: 32px; height: 32px; }
    .crafting-result .slot { width: 52px; height: 52px; }
}

body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body > main, body > .app { flex: 1 0 auto; }
body > .footer { margin-top: auto; }

.json-field .inline { gap: 14px; }
.manual-toggle { margin-left: auto; font-size: 12px; color: var(--secondary); }
.json-field[data-json-editor] .manual-only { display: none; }
.json-field[data-json-editor].is-manual .manual-only { display: block; }
.json-field[data-json-editor].is-manual button.manual-only { display: inline; }
.json-field[data-json-editor].is-manual .json-editor { display: none; }
.json-editor { display: grid; gap: 10px; }
.je-level, .je-group { border-radius: 10px; background: var(--fill); padding: 10px 12px; }
.je-group { display: grid; gap: 10px; }
.je-level summary { cursor: pointer; font-size: 13px; padding: 2px 0; list-style-position: inside; }
.je-level summary span { color: var(--tertiary); font-size: 12px; margin-left: 6px; }
.je-level[open] { display: grid; gap: 10px; }
.je-trade { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--hairline) inset; }
.je-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.je-row strong { font-weight: 400; font-size: 13px; margin-right: auto; }
.je-row .field { flex: 1 1 160px; }
.je-row > input { flex: 1 1 200px; }
.je-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.je-entry { background: var(--surface); padding: 10px; border-radius: 8px; }
.je-add-extra { grid-column: span 2; display: flex; align-items: flex-end; padding-bottom: 9px; font-size: 13px; }
.je-trade textarea { font-size: 12px; }
.je-props { display: grid; gap: 8px; }
.je-prop { padding: 10px; border-radius: 8px; background: var(--fill); display: grid; gap: 8px; }
.je-hint { font-size: 11px; color: var(--tertiary); flex: 1 1 200px; }
.je-note { font-size: 12px; color: var(--danger); margin: 0; }
.je-wide { grid-column: 1 / -1; }
.je-props select[data-add-prop] { max-width: 260px; }

.drop-edit { position: relative; z-index: 2; margin-top: 2px; padding: 2px 10px; border: 0; border-radius: 999px; background: var(--fill-2); color: var(--text); font: inherit; font-size: 11px; cursor: pointer; }
.drop-edit:hover { background: var(--accent); color: #fff; }
.tex-editor { width: min(1180px, calc(100vw - 16px)); max-height: calc(100vh - 16px); padding: 0; border: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.tex-editor::backdrop { background: rgba(0,0,0,.5); }
.te-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.te-head strong { font-weight: 400; font-size: 15px; }
.te-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 13px; }
.te-body { display: grid; grid-template-columns: 150px minmax(0, 1fr) 260px; min-height: 0; height: min(640px, calc(100vh - 90px)); }
.te-tools, .te-side { padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; font-size: 12px; }
.te-tools { border-right: 1px solid var(--hairline); }
.te-side { border-left: 1px solid var(--hairline); }
.te-tools [data-te-tool] { padding: 6px 8px; border: 0; border-radius: 7px; background: var(--fill); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.te-tools [data-te-tool].active { background: var(--accent); color: #fff; }
.te-field { display: flex; flex-direction: column; gap: 4px; color: var(--secondary); }
.te-field input[type="color"] { width: 100%; }
.te-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.te-swatches button { aspect-ratio: 1; border: 1px solid var(--hairline); border-radius: 4px; cursor: pointer; }
.te-stage { overflow: auto; display: grid; place-items: center; padding: 16px; background: repeating-conic-gradient(var(--fill) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px; }
.te-canvas-wrap { position: relative; }
.te-canvas-wrap canvas { display: block; image-rendering: pixelated; }
.te-canvas-wrap canvas[data-te="canvas"] { cursor: crosshair; touch-action: none; box-shadow: 0 0 0 1px var(--hairline); }
.te-canvas-wrap canvas[data-te="overlay"] { position: absolute; inset: 0; pointer-events: none; }
.te-preview { display: grid; place-items: center; gap: 4px; aspect-ratio: 1; border-radius: 10px; background: var(--slot); }
.te-preview img { width: 100%; image-rendering: pixelated; }
.te-preview span { font-size: 11px; color: var(--secondary); text-align: center; padding: 0 8px; }
.te-parts p { display: grid; grid-template-columns: 1fr 44px 34px; align-items: center; margin: 0; padding: 2px 0; }
.te-parts .te-parts-head { color: var(--tertiary); font-size: 11px; }
.te-help { color: var(--tertiary); font-size: 11px; margin: 0; }
@media (max-width: 860px) {
    .te-body { grid-template-columns: 1fr; height: auto; }
    .te-tools { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--hairline); }
    .te-side { border-left: 0; border-top: 1px solid var(--hairline); }
    .te-stage { min-height: 320px; }
}
.te-parts input[type="checkbox"] { justify-self: center; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.te-viewer { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--slot); cursor: grab; }
.te-viewer:active { cursor: grabbing; }
.te-viewer canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.te-viewer:fullscreen { aspect-ratio: auto; border-radius: 0; background: var(--bg); }
.te-full { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--surface); color: var(--text); font-size: 16px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.te-viewer-help { position: absolute; left: 8px; bottom: 6px; font-size: 10px; color: var(--secondary); pointer-events: none; }
.te-preview { aspect-ratio: auto; padding: 0; background: none; }
.te-preview img { border-radius: 10px; background: var(--slot); }
.te-faces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.te-faces button { padding: 5px 0; border: 0; border-radius: 7px; background: var(--fill); color: var(--text); font: inherit; font-size: 12px; text-transform: capitalize; cursor: pointer; }
.te-faces button.active { background: var(--accent); color: #fff; }

.je-row .check, .je-grid .check, .subrow .check { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0; margin: 0; }
.je-row > .link, .je-grid > .link, .subrow > .link { min-height: 36px; display: inline-flex; align-items: center; padding: 0; }
.je-add-extra { min-height: 36px; align-items: center; padding-bottom: 0; align-self: end; }
.je-row { align-items: flex-end; }
.je-row strong { align-self: center; }
.je-row:first-child { align-items: center; }
.je-row:first-child .check, .je-row:first-child .link { min-height: 0; }
.json-field .inline { align-items: center; }
.manual-toggle { min-height: 0 !important; }
.te-parts p span:first-child { display: inline-flex; align-items: center; gap: 6px; }

.je-row, .je-grid { align-items: end; }
.je-row > .check, .je-grid > .check, .je-row > .link, .je-grid > .link, .je-add-extra { min-height: 36px; display: inline-flex; align-items: center; padding: 0; margin: 0; }
.je-row:has(> strong) { align-items: center; }
.je-row:has(> strong) > .check, .je-row:has(> strong) > .link { min-height: 0; }
.je-hint { align-self: center; }
.mod-sources .file-button { position: relative; align-self: flex-start; cursor: pointer; }
.mod-sources ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.mod-sources li span { color: var(--tertiary); margin-left: 6px; }
.model-upload { gap: 12px; flex-wrap: wrap; align-items: center; }
.te-tools kbd { float: right; font: 11px var(--mono, monospace); color: var(--tertiary); }
.te-tools [data-te-tool].active kbd { color: rgba(255,255,255,.75); }
.te-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.te-slots button { padding: 5px 4px; border: 0; border-radius: 7px; background: var(--fill); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-slots button.active { background: var(--accent); color: #fff; }
.te-slot-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.te-viewer-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.te-viewer-tools button { height: 28px; min-width: 28px; padding: 0 8px; border: 0; border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.te-viewer-tools button.active { background: var(--accent); color: #fff; }
.te-flat { width: 100%; border-radius: 10px; background: var(--slot); image-rendering: pixelated; }

.mod-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 16px; }
.mod-sources > .label { margin: 0; }
.mod-sources > small, .mod-sources > ul { flex: 1 0 100%; margin: 0; }
.mod-sources ul:empty { display: none; }
.te-viewer:fullscreen { background: #d8d8de; }
.te-viewer:fullscreen::backdrop { background: #d8d8de; }
@media (prefers-color-scheme: dark) { .te-viewer:fullscreen, .te-viewer:fullscreen::backdrop { background: #3a3a40; } }
.field.mod-sources { flex-direction: row; align-items: center; }
.mod-sources > .label { flex: 0 0 auto; width: auto; text-align: left; }
.mod-sources > small { color: var(--secondary); font-size: 12px; }

.te-parts p { grid-template-columns: minmax(0, 1fr) 64px 52px; column-gap: 8px; }
.te-parts .te-parts-head span:nth-child(n+2) { text-align: center; }
.te-parts input[type="checkbox"] { justify-self: center; }
.je-grid { gap: 12px 14px; }
.je-row { gap: 12px 16px; }
.te-side, .te-tools { gap: 12px; }
.te-actions { gap: 16px; }
.eula-dialog { max-width: 480px; padding: 24px; border: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.eula-dialog::backdrop { background: rgba(0,0,0,.5); }
.eula-dialog h2 { font-size: 20px; margin: 0 0 12px; }
.eula-dialog p { font-size: 14px; color: var(--secondary); margin: 0 0 12px; line-height: 1.5; }
.eula-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 18px; }
#decompiler { position: fixed; inset: 0; z-index: 1001; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #fbfbfd; color: #1d1d1f; }
#decompiler.visible { display: flex; }
#decompiler strong { font: 20px/1 "Minecraft Seven", system-ui, sans-serif; letter-spacing: .12em; font-weight: 400; }
#decompiler span { font-size: 13px; color: #6e6e73; }
@media (prefers-color-scheme: dark) { #decompiler { background: #000; color: #f5f5f7; } #decompiler span { color: #a1a1a6; } }

.je-recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 150px)); gap: 6px; }
.je-recipe-grid input { font-size: 12px; }

[data-registry-sources] { list-style: none; padding: 0; display: grid; gap: 12px; }
[data-registry-sources] .source { display: grid; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--hairline) inset; }
.source-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.source-head strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-head span { color: var(--tertiary); font-size: 12px; margin-right: auto; white-space: nowrap; }
.source-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.source-results > * { flex: none; }
.source-results:empty { display: none; }
.source-results li { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; }
.source-results li code { font-family: var(--mono, monospace); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-results li em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--tertiary); white-space: nowrap; }
.source-results li.empty { color: var(--tertiary); min-height: 0; }
.source-results .slot { flex: none; }
.source-results .slot img, .source-results .slot .anim-icon { width: 32px; height: 32px; }
[data-registry-sources].card { padding: 0; background: none; box-shadow: none; border: 0; }
[data-registry-sources] > li.source { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; box-sizing: border-box; border-bottom: 0; }

.load-pack { margin-bottom: 14px; }
.load-pack .card-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.load-pack strong { display: block; font-weight: 500; }
.load-pack small { display: block; color: var(--secondary); font-size: 13px; margin-top: 2px; }
.load-pack-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.file-button { cursor: pointer; }
.button.secondary { background: var(--fill); color: var(--text); }

.section-label { margin: 18px 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--secondary); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; margin: 12px 0; }
.field.wide { grid-column: 1 / -1; }
.field small { font-size: 11px; color: var(--tertiary); }
[data-show] { display: contents; }
[data-show][hidden] { display: none; }
[data-show="custom"] { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
[data-show="custom"][hidden] { display: none; }
.me-note { color: var(--tertiary); font-size: 12px; }
.pack-icon-tile { margin-top: 12px; grid-template-columns: 118px; }
.note-card p { color: var(--secondary); font-size: 13px; margin: 4px 0 0; }
.version-note { font-size: 12px; color: var(--secondary); margin: 0 0 10px; text-align: center; }
.warnings { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: rgba(255, 159, 10, .12); font-size: 13px; }
.warnings ul { margin: 6px 0 0; padding-left: 18px; }
.model-editor .te-body { grid-template-columns: 170px minmax(0, 1fr) 300px; }
.me-stage { padding: 0; background: var(--slot); }
.me-viewer { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.me-cubes { display: grid; gap: 4px; }
.me-cubes button { padding: 6px 8px; border: 0; border-radius: 7px; background: var(--fill); color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-cubes button.active { background: var(--accent); color: #fff; }
.me-props { display: grid; gap: 10px; }
.me-xyz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.me-xyz.me-uv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.me-xyz input, .me-xyz select { min-width: 0; padding: 0 6px; }
.me-uv-map { width: 100%; image-rendering: pixelated; border-radius: 8px; }
@media (max-width: 860px) {
    .model-editor .te-body { grid-template-columns: 1fr; }
    .me-stage { min-height: 320px; }
    .me-viewer { height: 320px; }
}
.me-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.me-toolbar button { padding: 6px 8px; border: 0; border-radius: 7px; background: var(--fill); color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.me-toolbar button.active { background: var(--accent); color: #fff; }
.me-toolbar kbd { float: right; font: 11px var(--mono, monospace); color: var(--tertiary); }
.me-toolbar button.active kbd { color: rgba(255,255,255,.75); }
.me-uv-map { cursor: grab; }
.pack-icon-row { margin-top: 16px; grid-template-columns: 118px; }
.advanced-help { margin: -4px 0 12px; font-size: 12px; color: var(--secondary); }
.advanced-help summary { cursor: pointer; color: var(--accent); }
.advanced-help p { margin: 6px 0 0; line-height: 1.5; }
details.advanced { margin: 16px 0; padding: 12px 16px; border-radius: 12px; background: var(--fill); }
details.advanced summary { cursor: pointer; font-weight: 500; }
details.advanced .manual-toggle { margin: 8px 0 12px; }
.adv-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.adv-field code { font-size: 10px; color: var(--tertiary); margin-left: 4px; }
.adv-args { display: flex; flex-wrap: wrap; gap: 6px; }
.adv-args > * { flex: 1 1 70px; min-width: 0; }
.adv-args .check { flex: 0 0 auto; }
.adv-json { width: 100%; }
details.advanced { margin: 16px 0; padding: 12px 16px; border-radius: 12px; background: var(--fill); }
details.advanced summary { cursor: pointer; font-weight: 500; }
details.advanced .manual-toggle { margin: 8px 0 12px; }
.adv-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.adv-field code { font-size: 10px; color: var(--tertiary); margin-left: 4px; }
.adv-args { display: flex; flex-wrap: wrap; gap: 6px; }
.adv-args > * { flex: 1 1 70px; min-width: 0; }
.adv-args .check { flex: 0 0 auto; }
.adv-json { width: 100%; }
.adv-name { cursor: help; text-decoration: underline dotted var(--tertiary); text-underline-offset: 3px; width: fit-content; }
.adv-field { display: flex; flex-direction: column; gap: 6px; }

.custom-toggle { margin-top: 6px; font-size: 12px; }
.custom-card { grid-column: 1 / -1; display: grid; gap: 10px; margin: 6px 0 10px; padding: 14px 16px; border-radius: 12px; background: var(--fill); box-shadow: 0 0 0 1px var(--hairline) inset; }
.custom-card strong { font-weight: 500; }
.custom-card textarea { font-family: var(--mono, monospace); font-size: 12px; }

.custom-toggle { white-space: nowrap; flex: 0 0 auto; }
.custom-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.custom-cell > input { width: 100%; }
.custom-toggle input[type="checkbox"] { width: auto; }
.custom-cell .custom-toggle { font-size: 11px; margin-top: 0; }
.adv-args .check { white-space: nowrap; }
.checks .check { align-items: flex-start; line-height: 1.35; min-width: 0; }
.checks .check input { margin-top: 2px; flex: none; }

.display-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.display-preview .te-body { grid-template-columns: 170px minmax(0, 1fr) 280px; }
@media (max-width: 860px) { .display-preview .te-body { grid-template-columns: 1fr; } }

.custom-toggle, .custom-cell .custom-toggle { display: inline-flex; align-items: center; justify-content: flex-start; gap: 6px; width: auto; margin: 4px 0 0; padding: 0; }
.custom-toggle input { margin: 0; flex: none; }
.custom-cell { display: grid; grid-template-rows: auto auto; gap: 4px; align-content: start; }

.ench-row { padding: 12px 0; border-top: 1px solid var(--hairline); }
.ench-row > .link { align-self: end; }

.button, .button.small { white-space: nowrap; }
[data-show="custom"] { flex-wrap: wrap; }
[data-show="custom"] .check, .manual-toggle { white-space: nowrap; flex: 0 0 auto; }
[data-show="custom"] .me-note { flex: 1 1 200px; min-width: 0; }
.te-reset-view { position: absolute; top: 8px; left: 8px; z-index: 2; height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

[data-show="custom"] { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
[data-show="custom"][hidden] { display: none; }
[data-show="custom"] .button, [data-show="custom"] .check { flex: none; white-space: nowrap; width: auto; }
[data-show="custom"] .me-note { flex: 1 1 200px; }
.me-textures { display: grid; gap: 4px; font-size: 12px; } .me-textures small { color: var(--tertiary); }
.me-textures { display: grid; gap: 4px; font-size: 12px; } .me-textures small { color: var(--tertiary); }

.te-frames { display: grid; gap: 8px; }
.te-frame-list { display: flex; flex-wrap: wrap; gap: 6px; }
.te-frame { position: relative; width: 44px; height: 44px; padding: 2px; border: 2px solid transparent; border-radius: 8px; background: var(--slot); cursor: pointer; }
.te-frame.active { border-color: var(--accent); }
.te-frame img { width: 100%; height: 100%; image-rendering: pixelated; }
.te-frame span { position: absolute; right: 2px; bottom: 0; font-size: 10px; color: var(--secondary); }
.te-frame-actions { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; }

.fx-comp { margin: 10px 0; padding: 12px 14px; border-radius: 12px; background: var(--fill); display: grid; gap: 10px; }
.fx-comp-head { display: flex; align-items: center; gap: 10px; }
.fx-comp-head code { font-size: 11px; color: var(--tertiary); margin-right: auto; }
.fx-row { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.fx-box { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--hairline) inset; }
.fx-fields, .fx-pair { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
.fx-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--secondary); min-width: 0; }
.fx-field > textarea { font-family: var(--mono, monospace); font-size: 12px; }
.fx-node[data-fx="level"] { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.fx-node[data-fx="level"] > select { flex: 1 1 140px; }
.fx-node[data-fx="level"] > input, .fx-node[data-fx="level"] > .fx-field { flex: 1 1 90px; }
.fx-list { display: grid; gap: 6px; }
.fx-item { display: flex; gap: 8px; align-items: flex-start; }
.fx-item > :first-child { flex: 1; }
.fx-req summary { cursor: pointer; font-size: 12px; color: var(--secondary); }
.fx-add-comp select { max-width: 360px; }

.tex-editor .te-stage-col { display: flex; flex-direction: column; min-height: 0; padding: 0; }
.tex-editor .te-canvas-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 16px; }
.tex-editor .te-timeline { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 10px 14px; border-top: 1px solid var(--hairline); background: var(--surface, rgba(0,0,0,0.04)); }
.tex-editor .te-timeline[hidden] { display: none; }
.tex-editor .te-tl-actions { display: grid; grid-template-columns: repeat(2, auto); gap: 8px; }
.tex-editor .te-tl-actions .button { white-space: nowrap; }
.tex-editor .te-frame-list { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; min-height: 64px; align-items: center; }
.tex-editor .te-frame-list .te-frame { flex: none; }
.tex-editor .te-tl-timing { display: grid; gap: 8px; min-width: 150px; }
.tex-editor .te-tl-timing .check { white-space: nowrap; }
.tex-editor .te-side { display: flex; flex-direction: column; }
.tex-editor .te-side .te-viewer { flex: 1 0 260px; min-height: 260px; }
@media (max-width: 860px) {
  .tex-editor .te-timeline { grid-template-columns: 1fr; }
  .tex-editor .te-tl-actions { grid-template-columns: repeat(4, auto); justify-content: start; }
}

.tex-editor .te-stage.te-stage-col { display: flex; flex-direction: column; align-items: stretch; place-items: stretch; padding: 0; background: none; }
.tex-editor .te-stage.te-stage-col > .te-canvas-scroll { background: repeating-conic-gradient(var(--fill) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px; }
.tex-editor .te-stage.te-stage-col > .te-timeline { align-self: stretch; width: 100%; box-sizing: border-box; margin: 0; border-radius: 0; background: var(--bg, var(--surface)); }

.le-start { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
.le-start .link { text-transform: capitalize; }
.le-effect { padding: 14px; margin: 10px 0; border-radius: 12px; background: var(--fill); display: grid; gap: 10px; }
.le-list { display: grid; gap: 8px; padding-left: 12px; border-left: 2px solid var(--hairline); }
.le-node { padding: 10px; border-radius: 10px; background: var(--surface, rgba(255,255,255,0.04)); display: grid; gap: 8px; }
.le-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.le-head select { flex: 1; max-width: 360px; }
.le-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
.le-field { display: grid; gap: 4px; font-size: 12px; min-width: 0; }
.le-field > .le-list, .le-field > .le-rows { grid-column: 1 / -1; }
.le-fields > .le-field[data-kind="conds"], .le-fields > .le-field[data-kind="fns"], .le-fields > .le-field[data-kind="cond"], .le-fields > .le-field[data-kind^="rows:"] { grid-column: 1 / -1; }
.le-np { display: flex; gap: 6px; flex-wrap: wrap; } .le-np > * { flex: 1 1 80px; min-width: 0; }
.le-subrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; align-items: end; padding: 6px 0; }
.le-only summary { cursor: pointer; font-size: 12px; color: var(--secondary); }

.le-row { padding: 14px; margin: 10px 0; border-radius: 12px; background: var(--fill); display: grid; gap: 10px; }
.le-list { display: grid; gap: 8px; }
.le-item { border: 1px solid var(--hairline); border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: var(--surface); }
.le-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.le-head select { flex: 1 1 auto; max-width: 360px; }
.le-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
.le-field { display: grid; gap: 4px; font-size: 12px; align-content: start; }
.le-field[data-le-kind="conds"], .le-field[data-le-kind="fns"], .le-field[data-le-kind="cond1"], .le-field[data-le-kind="item"], .le-field[data-le-kind="entity"],
.le-field[data-le-kind="damage"], .le-field[data-le-kind="location"], .le-field[data-le-kind="raw"] { grid-column: 1 / -1; }
.le-nump, .le-range { display: flex; gap: 6px; flex-wrap: wrap; }
.le-nump > *, .le-range > * { flex: 1 1 70px; min-width: 0; }
.le-pred { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 12px; padding: 8px; border-radius: 8px; background: var(--fill); }
.le-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.wear-layers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.wear-layer { border: 1px solid var(--hairline); border-radius: 10px; padding: 8px 10px; display: grid; gap: 8px; }
.wear-layer-body { display: grid; gap: 8px; }
.wear-layer-body .tiles { grid-template-columns: 118px; }

.components .comp-row { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.components .comp-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.components .comp-head input { flex: 1 1 220px; min-width: 0; font-family: var(--mono); }
.components .comp-row textarea { width: 100%; }
.components .comp-row.invalid textarea { border-color: var(--danger, #d33); }
.components .comp-err { color: var(--danger, #d33); font-size: 12px; min-height: 0; }
.components .comp-err:empty { display: none; }
.components .comp-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding-top: 8px; }
.components .comp-json { width: 100%; margin-top: 8px; }
[data-vanilla-args]:empty, [data-item-args]:empty { display: none; }

select { text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.grid { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }

.prose { max-width: 760px; margin: 0 auto; padding: 56px 0 72px; color: var(--text); font-size: 16px; line-height: 1.6; }
.prose h2 { font-size: clamp(24px, 3vw, 30px); margin: 40px 0 12px; }
.prose h3 { font-size: 19px; margin: 28px 0 8px; }
.prose h4 { font-family: var(--ui); font-size: 16px; margin: 22px 0 6px; }
.prose p, .prose ul, .prose ol, .prose pre, .prose table { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose > :first-child { margin-top: 0; }
.prose pre { overflow-x: auto; padding: 14px 16px; border-radius: 12px; background: var(--fill); font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.prose th { color: var(--secondary); font-weight: 400; }
.prose .lead { font-size: clamp(17px, 2vw, 20px); color: var(--secondary); }
.prose details { margin: 24px 0; padding: 12px 16px; border-radius: 12px; background: var(--fill); }
.prose summary { cursor: pointer; font-family: var(--display); font-size: 18px; }
.prose .trade-level { margin: 14px 0 4px; color: var(--secondary); font-size: 13px; }
.prose details ul { columns: 2 280px; column-gap: 28px; }
.prose details li { break-inside: avoid; }
@media (max-width: 640px) { .prose { padding: 40px 0 56px; } .prose table { display: block; overflow-x: auto; } }
.site-text, .pack-text, article.prose { margin: 40px auto 64px; padding: 32px clamp(18px, 4vw, 40px); background: var(--surface); border-radius: 18px; box-shadow: 0 0 0 1px var(--hairline) inset; }
.prose h1 { font-size: clamp(32px, 5vw, 48px); margin-bottom: 16px; }
