:root {
  --bg: #101114;
  --panel: #181a1f;
  --panel2: #202329;
  --line: #333842;
  --text: #eceff3;
  --muted: #a5acb8;
  --accent: #6fc2ff;
  --good: #86df9d;
  --bad: #ff8d8d;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.35 "Segoe UI", Arial, sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(480px, 1fr) 330px;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
}

.fileToolbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
  padding: 7px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.primeActions, .fileActions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.primeActions button { min-height: 38px; border-color: #426280; }
.fileActions { flex: 1 1 500px; justify-content: flex-end; }
.fileActions #capturePicker { width: min(200px, 100%); }
.fileActions #filenameInput { flex: 1 1 180px; width: 180px; min-width: 120px; }
.fileActions button, .fileActions .fileButton { white-space: nowrap; }

.left, .right {
  background: var(--panel);
  border-color: var(--line);
  min-height: 0;
}
.left { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.right { border-left: 1px solid var(--line); overflow: auto; padding: 12px; }
.center { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) 28px; }
.inspectorToggle, .inspectorClose { display: none; }

.brand { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.title { font-weight: 700; font-size: 15px; }
.muted, .stats { color: var(--muted); }
.searchRow { padding: 10px; }

input, button {
  font: inherit;
}
input {
  width: 100%;
  background: #0f1115;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  outline: none;
}
input:focus { border-color: var(--accent); }

button, .fileButton {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel2);
  color: var(--text);
  padding: 7px 10px;
  cursor: pointer;
  text-align: center;
  user-select: none;
}
button:hover, .fileButton:hover { border-color: var(--accent); }
button.active { background: #153247; border-color: var(--accent); }
button.good { border-color: #3c8051; }

.actions { padding: 0 10px 10px; display: grid; gap: 8px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.actions.compact { padding: 0; margin-bottom: 8px; }

.itemList {
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
}
.itemRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}
.itemRow:hover, .itemRow.selected { background: #222833; }
.itemMeta { color: var(--muted); font-size: 11px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.toolGroup { display: flex; gap: 6px; align-items: center; min-width: 0; }
.toolGroup.grow { flex: 1; }
.toolGroup.grow input { min-width: 160px; }
.fileButton { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.fileButton input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }

.viewport { position: relative; min-width: 0; min-height: 0; background: #0b0d10; }
.viewport canvas { display: block; width: 100%; height: 100%; }
.status {
  padding: 5px 10px;
  color: var(--muted);
  background: #121419;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status.good { color: var(--good); }
.status.bad { color: var(--bad); }

.panel {
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.panelTitle {
  font-weight: 700;
  margin-bottom: 10px;
}
.selectionName {
  color: var(--accent);
  margin-bottom: 10px;
  word-break: break-word;
}
.fieldNote {
  color: var(--muted);
  margin: -3px 0 10px;
  font-size: 12px;
  word-break: break-word;
}
.parentTarget { margin-bottom: 8px; }
.treeList {
  max-height: 30vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1115;
}
.treeRow {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}
.treeRow:hover, .treeRow.selected { background: #222833; }
.treeRow.primary { box-shadow: inset 3px 0 0 var(--accent); }
.treeRow.parentTarget .treeName { color: var(--good); }
.treeMarker, .treeMeta {
  color: var(--muted);
  font-size: 11px;
}
.treeName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.treeEmpty {
  color: var(--muted);
  padding: 10px;
}
.selectionToolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.selectionToolbar button {
  min-height: 28px;
  padding: 5px 6px;
}
.wideAction { display: block; width: 100%; margin: 6px 0 10px; }
.selectionList {
  max-height: 108px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f1115;
  margin-bottom: 10px;
}
.selectionRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  gap: 6px;
  align-items: center;
  min-height: 28px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}
.selectionRow:hover, .selectionRow.primary { background: #222833; }
.selectionRow.primary .selectionItemName {
  color: var(--accent);
  font-weight: 700;
}
.selectionItemName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selectionRow button {
  min-height: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
}
.selectionEmpty {
  color: var(--muted);
  padding: 8px;
}
label {
  display: block;
  color: var(--muted);
  margin: 9px 0;
}
label input { margin-top: 4px; }
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.valueText { float: right; color: var(--text); }
#jsonPreview {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 46vh;
  overflow: auto;
  background: #0f1115;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: #d8dee9;
}

@media (max-width: 1050px) {
  .shell { grid-template-columns: minmax(170px, 240px) minmax(0, 1fr); }
  .inspectorToggle { display: inline-block; border-color: #426280; }
  .inspectorClose { display: block; width: 100%; margin-bottom: 12px; }
  .right { display: none; }
  .right.inspectorOpen {
    display: block;
    position: fixed;
    z-index: 20;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, calc(100vw - 32px));
    box-shadow: -16px 0 35px rgba(0, 0, 0, .65);
  }
  .fileActions { justify-content: flex-start; }
}

/* 2026-09-06 authoring update: contents, validation, sub-parent, ammo */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: end; }
.checkRow { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; }
.checkRow input { width: auto; }
select { width: 100%; box-sizing: border-box; }
#capturePicker { max-width: 220px; }
.itemRow.noModel .itemMeta { color: #b08a4a; }
.validationList { max-height: 220px; overflow: auto; }
.validationRow { padding: 4px 6px; font-size: 12px; line-height: 1.3; border-bottom: 1px solid rgba(255,255,255,0.05); }
.validationRow.err { color: #ff8080; }
.validationRow.warn { color: #ffcc66; }
.validationRow.info { color: #9fc5ff; }
.contentRow { display: grid; grid-template-columns: 1fr auto auto auto; gap: 4px; align-items: center; padding: 3px 4px; }
.contentRow input[type="number"] { width: 56px; }
.contentRow .mini { font-size: 11px; opacity: 0.85; }
.treeRow .treeBadge { margin-left: 6px; font-size: 10px; padding: 0 4px; border-radius: 3px; background: #3a4b66; color: #cfe2ff; }
.treeRow .treeBadge.stick { background: #6b4b1f; color: #ffe0b0; }
.treeRow .treeBadge.frozen { background: #66313a; color: #ffc9cf; }
/* Hosted package handoff */
#packageDialog, #scanDialog { width: min(420px, calc(100vw - 32px)); max-height: 85vh; overflow-y: auto; color: var(--text); background: #171d27; border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
#packageDialog::backdrop, #scanDialog::backdrop { background: rgba(0, 0, 0, .7); }
#packageDialog h2, #scanDialog h2 { margin: 0 0 12px; }
#packageDisplayName, #scanDisplayName, #scanClaimCode { box-sizing: border-box; width: 100%; }
#packageMessage, #scanMessage { min-height: 3em; line-height: 1.4; }
#scanDialog label { display: block; margin: 12px 0; }
#scanList button { display: block; width: 100%; margin: 5px 0; text-align: left; }
