/* ==========================================================================
   PixelForge (MotionLabs) — visual system (v2: dense icon grid)
   Dark by brand choice (doesn't follow the AE theme).
   Target: CEP 11+ Chromium — no :has(), no color-mix(), no accent-color.
   ========================================================================== */

:root {
  --bg:            #0e0f10;
  --bg-2:          #121314;
  --surface:       #17181a;
  --surface-hi:    #202122;
  --surface-input: #0a0b0c;

  --line:          #26272b;
  --line-soft:     #1b1c1e;
  --hl:            rgba(255, 255, 255, 0.045);   /* top inner highlight */

  --text:          #e7e9ee;
  --text-mid:      #999ea8;
  --text-dim:      #62666e;

  --accent:         #31a8ff;
  --accent-hi:      #6cc4ff;
  --accent-text:    #a6dcff;
  --accent-deep:    #0a6fd0;
  --on-accent:      #03182b;
  --accent-a10:     rgba(49, 168, 255, 0.10);
  --accent-a25:     rgba(49, 168, 255, 0.25);
  --accent-a45:     rgba(49, 168, 255, 0.45);

  --ok:            #6fc48a;
  --warn:          #e8b04a;
  --err:           #e5786c;

  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 10px;

  --ease:   cubic-bezier(0.22, 0.8, 0.28, 1);
  --expo:   cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Adobe Clean", "Inter", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, sans-serif;
  font-size: 11.5px;
  line-height: 1.45;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; }
svg { display: block; }

/* Shared stroke-icon style */
.mk-tab svg, .mk-ic svg, .mk-btn svg, .mk-info svg, .mk-chev, .mk-link svg,
.mk-status-icon svg, .mk-seg svg, .mk-anchor-mark svg, .mk-mine-add svg,
.mk-mine-ok svg, .mk-mine-cancel svg, .mk-chip-x svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   Header
   ========================================================================== */

.mk-header {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px 9px;
  overflow: hidden;
}

/* a soft violet aurora behind the mark */
.mk-header::before {
  content: "";
  position: absolute;
  top: -70px;
  left: -40px;
  width: 230px;
  height: 150px;
  background: radial-gradient(closest-side, rgba(49, 168, 255, 0.2), transparent);
  pointer-events: none;
}

.mk-mark {
  position: relative;
  flex: 0 0 auto;
  color: var(--accent);
  filter: drop-shadow(0 1px 6px rgba(49, 168, 255, 0.45));
}
.mk-mark svg { width: 40px; height: 20px; }
.mk-mark path, .mk-mark ellipse {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: mk-blade 0.7s var(--spring) both;
}
.mk-mark path:nth-child(4) { animation-delay: 0.02s; }
.mk-mark ellipse:nth-of-type(1) { animation-delay: 0.06s; }
.mk-mark path:nth-child(3) { animation-delay: 0.1s; }
.mk-mark path:nth-child(2) { animation-delay: 0.16s; }
.mk-mark path:nth-child(1) { animation-delay: 0.22s; }
.mk-mark ellipse:nth-of-type(2) { animation-delay: 0.3s; }
@keyframes mk-blade { from { transform: translateY(40%) scale(0.2); opacity: 0; } }

.mk-wordmark {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mk-wordmark em { font-style: normal; font-weight: 300; color: var(--text-mid); }

.mk-version {
  position: relative;
  flex: 0 0 auto;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ==========================================================================
   Tabs — icon + label, with a sliding violet underline
   ========================================================================== */

.mk-tabs {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  margin: 0 12px;
  border-bottom: 1px solid var(--line-soft);
}

.mk-tabs-indicator {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 25%;
  height: 2px;
  pointer-events: none;
  transition: transform 0.45s var(--expo);
}
.mk-tabs-indicator::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-hi));
  box-shadow: 0 0 10px rgba(49, 168, 255, 0.8);
}
/* glow puddle above the underline */
.mk-tabs-indicator::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 26px;
  background: radial-gradient(50% 100% at 50% 100%, rgba(49, 168, 255, 0.16), transparent);
}

.mk-tab {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 2px 8px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 9.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.mk-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mk-tab svg { width: 16px; height: 16px; transition: transform 0.45s var(--spring), stroke 0.2s var(--ease); }
.mk-tab:hover { color: var(--text-mid); }
.mk-tab:hover svg { transform: translateY(-1px); }
.mk-tab.is-active { color: var(--text); }
.mk-tab.is-active svg { stroke: var(--accent-text); animation: mk-tabpop 0.5s var(--spring); }
@keyframes mk-tabpop { 40% { transform: translateY(-2px) scale(1.14); } }

/* ==========================================================================
   Body & panels
   ========================================================================== */

.mk-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 12px 14px;
}

.mk-body::-webkit-scrollbar { width: 9px; }
.mk-body::-webkit-scrollbar-thumb {
  background: #2b2d33;
  border: 3px solid var(--bg);
  border-radius: 6px;
}
.mk-body::-webkit-scrollbar-thumb:hover { background: #393c44; }

.mk-panel { display: none; }
.mk-panel.is-active { display: block; }
.mk-panel.is-active .mk-sec { animation: mk-in 0.5s var(--expo) both; }
.mk-panel.is-active .mk-sec:nth-child(2) { animation-delay: 0.05s; }
.mk-panel.is-active .mk-sec:nth-child(3) { animation-delay: 0.1s; }

@keyframes mk-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   Sections
   ========================================================================== */

.mk-sec { position: relative; }
.mk-sec + .mk-sec { margin-top: 2px; }
.mk-sec + .mk-sec::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-soft) 20%, var(--line-soft) 80%, transparent);
}

.mk-sec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 12px 0 9px;
  background: none;
  border: 0;
  color: var(--text-dim);
  text-align: left;
  cursor: pointer;
}

.mk-chev {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  stroke-width: 2.2;
  transition: transform 0.35s var(--expo);
}

.mk-sec-title {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.2s var(--ease);
}

.mk-sec-head:hover .mk-sec-title,
.mk-sec-head:hover .mk-chev { color: var(--text-mid); }
.mk-sec-head:focus-visible { outline: none; }
.mk-sec-head:focus-visible .mk-sec-title { color: var(--accent-text); }

.mk-sec-body { padding-bottom: 12px; }
.mk-sec.is-collapsed .mk-chev { transform: rotate(-90deg); }
.mk-sec.is-collapsed .mk-sec-body { display: none; }
.mk-sec:not(.is-collapsed) .mk-sec-body { animation: mk-in 0.4s var(--expo) both; }

.mk-info {
  display: flex;
  margin-left: 1px;
  cursor: help;
  opacity: 0.45;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
}
.mk-info svg { width: 11px; height: 11px; stroke-width: 1.8; }
.mk-info:hover { opacity: 1; color: var(--accent-text); }

/* ==========================================================================
   Tiles — the core building block: icon + short label, dense grid
   ========================================================================== */

.mk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}
.mk-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mk-tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 58px;
  padding: 9px 3px 7px;
  background: linear-gradient(180deg, #1b1d21, #16171b);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--hl);
  color: var(--text-mid);
  cursor: pointer;
  transition: transform 0.35s var(--spring), border-color 0.2s var(--ease),
              background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.3s var(--ease);
}

.mk-tile .mk-ic {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.mk-tile .mk-ic svg { width: 20px; height: 20px; overflow: visible; }

.mk-tl {
  max-width: 100%;
  font-size: 9.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s var(--ease);
}

.mk-tile:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #1f222a, #191b20);
  border-color: rgba(49, 168, 255, 0.4);
  color: var(--accent-text);
  box-shadow: inset 0 1px 0 var(--hl), 0 8px 18px -10px rgba(49, 168, 255, 0.55);
}
.mk-tile:hover .mk-tl { color: var(--text); }
.mk-tile:active { transform: translateY(0) scale(0.96); transition-duration: 0.08s; }
.mk-tile:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-a25); }

/* Primary tile: violet icon plate */
.mk-tile--primary {
  background: linear-gradient(180deg, #20242d, #1a1d25);
  border-color: #343a48;
  color: var(--accent-text);
}
.mk-tile--primary .mk-tl { color: var(--text); }
.mk-tile--primary::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  width: 60px;
  height: 40px;
  margin-left: -30px;
  background: radial-gradient(closest-side, rgba(49, 168, 255, 0.35), transparent);
  pointer-events: none;
}
.mk-tile--primary:hover { background: linear-gradient(180deg, #272c36, #1f222a); border-color: var(--accent-a45); }

/* Square icon-only tile, sits next to a primary button */
.mk-tile--sq {
  flex: 0 0 auto;
  width: 34px;
  min-height: 0;
  height: 34px;
  padding: 0;
  gap: 0;
}
.mk-tile--sq .mk-ic svg { width: 17px; height: 17px; }
.mk-tile--accent { color: var(--accent-text); border-color: #343a48; background: linear-gradient(180deg, #20242d, #1a1d25); }

/* --- Hover micro-animations, per icon ------------------------------------ */
.mk-tile:hover [data-x], .mk-tile:hover .mk-ic svg { animation-duration: 0.6s; animation-fill-mode: both; }
.mk-tile[data-anim="pop"]:hover .mk-ic svg     { animation-name: mk-a-pop;   animation-timing-function: var(--spring); }
.mk-tile[data-anim="swing"]:hover .mk-ic svg   { animation-name: mk-a-swing; transform-origin: 80% 20%; }
.mk-tile[data-anim="shake"]:hover .mk-ic svg   { animation-name: mk-a-shake; }
.mk-tile[data-anim="look"]:hover .mk-ic svg    { animation-name: mk-a-look;  animation-timing-function: var(--ease); }
.mk-tile[data-anim="spin"]:hover .mk-ic svg    { animation-name: mk-a-spin;  animation-timing-function: var(--expo); }
.mk-tile[data-anim="swap"]:hover .mk-ic svg    { animation-name: mk-a-swap;  animation-timing-function: var(--expo); }
.mk-tile[data-anim="burst"] rect, .mk-tile[data-anim="squeeze"] rect { transition: transform 0.45s var(--spring); }
.mk-tile[data-anim="burst"]:hover .p1 { transform: translate(-2px, -2px); }
.mk-tile[data-anim="burst"]:hover .p2 { transform: translate(2px, -2px); }
.mk-tile[data-anim="burst"]:hover .p3 { transform: translate(-2px, 2px); }
.mk-tile[data-anim="burst"]:hover .p4 { transform: translate(2px, 2px); }
.mk-tile[data-anim="squeeze"]:hover .p1 { transform: translate(1.5px, 1.5px); }
.mk-tile[data-anim="squeeze"]:hover .p4 { transform: translate(-1.5px, -1.5px); }

@keyframes mk-a-pop   { 0% { transform: none; } 35% { transform: translateY(-3px) scale(1.12); } 100% { transform: none; } }
@keyframes mk-a-swing { 20% { transform: rotate(14deg); } 45% { transform: rotate(-9deg); } 70% { transform: rotate(4deg); } 100% { transform: none; } }
@keyframes mk-a-shake { 15% { transform: rotate(-9deg); } 35% { transform: rotate(8deg); } 55% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } 100% { transform: none; } }
@keyframes mk-a-look  { 30% { transform: translate(-2px, -1px); } 65% { transform: translate(2px, 1px); } 100% { transform: none; } }
@keyframes mk-a-spin  { from { transform: rotate(0); } to { transform: rotate(180deg); } }
@keyframes mk-a-swap  { 50% { transform: scaleX(-1); } 100% { transform: none; } }

/* --- Ripple from the click point ----------------------------------------- */
.mk-ripple {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: rgba(108, 196, 255, 0.35);
  pointer-events: none;
  animation: mk-ripple 0.6s var(--expo) forwards;
}
@keyframes mk-ripple { to { transform: scale(22); opacity: 0; } }

/* ==========================================================================
   Wide buttons
   ========================================================================== */

.mk-btn {
  position: relative;
  overflow: hidden;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  background: linear-gradient(180deg, #1b1d21, #16171b);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--hl);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.35s var(--spring), border-color 0.2s var(--ease),
              background 0.2s var(--ease), box-shadow 0.3s var(--ease), filter 0.2s var(--ease);
}
.mk-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-btn svg { flex: 0 0 auto; width: 15px; height: 15px; color: var(--text-mid); transition: transform 0.4s var(--spring), color 0.2s; }
.mk-btn:hover { border-color: rgba(49, 168, 255, 0.4); background: linear-gradient(180deg, #1f222a, #191b20); transform: translateY(-1px); }
.mk-btn:hover svg { color: var(--accent-text); transform: translateX(-1px) scale(1.08); }
.mk-btn:active { transform: scale(0.97); transition-duration: 0.08s; }
.mk-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-a25); }
.mk-btn--full { width: 100%; }

.mk-btn--primary {
  background: linear-gradient(160deg, var(--accent-hi), var(--accent) 50%, var(--accent-deep));
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 16px -8px rgba(49, 168, 255, 0.8);
  color: var(--on-accent);
}
.mk-btn--primary svg { color: var(--on-accent); stroke-width: 2; }
.mk-btn--primary:hover {
  background: linear-gradient(160deg, #a6dcff, #a6dcff 50%, #55b8ff);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 22px -8px rgba(49, 168, 255, 0.95);
}
.mk-btn--primary:hover svg { color: var(--on-accent); }
/* a sheen that sweeps across on hover */
.mk-btn--primary::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg) translateX(-120%);
  pointer-events: none;
}
.mk-btn--primary:hover::after { transform: skewX(-20deg) translateX(560%); transition: transform 0.8s var(--expo); }

/* --- Rows ---------------------------------------------------------------- */
.mk-row { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.mk-row:last-child { margin-bottom: 0; }
.mk-row--cta { margin-top: 4px; }

/* --- Result flash: whatever ran confirms what happened ------------------- */
.flash-ok   { border-color: #2f6a41 !important; box-shadow: 0 0 0 1px #2f6a41, 0 0 16px -4px rgba(111, 196, 138, 0.6) !important; }
.flash-warn { border-color: #3c4354 !important; box-shadow: 0 0 0 1px #3c4354, 0 0 16px -4px rgba(232, 176, 74, 0.5) !important; }
.flash-err  { border-color: #6c2f29 !important; box-shadow: 0 0 0 1px #6c2f29, 0 0 16px -4px rgba(229, 120, 108, 0.5) !important; animation: mk-shake 0.32s var(--ease); }
.mk-tile.flash-ok .mk-ic, .mk-btn.flash-ok svg { color: var(--ok); }
.mk-tile.flash-err .mk-ic, .mk-btn.flash-err svg { color: var(--err); }
.mk-tile.flash-warn .mk-ic, .mk-btn.flash-warn svg { color: var(--warn); }

@keyframes mk-shake {
  20% { transform: translateX(-3px); }
  45% { transform: translateX(3px); }
  70% { transform: translateX(-2px); }
}

/* While a host call runs, nothing else can be triggered */
body.is-busy .mk-tile, body.is-busy .mk-btn, body.is-busy .mk-anchor button { pointer-events: none; }
body.is-busy .mk-tile:not(.is-running), body.is-busy .mk-btn:not(.is-running) { opacity: 0.5; }
.is-running .mk-ic svg, .mk-btn.is-running svg { animation: mk-pulse 0.8s ease-in-out infinite; }
.mk-btn.is-running::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: mk-scan 0.9s linear infinite;
}
@keyframes mk-pulse { 50% { opacity: 0.3; } }
@keyframes mk-scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ==========================================================================
   Switch (checkbox)
   ========================================================================== */

.mk-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px 1px;
  color: var(--text-mid);
  font-size: 10.5px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.mk-check:hover { color: var(--text); }
.mk-check--inline { flex: 0 0 auto; margin: 0 0 0 6px; }

.mk-check input { position: absolute; opacity: 0; width: 0; height: 0; }

.mk-check-box {
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 14px;
  background: #23252b;
  border: 1px solid #32353c;
  border-radius: 999px;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.mk-check-box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #878c99;
  transition: transform 0.4s var(--spring), background 0.25s var(--ease), width 0.2s var(--ease);
}
.mk-check:active .mk-check-box::after { width: 11px; }
.mk-check input:checked + .mk-check-box {
  background: linear-gradient(135deg, var(--accent-hi), var(--accent-deep));
  border-color: transparent;
  box-shadow: 0 0 10px -2px rgba(49, 168, 255, 0.7);
}
.mk-check input:checked + .mk-check-box::after { transform: translateX(10px); background: #fff; }
.mk-check:active input:checked + .mk-check-box::after { transform: translateX(7px); }
.mk-check input:focus-visible + .mk-check-box { box-shadow: 0 0 0 2px var(--accent-a25); }

/* ==========================================================================
   Fields — label sits inside the field, AE-style
   ========================================================================== */

.mk-fields { display: grid; gap: 5px; margin-bottom: 6px; }

.mk-in {
  display: flex;
  align-items: center;
  height: 30px;
  background: var(--surface-input);
  border: 1px solid #25272d;
  border-radius: var(--r-md);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  cursor: text;
}
.mk-in:hover { border-color: #33363d; }
.mk-in-l {
  flex: 0 0 66px;
  padding-left: 10px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
}
.mk-in input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 10px 0 0;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  user-select: text;
  -webkit-user-select: text;
}
.mk-in input:focus { outline: none; }
.mk-in input::placeholder { color: #4b4f57; }
.mk-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(49, 168, 255, 0.16); }
.mk-in:focus-within .mk-in-l { color: var(--accent-text); }

/* --- Number field with scrub label and steppers -------------------------- */
.mk-num {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 30px;
  background: var(--surface-input);
  border: 1px solid #25272d;
  border-radius: var(--r-md);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.mk-num:hover { border-color: #33363d; }
.mk-num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(49, 168, 255, 0.16); }
.mk-num-l {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 8px 0 10px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: ew-resize;
  transition: color 0.2s var(--ease);
}
.mk-num-l:hover, .mk-num.is-scrubbing .mk-num-l { color: var(--accent-text); }
.mk-num input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 8px 0 0;
  background: none;
  border: 0;
  color: var(--accent-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  user-select: text;
  -webkit-user-select: text;
}
.mk-num input:focus { outline: none; }
.mk-num input::-webkit-inner-spin-button, .mk-num input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.mk-num-b {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #1b1d22;
  border: 1px solid #26272b;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.3s var(--spring);
}
.mk-num-b:hover { color: var(--accent-text); border-color: var(--accent-a45); }
.mk-num-b:active { transform: scale(0.88); }
.mk-num--step input { text-align: center; padding: 0 4px; }
.mk-num-u { flex: 0 0 auto; padding: 0 9px 0 5px; font-size: 9px; color: var(--text-dim); letter-spacing: 0.06em; }
.mk-num.is-bump input { animation: mk-bump 0.3s var(--spring); }
@keyframes mk-bump { 40% { transform: scale(1.18); } }

.mk-textarea {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 9px 10px;
  background: var(--surface-input);
  border: 1px solid #25272d;
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  line-height: 1.55;
  resize: vertical;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.mk-textarea::placeholder { color: #4b4f57; }
.mk-textarea:hover { border-color: #33363d; }
.mk-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(49, 168, 255, 0.16); }
.mk-textarea::-webkit-scrollbar { width: 8px; }
.mk-textarea::-webkit-scrollbar-thumb { background: #2b2d33; border: 2px solid var(--surface-input); border-radius: 5px; }

/* ==========================================================================
   Segmented control, with a sliding pill
   ========================================================================== */

.mk-seg {
  position: relative;
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  padding: 3px;
  background: var(--surface-input);
  border: 1px solid #21242a;
  border-radius: var(--r-md);
}
.mk-seg--grow { flex: 1 1 auto; margin-bottom: 0; }
.mk-seg-ind {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  background: linear-gradient(180deg, #262b35, #20242c);
  border: 1px solid rgba(49, 168, 255, 0.35);
  border-radius: var(--r-sm);
  box-shadow: inset 0 1px 0 var(--hl), 0 2px 8px -2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: transform 0.45s var(--expo), width 0.45s var(--expo);
}
.mk-seg .mk-chip {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  padding: 0 4px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 550;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.mk-seg .mk-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-seg .mk-chip svg { flex: 0 0 auto; width: 13px; height: 13px; transition: transform 0.4s var(--spring); }
.mk-seg .mk-chip:hover { color: var(--text-mid); }
.mk-seg .mk-chip.is-on { color: var(--text); }
.mk-seg .mk-chip.is-on svg { color: var(--accent-text); transform: scale(1.1); }

/* ==========================================================================
   Ease editor
   ========================================================================== */

.mk-editor {
  position: relative;
  margin-bottom: 9px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(49, 168, 255, 0.07), transparent 60%),
    var(--surface-input);
  border: 1px solid #23252b;
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.mk-curve {
  display: block;
  width: 100%;
  height: 140px;
  cursor: crosshair;
  touch-action: none;        /* dragging a handle mustn't scroll the page */
}

.mk-preview {
  position: relative;
  height: 22px;
  border-top: 1px solid #1c1e23;
}
.mk-preview-track {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  height: 1px;
  background: repeating-linear-gradient(90deg, #2d3036 0 3px, transparent 3px 6px);
}
.mk-preview-dot, .mk-preview-ghost {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  will-change: transform;
}
.mk-preview-dot { background: var(--accent-hi); box-shadow: 0 0 0 3px rgba(49, 168, 255, 0.18), 0 0 12px rgba(49, 168, 255, 0.8); }
.mk-preview-ghost { background: var(--text-dim); opacity: 0.35; }

/* Sliders */
.mk-sliders {
  display: grid;
  grid-template-columns: 1fr 22px;
  align-items: center;
  column-gap: 4px;
  margin-bottom: 10px;
}
.mk-slider { grid-column: 1; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mk-slider:last-of-type { margin-bottom: 0; }
.mk-slider.is-hidden { display: none; }
.mk-slider > label {
  flex: 0 0 28px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mk-slider > b {
  flex: 0 0 36px;
  text-align: right;
  font-size: 11px;
  font-weight: 650;
  color: var(--accent-text);
}
.mk-sliders--plain { grid-template-columns: 1fr; }
.mk-sliders--plain .mk-slider > label { flex-basis: 64px; }
.mk-sliders--plain .mk-slider > b { flex-basis: 42px; }

.mk-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
}
.mk-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-deep) 0, var(--accent-hi) var(--fill, 33%), #25272d var(--fill, 33%) 100%);
}
.mk-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 0 rgba(49, 168, 255, 0.3);
  transition: transform 0.3s var(--spring), box-shadow 0.25s var(--ease);
}
.mk-slider input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(49, 168, 255, 0.18); }
.mk-slider input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 6px rgba(49, 168, 255, 0.22); }
.mk-slider input[type="range"]:focus { outline: none; }

/* Link bracket between the two sliders */
.mk-link {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: stretch;
  padding: 0 1px 0 8px;
  background: none;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.mk-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 6px;
  border: 1px solid currentColor;
  border-left: 0;
  border-radius: 0 3px 3px 0;
  opacity: 0.45;
  transition: opacity 0.2s var(--ease);
}
.mk-link svg { width: 12px; height: 12px; stroke-width: 1.8; transition: transform 0.4s var(--spring); }
.mk-link:hover { color: var(--text-mid); }
.mk-link:hover::before { opacity: 0.8; }
.mk-link.is-on { color: var(--accent-text); }
.mk-link.is-on::before { opacity: 1; }
.mk-link.is-on svg { transform: rotate(-45deg); }
.mk-link:not(.is-on) svg { opacity: 0.6; }

/* --- Preset tiles with a drawing of the curve ---------------------------- */
.mk-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 9px;
}

.mk-ptile, .mk-chip--mine {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 7px 0 5px;
  background: linear-gradient(180deg, #1a1c20, #16171b);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--hl);
  color: var(--text-mid);
  font-size: 10px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease),
              transform 0.35s var(--spring);
}
.mk-pc {
  flex: 0 0 auto;
  width: 30px;
  height: 22px;
  overflow: visible;
  background: #111216;
  border-radius: 4px;
}
.mk-pc .g { stroke: #21242a; stroke-width: 0.8; fill: none; }
.mk-pc .c { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.mk-pc .d { fill: var(--accent-hi); opacity: 0; }
.mk-ptile .mk-pn, .mk-chip--mine .mk-chip-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mk-ptile:hover, .mk-chip--mine:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 168, 255, 0.35);
  background: linear-gradient(180deg, #1f2127, #191b20);
  color: var(--text);
}
.mk-ptile:hover .mk-pc .d, .mk-chip--mine:hover .mk-pc .d { opacity: 1; }
.mk-ptile:active, .mk-chip--mine:active { transform: scale(0.96); }
.mk-ptile.is-on, .mk-chip--mine.is-on {
  background: linear-gradient(180deg, #232731, #1c1f27);
  border-color: rgba(49, 168, 255, 0.55);
  color: var(--accent-text);
  box-shadow: inset 0 1px 0 var(--hl), 0 0 14px -6px rgba(49, 168, 255, 0.8);
}
.mk-ptile.is-on .mk-pc .c, .mk-chip--mine.is-on .mk-pc .c { stroke: var(--accent-hi); filter: drop-shadow(0 0 2px rgba(49, 168, 255, 0.8)); }

/* ==========================================================================
   My curves
   ========================================================================== */

.mk-mine {
  margin: 0 0 10px;
  padding: 8px;
  background: var(--bg-2);
  border: 1px dashed #25282e;
  border-radius: var(--r-lg);
}
.mk-mine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.mk-mine-add {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px 3px 6px;
  background: rgba(49, 168, 255, 0.08);
  border: 1px solid rgba(49, 168, 255, 0.3);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.35s var(--spring);
}
.mk-mine-add svg { width: 10px; height: 10px; stroke-width: 2.2; transition: transform 0.4s var(--spring); }
.mk-mine-add:hover { background: rgba(49, 168, 255, 0.16); border-color: var(--accent-a45); }
.mk-mine-add:hover svg { transform: rotate(90deg); }
.mk-mine-add:active { transform: scale(0.94); }

.mk-mine-new { display: flex; gap: 4px; margin-bottom: 7px; animation: mk-in 0.35s var(--expo); }
.mk-mine-new[hidden] { display: none; }
.mk-mine-new input {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  padding: 0 9px;
  background: var(--surface-input);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  box-shadow: 0 0 0 2px rgba(49, 168, 255, 0.15);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  user-select: text;
  -webkit-user-select: text;
}
.mk-mine-new input:focus { outline: none; }
.mk-mine-new input::placeholder { color: #4b4f57; }
.mk-mine-ok, .mk-mine-cancel {
  flex: 0 0 auto;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  color: var(--text-mid);
  cursor: pointer;
}
.mk-mine-ok { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mk-mine-ok svg, .mk-mine-cancel svg { width: 12px; height: 12px; stroke-width: 2.2; }
.mk-mine-cancel:hover { color: var(--text); border-color: var(--line); }

.mk-mine-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.mk-mine-empty { margin: 0; font-size: 9.5px; line-height: 1.5; color: var(--text-dim); }
.mk-mine-empty[hidden] { display: none; }

.mk-chip--mine { padding-right: 20px; }
.mk-chip-x {
  position: absolute;
  right: 3px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.mk-chip-x svg { width: 9px; height: 9px; stroke-width: 2.4; }
.mk-chip--mine:hover .mk-chip-x { opacity: 1; }
.mk-chip-x:hover { background: #242832; color: var(--err); }
.mk-chip--mine.is-new { animation: mk-pop 0.5s var(--spring); }
@keyframes mk-pop { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ==========================================================================
   Expression kinds — each tile plays its motion
   ========================================================================== */

.mk-kinds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}
.mk-kind {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 5px 5px 6px;
  background: linear-gradient(180deg, #1a1c20, #16171b);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 var(--hl);
  color: var(--text-mid);
  font-size: 10px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), transform 0.35s var(--spring);
}
.mk-kind > span:last-child { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-kind:hover { transform: translateY(-1px); border-color: rgba(49, 168, 255, 0.35); color: var(--text); }
.mk-kind:active { transform: scale(0.96); }
.mk-kind.is-on {
  background: linear-gradient(180deg, #232731, #1c1f27);
  border-color: rgba(49, 168, 255, 0.55);
  color: var(--accent-text);
  box-shadow: inset 0 1px 0 var(--hl), 0 0 14px -6px rgba(49, 168, 255, 0.8);
}

.mk-kv {
  position: relative;
  display: block;
  height: 30px;
  overflow: hidden;
  background: #101115;
  border-radius: 5px;
}
.mk-kv::before {       /* baseline / target mark */
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 7px;
  height: 1px;
  background: #23262c;
}
.mk-kv i, .mk-kv b {
  position: absolute;
  display: block;
  border-radius: 3px;
  background: #5a606e;
  transition: background 0.2s var(--ease);
}
.mk-kind:hover .mk-kv i, .mk-kind.is-on .mk-kv i { background: var(--accent-hi); box-shadow: 0 0 8px rgba(49, 168, 255, 0.7); }

/* Elastic: a bar slides in and overshoots */
.mk-kv--elastic i { left: 8px; bottom: 9px; width: 12px; height: 12px; transform: translateX(22px); }
.mk-kind:hover .mk-kv--elastic i, .mk-kind.is-on .mk-kv--elastic i { animation: mk-k-elastic 1.6s infinite; }
@keyframes mk-k-elastic {
  0%   { transform: translateX(0); animation-timing-function: cubic-bezier(0.3, 0, 0.6, 1); }
  28%  { transform: translateX(34px); animation-timing-function: ease-in-out; }
  40%  { transform: translateX(18px); animation-timing-function: ease-in-out; }
  52%  { transform: translateX(27px); animation-timing-function: ease-in-out; }
  62%  { transform: translateX(21px); animation-timing-function: ease-in-out; }
  72%, 100% { transform: translateX(23px); }
}

/* Bounce: a ball drops and bounces, squashing on contact */
.mk-kv--bounce i { left: 50%; bottom: 8px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; }
.mk-kv--bounce b { left: 50%; bottom: 5px; width: 12px; height: 2px; margin-left: -6px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); }
.mk-kind:hover .mk-kv--bounce i, .mk-kind.is-on .mk-kv--bounce i { animation: mk-k-bounce 1.4s infinite; }
@keyframes mk-k-bounce {
  0%   { transform: translateY(-18px); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  30%  { transform: translateY(0) scale(1.25, 0.75); animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1); }
  48%  { transform: translateY(-9px); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  62%  { transform: translateY(0) scale(1.15, 0.85); animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1); }
  72%  { transform: translateY(-3px); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  80%, 100% { transform: translateY(0); }
}

/* Wiggle: jitters around its spot */
.mk-kv--wiggle i { left: 50%; bottom: 9px; width: 12px; height: 12px; margin-left: -6px; }
.mk-kind:hover .mk-kv--wiggle i, .mk-kind.is-on .mk-kv--wiggle i { animation: mk-k-wiggle 1.2s infinite; }
@keyframes mk-k-wiggle {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  12% { transform: translate(-6px, -3px) rotate(-8deg); }
  26% { transform: translate(5px, -1px) rotate(6deg); }
  40% { transform: translate(-3px, -5px) rotate(-4deg); }
  55% { transform: translate(7px, -2px) rotate(9deg); }
  70% { transform: translate(-5px, -4px) rotate(-6deg); }
  85% { transform: translate(3px, 0) rotate(3deg); }
}

/* ==========================================================================
   Anchor point — nine points on a layer's bounds
   ========================================================================== */

.mk-anchor-wrap {
  display: flex;
  justify-content: center;
  padding: 18px 0 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px) 0 0 / 12px 12px,
    var(--surface-input);
  border: 1px solid #21242a;
  border-radius: var(--r-lg);
}

.mk-anchor { position: relative; width: 150px; height: 92px; }

.mk-anchor-layer {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(108, 196, 255, 0.16), rgba(79, 167, 230, 0.1));
  border: 1px solid rgba(49, 168, 255, 0.45);
  box-shadow: 0 8px 22px -10px rgba(49, 168, 255, 0.5);
}
.mk-anchor-layer::before, .mk-anchor-layer::after {
  content: "";
  position: absolute;
  background: rgba(49, 168, 255, 0.14);
}
.mk-anchor-layer::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.mk-anchor-layer::after { top: 50%; left: 0; right: 0; height: 1px; }

.mk-anchor button {
  position: absolute;
  z-index: 2;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.mk-anchor button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #272b33;
  border: 1.5px solid #969fb3;
  transition: transform 0.35s var(--spring), background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s;
}
.mk-anchor button:hover::after { transform: scale(1.6); background: var(--accent); border-color: #fff; box-shadow: 0 0 10px rgba(49, 168, 255, 0.9); }
.mk-anchor button:active::after { transform: scale(1.1); }
.mk-anchor button:focus-visible { outline: none; }
.mk-anchor button:focus-visible::after { box-shadow: 0 0 0 3px var(--accent-a45); }
.mk-anchor button.flash-ok, .mk-anchor button.flash-err, .mk-anchor button.flash-warn { box-shadow: none !important; }
.mk-anchor button.flash-ok::after { background: var(--ok); border-color: #fff; }
.mk-anchor button.flash-err::after { background: var(--err); border-color: #fff; }
.mk-anchor button.flash-warn::after { background: var(--warn); border-color: #fff; }

/* the crosshair travels to the last point used */
.mk-anchor-mark {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  color: var(--accent-hi);
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(49, 168, 255, 0.9));
  transition: left 0.55s var(--spring), top 0.55s var(--spring);
}
.mk-anchor-mark svg { width: 26px; height: 26px; stroke-width: 1.4; }
.mk-anchor-mark.is-hit svg { animation: mk-a-spin 0.55s var(--expo); }

/* ==========================================================================
   Status bar
   ========================================================================== */

.mk-status {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #0c0d0f;
  border-top: 1px solid var(--line-soft);
  font-size: 10px;
  color: var(--text-dim);
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
.mk-status::before {         /* hairline progress while busy */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-hi), transparent);
  opacity: 0;
  transform: translateX(-100%);
}
.mk-status.is-busy::before { opacity: 1; animation: mk-scan 1s linear infinite; }

.mk-status-icon { flex: 0 0 auto; width: 13px; height: 13px; }
.mk-status-icon svg { width: 13px; height: 13px; stroke-width: 1.8; display: none; }
.mk-status-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.4s var(--ease);
}
.mk-status .i-idle { display: block; }
.mk-status.is-busy { color: var(--accent-text); }
.mk-status.is-busy .i-idle { display: none; }
.mk-status.is-busy .i-busy { display: block; animation: mk-spin 0.7s linear infinite; }
.mk-status.is-ok { background: #0f1511; color: var(--ok); }
.mk-status.is-ok .i-idle { display: none; }
.mk-status.is-ok .i-ok { display: block; animation: mk-a-pop 0.5s var(--spring); }
.mk-status.is-ok .mk-status-text { color: #cfe0d4; }
.mk-status.is-warn { background: #0e1014; color: var(--warn); }
.mk-status.is-warn .i-idle { display: none; }
.mk-status.is-warn .i-warn { display: block; }
.mk-status.is-warn .mk-status-text { color: #adcce3; }
.mk-status.is-err { background: #101217; color: var(--err); }
.mk-status.is-err .i-idle { display: none; }
.mk-status.is-err .i-err { display: block; }
.mk-status.is-err .mk-status-text { color: #e8c3bd; }
.mk-status .mk-status-text { animation: none; }
.mk-status.is-ok .mk-status-text, .mk-status.is-warn .mk-status-text, .mk-status.is-err .mk-status-text { animation: mk-slide 0.35s var(--expo); }
@keyframes mk-slide { from { opacity: 0; transform: translateY(4px); } }

.mk-status-action {
  flex: 0 0 auto;
  padding: 2px 9px;
  background: none;
  border: 1px solid var(--accent-a45);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 9.5px;
  font-weight: 650;
  cursor: pointer;
}
.mk-status-action[hidden] { display: none; }
.mk-status-action:hover { background: var(--accent-a10); }

.mk-status.is-settled { background: #0c0d0f; }
.mk-status.is-settled .mk-status-text { color: var(--text-mid); }

@keyframes mk-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Tooltip
   ========================================================================== */

.mk-tip {
  position: fixed;
  z-index: 100;
  max-width: 230px;
  padding: 7px 10px;
  background: rgba(29, 31, 36, 0.97);
  border: 1px solid #32363e;
  border-radius: var(--r-md);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 10px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.15s var(--ease), transform 0.25s var(--expo);
}
.mk-tip.is-on { opacity: 1; transform: none; }

/* ==========================================================================
   Narrow panel (the minimum is 260 px)
   ========================================================================== */

@media (max-width: 300px) {
  .mk-grid { gap: 4px; }
  .mk-tl { font-size: 9px; }
  .mk-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-in-l { flex-basis: 60px; letter-spacing: 0.06em; }
  .mk-sliders--plain .mk-slider > label { flex-basis: 56px; }
  .mk-seg .mk-chip svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


/* ==========================================================================
   FrameSmith additions — notes, audit report, folder path
   Same tokens and radii as everything above.
   ========================================================================== */

.fs-note {
  display: flex;
  gap: 7px;
  margin: 0 0 9px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-dim);
}
.fs-note svg {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fs-note--warn {
  padding: 8px 9px;
  border: 1px solid var(--accent-a25);
  border-radius: var(--r-md);
  background: var(--accent-a10);
  color: var(--accent-text);
}
.fs-note--sample {
  margin-top: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-input);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--accent-text);
  word-break: break-all;
}

/* --- audit totals --- */
.fs-tots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.fs-tot {
  padding: 9px 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  box-shadow: inset 0 1px 0 var(--hl);
  text-align: center;
}
.fs-tot b {
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s var(--ease);
}
.fs-tot span {
  display: block;
  margin-top: 4px;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.fs-tot--b.is-hit b { color: var(--err); }
.fs-tot--w.is-hit b { color: var(--warn); }
.fs-tot--i.is-hit b { color: var(--text); }

/* --- audit report --- */
.fs-report {
  margin-top: 10px;
  max-height: 230px;
  overflow-y: auto;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface-input);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.fs-report::-webkit-scrollbar { width: 8px; }
.fs-report::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.fs-report-empty {
  margin: 0;
  padding: 10px 2px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-dim);
  text-align: center;
}
.fs-line {
  display: flex;
  gap: 7px;
  padding: 5px 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-mid);
  opacity: 0;
  transform: translateY(4px);
  animation: fs-in 0.32s var(--expo) forwards;
}
.fs-line + .fs-line { border-top: 1px solid var(--line-soft); }
@keyframes fs-in { to { opacity: 1; transform: none; } }
.fs-line i {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--text-dim);
}
.fs-line b {
  flex: 0 0 auto;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--text-dim);
}
.fs-line--b i { background: var(--err); }
.fs-line--b b { color: var(--err); }
.fs-line--w i { background: var(--warn); }
.fs-line--w b { color: var(--warn); }

/* --- chosen export folder --- */
.fs-path {
  margin: 8px 0 0;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-input);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 9.5px;
  color: var(--text-dim);
  word-break: break-all;
}
.fs-path.is-set { color: var(--accent-text); }

/* Demo mode: the panel runs in a browser with no host attached. */
.fs-demo .mk-version::after { content: " \00b7  demo"; }

/* The report scrolls; fade the last row so a cut line reads as more content
   rather than as a clipping bug. */
.fs-report {
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
}
