/* مختبر تشابك: شاشة كاملة، دارة (يمين) + كود (شمال). ألوان الموقع: كحلي + فيروزي على خلفية فاتحة. */
.lab {
  --ink: #0e3a63; --ink-2: #4a6380; --muted: #7b8ea2; --line: #dde6ee; --bg: #f3f6f9; --panel: #ffffff;
  --accent: #1a9e8f; --accent-2: #12857a; --danger: #c93b3b; --warn: #b7791f;
  --circuit: 0.58;
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; font-size: 14px;
}
.lab * { box-sizing: border-box; }
.lab [hidden] { display: none !important; }
.lab button { font: inherit; color: inherit; cursor: pointer; }
.lab-boot { margin: auto; display: flex; gap: 10px; align-items: center; color: var(--ink-2); }
.lab-boot i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: lb-pulse 1s ease-in-out infinite; }
@keyframes lb-pulse { 50% { opacity: .3; transform: scale(.7); } }

/* ---------- الشريط العلوي ---------- */
.lb-top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 56px; flex-wrap: wrap; }
.lb-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 12px; }
.lb-brand:hover { background: var(--bg); }
.lb-brand b { font-size: 16px; }
.lb-brand .beta { font-size: 11px; color: var(--accent-2); background: #e3f5f2; border-radius: 999px; padding: 1px 8px; }
.lb-title { border: 1px solid transparent; background: transparent; font: inherit; font-weight: 600; color: var(--ink); padding: 6px 10px; border-radius: 10px; width: 200px; }
.lb-title:hover, .lb-title:focus { border-color: var(--line); background: var(--bg); outline: none; }
.lb-run { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.lb-menu { display: flex; align-items: center; gap: 4px; }
.lb-board { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: var(--panel); color: var(--ink); direction: ltr; }
.lb-status { font-size: 13px; color: var(--ink-2); min-width: 120px; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-status[data-kind="err"] { color: var(--danger); }
.lb-status[data-kind="warn"] { color: var(--warn); }
.lb-status[data-kind="run"] { color: var(--accent-2); }
.lb-status[data-kind="busy"]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-inline-end: 6px; animation: lb-pulse 1s infinite; }

.lb-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; }
.lb-btn:hover:not(:disabled) { border-color: #b9cadb; background: #f8fbfd; }
.lb-btn:disabled { opacity: .45; cursor: default; }
.lb-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: 0 18px; box-shadow: 0 6px 16px -8px #1a9e8f; }
.lb-btn.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.lb-btn.primary.stop { background: var(--danger); border-color: var(--danger); box-shadow: 0 6px 16px -8px var(--danger); }
.lb-btn.ghost { border-color: transparent; background: transparent; }
.lb-btn.ghost:hover { background: var(--bg); }
.lb-btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.lb-btn:focus-visible, .lb-tb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- التقسيم ---------- */
.lb-main { flex: 1; display: flex; min-height: 0; }
.lb-circuit { position: relative; flex: 0 0 calc(var(--circuit) * 100%); min-width: 0; overflow: hidden; }
.lb-split { flex: 0 0 6px; cursor: col-resize; background: var(--line); }
.lb-split:hover { background: #b9cadb; }
.lb-code { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); }

/* ---------- لوحة الدارة ---------- */
.lb-canvas { position: absolute; inset: 0; overflow: hidden; touch-action: none; direction: ltr;
  background-color: #f7f9fb; background-image: radial-gradient(#d2dbe4 1px, transparent 1.2px); background-size: 19.2px 19.2px; }
.lb-canvas.sim { background-color: #f3f8f7; }
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-parts { position: absolute; left: 0; top: 0; }
.cv-part { position: absolute; left: 0; top: 0; transform-origin: center; cursor: grab; user-select: none; }
.cv-part > * { display: block; }
.cv-part.sel { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 4px; }
.cv-part.warn { outline: 2px solid var(--warn); outline-offset: 4px; border-radius: 4px; }
.sim .cv-part { cursor: default; }
.cv-wires, .cv-pins { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.cv-wire, .cv-pins .pin { pointer-events: auto; }
.cv-wire .hit { stroke: transparent; stroke-width: 10; fill: none; cursor: pointer; }
.cv-wire .under { stroke: #00000030; stroke-width: 4.2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.cv-wire .line { stroke-width: 2.8; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.cv-wire.sel .line { stroke-width: 3.6; filter: drop-shadow(0 0 3px #1a9e8f); }
.cv-wire .bend { fill: #fff; stroke: var(--accent); stroke-width: 1.5; cursor: move; }
.sim .cv-wire { pointer-events: none; }
.cv-wires .draft { stroke-width: 2.6; fill: none; stroke-dasharray: 5 4; stroke-linejoin: round; }
.cv-pins .pin { fill: #1a9e8f55; stroke: #12857a; stroke-width: 1; cursor: crosshair; }
.cv-pins .pin.hole { fill: #1a9e8f22; stroke: #1a9e8f88; }
.cv-pins .pin:hover { fill: var(--accent); r: 4.4; }

.lb-tools { position: absolute; bottom: 14px; inset-inline-start: 50%; transform: translateX(50%); display: flex; align-items: center; gap: 2px; padding: 5px;
  background: #ffffffe6; backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 30px -14px #0e3a6340; }
.lb-tb { display: inline-flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; justify-content: center; padding: 0 10px; border: 0; border-radius: 11px; background: transparent; }
.lb-tb:hover { background: var(--bg); }
.lb-tb.addpart { background: var(--ink); color: #fff; padding: 0 14px; font-weight: 600; }
.lb-tb.addpart:hover { background: #0a2448; }
.lb-tools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.sim ~ .lb-tools .addpart, .sim ~ .lb-tools .undo, .sim ~ .lb-tools .redo { opacity: .4; pointer-events: none; }
.lb-hint { position: absolute; top: 10px; inset-inline-start: 12px; inset-inline-end: 12px; font-size: 12px; color: var(--muted); pointer-events: none; text-align: start; }
.sim ~ .lb-hint { display: none; }

/* خصائص القطعة / تحكم الحساسات */
.lb-props { position: absolute; top: 40px; inset-inline-start: 14px; width: 250px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 40px -18px #0e3a6355; padding: 12px; display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.lb-props header { display: flex; align-items: center; gap: 8px; }
.lb-props header b { flex: 1; }
.lb-props header small { color: var(--muted); }
.lb-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.lb-field span { display: flex; justify-content: space-between; }
.lb-field output { color: var(--ink); font-weight: 600; direction: ltr; }
.lb-field select { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 7px; background: var(--panel); color: var(--ink); }
.lb-field input[type=range] { accent-color: var(--accent); width: 100%; }
.lb-field.tog { flex-direction: row; justify-content: space-between; align-items: center; }
.lb-field.tog input { width: 20px; height: 20px; accent-color: var(--accent); }
.lb-prow { display: flex; gap: 6px; }
.lb-colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.lb-colors button { aspect-ratio: 1; border-radius: 10px; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line); }
.lb-colors button.on { box-shadow: 0 0 0 2px var(--accent); }
.lb-x { margin-inline-start: auto; border: 0; background: transparent; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); }
.lb-x:hover { background: var(--bg); }

/* مكتبة القطع */
.lb-palette { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: min(340px, 92%); background: var(--panel); border-inline-end: 1px solid var(--line);
  box-shadow: 18px 0 40px -24px #0e3a6355; z-index: 6; display: flex; flex-direction: column; }
.lb-palette header { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.lb-palette header input { flex: 1; font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.lb-pal-list { overflow: auto; padding: 4px 12px 16px; }
.lb-pal-list h3 { font-size: 12px; color: var(--muted); margin: 14px 2px 8px; font-weight: 600; }
.lb-pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lb-pal-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 11.5px; line-height: 1.3; text-align: center; }
.lb-pal-item:hover { border-color: var(--accent); background: #f2fbf9; }
.lb-pal-item .thumb { width: 72px; height: 56px; display: flex; align-items: center; justify-content: center; overflow: hidden; direction: ltr; pointer-events: none; }
.lb-pal-item .thumb > * { transform-origin: center; flex: none; }
/* مكتبة القطع: بحث، أقسام بأعدادها، وسطر «للتوصيل والكود بس» للقطع اللي بلا محاكاة */
.lb-pal-search { padding: 10px 12px 0; }
.lb-pal-search input { width: 100%; height: 44px; font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--bg); color: var(--ink); }
.lb-pal-search input:focus { outline: none; border-color: var(--accent); background: var(--panel); }
.lb-pal-cats { display: flex; gap: 6px; padding: 10px 12px 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
.lb-pal-cats button { flex: none; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font: inherit; font-size: 13px; white-space: nowrap; }
.lb-pal-cats button span { color: var(--muted); font-size: 12px; }
.lb-pal-cats button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.lb-pal-cats button.on span { color: #ffffffb3; }
.lb-pal-list { flex: 1; min-height: 0; }
.lb-pal-item .nm { display: block; }
.lb-pal-item .ns { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.3; }
.lb-pal-empty { margin: 24px 4px; color: var(--ink-2); font-size: 14px; line-height: 1.7; text-align: center; }

/* ---------- الكود والشاشة ---------- */
.lb-code-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; direction: ltr; }
.lb-code-head b { font-family: "JetBrains Mono", Menlo, monospace; font-weight: 500; }
.lb-mem { color: var(--muted); margin-inline-start: auto; direction: rtl; }
.lb-editor { flex: 1; min-height: 0; overflow: hidden; }
.lb-editor .cm-editor { height: 100%; }
.lb-editor .cm-editor.cm-focused { outline: none; }
.lb-console { flex: 0 0 34%; min-height: 150px; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--con-bg); color: var(--con-fg); }
.lb-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px 0; background: var(--con-bar); }
.lb-tabs button[role=tab] { border: 0; background: transparent; color: var(--con-tab); padding: 7px 12px; border-radius: 9px 9px 0 0; font-size: 13px; }
.lb-tabs button[role=tab].on { background: var(--con-bg); color: var(--con-tab-on); }
.lb-tabs .lb-clear { margin-inline-start: auto; border: 0; background: transparent; color: var(--con-tab); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.lb-serial { flex: 1; margin: 0; padding: 10px 14px; overflow: auto; font: 12.5px/1.55 "JetBrains Mono", Menlo, monospace; white-space: pre-wrap; unicode-bidi: plaintext; }
.lb-build { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.lb-build .ok { color: var(--con-ok); margin: 0; }
.lb-build pre { font: 12px/1.5 Menlo, monospace; color: var(--con-dim); margin: 4px 0 0; white-space: pre-wrap; }
.lb-build .err { text-align: start; border: 1px solid #3b2530; background: #1d1319; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; color: #fbd5d5; }
.lb-build .err.warning { border-color: #3a3220; background: #1b1810; color: #fde8b5; }
.lb-build .err b { font-size: 12px; color: #fca5a5; }
.lb-build .err span { font: 12px/1.5 Menlo, monospace; }
.lb-build .err em { font-style: normal; color: #e8f1f8; background: #ffffff10; border-radius: 8px; padding: 4px 8px; }
.lb-send { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #1d2a36; }
.lb-send input { flex: 1; font: 13px Menlo, monospace; background: #0b1219; color: #e8f1f8; border: 1px solid #1d2a36; border-radius: 10px; padding: 8px 10px; }
.lb-send button { border: 0; background: var(--accent); color: #fff; border-radius: 10px; width: 40px; display: grid; place-items: center; }

/* وضع الكود / البلوكات */
.lb-mode { display: flex; gap: 2px; background: var(--bg); border-radius: 10px; padding: 3px; direction: rtl; }
.lb-mode button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.lb-mode button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px #0e3a6320; }
.lb-blocks { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lb-bws { flex: 1; min-height: 0; position: relative; }
.lb-gen { border-top: 1px solid var(--line); max-height: 40%; overflow: auto; }
.lb-gen summary { cursor: pointer; padding: 8px 14px; font-size: 13px; color: var(--ink-2); }
.lb-gen pre { margin: 0; padding: 4px 14px 12px; font: 12px/1.55 "JetBrains Mono", Menlo, monospace; color: var(--ink); white-space: pre; }
.blocklyToolboxDiv, .blocklyWidgetDiv, .blocklyDropDownDiv { font-family: "IBM Plex Sans Arabic", sans-serif !important; }

/* الرسم البياني */
.lb-plot { flex: 1; position: relative; min-height: 0; }
.lb-plot canvas { position: absolute; inset: 0 0 26px 0; width: 100%; height: calc(100% - 26px); direction: ltr; }
.lb-legend { position: absolute; bottom: 4px; inset-inline: 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: #9fb3c6; }
.lb-legend span::before { content: ""; display: inline-block; width: 10px; height: 3px; border-radius: 2px; background: var(--c); margin-inline-end: 6px; vertical-align: middle; }
.lb-legend b { color: #e8f1f8; font-family: Menlo, monospace; font-weight: 500; }
.lb-plot-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: #7f93a6; font-size: 13px; margin: 0; }

/* الحفظ والمشاركة */
.lb-dialog.sm { width: min(460px, 100%); }
.lb-cloud { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.lb-cloud p { margin: 0; line-height: 1.7; color: var(--ink-2); }
.lb-cloud .muted { font-size: 12.5px; color: var(--muted); }
.lb-cloud .ok { color: var(--accent-2); font-weight: 600; }
.lb-cloud .err { color: var(--danger); }
.lb-cloud a.lb-btn { text-decoration: none; color: inherit; }
.lb-cloud a.lb-btn.primary { color: #fff; }
.lb-cloud h3 { font-size: 13px; margin: 6px 0 0; color: var(--muted); }
.lb-link { display: flex; gap: 6px; }
.lb-link input { flex: 1; min-width: 0; font: 12.5px Menlo, monospace; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg); }
.lb-mine { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.lb-mine .row { display: flex; align-items: stretch; gap: 4px; }
.lb-mine a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.lb-mine a svg { flex: none; color: var(--muted); }
.lb-mine a:hover, .lb-mine .row.on a { border-color: var(--accent); background: #f2fbf9; }
.lb-mine small { color: var(--muted); margin-inline-start: auto; white-space: nowrap; }
.lb-mine .del { flex: none; width: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.lb-mine .del:hover { color: var(--danger); border-color: #f1c6c6; background: #fdf3f3; }
.lb-vis { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.lb-vis legend { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.lb-vis label { position: relative; cursor: pointer; }
.lb-vis input { position: absolute; opacity: 0; inset: 0; }
.lb-vis label > span { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s, background .15s; }
.lb-vis label > span svg { grid-row: span 2; color: var(--muted); }
.lb-vis small { color: var(--muted); font-size: 12.5px; }
.lb-vis input:checked + span { border-color: var(--accent); background: #f2fbf9; box-shadow: 0 0 0 3px #1a9e8f1f; }
.lb-vis input:checked + span svg { color: var(--accent-2); }
.lb-vis input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ملخّص المشروع بالذكاء الاصطناعي */
.lb-btn.ai { background: linear-gradient(135deg, #0e3a63, #1a6f8f 55%, #1a9e8f); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -10px #0e3a63; }
.lb-btn.ai:hover { filter: brightness(1.08); }
a.lb-btn { text-decoration: none; color: var(--ink); }
a.lb-btn.ai { color: #fff; }
.lb-dialog.wide { width: min(900px, 100%); max-height: 90vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.lb-dialog.wide > header { padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.lb-dialog.wide h2 { display: flex; align-items: center; gap: 8px; }
.lb-dialog.wide h2 svg { color: var(--accent-2); }
.lb-sumtools { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.lb-sumtools:not([hidden]) + .lb-x { margin-inline-start: 6px; }
.lb-sum { overflow: auto; padding: 18px 26px 26px; }
.lb-sum > p, .lb-sumintro p { line-height: 1.8; color: var(--ink-2); }
.lb-sum .err { color: var(--danger); }
.lb-sumintro ul { line-height: 1.9; color: var(--ink); padding-inline-start: 22px; }
.lb-sum a.lb-btn { text-decoration: none; color: inherit; }
.lb-sum a.lb-btn.primary { color: #fff; }
.lb-sumwait::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-inline-end: 8px; animation: lb-pulse 1s infinite; }
.lb-typing { display: flex; gap: 5px; margin: 8px 0 0; }
.lb-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: lb-pulse 1s infinite; }
.lb-typing i:nth-child(2) { animation-delay: .15s; } .lb-typing i:nth-child(3) { animation-delay: .3s; }
.md { line-height: 1.85; color: #1b2a3a; font-size: 15px; }
.md h2 { font-size: 24px; margin: 0 0 10px; color: var(--ink); }
.md h3 { font-size: 17px; margin: 26px 0 8px; color: var(--ink); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.md h4 { font-size: 15px; margin: 16px 0 6px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { padding-inline-start: 24px; margin: 6px 0 12px; }
.md li { margin: 3px 0; }
.md code { font: 13px Menlo, monospace; background: #eef3f7; border-radius: 6px; padding: 1px 6px; }
.md pre { background: #0f1a26; color: #e6edf3; border-radius: 12px; padding: 12px 14px; overflow: auto; text-align: left; margin: 8px 0 14px; }
.md pre code { background: none; padding: 0; color: inherit; font-size: 12.5px; line-height: 1.6; }
.md .md-table { overflow-x: auto; margin: 8px 0 14px; border: 1px solid var(--line); border-radius: 12px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { padding: 8px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.md th { background: var(--bg); color: var(--ink); font-weight: 600; }
.md tr:last-child td { border-bottom: 0; }
.md blockquote { margin: 8px 0; padding: 8px 14px; border-inline-start: 3px solid var(--accent); background: #f2fbf9; border-radius: 8px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- الأمثلة ---------- */
.lb-modal { position: fixed; inset: 0; background: #0b123066; backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 1000; padding: 16px; }
.lb-dialog { width: min(760px, 100%); max-height: 86vh; overflow: auto; background: var(--panel); border-radius: 20px; padding: 16px 18px 20px; box-shadow: 0 30px 80px -30px #0b1230; }
.lb-dialog header { display: flex; align-items: center; }
.lb-dialog h2 { font-size: 18px; margin: 0; }
.lb-exlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 14px; }
.lb-ex { text-align: start; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.lb-ex:hover { border-color: var(--accent); box-shadow: 0 10px 24px -16px #1a9e8f; }
.lb-ex .lvl { font-size: 11px; color: var(--accent-2); }
.lb-ex p { margin: 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }

/* ---------- الموبايل: الدارة فوق والكود تحت ---------- */
@media (max-width: 860px) {
  .lb-top { gap: 6px; padding: 6px 10px; }
  .lb-title { width: 130px; }
  .lb-run { margin-inline-start: 0; order: 3; width: 100%; }
  .lb-status { flex: 1; min-width: 0; }
  .lb-btn span { display: none; }
  .lb-btn.primary span { display: inline; }
  .lb-main { flex-direction: column; }
  .lb-circuit { flex: 0 0 52%; }
  .lb-split { display: none; }
  .lb-console { flex-basis: 40%; }
  .lb-hint { display: none; }
  .lb-props { inset-inline-start: 8px; top: 8px; width: min(250px, calc(100% - 16px)); }
  .lb-dialog .lb-btn span { display: inline; }
  .lb-sumtools { order: 3; width: 100%; margin: 0; }
  .lb-sum { padding: 14px 16px 20px; }
  .md { font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) { .lab * { animation: none !important; transition: none !important; } }

/* متصفح الجهاز (صفحات الويب اللي على ESP32 / ESP8266 / Pico W) */
.lb-web { display: flex; flex-direction: column; min-height: 0; flex: 1; background: #0f1a26; }
.lb-web[hidden] { display: none; }
.lb-webbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #16222f; border-bottom: 1px solid #22303f; direction: ltr; }
.lb-webbar .pre { color: #8fa3b8; font: 12.5px Menlo, monospace; white-space: nowrap; }
.lb-webbar .pre b { color: #e6edf3; font-weight: 600; }
.lb-webbar input { flex: 1; min-width: 0; background: #0f1a26; border: 1px solid #2a3a4c; color: #e6edf3; border-radius: 8px; padding: 6px 8px; font: 12.5px Menlo, monospace; }
.lb-webbar .lb-btn.sm { min-height: 30px; padding: 0 10px; }
.lb-wifi { color: #7ee2b8; font-size: 12px; white-space: nowrap; direction: rtl; }
.lb-web iframe { flex: 1; width: 100%; border: 0; background: #fff; min-height: 160px; }
.lb-web:not(.live) iframe { opacity: .55; }

/* المختبر برو: الاشتراك، الرفع على اللوحة، مولّد المشاريع، دليل التوصيل */
.lb-hw { overflow: auto; padding: 18px 26px 26px; }
.lb-hwtools { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.lb-hwtools:not([hidden]) + .lb-x { margin-inline-start: 6px; }
.lb-hw .lead { font-size: 15.5px; line-height: 1.8; color: var(--ink); margin: 0 0 12px; }
.lb-hw .muted { color: var(--muted); font-size: 13px; }
.lb-hw .err { color: var(--danger); white-space: pre-line; }
.lb-hw a.lb-btn { text-decoration: none; color: inherit; }
.lb-hw a.lb-btn.primary, .lb-hw a.lb-btn.ai { color: #fff; }
.lb-pro .feat { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.lb-pro .feat li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; line-height: 1.7; color: var(--ink-2); }
.lb-pro .feat b { display: block; color: var(--ink); margin-bottom: 2px; }
.lb-pro .price { font-size: 15px; color: var(--ink-2); margin: 4px 0 12px; }
.lb-pro .price b { font-size: 26px; color: var(--ink); }
.lb-up .steps { padding-inline-start: 22px; line-height: 1.85; color: var(--ink-2); margin: 0 0 14px; }
.lb-up .steps b { color: var(--ink); }
.lb-up .lb-field { margin-bottom: 10px; max-width: 360px; }
.lb-up .lb-field input, .lb-up .lb-field select { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel); color: var(--ink); }
.lb-wifi-real { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 4px; margin: 0 0 12px; }
.lb-wifi-real legend { font-size: 13px; color: var(--ink-2); padding: 0 6px; }
.lb-up .prog { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; margin: 12px 0 6px; }
.lb-up .prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1a6f8f, #1a9e8f); transition: width .2s; }
.lb-up .log { background: #0f1a26; color: #d6e2ee; border-radius: 12px; padding: 10px 12px; font: 12.5px/1.6 Menlo, monospace; max-height: 260px; overflow: auto; white-space: pre-wrap; margin: 8px 0 0; }
.lb-build-ai textarea { font: inherit; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; background: var(--panel); color: var(--ink); }
.lb-build-ai select { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel); color: var(--ink); max-width: 320px; }
.lb-build-ai .lb-field { margin-bottom: 10px; }
.lb-build-ai .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.lb-build-ai .chip { border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; }
.lb-build-ai .chip:hover { border-color: var(--accent); color: var(--accent-2); }
@media (max-width: 860px) { .lb-hw { padding: 14px 16px 20px; } .lb-hwtools { order: 3; width: 100%; margin: 0; } }

/* ---------- مساعد المختبر: شريط جانبي بيعدّل الكود والدارة (assist.js) ---------- */
/* زر المساعد براس الكود (الكود بيعدّله المساعد، وبالهيدر ما في مكان) */
.lb-code-head .lb-btn.asst { margin-left: auto; direction: rtl; min-height: 36px; padding: 0 12px; border-color: var(--line); color: var(--ink); font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; font-size: 13px; }
.lb-code-head .lb-btn.asst svg { color: var(--accent); }
.lb-btn.asst.on { background: var(--bg); border-color: var(--accent); }
/* لما يكون مفتوح، الدارة والكود بيتقاسموا الباقي بنفس النسبة */
.lab.assist-open .lb-circuit { flex-basis: calc(var(--circuit) * (100% - min(380px, 34vw))); }
.lb-assist { flex: 0 0 min(380px, 34vw); min-width: 300px; display: flex; flex-direction: column; background: var(--panel); border-inline-start: 1px solid var(--line); }
.lb-assist > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 8px 0 0; padding-inline: 16px 6px; border-bottom: 1px solid var(--line); }
.lb-assist > header b { font-size: 15px; }
.lb-assist .as-x { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); }
.lb-assist .as-x:hover { background: var(--bg); }
.as-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.as-empty { margin: auto 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
.as-empty p { margin: 0 0 14px; }
.as-empty .lb-btn { min-height: 44px; }
.as-msg p { margin: 0; font-size: 14.5px; line-height: 1.7; overflow-wrap: anywhere; }
.as-msg.me { align-self: flex-start; max-width: 88%; padding: 9px 13px; border-radius: 16px; border-start-start-radius: 6px; background: var(--bg); }
.as-msg.ai { color: var(--ink); }
.as-msg.err p { color: var(--danger); }
.as-card { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.as-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.as-card li { position: relative; padding-inline-start: 18px; line-height: 1.6; }
.as-card li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.as-card li.no { color: var(--ink-2); }
.as-card li.no::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.as-undo { margin-top: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font-weight: 600; }
.as-undo:hover:not(:disabled) { background: var(--bg); }
.as-undo:disabled { color: var(--ink-2); cursor: default; }
.as-dots { display: inline-flex; gap: 5px; padding: 6px 0; }
.as-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: lb-pulse 1s ease-in-out infinite; }
.as-dots i:nth-child(2) { animation-delay: .15s; }
.as-dots i:nth-child(3) { animation-delay: .3s; }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.as-chips[hidden] { display: none; }
.as-chips button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 13px; }
.as-chips button:hover { border-color: var(--accent); color: var(--ink); }
.as-form { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px 12px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.as-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #2a6b8026; }
.as-form textarea { flex: 1; min-height: 40px; max-height: 160px; resize: none; border: 0; outline: 0; padding: 9px 8px; background: transparent; color: var(--ink); font: inherit; font-size: 15px; line-height: 1.5; }
.as-send { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; }
.as-send:disabled { opacity: .5; cursor: default; }
.as-send svg { transform: scaleX(-1); }
@media (max-width: 860px) {
  .lab.assist-open .lb-circuit { flex-basis: 52%; }
  .lb-code-head .lb-btn.asst span { display: inline; }
  .lb-code-head .lb-btn.asst { min-height: 40px; }
  .lb-assist { position: fixed; inset: auto 0 0 0; z-index: 60; height: 78vh; min-width: 0; border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -20px 60px -20px #0b123059; }
  .lb-assist > header { min-height: 56px; }
  .as-form { margin-bottom: max(12px, env(safe-area-inset-bottom)); }
  .as-form textarea { font-size: 16px; }
}
/* ملاحظة خاصة باللوحة بنافذة الرفع (ESP32-CAM، Pro Mini، Leonardo) */
.lb-up .lb-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); color: var(--ink-2); font-size: 13.5px; line-height: 1.7; }

/* تبويب المكتبات: حالة كل مكتبة بيستعملها السكتش */
.lb-libs { overflow: auto; padding: 14px 16px; }
.lb-libs-empty, .lb-libs-note { color: #6b7280; font-size: 14px; line-height: 1.7; margin: 4px 0; }
.lb-libs-note { margin-top: 12px; }
.lb-libs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lb-libs-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fafafa;
}
.lb-libs-list code { font-size: 14px; font-weight: 600; }
.lb-libs-list span { font-size: 13px; color: #4b5563; }
.lb-libs-list li::before { content: ''; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lb-libs-list li.ok::before   { background: #1f9b76; }
.lb-libs-list li.warn::before { background: #e0922f; }
.lb-libs-list li.bad::before  { background: #c9333d; }
.lb-libs-list li.warn { background: #fff8ee; border-color: #f0dcc0; }
.lb-libs-list li.bad  { background: #fdf2f3; border-color: #f0cdd1; }

/* ===== مخطط التوصيل: شاشة وطباعة ===== */
.ws { padding: 18px 20px; color: #1f2937; }
.ws-head h2 { margin: 0 0 4px; font-size: 22px; }
.ws-head p { margin: 0 0 16px; color: #6b7280; font-size: 14px; }
.ws h3 { margin: 22px 0 6px; font-size: 17px; border-bottom: 2px solid #e5e7eb; padding-bottom: 6px; }
.ws-hint, .ws-empty { color: #6b7280; font-size: 13px; margin: 2px 0 12px; }
.ws-circuit { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; overflow: hidden;
  max-height: 440px; background: #fbfbfa; position: relative; }

.ws-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ws-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid #e5e7eb;
  border-radius: 12px; padding: 10px 12px; background: #fff; break-inside: avoid; }
.ws-art { flex: none; width: 76px; height: 76px; display: grid; place-items: center; overflow: hidden; }
.ws-art > * { max-width: 72px; max-height: 72px; transform: none !important; position: static !important; }
.ws-card-b { min-width: 0; }
.ws-card h4 { margin: 0 0 6px; font-size: 14px; }
.ws-card h4 small { color: #9ca3af; font-weight: 400; }
.ws-pins { display: flex; flex-wrap: wrap; gap: 5px; }
.ws-pin { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid #e5e7eb; background: #f7f7f6; font-size: 11px; color: #9ca3af; }
.ws-pin b { font-weight: 700; }
.ws-pin i { font-style: normal; font-size: 10px; }
.ws-pin.on { background: #e9f6f1; border-color: #9fd4c2; color: #15604a; }

.ws-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.ws-tbl th { text-align: right; padding: 7px 8px; background: #f7f7f6; border-bottom: 2px solid #e5e7eb; font-size: 12px; color: #4b5563; }
.ws-tbl td { padding: 7px 8px; border-bottom: 1px solid #f0f0ee; vertical-align: top; }
.ws-tbl tr { break-inside: avoid; }
.ws-tbl code { font-size: 12px; color: #374151; }
.ws-tbl i { font-style: normal; color: #9ca3af; font-size: 11px; }
.ws-n { color: #9ca3af; width: 28px; }
.ws-ar { color: #9ca3af; width: 22px; text-align: center; }
.ws-dot { display: inline-block; width: 15px; height: 15px; border-radius: 50%; border: 1px solid #0002; }
.ws-foot { margin-top: 20px; padding-top: 10px; border-top: 1px solid #e5e7eb; color: #9ca3af; font-size: 12px; }

@media print {
  body.wm-open > *:not(.lb-wmapbox) { display: none !important; }
  body.wm-open .lb-wmapbox { position: static !important; display: block !important; background: none !important; }
  body.wm-open .lb-wmapbox .lb-dialog { box-shadow: none !important; border: 0 !important; max-width: none !important;
    width: auto !important; max-height: none !important; }
  body.wm-open .lb-wmapbox header { display: none !important; }
  .ws-card, .ws-tbl tr, .ws-circuit { break-inside: avoid; }
}

/* الدارة بالورقة: لوحة قراءة مركّبة بنفس محرّك الرسم */
.ws-circuit { height: 380px; }
.ws-circuit .cv-world { transform-origin: 0 0; }

/* ===== مفتاح وضع العمل ===== */
.lb-wmode { display: inline-flex; background: #eef0ef; border-radius: 999px; padding: 3px; gap: 2px; }
.lb-wmode button { border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px;
  padding: 5px 13px; border-radius: 999px; color: #6b7280; white-space: nowrap; }
.lb-wmode button.on { background: #fff; color: #15604a; font-weight: 600; box-shadow: 0 1px 3px #0001; }

/* ===== حالات القطع: الموصولة بتضوي والباقي باهت ===== */
.cv-part { transition: opacity .18s, filter .18s; }
.cv-part[data-state="off"] { opacity: .45; filter: grayscale(.6); }
.cv-part[data-state="notready"] { opacity: .72; filter: grayscale(.25); }
.cv-part[data-state="nosim"] { opacity: .78; }
.cv-part[data-state="unknown"] { opacity: .45; filter: grayscale(.6); }
.cv-part[data-state="active"], .cv-part[data-state="ready"] { opacity: 1; filter: none; }

/* شارة صغيرة بزاوية القطعة بتقول حالتها */
.cv-part[data-state="error"]::after,
.cv-part[data-state="notready"]::after {
  content: ''; position: absolute; top: -4px; inset-inline-end: -4px;
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 1px 2px #0003; pointer-events: none; z-index: 3;
}
.cv-part[data-state="notready"]::after { background: #e0922f; }
.cv-part[data-state="error"]::after    { background: #c9333d; }
.cv-part[data-state="error"] { outline: 2px dashed #c9333d; outline-offset: 3px; border-radius: 6px; }

/* وضع القطع الحقيقية: اللوحة بتهدى عشان الانتباه يروح للرفع والمخطط */
.real-mode .lb-canvas { background-image: none; }

/* اللوحة ولوحة التجارب: قطع حاملة بلا شارة حالة */
.cv-part[data-state="passive"] { opacity: 1; filter: none; }

/* ===================================================================
   وضع ليلي للمختبر. الفاتح هو الافتراضي بـ.lab؛ هون منكمّل متغيّرات
   الكونسول والمحرّر اللي كانت مكتوبة باليد، وبعدها لوحة الليلي.
   =================================================================== */

.lab {
  --con-bg: #0f1720; --con-bar: #0b1219; --con-fg: #d7e3ee;
  --con-tab: #8fa3b6; --con-tab-on: #e8f1f8; --con-dim: #9fb3c6; --con-ok: #6ee7b7;
  --cm-bg: #ffffff; --cm-fg: #1f2d3d; --cm-gutter: #f6f8fa; --cm-line: #e3e9ef;
  --cm-lineno: #9aa8b6; --cm-active: #f3f8fb; --cm-sel: #cfe4f3; --cm-flash: #e2eaee;
  --cm-kw: #7c4dff; --cm-type: #0b7d8c; --cm-num: #c2410c; --cm-str: #2e7d32;
  --cm-cmt: #8a97a6; --cm-fn: #1d4ed8; --cm-pre: #b45309;
}

.lab[data-theme="dark"] {
  --ink: #e3edf5; --ink-2: #a9bccb; --muted: #7f94a6; --line: #2a3a49;
  --bg: #0d151d; --panel: #141f29; --accent: #35b9a8; --accent-2: #4fd0bd;
  --danger: #f07070; --warn: #e0a84a; --circuit: 0.42;
  --con-bg: #0a1118; --con-bar: #070d13; --con-fg: #d7e3ee;
  --cm-bg: #111a23; --cm-fg: #dbe6f0; --cm-gutter: #0d151d; --cm-line: #243341;
  --cm-lineno: #5d7a8f; --cm-active: #17242f; --cm-sel: #27425a; --cm-flash: #1d3346;
  --cm-kw: #b78bff; --cm-type: #4fd0bd; --cm-num: #f0a060; --cm-str: #8fd98f;
  --cm-cmt: #6b7f91; --cm-fn: #6fa8ff; --cm-pre: #e0b45a;
  color-scheme: dark;
}

/* الكونسول والمحرّر كانت ألوانهم ثابتة — صاروا يتبعوا الثيم */
.lb-console { background: var(--con-bg); color: var(--con-fg); }
.lb-tabs { background: var(--con-bar); }
.lb-tabs button[role=tab] { color: var(--con-tab); }
.lb-tabs button[role=tab].on { background: var(--con-bg); color: var(--con-tab-on); }
.lb-tabs .lb-clear { color: var(--con-tab); }
.lb-build pre { color: var(--con-dim); }
.lb-build .ok { color: var(--con-ok); }

/* بالوضع الليلي: لوحة الدارة والقطع تهدى شوي عشان ما تبهر العين */
.lab[data-theme="dark"] .lb-canvas { background-color: var(--bg); }
.lab[data-theme="dark"] .cv-part { filter: brightness(.94); }

/* زر الوضع: شمس/قمر متل باقي الموقع */
.lb-tb.lb-dark .sun { display: none; }
.lab[data-theme="dark"] .lb-tb.lb-dark .sun { display: block; }
.lab[data-theme="dark"] .lb-tb.lb-dark .moon { display: none; }

/* ===== ربط الأجهزة ===== */
.lb-iot { padding: 16px 18px; display: grid; gap: 14px; }
.io-msg, .io-note { color: var(--ink-2); font-size: 13.5px; line-height: 1.7; margin: 0; }
.io-note { font-size: 12.5px; color: var(--muted); }
.io-list { display: grid; gap: 10px; }
.io-dev { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  background: var(--bg); display: grid; gap: 10px; }
.io-dev-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.io-dev-h b { font-size: 15px; }
.io-seen { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.io-seen::before { content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); opacity: .5; }
.io-seen.on::before { background: var(--accent); opacity: 1; }
.io-row { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.io-pub { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.io-pub input { font: 12.5px/1.4 "JetBrains Mono", Menlo, monospace; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); }
.io-new { display: flex; gap: 8px; }
.io-new input { flex: 1; font: inherit; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--panel); color: var(--ink); }

/* ===== لوحة القراءات ===== */
.lb-data { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.rd-src, .rd-note { color: var(--con-tab); font-size: 12.5px; margin: 0; }
.rd-empty { color: var(--con-tab); font-size: 13px; line-height: 1.9; margin: auto 0; text-align: center; }
.rd-empty code { background: #ffffff14; padding: 2px 7px; border-radius: 7px; font-size: 12px; }
.rd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.rd-card { background: #ffffff0f; border: 1px solid #ffffff14; border-radius: 13px;
  padding: 10px 12px; display: grid; gap: 3px; }
.rd-card h5 { margin: 0; font-size: 12px; font-weight: 600; color: var(--con-tab); }
.rd-card b { font: 700 22px/1.2 "JetBrains Mono", Menlo, monospace; color: var(--con-tab-on); direction: ltr; }
.rd-card span { font-size: 11px; color: var(--con-tab); }
.rd-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-dev { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid #ffffff20; background: #ffffff10; color: var(--con-fg); }
.rd-cmd { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.rd-cmd input { font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 10px;
  border: 1px solid #ffffff20; background: #ffffff10; color: var(--con-fg); }
.rd-cmd input[name=k] { flex: 1; min-width: 150px; }
.rd-cmd input[name=v] { width: 78px; direction: ltr; }
.rd-cmd .lb-btn { background: #ffffff14; border-color: #ffffff22; color: var(--con-fg); }
