/* the desktop app's look: 3ds Max's greys */
:root {
  --bg: #444444;
  --raised: #393939;
  --sunken: #2e2e2e;
  --line: #5a5a5a;
  --button: #646464;
  --button-hi: #707070;
  --fg: #e6e6e6;
  --muted: #b8b8b8;
  --accent: #5c84b7;
  --accent-hi: #6a93c6;
  --warn: #ff9f43;
  --good: #4cd97b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}
header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 16px;
  background: var(--raised);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
h1 { font-size: 17px; font-weight: 600; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
#steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; counter-reset: s; flex-wrap: wrap; }
#steps li {
  counter-increment: s;
  padding: 3px 10px;
  border-radius: 3px;
  color: var(--muted);
  background: var(--sunken);
  font-size: 13px;
}
#steps li::before { content: counter(s) ". "; }
#steps li.done { background: var(--button); color: var(--fg); cursor: pointer; }
#steps li.done::after { content: " \2713"; }
#steps li.on { background: var(--accent); color: var(--fg); font-weight: 600; }
main { flex: 1; display: flex; min-height: 0; }
#panel {
  width: 440px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  min-height: 0;
}
#body { flex: 1; overflow-y: auto; padding: 16px; }
#foot { padding: 8px 16px 12px; border-top: 1px solid var(--line); }
#status { margin: 0 0 6px; white-space: pre-line; min-height: 1em; }
#view { flex: 1; position: relative; min-width: 0; background: var(--sunken); }
#draw { width: 100%; height: 100%; display: block; touch-action: none; }
#three { position: absolute; inset: 0; }
#three canvas { display: block; }
#empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 16px; text-align: center; }
.hint {
  position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 4px 8px; border-radius: 3px;
  background: rgba(46, 46, 46, 0.85); color: var(--fg); font-size: 12px; pointer-events: none;
}
p { margin: 0 0 10px; }
.note { color: var(--muted); font-size: 13px; }
.warn { color: var(--warn); }
.good { color: var(--good); }
.muted { color: var(--muted); }
ul.warn, ul.plain { font-size: 13px; padding-left: 18px; margin: 6px 0; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { margin-bottom: 4px; }
fieldset label { display: block; padding: 2px 0 2px 12px; }
label.field { display: block; margin: 10px 0 2px; }
button, .button {
  display: inline-block;
  font: inherit;
  color: var(--fg);
  background: var(--button);
  border: 1px solid var(--sunken);
  border-radius: 3px;
  padding: 5px 12px;
  cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: var(--button-hi); }
button:disabled { opacity: 0.45; cursor: default; }
button.accent, .button.accent { background: var(--accent); border-color: var(--accent); font-weight: 600; }
button.accent:hover:not(:disabled), .button.accent:hover { background: var(--accent-hi); }
button:focus-visible, .button:focus-within, input:focus-visible, select:focus-visible, tr:focus-visible {
  outline: 2px solid var(--accent-hi); outline-offset: 1px;
}
input[type="text"], input[type="number"], select {
  font: inherit;
  color: var(--fg);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 6px;
}
input.wide { display: block; width: 100%; }
input.num { width: 90px; text-align: right; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.row.end { justify-content: flex-end; }
nav { display: flex; justify-content: space-between; gap: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table { max-height: 300px; overflow-y: auto; background: var(--raised); border: 1px solid var(--line); margin: 6px 0; }
th { position: sticky; top: 0; background: var(--sunken); text-align: left; font-weight: 600; padding: 4px 6px; }
td { padding: 3px 6px; border-top: 1px solid #424242; vertical-align: top; }
tr.pick { cursor: pointer; }
tr.pick:hover td { background: #4a4a4a; }
tr.sel td { background: var(--accent) !important; }
td.c { text-align: center; }
td.n { text-align: right; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 2px; margin: 8px 0; }
.legend span { padding: 0 5px; font-size: 12px; border-radius: 2px; }
.grid { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; font-size: 13px; }
.grid .note { grid-column: 1 / -1; font-size: 12px; margin-bottom: 4px; }
.busy {
  height: 4px; margin-bottom: 8px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 40% 100% no-repeat var(--sunken);
  animation: slide 1.2s linear infinite;
}
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
dialog { background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 4px; padding: 16px; max-width: min(900px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.pages-body { display: flex; gap: 12px; align-items: flex-start; }
#pages-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; min-width: 320px; background: var(--raised); border: 1px solid var(--line); }
#pages-list label { display: flex; gap: 8px; padding: 4px 8px; cursor: pointer; font-size: 13px; }
#pages-list label:hover, #pages-list label.cur { background: #4a4a4a; }
#pages-thumb { max-width: 360px; max-height: 60vh; background: #fff; }
@media (max-width: 860px) {
  main { flex-direction: column; }
  #panel { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); max-height: 55vh; }
  #view { min-height: 60vh; }
  .pages-body { flex-direction: column; }
  #pages-list { min-width: 0; width: 100%; }
}
