:root {
  --bg: #0d1117;
  --panel: #131922;
  --panel-2: #1a2230;
  --line: #263041;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #ff7a45;
  --accent-ink: #1a0d06;
  --on: #ff6a3d;
  --on-glow: rgba(255, 106, 61, 0.45);
  --off: #3b4658;
  --ok: #3fb950;
  --warn: #e3b341;
  --danger: #f85149;
  --canvas: #0a0e14;
  --grid: #1c2533;
  --chip-ink: #ffffff;
  --lamp-off: #252e3c;
  --lamp-on: #ffcf5c;
  --code: #1f2836;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f4f1ea;
    --panel: #fbfaf6;
    --panel-2: #f0ece3;
    --line: #ddd6c8;
    --text: #1d2330;
    --muted: #6a7282;
    --accent: #e8561f;
    --accent-ink: #ffffff;
    --on: #e8561f;
    --on-glow: rgba(232, 86, 31, 0.3);
    --off: #b9b2a4;
    --canvas: #f7f4ee;
    --grid: #dcd5c7;
    --lamp-off: #e3ddd1;
    --lamp-on: #ffb703;
    --code: #efe9dd;
    --shadow: 0 10px 40px rgba(60, 40, 10, 0.18);
    color-scheme: light;
  }
}

/* Tema düğmesiyle açık tema seçildiyse (sistem koyu olsa bile). */
:root[data-theme='light'] {
  --bg: #f4f1ea;
  --panel: #fbfaf6;
  --panel-2: #f0ece3;
  --line: #ddd6c8;
  --text: #1d2330;
  --muted: #6a7282;
  --accent: #e8561f;
  --accent-ink: #ffffff;
  --on: #e8561f;
  --on-glow: rgba(232, 86, 31, 0.3);
  --off: #b9b2a4;
  --canvas: #f7f4ee;
  --grid: #dcd5c7;
  --lamp-off: #e3ddd1;
  --lamp-on: #ffb703;
  --code: #efe9dd;
  --shadow: 0 10px 40px rgba(60, 40, 10, 0.18);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 Inter, 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* Dokunmatik ekranda 16 pikselden küçük kutuya dokununca iOS sayfayı yakınlaştırır. */
@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 6px 12px;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
button:hover:not(:disabled) {
  border-color: var(--muted);
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
button.primary:hover:not(:disabled) {
  filter: brightness(1.08);
  border-color: var(--accent);
}
button.ghost {
  background: transparent;
  border-color: transparent;
}
button.ghost:hover:not(:disabled) {
  background: var(--panel-2);
  border-color: var(--line);
}
button.danger {
  color: var(--danger);
}
button.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
button.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
button.small,
.small {
  font-size: 12px;
}
.muted {
  color: var(--muted);
}

code,
pre {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
code {
  background: var(--code);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
}
pre {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  margin: 10px 0;
}

/* ---------- layout ---------- */

.app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  min-height: 56px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.logo-chip {
  fill: var(--accent);
}
.logo-pin rect {
  fill: var(--muted);
}
.logo-core {
  fill: var(--accent-ink);
  opacity: 0.85;
}
.seg {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  border-radius: 7px;
  color: var(--muted);
}
.seg button.on {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 0 var(--line);
}
.actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.clock-ctl {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid var(--line);
}
.clock-ctl select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
}
.clock-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--off);
}
.clock-led.on {
  background: var(--on);
  box-shadow: 0 0 8px var(--on-glow);
}

.body {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr 270px;
  min-height: 0;
}
.left,
.side {
  background: var(--panel);
  min-height: 0;
  overflow: hidden;
}
.left {
  border-right: 1px solid var(--line);
}
.side {
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 14px;
}
.center {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  min-height: 0;
}
.canvas-wrap {
  position: relative;
  min-height: 0;
}

/* ---------- lesson panel ---------- */

.lesson {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.lesson-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.lesson-picker {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border-color: transparent;
  padding: 4px;
}
.progress {
  display: flex;
  gap: 3px;
}
.progress i {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.progress i.done {
  background: var(--ok);
}
.progress i.cur {
  outline: 1.5px solid var(--accent);
  outline-offset: 1px;
}
.lesson-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  max-height: 50%;
  overflow-y: auto;
}
.lesson-list button {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 7px 8px;
  align-items: center;
}
.lesson-list button.active,
.lesson-list button:hover {
  background: var(--panel-2);
}
.lesson-list b {
  display: block;
  font-weight: 600;
}
.lesson-list small {
  color: var(--muted);
}
.num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.num.done {
  background: var(--ok);
  border-color: var(--ok);
  color: #04130a;
}
.lesson-scroll {
  overflow-y: auto;
  padding: 16px 18px 40px;
  flex: 1;
}
.lesson-scroll h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.lesson-scroll h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 22px 0 8px;
}
.lesson-scroll p {
  margin: 8px 0;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  vertical-align: middle;
}
.badge.ok {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
}
.note {
  border-left: 3px solid var(--accent);
  background: var(--panel-2);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
}
.note.warn {
  border-left-color: var(--warn);
}
.goal {
  margin-top: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border-radius: 10px;
  padding: 10px 12px;
}
.goal-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.hint {
  margin: 10px 0;
  color: var(--muted);
}
.hint summary {
  cursor: pointer;
  user-select: none;
}
.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.result {
  margin-top: 14px;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}
.result.ok {
  border-color: color-mix(in srgb, var(--ok) 60%, var(--line));
  background: color-mix(in srgb, var(--ok) 8%, var(--panel));
}
.result.bad {
  border-color: color-mix(in srgb, var(--danger) 60%, var(--line));
  background: color-mix(in srgb, var(--danger) 7%, var(--panel));
}
.result-title {
  font-weight: 700;
}
.result ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.ideas {
  padding-left: 18px;
}
.ideas li {
  margin: 4px 0;
}
.chip-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.chip-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.chip-list li .ghost {
  margin-left: auto;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
  display: inline-block;
}
.keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 13px;
}
.keys dt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
}
.keys dd {
  margin: 0;
}

/* ---------- side panel ---------- */

.side section {
  margin-bottom: 18px;
}
.side h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 8px;
}
.table-wrap {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tt {
  border-collapse: collapse;
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  text-align: center;
}
.tt th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  font-weight: 600;
  padding: 5px 6px;
  font-family: Inter, 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 12px;
  white-space: nowrap;
}
.tt td {
  padding: 3px 6px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.tt td.one {
  color: var(--text);
  font-weight: 700;
}
.tt td.out.one {
  color: var(--on);
}
.tt .sep {
  width: 2px;
  padding: 0;
  background: var(--line);
}
.tt tr.cur td {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.stats {
  display: flex;
  gap: 10px;
}
.stats div {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}
.stat {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.inspector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.insp-type {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}
.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
  color: var(--text);
}
.field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-color: var(--accent);
}
.row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.row.end {
  justify-content: flex-end;
  margin-top: 14px;
}

/* ---------- palette ---------- */

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  align-items: center;
  position: relative;
}
.pal-item {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 12px;
}
.pal-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--chip);
}
.pal-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  padding-left: 10px;
}

/* ---------- canvas ---------- */

.canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--canvas);
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.canvas:active {
  cursor: grabbing;
}
.canvas.wiring {
  cursor: crosshair;
}
.grid-dot {
  fill: var(--grid);
}
.empty {
  position: absolute;
  inset: auto 0 24px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.flag {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--warn) 20%, var(--panel));
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent);
}

.wire .wire-line {
  fill: none;
  stroke: var(--off);
  stroke-width: 3;
  stroke-linecap: round;
}
/* Parlama için SVG filtresi kullanılmıyor: saatli devrelerde teller saniyede onlarca kez
   yanıp söner ve filtre her seferinde pahalı bir yeniden boyama yaptırır. */
.wire.on .wire-line {
  stroke: var(--on);
}
.wire.selected .wire-line {
  stroke-width: 5;
  stroke-dasharray: 8 5;
}
.wire .wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  cursor: pointer;
}
.wire:hover .wire-line {
  stroke-width: 4.5;
}
path.wire.pending {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
  pointer-events: none;
}

.node {
  cursor: move;
}
.chip-body {
  fill: var(--chip);
  stroke: color-mix(in srgb, var(--chip) 60%, #000);
  stroke-width: 1.5;
}
.chip-body.missing {
  fill: #444;
  stroke-dasharray: 4 3;
}
.node.selected .chip-body,
.node.selected .switch-body,
.node.selected .display-body,
.node.selected .clock-body {
  stroke: var(--text);
  stroke-width: 2.5;
}
.node.selected .lamp {
  stroke: var(--text);
  stroke-width: 2.5;
}
.chip-name {
  fill: var(--chip-ink);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.pin-label {
  fill: var(--chip-ink);
  opacity: 0.85;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none;
}
.node-display .pin-label {
  fill: var(--muted);
}
.io-label {
  fill: var(--text);
  font-weight: 600;
  font-size: 14px;
  pointer-events: none;
}
.bit-label {
  fill: var(--muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none;
}

.switch-body {
  fill: var(--panel-2);
  stroke: var(--line);
  stroke-width: 1.5;
  cursor: pointer;
}
.switch-track {
  fill: var(--off);
  pointer-events: none;
}
.switch-body.on + .switch-track {
  fill: var(--on);
}
.switch-knob {
  fill: #fff;
  pointer-events: none;
  transition: cx 0.12s;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.node-switch {
  cursor: pointer;
}

.lamp {
  fill: var(--lamp-off);
  stroke: var(--line);
  stroke-width: 1.5;
  transition: fill 0.1s;
}
.lamp.on {
  fill: var(--lamp-on);
  stroke: color-mix(in srgb, var(--lamp-on) 60%, #000);
}
.lamp-glow {
  fill: transparent;
  pointer-events: none;
}
.lamp-glow.on {
  fill: var(--lamp-on);
  opacity: 0.22;
  filter: blur(4px);
}
.lamp-bit {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  fill: var(--muted);
  pointer-events: none;
}
.lamp.on + .lamp-bit,
.lamp-bit.on {
  fill: #3a2600;
}

.clock-body {
  fill: var(--panel-2);
  stroke: var(--line);
  stroke-width: 1.5;
}
.clock-wave {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  pointer-events: none;
}
.clock-body.on + .clock-wave {
  stroke: var(--on);
}

.display-body {
  fill: var(--panel-2);
  stroke: var(--line);
  stroke-width: 1.5;
}
.display-screen {
  fill: #05080c;
}
.display-digit {
  fill: #5ad8ff;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 40px;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(90, 216, 255, 0.5));
}

.pin {
  cursor: crosshair;
}
.pin-hit {
  fill: transparent;
}
/* Teller ve pinler saatli devrelerde saniyede onlarca kez değişir; geçiş animasyonu kullanılmaz. */
.pin-dot {
  fill: var(--bg);
  stroke: var(--off);
  stroke-width: 2;
}
.pin.on .pin-dot {
  fill: var(--on);
  stroke: var(--on);
}
.pin:hover .pin-dot,
.pin.hot .pin-dot {
  stroke: var(--accent);
  stroke-width: 3;
}

/* ---------- modal ---------- */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(460px, 100%);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  max-height: 100%;
  overflow: auto;
}
.modal.wide {
  width: min(1000px, 100%);
}
.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.modal h2 {
  margin: 0;
  font-size: 18px;
}
.viewer-canvas {
  height: min(60vh, 520px);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.color {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  padding: 0;
  border: 2px solid transparent;
}
.color.sel {
  border-color: var(--text);
}
.pin-preview {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
  font-size: 13px;
}
.pin-preview > div:not(.chip-mini) {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pin-preview > div:last-child {
  text-align: right;
}
.chip-mini {
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  padding: 18px 16px;
  min-width: 90px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 60;
  font-weight: 500;
  max-width: calc(100% - 32px);
}

/* ---------- dar ekran ---------- */

@media (max-width: 960px) {
  .body {
    grid-template-columns: 260px 1fr;
  }
  .side {
    display: none;
  }
}
@media (max-width: 760px) {
  .app {
    grid-template-rows: auto 1fr;
  }
  .topbar {
    flex-wrap: wrap;
    padding: 8px 16px;
    gap: 8px;
  }
  .actions {
    width: 100%;
    margin-left: 0;
  }
  .body {
    grid-template-columns: 1fr;
    grid-template-rows: 45% 55%;
  }
  .left {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* ---------- güç işaretleri (NAND) ---------- */

.power-stubs line {
  stroke: var(--muted);
  stroke-width: 1.5;
}
.power-stubs text {
  fill: var(--on);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- transistör laboratuvarı ---------- */

:root {
  --gnd: #5b9cff;
  --short: #ff4d4f;
}
.body.lab-mode {
  grid-template-columns: minmax(300px, 360px) 1fr;
}
.lab-center {
  display: block;
  overflow: auto;
  background: var(--canvas);
}
.lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 16px;
  min-height: 100%;
}
.lab-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.lab-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lab-inputs p {
  margin: 0;
  flex: 1;
  min-width: 180px;
}
.lab-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
}
.lab-toggle-val {
  font-family: 'JetBrains Mono', monospace;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--off);
  color: var(--text);
}
.lab-toggle.on .lab-toggle-val {
  background: var(--on);
  color: var(--accent-ink);
}
.lab-svg {
  width: 100%;
  max-height: calc(100vh - 220px);
  min-height: 360px;
}
.lab-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
}
.lg {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}
.lg.vdd {
  background: var(--on);
}
.lg.gnd {
  background: var(--gnd);
}
.lg.short {
  background: var(--short);
}
.lg.float {
  background: repeating-linear-gradient(90deg, var(--off) 0 4px, transparent 4px 7px);
}
.rail,
.lnet {
  stroke-width: 4;
  stroke-linecap: round;
}
.rail {
  stroke-width: 6;
}
.vdd {
  stroke: var(--on);
}
.gnd {
  stroke: var(--gnd);
}
.short {
  stroke: var(--short);
}
.float {
  stroke: var(--off);
  stroke-dasharray: 5 5;
}
.rail-label {
  font-size: 13px;
  font-weight: 600;
  fill: var(--text);
  stroke: none;
}
.rail-label.vdd {
  fill: var(--on);
}
.rail-label.gnd {
  fill: var(--gnd);
}
.net-label {
  font-size: 13px;
  font-weight: 700;
  fill: var(--muted);
}
.net-label.sub {
  font-weight: 400;
  font-size: 11px;
}
.ndot {
  stroke-width: 2;
}
.ndot.vdd {
  fill: var(--on);
}
.ndot.gnd {
  fill: var(--gnd);
}
.ndot.short {
  fill: var(--short);
}
.ndot.float {
  fill: var(--off);
  stroke-dasharray: none;
}
.channel {
  stroke-width: 5;
  stroke-linecap: round;
}
.channel.off {
  stroke: var(--muted);
  stroke-width: 3;
}
.channel.on.float {
  stroke-dasharray: none;
}
.term {
  fill: var(--panel);
  stroke: var(--muted);
  stroke-width: 1.5;
}
.gate-plate {
  stroke: var(--muted);
  stroke-width: 4;
  stroke-linecap: round;
}
.gate-lead {
  stroke: var(--muted);
  stroke-width: 2;
}
.gate-plate.hi,
.gate-lead.hi {
  stroke: var(--text);
}
.bubble {
  fill: var(--canvas);
  stroke: var(--muted);
  stroke-width: 2;
}
.gate-in {
  fill: var(--panel-2);
  stroke: var(--line);
}
.gate-in.hi {
  fill: var(--text);
}
.gate-name {
  font-weight: 700;
  font-size: 12px;
  fill: var(--text);
}
.gate-in.hi + .gate-name {
  fill: var(--bg);
}
.mos-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
}
.mos-state {
  font-size: 11px;
  fill: var(--muted);
}
.mos-state.on {
  fill: var(--ok);
}
.lab-lamp {
  fill: var(--lamp-off);
  stroke: var(--line);
  stroke-width: 2;
}
.lab-lamp.on {
  fill: var(--lamp-on);
  filter: drop-shadow(0 0 10px var(--on-glow));
}
.lab-lamp.short {
  fill: var(--short);
  animation: blink 0.5s steps(2) infinite;
}
.lab-lamp.float {
  stroke-dasharray: 5 4;
  stroke: var(--muted);
}
.lab-lamp-text {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 20px;
  fill: var(--text);
}
.lab-lamp.on + .lab-lamp-text {
  fill: #3a2600;
}
.lab-alert {
  fill: var(--short);
  font-weight: 800;
  font-size: 14px;
}
.lab-warn {
  fill: var(--warn);
  font-weight: 700;
  font-size: 13px;
}
@keyframes blink {
  50% {
    opacity: 0.45;
  }
}
.lab-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lab-controls h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 6px 0 0;
}
.picker {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.seg.small button {
  flex: 1;
  font-size: 12.5px;
  padding: 5px 8px;
}
.lab-tt td.bad {
  color: var(--short);
  font-weight: 700;
}
.lab-tt {
  border: 1px solid var(--line);
  border-radius: 8px;
}
@media (max-width: 1100px) {
  .body.lab-mode {
    grid-template-columns: 320px 1fr;
  }
  .lab {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .body.lab-mode {
    grid-template-columns: 1fr;
  }
}

/* ---------- fiziksel bağlantı görünümü ---------- */

.view-seg {
  margin-left: auto;
}
.phys {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.phys-svg {
  width: 100%;
  max-height: calc(100vh - 260px);
  min-height: 340px;
}
.pw {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.leg {
  stroke-width: 3.5;
  stroke-linecap: round;
}
.leg.gate {
  stroke: var(--gnd);
}
.leg.gate.hi {
  stroke: var(--on);
}
.gate-pad {
  fill: var(--gnd);
}
.gate-pad.hi {
  fill: var(--on);
}
.gate-wire {
  fill: none;
  stroke: var(--gnd);
  stroke-width: 2.5;
  stroke-linejoin: round;
  opacity: 0.85;
}
.gate-wire.hi {
  stroke: var(--on);
}
.jdot.vdd {
  fill: var(--on);
}
.jdot.gnd {
  fill: var(--gnd);
}
.jdot.short {
  fill: var(--short);
}
.jdot.float {
  fill: var(--off);
}
.jdot {
  stroke: none;
}
.phys-label {
  font-size: 15px;
  font-weight: 600;
  fill: var(--text);
}
.phys-label.vdd {
  fill: var(--on);
  stroke: none;
}
.phys-label.gnd {
  fill: var(--gnd);
  stroke: none;
}
.phys-sub {
  font-size: 13.5px;
  fill: var(--muted);
}
.phys-alert {
  font-size: 15px;
  font-weight: 800;
  fill: var(--short);
  animation: blink 0.5s steps(2) infinite;
}
.bat-body {
  fill: #2a2a2a;
  stroke: #555;
}
.bat-top {
  fill: #d98b3a;
}
.bat-term {
  fill: #aaa;
}
.bat-plus,
.bat-minus {
  font-size: 22px;
  font-weight: 800;
  fill: #fff;
}
.bat-v {
  font-size: 13px;
  font-weight: 800;
  fill: #ddd;
  letter-spacing: 0.1em;
}
.led {
  fill: #5a1d1d;
  stroke: #8a3b3b;
  stroke-width: 1.5;
  transition: fill 0.15s;
}
.led.on {
  fill: #ff3b3b;
  stroke: #ff8080;
}
.led.dim {
  fill: #a83232;
}
.led-rim {
  fill: #6b2a2a;
}
.led-rim.on {
  fill: #ff5a5a;
}
.led-glow {
  fill: transparent;
}
.led-glow.on {
  fill: rgba(255, 60, 60, 0.35);
  filter: blur(8px);
}
.led-glow.dim {
  fill: rgba(255, 60, 60, 0.12);
  filter: blur(6px);
}
.pkg-body {
  fill: #18191c;
  stroke: #3d4250;
  stroke-width: 1.5;
}
.pkg-body.p {
  stroke: #a678ff;
}
.pkg-body.n {
  stroke: #4ec9b0;
}
.pkg-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  fill: #c9ced8;
}
.contact {
  fill: #9aa3b2;
}
.bridge {
  fill: var(--ok);
}
.bridge.flowing {
  fill: #4ade80;
  filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.8));
}
.gap-txt {
  font-size: 11px;
  fill: #7d8597;
}
.leg-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  fill: var(--text);
}
.leg-in {
  font-size: 15px;
  font-weight: 700;
  fill: var(--muted);
}
.pkg-rule {
  font-size: 13.5px;
  fill: var(--muted);
}
.pkg-state {
  font-size: 14px;
  font-weight: 600;
  fill: var(--muted);
}
.pkg-state.on {
  fill: var(--ok);
}
.phys-switch {
  cursor: pointer;
}
.sw-body {
  fill: var(--panel-2);
  stroke: var(--line);
  stroke-width: 1.5;
}
.sw-body.on {
  stroke: var(--on);
}
.sw-name {
  font-size: 18px;
  font-weight: 800;
  fill: var(--text);
}
.sw-track {
  fill: var(--gnd);
}
.sw-track.on {
  fill: var(--on);
}
.sw-knob {
  fill: #fff;
  transition: cx 0.12s;
}
.flow {
  fill: none;
  stroke: #4ade80;
  stroke-width: 2.5;
  stroke-dasharray: 7 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: flow 0.7s linear infinite;
  pointer-events: none;
}
.flow.hot {
  stroke: #fde047;
  animation-duration: 0.25s;
}
@keyframes flow {
  to {
    stroke-dashoffset: -16;
  }
}
@media (prefers-reduced-motion: reduce) {
  .flow,
  .phys-alert,
  .lab-lamp.short {
    animation: none;
  }
}
.lg.flowing {
  background: repeating-linear-gradient(90deg, #4ade80 0 6px, transparent 6px 10px);
}
.phys-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px 16px;
  font-size: 13px;
}
.phys-notes .note {
  grid-column: 1 / -1;
  margin: 0;
}

/* ---------- kablo kırılımları ---------- */

.canvas-host {
  position: relative;
  width: 100%;
  height: 100%;
}
.wire .wire-sheath {
  fill: none;
  stroke: var(--canvas);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wire .wire-line {
  stroke-linejoin: round;
}
.wire-handle {
  fill: var(--panel);
  stroke: var(--accent);
  stroke-width: 2.5;
  cursor: move;
}
.wire-handle:hover {
  fill: var(--accent);
}
.pending-dot {
  fill: var(--accent);
  pointer-events: none;
}
.canvas-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.canvas-hint b {
  color: var(--text);
  font-weight: 600;
}
.wire-style button {
  padding: 4px 10px;
}
.seg button {
  white-space: nowrap;
}
.field select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
  color: var(--text);
}
.field small {
  font-size: 11.5px;
  line-height: 1.4;
}
.clock-hz {
  font-size: 10.5px;
}

/* ---------- dar masaüstü düzeltmeleri ---------- */
.topbar button {
  white-space: nowrap;
}
.actions > * {
  flex: none;
}
.brand span {
  white-space: nowrap;
}
@media (max-width: 1250px) and (min-width: 961px) {
  .body {
    grid-template-columns: 280px 1fr 240px;
  }
  .body.lab-mode {
    grid-template-columns: 280px 1fr;
  }
  .topbar {
    gap: 10px;
  }
  .brand span {
    display: none;
  }
}

/* ---------- palet koleksiyonları ---------- */

.pal-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 2px 4px;
}
.pal-group {
  position: relative;
}
.pal-coll {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
}
.pal-coll::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-top: 2px solid var(--muted);
  transform: rotate(-45deg) translate(-1px, 1px);
  margin-left: 2px;
}
.pal-coll.open {
  border-color: var(--accent);
  color: var(--accent);
}
.pal-coll.open::after {
  transform: rotate(135deg) translate(-1px, 1px);
}
.pal-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 99px;
  padding: 0 6px;
}
.pal-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 190px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.pal-pop .pal-item {
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
}
.pal-pop .pal-item:hover {
  background: var(--panel-2);
}

/* ---------- çok bitli pinler ve teller ---------- */

.pin.wide .pin-dot {
  stroke-width: 2.5;
}
.pin-bits {
  font-size: 7.5px;
  font-weight: 700;
  fill: var(--muted);
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.pin.on .pin-bits {
  fill: var(--accent-ink);
}
.wire.bus .wire-line {
  stroke-width: 5.5;
}
.wire.bus .wire-sheath {
  stroke-width: 10;
}
.wire.bus.selected .wire-line {
  stroke-width: 7;
}
.wire-badge rect {
  fill: var(--panel);
  stroke: var(--line);
}
.wire-badge.on rect {
  stroke: var(--on);
}
.wire-badge text {
  font-size: 11px;
  font-weight: 700;
  fill: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.canvas-hint.warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 50%, transparent);
}
.value-label {
  font-size: 11px;
  font-weight: 700;
  fill: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none;
}

/* ---------- çok bitli giriş/çıkış ---------- */

.multi-body {
  fill: var(--panel-2);
  stroke: var(--line);
  stroke-width: 1.5;
}
.node.selected .multi-body,
.node.selected .key-body,
.node.selected .pulse-body,
.node.selected .tri-body,
.node.selected .bundle-bar,
.node.selected .bus-body {
  stroke: var(--text);
  stroke-width: 2.5;
}
.bit-cell rect {
  fill: var(--lamp-off);
  stroke: var(--line);
}
.node-in4 .bit-cell,
.node-in8 .bit-cell {
  cursor: pointer;
}
.bit-cell.on rect {
  fill: var(--on);
  stroke: var(--on);
}
.bit-cell text {
  font-size: 10px;
  font-weight: 700;
  fill: var(--muted);
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.bit-cell.on text {
  fill: var(--accent-ink);
}
.node-out4 .bit-cell.on rect,
.node-out8 .bit-cell.on rect {
  fill: var(--lamp-on);
  stroke: var(--lamp-on);
}

/* ---------- tuş, darbe, tampon, birleştir/ayır, veri yolu ---------- */

.key-body,
.pulse-body {
  fill: var(--panel-2);
  stroke: var(--line);
  stroke-width: 1.5;
}
.key-cap {
  fill: var(--panel);
  stroke: var(--line);
}
.key-body.on {
  stroke: var(--on);
}
.key-body.on + .key-cap {
  fill: var(--on);
  transform: translateY(2px);
}
.key-name {
  font-size: 13px;
  font-weight: 700;
  fill: var(--text);
  pointer-events: none;
}
.key-body.on ~ .key-name {
  fill: var(--accent-ink);
}
.key-body {
  cursor: pointer;
}
.key-hint {
  font-size: 9.5px;
  fill: var(--muted);
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.pulse-body.on {
  stroke: var(--on);
}
.pulse-body.on + .clock-wave {
  stroke: var(--on);
}
.part-hit {
  fill: transparent;
}
.tri-body {
  fill: #64748b;
  stroke: color-mix(in srgb, #64748b 60%, #000);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.tri-body.on {
  fill: #7c8ca3;
}
.tri-bits {
  font-size: 10px;
  font-weight: 700;
  fill: #fff;
  pointer-events: none;
}
.part-pin-label {
  font-size: 9px;
  fill: var(--muted);
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.bundle-bar {
  fill: #475569;
  stroke: color-mix(in srgb, #475569 60%, #000);
  stroke-width: 1.5;
}
.bundle-label {
  font-size: 8.5px;
  font-weight: 700;
  fill: #e2e8f0;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.bus-body {
  fill: #0e7490;
  stroke: #0ea5e9;
  stroke-width: 2;
}
.bus-body.on {
  fill: #0ea5e9;
}
.bus-bits {
  font-size: 10px;
  font-weight: 700;
  fill: #fff;
  pointer-events: none;
}

/* ---------- ekranlar ---------- */

.segment {
  fill: color-mix(in srgb, #ff3b30 10%, var(--panel));
  transition: fill 0.06s;
}
.segment.on {
  fill: #ff3b30;
  filter: drop-shadow(0 0 4px rgba(255, 59, 48, 0.6));
}
.dot {
  fill: color-mix(in srgb, #ffb703 8%, var(--panel));
}
.dot.on {
  fill: #ffb703;
  filter: drop-shadow(0 0 3px rgba(255, 183, 3, 0.6));
}
.rgb-screen {
  fill: #050608;
  stroke: var(--line);
}
.led {
  fill: color-mix(in srgb, var(--led) 22%, var(--panel-2));
  stroke: color-mix(in srgb, var(--led) 50%, #000);
  stroke-width: 1.5;
}
.led.on {
  fill: var(--led);
}
.led-glow {
  fill: transparent;
}
.led-glow.on {
  fill: var(--led);
  opacity: 0.3;
  filter: blur(5px);
}
.led-shine {
  fill: #fff;
  opacity: 0.35;
  pointer-events: none;
}
.node.selected .led {
  stroke: var(--text);
  stroke-width: 2.5;
}
.rom-line {
  font-size: 11px;
  font-weight: 700;
  fill: #e2e8f0;
  pointer-events: none;
  font-family: 'JetBrains Mono', monospace;
}
.rom-line.dim {
  opacity: 0.65;
  font-weight: 500;
}
.speaker {
  fill: #94a3b8;
}
.speaker.on {
  fill: var(--on);
}
.speaker-wave {
  fill: none;
  stroke: var(--on);
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---------- denetçi ve ROM düzenleyici ---------- */

.swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.swatch-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  background: var(--sw);
  border: 2px solid var(--line);
}
.swatch-btn.on {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--sw);
}
.key-input {
  text-align: center;
  font-weight: 700;
  cursor: pointer;
}
.key-input:focus {
  border-color: var(--accent);
}
.rom-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rom-editor .row {
  align-items: center;
}
.code-area {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--code);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  tab-size: 8;
}
.code-area:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- örnek devreler ---------- */

.examples {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.example-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 8px 10px;
  white-space: normal;
}
.example-btn b {
  font-size: 13px;
}

/* ---------- üst çubuk: ikonlu butonlar, kaymasız basış ---------- */

/* Basınca aşağı kayma, sığmayan çubukta titreme yapıyordu; üst çubukta renkle geri bildirim yeter. */
.topbar button:active:not(:disabled) {
  transform: none;
  filter: brightness(0.92);
}
.tb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}
.tb-icon {
  flex: none;
}
.tb-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button.tb.on {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}
.tb-short {
  display: none;
}
@media (max-width: 1450px) {
  .tb-label {
    display: none;
  }
  .tb {
    padding: 6px 8px;
  }
}
@media (max-width: 1100px) {
  .tb-long {
    display: none;
  }
  .tb-short {
    display: inline;
  }
  .clock-ctl .muted {
    display: none;
  }
}

/* ---------- tam ekran: sadece üst çubuk, tuval ve palet ---------- */

.body.focus,
.body.focus.lab-mode {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.body.focus > .left,
.body.focus > .side {
  display: none;
}
@media (max-width: 1250px) {
  .brand span {
    display: none;
  }
}

/* ---------- seçim: çerçeve, kaydırma imleci ---------- */

.canvas {
  cursor: default;
}
.canvas:active {
  cursor: default;
}
.canvas.pan-ready,
.canvas.pan-ready * {
  cursor: grab !important;
}
.canvas.pan-ready:active,
.canvas.pan-ready:active * {
  cursor: grabbing !important;
}
.marquee {
  fill: color-mix(in srgb, var(--accent) 10%, transparent);
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* ---------- sağ tık menüsü ---------- */

.ctx-menu {
  position: absolute;
  z-index: 40;
  min-width: 220px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  text-align: left;
  white-space: nowrap;
}
.ctx-item:hover {
  background: var(--panel-2);
}
.ctx-item:active:not(:disabled) {
  transform: none;
}
.ctx-item.danger {
  color: var(--danger);
}
.ctx-hint {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- düzenlenen çipi güncelle ---------- */

.linked {
  display: inline-flex;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.linked .update {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 10px;
  max-width: 260px;
}
.linked .update span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.linked .unlink {
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  padding: 6px 9px;
  font-size: 16px;
  line-height: 1;
}

/* ---------- canlı izleme paneli ---------- */

.live-panel {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 25;
  width: min(560px, calc(100% - 24px));
  height: min(420px, calc(100% - 24px));
  min-width: 300px;
  min-height: 220px;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  resize: both;
  direction: rtl; /* tutamaç sol altta: panel sağa yaslı olduğu için sola doğru büyür */
}
.live-panel > * {
  direction: ltr;
}
.live-panel header {
  cursor: move;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--line);
  min-height: 40px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--on);
  box-shadow: 0 0 8px var(--on-glow);
  flex: none;
  animation: live-pulse 1.4s ease-in-out infinite;
}
@keyframes live-pulse {
  50% {
    opacity: 0.35;
  }
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
}
.crumb {
  border: 0;
  background: transparent;
  padding: 3px 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.crumb:hover:not(:disabled) {
  color: var(--text);
  background: var(--panel-2);
}
.crumb.on,
.crumb:disabled {
  opacity: 1;
  color: var(--text);
  font-weight: 700;
}
.crumb-sep {
  color: var(--muted);
  font-size: 12px;
}
.live-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
}
.live-hint {
  margin: 0;
  padding: 5px 12px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

