:root {
  color-scheme: dark;
  --bg: #070b14;
  --bg-deep: #050810;
  --panel: #0d1421;
  --panel-raised: #121b2b;
  --panel-soft: #172234;
  --line: #223047;
  --line-soft: #1a2639;
  --text: #e7eefb;
  --text-soft: #9aabc4;
  --text-muted: #667792;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --violet: #a78bfa;
  --header-height: 62px;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

body {
  min-width: 1080px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(56, 189, 248, 0.04), transparent 28%),
    #0a101b;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  color: var(--text);
}

.brand-mark {
  position: relative;
  display: block;
  width: 31px;
  height: 31px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 4px #0a1422,
    0 0 20px rgba(56, 189, 248, 0.12);
}

.brand-mark span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

.brand-mark span:nth-child(2) {
  transform: translate(-50%, -50%) translateX(9px);
  opacity: 0.6;
}

.brand-mark span:nth-child(3) {
  transform: translate(-50%, -50%) translateX(-9px);
  opacity: 0.35;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.brand-copy small {
  color: var(--text-muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 8px;
  letter-spacing: 0.19em;
}

.module-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 2px;
  min-width: 0;
}

.module-tab {
  position: relative;
  min-width: 62px;
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.module-tab.is-active {
  color: var(--text);
}

.module-tab.is-active::after {
  position: absolute;
  right: 13px;
  bottom: 0;
  left: 13px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  content: "";
}

.module-tab:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.save-state {
  min-width: 76px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: right;
}

.save-state.is-dirty {
  color: var(--warning);
}

.save-state.is-saved {
  color: var(--success);
}

.save-state.is-error {
  color: var(--danger);
}

.level-select {
  max-width: 156px;
  height: 32px;
  padding: 0 24px 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1220;
  color: var(--text-soft);
  font-size: 10px;
  outline: 0;
}

.level-select:hover {
  border-color: #334866;
}

.button {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-raised);
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.button:hover {
  border-color: #334866;
  background: #172235;
  color: var(--text);
}

.button:disabled {
  cursor: default;
  opacity: 0.45;
}

.button-primary {
  border-color: #0284c7;
  background: #0284c7;
  color: #f0f9ff;
}

.button-primary:hover {
  border-color: var(--accent);
  background: var(--accent-strong);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-raised);
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover:not(:disabled) {
  border-color: #3a506e;
  color: var(--text);
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.32;
}

.help-button {
  border-radius: 50%;
  font-size: 13px;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
}

.text-button:hover {
  color: #7dd3fc;
}

.editor-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 306px;
  min-height: 0;
}

.sidebar {
  min-height: 0;
  background: var(--panel);
}

.sidebar-left {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.panel-section {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.section-hint {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tool-button {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  height: 36px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--panel-raised);
  color: var(--text-soft);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.tool-button:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.tool-button.is-active {
  border-color: rgba(56, 189, 248, 0.48);
  background: var(--accent-soft);
  color: #dff5ff;
}

.tool-glyph {
  color: var(--text-muted);
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 16px;
  text-align: center;
}

.tool-button.is-active .tool-glyph {
  color: var(--accent);
}

.tool-danger:hover {
  border-color: rgba(251, 113, 133, 0.45);
  color: #fecdd3;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border: 1px solid #2b3b54;
  border-bottom-color: #3b506e;
  border-radius: 3px;
  background: #0b111c;
  color: var(--text-muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 8px;
  line-height: 1;
}

.palette-section {
  min-height: 116px;
}

.palette-content {
  display: grid;
  gap: 5px;
}

.palette-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 38px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--panel-raised);
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.palette-card:hover {
  border-color: var(--line);
  color: var(--text);
}

.palette-card.is-active {
  border-color: rgba(56, 189, 248, 0.45);
  background: var(--accent-soft);
}

.palette-swatch {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.palette-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.palette-copy strong {
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-copy small,
.palette-tag {
  color: var(--text-muted);
  font-size: 9px;
}

.palette-tag {
  padding: 2px 5px;
  border-radius: 999px;
  background: #0b1220;
}

.palette-empty {
  padding: 8px 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.7;
}

.palette-tip {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.65;
}

.layer-section {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-color: #293b56 transparent;
  scrollbar-width: thin;
}

.layer-list {
  display: grid;
  gap: 12px;
  padding-bottom: 20px;
}

.layer-group {
  display: grid;
  gap: 3px;
}

.layer-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 3px 4px;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.layer-count {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #0a111d;
  text-align: center;
}

.layer-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 29px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.layer-row:hover {
  background: var(--panel-raised);
  color: var(--text);
}

.layer-row.is-active {
  border-color: rgba(56, 189, 248, 0.35);
  background: var(--accent-soft);
  color: #dff5ff;
}

.layer-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--text-muted);
}

.layer-name {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-meta {
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
}

.workspace {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 30px;
  min-width: 0;
  min-height: 0;
  background: var(--bg-deep);
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 0 14px 0 17px;
  border-bottom: 1px solid var(--line);
  background: #0a101b;
}

.document-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.document-eyebrow,
.inspector-eyebrow {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-heading strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-id {
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
}

.canvas-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.segmented-control {
  display: flex;
  align-items: center;
  height: 30px;
  margin-right: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented-control button,
.segmented-control select {
  height: 100%;
  border: 0;
  background: var(--panel-raised);
  color: var(--text-soft);
  font-size: 10px;
}

.segmented-control button {
  padding: 0 9px;
  cursor: pointer;
}

.segmented-control button.is-active {
  background: var(--accent-soft);
  color: #bae6fd;
}

.segmented-control select {
  width: 48px;
  border-left: 1px solid var(--line);
  padding: 0 4px;
  outline: 0;
}

.canvas-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(30, 64, 175, 0.08), transparent 45%),
    var(--bg-deep);
}

#map-canvas {
  position: absolute;
  inset: 0;
}

#map-canvas canvas {
  display: block;
  image-rendering: pixelated;
}

.canvas-badge,
.canvas-coordinates,
.zoom-control {
  position: absolute;
  z-index: 3;
  border: 1px solid rgba(81, 105, 137, 0.34);
  background: rgba(8, 14, 24, 0.86);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.canvas-badge {
  top: 12px;
  left: 14px;
  padding: 6px 9px;
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 9px;
  pointer-events: none;
}

.canvas-coordinates {
  right: 14px;
  bottom: 13px;
  padding: 5px 8px;
  border-radius: 4px;
  color: #7f93ad;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  pointer-events: none;
}

.zoom-control {
  bottom: 13px;
  left: 14px;
  display: flex;
  align-items: center;
  height: 29px;
  border-radius: 5px;
  overflow: hidden;
}

.zoom-control button {
  width: 28px;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 15px;
  cursor: pointer;
}

.zoom-control button:hover {
  background: var(--panel-soft);
}

.zoom-control span {
  min-width: 45px;
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  text-align: center;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

.canvas-empty strong {
  color: var(--text-soft);
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: #080e18;
  color: var(--text-muted);
  font-size: 9px;
}

.status-summary,
.status-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-actions {
  margin-left: auto;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.55);
}

.sidebar-right {
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr) auto;
  border-left: 1px solid var(--line);
  overflow: hidden;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line-soft);
}

.inspector-header > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.inspector-header strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-scroll {
  min-height: 0;
  overflow: auto;
  padding: 14px 15px 24px;
  scrollbar-color: #293b56 transparent;
  scrollbar-width: thin;
}

.form-section {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 9px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field.is-wide {
  grid-column: 1 / -1;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 9px;
}

.field-note {
  color: #4f627d;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #0a111c;
  color: var(--text);
  font-size: 10px;
}

.field textarea {
  height: 58px;
  padding: 7px 8px;
  line-height: 1.5;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #30445f;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(56, 189, 248, 0.65);
}

.field input.is-invalid {
  border-color: rgba(251, 113, 133, 0.65);
}

.color-field {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 5px;
}

.color-field input[type="color"] {
  padding: 3px;
  cursor: pointer;
}

.reference-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #0a111b;
}

.reference-card strong {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
}

.reference-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.6;
}

.reference-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.reference-stats span {
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--panel-raised);
  color: #8ea2bc;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
}

.background-asset-field {
  gap: 8px;
}

.background-asset-current {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #09111c;
}

.background-asset-preview {
  display: grid;
  place-items: center;
  height: 48px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #050a12;
  overflow: hidden;
}

.background-asset-preview {
  position: relative;
}

.background-asset-preview img,
.background-asset-preview canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  object-fit: contain;
}

.background-asset-preview canvas {
  position: relative;
  z-index: 1;
}

.background-map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fbbf24;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.background-asset-preview:has(
  canvas[data-preview-ready="true"]
) .background-map-fallback {
  display: none;
}

.background-asset-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.background-asset-copy strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-asset-copy small {
  overflow: hidden;
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-asset-empty {
  padding: 11px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.6;
}

.background-asset-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.empty-inspector {
  padding: 12px 2px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.7;
}

.validation-panel {
  max-height: 230px;
  border-top: 1px solid var(--line);
  background: #0a111b;
  overflow: hidden;
}

.validation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 39px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 10px;
  cursor: pointer;
}

.validation-heading > span:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
}

.validation-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  font-size: 9px;
}

.validation-panel.has-errors .validation-icon {
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
}

.validation-panel.has-warnings .validation-icon {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

#validation-count {
  color: var(--text-muted);
  font-size: 9px;
}

.validation-list {
  display: grid;
  max-height: 190px;
  padding: 0 9px 10px;
  overflow: auto;
}

.validation-list.is-collapsed {
  display: none;
}

.validation-item {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9px;
  line-height: 1.5;
  text-align: left;
}

.validation-item:hover {
  background: var(--panel-raised);
  color: var(--text-soft);
}

.validation-item::before {
  width: 4px;
  height: 4px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--warning);
  content: "";
}

.validation-item.is-error::before {
  background: var(--danger);
}

.validation-ok {
  padding: 2px 7px 9px;
  color: #5e927d;
  font-size: 9px;
}

.shortcut-dialog {
  width: min(560px, calc(100vw - 48px));
  padding: 22px;
  border: 1px solid #2a3b52;
  border-radius: 10px;
  background: #0d1523;
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.shortcut-dialog::backdrop {
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(3px);
}

.tiled-map-select-dialog {
  width: min(680px, calc(100vw - 48px));
  padding: 22px;
  border: 1px solid #2a3b52;
  border-radius: 10px;
  background: #0d1523;
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.tiled-map-select-dialog::backdrop {
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(3px);
}

.tiled-map-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 10px;
}

.tiled-map-candidate-list {
  display: grid;
  max-height: min(420px, 52vh);
  gap: 7px;
  margin-top: 9px;
  overflow: auto;
}

.tiled-map-candidate {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #09111c;
  cursor: pointer;
}

.tiled-map-candidate:has(input:checked) {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.06);
}

.tiled-map-candidate span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.tiled-map-candidate strong {
  color: var(--text-soft);
  font-size: 11px;
}

.tiled-map-candidate small {
  overflow: hidden;
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tiled-map-select-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 16px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.dialog-heading > div {
  display: grid;
  gap: 4px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  color: var(--text-soft);
  font-size: 10px;
}

.shortcut-grid span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dialog-note {
  padding-top: 15px;
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.6;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 7px;
  pointer-events: none;
}

.toast {
  min-width: 210px;
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid #2c405b;
  border-radius: 6px;
  background: rgba(14, 23, 38, 0.96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.36);
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.5;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  border-color: rgba(251, 113, 133, 0.5);
  color: #fecdd3;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 1240px) {
  .editor-layout {
    grid-template-columns: 202px minmax(0, 1fr) 284px;
  }

  .module-nav {
    gap: 0;
  }

  .module-tab {
    min-width: 54px;
    padding: 0 9px;
  }
}

.asset-dialog {
  position: relative;
  width: min(1040px, calc(100vw - 48px));
  height: min(730px, calc(100vh - 48px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #2a3b52;
  border-radius: 12px;
  background: #0b1220;
  color: var(--text);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.62);
  overflow: hidden;
}

.asset-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.asset-dialog::backdrop {
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(4px);
}

.asset-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 19px 22px 17px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(
      circle at 12% 0,
      rgba(56, 189, 248, 0.1),
      transparent 38%
    ),
    #0c1421;
}

.asset-dialog-title {
  display: grid;
  gap: 4px;
}

.asset-dialog-title h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.asset-dialog-title p {
  margin: 1px 0 0;
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  line-height: 1.5;
}

.asset-dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.asset-api-state {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 9px;
}

.asset-api-state.is-connected {
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.08);
  color: #6ee7b7;
}

.asset-api-state.is-offline {
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.08);
  color: #fda4af;
}

.asset-library-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 0;
}

.asset-taxonomy {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.025), transparent 32%),
    var(--panel);
}

.asset-taxonomy-label {
  padding: 0 8px 9px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.asset-category-group {
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0a121f;
}

.asset-subcategory-list {
  display: grid;
  gap: 3px;
}

.asset-subcategory-list + .asset-subcategory-list {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.asset-category-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 4px;
  color: var(--text-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.asset-category-section-heading span:first-child {
  color: var(--text-soft);
  font-weight: 600;
}

.asset-subcategory {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font-size: 10px;
  cursor: pointer;
  text-align: left;
}

.asset-subcategory:hover {
  background: var(--panel-raised);
  color: var(--text);
}

.asset-subcategory.is-active {
  border-color: rgba(56, 189, 248, 0.36);
  background: var(--accent-soft);
  color: #e0f2fe;
}

.asset-subcategory > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.asset-subcategory > span:last-child {
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #08101b;
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
  justify-content: center;
}

.asset-subcategory-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}

.asset-subcategory-dot.is-entity {
  background: var(--violet);
}

.asset-subcategory-dot.is-static {
  background: #34d399;
}

.asset-subcategory-dot.is-tiled {
  background: #f59e0b;
}

.asset-scope-note {
  padding: 14px 8px 0;
  margin: auto 0 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.75;
}

.asset-collection {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  padding: 18px 20px 14px;
}

.asset-collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 14px;
}

.asset-collection-heading > div:first-child {
  min-width: 0;
}

.asset-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: var(--text-soft);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.asset-breadcrumb button,
.background-picker-breadcrumb button {
  padding: 3px 5px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.asset-breadcrumb button:hover,
.background-picker-breadcrumb button:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.asset-breadcrumb button:last-child {
  color: var(--text);
}

.asset-breadcrumb button.is-drop-target {
  color: #fbbf24;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.asset-collection-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.asset-drop-zone {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
  padding: 13px;
  border: 1px dashed #29394f;
  border-radius: 10px;
  background:
    linear-gradient(
      135deg,
      rgba(56, 189, 248, 0.02),
      transparent 42%
    ),
    #080f1a;
  overflow: auto;
  scrollbar-color: #293b56 transparent;
  scrollbar-width: thin;
  transition:
    border-color 120ms ease,
    background 120ms ease;
}

.asset-drop-zone.is-dragging {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
}

.asset-drop-hint {
  padding: 8px 10px;
  border-radius: 6px;
  background: #0b1422;
  color: var(--text-muted);
  font-size: 9px;
  text-align: center;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  align-content: start;
  gap: 12px;
}

.asset-folder-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 158px;
  padding: 14px;
  border: 1px solid #31445d;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(245, 158, 11, 0.08), transparent 48%),
    #0a1320;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  transition:
    border-color 120ms ease,
    transform 120ms ease,
    background 120ms ease;
}

.asset-folder-card[draggable="true"] {
  cursor: grab;
}

.asset-folder-card.is-dragging {
  cursor: grabbing;
  opacity: 0.5;
  transform: scale(0.98);
}

.asset-folder-card:hover,
.asset-folder-card:focus-visible {
  border-color: rgba(245, 158, 11, 0.58);
  background:
    linear-gradient(145deg, rgba(245, 158, 11, 0.13), transparent 52%),
    #0c1624;
  transform: translateY(-1px);
}

.asset-folder-card.is-context-target,
.asset-folder-card.is-drop-target {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.18);
}

.asset-folder-icon {
  align-self: center;
  color: #fbbf24;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 48px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 8px 22px rgba(245, 158, 11, 0.18);
}

.asset-folder-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.asset-folder-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-folder-copy small,
.asset-folder-action {
  color: var(--text-muted);
  font-size: 8px;
}

.asset-folder-action {
  margin-top: 4px;
  color: #fbbf24;
}

.asset-loading {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--text-muted);
  font-size: 10px;
}

.asset-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0b1320;
  overflow: hidden;
  transition:
    border-color 120ms ease,
    transform 120ms ease;
}

.asset-card[draggable="true"] {
  cursor: grab;
}

.asset-card.is-dragging {
  cursor: grabbing;
  opacity: 0.5;
  transform: scale(0.98);
}

.asset-card:hover {
  border-color: #385271;
  transform: translateY(-1px);
}

.asset-card.is-context-target {
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.16);
}

.asset-preview {
  position: relative;
  display: grid;
  place-items: center;
  height: 122px;
  background-color: #07101b;
  background-image:
    linear-gradient(45deg, #0d1725 25%, transparent 25%),
    linear-gradient(-45deg, #0d1725 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0d1725 75%),
    linear-gradient(-45deg, transparent 75%, #0d1725 75%);
  background-position:
    0 0,
    0 9px,
    9px -9px,
    -9px 0;
  background-size: 18px 18px;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}

.asset-preview img,
.asset-preview canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  image-rendering: pixelated;
  object-fit: contain;
  object-position: center;
}

.asset-extension {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  background: rgba(5, 10, 18, 0.78);
  color: var(--text-soft);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 7px;
}

.asset-card-copy {
  display: grid;
  gap: 3px;
  padding: 9px 10px 10px;
}

.asset-name-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
}

.asset-file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-file-extension {
  flex: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.asset-rename-input {
  flex: 1;
  width: 0;
  min-width: 0;
  padding: 1px 3px;
  border: 1px solid rgba(56, 189, 248, 0.72);
  border-radius: 3px;
  outline: none;
  background: #07111d;
  color: var(--text);
  font: inherit;
  font-size: 10px;
}

.asset-rename-input:focus {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
}

.asset-rename-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.12);
}

.asset-card.is-renaming,
.asset-card.is-saving {
  border-color: rgba(56, 189, 248, 0.72);
}

.asset-card.is-saving {
  opacity: 0.76;
}

.asset-card-copy small {
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
}

.asset-empty {
  display: grid;
  flex: 1;
  place-content: center;
  justify-items: center;
  min-height: 220px;
  gap: 7px;
  padding: 22px;
  color: var(--text-muted);
  text-align: center;
}

.asset-empty-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 3px;
  border: 1px dashed #334763;
  border-radius: 10px;
  color: var(--accent);
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 20px;
}

.asset-empty strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.asset-empty span:last-child {
  max-width: 330px;
  font-size: 9px;
  line-height: 1.65;
}

.asset-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 3px 0;
  color: var(--text-muted);
  font-size: 8px;
}

.asset-dialog-footer #asset-status {
  color: var(--text-soft);
  font-size: 9px;
}

.asset-dialog-footer #asset-status.is-error {
  color: #fda4af;
}

@media (max-height: 680px) {
  .asset-dialog {
    height: calc(100vh - 24px);
  }

  .asset-preview {
    height: 94px;
  }
}

.asset-context-menu {
  position: fixed;
  z-index: 70;
  display: grid;
  width: 194px;
  padding: 5px;
  border: 1px solid #2d425d;
  border-radius: 8px;
  background: rgba(11, 19, 32, 0.98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.asset-context-item {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 45px;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.asset-context-item:hover,
.asset-context-item:focus-visible {
  background: var(--panel-soft);
  color: var(--text);
}

.asset-context-item.is-danger:hover,
.asset-context-item.is-danger:focus-visible {
  background: rgba(251, 113, 133, 0.1);
  color: #fecdd3;
}

.asset-context-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #09111d;
  color: var(--accent);
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 14px;
}

.asset-context-item.is-danger .asset-context-icon {
  color: var(--danger);
}

.asset-context-item > span:last-child {
  display: grid;
  gap: 2px;
}

.asset-context-item strong {
  font-size: 10px;
  font-weight: 500;
}

.asset-context-item small {
  color: var(--text-muted);
  font-size: 8px;
}

.asset-image-viewer {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #060b13;
}

.asset-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(
      90deg,
      rgba(56, 189, 248, 0.07),
      transparent 42%
    ),
    #0b1320;
}

.asset-viewer-heading {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.asset-viewer-heading strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-viewer-heading span {
  color: var(--text-muted);
  font-size: 8px;
}

.asset-viewer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.asset-viewer-zoom {
  min-width: 48px;
  color: var(--text-soft);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  text-align: center;
}

.asset-viewer-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  background-color: #050a12;
  background-image:
    radial-gradient(
      circle at 50% 50%,
      rgba(56, 189, 248, 0.045),
      transparent 55%
    ),
    linear-gradient(45deg, #0a121e 25%, transparent 25%),
    linear-gradient(-45deg, #0a121e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0a121e 75%),
    linear-gradient(-45deg, transparent 75%, #0a121e 75%);
  background-position:
    center,
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size:
    auto,
    20px 20px,
    20px 20px,
    20px 20px,
    20px 20px;
  cursor: grab;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.asset-viewer-canvas.is-dragging {
  cursor: grabbing;
}

.asset-viewer-image {
  position: absolute;
  inset: 44px;
  width: calc(100% - 88px);
  height: calc(100% - 88px);
  image-rendering: pixelated;
  object-fit: contain;
  transform-origin: center center;
  filter: drop-shadow(0 14px 34px rgba(0, 0, 0, 0.38));
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.asset-name-conflict-panel {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.74);
  backdrop-filter: blur(4px);
}

.asset-name-conflict-dialog {
  display: grid;
  width: min(470px, 100%);
  gap: 11px;
  padding: 20px;
  border: 1px solid #344a64;
  border-radius: 10px;
  background: #0c1624;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.asset-name-conflict-dialog h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.asset-name-conflict-dialog p {
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.7;
}

.asset-name-conflict-field {
  display: grid;
  gap: 5px;
  color: var(--text-soft);
  font-size: 9px;
}

.asset-name-input-row {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.asset-name-input-row input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #07111d;
  color: var(--text);
}

.asset-name-fixed-suffix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #0a1422;
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  white-space: nowrap;
}

.asset-name-input-row:has(.asset-name-fixed-suffix:not([hidden]))
  input {
  border-radius: 6px 0 0 6px;
}

.asset-name-input-row input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.12);
}

.asset-name-conflict-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.asset-name-conflict-actions .button {
  min-width: 84px;
}

.asset-name-conflict-actions #asset-name-conflict-overwrite {
  border-color: rgba(251, 113, 133, 0.42);
  background: rgba(251, 113, 133, 0.12);
  color: #fecdd3;
}

.asset-frame-rate-panel {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
}

.asset-frame-rate-dialog {
  display: grid;
  width: min(760px, 100%);
  gap: 14px;
  padding: 18px;
  border: 1px solid #2d425d;
  border-radius: 12px;
  background: #0b1421;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.55);
}

.asset-frame-rate-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.asset-frame-rate-heading > div {
  display: grid;
  gap: 4px;
}

.asset-frame-rate-heading h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.asset-frame-rate-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(260px, 0.9fr);
  gap: 16px;
  min-height: 300px;
}

.asset-frame-rate-preview-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 300px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #050a12;
  background-image:
    linear-gradient(45deg, #0d1725 25%, transparent 25%),
    linear-gradient(-45deg, #0d1725 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0d1725 75%),
    linear-gradient(-45deg, transparent 75%, #0d1725 75%);
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
  overflow: hidden;
}

.asset-frame-rate-preview-label {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 1;
  color: var(--text-muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.asset-frame-rate-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.4));
}

.asset-frame-rate-controls {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 3px 1px;
}

.asset-frame-rate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #08111c;
}

.asset-frame-rate-meta strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-frame-rate-meta span {
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.asset-frame-rate-field {
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-size: 9px;
}

.asset-frame-rate-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.asset-frame-rate-stepper {
  display: grid;
  grid-template-columns: 58px 104px 58px auto;
  align-items: center;
  gap: 8px;
}

.asset-frame-rate-stepper button {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
  color: var(--accent);
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 22px;
  cursor: pointer;
}

.asset-frame-rate-stepper button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.asset-frame-rate-stepper input[type="number"] {
  width: 104px;
  height: 58px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a111c;
  color: var(--text);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 22px;
  text-align: center;
}

.asset-frame-rate-stepper input[type="number"]::-webkit-inner-spin-button,
.asset-frame-rate-stepper input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.asset-frame-rate-stepper > span {
  color: var(--text-muted);
  font-size: 11px;
}

.asset-frame-rate-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.65;
}

.asset-frame-rate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.asset-frame-rate-actions .button {
  min-width: 156px;
  height: 38px;
}

.background-picker-dialog {
  width: min(920px, calc(100vw - 48px));
  height: min(650px, calc(100vh - 48px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #2a3b52;
  border-radius: 12px;
  background: #0b1220;
  color: var(--text);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.62);
  overflow: hidden;
}

.background-picker-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.background-picker-dialog::backdrop {
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(4px);
}

.background-picker-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(
      circle at 12% 0,
      rgba(56, 189, 248, 0.1),
      transparent 38%
    ),
    #0c1421;
}

.background-picker-heading > div:first-child {
  display: grid;
  gap: 4px;
}

.background-picker-heading h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
}

.background-picker-heading p {
  margin: 1px 0 0;
  color: var(--text-muted);
  font-size: 9px;
}

.background-picker-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.background-picker-body {
  grid-row: 2;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 0;
}

.background-picker-taxonomy {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.035), transparent 38%),
    #09111d;
}

.background-picker-taxonomy-label {
  padding: 0 8px 9px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.background-picker-categories {
  display: grid;
  gap: 5px;
}

.background-picker-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font-size: 10px;
  cursor: pointer;
  text-align: left;
}

.background-picker-category:hover {
  background: var(--panel-raised);
  color: var(--text);
}

.background-picker-category.is-active {
  border-color: rgba(56, 189, 248, 0.4);
  background: var(--accent-soft);
  color: #e0f2fe;
}

.background-picker-category > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.background-picker-category > span:last-child {
  min-width: 21px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #08101b;
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
  justify-content: center;
}

.background-picker-taxonomy p {
  margin: auto 0 0;
  padding: 14px 8px 0;
  color: var(--text-muted);
  font-size: 8px;
  line-height: 1.7;
}

.background-picker-collection {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.background-picker-collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px 0;
}

.background-picker-heading-copy {
  display: flex;
  align-items: center;
  min-width: 0;
}

.background-picker-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 600;
}

.background-picker-breadcrumb button:last-child {
  color: var(--text);
}

.background-picker-collection-heading span {
  color: var(--text-muted);
  font-size: 8px;
}

.background-picker-grid {
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 12px 20px 18px;
  overflow: auto;
  scrollbar-color: #293b56 transparent;
  scrollbar-width: thin;
}

.background-picker-loading {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--text-muted);
  font-size: 10px;
}

.background-choice {
  display: grid;
  grid-template-rows: 132px auto auto;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #0a121f;
  color: var(--text-soft);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition:
    border-color 120ms ease,
    transform 120ms ease;
}

.background-folder-choice {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 192px;
  padding: 16px;
  border: 1px solid #3a4c62;
  border-radius: 9px;
  background:
    linear-gradient(145deg, rgba(245, 158, 11, 0.09), transparent 52%),
    #0a121f;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 120ms ease,
    transform 120ms ease;
}

.background-folder-choice:hover {
  border-color: rgba(245, 158, 11, 0.62);
  transform: translateY(-1px);
}

.background-folder-icon {
  align-self: center;
  color: #fbbf24;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 52px;
  line-height: 1;
  text-align: center;
}

.background-folder-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.background-folder-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-folder-copy small,
.background-folder-action {
  color: var(--text-muted);
  font-size: 8px;
}

.background-folder-action {
  margin-top: 5px;
  color: #fbbf24;
}

.background-choice:hover:not(:disabled) {
  border-color: #3b5879;
  transform: translateY(-1px);
}

.background-choice.is-current {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.14);
}

.background-choice:disabled {
  cursor: wait;
  opacity: 0.62;
}

.background-choice-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  background-color: #060d17;
  background-image:
    linear-gradient(45deg, #0d1725 25%, transparent 25%),
    linear-gradient(-45deg, #0d1725 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0d1725 75%),
    linear-gradient(-45deg, transparent 75%, #0d1725 75%);
  background-position:
    0 0,
    0 9px,
    9px -9px,
    -9px 0;
  background-size: 18px 18px;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}

.background-choice-preview img,
.background-choice-tiled-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.background-choice-preview img {
  object-fit: cover;
}

.background-choice-tiled-canvas {
  object-fit: contain;
}

.background-choice-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 6px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 999px;
  background: rgba(8, 18, 31, 0.9);
  color: #7dd3fc;
  font-size: 8px;
}

.background-choice-copy {
  display: grid;
  gap: 3px;
  padding: 9px 11px 4px;
}

.background-choice-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-choice-copy small {
  color: var(--text-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
}

.background-choice-action {
  padding: 3px 11px 10px;
  color: var(--accent);
  font-size: 9px;
}

.background-picker-empty {
  grid-row: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  min-height: 0;
  color: var(--text-muted);
  text-align: center;
}

.background-picker-empty > span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px dashed #334763;
  border-radius: 10px;
  color: var(--accent);
  font-size: 21px;
}

.background-picker-empty strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.background-picker-empty p {
  margin: 0;
  font-size: 9px;
}

.background-picker-footer {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 8px;
}

.background-picker-footer #background-picker-status {
  color: var(--text-soft);
}

.background-picker-footer #background-picker-status.is-error {
  color: #fda4af;
}
