:root {
  --bg:      #1a1a2e;
  --surface: #16213e;
  --border:  #2a3a5e;
  --accent:  #4cc9f0;
  --purple:  #7b2fff;
  --text:    #c8d6e5;
  --muted:   #5a6a80;
  --danger:  #f64f59;
  --success: #43e97b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

/* ── Landing overlay ────────────────────────────────────────────────────── */
#landing {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s;
}
#landing.hidden { opacity: 0; pointer-events: none; }

.landing-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px 48px;
  width: 480px;
  max-width: 90vw;
}

.landing-box h1 { font-size: 22px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.landing-box p  { color: var(--muted); margin-bottom: 28px; line-height: 1.5; }

.path-input-row {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.path-input-row:focus-within { border-color: var(--accent); }

#path-display {
  flex: 1;
  background: var(--bg);
  border: none;
  outline: none;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  min-width: 0;
  font-family: inherit;
}
#path-display::placeholder { color: var(--muted); }

#browse-btn,
#browse-files-btn {
  background: var(--surface);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  font-family: inherit;
}
#browse-btn:hover,
#browse-files-btn:hover { color: var(--accent); }

.landing-actions {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

#init-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: #0a0a1a;
  font-weight: 600;
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
  font-family: inherit;
}
#init-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#init-btn:not(:disabled):hover { background: #6dd4f7; border-color: #6dd4f7; }

#cashshop-browse-btn {
  padding-inline: 14px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

@media (max-width: 560px) {
  .landing-actions {
    grid-template-columns: 1fr;
  }
}

#progress-bar-wrap {
  margin-top: 14px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  display: none;
}
#progress-bar-wrap.visible { display: block; }
#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--accent));
  width: 0%;
  transition: width 0.15s;
}

#landing-status {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  min-height: 16px;
  font-family: system-ui, -apple-system, sans-serif;
}
#landing-status.error   { color: var(--danger); }
#landing-status.success { color: var(--success); }

/* ── Main app ───────────────────────────────────────────────────────────── */
#app { display: none; flex-direction: column; height: 100vh; }
#app.visible { display: flex; }

#header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

#header .title {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  cursor: pointer;
}
#header .title:hover { opacity: 0.75; }
#header .sep { color: var(--border); user-select: none; }

#search {
  flex: 1;
  min-width: 160px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
#search:focus { border-color: var(--accent); }

#count { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Filters */
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-row label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.filter-row select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
}
.filter-row select:focus { border-color: var(--accent); }

button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  font-family: inherit;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* strings status pill */
#strings-pill {
  display: none;
  font-size: 12px;
  color: var(--purple);
  white-space: nowrap;
}
#strings-pill.visible { display: inline-block; }

/* Grid */
#string-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  font-size: 13px;
  color: var(--accent);
}
#string-prompt button { font-size: 12px; }
#string-prompt-dismiss { opacity: 0.5; }
#string-prompt-dismiss:hover { opacity: 1; }

#grid-container { flex: 1; overflow-y: auto; padding: 12px; }
#grid { position: relative; }

/* String editor */
#string-editor {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 250px minmax(460px, 1fr) 340px;
  background: var(--bg);
  overflow: hidden;
}

.string-sidebar,
.string-inspector {
  background: color-mix(in srgb, var(--surface) 88%, #000);
  min-height: 0;
  overflow-y: auto;
}

.string-sidebar { border-right: 1px solid var(--border); }
.string-inspector {
  border-left: 1px solid var(--border);
  padding: 14px;
}

#string-editor-source,
#string-editor-total,
#string-editor-dirty {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

#string-editor-dirty { color: #ffd166; }

#string-categories {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.string-category {
  width: 100%;
  border-radius: 4px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  text-align: left;
  background: transparent;
}

.string-category span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.string-category strong {
  color: var(--muted);
  font-size: 12px;
}

.string-category.active {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}

.string-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.string-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
}

#string-editor-search {
  flex: 1;
  min-width: 220px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

#string-editor-search:focus { border-color: var(--accent); }

.string-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.string-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.string-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--surface) 92%, #000);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.string-table td {
  padding: 9px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

.string-table tr {
  cursor: pointer;
}

.string-table tr:hover,
.string-table tr.selected {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.string-table th:nth-child(1) { width: 18%; }
.string-table th:nth-child(2) { width: 22%; }
.string-table th:nth-child(3) { width: 32%; }
.string-table th:nth-child(4) { width: 14%; }
.string-table th:nth-child(5) { width: 14%; }

.string-node-id {
  color: var(--accent);
  font-family: monospace;
  font-size: 12px;
}

.string-muted {
  color: var(--muted);
  font-size: 12px;
}

.string-field-chip {
  display: inline-block;
  margin: 0 4px 4px 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
  color: var(--muted);
  font-size: 11px;
}

.string-inspector h2 {
  font-size: 16px;
  line-height: 1.25;
  margin: 4px 0 12px;
}

.string-inspector label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.string-inspector input,
.string-inspector textarea,
.string-inspector select {
  width: 100%;
  margin-top: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.string-inspector textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.35;
}

.string-inspector input:focus,
.string-inspector textarea:focus,
.string-inspector select:focus {
  border-color: var(--accent);
}

.string-field-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.string-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.string-field-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.string-field-head button,
.string-inspector-actions button {
  padding: 6px 9px;
  font-size: 12px;
}

.string-inspector-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.string-preset-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.string-preset-list button {
  padding: 5px 8px;
  font-size: 12px;
}

/* Commodity editor */
#commodity-editor {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(420px, 1fr) 320px;
  background: var(--bg);
  overflow: hidden;
}

.commodity-sidebar,
.commodity-inspector {
  background: color-mix(in srgb, var(--surface) 88%, #000);
  border-right: 1px solid var(--border);
  min-height: 0;
  overflow-y: auto;
}

.commodity-inspector {
  border-right: none;
  border-left: 1px solid var(--border);
  padding: 14px;
}

.commodity-sidebar-head {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
}

.commodity-kicker {
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#commodity-total,
#commodity-dirty {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

#commodity-dirty { color: #ffd166; }

#commodity-categories {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.commodity-category {
  width: 100%;
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  background: transparent;
}

.commodity-category span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commodity-category strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.commodity-category.active {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}

.commodity-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.commodity-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
  flex-wrap: wrap;
}

.commodity-search-wrap {
  flex: 1;
  min-width: 240px;
}

#commodity-search,
.commodity-toolbar select,
.commodity-inspector input,
.commodity-inspector select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

#commodity-search:focus,
.commodity-toolbar select:focus,
.commodity-inspector input:focus,
.commodity-inspector select:focus {
  border-color: var(--accent);
}

.commodity-toolbar select {
  width: auto;
  min-width: 128px;
}

#commodity-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  grid-auto-rows: minmax(178px, auto);
  gap: 10px;
  align-content: start;
}

.commodity-card {
  position: relative;
  min-width: 0;
  min-height: 178px;
  padding: 8px;
  display: grid;
  grid-template-rows: 22px 58px minmax(34px, auto) 20px 16px;
  gap: 5px;
  justify-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-align: center;
}

.commodity-card:hover,
.commodity-card.selected {
  border-color: var(--accent);
  color: var(--text);
}

.commodity-card.selected {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent);
}

.commodity-card.unavailable {
  opacity: 0.58;
}

.commodity-card.duplicate {
  border-color: color-mix(in srgb, #ff7a7a 55%, var(--border));
}

.commodity-card-tags {
  width: 100%;
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.cash-badge,
.cash-package {
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: #101018;
}

.badge-0 { background: #ffe45e; }
.badge-1 { background: #ff5b5b; color: #fff; }
.badge-2 { background: #f94144; color: #fff; }
.badge-3 { background: #4cc9f0; color: #06141a; }
.cash-badge.limit { background: #b7f25f; }
.cash-badge.duplicate { background: #ff7a7a; color: #180808; }
.cash-package {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}

.commodity-card-body {
  width: 58px;
  height: 58px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, #000);
  background: #0d0d1a;
  display: grid;
  place-items: center;
}

.commodity-icon {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.commodity-card-name {
  width: 100%;
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.commodity-card-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent);
  font-size: 11px;
}

.commodity-card-sn {
  width: 100%;
  color: var(--muted);
  font-family: monospace;
  font-size: 11px;
}

.commodity-no-results,
.commodity-empty {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.inspector-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.inspector-head h2 {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
  margin-top: 3px;
}

#commodity-remove-btn {
  border-color: color-mix(in srgb, var(--danger) 70%, var(--border));
  color: var(--danger);
  padding: 7px 10px;
}

.package-warning {
  border: 1px solid color-mix(in srgb, #ffd166 45%, var(--border));
  background: color-mix(in srgb, #ffd166 10%, transparent);
  color: #ffd166;
  border-radius: 4px;
  padding: 8px;
  font-size: 12px;
  margin-bottom: 12px;
}

.duplicate-warning {
  border: 1px solid color-mix(in srgb, #ff7a7a 55%, var(--border));
  background: color-mix(in srgb, #ff7a7a 10%, transparent);
  color: #ffb4b4;
  border-radius: 4px;
  padding: 8px;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 12px;
}

.commodity-inspector label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.commodity-inspector label input,
.commodity-inspector label select {
  margin-top: 5px;
}

.item-id-button {
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  text-align: left;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.item-id-button span {
  color: var(--accent);
  font-family: monospace;
  font-size: 12px;
}

.item-id-button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.inspector-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.inspector-checks label {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  margin: 0;
  color: var(--text);
}

.inspector-checks input {
  width: auto;
  margin: 0 6px 0 0;
}

/* Item picker */
#item-picker {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0,0,0,0.78);
  padding: 24px;
  align-items: center;
  justify-content: center;
}

#item-picker.visible { display: flex; }

.item-picker-modal {
  width: min(1120px, 96vw);
  height: min(820px, 92vh);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
}

.item-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.item-picker-head h2 {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.2;
  margin-top: 3px;
}

.item-picker-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
}

#item-picker-search {
  flex: 1;
  min-width: 220px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

#item-picker-search:focus { border-color: var(--accent); }

#item-picker-category {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
}

#item-picker-count {
  min-width: 76px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

#item-picker-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  grid-auto-rows: minmax(144px, auto);
  gap: 8px;
  align-content: start;
}

.item-picker-card {
  min-width: 0;
  min-height: 144px;
  padding: 8px;
  display: grid;
  grid-template-rows: 50px minmax(36px, auto) 18px;
  gap: 7px;
  justify-items: center;
  text-align: center;
  background: color-mix(in srgb, var(--surface) 88%, #000);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.item-picker-card:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.item-picker-icon-wrap {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  background: #0d0d1a;
  border: 1px solid color-mix(in srgb, var(--border) 70%, #000);
}

.item-picker-icon {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
}

.item-picker-name {
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item-picker-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-family: monospace;
}

.sprite-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  gap: 4px;
  transition: border-color 0.15s;
}
.sprite-cell:hover { border-color: var(--accent); }

.sprite-cell canvas {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
  background: #0d0d1a;
  border-radius: 2px;
}

.sprite-cell .label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
  width: 100%;
}
.sprite-cell .label.has-name { color: var(--text); }

/* Detail modal */
#detail {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#detail.visible { display: flex; }

.detail-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: row;
  gap: 0;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
  letter-spacing: 0;
}
.detail-close:hover { color: var(--text); background: var(--border); }

.detail-preview {
  flex: 0 1 auto;
  background: #0d0d1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  min-width: 0;
  max-width: 400px;
  border-right: 1px solid var(--border);
}

#detail-canvas {
  display: block;
  max-width: min(320px, 100%);
  max-height: calc(90vh - 120px);
  image-rendering: pixelated;
}

#frame-controls {
  display: none;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  padding: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}
#frame-controls.visible { display: flex; }
#play-btn {
  padding: 4px 12px;
  font-size: 12px;
  min-width: 58px;
}

.detail-info {
  flex: 1;
  padding: 28px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  min-width: 0;
}

.detail-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  padding-right: 28px;
}
.detail-title .resolved-name {
  color: var(--accent);
  display: block;
  font-size: 13px;
  margin-top: 4px;
  font-weight: 400;
}

.detail-meta {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.detail-meta td {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.detail-meta td:first-child {
  color: var(--muted);
  white-space: nowrap;
  padding-right: 20px;
  width: 90px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-meta td:last-child {
  color: var(--text);
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
}
.detail-meta .name-cell { color: var(--accent); font-family: inherit; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }

/* Frame strip (animation frames in detail modal) */
#frame-strip {
  display: none;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 0 0;
  justify-content: center;
  max-width: 100%;
}
#frame-strip.visible { display: flex; }
.frame-thumb {
  width: 40px; height: 40px;
  background: #0d0d1a;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  image-rendering: pixelated;
}
.frame-thumb.active { border-color: var(--accent); }
.frame-thumb:hover:not(.active) { border-color: var(--muted); }
