:root {
  color-scheme: dark;
  --bg: #060707;
  --surface: #141615;
  --surface-raised: #1b211e;
  --text: #f2f4f2;
  --muted: #a3b2a9;
  --accent: #4dff8e;
  --accent-dark: #2fd16b;
  --border: rgba(200, 230, 210, .15);
  --border-strong: rgba(200, 230, 210, .3);
  --warning: #f2c66d;
  --danger: #ff8585;
  --info: #8ec7ff;
  --work-pad: clamp(12px, 1.45vw, 28px);
  --topbar-height: 51px;
  --stage-fit: min(900px, max(320px, calc((100dvh - 198px) * 9 / 8)));
  font-family: Geist, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
h2, h3, p { margin: 0; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 640; }
button, input, select { font: inherit; color: inherit; }
button, input, select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #121814;
  min-height: 36px;
}
button { cursor: pointer; padding: 0 12px; white-space: nowrap; }
button:hover:enabled { border-color: var(--border-strong); background-color: #1b251e; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, .resource:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary { background: var(--accent); border-color: #84ffb0; color: #0a1910; font-weight: 650; }
button.primary:hover:enabled { background: #84ffb0; border-color: #acffc9; }
button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-dark); }
input, select { width: 100%; padding: 0 11px; }
input::placeholder { color: #91a398; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--topbar-height);
  padding: 7px var(--work-pad);
  border-bottom: 1px solid var(--border);
  background: #0d100e;
}
.section-heading { display: flex; align-items: center; gap: 12px; }
.subtle { color: var(--muted); font-size: 12px; }
.notice {
  margin: 12px var(--work-pad) 0;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: #111a14;
  overflow-wrap: anywhere;
}
.notice.error { border-color: rgba(255, 133, 133, .4); color: var(--danger); }
.notice.success { border-color: rgba(77, 255, 142, .35); color: #b6fbc9; }
.workspace {
  padding: var(--work-pad);
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(57%, var(--stage-fit));
  gap: clamp(12px, 1.2vw, 24px);
  align-items: start;
}
.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #181d19, #111412 110px);
  box-shadow: inset 0 1px rgba(255, 255, 255, .04), 0 12px 33px #0007;
}
.library {
  position: relative;
  display: flex;
  flex-direction: column;
  height: max(420px, calc(100dvh - var(--topbar-height) - 2 * var(--work-pad)));
}
.library-header { display: grid; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.section-heading { justify-content: space-between; }
.resource-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(104px, .38fr) minmax(104px, .38fr); gap: 8px; }
.resource-filters select { min-width: 0; }
.resource-display { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.resource-display select, .resource-view button { width: auto; min-height: 29px; font-size: 11px; }
.resource-display select { flex: 0 1 auto; max-width: 100%; padding-inline: 7px; }
.resource-view { display: flex; flex: 0 0 auto; }
.resource-view button { padding-inline: 8px; }
.resource-view button:first-child { border-start-end-radius: 0; border-end-end-radius: 0; }
.resource-view button:last-child { border-start-start-radius: 0; border-end-start-radius: 0; margin-inline-start: -1px; }
.resource-view button[aria-pressed="true"] { position: relative; background: #273b2d; }
.folder-breadcrumb, .todo-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 7px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.folder-breadcrumb button, .todo-summary button { min-height: 26px; padding: 0 7px; font-size: 11px; }
.folder-breadcrumb #folder-up { margin-inline-end: 4px; }
.folder-breadcrumb span[aria-current="location"] { color: var(--text); }
.todo-summary button { color: var(--accent); }
.todo-summary button[aria-pressed="true"] { background: #273b2d; }
.resource-path { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.resource-list {
  overflow-anchor: none;
  flex: 1 1 auto;
  overflow: auto;
  scrollbar-gutter: stable;
  min-height: 124px;
  min-width: 0;
}
.resource-canvas { position: relative; }
.resource-canvas > * { position: absolute; }
.list-empty { grid-column: 1 / -1; padding: 8px 5px; color: var(--muted); }
.resource-group-heading {
  grid-column: 1 / -1;
  padding: 6px 5px 3px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.resource {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 110px;
  border-color: transparent;
  border-radius: 10px;
  text-align: center;
  padding: 5px;
  gap: 3px;
  background: transparent;
}
.resource-list[data-view="icons"] .resource {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 74px 16px;
  grid-auto-rows: minmax(15px, max-content);
}
.resource-vacant { visibility: hidden; pointer-events: none; }
.resource:hover:enabled { background: #4dff8e0a; border-color: var(--border); }
.resource[aria-pressed="true"], .resource[aria-pressed="true"]:hover {
  background: #4dff8e16;
  border-color: #5fbe80;
}
.resource:focus-visible { outline-offset: 0; }
.tile-visual { display: grid; place-items: center; position: relative; min-width: 0; height: 74px; border-radius: 6px; }
.tile-visual.has-thumbnail {
  background: repeating-conic-gradient(#212a24 0 25%, #17201a 0 50%) 50% / 12px 12px;
  overflow: hidden;
}
.tile-visual img { display: block; width: 100%; height: 100%; padding: 3px; object-fit: contain; }
.thumbnail-version {
  position: absolute;
  inset: auto 3px 3px auto;
  max-width: calc(100% - 6px);
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--text);
  background: #101511ee;
  font-size: 10px;
}
.thumbnail-version.new { color: var(--accent); }
.thumbnail-version.retained { color: var(--warning); }
.folder-icon {
  position: relative;
  width: 52px;
  height: 35px;
  border: 1px solid #89b596;
  border-radius: 6px;
  margin-top: 5px;
  background: linear-gradient(#699978, #43674e);
  box-shadow: inset 0 1px #c6e8cd77, 0 4px 10px #0005;
}
.folder-icon::before {
  content: "";
  position: absolute;
  inset: -7px auto auto 0;
  width: 23px;
  height: 9px;
  border-radius: 4px 4px 0 0;
  background: #89b596;
}
.file-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 45px;
  padding-top: 5px;
  border: 1px solid #687f72;
  border-radius: 5px 10px 5px 5px;
  color: #c3dbcb;
  background: #283730;
  box-shadow: inset 0 1px #d1e8dc29, 0 4px 9px #0004;
  font-size: 10px;
  font-weight: 650;
}
.file-icon.font { color: #e0c9f3; background: #392a44; border-color: #8e6da4; font-size: 19px; }
.file-icon.audio { color: #bfe5ff; background: #233749; border-color: #668eab; font-size: 22px; }
.file-icon.spine { color: #a9ecc9; background: #224334; border-color: #5aab80; font-size: 13px; }
.file-icon.image::before {
  content: "";
  width: 18px;
  height: 13px;
  background: radial-gradient(circle at 72% 25%, #bfdac3 0 2px, transparent 2px),
    linear-gradient(140deg, transparent 0 50%, #92b29a 51% 74%, transparent 75%) center / 100% 85% no-repeat;
  border: 1px solid #92b29a;
  border-radius: 2px;
}
.resource-title, .resource-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.resource-title { font-size: 12px; line-height: 1.3; }
.resource-sub { font-size: 10px; color: var(--muted); }
.resource-sub::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 4px 2px 0; border-radius: 50%; background: currentColor; }
.resource-sub.changed { color: var(--accent); }
.resource-sub.invalid, .resource-sub.missing, .preview-status.error { color: var(--danger); }
.resource-sub.unknown, .resource-sub.delivery, .resource-sub.unsupported { color: var(--warning); }
.resource-type { display: none; }
.resource-list[data-view="list"] .resource {
  grid-template-columns: 45px minmax(0, 1fr) minmax(65px, auto) minmax(85px, auto);
  grid-template-rows: auto;
  align-items: center;
  align-content: center;
  gap: 1px 8px;
  min-height: 38px;
  text-align: start;
  padding: 3px 7px;
}
.resource-list[data-view="list"] .tile-visual { grid-row: 1 / span 2; height: 33px; }
.resource-list[data-view="list"] .thumbnail-version { font-size: 8px; padding: 0 2px; inset: auto 1px 1px auto; }
.resource-list[data-view="list"] .folder-icon { width: 28px; height: 18px; border-radius: 3px; }
.resource-list[data-view="list"] .folder-icon::before { width: 13px; height: 5px; inset-block-start: -4px; border-radius: 2px 2px 0 0; }
.resource-list[data-view="list"] .file-icon { transform: scale(.63); transform-origin: center; height: 33px; }
.resource-list[data-view="list"] .resource-title { grid-column: 2; }
.resource-list[data-view="list"] .resource-type { display: block; grid-column: 3; grid-row: 1; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.resource-list[data-view="list"] .resource-sub { grid-column: 4; grid-row: 1; }
.resource-list[data-view="list"] .resource-path { grid-column: 2 / -1; grid-row: 2; }
.resource-detail {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100% - 24px));
  max-height: min(460px, calc(100% - 24px), calc(100dvh - 24px));
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: #1b211e;
  box-shadow: 0 16px 50px #0009, inset 0 1px #ffffff0b;
  color: var(--muted);
  font-size: 12px;
}
.detail-header { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px 9px 15px; border-bottom: 1px solid var(--border); }
.detail-header h3 { min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-close { width: 32px; min-height: 32px; flex: none; padding: 0; font-size: 22px; line-height: 1; }
.detail-body { display: grid; gap: 12px; min-height: 0; padding: 12px 15px; overflow: auto; overflow-wrap: anywhere; }
.detail-summary { display: grid; gap: 5px; }
.detail-summary strong { color: var(--text); font-weight: 500; }
.source-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.source-images figure { min-width: 0; margin: 0; }
.source-images figcaption { margin-top: 4px; font-size: 11px; text-align: center; }
.detail-preview {
  display: grid;
  place-items: center;
  height: clamp(96px, 19dvh, 176px);
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: repeating-conic-gradient(#1d2820 0 25%, #121a14 0 50%) center / 14px 14px;
  text-align: center;
}
.detail-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.spine-player, .spine-files { display: grid; gap: 7px; }
.spine-files label { display: grid; gap: 3px; min-width: 0; }
.spine-files select { min-width: 0; font-size: 12px; }
.spine-files ul { display: grid; gap: 5px; padding: 0; margin: 0; list-style: none; }
.spine-member { display: grid; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; }
.resource-actions { display: flex; flex: none; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding: 9px 14px; border-top: 1px solid var(--border); }
.resource-actions button { min-height: 32px; padding: 0 9px; font-size: 12px; }
.resource-actions input { min-height: 28px; font-size: 11px; }
.stage { min-width: 0; width: 100%; }
.previews { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 1.5vw, 18px); }
.preview { overflow: hidden; }
.preview > header { display: flex; gap: 8px; min-height: 54px; justify-content: space-between; align-items: center; padding: 10px clamp(8px, 1.25vw, 16px); border-bottom: 1px solid var(--border); }
.preview > header > div { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.source-tag, .preview-status { color: var(--muted); font-size: 11px; }
.source-tag { border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px; font-family: ui-monospace, monospace; }
.source-tag.accent, .preview-status.ready { color: var(--accent); }
.preview-status { text-align: end; }
.preview-body {
  display: grid;
  place-items: center;
  padding: clamp(8px, 1.45vw, 20px);
  background: radial-gradient(ellipse at center, #15251b82, #080c0999 66%);
}
.viewport {
  position: relative;
  width: min(100%, 450px, calc((100dvh - 218px) * 9 / 16));
  min-width: 0;
  min-height: 160px;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #0a0e0b;
}
.viewport iframe, .empty-preview { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.asset-media { position: absolute; inset: 0; margin: auto; width: 100%; max-height: 100%; object-fit: contain; }
img.asset-media { height: 100%; }
audio.asset-media { width: calc(100% - 16px); }
.empty-preview { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; padding: 10px; text-align: center; }
.empty-preview span:not(.screen-shape) { font-size: 12px; color: var(--muted); }
.screen-shape { width: 23px; height: 38px; border: 1px solid #39784f; border-radius: 5px; background: #1a2c20; margin-bottom: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .stage { grid-row: 1; justify-self: end; width: min(100%, var(--stage-fit)); }
  .library { height: clamp(375px, 52dvh, 640px); }
}
@media (max-width: 550px) {
  .viewport { width: 100%; }
  .preview-status { display: block; }
  .resource-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-filters input { grid-column: 1 / -1; }
  .resource-list[data-view="list"] .resource { grid-template-columns: 39px minmax(0, 1fr) minmax(68px, auto); gap: 1px 5px; padding-inline: 4px; }
  .resource-list[data-view="list"] .resource-type { display: none; }
  .resource-list[data-view="list"] .resource-sub { grid-column: 3; }
  .resource-detail { width: min(380px, calc(100% - 16px)); }
}

.compare {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #111713;
  overflow: hidden;
}
.compare-labels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.compare-labels > div {
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px clamp(7px, 1.3vw, 15px);
}
.compare-labels > div + div { border-inline-start: 1px solid var(--border); }
.compare-labels .preview-status { margin-inline-start: auto; }
.compare-viewport { position: relative; width: 100%; aspect-ratio: 18 / 16; background: #0a0e0b; }
.compare-viewport iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
