@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(/fonts/inter_regular.ttf) format("truetype"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(/fonts/inter_medium.ttf) format("truetype"); }

:root {
  --bg: #0b0b0c;
  --panel: #111112;
  --panel-2: #151517;
  --raise: #1b1b1e;
  --line: #1f1f22;
  --line-2: #2a2a2e;
  --text: #ededee;
  --text-2: #a9a9b0;
  --muted: #6e6e76;
  --accent: #ff6a1a;
  --accent-2: #ff8040;
  --accent-ink: #170b04;
  --accent-soft: rgba(255, 106, 26, .1);
  --accent-line: rgba(255, 106, 26, .45);
  --r: 12px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --side: 236px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg.i { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232326; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #303034; }

.app { display: grid; grid-template-columns: var(--side) 1fr; height: 100%; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------------------ sidebar */
.side { border-right: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; }
.logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.logo svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.brand b { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav { position: relative; flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav h6 { margin: 18px 10px 6px; font-size: 12px; font-weight: 400; color: var(--muted); }
.nav-pill {
  position: absolute; top: 0; left: 0; border-radius: 8px; background: var(--raise); pointer-events: none; opacity: 0;
  transition: transform .38s var(--ease), width .38s var(--ease), height .38s var(--ease), opacity .2s;
}
.nav-pill.instant { transition: none; }
.nav-item {
  position: relative; width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; color: var(--text-2); text-align: left;
  transition: color .2s, background .2s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.025); }
.nav-item.on { color: var(--text); background: none; }
.nav-item svg { transition: color .25s; }
.nav-item.on svg { color: var(--accent); }
.nav-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item em { font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item em.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.nav-item.empty { opacity: .4; }
.side-foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; gap: 4px; }
.side-foot { align-items: center; }
.vol { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.vol input {
  flex: 1; min-width: 0; height: 4px; margin: 0 6px 0 0; appearance: none; -webkit-appearance: none; border-radius: 2px; cursor: pointer;
  background: linear-gradient(to right, var(--accent) var(--v, 80%), var(--line-2) var(--v, 80%));
}
.vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0; transition: transform .15s; }
.vol input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0; }
.vol input:hover::-webkit-slider-thumb { transform: scale(1.2); }
.vol.off input::-webkit-slider-thumb { background: var(--muted); }
.vol.off input::-moz-range-thumb { background: var(--muted); }

/* ------------------------------------------------------------------ top bar */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 10px; padding: 14px 28px; border-bottom: 1px solid var(--line); }
.crumbs { min-width: 0; }
.crumbs h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.015em; white-space: nowrap; }
.crumbs p { margin: 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .grow { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px; width: min(320px, 30vw); height: 36px; padding: 0 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; color: var(--muted);
  transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--line-2); background: var(--panel-2); color: var(--text-2); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); }
.search input::placeholder { color: var(--muted); }
kbd { font: 400 11px Inter, sans-serif; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; font-weight: 600; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, border-color .2s, color .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border: 1px solid var(--line-2); background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--raise); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.primary.danger { background: #e5484d; color: #fff; }
.btn.primary.danger:hover { background: #f2555a; }
.btn.io { gap: 6px; padding: 0 12px; }
.btn.io svg { width: 16px; height: 16px; }
.import-info { display: grid; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.import-info > div:not(.warn) { display: flex; justify-content: space-between; gap: 12px; }
.import-info > div:not(.warn) span { color: var(--muted); }
.import-info b { font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-info .warn { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.import-info .warn svg { flex: none; width: 16px; height: 16px; color: var(--accent); margin-top: 1px; }
.btn.ver { font-weight: 400; gap: 8px; padding: 0 10px 0 12px; }
.btn.ver svg { width: 15px; height: 15px; color: var(--muted); }
.ver-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); transition: background .3s; }
.ver-dot.set { background: var(--accent); }
.icon-btn {
  height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 8px; color: var(--text-2); padding: 0 8px; font-size: 13px; transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--raise); color: var(--text); }
.icon-btn.on { color: var(--accent); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.lnk { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s; }
.lnk:hover { color: var(--text); text-decoration-color: var(--text-2); }

/* ------------------------------------------------------------------ view */
.view { flex: 1; overflow-y: auto; padding: 24px 28px 56px; transition: opacity .13s var(--ease-io), transform .13s var(--ease-io); }
.view.out { opacity: 0; transform: translateY(4px); }
.enter .card, .enter .pack, .enter .part, .enter .toolbar, .enter .empty-state { animation: rise .55s var(--ease) both; animation-delay: var(--d, 0ms); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.card-h { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.card-h h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card-h .sub { color: var(--muted); font-size: 12.5px; }
.card-h > .sub { align-self: center; }
.card-h .grow { flex: 1; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat .lbl, .version-card .lbl { color: var(--muted); font-size: 12.5px; }
.stat .num { font-size: 28px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .num small { font-size: 15px; color: var(--muted); font-weight: 400; margin-left: 1px; }
.stat .hint, .version-card .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.meter { height: 3px; border-radius: 3px; background: var(--raise); margin-top: 14px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .9s var(--ease); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.version-card .ver-big { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; }
.version-card .btn { margin-top: 14px; }
.more { display: flex; justify-content: center; margin: 14px 0 2px; }

/* sources */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pack {
  position: relative; display: flex; gap: 12px; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); text-align: left; align-items: flex-start;
  transition: border-color .25s, background .25s, transform .2s var(--ease);
}
.pack:hover { border-color: var(--line-2); background: #18181a; }
.pack:active { transform: scale(.99); }
.pack.base { border-color: var(--accent-line); }
.pack-ico { width: 44px; height: 44px; border-radius: 8px; flex: none; image-rendering: pixelated; background: #1e1e21 center/cover; display: grid; place-items: center; font-weight: 600; color: #0b0b0c; font-size: 17px; }
.pack-ico.default { background: var(--raise); color: var(--text-2); }
.pack-ico.default svg { width: 22px; height: 22px; }
.pack-body { flex: 1; min-width: 0; }
.pack-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.pack-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-desc { color: var(--muted); font-size: 12px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3em; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip { font-size: 11.5px; padding: 1px 7px; border-radius: 5px; background: var(--raise); color: var(--text-2); white-space: nowrap; }
.chip.warn { color: #e8b45a; }
.pack-name .base-tag { flex: none; font-size: 11px; font-weight: 600; color: var(--accent); animation: fade .3s both; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.cat-bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); column-gap: 32px; row-gap: 10px; }
.bar-row { display: grid; grid-template-columns: 104px 1fr 78px; align-items: center; gap: 12px; font-size: 12.5px; }
.bar-row > span:first-child, .bar-row > .lnk { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; text-decoration: none; }
.bar { height: 6px; border-radius: 3px; background: var(--raise); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .9s var(--ease); }
.bar-row b { font-weight: 400; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.bar-row .bar:hover i { background: var(--accent-2); }
.count { color: var(--muted); font-size: 12.5px; }

.empty-state { display: grid; place-items: center; text-align: center; padding: 72px 20px; color: var(--text-2); }
.empty-state .big { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--raise); color: var(--text-2); margin-bottom: 16px; }
.empty-state .big svg { width: 26px; height: 26px; }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; font-weight: 600; }
.empty-state code { display: inline-block; margin-top: 10px; padding: 6px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); word-break: break-all; }

/* ------------------------------------------------------------------ category grid */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); }
.seg button { height: 28px; padding: 0 11px; border-radius: 6px; font-size: 13px; color: var(--text-2); transition: background .25s, color .25s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raise); color: var(--text); }
.toolbar .grow { flex: 1; }

.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 10px; }
.part {
  position: relative; display: flex; flex-direction: column; text-align: left; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); overflow: hidden;
  transition: border-color .25s, transform .25s var(--ease), background .25s;
}
.more-sentinel { height: 1px; }
.part:hover { border-color: var(--line-2); background: var(--panel-2); transform: translateY(-2px); }
.part.custom { border-color: var(--accent-line); }
.part .stage { position: relative; aspect-ratio: 1.25; display: grid; place-items: center; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.part .stage .tex { width: 50%; transition: transform .35s var(--ease); }
.part:hover .stage .tex { transform: scale(1.06); }
.sky-default { width: 100%; aspect-ratio: 1; border-radius: 10px; background: linear-gradient(#6f9cf7, #bcd4ff 70%, #dfe9ff); }
.sky-cell { width: 100%; aspect-ratio: 1; border-radius: 10px; background-size: 300% 200%; background-position: 50% 100%; transform: scaleX(-1); }
.tex img.sky-img { object-fit: cover; border-radius: 10px; image-rendering: auto; }
.sheet-frame { width: 100%; aspect-ratio: 1; background-size: calc(var(--n) * 100%) auto; background-position: 0 0; image-rendering: pixelated; }
.standin { display: contents; }
.standin .tex { opacity: .3; filter: grayscale(.8); }
.part .stage .standin .tex { width: 50%; }
.part .meta { padding: 10px 12px 12px; min-width: 0; }
.part .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part .from { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--muted); font-size: 12px; min-width: 0; }
.part .from span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part .badge, .part .flag { z-index: 1; }
.part .badge { position: absolute; top: 8px; right: 8px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.part .flag { position: absolute; top: 9px; left: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); font-size: 0; }
.dotc { width: 6px; height: 6px; border-radius: 50%; flex: none; }

.tex { position: relative; aspect-ratio: 1; overflow: hidden; display: grid; place-items: center; }
.tex img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.tex img.r3d { image-rendering: auto; animation: fade .3s both; }
.part .stage .tex[data-ent] { width: 72%; }
.part .stage .tex[data-icon] { width: 64%; }
.tex.ent-loading::after { content: ""; width: 34%; height: 34%; border-radius: 8px; background: var(--raise); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.tex img.anim { height: auto; align-self: start; animation: frames var(--dur, 1s) steps(var(--n, 1), jump-none) infinite; }
@keyframes frames { to { transform: translateY(var(--to, 0)); } }
.tex .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #2c2c30; }
.tex .ph svg { width: 40%; height: 40%; }
.sound-ph { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--raise); color: var(--text-2); }

/* ------------------------------------------------------------------ drawer */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); z-index: 20; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 21;
  background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .42s var(--ease);
}
.drawer.on { transform: none; }
.drawer.fresh .d-head > * { animation: fade .4s both; }
.drawer.fresh .variant { animation: rise .5s var(--ease) both; animation-delay: calc(var(--d, 0ms) + 80ms); }
.d-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.d-head .tex { width: 48px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); padding: 7px; flex: none; }
.d-head h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.d-head .key { color: var(--muted); font-size: 12px; margin-top: 1px; word-break: break-all; }
.d-head .grow { flex: 1; min-width: 0; }
.d-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.d-foot { display: flex; align-items: center; gap: 6px; padding: 12px 22px; border-top: 1px solid var(--line); }
.d-foot .grow { flex: 1; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.variant {
  position: relative; display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; text-align: left;
  border: 1px solid var(--line); background: var(--panel-2); transition: border-color .25s, transform .25s var(--ease);
}
.variant:hover { border-color: var(--line-2); transform: translateY(-1px); }
.variant.on { border-color: var(--accent); }
.variant .stage { aspect-ratio: 1; display: grid; place-items: center; }
.variant .stage .tex { width: 60%; transition: transform .35s var(--ease); }
.variant:hover .stage .tex { transform: scale(1.05); }
.variant .vm { padding: 9px 11px 11px; border-top: 1px solid var(--line); }
.variant .vn { font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; min-width: 0; }
.variant .vn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.variant .vs { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.variant .play, .variant .tick { z-index: 1; }
.variant .tick { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; transform: scale(0); opacity: 0; transition: transform .3s var(--ease), opacity .2s; }
.variant.on .tick { transform: scale(1); opacity: 1; }
.variant .tick svg { width: 12px; height: 12px; stroke-width: 2.6; }
.variant .play { position: absolute; left: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(11,11,12,.8); display: grid; place-items: center; color: var(--text); transition: background .2s, color .2s; }
.variant .play:hover { background: var(--accent); color: var(--accent-ink); }
.variant .play svg { width: 13px; height: 13px; }
.vanilla-ico { width: 44px; height: 44px; border-radius: 12px; border: 1px dashed #36363b; display: grid; place-items: center; color: var(--muted); }
.vanilla-ico svg { width: 22px; height: 22px; }
.d-section { margin: 22px 0 10px; color: var(--muted); font-size: 12.5px; }
.sound-list { display: flex; flex-direction: column; gap: 4px; }
.sound-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; transition: border-color .2s; }
.sound-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.sound-row .icon-btn { height: 26px; min-width: 26px; }
.sound-row.playing { border-color: var(--accent-line); }
.sound-row.playing .icon-btn { color: var(--accent); }

/* ------------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.modal.on { pointer-events: auto; }
.modal .bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .3s var(--ease); }
.modal.on .bg { opacity: 1; }
.sheet {
  position: relative; width: min(500px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 16px; padding: 24px; opacity: 0; transform: translateY(14px) scale(.985);
  transition: opacity .3s var(--ease), transform .4s var(--ease);
}
.modal.on .sheet { opacity: 1; transform: none; }
.modal.on .ver-opt { animation: rise .45s var(--ease) both; animation-delay: calc(var(--d, 0ms) * .6 + 60ms); }
.sheet h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.sheet p.sub { margin: 6px 0 18px; color: var(--muted); font-size: 13px; }
.ver-line { display: flex; align-items: center; gap: 6px; margin: 6px 0 18px; color: var(--text-2); font-size: 13px; }
.ver-line b { color: var(--text); font-weight: 600; }
.ver-line .lnk { margin-left: 6px; }
.versions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.ver-opt { display: flex; flex-direction: column; align-items: flex-start; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); text-align: left; transition: border-color .2s, background .2s, transform .15s var(--ease); }
.ver-opt b { font-weight: 600; font-size: 14px; }
.ver-opt span { color: var(--muted); font-size: 11.5px; }
.ver-opt:hover { background: var(--raise); }
.ver-opt:active { transform: scale(.97); }
.ver-opt.on { border-color: var(--accent); }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field input { width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); outline: 0; transition: border-color .2s; }
.field input:focus { border-color: var(--accent-line); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.summary div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.summary b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary span { color: var(--muted); font-size: 12px; }
.contrib { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; max-height: 170px; overflow-y: auto; }
.contrib .bar-row { grid-template-columns: 140px 1fr 44px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.actions .grow { flex: 1; }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.done { text-align: center; padding: 6px 0 2px; animation: fade .35s both; }
.done .ring { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); animation: pop .55s var(--ease) both; }
.done .ring svg { width: 26px; height: 26px; stroke-width: 2.6; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.done ol { text-align: left; color: var(--text-2); font-size: 13px; padding-left: 20px; margin: 16px 0 18px; }
.done ol code { color: var(--text); }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(23,11,4,.3); border-top-color: var(--accent-ink); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ dashboard fits the window */
.view.is-dash { overflow: hidden; display: flex; padding-bottom: 24px; }
.dash { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dash .stats { flex: none; }
.dash-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 12px; }
.dash .card.sources, .dash .col { min-height: 0; display: flex; flex-direction: column; }
.dash .scroll-area { min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.dash .sources .scroll-area { flex: 1; }
.dash .mix-card { flex: 0 1 auto; max-height: 34%; display: flex; flex-direction: column; min-height: 120px; }
.dash .cov-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dash .version-card { flex: none; }
.pack.pop { animation: rise .5s var(--ease) both; animation-delay: var(--d, 0ms); }
.pack-peek {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); background: transparent; transition: background .2s, color .2s; z-index: 1;
}
.pack-peek svg { width: 16px; height: 16px; }
.pack-peek:hover { background: var(--raise); color: var(--text); }
.pack .pack-body { padding-right: 22px; }
svg.i.inline { width: 14px; height: 14px; vertical-align: -2px; }
.cat-note { display: flex; gap: 8px; align-items: flex-start; margin: -4px 0 16px; color: var(--muted); font-size: 12.5px; max-width: 900px; }
.cat-note svg { width: 15px; height: 15px; margin-top: 1px; color: var(--text-2); }
@media (max-width: 1180px) {
  .view.is-dash { overflow-y: auto; display: block; }
  .dash { display: block; }
  .dash-main { grid-template-columns: minmax(0, 1fr); }
  .dash .scroll-area { overflow: visible; margin: 0; padding: 0; }
  .dash .mix-card { max-height: none; }
  .dash .col { margin-top: 12px; gap: 12px; }
}

/* inventory icon badge in the drawer */
.variant .stage { position: relative; }
.inv-badge { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; padding: 4px; border-radius: 6px; background: #8b8b8b; box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff; }
.inv-badge img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }

/* pack preview */
.sheet.wide { width: min(880px, 100%); height: min(720px, calc(100vh - 32px)); display: flex; flex-direction: column; padding: 0; }
.peek { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.peek-head { display: flex; gap: 14px; align-items: center; padding: 20px 20px 14px; }
.peek-head .grow { flex: 1; min-width: 0; }
.peek-head .sub { margin: 2px 0 0 !important; }
.peek-tabs { display: flex; gap: 4px; padding: 0 20px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.peek-tabs button { flex: none; height: 30px; padding: 0 11px; border-radius: 7px; font-size: 13px; color: var(--text-2); transition: background .2s, color .2s; }
.peek-tabs button:hover { color: var(--text); }
.peek-tabs button.on { background: var(--raise); color: var(--text); }
.peek-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.peek-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.peek-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px 8px; text-align: center; font-size: 12px; color: var(--text-2); animation: rise .45s var(--ease) both; animation-delay: var(--d, 0ms); min-width: 0; }
.peek-item .stage { display: grid; place-items: center; aspect-ratio: 1; }
.peek-item .tex { width: 64%; }
.peek-item span { display: block; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek .actions { padding: 12px 20px; border-top: 1px solid var(--line); }

/* 2D previews inside the preview window: inventory, font, gallery */
.v3d-2d { position: absolute; inset: 0; overflow: auto; display: none; padding: 24px; }
.v3d-2d.on { display: block; animation: fade .3s both; }
.inv-wrap { min-height: 100%; display: grid; place-items: center; }
.inv-box { position: relative; width: calc(176px * var(--s)); height: calc(166px * var(--s)); }
.inv-box img.inv { display: block; image-rendering: pixelated; width: 100%; height: 100%; }
.inv-slot { position: absolute; width: calc(16px * var(--s)); height: calc(16px * var(--s)); }
.inv-slot.hover::before { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .33); z-index: 1; }
.inv-slot img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.inv-slot .tex { width: 100%; height: 100%; }
.mc-tip {
  position: absolute; padding: 5px 9px; font-size: 15px; color: #fff; white-space: nowrap; z-index: 2;
  background: rgba(16, 0, 16, .94); border: 2px solid #2a0a5e; border-radius: 3px; box-shadow: inset 0 0 0 1px #5000ff55;
  font-family: Inter, sans-serif; text-shadow: 2px 2px 0 #3f3f3f;
}
.font-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px 0; }
.font-sample { image-rendering: pixelated; background: #3a2c22; padding: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.font-sheet { background: repeating-conic-gradient(#1b1b1f 0 25%, #222227 0 50%) 0 0 / 16px 16px; padding: 12px; border-radius: 10px; }
.font-sheet img { width: 384px; max-width: 100%; image-rendering: pixelated; display: block; }
.gal-title { color: var(--muted); font-size: 12.5px; margin: 18px 0 8px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gal-item { margin: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.gal-img { aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; background: repeating-conic-gradient(#18181b 0 25%, #1e1e22 0 50%) 0 0 / 16px 16px; }
.gal-img img { max-width: 80%; max-height: 80%; image-rendering: pixelated; min-width: 32px; object-fit: contain; }
.gal-img img.anim { max-height: none; width: 60%; align-self: start; margin-top: 20%; }
.gal-item figcaption { padding: 6px 8px; font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-files { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; columns: 2; }
.gal-screens { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-bottom: 18px; }
.gal-screen { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; border-radius: 12px; background: rgba(0,0,0,.35); }
.gal-screen img { image-rendering: pixelated; max-width: 100%; }
.gal-screen figcaption { color: var(--muted); font-size: 12px; }

/* preview window extras: time of day, totem pop */
.v3d-time { display: flex; align-items: center; gap: 10px; margin-left: 12px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.v3d-time[hidden] { display: none; }
.v3d-time input { width: min(320px, 30vw); accent-color: var(--accent); }
.v3d-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.totem-pop { position: absolute; left: 50%; top: 50%; width: 30%; max-width: 360px; image-rendering: pixelated; animation: totem 2.2s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes totem {
  0% { transform: translate(-50%, 60%) scale(.2) rotate(0); opacity: 0; }
  12% { opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(1.1) rotate(540deg); }
  75% { transform: translate(-50%, -55%) scale(1) rotate(720deg); opacity: 1; }
  100% { transform: translate(-50%, -160%) scale(.4) rotate(720deg); opacity: 0; }
}

/* ------------------------------------------------------------------ 3D viewer */
.v3d { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; padding: 24px; pointer-events: none; }
.v3d.on { pointer-events: auto; }
.v3d-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); opacity: 0; transition: opacity .3s var(--ease); }
.v3d.on .v3d-bg { opacity: 1; }
.v3d-panel {
  position: relative; width: min(1100px, 100%); height: min(760px, 100%); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(.985); transition: opacity .3s var(--ease), transform .4s var(--ease);
}
.v3d.on .v3d-panel { opacity: 1; transform: none; }
.v3d-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.v3d-title { flex: 1; min-width: 0; }
.v3d-modes[hidden] { display: none; }
.v3d-title h3 { margin: 0; font-size: 16px; font-weight: 600; }
.v3d-title p { margin: 0; color: var(--muted); font-size: 12.5px; }
.v3d-stage { position: relative; flex: 1; min-height: 0; background: #0f0f11; }
.v3d-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.v3d-stage canvas:active { cursor: grabbing; }
.v3d-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-2); font-size: 13.5px; pointer-events: none; opacity: 0; transition: opacity .2s; }
.v3d-msg.on { opacity: 1; }
.v3d-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px 10px 20px; border-top: 1px solid var(--line); }
.v3d-foot .grow { flex: 1; }
.v3d-foot .btn.on { border-color: var(--accent); color: var(--accent); }
.v3d-hint { color: var(--muted); font-size: 12.5px; }
@media (max-width: 860px) {
  .v3d { padding: 0; }
  .v3d-panel { height: 100%; border-radius: 0; }
  .v3d-hint { display: none; }
}

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 40; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-radius: 10px; background: var(--raise); border: 1px solid var(--line-2);
  font-size: 13px; transition: opacity .3s var(--ease), transform .4s var(--ease); max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast svg { color: var(--accent); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; height: auto; min-height: 100%; }
  .side { min-width: 0; position: sticky; top: 0; z-index: 10; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 12px 16px; }
  .nav { flex: none; display: flex; gap: 2px; overflow-x: auto; padding: 0 12px 10px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav h6, .nav-item em, .side-foot { display: none; }
  .nav-item { width: auto; flex: none; padding: 7px 11px; }
  .top { padding: 12px 16px; flex-wrap: wrap; }
  .crumbs { flex: 1; }
  .search { order: 3; width: 100%; }
  .btn.io span { display: none; }
  .top .grow { display: none; }
  .view { padding: 16px 16px 40px; overflow: visible; }
  .parts { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .stat .num { font-size: 23px; }
  .bar-row { grid-template-columns: 84px 1fr 70px; }
  .versions { grid-template-columns: repeat(2, 1fr); }
  .drawer { top: auto; height: 86vh; width: 100vw; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; transform: translateY(100%); }
  .variants { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
