:root {
  color-scheme: dark;
  --background: #101810;
  --surface: #172117;
  --surface-raised: #1b291d;
  --frame: #354532;
  --subtle: #293a29;
  --ink: #f2efe1;
  --muted: #a4b29b;
  --soft: #bac9af;
  --accent: #d6eb91;
  --accent-ink: #19230e;
  --copper: #e5c58d;
  --mono: "Cascadia Mono", Consolas, monospace;
  font-family: "Noto Sans CJK SC", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 290px; background: var(--background); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; height: 1px; width: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

.masthead {
  position: sticky; top: 0; z-index: 4;
  min-height: 76px; display: grid; grid-template-columns: minmax(195px, 1fr) minmax(230px, 540px) minmax(195px, 1fr);
  align-items: center; gap: 28px; padding: 12px 28px;
  background: #121b13; border-bottom: 1px solid var(--frame);
}
.brand { display: inline-flex; width: fit-content; align-items: center; gap: 12px; color: var(--ink); font-size: 20px; font-weight: 760; letter-spacing: .04em; }
.brand small { display: block; color: var(--soft); margin-top: 3px; font: 10px var(--mono); letter-spacing: .17em; }
.brand-mark { flex: none; height: 37px; width: 37px; background: #243421; border: 1px solid #45573c; display: grid; grid-template-columns: 7px 7px; grid-auto-rows: 7px; gap: 2px; place-content: center; border-radius: 5px; }
.brand-mark i { background: #b0ca68; }
.brand-mark i:nth-child(2) { background: #e4ed9c; }
.brand-mark i:nth-child(3) { background: #60854e; }
.brand-mark i:nth-child(4) { background: #90aa5c; }
.search { display: flex; align-items: center; padding: 0 11px 0 15px; gap: 12px; min-width: 0; border: 1px solid var(--frame); background: #1b291e; border-radius: 6px; }
.search:focus-within { border-color: var(--accent); }
.search-mark { display: inline-block; flex: none; height: 12px; width: 12px; border: 1.5px solid #b4c2a7; border-radius: 50%; position: relative; }
.search-mark::after { position: absolute; content: ""; width: 6px; height: 1.5px; background: #b4c2a7; transform: rotate(48deg); right: -5px; bottom: -2px; }
.search input { background: none; color: var(--ink); border: 0; outline: none; width: 100%; min-width: 0; height: 42px; font-size: 14px; padding: 0; }
.search input::placeholder { color: var(--muted); }
.search kbd { font: 12px var(--mono); border: 1px solid #435740; min-width: 21px; text-align: center; padding: 1px 4px; border-radius: 3px; color: var(--soft); }
.action, .quiet { border-radius: 5px; font-size: 13px; font-weight: 690; padding: 9px 12px; min-height: 36px; }
.action { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.action:not(:disabled):hover { background: #ecf6bd; border-color: #ecf6bd; }
.quiet { color: var(--soft); background: var(--surface); border: 1px solid var(--frame); }
.quiet:not(:disabled):hover { color: var(--ink); background: #293a28; }
.header-pack { justify-self: end; display: flex; gap: 10px; align-items: center; }
.header-actions { display: flex; align-items: center; justify-content: end; gap: 12px; }
.yard-link { white-space: nowrap; color: var(--copper); font-size: 12px; }
.yard-link:hover { text-decoration: underline; }
.header-pack span { background: #27331b; color: #e8f3bc; min-width: 22px; padding: 3px 5px; font: 12px var(--mono); border-radius: 3px; text-align: center; }

.workspace { display: grid; grid-template-columns: 184px minmax(0, 1fr) 294px; max-width: 1680px; margin: 0 auto; min-height: calc(100vh - 76px); }
.sidebar { padding: 25px 14px 24px; border-right: 1px solid var(--subtle); background: #141e15; }
.sidebar section + section { margin-top: 24px; }
.sidebar h2 { margin: 0 8px 8px; color: var(--muted); font-size: 12px; letter-spacing: .14em; font-weight: 650; }
.sidebar nav { display: grid; gap: 3px; }
.filter { text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; padding: 8px; border-radius: 3px; border: 1px solid transparent; background: transparent; color: var(--soft); font-size: 13px; }
.filter:hover { background: #223022; }
.filter[aria-pressed="true"] { background: #253729; color: #e7f5be; border-color: #3b583d; }
.filter b { font: 11px var(--mono); color: var(--muted); }
.filter[aria-pressed="true"] b { color: var(--accent); }
.sidebar-note { margin: 28px 5px 0; border-top: 1px solid var(--subtle); padding-top: 15px; line-height: 1.7; color: var(--muted); font-size: 12px; }
.sidebar-note summary { cursor: pointer; color: var(--soft); }

main { min-width: 0; padding: 23px 24px 35px; }
.collection-head {
  display: grid; grid-template-columns: 1fr minmax(180px, 48%); overflow: hidden; position: relative;
  min-height: 155px; background: #213427; border: 1px solid #405942; border-radius: 6px;
  isolation: isolate;
}
.collection-copy { z-index: 1; align-self: center; padding: 22px; }
.eyebrow { font: 10px var(--mono); letter-spacing: .16em; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.eyebrow span { width: 6px; height: 6px; background: var(--accent); display: inline-block; }
.collection-copy h1 { margin: 8px 0 6px; font-size: clamp(24px, 3vw, 39px); color: #f2f0dc; line-height: 1.12; letter-spacing: .06em; font-weight: 760; }
.collection-copy p { margin: 11px 0 0; color: #bacbac; font-size: 13px; }
.showcase { position: relative; min-width: 0; display: grid; align-content: stretch; isolation: isolate; }
.showcase::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg,#213427 0%,transparent 42%,#21342714 100%); }
.showcase-image { position: absolute; inset: 0; background-image: url("/media/packs/top/preview-scene.png"); background-position: 66% 39%; background-size: cover; image-rendering: pixelated; opacity: .87; }
body[data-view="side"] .showcase-image { background-image: url("/media/packs/side/preview-scene.png"); background-position: 52% 43%; }
body[data-view="shared"] .showcase-image { background-position: 81% 75%; }
.results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 23px 0 11px; }
.results-bar > div:first-child { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.results-bar h2 { margin: 0; font-size: 17px; letter-spacing: .04em; }
#results-count { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.results-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.results-actions > button { white-space: nowrap; }
.scene-filter { color: var(--soft); display: flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.scene-filter select { background: var(--surface); color: var(--ink); border: 1px solid var(--frame); border-radius: 4px; min-height: 34px; padding: 4px 6px; max-width: 118px; }
.page-nav { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--soft); font: 13px var(--mono); margin-top: 18px; }
main { scroll-margin-top: 88px; }
.motion-filter { color: var(--soft); display: flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
#status { font-size: 14px; color: var(--soft); }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(123px,1fr)); gap: 10px; }
.asset-card { position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--frame); border-radius: 6px; overflow: clip; }
.asset-card:hover { border-color: #819874; }
.asset-card[data-active="true"] { border-color: var(--accent); }
.asset-card[data-selected="true"] { box-shadow: inset 0 -2px 0 #a5c96f; }
.card-open { border: 0; width: 100%; display: block; text-align: left; color: var(--ink); padding: 0; background: transparent; }
.card-open:focus-visible { outline-offset: -3px; }
.card-art, .preview-stage {
  background-color: #213024;
  background-image: conic-gradient(#263729 25%, transparent 0 50%, #263729 0 75%, transparent 0);
  background-size: 16px 16px;
}
.card-art { height: 88px; display: grid; place-items: center; border-bottom: 1px solid var(--subtle); }
.thumb { background-repeat: no-repeat; image-rendering: pixelated; }
.audio-wave { display: flex; align-items: center; gap: 2px; width: min(100%, 250px); height: 60px; pointer-events: none; }
.audio-wave i { flex: 1; min-width: 1px; border-radius: 1px; background: var(--accent); opacity: .77; }
.audio-card-art { padding-inline: 14%; }
.audio-card-art .audio-wave { height: 36px; }
.audio-preview { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 12px; }
.audio-player { display: block; width: 100%; height: 38px; }
.audio-loop { display: flex; align-items: center; gap: 4px; color: var(--soft); font-size: 12px; }
.audio-status { color: var(--soft); font-size: 12px; }
.audio-status:empty { display: none; }
.card-check { position: absolute; top: 6px; left: 7px; margin: 0; z-index: 1; }
.card-kind {
  position: absolute; top: 6px; right: 6px; padding: 2px 4px;
  color: var(--soft); background: #152119dd; border: 1px solid #4c614b;
  font: 10px var(--mono); border-radius: 3px; pointer-events: none;
}
.card-meta { display: grid; padding: 8px 8px 10px; gap: 4px; }
.card-meta strong { font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-meta small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.inspector { min-width: 0; padding: 24px 16px; border-left: 1px solid var(--subtle); background: #141e15; }
.inspector-inner { position: sticky; top: 96px; }
.inspector-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; color: var(--soft); font-size: 13px; font-weight: 650; }
.preview-stage { height: 218px; display: grid; place-items: center; position: relative; border: 1px solid var(--frame); border-radius: 6px; overflow: clip; }
.preview-stage canvas { image-rendering: pixelated; max-width: 100%; max-height: 100%; }
.frame-label { position: absolute; bottom: 7px; right: 7px; font: 11px var(--mono); color: var(--soft); background: #152119ee; border: 1px solid var(--frame); border-radius: 3px; padding: 3px 6px; }
.inspect-title { margin: 14px 0 4px; font-size: 20px; overflow-wrap: anywhere; }
.inspect-id { color: var(--muted); font: 11px var(--mono); overflow-wrap: anywhere; }
.inspect-controls { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.inspect-controls button { min-height: 32px; padding: 5px 8px; }
.inspect-controls select { min-width: 55px; color: var(--ink); padding: 4px; border: 1px solid var(--frame); border-radius: 4px; background: var(--surface); }
.inspect-fields { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; border-top: 1px solid var(--frame); margin: 14px 0; padding-top: 12px; font-size: 12px; }
.inspect-fields dt { color: var(--muted); }
.inspect-fields dd { margin: 0; text-align: right; color: var(--ink); overflow-wrap: anywhere; }
.inspect-select { width: 100%; }
.empty-inspector { color: var(--muted); line-height: 1.7; font-size: 13px; }
dialog { width: min(492px,calc(100% - 24px)); max-height: min(620px,calc(100% - 24px)); overflow: auto; padding: 20px; border: 1px solid #5d7357; border-radius: 8px; color: var(--ink); background: #1a281c; box-shadow: 0 18px 60px #0009; }
dialog::backdrop { background: #080e0ac9; }
.dialog-head, .dialog-foot, .pack-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 5px 0 0; }
.dialog-foot { margin-top: 14px; }
.pack-list { margin: 14px 0 8px; max-height: 330px; overflow: auto; }
.pack-row { border-top: 1px solid var(--frame); padding: 8px 2px; font-size: 13px; }
.pack-row small { color: var(--muted); display: block; margin-top: 2px; }
.pack-row .quiet { padding: 4px 8px; min-height: 28px; }
#export-note { color: var(--soft); font-size: 13px; margin: 8px 0 0; }
@media (max-width: 1070px) {
  .workspace { grid-template-columns: 150px minmax(0, 1fr) 240px; }
  main { padding-inline: 15px; }
  .inspector { padding-inline: 11px; }
  .preview-stage { height: 182px; }
}
@media (max-width: 800px) {
  .masthead { min-height: 65px; padding: 9px 12px; gap: 10px; grid-template-columns: auto minmax(85px,1fr) auto; }
  .brand { font-size: 15px; gap: 7px; }
  .brand small, .search kbd { display: none; }
  .brand-mark { width: 29px; height: 29px; }
  .workspace { grid-template-columns: minmax(0,1fr) 218px; }
  .sidebar { grid-column: 1 / -1; display: grid; gap: 7px; border-right: 0; border-bottom: 1px solid var(--subtle); padding: 8px 12px; }
  .sidebar section { display: flex; align-items: center; }
  .sidebar section + section { margin: 0; }
  .sidebar h2 { margin: 0 10px 0 0; white-space: nowrap; }
  .sidebar nav { display: flex; gap: 4px; overflow: auto; }
  .filter { white-space: nowrap; width: auto; }
  .sidebar-note { display: none; }
}
@media (max-width: 600px) {
  .masthead { grid-template-columns: 1fr auto; }
  .search { grid-area: 2 / 1 / 3 / 3; }
  .workspace { display: flex; flex-direction: column; }
  main { padding: 12px; }
  .inspector { position: fixed; inset: auto 0 0; z-index: 5; max-height: 75vh; overflow: auto; padding: 12px 16px; border-top: 1px solid #697c60; border-left: 0; box-shadow: 0 -5px 24px #0009; }
  .inspector:not([data-mobile-open="true"]) { display: none; }
  .inspector-inner { position: static; max-width: 430px; margin: auto; }
  .preview-stage { height: 155px; }
  .collection-head { min-height: 118px; grid-template-columns: 1fr 39%; }
  .collection-copy { padding: 14px; }
  .eyebrow { font-size: 9px; }
  .results-bar { margin-top: 16px; }
  .asset-grid { grid-template-columns: repeat(auto-fill,minmax(105px,1fr)); gap: 7px; }
  .results-bar { flex-wrap: wrap; }
  .results-actions { gap: 5px; flex-wrap: wrap; }
}
@media (min-width: 601px) { .inspector-close { display: none; } }
