:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --todo: #475569;
  --todo-bg: #1e293b;
  --progress: #f59e0b;
  --progress-bg: #422006;
  --done: #22c55e;
  --done-bg: #14532d;
  --font: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.layout {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

header p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.mode-4 { background: #0c4a6e; color: #7dd3fc; }

.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.toolbar button, .toolbar a {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
}

.toolbar button:hover, .toolbar a:hover {
  border-color: var(--accent);
}

main {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
}

aside {
  border-right: 1px solid var(--border);
  padding: 1rem;
  overflow: auto;
  background: #121820;
}

aside h2 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

aside pre {
  margin: 0 0 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow: auto;
  white-space: pre-wrap;
}

.syntax-key { color: #86efac; }
.syntax-comment { color: var(--muted); }

.legend {
  display: grid;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.canvas-wrap {
  position: relative;
  overflow: auto;
  padding: 2rem;
  background:
    radial-gradient(circle at 50% 50%, #1a2332 0%, transparent 70%),
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
}

.roadmap {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: min-content;
  padding: 1rem 0;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

.column.parallel {
  padding: 0.5rem;
  border: 1px dashed #475569;
  border-radius: 12px;
  background: rgba(15, 20, 25, 0.5);
  position: relative;
}

.column.parallel::before {
  content: "параллельно";
  position: absolute;
  top: -10px;
  left: 12px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--bg);
  padding: 0 0.35rem;
}

.arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  flex-shrink: 0;
  font-size: 1.5rem;
  color: var(--muted);
  user-select: none;
}

.stage {
  width: 220px;
  padding: 1rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: default;
}

.stage:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.stage.status-todo {
  border-color: var(--todo);
  background: var(--todo-bg);
}

.stage.status-progress {
  border-color: var(--progress);
  background: var(--progress-bg);
}

.stage.status-done {
  border-color: var(--done);
  background: var(--done-bg);
}

.stage-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.stage h3 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.3;
}

.stage-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-todo .stage-badge { background: #334155; color: #94a3b8; }
.status-progress .stage-badge { background: #78350f; color: #fcd34d; }
.status-done .stage-badge { background: #166534; color: #86efac; }

.stage-desc {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
}

.stage.is-highlight {
  box-shadow: 0 0 0 2px var(--accent);
}

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  aside { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .roadmap { flex-direction: column; align-items: stretch; }
  .arrow { transform: rotate(90deg); width: auto; height: 32px; }
  .stage { width: 100%; }
}
