/* Menu preview: a DOM copy of the ImGui menu (src/ui/menu*.cpp, widgets.cpp, theme.h); sizes are in em of the menu font, as Em() is in game. */

.mk-wrap {
  --mk-px: 16px;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.9em;
  font-size: var(--mk-px);
}
.mk-wrap, .mk-layer {
  --mk-accent: #f2aa3b;
  --mk-accent-dark: #c27420;
  --mk-text: #ecf1f7;
  --mk-muted: #8fa0b5;
  --mk-dim: #5c6d83;
  --mk-on-accent: #1a1106;
  --mk-info: #42bcf7;
  --mk-danger: #ee5e5a;
  --mk-wip: #ff69c8;
  --mk-line: rgba(125, 170, 220, 0.15);
  --mk-line-strong: rgba(140, 185, 230, 0.35);
  --mk-control: rgba(255, 255, 255, 0.047);
  --mk-control-hover: rgba(255, 255, 255, 0.094);
  --mk-control-border: rgba(150, 175, 202, 0.28);
  --mk-control-border-hover: rgba(175, 200, 226, 0.55);
  --mk-track: rgba(255, 255, 255, 0.086);
  --mk-inset: rgba(4, 10, 20, 0.59);
}
.mk {
  position: relative;
  flex: none;
  width: 50em;
  height: 37.5em;
  color: var(--mk-text);
  font: 400 1em/1.2 "Sansation", "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.18s, transform 0.18s;
}
:where(.mk, .mk-layer, .mk-wrap) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: left; }
.mk [hidden], .mk-layer [hidden], .mk-wrap [hidden] { display: none !important; }
.mk :focus-visible { outline: 1px solid var(--mk-info); outline-offset: 1px; }
:where(.mk, .mk-layer) input { font: inherit; color: inherit; }

/* Chamfer: corners cut top-left and bottom-right, outline and diagonals drawn as background layers (ChamferPoints). */
.mk-ch {
  --cut: 0.5em;
  --ln: var(--mk-line);
  --fill: transparent;
  --d1: var(--ln);
  --d2: var(--ln);
  --w1: 1px;
  --w2: 1px;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  background:
    linear-gradient(to bottom right, transparent 50%, var(--d1) 50%, var(--d1) calc(50% + var(--w1)), transparent calc(50% + var(--w1))) top left / var(--cut) var(--cut) no-repeat,
    linear-gradient(to bottom right, transparent calc(50% - var(--w2)), var(--d2) calc(50% - var(--w2)), var(--d2) 50%, transparent 50%) bottom right / var(--cut) var(--cut) no-repeat,
    linear-gradient(var(--ln), var(--ln)) top right / calc(100% - var(--cut)) 1px no-repeat,
    linear-gradient(var(--ln), var(--ln)) top right / 1px calc(100% - var(--cut)) no-repeat,
    linear-gradient(var(--ln), var(--ln)) bottom left / calc(100% - var(--cut)) 1px no-repeat,
    linear-gradient(var(--ln), var(--ln)) bottom left / 1px calc(100% - var(--cut)) no-repeat,
    var(--fill);
}

/* ---------- Frame (DrawFrame) ---------- */

.mk-panel {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 0.9em 1.6em rgba(0, 0, 0, 0.6));
}
.mk-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(1.1em 0, 100% 0, 100% calc(100% - 1.1em), calc(100% - 1.1em) 100%, 0 100%, 0 1.1em);
  background: linear-gradient(180deg, rgba(17, 30, 48, 0.93), rgba(8, 14, 25, 0.965));
}
.mk-sidefill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14em;
  background: rgba(3, 8, 16, 0.47);
  clip-path: polygon(1.1em 0, 100% 0, 100% 100%, 0 100%, 0 1.1em);
}
.mk-divider {
  position: absolute;
  left: calc(14em - 1px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--mk-line-strong) 50%, transparent);
}
.mk-outline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --cut: 1.1em;
  --d1: color-mix(in srgb, var(--mk-accent) 80%, transparent);
  --d2: var(--d1);
  --w1: 0.13em;
  --w2: 0.13em;
}
.mk-topline {
  position: absolute;
  top: 0;
  left: 1.1em;
  right: 6em;
  height: 1px;
  background: linear-gradient(90deg, var(--mk-line-strong), transparent);
  pointer-events: none;
}
.mk-bracket {
  position: absolute;
  width: 1.3em;
  height: 1.3em;
  pointer-events: none;
  border: 0 solid var(--mk-accent);
}
.mk-bracket.tr { top: 1px; right: 1px; border-top-width: 0.13em; border-right-width: 0.13em; }
.mk-bracket.bl { bottom: 1px; left: 1px; border-bottom-width: 0.13em; border-left-width: 0.13em; }

/* ---------- Sidebar ---------- */

.mk-side {
  position: absolute;
  left: 1.2em;
  top: 1.5em;
  bottom: 1.2em;
  width: 11.6em;
  display: flex;
  flex-direction: column;
}
.mk-brand {
  position: relative;
  height: 2.6em;
  flex: none;
  margin-bottom: 1.25em;
}
.mk-brand b {
  position: absolute;
  left: 0.35em;
  top: 0.4em;
  font-size: 1.3em;
  font-weight: 700;
  line-height: 1;
}
.mk-brand i {
  position: absolute;
  left: 0.35em;
  top: 1.85em;
  width: 2.2em;
  height: 0.14em;
  background: var(--mk-accent);
}
.mk-tabs { display: flex; flex-direction: column; gap: 0.45em; }
.mk-tab {
  position: relative;
  display: flex;
  align-items: center;
  height: 2.55em;
  width: 100%;
  color: var(--mk-muted);
  font-weight: 700;
  transition: color 0.12s;
}
.mk-tab-shape {
  --sl: 1.07em;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--sl)) 100%, 0 100%);
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1px), var(--mk-line) calc(50% - 1px), var(--mk-line) 50%, transparent 50%) top right / var(--sl) 100% no-repeat,
    linear-gradient(var(--mk-line), var(--mk-line)) top left / 100% 1px no-repeat,
    linear-gradient(var(--mk-line), var(--mk-line)) bottom left / calc(100% - var(--sl)) 1px no-repeat,
    linear-gradient(var(--mk-line), var(--mk-line)) top left / 1px 100% no-repeat,
    var(--mk-control);
  transition: left 0.15s, right 0.15s, background-color 0.15s;
}
.mk-tab-text {
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 0.95em;
  transition: transform 0.15s;
}
.mk-tab-ico { font: 1em/1 "Mek Icons"; width: 1.75em; }
.mk-tab:hover:not(.is-on) { color: var(--mk-text); }
.mk-tab:hover:not(.is-on) .mk-tab-shape { left: 0.3em; right: -0.3em; background-color: var(--mk-control-hover); }
.mk-tab:hover:not(.is-on) .mk-tab-text { transform: translateX(0.3em); }
.mk-tab.is-on { color: var(--mk-on-accent); filter: drop-shadow(0 0 0.32em color-mix(in srgb, var(--mk-accent) 38%, transparent)); }
.mk-tab.is-on .mk-tab-shape { left: -0.55em; background: linear-gradient(90deg, var(--mk-accent), var(--mk-accent-dark)); }
.mk-tab.is-on .mk-tab-text { transform: translateX(-0.55em); }

.mk-status {
  --cut: 0.55em;
  --fill: rgba(255, 255, 255, 0.035);
  margin-top: auto;
  height: 2.6em;
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding-left: 0.85em;
}
.mk-status span { font-size: 0.82em; color: var(--mk-muted); }

/* ---------- Keycap (KeyCap) ---------- */

.mk-kc {
  position: relative;
  flex: none;
  display: inline-block;
  font-size: 0.74em;
  font-weight: 700;
  line-height: 1;
  padding: 0.27em 0.68em 0.45em;
  border-radius: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--mk-text);
  border: 1px solid rgba(175, 200, 226, 0.27);
  background: linear-gradient(rgba(255, 255, 255, 0.063) calc(100% - 0.18em), transparent 0), rgba(0, 0, 0, 0.43);
  transition: color 0.12s, border-color 0.12s;
}
button.mk-kc { cursor: pointer; }
button.mk-kc:hover, .mk-row-key:hover .mk-kc, .mk-kc.is-cap {
  color: var(--mk-accent);
  border-color: color-mix(in srgb, var(--mk-accent) 90%, transparent);
  background: linear-gradient(rgba(255, 255, 255, 0.1) calc(100% - 0.18em), transparent 0), rgba(0, 0, 0, 0.43);
}
.mk-kc.is-cap::after {
  content: "";
  position: absolute;
  inset: calc(-0.27em - 1px);
  border: 0.135em solid var(--mk-accent);
  border-radius: 0.4em;
  animation: mk-pulse 1.05s ease-in-out infinite;
  pointer-events: none;
}
@keyframes mk-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.6; } }

/* ---------- Page ---------- */

.mk-main {
  position: absolute;
  left: 15.9em;
  top: 1.5em;
  right: 1.3em;
  bottom: 1.3em;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mk-head {
  height: 2.2em;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
}
.mk-title { font-size: 1.5em; font-weight: 700; white-space: nowrap; }
.mk-search {
  --cut: 0.4em;
  --ln: var(--mk-control-border);
  --fill: var(--mk-control);
  position: relative;
  width: 11em;
  height: 1.95em;
  flex: none;
  transition: background-color 0.12s;
}
.mk-search:hover { --ln: var(--mk-control-border-hover); --fill: var(--mk-control-hover); }
.mk-search.is-active { --ln: var(--mk-accent); }
.mk-search input {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0 1.8em 0 1.9em;
  outline: none;
  color: var(--mk-text);
  user-select: text;
  -webkit-user-select: text;
}
.mk-search input::placeholder { color: var(--mk-dim); }
.mk-lens {
  position: absolute;
  left: 0.65em;
  top: 50%;
  width: 0.6em;
  height: 0.6em;
  margin-top: -0.38em;
  border: 0.1em solid var(--mk-muted);
  border-radius: 50%;
  pointer-events: none;
}
.mk-lens::after {
  content: "";
  position: absolute;
  left: 0.42em;
  top: 0.48em;
  width: 0.3em;
  height: 0.11em;
  background: var(--mk-muted);
  transform: rotate(45deg);
  transform-origin: 0 50%;
}
.mk-search:hover .mk-lens { border-color: var(--mk-text); }
.mk-search:hover .mk-lens::after { background: var(--mk-text); }
.mk-search.is-active .mk-lens { border-color: var(--mk-accent); }
.mk-search.is-active .mk-lens::after { background: var(--mk-accent); }
.mk-clear {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1.8em;
  color: var(--mk-muted);
}
.mk-clear:hover { color: var(--mk-text); }
.mk-clear::before, .mk-clear::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.6em;
  height: 0.1em;
  margin: -0.05em 0 0 -0.4em;
  background: currentColor;
  transform: rotate(45deg);
}
.mk-clear::after { transform: rotate(-45deg); }

.mk-nav { flex: none; margin-top: 0.3em; }
.mk-rule { position: relative; height: 0.14em; }
.mk-rule::before { content: ""; position: absolute; left: 0; top: 0; width: 2.2em; height: 0.14em; background: var(--mk-accent); }
.mk-rule::after { content: ""; position: absolute; left: 2.55em; right: 0; top: 0.035em; height: 0.07em; background: linear-gradient(90deg, var(--mk-line-strong), transparent); }

/* Tab strip (TabStrip): a track with a gliding accent pill. */
.mk-strip { position: relative; padding-bottom: calc(0.35em + 0.07em); }
.mk-strip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0.07em; background: linear-gradient(90deg, var(--mk-line-strong), transparent); }
.mk-track {
  --pad: 1em;
  position: relative;
  display: inline-flex;
  max-width: 100%;
  height: 1.9em;
  padding: 0.2em;
  border-radius: 0.4em;
  background: var(--mk-control);
  box-shadow: inset 0 0 0 1px var(--mk-line);
}
.mk-pill {
  position: absolute;
  top: 0.2em;
  bottom: 0.2em;
  left: 0;
  width: 0;
  border-radius: 0.3em;
  background: var(--mk-accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mk-accent-dark) 90%, transparent);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.mk-st {
  position: relative;
  padding: 0 var(--pad);
  border-radius: 0.3em;
  white-space: nowrap;
  color: var(--mk-muted);
  transition: color 0.15s, background-color 0.12s;
}
.mk-st span { font-size: 0.86em; font-weight: 700; }
.mk-st:hover { color: var(--mk-text); background: var(--mk-control-hover); }
.mk-st.is-on, .mk-st.is-on:hover { color: var(--mk-on-accent); background: transparent; }
.mk-seg { margin-bottom: 0.675em; }

.mk-body {
  flex: 1;
  min-height: 0;
  margin-top: 0.725em;
  padding-right: calc(1.1em - 6px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
@supports not selector(::-webkit-scrollbar) {
  .mk-body { scrollbar-width: thin; scrollbar-color: rgba(236, 241, 247, 0.1) transparent; }
}
.mk-body::-webkit-scrollbar { width: 6px; }
.mk-body::-webkit-scrollbar-thumb { background: rgba(236, 241, 247, 0.1); border-radius: 3px; }
.mk-body::-webkit-scrollbar-thumb:hover { background: rgba(236, 241, 247, 0.18); }
.mk-content.is-entering { animation: mk-enter 0.18s ease-out; }
@keyframes mk-enter { from { opacity: 0; transform: translateY(0.6em); } to { opacity: 1; transform: none; } }

.mk-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 0.9em; align-items: start; }
.mk-col { min-width: 0; }

/* ---------- Card (BeginCard / EndCard) ---------- */

.mk-card {
  --cut: 0.5em;
  --fill: linear-gradient(180deg, rgba(255, 255, 255, 0.047), rgba(255, 255, 255, 0.02));
  --d1: color-mix(in srgb, var(--mk-accent) 75%, transparent);
  --w1: 0.08em;
  padding: 0.6em 0.85em 0.5em;
  margin: 0 0 0.6em;
}
.mk-card.has-cap { padding-top: 0; }
.mk-cap {
  display: flex;
  align-items: center;
  height: 2em;
  padding-top: 0.08em;
  margin-bottom: 0.15em;
}
.mk-cap::before { content: ""; width: 0.24em; height: 0.24em; margin: 0 0.36em 0 0.05em; background: var(--mk-accent); transform: rotate(45deg); flex: none; }
.mk-cap::after { content: ""; flex: 1; height: 1px; margin-left: 0.5em; background: linear-gradient(90deg, var(--mk-line), transparent); }
.mk-cap span {
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--mk-muted);
  white-space: nowrap;
}
button.mk-cap { width: 100%; }
button.mk-cap span { color: var(--mk-dim); transition: color 0.12s; }
button.mk-cap span:last-of-type { color: var(--mk-muted); }
button.mk-cap:hover span { color: var(--mk-text); }
.mk-cap i { width: 0.17em; height: 0.42em; margin: 0 0.45em 0 0.3em; flex: none; position: relative; }
.mk-cap i::before {
  content: "";
  position: absolute;
  inset: 0.03em 0.02em;
  border-top: 0.08em solid var(--mk-dim);
  border-right: 0.08em solid var(--mk-dim);
  transform: scaleX(0.55) rotate(45deg);
}

.mk-items { display: flex; flex-direction: column; gap: 0.375em; }
.mk-items.list { gap: 0.375em; }
.mk-items + .mk-items, .mk-gap { margin-top: 0.15em; }
.is-off { opacity: 0.6; pointer-events: none; }
.is-off .is-off { opacity: 1; }

/* ---------- Rows ---------- */

.mk-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5em;
  height: 1.95em;
  min-width: 0;
}
.mk-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--mk-muted);
  transition: color 0.15s;
}
.mk-row:hover .mk-label.hov { color: var(--mk-text); }
.mk-label.text { color: var(--mk-text); }

/* Checkbox (CheckboxRow) */
.mk-check {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0.7em;
  padding-left: 0.1em;
}
.mk-box {
  position: relative;
  flex: none;
  width: 1.05em;
  height: 1.05em;
  border-radius: 0.16em;
  background: var(--mk-control);
  box-shadow: inset 0 0 0 0.09em var(--mk-control-border);
  transition: background-color 0.12s, box-shadow 0.12s;
}
.mk-check:hover .mk-box { background: var(--mk-control-hover); box-shadow: inset 0 0 0 0.09em var(--mk-control-border-hover); }
.mk-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.16em;
  background: var(--mk-info);
  transform: scale(0);
  transition: transform 0.12s ease-out;
}
.mk-box::after {
  content: "";
  position: absolute;
  inset: -0.19em;
  border: 0.1em solid rgba(66, 188, 247, 0.22);
  border-radius: 0.3em;
  opacity: 0;
  transition: opacity 0.12s;
}
.mk-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mk-box path {
  fill: none;
  stroke: #061624;
  stroke-width: 12.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 86;
  stroke-dashoffset: 86;
  transition: stroke-dashoffset 0.14s ease-in;
}
.is-checked .mk-box { box-shadow: inset 0 0 0 0.09em var(--mk-info); }
.is-checked .mk-box::before { transform: scale(1); }
.is-checked .mk-box::after { opacity: 1; }
.is-checked .mk-box path { stroke-dashoffset: 0; transition-delay: 0.05s; }
.mk-check .mk-label { color: var(--mk-muted); }
.mk-check:hover .mk-label { color: color-mix(in srgb, var(--mk-text) 70%, var(--mk-muted)); }
.is-checked .mk-check .mk-label, .is-checked .mk-check:hover .mk-label { color: var(--mk-text); }
.tint-danger .mk-check .mk-label { color: color-mix(in srgb, var(--mk-danger) 66%, transparent); }
.tint-danger.is-checked .mk-check .mk-label, .tint-danger .mk-check:hover .mk-label { color: var(--mk-danger); }
.tint-wip .mk-check .mk-label { color: color-mix(in srgb, var(--mk-wip) 66%, transparent); }
.tint-wip.is-checked .mk-check .mk-label, .tint-wip .mk-check:hover .mk-label { color: var(--mk-wip); }

/* Swatch (DrawSwatch) */
.mk-sw {
  position: relative;
  flex: none;
  width: 2.2em;
  height: 1.1em;
  border-radius: 0.2em;
  background: #121821;
  box-shadow: inset 0 0 0 1px var(--mk-control-border);
  overflow: hidden;
  transition: box-shadow 0.12s;
}
.mk-sw::before { content: ""; position: absolute; inset: 0; background: var(--c, #fff); }
.mk-sw::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--mk-control-border); transition: box-shadow 0.12s; }
.mk-sw:hover::after { box-shadow: inset 0 0 0 1px var(--mk-control-border-hover); }
.mk-sw.is-faded::before { opacity: 0.4; }
.mk-sw.big { width: 2.6em; height: 1.2em; }
.mk-hex { font-size: 0.82em; color: var(--mk-dim); flex: none; margin-left: auto; }

/* Chevron (FeatureRow's open button) */
.mk-chev {
  position: relative;
  flex: none;
  width: 1.5em;
  height: 1.5em;
  border-radius: 0.25em;
  background: var(--mk-control);
  box-shadow: inset 0 0 0 1px var(--mk-control-border);
  color: var(--mk-muted);
  transition: background-color 0.12s, box-shadow 0.15s, color 0.12s;
}
.mk-chev:hover { background: var(--mk-control-hover); color: var(--mk-text); }
.mk-chev svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform 0.15s ease-out; }
.mk-chev polyline { fill: none; stroke: currentColor; stroke-width: 7.3; stroke-linecap: round; stroke-linejoin: round; }
.is-open > .mk-row .mk-chev { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mk-accent) 80%, var(--mk-control-border)); color: var(--mk-text); }
.is-open > .mk-row .mk-chev svg { transform: rotate(90deg); }

/* Details panel (BeginDetails / EndDetails) */
.mk-det {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0.25;
  transition: grid-template-rows 0.2s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.2s;
}
.is-open > .mk-det { grid-template-rows: 1fr; opacity: 1; }
.mk-det > div { overflow: hidden; min-height: 0; }
.mk-det-panel {
  position: relative;
  margin: 0.375em 0 0.25em 0.8em;
  padding: 0.55em 0.75em 0.55em 0.77em;
  border-radius: 0.35em;
  background: var(--mk-inset);
  box-shadow: inset 0 0 0 1px var(--mk-control-border);
}
.mk-det-panel::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 0.35em;
  bottom: 0.35em;
  width: 0.15em;
  background: color-mix(in srgb, var(--mk-accent) 85%, transparent);
}
.mk-det-panel > .mk-items { gap: 0.375em; }
.mk-exp { display: flex; flex-direction: column; }

/* Slider (Slider<T>) */
.mk-slider {
  position: relative;
  height: 2.8em;
  cursor: pointer;
  touch-action: pan-y;
}
.mk-slider .mk-sl-top { display: flex; justify-content: space-between; gap: 0.5em; line-height: 1; }
.mk-slider .mk-label { color: var(--mk-muted); }
.mk-slider:hover .mk-label, .mk-slider.is-held .mk-label { color: var(--mk-text); }
.mk-val { font-weight: 700; color: var(--mk-info); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.mk-tr {
  position: absolute;
  left: 0.4em;
  right: 0.4em;
  top: calc(1.95em - 0.12em);
  height: 0.24em;
  border-radius: 0.12em;
  background: var(--mk-track);
}
.mk-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 0.12em;
  background: linear-gradient(90deg, var(--mk-accent-dark), var(--mk-accent));
}
.mk-knob {
  position: absolute;
  top: 50%;
  width: 0.566em;
  height: 0.566em;
  margin: -0.283em 0 0 -0.283em;
  background: var(--mk-text);
  box-shadow: inset 0 0 0 0.12em var(--mk-accent);
  transform: rotate(45deg);
  transition: transform 0.12s;
}
.mk-knob::before {
  content: "";
  position: absolute;
  inset: -0.33em;
  background: color-mix(in srgb, var(--mk-accent) 16%, transparent);
  opacity: 0;
  transition: opacity 0.12s;
  z-index: -1;
}
.mk-slider:hover .mk-knob, .mk-slider.is-held .mk-knob { transform: rotate(45deg) scale(1.15); }
.mk-slider:hover .mk-knob::before, .mk-slider.is-held .mk-knob::before { opacity: 1; }

/* Combo */
.mk-row-combo .mk-label { flex: 1; color: var(--mk-text); padding-left: 0.1em; }
.mk-combo {
  position: relative;
  flex: none;
  width: min(10.5em, 60%);
  height: 1.55em;
  margin-left: auto;
  border-radius: 0.25em;
  background: var(--mk-control);
  box-shadow: inset 0 0 0 1px var(--mk-control-border);
  padding: 0 1.4em 0 0.6em;
  display: flex;
  align-items: center;
  transition: background-color 0.12s, box-shadow 0.12s;
}
.mk-combo.full { width: 100%; }
.mk-combo:hover { background: var(--mk-control-hover); box-shadow: inset 0 0 0 1px var(--mk-control-border-hover); }
.mk-combo span { font-size: 0.88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-combo span.empty { color: var(--mk-muted); }
.mk-combo::after {
  content: "";
  position: absolute;
  right: 0.54em;
  top: 50%;
  margin-top: -0.13em;
  border-left: 0.26em solid transparent;
  border-right: 0.26em solid transparent;
  border-top: 0.31em solid var(--mk-muted);
}
.mk-combo:hover::after { border-top-color: var(--mk-text); }
.mk-row-combo.full { height: 1.95em; }

/* Buttons (Button / WideButton) */
.mk-btn {
  --tone: var(--mk-accent);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.1em;
  padding: 0 1em;
  border-radius: 0.3em;
  background: color-mix(in srgb, var(--tone) 7%, var(--mk-control));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 50%, transparent);
  color: var(--tone);
  transition: background-color 0.12s, box-shadow 0.12s, color 0.12s;
  text-align: center;
}
.mk-btn span { font-size: 0.95em; font-weight: 700; white-space: nowrap; }
.mk-btn:hover { background: color-mix(in srgb, var(--tone) 19%, var(--mk-control)); box-shadow: inset 0 0 0 1px var(--tone); color: color-mix(in srgb, var(--tone) 65%, var(--mk-text)); }
.mk-btn:active { background: color-mix(in srgb, var(--tone) 33%, var(--mk-control)); }
.mk-btn.danger { --tone: var(--mk-danger); }
.mk-btn.wide { width: 100%; }
.mk-btn[disabled] { opacity: 0.6; pointer-events: none; }
.mk-btns { display: flex; gap: 0.5em; }
.mk-btns .mk-btn { flex: 1; padding: 0; }
.mk-btns.auto .mk-btn { flex: none; padding: 0 1em; }

/* Text input (TextInput / IntInput) */
.mk-row-text .mk-label { flex: 0 1 auto; color: var(--mk-text); padding-left: 0.1em; }
.mk-row-text .mk-input { flex: 0 1 10.5em; min-width: 4em; max-width: 60%; }
.mk-input {
  flex: none;
  width: min(10.5em, 60%);
  height: 1.625em;
  margin-left: auto;
  padding: 0 0.5em;
  border: 0;
  border-radius: 0.25em;
  background: var(--mk-control);
  box-shadow: inset 0 0 0 1px var(--mk-control-border);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  transition: background-color 0.12s;
}
.mk-input:hover { background: var(--mk-control-hover); }
.mk-input:focus { background: var(--mk-control-hover); box-shadow: inset 0 0 0 1px var(--mk-control-border-hover); }
.mk-input::placeholder { color: var(--mk-muted); }
.mk-input.full { width: 100%; }

.mk-hint { color: var(--mk-muted); line-height: 1.25; }
.mk-hint.danger { color: var(--mk-danger); }
.mk-plain { line-height: 1.25; }

/* List box (craft groups) */
.mk-list {
  max-height: 9em;
  overflow-y: auto;
  padding: 0.31em 0.5em;
  border-radius: 0.19em;
  background: rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}
.mk-opt {
  display: block;
  width: 100%;
  padding: 0.09em 0.25em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mk-opt:hover { background: color-mix(in srgb, var(--mk-accent) 26%, transparent); }
.mk-opt.is-on { background: color-mix(in srgb, var(--mk-accent) 18%, transparent); }
.mk-opt.is-on:hover { background: color-mix(in srgb, var(--mk-accent) 26%, transparent); }
.mk-queue .mk-opt { padding-block: 0.19em; }

/* ---------- Popups, tooltip, picker ---------- */

.mk-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
.mk-pop {
  position: fixed;
  pointer-events: auto;
  min-width: 6em;
  padding: 0.5em;
  border-radius: 0.25em;
  background: rgba(16, 27, 43, 0.98);
  box-shadow: inset 0 0 0 1px var(--mk-line-strong, rgba(140, 185, 230, 0.35)), 0 0.6em 1.6em rgba(0, 0, 0, 0.45);
  color: #ecf1f7;
  font: 400 var(--mk-px, 16px)/1.2 "Sansation", "Segoe UI", system-ui, sans-serif;
  max-height: 18em;
  overflow-y: auto;
  scrollbar-width: thin;
  user-select: none;
}
.mk-pop .mk-opt { padding: 0.19em 0.37em; color: #ecf1f7; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.mk-pop .mk-opt:hover { background: color-mix(in srgb, var(--mk-accent, #f2aa3b) 26%, transparent); }
.mk-pop .mk-opt.is-on { background: color-mix(in srgb, var(--mk-accent, #f2aa3b) 18%, transparent); }
.mk-tip {
  position: fixed;
  max-width: 22em;
  padding: 0.55em 0.65em;
  border-radius: 0.25em;
  background: rgba(16, 27, 43, 0.98);
  box-shadow: inset 0 0 0 1px rgba(140, 185, 230, 0.35), 0 0.5em 1.4em rgba(0, 0, 0, 0.45);
  color: #ecf1f7;
  font: 400 var(--mk-px, 16px)/1.3 "Sansation", "Segoe UI", system-ui, sans-serif;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
}
.mk-tip.is-on { opacity: 1; }

.mk-picker { width: 14.2em; padding: 0.6em; overflow: visible; max-height: none; }
.mk-pk-main { display: flex; gap: 0.4em; height: 11em; }
.mk-sv {
  position: relative;
  flex: 1;
  border-radius: 0.1em;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), var(--hue, red);
  cursor: crosshair;
  touch-action: none;
}
.mk-sv i {
  position: absolute;
  width: 0.7em;
  height: 0.7em;
  margin: -0.35em 0 0 -0.35em;
  border-radius: 50%;
  box-shadow: 0 0 0 0.12em #fff, 0 0 0 0.2em rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.mk-bar {
  position: relative;
  width: 1.2em;
  border-radius: 0.1em;
  cursor: ns-resize;
  touch-action: none;
}
.mk-bar.hue { background: linear-gradient(to bottom, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); }
.mk-bar.alpha { background: linear-gradient(to bottom, var(--solid, #fff), transparent), repeating-conic-gradient(#808080 0 25%, #c0c0c0 0 50%) 0 0 / 0.6em 0.6em; }
.mk-bar i {
  position: absolute;
  left: -0.2em;
  right: -0.2em;
  height: 0.3em;
  margin-top: -0.15em;
  border-radius: 0.1em;
  box-shadow: inset 0 0 0 0.1em #fff, 0 0 0 0.08em rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.mk-pk-hex { margin-top: 0.5em; width: 100%; }

/* ---------- Hidden / unloaded ---------- */

.mk-wrap.is-hidden .mk { opacity: 0; transform: scale(0.985); pointer-events: none; visibility: hidden; transition: opacity 0.18s, transform 0.18s, visibility 0s 0.18s; }
.mk-reopen {
  position: absolute;
  left: 50%;
  top: 14em;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.2em;
  border: 0;
  border-radius: 0.3em;
  background: rgba(8, 14, 25, 0.82);
  box-shadow: inset 0 0 0 1px rgba(140, 185, 230, 0.35);
  color: #ecf1f7;
  font: 700 1em/1 "Sansation", "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.mk-reopen:hover { box-shadow: inset 0 0 0 1px #f2aa3b; }
.mk-wrap.is-hidden .mk-reopen { display: inline-flex; }

/* ---------- Narrow screens: sidebar becomes a tab row, columns stack ---------- */

.mk-wrap.is-compact { --mk-px: 15px; width: 100%; max-width: 36em; }
.is-compact .mk { width: 100%; height: auto; }
.is-compact .mk-sidefill, .is-compact .mk-divider, .is-compact .mk-status, .is-compact .mk-brand { display: none; }
.is-compact .mk-side { position: relative; left: auto; top: auto; bottom: auto; width: auto; padding: 1.2em 1em 0 1.2em; }
.is-compact .mk-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.35em; }
.is-compact .mk-tab { height: 3.3em; }
.is-compact .mk-tab-shape { --sl: 0.5em; }
.is-compact .mk-tab-text { flex-direction: column; align-items: flex-start; gap: 0.3em; padding-left: 0.55em; font-size: 0.76em; }
.is-compact .mk-tab-ico { width: auto; font-size: 1.2em; }
.is-compact .mk-tab.is-on .mk-tab-shape { left: 0; }
.is-compact .mk-tab.is-on .mk-tab-text, .is-compact .mk-tab:hover .mk-tab-text { transform: none; }
.is-compact .mk-tab:hover:not(.is-on) .mk-tab-shape { left: 0; right: 0; }
.is-compact .mk-main { position: relative; left: auto; top: auto; right: auto; bottom: auto; padding: 1.1em 1.1em 1.3em 1.2em; }
.is-compact .mk-search { width: 8.5em; }
.is-compact .mk-body { overflow: visible; padding-right: 0; }
.is-compact .mk-cols { grid-template-columns: minmax(0, 1fr); }
.is-compact .mk-track { overflow-x: auto; scrollbar-width: none; }
.is-compact .mk-reopen { top: 6em; }
