/* Level design, the CheckList editor (levelchecklist.js) and the kit the inspector and the
   flow editor are built from. Kit classes are .le-, the CheckList dialog's own are .lc-.
   Link this file whenever any of the three editors is on the page. */

/* A class that sets display would beat the hidden attribute the scripts use. */
.li-root [hidden], .le-dialog [hidden], .le-dialog[hidden] { display: none !important; }

.le-grow { flex: 1 1 auto; }

/* ---------------------------------------------------------------- boxes */
.le-input {
  width: 100%; min-width: 0; padding: 3px 6px; font: inherit;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px;
  -webkit-user-select: text; user-select: text;
}
.le-input:focus { outline: none; border-color: var(--accent); }
.le-input:disabled { opacity: .45; }
.le-input.le-bad { border-color: #ff6b6b; box-shadow: 0 0 0 1px #ff6b6b; }
.le-input::placeholder { color: #6c717a; }

.le-numbox { display: inline-flex; align-items: center; gap: 4px; }
.le-num { width: 74px; text-align: right; font-variant-numeric: tabular-nums; }
.le-unit { color: var(--dim); font-size: 11px; }

.le-select {
  width: 100%; min-width: 0; padding: 3px 6px; font: inherit;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px;
}
.le-select:focus { outline: none; border-color: var(--accent); }
.le-select:disabled { opacity: .45; }
.le-check { margin: 0; accent-color: var(--accent); cursor: pointer; }
.le-check:disabled { cursor: default; opacity: .45; }

.le-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 2px 8px; font: inherit; line-height: 1.5; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px;
}
.le-btn:hover:not(:disabled) { border-color: var(--accent); }
.le-btn:disabled { opacity: .4; cursor: default; }
.le-btn:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.le-btn.on { background: rgba(78, 161, 255, .22); border-color: var(--accent); }
.le-btn .ll-ico { color: var(--dim); }
.le-btn:hover:not(:disabled) .ll-ico { color: var(--text); }
.le-ibtn { width: 22px; height: 22px; padding: 0; }

/* ---------------------------------------------------------------- sections */
.le-sec + .le-sec { margin-top: 0; }
.le-sec-head {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px;
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer;
  border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.le-sec-head:hover { background: #31343a; }
.le-sec-head:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.le-twist { flex: none; position: relative; width: 12px; height: 12px; }
.le-twist::before {
  content: ''; position: absolute; left: 3px; top: 2px;
  border-left: 5px solid var(--dim); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transform: rotate(90deg); transform-origin: 2px 4px; transition: transform .12s;
}
.le-collapsed .le-twist::before { transform: none; }
.le-sec-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.le-sec-meta { margin-left: auto; color: var(--dim); font-size: 11px; font-weight: 400; white-space: nowrap; }
.le-sec-body { padding: 4px 12px 10px; }
.le-tone-group > .le-sec-head { box-shadow: inset 3px 0 0 var(--warn); }
.le-tone-tiled > .le-sec-head { box-shadow: inset 3px 0 0 #3cc4b1; }

/* ---------------------------------------------------------------- one field */
.le-field {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; align-items: start; gap: 4px 8px;
  padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.le-field:last-child { border-bottom: 0; }
.le-label-cell { min-width: 0; }
.le-label { display: block; font-weight: 500; cursor: default; }
.le-unity { color: #646a74; font-size: 10px; font-weight: 400; }
.le-hint { margin-top: 1px; color: var(--dim); font-size: 11px; line-height: 1.35; }
.le-default { color: #7f93ad; }
.le-control-cell { display: flex; align-items: center; justify-content: flex-end; min-height: 22px; min-width: 0; max-width: 230px; }
.le-control-cell .le-select { width: 170px; }
.le-reset { margin-top: 0; }
.le-reset:disabled { opacity: .18; }
.le-field.le-dim { opacity: .5; }

/* ---------------------------------------------------------------- combo picker */
.le-combo { display: flex; flex-direction: column; gap: 4px; min-width: 0; width: 100%; }
.le-combo-top { display: flex; gap: 4px; }
.le-combo-btn {
  flex: 1 1 auto; min-width: 0; padding: 3px 8px; font: inherit; text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 4px;
}
.le-combo-btn:hover { border-color: var(--accent); }
.le-combo-btn.le-empty { color: var(--dim); }
.le-combo-btn.le-missing { color: var(--warn); border-color: var(--warn); }
.le-combo-panel {
  display: flex; flex-direction: column; gap: 4px; padding: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
}
.le-combo-list { max-height: 200px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #4a4d55 transparent; }
.le-combo-opt {
  display: flex; align-items: baseline; gap: 6px; width: 100%; padding: 3px 6px; font: inherit; text-align: left; cursor: pointer;
  background: none; color: var(--text); border: 0; border-radius: 3px;
}
.le-combo-opt:hover, .le-combo-opt.le-hi { background: rgba(78, 161, 255, .22); }
.le-combo-opt.le-kind-file > .le-combo-name { font-weight: 600; }
.le-combo-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.le-combo-sub { flex: none; color: var(--dim); font-size: 10px; }
.le-combo-more { color: var(--dim); font-size: 11px; }
.le-combo-more:empty { display: none; }

/* ---------------------------------------------------------------- virtual list */
.le-vlist {
  position: relative; flex: none; height: 220px; overflow-y: auto; overflow-x: hidden;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  scrollbar-width: thin; scrollbar-color: #4a4d55 transparent;
}
.le-vlist-spacer { position: relative; width: 100%; }

/* ---------------------------------------------------------------- the floating window */
.le-dialog {
  position: fixed; z-index: 55; display: flex; flex-direction: column;
  min-width: 420px; min-height: 280px; max-width: calc(100vw - 8px); max-height: calc(100vh - 8px);
  overflow: hidden; resize: both;
  background: var(--panel); color: var(--text); font-size: 12px; line-height: 1.4;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 16px 48px rgba(0, 0, 0, .6);
}
.le-dialog:focus { outline: none; }
.le-dialog-head {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 14px;
  border-bottom: 1px solid var(--line); font-weight: 600; cursor: move; -webkit-user-select: none; user-select: none; touch-action: none;
}
.le-dialog-close { width: 24px; height: 24px; padding: 0; font-size: 16px; line-height: 1; }
.le-dialog-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- the list of actions */
.le-actions { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.le-act { padding: 6px 8px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.le-act-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.le-act-num { color: var(--dim); font-variant-numeric: tabular-nums; }
.le-act-kind { font-weight: 600; }
.le-act-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 12px; }
.le-mini { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.le-mini-wide { flex: 1 1 190px; }
.le-mini-label { color: var(--dim); font-size: 10px; }
.le-act-empty { color: var(--dim); font-style: italic; }
.le-act-sentence {
  padding: 6px 8px; background: rgba(78, 161, 255, .1); border-left: 2px solid var(--accent); border-radius: 0 4px 4px 0;
}
.le-act-add { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.le-act-add-label { color: var(--dim); }

/* ---------------------------------------------------------------- the CheckList dialog */
.lc-root { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.lc-side {
  display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 10px; overflow-y: auto;
  border-right: 1px solid var(--line);
}
.lc-intro { margin: 0; color: var(--dim); font-size: 11px; }
.lc-list { display: flex; flex-direction: column; gap: 4px; }
.lc-entry {
  position: relative; display: flex; flex-direction: column; gap: 1px; padding: 5px 24px 5px 8px; text-align: left; font: inherit; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 5px;
}
.lc-entry:hover { border-color: var(--accent); }
.lc-entry.on { background: rgba(78, 161, 255, .24); border-color: var(--accent); }
.lc-entry-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-entry-sub { color: var(--dim); font-size: 11px; }
.lc-entry-warn {
  position: absolute; right: 6px; top: 8px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--warn); color: #1b1c1f; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center; cursor: help;
}
.lc-main { min-width: 0; min-height: 0; padding: 10px 14px 14px; overflow-y: auto; }
.lc-empty { padding: 30px 10px; text-align: center; color: var(--dim); }
.lc-editor { display: flex; flex-direction: column; gap: 8px; }
.lc-top { display: flex; gap: 8px; }
.lc-top .le-text { font-weight: 600; }
.lc-sentence {
  padding: 7px 10px; background: rgba(78, 161, 255, .12); border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0;
  font-size: 13px; line-height: 1.45;
}
.lc-warn { color: var(--warn); }
.lc-items-head { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.lc-h { font-weight: 600; }
.lc-count { color: var(--dim); font-size: 11px; }
.lc-filter-row { display: flex; align-items: center; gap: 6px; }
.lc-filter-row .lc-filter { flex: 1 1 auto; }
.lc-filter-row .le-select { flex: 0 0 160px; width: 160px; }
.lc-only-label { flex: none; display: inline-flex; align-items: center; gap: 4px; color: var(--dim); cursor: pointer; }
.lc-bulk { display: flex; flex-wrap: wrap; gap: 4px; }
.lc-item {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 0 8px; cursor: pointer;
}
.lc-item:hover { background: rgba(255, 255, 255, .05); }
.lc-item-name { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-item-sub { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 11px; }
.lc-excluded .lc-item-name { opacity: .6; font-style: italic; }
.lc-delay .le-field, .lc-delay.le-field { border-bottom: 0; }
