@font-face {
  font-family: "Geist Pixel";
  src: url(/fonts/geist-pixel-square.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: PixelRu;
  font-weight: 500;
  src: url(/fonts/pixel-cyrillic-500.woff2) format("woff2");
  font-display: swap;
  unicode-range: U+0400-052F;
}
@font-face {
  font-family: JetBrains;
  src: url(/fonts/jetbrains-mono.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: JetBrains;
  src: url(/fonts/jetbrains-mono-cyrillic.woff2) format("woff2");
  font-display: swap;
  unicode-range: U+0400-052F;
}
:root {
  --bg: #f8f8f7;
  --grid: #d4d4d2;
  --ink: #1a1a1a;
  --paper: #fff;
  --soft: #efefed;
  --muted: #5e5e5b;
  --line: #747471;
  --border: #31312f;
  --inv: #fcfcfa;
  --shadow: #d1d1cd;
  --pixel: "Geist Pixel", PixelRu, monospace;
  --mono: JetBrains, "Courier New", monospace;
  color-scheme: light;
  font:
    16px Arial,
    Helvetica,
    sans-serif;
}
:root[data-theme="dark"] {
  --bg: #191919;
  --grid: #393939;
  --ink: #f2f2ef;
  --paper: #242424;
  --soft: #383838;
  --muted: #c1c1bc;
  --line: #a4a4a1;
  --border: #bdbdb8;
  --inv: #171717;
  --shadow: #080808;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
button,
input,
select,
a {
  font: inherit;
}
button,
a {
  color: inherit;
}
button {
  border: none;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 3px double var(--ink);
  outline-offset: 4px;
}
button {
  background: transparent;
}
.icon {
  width: 20px;
  height: 20px;
  display: block;
  flex: none;
}
#canvas {
  position: fixed;
  inset: 0;
  touch-action: none;
  overflow: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(
    circle,
    var(--grid) 1px,
    transparent 1.15px
  );
  background-size: 28px 28px;
  cursor: grab;
  user-select: none;
  transition: background-color 0.18s;
}
#canvas.dragging,
#canvas.dragging * {
  cursor: grabbing !important;
}
#world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
}
#wires {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}
.wire {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.55;
  transition: stroke 0.2s ease, stroke-width 0.2s ease, filter 0.2s ease;
}
.edge {
  transition: opacity 0.2s ease;
}
.path-focus .edge:not(.path-lit),
.path-focus .node:not(.path-before):not(.path-after) {
  opacity: 0.14;
}
.edge.path-lit .wire {
  stroke: var(--ink);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 2px color-mix(in srgb, var(--ink) 45%, transparent));
}
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 17;
  pointer-events: none;
}
.teacher .edge-hit {
  pointer-events: stroke;
  cursor: pointer;
}
.teacher .edge:hover .wire {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-dasharray: 4 3;
}
.space-switch {
  position: fixed;
  left: 28px;
  top: 26px;
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: 0 3px 0 var(--shadow);
  border-radius: 10px;
  padding: 9px 13px 9px 9px;
  min-height: 58px;
  max-width: calc(100vw - 36px);
}
.space-mark {
  background: var(--ink);
  color: var(--inv);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.space-mark .icon {
  width: 24px;
  height: 24px;
}
.space-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.space-copy small,
.eyebrow {
  font: 10px var(--mono);
  letter-spacing: 0.13em;
  color: var(--muted);
}
.space-copy strong {
  font: 500 18px/1 var(--pixel);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-switch > .space-copy + span {
  margin-left: 10px;
}
.space-switch > .space-copy + span .icon {
  width: 14px;
}
#cover {
  position: absolute;
  width: 300px;
  cursor: grab;
}
.hero-art {
  display: block;
  width: 164px;
  height: auto;
  margin: -4px 0 15px -9px;
  image-rendering: pixelated;
}
[data-theme="dark"] .hero-art {
  filter: invert(1);
}
.cover-kicker {
  font: 11px var(--mono);
  letter-spacing: 0.13em;
  color: var(--muted);
  display: flex;
  gap: 9px;
  align-items: center;
}
.cover-kicker:before {
  content: "";
  display: block;
  background: var(--ink);
  width: 18px;
  height: 2px;
}
h1 {
  font: 500 64px/0.93 var(--pixel);
  letter-spacing: -0.065em;
  margin: 12px 0 18px;
  overflow-wrap: anywhere;
}
.cover-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 12px var(--mono);
  color: var(--muted);
}
.cover-meta .icon {
  width: 15px;
  height: 15px;
}
.cover-meta b {
  height: 3px;
  width: 3px;
  background: currentColor;
}
.node {
  position: absolute;
  width: 271px;
  height: 176px;
  border: 1.4px solid var(--border);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 4px 0 var(--shadow);
  padding: 17px 20px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition:
    opacity 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease,
    background 0.2s ease;
}
.node:hover {
  box-shadow: 4px 5px 0 var(--line);
}
.node.start {
  background: var(--ink);
  color: var(--inv);
  border-color: var(--ink);
  box-shadow: 3px 4px 0 var(--shadow);
}
.node.path-before,
.node.path-after {
  border-color: var(--ink);
  box-shadow: 2px 3px 0 var(--line);
}
.node.path-before .port.out,
.node.path-after .port.in {
  background: var(--ink);
  border-color: var(--ink);
}
.node.path-selected {
  box-shadow: 0 0 0 2px var(--ink), 4px 6px 0 var(--shadow),
    0 4px 14px color-mix(in srgb, var(--ink) 18%, transparent);
  z-index: 1;
}
.node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 22px;
}
.badge {
  font: 500 12px/1 var(--pixel);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 4px;
  padding: 4px 7px 3px;
  color: var(--muted);
  background: var(--soft);
}
.start .badge {
  color: var(--inv);
  background: transparent;
  border-color: color-mix(in srgb, var(--inv) 40%, transparent);
}
.node-head > .icon {
  width: 17px;
  height: 17px;
  color: var(--muted);
}
.start .node-head > .icon {
  color: var(--inv);
}
.node-art {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
  margin: 15px 0 6px;
}
.start .node-art,
[data-theme="dark"] .node:not(.start) .node-art {
  filter: invert(1);
}
[data-theme="dark"] .start .node-art {
  filter: none;
}
.node-title {
  font: 500 28px/1.12 var(--pixel);
  letter-spacing: -0.04em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 0 6px;
}
.node-sub {
  font: 12px/1.5 var(--mono);
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.start .node-sub {
  color: color-mix(in srgb, var(--inv) 75%, transparent);
}
.port {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--border);
  background: var(--paper);
  border-radius: 50%;
  pointer-events: none;
}
.ports { display: contents; }
.port.left, .port.right { top: 50%; transform: translateY(-50%); }
.port.top, .port.bottom { left: 50%; transform: translateX(-50%); }
.port.left { left: -5px; }
.port.right { right: -5px; }
.port.top { top: -5px; }
.port.bottom { bottom: -5px; }
.start .port {
  background: var(--ink);
}
.small-action {
  position: absolute;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0;
}
.small-action .icon {
  width: 14px;
  height: 14px;
}
.add {
  right: -13px;
  top: calc(50% - 12px);
}
.remove {
  top: 12px;
  right: 14px;
  opacity: 0;
}
.node:hover .remove,
.node:focus-within .remove {
  opacity: 1;
}
@media (hover: none) {
  .remove {
    opacity: 1;
  }
}
.dock {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--inv);
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 5px 6px;
  box-shadow: 0 4px 12px #0002;
  white-space: nowrap;
}
.dock button {
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: 13px var(--mono);
  min-height: 36px;
  padding: 0 13px;
  border-radius: 22px;
}
.dock strong {
  font-weight: normal;
}
.dock button:hover {
  background: color-mix(in srgb, var(--inv) 14%, transparent);
}
.dock i {
  width: 1px;
  height: 20px;
  background: color-mix(in srgb, var(--inv) 30%, transparent);
}
.dock #theme {
  padding: 0 11px;
}
.dock .icon {
  width: 18px;
  height: 18px;
}
dialog {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--border);
  padding: 0;
  border-radius: 14px;
  width: min(425px, calc(100vw - 28px));
  max-height: 85dvh;
  box-shadow: 5px 6px 0 #0003;
}
dialog::backdrop {
  background: #17171740;
  backdrop-filter: blur(2px);
}
#dialog-body {
  padding: 26px;
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.dialog-head h2 {
  margin: 0;
  font: 500 29px/1.1 var(--pixel);
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}
.dialog-head .plain {
  margin: -4px -5px 0 0;
}
.dialog-kicker {
  font: 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 10px;
}
.plain {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  min-width: 33px;
  height: 33px;
  color: var(--muted);
}
.plain:hover,
.row-select:hover {
  background: var(--soft);
  color: var(--ink);
}
form {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 41px;
  background: var(--bg);
  padding: 8px 10px;
  color: var(--ink);
  font-size: 16px;
}
.primary,
.secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  text-decoration: none;
  border-radius: 7px;
  padding: 9px 14px;
  font-size: 14px;
}
.primary {
  background: var(--ink);
  color: var(--inv);
}
.secondary {
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
}
.primary .icon,
.secondary .icon {
  width: 16px;
  height: 16px;
}
.primary:disabled {
  opacity: 0.5;
}
.detail-sub,
.info {
  color: var(--muted);
  font: 13px/1.6 var(--mono);
  overflow-wrap: anywhere;
}
.detail-sub {
  margin: -5px 0 20px;
}
.form-error {
  font-size: 13px;
  margin: 0;
  color: var(--ink);
}
.form-error:empty {
  display: none;
}
.space-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--soft);
  gap: 4px;
}
.row-select {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border-radius: 6px;
  flex: 1;
  padding: 9px 4px;
  min-width: 0;
  word-break: break-word;
}
.row-select .icon {
  width: 17px;
}
.space-list + .primary,
.detail-actions {
  margin-top: 15px;
}
.detail-actions {
  display: grid;
  gap: 8px;
}
#notice {
  position: fixed;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px 14px;
  font: 13px/1.45 var(--mono);
  max-width: min(90vw, 440px);
  width: max-content;
  z-index: 3;
}
#notice:empty {
  display: none;
}
.empty-add {
  margin: 15px 0 0;
}
.pin {
  letter-spacing: 0.35em;
  font-family: var(--mono);
}
@media (max-width: 650px) {
  .space-switch {
    left: 16px;
    top: 16px;
    min-height: 50px;
    gap: 10px;
  }
  .space-mark {
    width: 32px;
    height: 32px;
  }
  .space-copy strong {
    font-size: 16px;
  }
  .space-copy small {
    font-size: 9px;
  }
  .dock {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
  #cover.mobile {
    width: 330px;
  }
  .mobile .hero-art {
    width: 93px;
    float: right;
    margin: 18px 4px 0 0;
  }
  .mobile h1 {
    font-size: 44px;
    max-width: 220px;
    margin: 9px 0 10px;
  }
  .mobile .cover-kicker {
    font-size: 10px;
  }
  .mobile .cover-meta {
    font-size: 11px;
  }
  .remove {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
.node-title.compact-title {
  font-size: 23px;
  line-height: 1.08;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  flex-shrink: 0;
}
.node:has(.compact-title) .node-art {
  width: 29px;
  height: 29px;
  margin: 12px 0 5px;
}
.node .node-sub {
  flex-shrink: 0;
}
.node:has(.compact-title) {
  padding-bottom: 10px;
}
.node:has(.compact-title) .node-title {
  margin-bottom: 3px;
}

#link-prompt:not([hidden]) {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: calc(100vw - 28px);
  padding: 8px 10px 8px 17px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--inv);
  box-shadow: 0 3px 12px #0002;
  font: 14px/1.45 var(--mono);
}
#link-instruction { overflow-wrap: anywhere; }
#cancel-link {
  color: inherit;
  padding: 8px 10px;
  border: 1px solid currentColor;
  border-radius: 8px;
}
.picking-link .dock, .picking-link .small-action { display: none; }
.picking-link .node { cursor: pointer; }
.picking-link .node.link-source {
  cursor: default;
  box-shadow: 0 0 0 3px var(--ink), 3px 4px 0 var(--shadow);
}
.picking-link .node.link-unavailable { opacity: .4; cursor: default; }
.picking-link .edge-hit { pointer-events: none; }
.edge-grip { visibility: hidden; }
.teacher .edge:hover .edge-grip { visibility: visible; }
.grip-hit { fill: transparent; pointer-events: visibleFill; cursor: grab; }
.grip-dot { fill: var(--paper); stroke: var(--ink); stroke-width: 1.7; pointer-events: none; }
#canvas.rewiring, #canvas.rewiring * { cursor: grabbing; }
#canvas.rewiring .edge-grip, .picking-link .edge-grip { display: none; }
.rewiring .loose-edge .wire { stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 5 3; }
.node.rewire-target { box-shadow: 0 0 0 3px var(--ink), 3px 4px 0 var(--shadow); }
