/* WorldWeaver - Windows XP ("Luna") look, matching Schematic Viewer. */

:root {
  --face: #ECE9D8;
  --face-light: #F5F4EA;
  --border: #ACA899;
  --border-dark: #919B9C;
  --input-border: #7F9DB9;
  --select: #316AC5;
  --link: #215DC6;
  --link-hover: #428EFF;
  --muted: #6D6B60;
  --ok-c: #2E8B23;
  --warn-c: #A86A00;
  --err-c: #C8261B;
  --since-c: #C85A00;     /* changed since the last Generate */
  --mod-c: #215DC6;       /* not the default */
  --font: 11px Tahoma, "Segoe UI", Verdana, sans-serif;
  --mono: "Lucida Console", Consolas, "Courier New", monospace;
  --side-w: 330px;
  /* Names map.js / view3d.js read for canvas drawing. */
  --bg: #FFFFFF;
  --map-bg: #808080;
  --text: #000000;
  --dim: #555555;
  --faint: #C8D6EE;
  --line2: #D6D2C2;
  --accent: #316AC5;
  --overlay: rgba(255, 255, 225, .96);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font: var(--font); color: #000; background: var(--face); cursor: default; }
button, input, select, textarea { font: var(--font); color: #000; }
[hidden] { display: none !important; }
code, .mono { font-family: var(--mono); font-size: 11px; }
h2, h3 { margin: 0; font: bold 11px Tahoma, sans-serif; }
p { margin: 0 0 6px; }
a { color: var(--link); }

input[type=text], input[type=search], input[type=number], input:not([type]), select, textarea {
  border: 1px solid var(--input-border); background: #fff; padding: 2px 3px; height: 21px; outline: none; border-radius: 0; min-width: 0;
}
textarea { height: auto; font-family: var(--mono); }
input:focus, select:focus, textarea:focus { border-color: #3C7FB1; }
input:disabled, select:disabled { background: var(--face-light); color: #A3A193; }
select { padding: 1px; }
input[type=number] { text-align: right; }
input[type=checkbox], input[type=radio] { accent-color: var(--select); margin: 0 4px 0 0; vertical-align: -2px; }
input[type=range] { accent-color: var(--select); height: 18px; margin: 0; }

/* XP scrollbars */
::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-track { background: #F4F3EE; border-left: 1px solid #EEEDE5; }
::-webkit-scrollbar-thumb { background: linear-gradient(to right, #CAD9FB, #B9CDF8); border: 1px solid #fff; border-radius: 3px; box-shadow: inset 0 0 0 1px #9EB6EC; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(to right, #DCE6FD, #C6D7FA); }
::-webkit-scrollbar-corner { background: var(--face); }

.ico { display: inline-block; width: 16px; height: 16px; flex: none; vertical-align: middle; }
.ico svg { display: block; }

/* -- buttons ----------------------------------------------------------------- */
.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 75px; height: 23px; padding: 0 10px; border: 1px solid #003C74; border-radius: 3px;
  background: linear-gradient(180deg, #fff 0%, #ECEBE6 86%, #D6D0C5 100%); color: #000; white-space: nowrap; text-decoration: none;
}
.btn.small { min-width: 0; height: 21px; padding: 0 7px; }
.btn:hover:not(:disabled) { box-shadow: inset -1px 1px #FFF0CF, inset 1px 2px #FDD889, inset -2px 2px #FBC761, inset 2px -2px #E5A01A; }
.btn:focus-visible, .btn.primary { box-shadow: inset -1px 1px #CEE7FF, inset 1px 2px #98B8EA, inset -2px 2px #BCD4F6, inset 1px -1px #89ADE4, inset 2px -2px #89ADE4; outline: none; }
.btn.primary { font-weight: bold; }
.btn.danger { color: #8B1A10; }
.btn:active:not(:disabled) { background: linear-gradient(180deg, #CDCAC3 0%, #E3E3DB 8%, #E5E5DE 94%, #F2F2F1 100%); }
.btn:disabled { color: #ACA899; border-color: #C9C7BA; background: #F5F4EA; box-shadow: none; }
.icon-btn { width: 23px; height: 21px; padding: 0; border: 1px solid transparent; border-radius: 3px; background: none; display: inline-grid; place-items: center; flex: none; font-size: 14px; line-height: 1; }
.icon-btn:hover { border-color: #CECEC3; background: linear-gradient(#FEFEFE, #EBEAE5); }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--link-hover); text-decoration: underline; }

/* Segmented groups (map layers, paint palette layers...) as XP toolbar toggles. */
.seg { display: inline-flex; gap: 1px; flex-wrap: wrap; }
.seg button { height: 22px; padding: 0 7px; border: 1px solid transparent; border-radius: 3px; background: none; white-space: nowrap; }
.seg button:hover:not(:disabled) { border-color: #CECEC3; background: linear-gradient(#FEFEFE, #EBEAE5 80%, #E2E0D7); }
.seg button.on, .seg button.on:hover { border-color: #9D9D92; background: linear-gradient(#E3E2DA, #EFEEE9); box-shadow: inset 1px 1px 1px rgba(0,0,0,.1); }
.seg button:disabled { color: #ACA899; }
.seg.small button { height: 20px; padding: 0 6px; }
.checks-seg button::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 4px; vertical-align: -2px;
  border: 1px solid #1C5180; background: linear-gradient(135deg, #DCDCD7, #fff); }
.checks-seg button.on::before { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 11'%3E%3Cpath d='M2 5.5l2.3 2.3L9 3' fill='none' stroke='%2321A121' stroke-width='2'/%3E%3C/svg%3E") center/9px no-repeat; }
.checks-seg button.on, .checks-seg button.on:hover { background: none; box-shadow: none; border-color: transparent; }
.checks-seg button:hover:not(:disabled) { background: none; border-color: transparent; text-decoration: underline; }

/* -- app layout -------------------------------------------------------------- */
#app { display: flex; flex-direction: column; height: 100%; }
#main { flex: 1; display: flex; min-height: 0; }
#center { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 4px 4px 4px 4px; }

/* menu bar */
#menubar { display: flex; background: var(--face); border-bottom: 1px solid #fff; box-shadow: 0 1px 0 #D6D2C2; padding: 1px 2px; flex: none; }
#menubar .mb { padding: 2px 7px 3px; }
#menubar .mb.open, #menubar .mb:hover { background: var(--select); color: #fff; }
.menu { position: fixed; z-index: 1000; background: #fff; border: 1px solid var(--border); box-shadow: 2px 2px 3px rgba(0,0,0,.28); padding: 2px; min-width: 190px; }
.menu .mi { display: flex; align-items: center; padding: 3px 18px 3px 4px; white-space: nowrap; }
.menu .mi .chk { width: 18px; text-align: center; flex: none; }
.menu .mi .ico { margin-right: 6px; }
.menu .mi .noico { width: 22px; flex: none; }
.menu .mi .lbl { flex: 1; padding-right: 24px; }
.menu .mi:hover:not(.dis) { background: var(--select); color: #fff; }
.menu .mi.dis { color: var(--border); }
.menu .mi.dis .ico { filter: grayscale(1); opacity: .5; }
.menu .sep { height: 1px; background: var(--border); margin: 3px 1px; }

/* toolbar */
#toolbar { display: flex; align-items: center; gap: 1px; padding: 2px 4px; background: linear-gradient(#FBFBF8, #ECE9D8); border-bottom: 1px solid #D5D2C5; flex: none; min-height: 38px; flex-wrap: wrap; }
.tbtn { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 6px; border: 1px solid transparent; border-radius: 3px; background: none; color: #000; }
.tbtn .ico { width: 22px; height: 22px; }
.tbtn:hover:not(:disabled) { border-color: #CECEC3; background: linear-gradient(#FEFEFE, #EBEAE5 80%, #E2E0D7); }
.tbtn:active:not(:disabled), .tbtn.on { border-color: #9D9D92; background: linear-gradient(#E3E2DA, #EFEEE9); box-shadow: inset 1px 1px 1px rgba(0,0,0,.08); }
.tbtn:disabled { opacity: .45; filter: grayscale(1); }
.tbtn.big { font-weight: bold; }
.tsep { display: inline-block; width: 1px; height: 26px; background: #C5C2B2; border-right: 1px solid #fff; margin: 0 4px; flex: none; }
#toolbar .tgroup { display: inline-flex; gap: 1px; }

/* task pane */
#taskpane { width: 212px; flex: none; background: linear-gradient(#7BA2E7, #6375D6); padding: 12px 11px; overflow-y: auto; }
#taskpane.hidden { display: none; }
.tp-box { margin-bottom: 14px; }
.tp-head { display: flex; align-items: center; justify-content: space-between; height: 25px; padding: 0 2px 0 11px; border-radius: 3px 3px 0 0; background: linear-gradient(to right, #fff 0%, #C6D3F7 100%); color: var(--link); font-weight: bold; cursor: pointer; }
.tp-head:hover { color: var(--link-hover); }
.tp-box.special .tp-head { background: linear-gradient(to right, #0C32B0, #2A5AD8); color: #fff; }
.tp-box.special .tp-head:hover { color: #C6D3F7; }
.tp-box.special .tp-body { background: #EFF3FF; }
.tp-chev { width: 19px; height: 19px; border-radius: 50%; border: 1px solid #C6D3F7; background: linear-gradient(#fff, #E3EAFB); display: grid; place-items: center; box-shadow: 0 1px 1px rgba(0,0,0,.18); }
.tp-chev svg { width: 9px; height: 9px; transition: transform .15s; }
.tp-box.collapsed .tp-chev svg { transform: rotate(180deg); }
.tp-box.collapsed .tp-body { display: none; }
.tp-body { background: #D6DFF7; border: 1px solid #fff; border-top: 0; padding: 9px 10px 8px; }
.tp-link { display: flex; align-items: flex-start; gap: 6px; padding: 2px 0; color: var(--link); }
.tp-link .ico { margin-top: -1px; }
.tp-link:hover:not(.dis) { color: var(--link-hover); text-decoration: underline; cursor: pointer; }
.tp-link.dis { color: #8A9BBF; }
.tp-link.dis .ico { filter: grayscale(1); opacity: .5; }
.tp-link.strong { font-weight: bold; }
.tp-details { line-height: 1.55; word-break: break-word; }
.tp-details b { display: block; margin-bottom: 2px; }
.tp-details .dim { color: #44506A; }
.tp-details .okt { color: var(--ok-c); }
.tp-details .chg { color: var(--since-c); font-weight: bold; }
.tp-check { display: flex; gap: 6px; align-items: flex-start; padding: 3px 0; line-height: 1.4; }
.tp-check + .tp-check { border-top: 1px solid #fff; }
.tp-check .ico { margin-top: 1px; }
.tp-check .link-btn { display: block; margin-top: 2px; }
.tp-prog { margin: 4px 0 2px; }
.q-row { display: flex; align-items: flex-start; gap: 6px; padding: 3px 0; line-height: 1.35; }
.q-row + .q-row { border-top: 1px solid #fff; }
.q-row .ico { margin-top: 1px; flex: none; }
.q-row .dim { color: #44506A; font-size: 11px; }
.q-text { flex: 1; min-width: 0; word-break: break-word; }
.q-num { flex: none; width: 16px; text-align: right; color: #44506A; }
.q-btns { display: flex; flex: none; }
.q-btns .icon-btn { width: 17px; height: 17px; font-size: 10px; }
.q-btns .icon-btn:disabled { opacity: .35; }
.q-row.cur b { color: var(--link); }
.q-row.done .link-btn { flex: none; }
.tp-body > .tp-details + .q-row, .tp-body > .q-row + .tp-link, .tp-body > .q-row + .tp-details { margin-top: 4px; }

/* XP tabs */
.tabs { display: flex; padding-left: 2px; position: relative; z-index: 1; flex: none; }
.tab { padding: 3px 12px 4px; border: 1px solid var(--border-dark); border-bottom: 0; border-radius: 3px 3px 0 0; background: linear-gradient(#fff, #ECEBE5 90%, #DCDBD2); margin-right: -1px; position: relative; top: 2px; }
.tab:hover { border-top: 2px solid #FFC83C; padding-top: 2px; }
.tab.active { background: #FCFCFE; border-top: 3px solid #FFC83C; padding: 2px 12px 6px; top: 1px; box-shadow: inset 0 1px #E68B2C; }
.tab .badge { margin-left: 5px; }
.tabpage { flex: 1; display: none; flex-direction: column; background: #FCFCFE; border: 1px solid var(--border-dark); min-height: 0; box-shadow: 1px 1px 0 #D0CEBF; overflow: hidden; }
.tabpage.active { display: flex; }

/* status bar */
#statusbar { display: flex; height: 23px; background: var(--face); border-top: 1px solid #fff; box-shadow: 0 -1px 0 #D6D2C2; flex: none; align-items: stretch; }
.sb { padding: 4px 8px 0; border-right: 1px solid #D6D2C2; box-shadow: 1px 0 #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sb-msg { flex: 1; min-width: 0; }
#sb-msg.link { cursor: pointer; }
#sb-msg.link:hover { color: var(--link); text-decoration: underline; }
#map-readout { width: 300px; font-family: var(--mono); font-size: 10px; padding-top: 5px; }
#sb-size { width: 180px; }
.sb-prog { padding: 3px 6px 0; }
.grip { width: 14px; background: radial-gradient(circle at 2px 2px, #fff 1px, transparent 1.2px) 0 0/4px 4px, radial-gradient(circle at 1px 1px, #ABA898 1px, transparent 1.2px) 0 0/4px 4px; clip-path: polygon(100% 0, 100% 100%, 0 100%); margin: 6px 2px 2px 0; }

/* XP progress bar (green blocks). .indet = marquee. */
.progress { width: 160px; height: 15px; border: 1px solid #686868; border-radius: 3px; padding: 1px; background: #fff; overflow: hidden; position: relative; }
.progress > div { height: 100%; width: 0; background: repeating-linear-gradient(90deg, #2FB52F 0 7px, #fff 7px 9px); transition: width .4s; }
.progress.wide { width: 100%; }
.progress.indet > div { position: absolute; top: 1px; bottom: 1px; width: 50px; animation: marquee 1.4s linear infinite; }
@keyframes marquee { from { left: -50px; } to { left: 100%; } }

/* -- options sidebar ---------------------------------------------------------- */
#sidebar { width: var(--side-w); flex: none; display: flex; flex-direction: column; background: var(--face); padding: 6px 6px 6px 4px; border-left: 1px solid #D6D2C2; position: relative; min-height: 0; }
.side-title { font: bold 13px "Trebuchet MS", Tahoma, sans-serif; color: #2E4E9E; padding: 2px 2px 6px; }
.side-head { display: flex; flex-direction: column; gap: 5px; padding-bottom: 6px; }
.side-row { display: flex; gap: 5px; align-items: center; }
.side-row select { flex: 1; min-width: 0; }
.side-row label { white-space: nowrap; }
.side-row .chk { display: flex; align-items: center; }
#param-search { width: 100%; }
.side-body { flex: 1; overflow-y: auto; background: #fff; border: 1px solid var(--input-border); min-height: 0; }
.side-resize { position: absolute; left: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 5; }
.side-resize:hover, .side-resize.drag { background: rgba(49,106,197,.3); }

.pgroup-head { display: flex; align-items: center; gap: 5px; padding: 3px 6px 4px; background: linear-gradient(#fff, #F7F6F0 60%, #EBEADB); border-bottom: 1px solid #D6D2C2; position: sticky; top: 0; z-index: 2; }
.pgroup-head:hover { box-shadow: inset 0 -2px #F9B119; }
.pgroup-head .exp { width: 9px; height: 9px; border: 1px solid #7A8CA8; background: #fff; display: grid; place-items: center; font: 9px/1 Tahoma; color: #000; flex: none; }
.pgroup-head .gname { font-weight: bold; flex: 1; }
.pgroup-head .gcount { color: var(--since-c); }
.pgroup-head .gmod { color: var(--mod-c); }
.pgroup-body { display: none; padding: 2px 0 6px; }
.pgroup.open .pgroup-body { display: block; }
.pgroup-tip { color: var(--muted); padding: 3px 8px 4px 20px; font-style: italic; }
.pgroup-empty { padding: 20px 14px; color: var(--muted); text-align: center; }

.prow { padding: 3px 6px 3px 20px; position: relative; }
.prow:hover { background: #F1F5FD; }
.prow::before { content: ""; position: absolute; left: 8px; top: 9px; width: 6px; height: 6px; border-radius: 50%; }
.prow.mod::before { background: var(--mod-c); }
.prow.since::before { background: var(--since-c); }
.prow.disabled { opacity: .5; }
.prow.adv .plabel { color: #333; }
.ptop { display: flex; align-items: center; gap: 4px; min-height: 21px; }
.plabel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow.pcheck .plabel { display: flex; align-items: center; }
.pnum { width: 80px; }
.ptext { width: 100%; margin-top: 2px; font-family: var(--mono); }
.prow select { max-width: 130px; }
.prow input[type=range] { width: 100%; display: block; }
.prow-btn { visibility: hidden; flex: none; }
.prow:hover .prow-btn.show, .prow:hover .prow-btn.always { visibility: visible; }
.pbrowse { display: flex; gap: 3px; margin-top: 2px; }
.pbrowse input { flex: 1; font-family: var(--mono); }

/* -- list views ------------------------------------------------------------- */
.lv { display: flex; flex-direction: column; border: 1px solid var(--input-border); background: #fff; min-height: 0; }
.lv-head { display: flex; background: linear-gradient(#fff, #F7F6F0 60%, #EBEADB); border-bottom: 1px solid #D6D2C2; flex: none; }
.lv-head > div { padding: 3px 6px 4px; border-right: 1px solid #E2DFD0; box-shadow: 1px 0 #fff; }
.lv-body { flex: 1; overflow: auto; }
.lv-row { display: flex; align-items: center; gap: 4px; min-height: 19px; padding: 1px 4px; white-space: nowrap; }
.lv-row:hover { background: #F1F5FD; }
.lv-row.sel, .lv-row.sel:hover { background: var(--select); color: #fff; }
.lv-row.sel .dim { color: #DDE6F7; }
.lv-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lv-row .num { text-align: right; color: #333; }
.lv-row.sel .num { color: #fff; }
.dim { color: var(--muted); }

/* -- Steps tab ----------------------------------------------------------------- */
#tab-pipeline { overflow-y: auto; }
.pipe { padding: 10px 12px 30px; display: flex; flex-direction: column; gap: 4px; }
.groupbox { border: 1px solid #D0D0BF; border-radius: 4px; padding: 12px 10px 8px; display: flow-root; margin-top: 10px; position: relative; background: #fff; }
.groupbox > .gt { position: absolute; top: -7px; left: 7px; padding: 0 3px; background: #FCFCFE; color: #0046D5; }
.groupbox .gb-tools { float: right; display: flex; gap: 4px; margin: 0 0 6px 12px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 8px; align-items: baseline; }
.kv > :nth-child(odd) { color: var(--muted); }
.kv .v { user-select: text; word-break: break-all; }
.path { font-family: var(--mono); font-size: 11px; word-break: break-all; user-select: text; }
.line { display: flex; gap: 4px; align-items: center; min-width: 0; }
.line input[type=text] { flex: 1; font-family: var(--mono); }
.hint { color: var(--muted); line-height: 1.4; }
.hint.warn { color: var(--warn-c); }
.hint.err, .err { color: var(--err-c); }
.err-text { color: var(--err-c); white-space: pre-wrap; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.badge { padding: 0 5px; border: 1px solid #7FB37A; background: #EAF6E8; color: #2E6B26; border-radius: 2px; white-space: nowrap; font-weight: normal; }
.badge.chg { border-color: #E0A060; background: #FFF1DE; color: #8A4A00; }
.badge.run { border-color: #7F9DB9; background: #E8F0FC; color: #1E4C9A; }
.badge.err { border-color: #D88; background: #FDEAEA; color: #8B1A10; }
.badge.off { border-color: #CCC; background: #F3F3F3; color: #777; }

.stage { border: 1px solid #D6D2C2; background: #fff; }
.stage + .stage { border-top: 0; }
.stage-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.stage-head:hover { background: #F1F5FD; }
.stage-head .exp { width: 9px; height: 9px; border: 1px solid #7A8CA8; background: #fff; display: grid; place-items: center; font: 9px/1 Tahoma; flex: none; }
.stage .num { color: var(--muted); width: 14px; text-align: right; }
.stage .sname { font-weight: bold; width: 170px; flex: none; }
.stage-head .badge { width: 170px; flex: none; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.stage .sdesc { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage .stime { color: var(--muted); font-family: var(--mono); min-width: 50px; text-align: right; }
.stage-body { display: none; padding: 4px 10px 10px 42px; flex-direction: column; gap: 8px; border-top: 1px dotted #D6D2C2; }
.stage.open .stage-body { display: flex; }
.changes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.changes li { display: flex; gap: 6px; align-items: baseline; }
.changes .from { color: #8C8A7E; text-decoration: line-through; font-family: var(--mono); }
.changes .to { color: var(--since-c); font-family: var(--mono); }
.files { display: flex; flex-wrap: wrap; gap: 4px; }
.file { display: flex; align-items: center; gap: 5px; padding: 2px 6px; border: 1px solid #D6D2C2; background: var(--face-light); }
.file .fsize { color: var(--muted); }
.file.missing { opacity: .5; border-style: dashed; }
.file.image { padding: 2px 6px 2px 2px; }
.file.image:hover { border-color: var(--select); background: #E8F0FC; }
.file img { width: 32px; height: 32px; object-fit: cover; background: #000; border: 1px solid #999; }
.stat-line b { font-weight: bold; }
.sharebar { display: flex; height: 10px; border: 1px solid #999; background: #fff; }
.sharebar > div { height: 100%; }
.share-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); }
.share-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 4px; border: 1px solid #555; background: var(--c); }

.empty-state { margin: 60px auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; max-width: 380px; line-height: 1.5; }
.empty-state h2 { font: bold 14px "Trebuchet MS", Tahoma, sans-serif; color: #2E4E9E; }
.empty-state .big { width: 48px; height: 48px; }

/* -- History tab ---------------------------------------------------------------- */
.runs { display: flex; height: 100%; gap: 6px; padding: 6px; min-height: 0; }
.runs-list { width: 240px; flex: none; overflow-y: auto; }
.run-item { padding: 3px 6px; display: flex; flex-direction: column; gap: 1px; border-bottom: 1px solid #F0EFE8; }
.run-item:hover { background: #F1F5FD; }
.run-item.on, .run-item.on:hover { background: var(--select); color: #fff; }
.run-item .r1, .run-item .r2 { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.run-item .r2 { color: var(--muted); }
.run-item.on .r2 { color: #DDE6F7; }
.run-item .ico { margin-right: 4px; }
.run-detail { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.run-head { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px; border: 1px solid #D0D0BF; background: #fff; }
.run-head .row1 { display: flex; align-items: center; gap: 6px; }
.run-head .row1 h3 { flex: 1; font-size: 12px; }
.stepper { display: flex; gap: 2px; }
.stepper > div { flex: 1; min-width: 0; }
.stepper .bar { height: 7px; border: 1px solid #A6A493; background: #fff; }
.stepper .done .bar { background: #46B33F; border-color: #2E7D26; }
.stepper .cur .bar { background: repeating-linear-gradient(90deg, #2FB52F 0 7px, #fff 7px 9px); border-color: #686868; }
.stepper .fail .bar { background: #D9341E; border-color: #7E1408; }
.stepper .lbl { color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper .cur .lbl { color: #000; font-weight: bold; }
.live { display: flex; gap: 8px; align-items: center; min-height: 17px; }
.live .sub { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timebar { display: flex; height: 16px; border: 1px solid #999; background: #fff; }
.timebar > div { height: 100%; display: grid; place-items: center; font-size: 10px; color: #000; overflow: hidden; white-space: nowrap; min-width: 2px; }
.run-tabs { display: flex; padding-left: 2px; }
.run-tabs + * { border-top: 1px solid var(--border-dark); }
.log-tools { display: flex; gap: 8px; align-items: center; }
.log-tools input[type=search] { width: 200px; }
.log { flex: 1; overflow: auto; margin: 0; padding: 6px 8px 20px; font: 11px/1.4 var(--mono); white-space: pre; color: #000; background: #fff; border: 1px solid var(--input-border); user-select: text; min-height: 0; }
.log .ls { color: #0B3EA8; font-weight: bold; }
.log .lw { color: #9A5B00; }
.log .le { color: #C8261B; }
.log .lv { color: #8C8A7E; }
.log mark { background: #FFF2A8; color: inherit; }
.diff-list { padding: 8px; overflow: auto; display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--input-border); flex: 1; }

/* -- Map tab ---------------------------------------------------------------- */
.map-strip { display: flex; align-items: center; gap: 4px; padding: 3px 6px; background: linear-gradient(#FBFBF8, #ECE9D8); border-bottom: 1px solid #D5D2C5; flex-wrap: wrap; flex: none; }
.strip-label { color: var(--muted); padding: 0 2px 0 4px; }
.map-strip select { max-width: 190px; }
.map-strip .tsep { height: 20px; }
.map-wrap { flex: 1; position: relative; overflow: hidden; background: var(--map-bg); min-height: 0; }
#map2d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#map3d { position: absolute; inset: 0; }
#map3d canvas { display: block; }
.map-wrap.tool-pan #map2d { cursor: grab; }
.map-wrap.tool-pan.dragging #map2d { cursor: grabbing; }
.map-wrap.tool-inspect #map2d, .map-wrap.tool-profile #map2d, .map-wrap.tool-wind #map2d { cursor: crosshair; }
.map-wrap.tool-paint #map2d { cursor: none; }
.map-wrap.tool-paint.selecting #map2d { cursor: crosshair; }

/* Floating tool panel = a small XP tool window. */
.map-panel { position: absolute; right: 8px; top: 8px; width: 276px; max-height: calc(100% - 16px); display: flex; flex-direction: column;
  background: #0A5BE3; border: 1px solid #0831D9; border-radius: 6px 6px 0 0; padding: 0 3px 3px; z-index: 3; box-shadow: 3px 4px 10px rgba(0,0,0,.35); }
.map-panel .mp-head { height: 22px; display: flex; align-items: center; gap: 4px; padding: 0 2px 0 6px; margin: 0 -3px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #0997FF 0%, #0053EE 10%, #0050EE 45%, #0066FF 90%, #003DD7 100%); color: #fff; font: bold 11px Tahoma; text-shadow: 1px 1px #0F1089; flex: none; }
.map-panel .mp-head h3 { flex: 1; font: bold 11px Tahoma; }
.map-panel .mp-head .icon-btn { width: 17px; height: 17px; border: 1px solid #fff; border-radius: 3px; color: #fff; font-size: 13px; font-weight: bold;
  background: radial-gradient(circle at 90% 90%, #CC4600 0%, #DC6527 55%, #CD7546 70%, #E5A288 100%); }
.map-panel .mp-body { background: var(--face); padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
.mp-sec { display: flex; flex-direction: column; gap: 4px; }
.mp-sec > .t { color: #0046D5; border-bottom: 1px solid #D0D0BF; padding-bottom: 1px; }
.mp-sec .row input[type=range] { flex: 1; }
.palette { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; }
.palette button { display: flex; align-items: center; gap: 5px; background: #fff; border: 1px solid transparent; padding: 1px 4px; text-align: left; }
.palette button:hover { border-color: #CECEC3; }
.palette button.on { background: var(--select); color: #fff; }
.palette .sw, .map-legend .sw, .map-tip .sw { width: 12px; height: 12px; border: 1px solid #555; flex: none; }
.settings-grid { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; }
.inspect-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; user-select: text; }
.inspect-kv > :nth-child(odd) { color: var(--muted); }

.map-legend { position: absolute; left: 8px; bottom: 8px; z-index: 2; background: #FFFFE1; border: 1px solid #000; padding: 4px 6px; max-width: 240px; display: flex; flex-direction: column; gap: 2px; }
.map-legend:empty { display: none; }
.map-legend .lg-row { display: flex; align-items: center; gap: 5px; }
.map-legend .ramp { height: 9px; width: 200px; border: 1px solid #555; }
.map-legend .ramp-scale { display: flex; justify-content: space-between; color: var(--muted); }
.map-legend .lg-title { font-weight: bold; }
.map-tip { position: absolute; z-index: 5; pointer-events: none; background: #FFFFE1; border: 1px solid #000; padding: 2px 5px; white-space: nowrap; }
.map-tip:not([hidden]) { display: flex; flex-direction: column; gap: 2px; }
.map-tip .tip-row { display: flex; align-items: center; gap: 5px; }
.map-tip .sub { color: var(--muted); }
.map-scale { position: absolute; right: 10px; bottom: 8px; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; pointer-events: none; }
.map-scale .bar { height: 5px; border: 2px solid #fff; border-top: 0; box-shadow: 0 1px 0 #000; }
.map-scale span { color: #fff; text-shadow: 1px 1px 1px #000, -1px -1px 1px #000; font-weight: bold; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); z-index: 1; text-align: center; padding: 20px; background: #fff; line-height: 1.6; }
.map-busy { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 4; background: #FFFFE1; border: 1px solid #000; padding: 3px 10px; }
.profile-panel { position: absolute; left: 0; right: 0; bottom: 0; height: 190px; background: #fff; border-top: 2px solid var(--border-dark); z-index: 3; }
.profile-panel canvas { width: 100%; height: 100%; display: block; }
.profile-close { position: absolute; right: 4px; top: 4px; }
.map-wrap.has-profile .map-legend { bottom: 200px; }
.map-wrap.has-profile .map-scale { bottom: 200px; }

.sea-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: var(--face); border-top: 1px solid #D6D2C2; flex-wrap: wrap; }
.sea-bar > label { font-weight: bold; white-space: nowrap; }
.sea-bar #sea-range { width: 220px; flex-shrink: 1; min-width: 90px; }
.sea-bar #sea-num { width: 70px; }
#hypso { width: 200px; height: 28px; cursor: ew-resize; flex: none; border: 1px solid var(--input-border); background: #fff; }
.sea-stats { white-space: nowrap; }
.sea-stats b { font-weight: bold; }
.sea-last { color: var(--muted); margin-left: auto; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.sea-last.diff { color: var(--since-c); }

/* -- windows (dialogs) -------------------------------------------------------- */
.modal-back { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.04); }
.win { background: #0A5BE3; border: 1px solid #0831D9; border-radius: 8px 8px 0 0; padding: 0 3px 3px; box-shadow: 3px 4px 14px rgba(0,0,0,.35);
  min-width: 300px; max-width: min(560px, calc(100vw - 40px)); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.win.wide { max-width: min(780px, calc(100vw - 40px)); width: 780px; }
/* Resizable windows: the body fills the window, a grip in the corner. */
.win.resizable { position: relative; max-width: calc(100vw - 8px); max-height: calc(100vh - 8px); min-width: 420px; min-height: 300px; }
.win.resizable > .win-body { flex: 1; }
.win-grip { position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; cursor: nwse-resize; z-index: 2;
  background: radial-gradient(circle at 2px 2px, #fff 1px, transparent 1.2px) 0 0/4px 4px, radial-gradient(circle at 1px 1px, #ABA898 1px, transparent 1.2px) 0 0/4px 4px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.win.resizable .fill { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.win-title { height: 28px; margin: 0 -3px; padding: 0 5px 0 8px; display: flex; align-items: center; gap: 6px; border-radius: 7px 7px 0 0; flex: none;
  background: linear-gradient(180deg, #0997FF 0%, #0053EE 8%, #0050EE 40%, #0066FF 88%, #0066FF 93%, #005BFF 95%, #003DD7 96%, #003DD7 100%);
  color: #fff; font: bold 13px "Trebuchet MS", Tahoma, sans-serif; text-shadow: 1px 1px #0F1089; }
.win-title .t { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.win-close { width: 21px; height: 21px; border: 1px solid #fff; border-radius: 3px; display: grid; place-items: center; padding: 0;
  background: radial-gradient(circle at 90% 90%, #CC4600 0%, #DC6527 55%, #CD7546 70%, #E5A288 100%); box-shadow: inset 0 0 1px rgba(0,0,0,.4); }
.win-close:hover { filter: brightness(1.15); }
.win-close .ico { width: 11px; height: 11px; }
.win-body { background: var(--face); padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.win-buttons { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; flex: none; }
.msg { display: flex; gap: 14px; align-items: flex-start; max-width: 460px; }
.msg .ico.big { width: 32px; height: 32px; }
.msg .text { padding-top: 2px; white-space: pre-wrap; line-height: 1.45; user-select: text; }
.form-grid { display: grid; grid-template-columns: 110px 1fr; gap: 7px 10px; align-items: center; }
.form-grid > label { white-space: nowrap; }
.win textarea { width: 100%; min-height: 150px; resize: vertical; }
.sec-title { color: #0046D5; border-bottom: 1px solid #D0D0BF; padding-bottom: 1px; margin-top: 4px; }
.win .lv { max-height: 220px; }
.recent .lv-row { padding: 3px 4px; }
.recent .rp { font-family: var(--mono); font-size: 10px; }
.drop { border: 2px dashed #9CB2D8; padding: 12px; text-align: center; color: var(--muted); background: #fff; }
.drop.over { border-color: var(--select); color: var(--select); background: #EEF3FC; }
.cmd-box pre { margin: 0; padding: 6px 8px; background: #fff; border: 1px solid var(--input-border); font: 11px/1.45 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; user-select: text; }
.exports { display: flex; flex-direction: column; border: 1px solid var(--input-border); background: #fff; }
.export-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-top: 1px solid #F0EFE8; }
.export-row:first-child { border-top: 0; }
.export-row .en { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.export-row .en span { color: var(--muted); }
.export-row .line { display: flex; gap: 4px; }
.props-desc { background: #fff; border: 1px solid #D0D0BF; padding: 6px 8px; line-height: 1.5; white-space: pre-line; max-height: 240px; overflow: auto; user-select: text; }
.note { color: #5E5A3F; background: #FFFFE1; border: 1px solid #C9C59A; padding: 4px 6px; display: flex; gap: 6px; align-items: center; }
.kbd-table td { padding: 2px 12px 2px 0; vertical-align: top; }
.kbd-table td:first-child { color: #0046D5; white-space: nowrap; }
.quick ol { margin: 0; padding-left: 18px; line-height: 1.6; }

/* Open World table */
.wt { height: 240px; }
.win.resizable .wt { height: auto; flex: 1; min-height: 120px; max-height: none; }
.wt-head > span.sortable:hover { background: #FAF9F5; box-shadow: inset 0 -3px #F9B119; }
.wt-head > span.sorted { background: #F2F1EA; }
.wt-head .arrow { color: #6D6B60; margin-left: 5px; font-size: 8px; }
.wt-row { display: grid; grid-template-columns: 130px 190px 105px 115px minmax(0, 1fr); align-items: center; min-height: 20px; }
.wt-row > span { padding: 1px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid #F0EFE8; }
.wt-row > span:last-child { border-right: 0; }
.wt-head { background: linear-gradient(#fff, #F7F6F0 60%, #EBEADB); border-bottom: 1px solid #D6D2C2; flex: none; }
.wt-head > span { padding: 3px 6px 4px; border-right: 1px solid #E2DFD0; box-shadow: 1px 0 #fff; }
.lv-body .wt-row:nth-child(even) { background: #F7F7F2; }
.lv-body .wt-row:hover { background: #F1F5FD; }
.lv-body .wt-row.sel, .lv-body .wt-row.sel:hover { background: var(--select); color: #fff; }
.lv-body .wt-row.sel .wt-path { color: #DDE6F7; }
.wt-row.missing { color: #A3A193; }
.wt-row.missing .ico { opacity: .7; }
.wt-row > span.wt-status { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; white-space: normal; }
.badge.ingame { border-color: #B88A55; background: #F6ECDD; color: #5E3F1B; margin-left: 2px; }
.lv-body .wt-row.sel .badge.ingame { color: #5E3F1B; }
.wt-status .badge.wt-q { margin-left: 2px; }
.lv-body .wt-row.sel .badge.run { color: #1E4C9A; }
.lv-body .wt-row.sel .badge.chg { color: #8A4A00; }
.wt-path { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* -- balloon notices + tooltips ------------------------------------------------- */
#toasts { position: fixed; right: 18px; bottom: 30px; z-index: 1500; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.balloon { background: #FFFFE1; border: 1px solid #000; border-radius: 6px; padding: 6px 8px 8px; max-width: 380px; min-width: 220px; box-shadow: 2px 2px 4px rgba(0,0,0,.3); transition: opacity .3s; position: relative; }
.balloon::after { content: ""; position: absolute; right: 26px; bottom: -9px; width: 14px; height: 9px; background: #FFFFE1; clip-path: polygon(0 0, 100% 0, 100% 100%); border-right: 1px solid #000; }
.balloon .b-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.balloon .b-head b { flex: 1; }
.balloon .b-close { border: 1px solid transparent; background: none; padding: 0 4px; line-height: 1; font-size: 12px; }
.balloon .b-close:hover { border-color: #999; background: #fff; }
.balloon .b-text { white-space: pre-wrap; line-height: 1.4; user-select: text; }
.balloon.out { opacity: 0; }
#tip { position: fixed; z-index: 2000; background: #FFFFE1; border: 1px solid #000; padding: 2px 5px; pointer-events: none; display: none; max-width: 340px; white-space: pre-wrap; line-height: 1.35; box-shadow: 1px 1px 2px rgba(0,0,0,.2); }

/* 3D view's own bars (built by view3d.js) */
.v3d-bar { background: #FFFFE1; border: 1px solid #000; padding: 2px 6px; }
.v3d-settings { position: absolute; left: 8px; top: 8px; z-index: 2; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 16px); }
.v3d-settings .v3d-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.v3d-settings.folded .v3d-body { display: none; }
.v3d-fold { border: 1px solid transparent; border-radius: 3px; background: none; padding: 1px 4px; font: inherit; color: var(--link); cursor: pointer; flex: none; }
.v3d-fold:hover { border-color: #CECEC3; background: linear-gradient(#FEFEFE, #EBEAE5); }
.v3d-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; padding: 5px 10px; pointer-events: none; transition: opacity .8s; text-align: center; }
.v3d-hint.gone { opacity: 0; }
.wind-bar { background: #FFFFE1 !important; border: 1px solid #000 !important; border-radius: 0 !important; color: #000 !important; font-size: 11px !important; }

/* Queue window */
.tbtn span { white-space: nowrap; }
.qd { display: flex; min-width: 0; flex-direction: column; gap: 4px; max-height: 70vh; overflow: auto; }
.qd-head { display: flex; align-items: center; gap: 6px; font-weight: bold; color: #1E4C9A; border-bottom: 1px solid #C9D3E6; padding: 6px 0 2px; }
.qd-head:first-child { padding-top: 0; }
.qd .spacer { flex: 1; }
.qd-now { display: flex; flex-direction: column; gap: 4px; padding: 2px 0 4px; }
.qd-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qd-title b { font-size: 12px; }
.qd-prog .progress { width: 100%; }
.qd-line { line-height: 1.4; }
.qd .dim { color: #555F73; }
.qd-sub { font-size: 11px; min-height: 13px; }
.qd-list { display: flex; flex-direction: column; border: 1px solid #C9D3E6; background: #fff; }
.qd-row { display: grid; grid-template-columns: 18px minmax(0, 1.2fr) minmax(0, 1fr) 120px 60px; align-items: center; gap: 6px; padding: 2px 6px; min-height: 22px; }
.qd-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-row + .qd-row { border-top: 1px solid #F0EFE8; }
.qd-row.done .link-btn { justify-self: end; }
.qd-name { font-weight: bold; }
.qd-row.done .qd-name { font-weight: normal; }
.qd-empty { padding: 8px; }

/* New World: heightmap preview beside the form */
.nw-row { display: flex; gap: 12px; align-items: flex-start; }
.nw-row > .form-grid { flex: 1; min-width: 0; }
.nw-preview { flex: none; width: 200px; display: flex; flex-direction: column; gap: 4px; }
.nw-frame { width: 200px; height: 200px; background: #20242C; border: 1px solid #7F9DB9; display: grid; place-items: center; }
.nw-img { max-width: 100%; max-height: 100%; }
.nw-preview .nw-text { font-size: 11px; line-height: 1.35; word-break: break-word; }
@media (max-width: 640px) { .nw-row { flex-direction: column; } }
.v3d-slicebox { position: absolute; right: 8px; top: 8px; z-index: 2; display: flex; flex-direction: column; gap: 2px; font-size: 12px; max-height: calc(100% - 80px); overflow: auto; }
